[roll] Update third-party dart packages
Updated:
Change-Id: I82732016b92a7a70eb537cf415a8ab41f595afe2
diff --git a/analyzer/BUILD.gn b/analyzer/BUILD.gn
index 53de368..d3757b8 100644
--- a/analyzer/BUILD.gn
+++ b/analyzer/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for analyzer-0.35.4
+# This file is generated by importer.py for analyzer-0.36.3
import("//build/dart/dart_library.gni")
@@ -13,19 +13,20 @@
deps = [
"//third_party/dart-pkg/pub/kernel",
- "//third_party/dart-pkg/pub/convert",
"//third_party/dart-pkg/pub/args",
- "//third_party/dart-pkg/pub/front_end",
- "//third_party/dart-pkg/pub/pub_semver",
"//third_party/dart-pkg/pub/glob",
"//third_party/dart-pkg/pub/package_config",
- "//third_party/dart-pkg/pub/crypto",
"//third_party/dart-pkg/pub/collection",
"//third_party/dart-pkg/pub/watcher",
- "//third_party/dart-pkg/pub/yaml",
"//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/path",
"//third_party/dart-pkg/pub/source_span",
+ "//third_party/dart-pkg/pub/convert",
+ "//third_party/dart-pkg/pub/front_end",
+ "//third_party/dart-pkg/pub/pub_semver",
+ "//third_party/dart-pkg/pub/crypto",
+ "//third_party/dart-pkg/pub/yaml",
+ "//third_party/dart-pkg/pub/html",
"//third_party/dart-pkg/pub/charcode",
]
}
diff --git a/analyzer/CHANGELOG.md b/analyzer/CHANGELOG.md
index e376b96..19b5b21 100644
--- a/analyzer/CHANGELOG.md
+++ b/analyzer/CHANGELOG.md
@@ -1,3 +1,62 @@
+## 0.36.3
+* Deprecated `AstFactory.compilationUnit`. In a future analyzer release, this
+ method will be changed so that all its parameters are named parameters.
+ Clients wishing to prepare for this should switch to using
+ `AstFactory.compilationUnit2`.
+* Deprecated Parser setters `enableControlFlowCollections`, `enableNonNullable`,
+ `enableSpreadCollections`, and `enableTripleShift`, as well as the
+ recently-introduced method `configureFeatures`. Parsers should now be
+ configured by passing a FeatureSet object to the Parser constructor.
+* Deprecated `AnalysisError.isStaticOnly`.
+* Deprecated `AnalysisError.offset` setter.
+* Added method `LinterContext.canBeConstConstructor`.
+* Bug fixes: #36732, #36775.
+
+## 0.36.2
+* Bug fixes: #36724.
+
+## 0.36.1
+* Deprecated `DartType.isUndefined`, and now it always returns `false`.
+* The "UI as code" features (control_flow_collections and spread_collections)
+ are now enabled.
+* Bug fixes: #32918, #36262, #36380, #36439, #36492, #36529, #36576, #36667,
+ #36678, #36691.
+
+## 0.36.0
+* Changed the return type of `Expression.precendence` to `Precedence`. Clients
+ that prepared for this change by switching to `Expression.precedence2` should
+ now return to using `Expression.precedence`.
+* AST cleanup related to the "UI as code" feature:
+ * Removed the following AST node types:
+ * `ForEachStatement` (use `ForStatement` instead)
+ * `MapLiteral` and `MapLiteral2` (use `SetOrMapLiteral` instead)
+ * `SetLiteral` and `SetLiteral2` (use `SetOrMapLiteral` instead)
+ * `ListLiteral2` (use `ListLiteral` instead)
+ * Deprecated `ForStatement2` (use `ForStatement` instead)
+ * Removed the following visit methods:
+ * `visitForEachStatement` (override `visitForStatement` instead)
+ * `visitMapLiteral` and `visitMapLiteral2` (override `visitSetOrMapLiteral`
+ instead)
+ * `visitSetLiteral` and `visitSetLiteral2` (override `visitSetOrMapLiteral`
+ instead)
+ * `visitListLiteral2` (override `visitListLiteral` instead)
+ * Deprecated the `visitForStatement2` visit method (use `VisitForStatement`
+ instead)
+ * Removed the following AstFactory methods:
+ * `mapLiteral` and `mapLiteral2` (use `setOrMapLiteral` instead)
+ * `setLiteral` and `setLiteral2` (use `setOrMapLiteral` instead)
+ * `listLiteral2` (use `listLiteral` instead)
+ * Deprecated `AstFactory.forStatement2`, and introduced
+ `AstFactory.forStatement` to replace it
+ * Changed the type of the getter `ListLiteral.elements` to
+ `NodeList<CollectionElement>`
+ * Deprecated `ListLiteral.elements2` (use `ListLiteral.elements` instead)
+ * Deprecated `SetOrMapLiteral.elements2`, and introduced
+ `SetOrMapLiteral.elements` to replace it
+ * Deprecated `NodeLintRegistry.addForStatement2` (use
+ `NodeLintRegistry.addForStatement` instead)
+* Bug fixes: #36158, #36212, #36255
+
## 0.35.4
* Deprecated AST structures that will no longer be used after the
control_flow_collections and spread_collections experiments are enabled. The
diff --git a/analyzer/lib/analyzer.dart b/analyzer/lib/analyzer.dart
index 3516414..0e8a271 100644
--- a/analyzer/lib/analyzer.dart
+++ b/analyzer/lib/analyzer.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -7,6 +7,7 @@
import 'dart:io';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
@@ -40,9 +41,14 @@
/// If [parseFunctionBodies] is [false] then only function signatures will be
/// parsed.
CompilationUnit parseCompilationUnit(String contents,
- {String name, bool suppressErrors: false, bool parseFunctionBodies: true}) {
+ {String name,
+ bool suppressErrors: false,
+ bool parseFunctionBodies: true,
+ FeatureSet featureSet}) {
+ // TODO(paulberry): make featureSet a required parameter
+ featureSet ??= FeatureSet.fromEnableFlags([]);
Source source = new StringSource(contents, name);
- return _parseSource(contents, source,
+ return _parseSource(contents, source, featureSet,
suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies);
}
@@ -54,7 +60,11 @@
/// If [parseFunctionBodies] is [false] then only function signatures will be
/// parsed.
CompilationUnit parseDartFile(String path,
- {bool suppressErrors: false, bool parseFunctionBodies: true}) {
+ {bool suppressErrors: false,
+ bool parseFunctionBodies: true,
+ FeatureSet featureSet}) {
+ // TODO(paulberry): Make featureSet a required parameter
+ featureSet ??= FeatureSet.fromEnableFlags([]);
String contents = new File(path).readAsStringSync();
var sourceFactory = new SourceFactory(
[new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)]);
@@ -68,7 +78,7 @@
throw new ArgumentError("Source $source doesn't exist");
}
- return _parseSource(contents, source,
+ return _parseSource(contents, source, featureSet,
suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies);
}
@@ -83,13 +93,16 @@
/// Throws an [AnalyzerErrorGroup] if any errors occurred, unless
/// [suppressErrors] is `true`, in which case any errors are discarded.
CompilationUnit parseDirectives(String contents,
- {String name, bool suppressErrors: false}) {
+ {String name, bool suppressErrors: false, FeatureSet featureSet}) {
+ // TODO(paulberry): make featureSet a required parameter.
+ featureSet ??= FeatureSet.fromEnableFlags([]);
var source = new StringSource(contents, name);
var errorCollector = new _ErrorCollector();
var reader = new CharSequenceReader(contents);
- var scanner = new Scanner(source, reader, errorCollector);
+ var scanner = new Scanner(source, reader, errorCollector)
+ ..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = new Parser(source, errorCollector);
+ var parser = new Parser(source, errorCollector, featureSet: featureSet);
var unit = parser.parseDirectives(token);
unit.lineInfo = new LineInfo(scanner.lineStarts);
@@ -103,13 +116,15 @@
return literal.stringValue;
}
-CompilationUnit _parseSource(String contents, Source source,
+CompilationUnit _parseSource(
+ String contents, Source source, FeatureSet featureSet,
{bool suppressErrors: false, bool parseFunctionBodies: true}) {
var reader = new CharSequenceReader(contents);
var errorCollector = new _ErrorCollector();
- var scanner = new Scanner(source, reader, errorCollector);
+ var scanner = new Scanner(source, reader, errorCollector)
+ ..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = new Parser(source, errorCollector)
+ var parser = new Parser(source, errorCollector, featureSet: featureSet)
..parseFunctionBodies = parseFunctionBodies;
var unit = parser.parseCompilationUnit(token)
..lineInfo = new LineInfo(scanner.lineStarts);
diff --git a/analyzer/lib/context/context_root.dart b/analyzer/lib/context/context_root.dart
index 7625503..df4a4b4 100644
--- a/analyzer/lib/context/context_root.dart
+++ b/analyzer/lib/context/context_root.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/context/declared_variables.dart b/analyzer/lib/context/declared_variables.dart
index c0d7fdf..74dc187 100644
--- a/analyzer/lib/context/declared_variables.dart
+++ b/analyzer/lib/context/declared_variables.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/dart/analysis/analysis_context.dart b/analyzer/lib/dart/analysis/analysis_context.dart
index e24bfc8..6c3728f 100644
--- a/analyzer/lib/dart/analysis/analysis_context.dart
+++ b/analyzer/lib/dart/analysis/analysis_context.dart
@@ -1,77 +1,65 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
-/**
- * A representation of a body of code and the context in which the code is to be
- * analyzed.
- *
- * The body of code is represented as a collection of files and directories, as
- * defined by the list of included paths. If the list of included paths
- * contains one or more directories, then zero or more files or directories
- * within the included directories can be excluded from analysis, as defined by
- * the list of excluded paths.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// A representation of a body of code and the context in which the code is to
+/// be analyzed.
+///
+/// The body of code is represented as a collection of files and directories, as
+/// defined by the list of included paths. If the list of included paths
+/// contains one or more directories, then zero or more files or directories
+/// within the included directories can be excluded from analysis, as defined by
+/// the list of excluded paths.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisContext {
- /**
- * The analysis options used to control the way the code is analyzed.
- */
+ /// The analysis options used to control the way the code is analyzed.
AnalysisOptions get analysisOptions;
- /**
- * Return the context root from which this context was created.
- */
+ /// Return the context root from which this context was created.
ContextRoot get contextRoot;
- /**
- * Return the currently active analysis session.
- */
+ /// Return the currently active analysis session.
AnalysisSession get currentSession;
- /**
- * A list of the absolute, normalized paths of files and directories that
- * will not be analyzed.
- *
- * Deprecated: Use `contextRoot.excludedPaths`.
- */
+ /// A list of the absolute, normalized paths of files and directories that
+ /// will not be analyzed.
+ ///
+ /// Deprecated: Use `contextRoot.excludedPaths`.
@deprecated
List<String> get excludedPaths;
- /**
- * A list of the absolute, normalized paths of files and directories that
- * will be analyzed. If a path in the list represents a file, then that file
- * will be analyzed, even if it is in the list of [excludedPaths]. If path in
- * the list represents a directory, then all of the files contained in that
- * directory, either directly or indirectly, and that are not explicitly
- * excluded by the list of [excludedPaths] will be analyzed.
- *
- * Deprecated: Use `contextRoot.includedPaths`.
- */
+ /// A list of the absolute, normalized paths of files and directories that
+ /// will be analyzed. If a path in the list represents a file, then that file
+ /// will be analyzed, even if it is in the list of [excludedPaths]. If path in
+ /// the list represents a directory, then all of the files contained in that
+ /// directory, either directly or indirectly, and that are not explicitly
+ /// excluded by the list of [excludedPaths] will be analyzed.
+ ///
+ /// Deprecated: Use `contextRoot.includedPaths`.
@deprecated
List<String> get includedPaths;
- /**
- * Return the absolute, normalized paths of all of the files that are
- * contained in this context. These are all of the files that are included
- * directly or indirectly by one or more of the [includedPaths] and that are
- * not excluded by any of the [excludedPaths].
- *
- * Deprecated: Use `contextRoot.analyzedFiles`.
- */
+ /// Return the absolute, normalized paths of all of the files that are
+ /// contained in this context. These are all of the files that are included
+ /// directly or indirectly by one or more of the [includedPaths] and that are
+ /// not excluded by any of the [excludedPaths].
+ ///
+ /// Deprecated: Use `contextRoot.analyzedFiles`.
@deprecated
Iterable<String> analyzedFiles();
- /**
- * Return `true` if the file or directory with the given [path] will be
- * analyzed in this context. A file (or directory) will be analyzed if it is
- * either the same as or contained in one of the [includedPaths] and, if it is
- * is contained in one of the [includedPaths], is not the same as or contained
- * in one of the [excludedPaths].
- *
- * Deprecated: Use `contextRoot.isAnalyzed`.
- */
+ /// Return `true` if the file or directory with the given [path] will be
+ /// analyzed in this context. A file (or directory) will be analyzed if it is
+ /// either the same as or contained in one of the [includedPaths] and, if it
+ /// is contained in one of the [includedPaths], is not the same as or
+ /// contained in one of the [excludedPaths].
+ ///
+ /// Deprecated: Use `contextRoot.isAnalyzed`.
@deprecated
bool isAnalyzed(String path);
}
diff --git a/analyzer/lib/dart/analysis/context_builder.dart b/analyzer/lib/dart/analysis/context_builder.dart
index f99dce5..08cbd34 100644
--- a/analyzer/lib/dart/analysis/context_builder.dart
+++ b/analyzer/lib/dart/analysis/context_builder.dart
@@ -9,39 +9,33 @@
import 'package:analyzer/src/dart/analysis/context_builder.dart';
import 'package:meta/meta.dart';
-/**
- * A utility class used to build an analysis context based on a context root.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// A utility class used to build an analysis context based on a context root.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class ContextBuilder {
- /**
- * Initialize a newly created context builder. If a [resourceProvider] is
- * given, then it will be used to access the file system, otherwise the
- * default resource provider will be used.
- */
+ /// Initialize a newly created context builder. If a [resourceProvider] is
+ /// given, then it will be used to access the file system, otherwise the
+ /// default resource provider will be used.
factory ContextBuilder({ResourceProvider resourceProvider}) =
ContextBuilderImpl;
- /**
- * Return an analysis context corresponding to the given [contextRoot].
- *
- * If a set of [declaredVariables] is provided, the values will be used to map
- * the the variable names found in `fromEnvironment` invocations to the
- * constant value that will be returned. If none is given, then no variables
- * will be defined.
- *
- * If a list of [librarySummaryPaths] is provided, then the summary files at
- * those paths will be used, when possible, when analyzing the libraries
- * contained in the summary files.
- *
- * If an [sdkPath] is provided, and if it is a valid path to a directory
- * containing a valid SDK, then the SDK in the referenced directory will be
- * used when analyzing the code in the context.
- *
- * If an [sdkSummaryPath] is provided, then that file will be used as the
- * summary file for the SDK.
- */
+ /// Return an analysis context corresponding to the given [contextRoot].
+ ///
+ /// If a set of [declaredVariables] is provided, the values will be used to
+ /// map the the variable names found in `fromEnvironment` invocations to the
+ /// constant value that will be returned. If none is given, then no variables
+ /// will be defined.
+ ///
+ /// If a list of [librarySummaryPaths] is provided, then the summary files at
+ /// those paths will be used, when possible, when analyzing the libraries
+ /// contained in the summary files.
+ ///
+ /// If an [sdkPath] is provided, and if it is a valid path to a directory
+ /// containing a valid SDK, then the SDK in the referenced directory will be
+ /// used when analyzing the code in the context.
+ ///
+ /// If an [sdkSummaryPath] is provided, then that file will be used as the
+ /// summary file for the SDK.
AnalysisContext createContext(
{@required ContextRoot contextRoot,
DeclaredVariables declaredVariables,
diff --git a/analyzer/lib/dart/analysis/context_locator.dart b/analyzer/lib/dart/analysis/context_locator.dart
index ce4d07a..d2c4cd3 100644
--- a/analyzer/lib/dart/analysis/context_locator.dart
+++ b/analyzer/lib/dart/analysis/context_locator.dart
@@ -8,39 +8,33 @@
import 'package:analyzer/src/dart/analysis/context_locator.dart';
import 'package:meta/meta.dart';
-/**
- * Determines the list of analysis contexts that can be used to analyze the
- * files and folders that should be analyzed given a list of included files and
- * folders and a list of excluded files and folders.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// Determines the list of analysis contexts that can be used to analyze the
+/// files and folders that should be analyzed given a list of included files and
+/// folders and a list of excluded files and folders.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class ContextLocator {
- /**
- * Initialize a newly created context locator. If a [resourceProvider] is
- * supplied, it will be used to access the file system. Otherwise the default
- * resource provider will be used.
- */
+ /// Initialize a newly created context locator. If a [resourceProvider] is
+ /// supplied, it will be used to access the file system. Otherwise the default
+ /// resource provider will be used.
factory ContextLocator({ResourceProvider resourceProvider}) =
ContextLocatorImpl;
- /**
- * Return a list of the analysis contexts that should be used to analyze the
- * files that are included by the list of [includedPaths] and not excluded by
- * the list of [excludedPaths].
- *
- * If an [optionsFile] is specified, then it is assumed to be the path to the
- * `analysis_options.yaml` (or `.analysis_options`) file that should be used
- * in place of the ones that would be found by looking in the directories
- * containing the context roots.
- *
- * If a [packagesFile] is specified, then it is assumed to be the path to the
- * `.packages` file that should be used in place of the one that would be
- * found by looking in the directories containing the context roots.
- *
- * If the [sdkPath] is specified, then it is used as the path to the root of
- * the SDK that should be used during analysis.
- */
+ /// Return a list of the analysis contexts that should be used to analyze the
+ /// files that are included by the list of [includedPaths] and not excluded by
+ /// the list of [excludedPaths].
+ ///
+ /// If an [optionsFile] is specified, then it is assumed to be the path to the
+ /// `analysis_options.yaml` (or `.analysis_options`) file that should be used
+ /// in place of the ones that would be found by looking in the directories
+ /// containing the context roots.
+ ///
+ /// If a [packagesFile] is specified, then it is assumed to be the path to the
+ /// `.packages` file that should be used in place of the one that would be
+ /// found by looking in the directories containing the context roots.
+ ///
+ /// If the [sdkPath] is specified, then it is used as the path to the root of
+ /// the SDK that should be used during analysis.
@deprecated
List<AnalysisContext> locateContexts(
{@required List<String> includedPaths,
@@ -49,20 +43,18 @@
String packagesFile: null,
String sdkPath: null});
- /**
- * Return a list of the context roots that should be used to analyze the files
- * that are included by the list of [includedPaths] and not excluded by the
- * list of [excludedPaths].
- *
- * If an [optionsFile] is specified, then it is assumed to be the path to the
- * `analysis_options.yaml` (or `.analysis_options`) file that should be used
- * in place of the ones that would be found by looking in the directories
- * containing the context roots.
- *
- * If a [packagesFile] is specified, then it is assumed to be the path to the
- * `.packages` file that should be used in place of the one that would be
- * found by looking in the directories containing the context roots.
- */
+ /// Return a list of the context roots that should be used to analyze the
+ /// files that are included by the list of [includedPaths] and not excluded by
+ /// the list of [excludedPaths].
+ ///
+ /// If an [optionsFile] is specified, then it is assumed to be the path to the
+ /// `analysis_options.yaml` (or `.analysis_options`) file that should be used
+ /// in place of the ones that would be found by looking in the directories
+ /// containing the context roots.
+ ///
+ /// If a [packagesFile] is specified, then it is assumed to be the path to the
+ /// `.packages` file that should be used in place of the one that would be
+ /// found by looking in the directories containing the context roots.
List<ContextRoot> locateRoots(
{@required List<String> includedPaths,
List<String> excludedPaths: null,
diff --git a/analyzer/lib/dart/analysis/context_root.dart b/analyzer/lib/dart/analysis/context_root.dart
index a8998fe..ccb15b5 100644
--- a/analyzer/lib/dart/analysis/context_root.dart
+++ b/analyzer/lib/dart/analysis/context_root.dart
@@ -4,79 +4,58 @@
import 'package:analyzer/file_system/file_system.dart';
-/**
- * Information about the root directory associated with an analysis context.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// Information about the root directory associated with an analysis context.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class ContextRoot {
- /**
- * A list of the files and directories within the root directory that should
- * not be analyzed.
- */
+ /// A list of the files and directories within the root directory that should
+ /// not be analyzed.
List<Resource> get excluded;
- /**
- * A collection of the absolute, normalized paths of files and directories
- * within the root directory that should not be analyzed.
- */
+ /// A collection of the absolute, normalized paths of files and directories
+ /// within the root directory that should not be analyzed.
Iterable<String> get excludedPaths;
- /**
- * A list of the files and directories within the root directory that should
- * be analyzed. If all of the files in the root directory (other than those
- * that are explicitly excluded) should be analyzed, then this list will
- * contain the root directory.
- */
+ /// A list of the files and directories within the root directory that should
+ /// be analyzed. If all of the files in the root directory (other than those
+ /// that are explicitly excluded) should be analyzed, then this list will
+ /// contain the root directory.
List<Resource> get included;
- /**
- * A collection of the absolute, normalized paths of files within the root
- * directory that should be analyzed. If all of the files in the root
- * directory (other than those that are explicitly excluded) should be
- * analyzed, then this collection will contain the path of the root directory.
- */
+ /// A collection of the absolute, normalized paths of files within the root
+ /// directory that should be analyzed. If all of the files in the root
+ /// directory (other than those that are explicitly excluded) should be
+ /// analyzed, then this collection will contain the path of the root
+ /// directory.
Iterable<String> get includedPaths;
- /**
- * The analysis options file that should be used when analyzing the files
- * within this context root, or `null` if there is no options file.
- */
+ /// The analysis options file that should be used when analyzing the files
+ /// within this context root, or `null` if there is no options file.
File get optionsFile;
- /**
- * The packages file that should be used when analyzing the files within this
- * context root, or `null` if there is no options file.
- */
+ /// The packages file that should be used when analyzing the files within this
+ /// context root, or `null` if there is no options file.
File get packagesFile;
- /**
- * The resource provider used to access the file system.
- */
+ /// The resource provider used to access the file system.
ResourceProvider get resourceProvider;
- /**
- * The root directory containing the files to be analyzed.
- */
+ /// The root directory containing the files to be analyzed.
Folder get root;
- /**
- * Return the absolute, normalized paths of all of the files that are
- * contained in this context. These are all of the files that are included
- * directly or indirectly by one or more of the [includedPaths] and that are
- * not excluded by any of the [excludedPaths].
- *
- * Note that the list is not filtered based on the file suffix, so non-Dart
- * files can be returned.
- */
+ /// Return the absolute, normalized paths of all of the files that are
+ /// contained in this context. These are all of the files that are included
+ /// directly or indirectly by one or more of the [includedPaths] and that are
+ /// not excluded by any of the [excludedPaths].
+ ///
+ /// Note that the list is not filtered based on the file suffix, so non-Dart
+ /// files can be returned.
Iterable<String> analyzedFiles();
- /**
- * Return `true` if the file or directory with the given [path] will be
- * analyzed in this context. A file (or directory) will be analyzed if it is
- * either the same as or contained in one of the [includedPaths] and, if it is
- * contained in one of the [includedPaths], is not the same as or contained
- * in one of the [excludedPaths].
- */
+ /// Return `true` if the file or directory with the given [path] will be
+ /// analyzed in this context. A file (or directory) will be analyzed if it is
+ /// either the same as or contained in one of the [includedPaths] and, if it
+ /// is contained in one of the [includedPaths], is not the same as or
+ /// contained in one of the [excludedPaths].
bool isAnalyzed(String path);
}
diff --git a/analyzer/lib/dart/analysis/declared_variables.dart b/analyzer/lib/dart/analysis/declared_variables.dart
index a517582..bcd0d74 100644
--- a/analyzer/lib/dart/analysis/declared_variables.dart
+++ b/analyzer/lib/dart/analysis/declared_variables.dart
@@ -6,67 +6,49 @@
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
-/**
- * An object used to provide access to the values of variables that have been
- * defined on the command line using the `-D` option.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// An object used to provide access to the values of variables that have been
+/// defined on the command line using the `-D` option.
+///
+/// Clients may not extend, implement or mix-in this class.
class DeclaredVariables {
- /**
- * A table mapping the names of declared variables to their values.
- */
+ /// A table mapping the names of declared variables to their values.
Map<String, String> _declaredVariables = <String, String>{};
- /**
- * Initialize a newly created set of declared variables in which there are no
- * variables.
- */
+ /// Initialize a newly created set of declared variables in which there are no
+ /// variables.
DeclaredVariables();
- /**
- * Initialize a newly created set of declared variables to define variables
- * whose names are the keys in the give [variableMap] and whose values are the
- * corresponding values from the map.
- */
+ /// Initialize a newly created set of declared variables to define variables
+ /// whose names are the keys in the give [variableMap] and whose values are
+ /// the corresponding values from the map.
DeclaredVariables.fromMap(Map<String, String> variableMap) {
_declaredVariables.addAll(variableMap);
}
- /**
- * Return the names of the variables for which a value has been defined.
- */
+ /// Return the names of the variables for which a value has been defined.
Iterable<String> get variableNames => _declaredVariables.keys;
- /**
- * Add all variables of [other] to this object.
- */
+ /// Add all variables of [other] to this object.
@deprecated
void addAll(DeclaredVariables other) {
_declaredVariables.addAll(other._declaredVariables);
}
- /**
- * Define a variable with the given [name] to have the given [value].
- */
+ /// Define a variable with the given [name] to have the given [value].
@deprecated
void define(String name, String value) {
_declaredVariables[name] = value;
}
- /**
- * Return the raw string value of the variable with the given [name],
- * or `null` of the variable is not defined.
- */
+ /// Return the raw string value of the variable with the given [name],
+ /// or `null` of the variable is not defined.
String get(String name) => _declaredVariables[name];
- /**
- * Return the value of the variable with the given [name] interpreted as a
- * 'boolean' value. If the variable is not defined (or [name] is `null`), a
- * DartObject representing "unknown" is returned. If the value cannot be
- * parsed as a boolean, a DartObject representing 'null' is returned. The
- * [typeProvider] is the type provider used to find the type 'bool'.
- */
+ /// Return the value of the variable with the given [name] interpreted as a
+ /// 'boolean' value. If the variable is not defined (or [name] is `null`), a
+ /// DartObject representing "unknown" is returned. If the value cannot be
+ /// parsed as a boolean, a DartObject representing 'null' is returned. The
+ /// [typeProvider] is the type provider used to find the type 'bool'.
DartObject getBool(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
@@ -80,12 +62,10 @@
return new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE);
}
- /**
- * Return the value of the variable with the given [name] interpreted as an
- * integer value. If the variable is not defined (or [name] is `null`), a
- * DartObject representing "unknown" is returned. If the value cannot be
- * parsed as an integer, a DartObject representing 'null' is returned.
- */
+ /// Return the value of the variable with the given [name] interpreted as an
+ /// integer value. If the variable is not defined (or [name] is `null`), a
+ /// DartObject representing "unknown" is returned. If the value cannot be
+ /// parsed as an integer, a DartObject representing 'null' is returned.
DartObject getInt(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
@@ -100,14 +80,12 @@
return new DartObjectImpl(typeProvider.intType, new IntState(bigInteger));
}
- /**
- * Return the value of the variable with the given [name] interpreted as a
- * String value, or `null` if the variable is not defined. Return the value of
- * the variable with the given name interpreted as a String value. If the
- * variable is not defined (or [name] is `null`), a DartObject representing
- * "unknown" is returned. The [typeProvider] is the type provider used to find
- * the type 'String'.
- */
+ /// Return the value of the variable with the given [name] interpreted as a
+ /// String value, or `null` if the variable is not defined. Return the value
+ /// of the variable with the given name interpreted as a String value. If the
+ /// variable is not defined (or [name] is `null`), a DartObject representing
+ /// "unknown" is returned. The [typeProvider] is the type provider used to
+ /// find the type 'String'.
DartObject getString(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
diff --git a/analyzer/lib/dart/analysis/features.dart b/analyzer/lib/dart/analysis/features.dart
new file mode 100644
index 0000000..6841054
--- /dev/null
+++ b/analyzer/lib/dart/analysis/features.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:meta/meta.dart';
+import 'package:pub_semver/pub_semver.dart';
+
+/// Information about a single language feature whose presence or absence
+/// depends on the supported Dart SDK version, and possibly on the presence of
+/// experimental flags.
+abstract class Feature {
+ /// Feature information for the 2018 constant update.
+ static const constant_update_2018 = ExperimentalFeatures.constant_update_2018;
+
+ /// Feature information for non-nullability by default.
+ static const non_nullable = ExperimentalFeatures.non_nullable;
+
+ /// Feature information for control flow collections.
+ static const control_flow_collections =
+ ExperimentalFeatures.control_flow_collections;
+
+ /// Feature information for spread collections.
+ static const spread_collections = ExperimentalFeatures.spread_collections;
+
+ /// Feature information for set literals.
+ static const set_literals = ExperimentalFeatures.set_literals;
+
+ /// Feature information for the triple-shift operator.
+ static const triple_shift = ExperimentalFeatures.triple_shift;
+
+ /// If the feature may be enabled or disabled on the command line, the
+ /// experimental flag that may be used to enable it. Otherwise `null`.
+ ///
+ /// Should be `null` if [status] is `current` or `abandoned`.
+ String get experimentalFlag;
+
+ /// If [status] is not `future`, the first version of the Dart SDK in which
+ /// the given feature was supported. Otherwise `null`.
+ Version get firstSupportedVersion;
+
+ /// The status of the feature.
+ FeatureStatus get status;
+}
+
+/// An unordered collection of [Feature] objects.
+abstract class FeatureSet {
+ /// Computes a set of features for use in a unit test. Computes the set of
+ /// features enabled in [sdkVersion], plus any specified [additionalFeatures].
+ ///
+ /// If [sdkVersion] is not supplied (or is `null`), then the current set of
+ /// enabled features is used as the starting point.
+ @visibleForTesting
+ factory FeatureSet.forTesting(
+ {String sdkVersion, List<Feature> additionalFeatures}) =
+ // ignore: invalid_use_of_visible_for_testing_member
+ ExperimentStatus.forTesting;
+
+ /// Computes the set of features implied by the given set of experimental
+ /// enable flags.
+ factory FeatureSet.fromEnableFlags(List<String> flags) =
+ ExperimentStatus.fromStrings;
+
+ /// Queries whether the given [feature] is contained in this feature set.
+ bool isEnabled(Feature feature);
+
+ /// Computes a subset of this FeatureSet by removing any features that weren't
+ /// available in the given Dart SDK version.
+ FeatureSet restrictToVersion(Version version);
+}
+
+/// Information about the status of a language feature.
+enum FeatureStatus {
+ /// The language feature has not yet shipped. It may not be used unless an
+ /// experimental flag is used to enable it.
+ future,
+
+ /// The language feature has not yet shipped, but we are testing the effect of
+ /// enabling it by default. It may be used in any library with an appopriate
+ /// version constraint, unless an experimental flag is used to disable it.
+ provisional,
+
+ /// The language feature has been shipped. It may be used in any library with
+ /// an appropriate version constraint.
+ current,
+
+ /// The language feature is no longer planned. It may not be used.
+ abandoned,
+}
diff --git a/analyzer/lib/dart/analysis/uri_converter.dart b/analyzer/lib/dart/analysis/uri_converter.dart
index ec1ed8d..a93d045 100644
--- a/analyzer/lib/dart/analysis/uri_converter.dart
+++ b/analyzer/lib/dart/analysis/uri_converter.dart
@@ -2,29 +2,25 @@
// 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.
-/**
- * A utility class used to convert between URIs and absolute file paths.
- */
+/// A utility class used to convert between URIs and absolute file paths.
abstract class UriConverter {
- /**
- * Return the URI that should be used to reference the file at the absolute
- * [path], or `null` if there is no valid way to reference the file in this
- * converter’s context. The file at that path is not required to exist.
- *
- * If a [containingPath] is provided and both the [path] and [containingPath]
- * are within the root of this converter’s context, then the returned URI will
- * be a relative path. Otherwise, the returned URI will be an absolute URI.
- *
- * Throws an `ArgumentError` if the [path] is `null` or is not a valid
- * absolute file path.
- */
+ /// Return the URI that should be used to reference the file at the absolute
+ /// [path], or `null` if there is no valid way to reference the file in this
+ /// converter’s context. The file at that path is not required to exist.
+ ///
+ /// If a [containingPath] is provided and both the [path] and [containingPath]
+ /// are within the root of this converter’s context, then the returned URI
+ /// will be a relative path. Otherwise, the returned URI will be an absolute
+ /// URI.
+ ///
+ /// Throws an `ArgumentError` if the [path] is `null` or is not a valid
+ /// absolute file path.
Uri pathToUri(String path, {String containingPath});
- /**
- * Return the absolute path of the file to which the absolute [uri] resolves,
- * or `null` if the [uri] cannot be resolved in this converter’s context.
- *
- * Throws an `ArgumentError` if the [uri] is `null` or is not an absolute URI.
- */
+ /// Return the absolute path of the file to which the absolute [uri] resolves,
+ /// or `null` if the [uri] cannot be resolved in this converter’s context.
+ ///
+ /// Throws an `ArgumentError` if the [uri] is `null` or is not an absolute
+ /// URI.
String uriToPath(Uri uri);
}
diff --git a/analyzer/lib/dart/ast/ast.dart b/analyzer/lib/dart/ast/ast.dart
index b2ce8fa..f233ef1 100644
--- a/analyzer/lib/dart/ast/ast.dart
+++ b/analyzer/lib/dart/ast/ast.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:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/precedence.dart';
/// Defines the AST model. The AST (Abstract Syntax Tree) model describes the
@@ -507,9 +508,6 @@
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node);
- @Deprecated('Replaced by visitForStatement2')
- R visitForEachStatement(ForEachStatement node);
-
R visitForElement(ForElement node);
R visitFormalParameterList(FormalParameterList node);
@@ -518,9 +516,9 @@
R visitForPartsWithExpression(ForPartsWithExpression node);
- @Deprecated('Replaced by visitForStatement2')
R visitForStatement(ForStatement node);
+ @Deprecated('Replaced by visitForStatement')
R visitForStatement2(ForStatement2 node);
R visitFunctionDeclaration(FunctionDeclaration node);
@@ -571,15 +569,6 @@
R visitListLiteral(ListLiteral node);
- @Deprecated('Replaced by visitListLiteral')
- R visitListLiteral2(ListLiteral2 node);
-
- @Deprecated('Replaced by visitSetOrMapLiteral')
- R visitMapLiteral(MapLiteral node);
-
- @Deprecated('Replaced by visitSetOrMapLiteral')
- R visitMapLiteral2(MapLiteral2 node);
-
R visitMapLiteralEntry(MapLiteralEntry node);
R visitMethodDeclaration(MethodDeclaration node);
@@ -621,12 +610,6 @@
R visitScriptTag(ScriptTag node);
- @Deprecated('Replaced by visitSetOrMapLiteral')
- R visitSetLiteral(SetLiteral node);
-
- @Deprecated('Replaced by visitSetOrMapLiteral')
- R visitSetLiteral2(SetLiteral2 node);
-
R visitSetOrMapLiteral(SetOrMapLiteral node);
R visitShowCombinator(ShowCombinator node);
@@ -1241,6 +1224,17 @@
/// [token].
void set endToken(Token token);
+ /// The set of features available to this compilation unit, or `null` if
+ /// unknown.
+ ///
+ /// Determined by some combination of the .packages file, the enclosing
+ /// package's SDK version constraint, and/or the presence of a `@dart`
+ /// directive in a comment at the top of the file.
+ ///
+ /// Might be `null` if, for example, this [CompilationUnit] has been
+ /// resynthesized from a summary,
+ FeatureSet get featureSet;
+
/// Return the line information for this compilation unit.
LineInfo get lineInfo;
@@ -1983,14 +1977,13 @@
/// integer value that defines how the source code is parsed into an AST. For
/// example `a * b + c` is parsed as `(a * b) + c` because the precedence of
/// `*` is greater than the precedence of `+`.
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
- int get precedence;
+ Precedence get precedence;
/// Return the precedence of this expression. The precedence is a positive
/// integer value that defines how the source code is parsed into an AST. For
/// example `a * b + c` is parsed as `(a * b) + c` because the precedence of
/// `*` is greater than the precedence of `+`.
+ @Deprecated('Use precedence')
Precedence get precedence2;
/// If this expression is an argument to an invocation, and the AST structure
@@ -2239,63 +2232,6 @@
SimpleIdentifier get identifier;
}
-/// A for-each statement.
-///
-/// forEachStatement ::=
-/// 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block]
-/// | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block]
-///
-/// This is the class that is used to represent a for-each loop when neither the
-/// 'control-flow-collections' nor 'spread-collections' experiments are enabled.
-/// If either of those experiments are enabled, then [ForStatement2] will be
-/// used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by ForStatement2')
-abstract class ForEachStatement implements ForStatement2 {
- /// Set the token representing the 'await' keyword to the given [token].
- void set awaitKeyword(Token token);
-
- /// Set the body of the loop to the given [statement].
- void set body(Statement statement);
-
- /// Set the token representing the 'for' keyword to the given [token].
- void set forKeyword(Token token);
-
- /// Return the loop variable, or `null` if the loop variable is declared in
- /// the 'for'.
- SimpleIdentifier get identifier;
-
- /// Set the loop variable to the given [identifier].
- void set identifier(SimpleIdentifier identifier);
-
- /// Return the token representing the 'in' keyword.
- Token get inKeyword;
-
- /// Set the token representing the 'in' keyword to the given [token].
- void set inKeyword(Token token);
-
- /// Return the expression evaluated to produce the iterator.
- Expression get iterable;
-
- /// Set the expression evaluated to produce the iterator to the given
- /// [expression].
- void set iterable(Expression expression);
-
- /// Set the left parenthesis to the given [token].
- void set leftParenthesis(Token token);
-
- /// Return the declaration of the loop variable, or `null` if the loop
- /// variable is a simple identifier.
- DeclaredIdentifier get loopVariable;
-
- /// Set the declaration of the loop variable to the given [variable].
- void set loopVariable(DeclaredIdentifier variable);
-
- /// Set the right parenthesis to the given [token].
- void set rightParenthesis(Token token);
-}
-
/// The basic structure of a for element.
///
/// Clients may not extend, implement or mix-in this class.
@@ -2365,15 +2301,17 @@
/// even though they are implicitly final.
bool get isFinal;
- /// Return `true` if this parameter is a named parameter. Named parameters are
- /// always optional, even when they are annotated with the `@required`
- /// annotation.
+ /// Return `true` if this parameter is a named parameter. Named parameters can
+ /// either be required or optional.
bool get isNamed;
/// Return `true` if this parameter is an optional parameter. Optional
/// parameters can either be positional or named.
bool get isOptional;
+ /// Return `true` if this parameter is both an optional and named parameter.
+ bool get isOptionalNamed;
+
/// Return `true` if this parameter is both an optional and positional
/// parameter.
bool get isOptionalPositional;
@@ -2383,18 +2321,31 @@
bool get isPositional;
/// Return `true` if this parameter is a required parameter. Required
- /// parameters are always positional.
+ /// parameters can either be positional or named.
///
- /// Note: this will return `false` for a named parameter that is annotated with
- /// the `@required` annotation.
+ /// Note: this will return `false` for a named parameter that is annotated
+ /// with the `@required` annotation.
bool get isRequired;
+ /// Return `true` if this parameter is both a required and named parameter.
+ ///
+ /// Note: this will return `false` for a named parameter that is annotated
+ /// with the `@required` annotation.
+ bool get isRequiredNamed;
+
+ /// Return `true` if this parameter is both a required and positional
+ /// parameter.
+ bool get isRequiredPositional;
+
/// Return the kind of this parameter.
@deprecated
ParameterKind get kind;
/// Return the annotations associated with this parameter.
NodeList<Annotation> get metadata;
+
+ /// The 'required' keyword, or `null` if the keyword was not used.
+ Token get requiredKeyword;
}
/// The formal parameter list of a method declaration, function declaration, or
@@ -2511,78 +2462,6 @@
Expression get initialization;
}
-/// A for statement.
-///
-/// forStatement ::=
-/// 'for' '(' forLoopParts ')' [Statement]
-///
-/// forLoopParts ::=
-/// forInitializerStatement ';' [Expression]? ';' [Expression]?
-///
-/// forInitializerStatement ::=
-/// [DefaultFormalParameter]
-/// | [Expression]?
-///
-/// This is the class that is used to represent a for loop when neither the
-/// 'control-flow-collections' nor 'spread-collections' experiments are enabled.
-/// If either of those experiments are enabled, then [ForStatement2] will be
-/// used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by ForStatement2')
-abstract class ForStatement implements ForStatement2 {
- /// Set the body of the loop to the given [statement].
- void set body(Statement statement);
-
- /// Return the condition used to determine when to terminate the loop, or
- /// `null` if there is no condition.
- Expression get condition;
-
- /// Set the condition used to determine when to terminate the loop to the
- /// given [expression].
- void set condition(Expression expression);
-
- /// Set the token representing the 'for' keyword to the given [token].
- void set forKeyword(Token token);
-
- /// Return the initialization expression, or `null` if there is no
- /// initialization expression.
- Expression get initialization;
-
- /// Set the initialization expression to the given [expression].
- void set initialization(Expression initialization);
-
- /// Set the left parenthesis to the given [token].
- void set leftParenthesis(Token token);
-
- /// Return the semicolon separating the initializer and the condition.
- Token get leftSeparator;
-
- /// Set the semicolon separating the initializer and the condition to the
- /// given [token].
- void set leftSeparator(Token token);
-
- /// Set the right parenthesis to the given [token].
- void set rightParenthesis(Token token);
-
- /// Return the semicolon separating the condition and the updater.
- Token get rightSeparator;
-
- /// Set the semicolon separating the condition and the updater to the given
- /// [token].
- void set rightSeparator(Token token);
-
- /// Return the list of expressions run after each execution of the loop body.
- NodeList<Expression> get updaters;
-
- /// Return the declaration of the loop variables, or `null` if there are no
- /// variables.
- VariableDeclarationList get variables;
-
- /// Set the declaration of the loop variables to the given [variableList].
- void set variables(VariableDeclarationList variableList);
-}
-
/// A for or for-each statement.
///
/// forStatement ::=
@@ -2600,7 +2479,7 @@
/// `ForEachStatement` will be used.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class ForStatement2 implements Statement {
+abstract class ForStatement implements Statement {
/// Return the token representing the 'await' keyword, or `null` if there is
/// no 'await' keyword.
Token get awaitKeyword;
@@ -2621,6 +2500,26 @@
Token get rightParenthesis;
}
+/// A for or for-each statement.
+///
+/// forStatement ::=
+/// 'for' '(' forLoopParts ')' [Statement]
+///
+/// forLoopParts ::=
+/// [VariableDeclaration] ';' [Expression]? ';' expressionList?
+/// | [Expression]? ';' [Expression]? ';' expressionList?
+/// | [DeclaredIdentifier] 'in' [Expression]
+/// | [SimpleIdentifier] 'in' [Expression]
+///
+/// This is the class that is used to represent a for loop when either the
+/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
+/// If neither of those experiments are enabled, then either `ForStatement` or
+/// `ForEachStatement` will be used.
+///
+/// Clients may not extend, implement or mix-in this class.
+@Deprecated('Replaced by ForStatement')
+abstract class ForStatement2 extends ForStatement {}
+
/// A node representing the body of a function or method.
///
/// functionBody ::=
@@ -3695,11 +3594,11 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class ListLiteral implements TypedLiteral {
- /// Return the expressions used to compute the elements of the list.
- @Deprecated('Use elements2')
- NodeList<Expression> get elements;
+ /// Return the syntactic elements used to compute the elements of the list.
+ NodeList<CollectionElement> get elements;
/// Return the syntactic elements used to compute the elements of the list.
+ @Deprecated('Replaced by elements')
NodeList<CollectionElement> get elements2;
/// Return the left square bracket.
@@ -3715,38 +3614,6 @@
void set rightBracket(Token token);
}
-/// A list literal.
-///
-/// listLiteral ::=
-/// 'const'? [TypeAnnotationList]? '[' elements? ']'
-///
-/// elements ::=
-/// [CollectionElement] (',' [CollectionElement])* ','?
-///
-/// This is the class that is used to represent a list literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [ListLiteral] will be
-/// used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by ListLiteral')
-abstract class ListLiteral2 implements TypedLiteral {
- /// Return the expressions used to compute the elements of the list.
- NodeList<CollectionElement> get elements;
-
- /// Return the left square bracket.
- Token get leftBracket;
-
- /// Set the left square bracket to the given [token].
- void set leftBracket(Token token);
-
- /// Return the right square bracket.
- Token get rightBracket;
-
- /// Set the right square bracket to the given [token].
- void set rightBracket(Token token);
-}
-
/// A node that represents a literal expression.
///
/// literal ::=
@@ -3761,65 +3628,6 @@
/// Clients may not extend, implement or mix-in this class.
abstract class Literal implements Expression {}
-/// A literal map.
-///
-/// mapLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
-/// '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
-///
-/// This is the class that is used to represent a map literal when neither the
-/// 'control-flow-collections' nor 'spread-collections' experiments are enabled.
-/// If either of those experiments are enabled, then [SetOrMapLiteral] will be
-/// used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by SetOrMapLiteral')
-abstract class MapLiteral implements SetOrMapLiteral {
- /// Return the entries in the map.
- NodeList<MapLiteralEntry> get entries;
-
- /// Return the left curly bracket.
- Token get leftBracket;
-
- /// Set the left curly bracket to the given [token].
- void set leftBracket(Token token);
-
- /// Return the right curly bracket.
- Token get rightBracket;
-
- /// Set the right curly bracket to the given [token].
- void set rightBracket(Token token);
-}
-
-/// A literal map.
-///
-/// mapLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
-/// '{' ([MapElement] (',' [MapElement])* ','?)? '}'
-///
-/// This is the class that is used to represent a map literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [MapLiteral] will be used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by SetOrMapLiteral')
-abstract class MapLiteral2 implements TypedLiteral {
- /// Return the entries in the map.
- NodeList<CollectionElement> get entries;
-
- /// Return the left curly bracket.
- Token get leftBracket;
-
- /// Set the left curly bracket to the given [token].
- void set leftBracket(Token token);
-
- /// Return the right curly bracket.
- Token get rightBracket;
-
- /// Set the right curly bracket to the given [token].
- void set rightBracket(Token token);
-}
-
/// A single key/value pair in a map literal.
///
/// mapLiteralEntry ::=
@@ -4645,67 +4453,6 @@
void set scriptTag(Token token);
}
-/// A literal set.
-///
-/// setLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] '>')?
-/// '{' [Expression] (',' [Expression])* ','? '}'
-/// | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
-///
-/// This is the class that is used to represent a set literal when neither the
-/// 'control-flow-collections' nor 'spread-collections' experiments are enabled.
-/// If either of those experiments are enabled, then [SetOrMapLiteral] will be
-/// used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by SetOrMapLiteral')
-abstract class SetLiteral implements SetOrMapLiteral {
- /// Return the expressions used to compute the elements of the set.
- NodeList<Expression> get elements;
-
- /// Return the left curly bracket.
- Token get leftBracket;
-
- /// Set the left curly bracket to the given [token].
- void set leftBracket(Token token);
-
- /// Return the right curly bracket.
- Token get rightBracket;
-
- /// Set the right curly bracket to the given [token].
- void set rightBracket(Token token);
-}
-
-/// A literal set.
-///
-/// setLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] '>')?
-/// '{' [CollectionElement] (',' [CollectionElement])* ','? '}'
-/// | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
-///
-/// This is the class that is used to represent a set literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [SetLiteral] will be used.
-///
-/// Clients may not extend, implement or mix-in this class.
-@Deprecated('Replaced by SetOrMapLiteral')
-abstract class SetLiteral2 implements TypedLiteral {
- /// Return the expressions used to compute the elements of the set.
- NodeList<CollectionElement> get elements;
-
- /// Return the left curly bracket.
- Token get leftBracket;
-
- /// Set the left curly bracket to the given [token].
- void set leftBracket(Token token);
-
- /// Return the right curly bracket.
- Token get rightBracket;
-
- /// Set the right curly bracket to the given [token].
- void set rightBracket(Token token);
-}
-
/// A set or map literal.
///
/// setOrMapLiteral ::=
@@ -4724,6 +4471,11 @@
abstract class SetOrMapLiteral implements TypedLiteral {
/// Return the syntactic elements used to compute the elements of the set or
/// map.
+ NodeList<CollectionElement> get elements;
+
+ /// Return the syntactic elements used to compute the elements of the set or
+ /// map.
+ @Deprecated('Replaced by elements')
NodeList<CollectionElement> get elements2;
/// Return `true` if this literal represents a map literal.
@@ -5499,6 +5251,9 @@
/// even though they are implicitly final.
bool get isFinal;
+ /// Return `true` if this variable was declared with the 'late' modifier.
+ bool get isLate;
+
/// Return the name of the variable being declared.
SimpleIdentifier get name;
@@ -5512,10 +5267,10 @@
/// finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
///
/// finalConstVarOrType ::=
-/// | 'final' [TypeAnnotation]?
+/// 'final' 'late'? [TypeAnnotation]?
/// | 'const' [TypeAnnotation]?
/// | 'var'
-/// | [TypeAnnotation]
+/// | 'late'? [TypeAnnotation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class VariableDeclarationList implements AnnotatedNode {
@@ -5529,6 +5284,10 @@
/// this is a syntactic check rather than a semantic check.)
bool get isFinal;
+ /// Return `true` if the variables in this list were declared with the 'late'
+ /// modifier.
+ bool get isLate;
+
/// Return the token representing the 'final', 'const' or 'var' keyword, or
/// `null` if no keyword was included.
Token get keyword;
@@ -5537,6 +5296,10 @@
/// given [token].
void set keyword(Token token);
+ /// Return the token representing the 'late' keyword, or `null` if the late
+ /// modifier was not included.
+ Token get lateKeyword;
+
/// Return the type of the variables being declared, or `null` if no type was
/// provided.
TypeAnnotation get type;
diff --git a/analyzer/lib/dart/ast/ast_factory.dart b/analyzer/lib/dart/ast/ast_factory.dart
index b057147..815ad03 100644
--- a/analyzer/lib/dart/ast/ast_factory.dart
+++ b/analyzer/lib/dart/ast/ast_factory.dart
@@ -1,51 +1,40 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:front_end/src/scanner/token.dart';
import 'package:meta/meta.dart';
-/**
- * A collection of factory methods which may be used to create concrete
- * instances of the interfaces that constitute the AST.
- *
- * Clients should not extend, implement or mix-in this class.
- */
+/// A collection of factory methods which may be used to create concrete
+/// instances of the interfaces that constitute the AST.
+///
+/// Clients should not extend, implement or mix-in this class.
abstract class AstFactory {
- /**
- * Returns a newly created list of adjacent strings. To be syntactically
- * valid, the list of [strings] must contain at least two elements.
- */
+ /// Returns a newly created list of adjacent strings. To be syntactically
+ /// valid, the list of [strings] must contain at least two elements.
AdjacentStrings adjacentStrings(List<StringLiteral> strings);
- /**
- * Returns a newly created annotation. Both the [period] and the
- * [constructorName] can be `null` if the annotation is not referencing a
- * named constructor. The [arguments] can be `null` if the annotation is not
- * referencing a constructor.
- */
+ /// Returns a newly created annotation. Both the [period] and the
+ /// [constructorName] can be `null` if the annotation is not referencing a
+ /// named constructor. The [arguments] can be `null` if the annotation is not
+ /// referencing a constructor.
Annotation annotation(Token atSign, Identifier name, Token period,
SimpleIdentifier constructorName, ArgumentList arguments);
- /**
- * Returns a newly created list of arguments. The list of [arguments] can
- * be `null` if there are no arguments.
- */
+ /// Returns a newly created list of arguments. The list of [arguments] can
+ /// be `null` if there are no arguments.
ArgumentList argumentList(Token leftParenthesis, List<Expression> arguments,
Token rightParenthesis);
- /**
- * Returns a newly created as expression.
- */
+ /// Returns a newly created as expression.
AsExpression asExpression(
Expression expression, Token asOperator, TypeAnnotation type);
- /**
- * Returns a newly created assert initializer. The [comma] and [message]
- * can be `null` if there is no message.
- */
+ /// Returns a newly created assert initializer. The [comma] and [message]
+ /// can be `null` if there is no message.
AssertInitializer assertInitializer(
Token assertKeyword,
Token leftParenthesis,
@@ -54,10 +43,8 @@
Expression message,
Token rightParenthesis);
- /**
- * Returns a newly created assert statement. The [comma] and [message] can
- * be `null` if there is no message.
- */
+ /// Returns a newly created assert statement. The [comma] and [message] can
+ /// be `null` if there is no message.
AssertStatement assertStatement(
Token assertKeyword,
Token leftParenthesis,
@@ -67,67 +54,47 @@
Token rightParenthesis,
Token semicolon);
- /**
- * Returns a newly created assignment expression.
- */
+ /// Returns a newly created assignment expression.
AssignmentExpression assignmentExpression(
Expression leftHandSide, Token operator, Expression rightHandSide);
- /**
- * Returns a newly created await expression.
- */
+ /// Returns a newly created await expression.
AwaitExpression awaitExpression(Token awaitKeyword, Expression expression);
- /**
- * Returns a newly created binary expression.
- */
+ /// Returns a newly created binary expression.
BinaryExpression binaryExpression(
Expression leftOperand, Token operator, Expression rightOperand);
- /**
- * Returns a newly created block of code.
- */
+ /// Returns a newly created block of code.
Block block(
Token leftBracket, List<Statement> statements, Token rightBracket);
- /**
- * Returns a block comment consisting of the given [tokens].
- */
+ /// Returns a block comment consisting of the given [tokens].
Comment blockComment(List<Token> tokens);
- /**
- * Returns a newly created function body consisting of a block of
- * statements. The [keyword] can be `null` if there is no keyword specified
- * for the block. The [star] can be `null` if there is no star following the
- * keyword (and must be `null` if there is no keyword).
- */
+ /// Returns a newly created function body consisting of a block of
+ /// statements. The [keyword] can be `null` if there is no keyword specified
+ /// for the block. The [star] can be `null` if there is no star following the
+ /// keyword (and must be `null` if there is no keyword).
BlockFunctionBody blockFunctionBody(Token keyword, Token star, Block block);
- /**
- * Returns a newly created boolean literal.
- */
+ /// Returns a newly created boolean literal.
BooleanLiteral booleanLiteral(Token literal, bool value);
- /**
- * Returns a newly created break statement. The [label] can be `null` if
- * there is no label associated with the statement.
- */
+ /// Returns a newly created break statement. The [label] can be `null` if
+ /// there is no label associated with the statement.
BreakStatement breakStatement(
Token breakKeyword, SimpleIdentifier label, Token semicolon);
- /**
- * Returns a newly created cascade expression. The list of
- * [cascadeSections] must contain at least one element.
- */
+ /// Returns a newly created cascade expression. The list of
+ /// [cascadeSections] must contain at least one element.
CascadeExpression cascadeExpression(
Expression target, List<Expression> cascadeSections);
- /**
- * Returns a newly created catch clause. The [onKeyword] and
- * [exceptionType] can be `null` if the clause will catch all exceptions. The
- * [comma] and [stackTraceParameter] can be `null` if the stack trace
- * parameter is not defined.
- */
+ /// Returns a newly created catch clause. The [onKeyword] and [exceptionType]
+ /// can be `null` if the clause will catch all exceptions. The [comma] and
+ /// [stackTraceParameter] can be `null` if the stack trace parameter is not
+ /// defined.
CatchClause catchClause(
Token onKeyword,
TypeAnnotation exceptionType,
@@ -139,16 +106,14 @@
Token rightParenthesis,
Block body);
- /**
- * Returns a newly created class declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the class does not have the
- * corresponding attribute. The [abstractKeyword] can be `null` if the class
- * is not abstract. The [typeParameters] can be `null` if the class does not
- * have any type parameters. Any or all of the [extendsClause], [withClause],
- * and [implementsClause] can be `null` if the class does not have the
- * corresponding clause. The list of [members] can be `null` if the class does
- * not have any members.
- */
+ /// Returns a newly created class declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the class does not have the
+ /// corresponding attribute. The [abstractKeyword] can be `null` if the class
+ /// is not abstract. The [typeParameters] can be `null` if the class does not
+ /// have any type parameters. Any or all of the [extendsClause], [withClause],
+ /// and [implementsClause] can be `null` if the class does not have the
+ /// corresponding clause. The list of [members] can be `null` if the class
+ /// does not have any members.
ClassDeclaration classDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -163,14 +128,12 @@
List<ClassMember> members,
Token rightBracket);
- /**
- * Returns a newly created class type alias. Either or both of the
- * [comment] and [metadata] can be `null` if the class type alias does not
- * have the corresponding attribute. The [typeParameters] can be `null` if the
- * class does not have any type parameters. The [abstractKeyword] can be
- * `null` if the class is not abstract. The [implementsClause] can be `null`
- * if the class does not implement any interfaces.
- */
+ /// Returns a newly created class type alias. Either or both of the [comment]
+ /// and [metadata] can be `null` if the class type alias does not have the
+ /// corresponding attribute. The [typeParameters] can be `null` if the class
+ /// does not have any type parameters. The [abstractKeyword] can be `null` if
+ /// the class is not abstract. The [implementsClause] can be `null` if the
+ /// class does not implement any interfaces.
ClassTypeAlias classTypeAlias(
Comment comment,
List<Annotation> metadata,
@@ -184,29 +147,41 @@
ImplementsClause implementsClause,
Token semicolon);
- /**
- * Returns a newly created reference to a Dart element. The [newKeyword]
- * can be `null` if the reference is not to a constructor.
- */
+ /// Returns a newly created reference to a Dart element. The [newKeyword]
+ /// can be `null` if the reference is not to a constructor.
CommentReference commentReference(Token newKeyword, Identifier identifier);
- /**
- * Returns a newly created compilation unit to have the given directives
- * and declarations. The [scriptTag] can be `null` if there is no script tag
- * in the compilation unit. The list of [directives] can be `null` if there
- * are no directives in the compilation unit. The list of [declarations] can
- * be `null` if there are no declarations in the compilation unit.
- */
+ /// Returns a newly created compilation unit to have the given directives
+ /// and declarations. The [scriptTag] can be `null` if there is no script tag
+ /// in the compilation unit. The list of [directives] can be `null` if there
+ /// are no directives in the compilation unit. The list of [declarations] can
+ /// be `null` if there are no declarations in the compilation unit.
+ @Deprecated('Use compilationUnit2')
CompilationUnit compilationUnit(
Token beginToken,
ScriptTag scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations,
- Token endToken);
+ Token endToken,
+ [FeatureSet featureSet]);
- /**
- * Returns a newly created conditional expression.
- */
+ /// Returns a newly created compilation unit to have the given directives and
+ /// declarations. The [scriptTag] can be `null` (or omitted) if there is no
+ /// script tag in the compilation unit. The list of [declarations] can be
+ /// `null` (or omitted) if there are no directives in the compilation unit.
+ /// The list of `declarations` can be `null` (or omitted) if there are no
+ /// declarations in the compilation unit. The [featureSet] can be `null` if
+ /// the set of features for this compilation unit is not known (this
+ /// restricts what analysis can be done of the compilation unit).
+ CompilationUnit compilationUnit2(
+ {@required Token beginToken,
+ ScriptTag scriptTag,
+ List<Directive> directives,
+ List<CompilationUnitMember> declarations,
+ @required Token endToken,
+ @required FeatureSet featureSet});
+
+ /// Returns a newly created conditional expression.
ConditionalExpression conditionalExpression(
Expression condition,
Token question,
@@ -214,9 +189,7 @@
Token colon,
Expression elseExpression);
- /**
- * Returns a newly created configuration.
- */
+ /// Returns a newly created configuration.
Configuration configuration(
Token ifKeyword,
Token leftParenthesis,
@@ -226,21 +199,19 @@
Token rightParenthesis,
StringLiteral libraryUri);
- /**
- * Returns a newly created constructor declaration. The [externalKeyword]
- * can be `null` if the constructor is not external. Either or both of the
- * [comment] and [metadata] can be `null` if the constructor does not have the
- * corresponding attribute. The [constKeyword] can be `null` if the
- * constructor cannot be used to create a constant. The [factoryKeyword] can
- * be `null` if the constructor is not a factory. The [period] and [name] can
- * both be `null` if the constructor is not a named constructor. The
- * [separator] can be `null` if the constructor does not have any initializers
- * and does not redirect to a different constructor. The list of
- * [initializers] can be `null` if the constructor does not have any
- * initializers. The [redirectedConstructor] can be `null` if the constructor
- * does not redirect to a different constructor. The [body] can be `null` if
- * the constructor does not have a body.
- */
+ /// Returns a newly created constructor declaration. The [externalKeyword]
+ /// can be `null` if the constructor is not external. Either or both of the
+ /// [comment] and [metadata] can be `null` if the constructor does not have
+ /// the corresponding attribute. The [constKeyword] can be `null` if the
+ /// constructor cannot be used to create a constant. The [factoryKeyword] can
+ /// be `null` if the constructor is not a factory. The [period] and [name] can
+ /// both be `null` if the constructor is not a named constructor. The
+ /// [separator] can be `null` if the constructor does not have any
+ /// initializers and does not redirect to a different constructor. The list of
+ /// [initializers] can be `null` if the constructor does not have any
+ /// initializers. The [redirectedConstructor] can be `null` if the constructor
+ /// does not redirect to a different constructor. The [body] can be `null` if
+ /// the constructor does not have a body.
ConstructorDeclaration constructorDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -256,11 +227,9 @@
ConstructorName redirectedConstructor,
FunctionBody body);
- /**
- * Returns a newly created field initializer to initialize the field with
- * the given name to the value of the given expression. The [thisKeyword] and
- * [period] can be `null` if the 'this' keyword was not specified.
- */
+ /// Returns a newly created field initializer to initialize the field with
+ /// the given name to the value of the given expression. The [thisKeyword] and
+ /// [period] can be `null` if the 'this' keyword was not specified.
ConstructorFieldInitializer constructorFieldInitializer(
Token thisKeyword,
Token period,
@@ -268,26 +237,20 @@
Token equals,
Expression expression);
- /**
- * Returns a newly created constructor name. The [period] and [name] can be
- * `null` if the constructor being named is the unnamed constructor.
- */
+ /// Returns a newly created constructor name. The [period] and [name] can be
+ /// `null` if the constructor being named is the unnamed constructor.
ConstructorName constructorName(
TypeName type, Token period, SimpleIdentifier name);
- /**
- * Returns a newly created continue statement. The [label] can be `null` if
- * there is no label associated with the statement.
- */
+ /// Returns a newly created continue statement. The [label] can be `null` if
+ /// there is no label associated with the statement.
ContinueStatement continueStatement(
Token continueKeyword, SimpleIdentifier label, Token semicolon);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the declaration does not have the
- * corresponding attribute. The [keyword] can be `null` if a type name is
- * given. The [type] must be `null` if the keyword is 'var'.
- */
+ /// Returns a newly created formal parameter. Either or both of the
+ /// [comment] and [metadata] can be `null` if the declaration does not have
+ /// the corresponding attribute. The [keyword] can be `null` if a type name is
+ /// given. The [type] must be `null` if the keyword is 'var'.
DeclaredIdentifier declaredIdentifier(
Comment comment,
List<Annotation> metadata,
@@ -295,23 +258,17 @@
TypeAnnotation type,
SimpleIdentifier identifier);
- /**
- * Returns a newly created default formal parameter. The [separator] and
- * [defaultValue] can be `null` if there is no default value.
- */
+ /// Returns a newly created default formal parameter. The [separator] and
+ /// [defaultValue] can be `null` if there is no default value.
DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter,
ParameterKind kind, Token separator, Expression defaultValue);
- /**
- * Returns a documentation comment consisting of the given [tokens] and having
- * the given [references] (if supplied) embedded within it.
- */
+ /// Returns a documentation comment consisting of the given [tokens] and
+ /// having the given [references] (if supplied) embedded within it.
Comment documentationComment(List<Token> tokens,
[List<CommentReference> references]);
- /**
- * Returns a newly created do loop.
- */
+ /// Returns a newly created do loop.
DoStatement doStatement(
Token doKeyword,
Statement body,
@@ -321,46 +278,32 @@
Token rightParenthesis,
Token semicolon);
- /**
- * Returns a newly created dotted name.
- */
+ /// Returns a newly created dotted name.
DottedName dottedName(List<SimpleIdentifier> components);
- /**
- * Returns a newly created floating point literal.
- */
+ /// Returns a newly created floating point literal.
DoubleLiteral doubleLiteral(Token literal, double value);
- /**
- * Returns a newly created function body.
- */
+ /// Returns a newly created function body.
EmptyFunctionBody emptyFunctionBody(Token semicolon);
- /**
- * Returns a newly created empty statement.
- */
+ /// Returns a newly created empty statement.
EmptyStatement emptyStatement(Token semicolon);
- /**
- * Returns an end-of-line comment consisting of the given [tokens].
- */
+ /// Returns an end-of-line comment consisting of the given [tokens].
Comment endOfLineComment(List<Token> tokens);
- /**
- * Returns a newly created enum constant declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the constant does not have the
- * corresponding attribute. (Technically, enum constants cannot have metadata,
- * but we allow it for consistency.)
- */
+ /// Returns a newly created enum constant declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the constant does not have the
+ /// corresponding attribute. (Technically, enum constants cannot have
+ /// metadata, but we allow it for consistency.)
EnumConstantDeclaration enumConstantDeclaration(
Comment comment, List<Annotation> metadata, SimpleIdentifier name);
- /**
- * Returns a newly created enumeration declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the declaration does not have the
- * corresponding attribute. The list of [constants] must contain at least one
- * value.
- */
+ /// Returns a newly created enumeration declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the declaration does not have
+ /// the corresponding attribute. The list of [constants] must contain at least
+ /// one value.
EnumDeclaration enumDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -370,12 +313,10 @@
List<EnumConstantDeclaration> constants,
Token rightBracket);
- /**
- * Returns a newly created export directive. Either or both of the
- * [comment] and [metadata] can be `null` if the directive does not have the
- * corresponding attribute. The list of [combinators] can be `null` if there
- * are no combinators.
- */
+ /// Returns a newly created export directive. Either or both of the
+ /// [comment] and [metadata] can be `null` if the directive does not have the
+ /// corresponding attribute. The list of [combinators] can be `null` if there
+ /// are no combinators.
ExportDirective exportDirective(
Comment comment,
List<Annotation> metadata,
@@ -385,43 +326,33 @@
List<Combinator> combinators,
Token semicolon);
- /**
- * Returns a newly created function body consisting of a block of
- * statements. The [keyword] can be `null` if the function body is not an
- * async function body.
- */
+ /// Returns a newly created function body consisting of a block of statements.
+ /// The [keyword] can be `null` if the function body is not an async function
+ /// body.
ExpressionFunctionBody expressionFunctionBody(Token keyword,
Token functionDefinition, Expression expression, Token semicolon);
- /**
- * Returns a newly created expression statement.
- */
+ /// Returns a newly created expression statement.
ExpressionStatement expressionStatement(
Expression expression, Token semicolon);
- /**
- * Returns a newly created extends clause.
- */
+ /// Returns a newly created extends clause.
ExtendsClause extendsClause(Token extendsKeyword, TypeName superclass);
- /**
- * Returns a newly created field declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the declaration does not have the
- * corresponding attribute. The [staticKeyword] can be `null` if the field is
- * not a static field.
- *
- * Use [fieldDeclaration2] instead.
- */
+ /// Returns a newly created field declaration. Either or both of the [comment]
+ /// and [metadata] can be `null` if the declaration does not have the
+ /// corresponding attribute. The [staticKeyword] can be `null` if the field is
+ /// not a static field.
+ ///
+ /// Use [fieldDeclaration2] instead.
@deprecated
FieldDeclaration fieldDeclaration(Comment comment, List<Annotation> metadata,
Token staticKeyword, VariableDeclarationList fieldList, Token semicolon);
- /**
- * Returns a newly created field declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the declaration does not have the
- * corresponding attribute. The [staticKeyword] can be `null` if the field is
- * not a static field.
- */
+ /// Returns a newly created field declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the declaration does not have
+ /// the corresponding attribute. The [staticKeyword] can be `null` if the
+ /// field is not a static field.
FieldDeclaration fieldDeclaration2(
{Comment comment,
List<Annotation> metadata,
@@ -430,17 +361,15 @@
@required VariableDeclarationList fieldList,
@required Token semicolon});
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [keyword] can be `null` if there is a type.
- * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
- * [period] can be `null` if the keyword 'this' was not provided. The
- * [parameters] can be `null` if this is not a function-typed field formal
- * parameter.
- *
- * Use [fieldFormalParameter2] instead.
- */
+ /// Returns a newly created formal parameter. Either or both of the [comment]
+ /// and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [keyword] can be `null` if there is a type.
+ /// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
+ /// [period] can be `null` if the keyword 'this' was not provided. The
+ /// [parameters] can be `null` if this is not a function-typed field formal
+ /// parameter.
+ ///
+ /// Use [fieldFormalParameter2] instead.
@deprecated
FieldFormalParameter fieldFormalParameter(
Comment comment,
@@ -453,19 +382,18 @@
TypeParameterList typeParameters,
FormalParameterList parameters);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [keyword] can be `null` if there is a type.
- * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
- * [period] can be `null` if the keyword 'this' was not provided. The
- * [parameters] can be `null` if this is not a function-typed field formal
- * parameter.
- */
+ /// Returns a newly created formal parameter. Either or both of the [comment]
+ /// and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [keyword] can be `null` if there is a type.
+ /// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
+ /// [period] can be `null` if the keyword 'this' was not provided. The
+ /// [parameters] can be `null` if this is not a function-typed field formal
+ /// parameter.
FieldFormalParameter fieldFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required Token thisKeyword,
@@ -474,23 +402,17 @@
TypeParameterList typeParameters,
FormalParameterList parameters});
- /**
- * Returns a newly created for each part that includes a declaration.
- */
+ /// Returns a newly created for each part that includes a declaration.
ForEachPartsWithDeclaration forEachPartsWithDeclaration(
{DeclaredIdentifier loopVariable, Token inKeyword, Expression iterable});
- /**
- * Returns a newly created for each part that includes an identifier that is
- * declared outside of the loop.
- */
+ /// Returns a newly created for each part that includes an identifier that is
+ /// declared outside of the loop.
ForEachPartsWithIdentifier forEachPartsWithIdentifier(
{SimpleIdentifier identifier, Token inKeyword, Expression iterable});
- /**
- * Returns a newly created for element that can be part of a list, map or set
- * literal.
- */
+ /// Returns a newly created for element that can be part of a list, map or set
+ /// literal.
ForElement forElement(
{Token awaitKeyword,
Token forKeyword,
@@ -499,11 +421,9 @@
Token rightParenthesis,
CollectionElement body});
- /**
- * Returns a newly created parameter list. The list of [parameters] can be
- * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter]
- * can be `null` if there are no optional parameters.
- */
+ /// Returns a newly created parameter list. The list of [parameters] can be
+ /// `null` if there are no parameters. The [leftDelimiter] and
+ /// [rightDelimiter] can be `null` if there are no optional parameters.
FormalParameterList formalParameterList(
Token leftParenthesis,
List<FormalParameter> parameters,
@@ -511,9 +431,7 @@
Token rightDelimiter,
Token rightParenthesis);
- /**
- * Returns a newly created for part that includes a declaration.
- */
+ /// Returns a newly created for part that includes a declaration.
ForPartsWithDeclarations forPartsWithDeclarations(
{VariableDeclarationList variables,
Token leftSeparator,
@@ -521,9 +439,7 @@
Token rightSeparator,
List<Expression> updaters});
- /**
- * Returns a newly created for part that includes an expression.
- */
+ /// Returns a newly created for part that includes an expression.
ForPartsWithExpression forPartsWithExpression(
{Expression initialization,
Token leftSeparator,
@@ -531,10 +447,8 @@
Token rightSeparator,
List<Expression> updaters});
- /**
- * Returns a newly created for statement.
- */
- ForStatement2 forStatement2(
+ /// Returns a newly created for statement.
+ ForStatement forStatement(
{Token awaitKeyword,
Token forKeyword,
Token leftParenthesis,
@@ -542,14 +456,22 @@
Token rightParenthesis,
Statement body});
- /**
- * Returns a newly created function declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the function does not have the
- * corresponding attribute. The [externalKeyword] can be `null` if the
- * function is not an external function. The [returnType] can be `null` if no
- * return type was specified. The [propertyKeyword] can be `null` if the
- * function is neither a getter or a setter.
- */
+ /// Returns a newly created for statement.
+ @Deprecated('Replaced by forStatement')
+ ForStatement forStatement2(
+ {Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ Statement body});
+
+ /// Returns a newly created function declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the function does not have the
+ /// corresponding attribute. The [externalKeyword] can be `null` if the
+ /// function is not an external function. The [returnType] can be `null` if no
+ /// return type was specified. The [propertyKeyword] can be `null` if the
+ /// function is neither a getter or a setter.
FunctionDeclaration functionDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -559,31 +481,23 @@
SimpleIdentifier name,
FunctionExpression functionExpression);
- /**
- * Returns a newly created function declaration statement.
- */
+ /// Returns a newly created function declaration statement.
FunctionDeclarationStatement functionDeclarationStatement(
FunctionDeclaration functionDeclaration);
- /**
- * Returns a newly created function declaration.
- */
+ /// Returns a newly created function declaration.
FunctionExpression functionExpression(TypeParameterList typeParameters,
FormalParameterList parameters, FunctionBody body);
- /**
- * Returns a newly created function expression invocation.
- */
+ /// Returns a newly created function expression invocation.
FunctionExpressionInvocation functionExpressionInvocation(Expression function,
TypeArgumentList typeArguments, ArgumentList argumentList);
- /**
- * Returns a newly created function type alias. Either or both of the
- * [comment] and [metadata] can be `null` if the function does not have the
- * corresponding attribute. The [returnType] can be `null` if no return type
- * was specified. The [typeParameters] can be `null` if the function has no
- * type parameters.
- */
+ /// Returns a newly created function type alias. Either or both of the
+ /// [comment] and [metadata] can be `null` if the function does not have the
+ /// corresponding attribute. The [returnType] can be `null` if no return type
+ /// was specified. The [typeParameters] can be `null` if the function has no
+ /// type parameters.
FunctionTypeAlias functionTypeAlias(
Comment comment,
List<Annotation> metadata,
@@ -594,14 +508,12 @@
FormalParameterList parameters,
Token semicolon);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [returnType] can be `null` if no return type
- * was specified.
- *
- * Use [functionTypedFormalParameter2] instead.
- */
+ /// Returns a newly created formal parameter. Either or both of the
+ /// [comment] and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [returnType] can be `null` if no return type
+ /// was specified.
+ ///
+ /// Use [functionTypedFormalParameter2] instead.
@deprecated
FunctionTypedFormalParameter functionTypedFormalParameter(
Comment comment,
@@ -611,24 +523,21 @@
TypeParameterList typeParameters,
FormalParameterList parameters);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [returnType] can be `null` if no return type
- * was specified.
- */
+ /// Returns a newly created formal parameter. Either or both of the
+ /// [comment] and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [returnType] can be `null` if no return type
+ /// was specified.
FunctionTypedFormalParameter functionTypedFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
TypeAnnotation returnType,
@required SimpleIdentifier identifier,
TypeParameterList typeParameters,
@required FormalParameterList parameters});
- /**
- * Initialize a newly created generic function type.
- */
+ /// Initialize a newly created generic function type.
GenericFunctionType genericFunctionType(
TypeAnnotation returnType,
Token functionKeyword,
@@ -636,12 +545,10 @@
FormalParameterList parameters,
{Token question});
- /**
- * Returns a newly created generic type alias. Either or both of the
- * [comment] and [metadata] can be `null` if the variable list does not have
- * the corresponding attribute. The [typeParameters] can be `null` if there
- * are no type parameters.
- */
+ /// Returns a newly created generic type alias. Either or both of the
+ /// [comment] and [metadata] can be `null` if the variable list does not have
+ /// the corresponding attribute. The [typeParameters] can be `null` if there
+ /// are no type parameters.
GenericTypeAlias genericTypeAlias(
Comment comment,
List<Annotation> metadata,
@@ -652,16 +559,12 @@
GenericFunctionType functionType,
Token semicolon);
- /**
- * Returns a newly created import show combinator.
- */
+ /// Returns a newly created import show combinator.
HideCombinator hideCombinator(
Token keyword, List<SimpleIdentifier> hiddenNames);
- /**
- * Returns a newly created if element that can be part of a list, map or set
- * literal.
- */
+ /// Returns a newly created if element that can be part of a list, map or set
+ /// literal.
IfElement ifElement(
{Token ifKeyword,
Token leftParenthesis,
@@ -671,10 +574,8 @@
Token elseKeyword,
CollectionElement elseElement});
- /**
- * Returns a newly created if statement. The [elseKeyword] and
- * [elseStatement] can be `null` if there is no else clause.
- */
+ /// Returns a newly created if statement. The [elseKeyword] and
+ /// [elseStatement] can be `null` if there is no else clause.
IfStatement ifStatement(
Token ifKeyword,
Token leftParenthesis,
@@ -684,20 +585,16 @@
Token elseKeyword,
Statement elseStatement);
- /**
- * Returns a newly created implements clause.
- */
+ /// Returns a newly created implements clause.
ImplementsClause implementsClause(
Token implementsKeyword, List<TypeName> interfaces);
- /**
- * Returns a newly created import directive. Either or both of the
- * [comment] and [metadata] can be `null` if the function does not have the
- * corresponding attribute. The [deferredKeyword] can be `null` if the import
- * is not deferred. The [asKeyword] and [prefix] can be `null` if the import
- * does not specify a prefix. The list of [combinators] can be `null` if there
- * are no combinators.
- */
+ /// Returns a newly created import directive. Either or both of the
+ /// [comment] and [metadata] can be `null` if the function does not have the
+ /// corresponding attribute. The [deferredKeyword] can be `null` if the import
+ /// is not deferred. The [asKeyword] and [prefix] can be `null` if the import
+ /// does not specify a prefix. The list of [combinators] can be `null` if
+ /// there are no combinators.
ImportDirective importDirective(
Comment comment,
List<Annotation> metadata,
@@ -710,129 +607,70 @@
List<Combinator> combinators,
Token semicolon);
- /**
- * Returns a newly created index expression.
- */
+ /// Returns a newly created index expression.
IndexExpression indexExpressionForCascade(
Token period, Token leftBracket, Expression index, Token rightBracket);
- /**
- * Returns a newly created index expression.
- */
+ /// Returns a newly created index expression.
IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
Expression index, Token rightBracket);
- /**
- * Returns a newly created instance creation expression.
- */
+ /// Returns a newly created instance creation expression.
InstanceCreationExpression instanceCreationExpression(
Token keyword, ConstructorName constructorName, ArgumentList argumentList,
{TypeArgumentList typeArguments});
- /**
- * Returns a newly created integer literal.
- */
+ /// Returns a newly created integer literal.
IntegerLiteral integerLiteral(Token literal, int value);
- /**
- * Returns a newly created interpolation expression.
- */
+ /// Returns a newly created interpolation expression.
InterpolationExpression interpolationExpression(
Token leftBracket, Expression expression, Token rightBracket);
- /**
- * Returns a newly created string of characters that are part of a string
- * interpolation.
- */
+ /// Returns a newly created string of characters that are part of a string
+ /// interpolation.
InterpolationString interpolationString(Token contents, String value);
- /**
- * Returns a newly created is expression. The [notOperator] can be `null`
- * if the sense of the test is not negated.
- */
+ /// Returns a newly created is expression. The [notOperator] can be `null`
+ /// if the sense of the test is not negated.
IsExpression isExpression(Expression expression, Token isOperator,
Token notOperator, TypeAnnotation type);
- /**
- * Returns a newly created label.
- */
+ /// Returns a newly created label.
Label label(SimpleIdentifier label, Token colon);
- /**
- * Returns a newly created labeled statement.
- */
+ /// Returns a newly created labeled statement.
LabeledStatement labeledStatement(List<Label> labels, Statement statement);
- /**
- * Returns a newly created library directive. Either or both of the
- * [comment] and [metadata] can be `null` if the directive does not have the
- * corresponding attribute.
- */
+ /// Returns a newly created library directive. Either or both of the
+ /// [comment] and [metadata] can be `null` if the directive does not have the
+ /// corresponding attribute.
LibraryDirective libraryDirective(Comment comment, List<Annotation> metadata,
Token libraryKeyword, LibraryIdentifier name, Token semicolon);
- /**
- * Returns a newly created prefixed identifier.
- */
+ /// Returns a newly created prefixed identifier.
LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components);
- /**
- * Returns a newly created list literal. The [constKeyword] can be `null`
- * if the literal is not a constant. The [typeArguments] can be `null` if no
- * type arguments were declared. The list of [elements] can be `null` if the
- * list is empty.
- */
+ /// Returns a newly created list literal. The [constKeyword] can be `null`
+ /// if the literal is not a constant. The [typeArguments] can be `null` if no
+ /// type arguments were declared. The list of [elements] can be `null` if the
+ /// list is empty.
ListLiteral listLiteral(Token constKeyword, TypeArgumentList typeArguments,
Token leftBracket, List<CollectionElement> elements, Token rightBracket);
- /**
- * Returns a newly created list literal.
- */
- @Deprecated('Use listLiteral')
- ListLiteral2 listLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> elements,
- Token rightBracket});
-
- /**
- * Returns a newly created map literal. The [constKeyword] can be `null` if
- * the literal is not a constant. The [typeArguments] can be `null` if no type
- * arguments were declared. The [entries] can be `null` if the map is empty.
- */
- @Deprecated('Use setOrMapLiteral')
- MapLiteral mapLiteral(Token constKeyword, TypeArgumentList typeArguments,
- Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket);
-
- /**
- * Returns a newly created map literal.
- */
- @Deprecated('Use setOrMapLiteral')
- MapLiteral2 mapLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> entries,
- Token rightBracket});
-
- /**
- * Returns a newly created map literal entry.
- */
+ /// Returns a newly created map literal entry.
MapLiteralEntry mapLiteralEntry(
Expression key, Token separator, Expression value);
- /**
- * Returns a newly created method declaration. Either or both of the
- * [comment] and [metadata] can be `null` if the declaration does not have the
- * corresponding attribute. The [externalKeyword] can be `null` if the method
- * is not external. The [modifierKeyword] can be `null` if the method is
- * neither abstract nor static. The [returnType] can be `null` if no return
- * type was specified. The [propertyKeyword] can be `null` if the method is
- * neither a getter or a setter. The [operatorKeyword] can be `null` if the
- * method does not implement an operator. The [parameters] must be `null` if
- * this method declares a getter.
- */
+ /// Returns a newly created method declaration. Either or both of the
+ /// [comment] and [metadata] can be `null` if the declaration does not have
+ /// the corresponding attribute. The [externalKeyword] can be `null` if the
+ /// method is not external. The [modifierKeyword] can be `null` if the method
+ /// is neither abstract nor static. The [returnType] can be `null` if no
+ /// return type was specified. The [propertyKeyword] can be `null` if the
+ /// method is neither a getter or a setter. The [operatorKeyword] can be
+ /// `null` if the method does not implement an operator. The [parameters] must
+ /// be `null` if this method declares a getter.
MethodDeclaration methodDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -846,10 +684,8 @@
FormalParameterList parameters,
FunctionBody body);
- /**
- * Returns a newly created method invocation. The [target] and [operator]
- * can be `null` if there is no target.
- */
+ /// Returns a newly created method invocation. The [target] and [operator]
+ /// can be `null` if there is no target.
MethodInvocation methodInvocation(
Expression target,
Token operator,
@@ -857,9 +693,7 @@
TypeArgumentList typeArguments,
ArgumentList argumentList);
- /**
- * Return a newly created mixin declaration.
- */
+ /// Return a newly created mixin declaration.
MixinDeclaration mixinDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -872,59 +706,41 @@
List<ClassMember> members,
Token rightBracket);
- /**
- * Returns a newly created named expression..
- */
+ /// Returns a newly created named expression.
NamedExpression namedExpression(Label name, Expression expression);
- /**
- * Returns a newly created native clause.
- */
+ /// Returns a newly created native clause.
NativeClause nativeClause(Token nativeKeyword, StringLiteral name);
- /**
- * Returns a newly created function body consisting of the 'native' token,
- * a string literal, and a semicolon.
- */
+ /// Returns a newly created function body consisting of the 'native' token,
+ /// a string literal, and a semicolon.
NativeFunctionBody nativeFunctionBody(
Token nativeKeyword, StringLiteral stringLiteral, Token semicolon);
- /**
- * Returns a newly created list of nodes such that all of the nodes that
- * are added to the list will have their parent set to the given [owner]. The
- * list will initially be populated with the given [elements].
- */
+ /// Returns a newly created list of nodes such that all of the nodes that
+ /// are added to the list will have their parent set to the given [owner]. The
+ /// list will initially be populated with the given [elements].
NodeList<E> nodeList<E extends AstNode>(AstNode owner, [List<E> elements]);
- /**
- * Returns a newly created null literal.
- */
+ /// Returns a newly created null literal.
NullLiteral nullLiteral(Token literal);
- /**
- * Return a newly created on clause.
- */
+ /// Return a newly created on clause.
OnClause onClause(Token onKeyword, List<TypeName> superclassConstraints);
- /**
- * Returns a newly created parenthesized expression.
- */
+ /// Returns a newly created parenthesized expression.
ParenthesizedExpression parenthesizedExpression(
Token leftParenthesis, Expression expression, Token rightParenthesis);
- /**
- * Returns a newly created part directive. Either or both of the [comment]
- * and [metadata] can be `null` if the directive does not have the
- * corresponding attribute.
- */
+ /// Returns a newly created part directive. Either or both of the [comment]
+ /// and [metadata] can be `null` if the directive does not have the
+ /// corresponding attribute.
PartDirective partDirective(Comment comment, List<Annotation> metadata,
Token partKeyword, StringLiteral partUri, Token semicolon);
- /**
- * Returns a newly created part-of directive. Either or both of the
- * [comment] and [metadata] can be `null` if the directive does not have the
- * corresponding attribute.
- */
+ /// Returns a newly created part-of directive. Either or both of the
+ /// [comment] and [metadata] can be `null` if the directive does not have the
+ /// corresponding attribute.
PartOfDirective partOfDirective(
Comment comment,
List<Annotation> metadata,
@@ -934,83 +750,44 @@
LibraryIdentifier libraryName,
Token semicolon);
- /**
- * Returns a newly created postfix expression.
- */
+ /// Returns a newly created postfix expression.
PostfixExpression postfixExpression(Expression operand, Token operator);
- /**
- * Returns a newly created prefixed identifier.
- */
+ /// Returns a newly created prefixed identifier.
PrefixedIdentifier prefixedIdentifier(
SimpleIdentifier prefix, Token period, SimpleIdentifier identifier);
- /**
- * Returns a newly created prefix expression.
- */
+ /// Returns a newly created prefix expression.
PrefixExpression prefixExpression(Token operator, Expression operand);
- /**
- * Returns a newly created property access expression.
- */
+ /// Returns a newly created property access expression.
PropertyAccess propertyAccess(
Expression target, Token operator, SimpleIdentifier propertyName);
- /**
- * Returns a newly created redirecting invocation to invoke the constructor
- * with the given name with the given arguments. The [constructorName] can be
- * `null` if the constructor being invoked is the unnamed constructor.
- */
+ /// Returns a newly created redirecting invocation to invoke the constructor
+ /// with the given name with the given arguments. The [constructorName] can be
+ /// `null` if the constructor being invoked is the unnamed constructor.
RedirectingConstructorInvocation redirectingConstructorInvocation(
Token thisKeyword,
Token period,
SimpleIdentifier constructorName,
ArgumentList argumentList);
- /**
- * Returns a newly created rethrow expression.
- */
+ /// Returns a newly created rethrow expression.
RethrowExpression rethrowExpression(Token rethrowKeyword);
- /**
- * Returns a newly created return statement. The [expression] can be `null`
- * if no explicit value was provided.
- */
+ /// Returns a newly created return statement. The [expression] can be `null`
+ /// if no explicit value was provided.
ReturnStatement returnStatement(
Token returnKeyword, Expression expression, Token semicolon);
- /**
- * Returns a newly created script tag.
- */
+ /// Returns a newly created script tag.
ScriptTag scriptTag(Token scriptTag);
- /**
- * Returns a newly created set literal. The [constKeyword] can be `null`
- * if the literal is not a constant. The [typeArguments] can be `null` if no
- * type arguments were declared. The list of [elements] can be `null` if the
- * set is empty.
- */
- @Deprecated('Use setOrMapLiteral')
- SetLiteral setLiteral(Token constKeyword, TypeArgumentList typeArguments,
- Token leftBracket, List<Expression> elements, Token rightBracket);
-
- /**
- * Returns a newly created set literal.
- */
- @Deprecated('Use setOrMapLiteral')
- SetLiteral2 setLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> elements,
- Token rightBracket});
-
- /**
- * Returns a newly created set or map literal. The [constKeyword] can be
- * `null` if the literal is not a constant. The [typeArguments] can be `null`
- * if no type arguments were declared. The list of [elements] can be `null` if
- * the set or map is empty.
- */
+ /// Returns a newly created set or map literal. The [constKeyword] can be
+ /// `null` if the literal is not a constant. The [typeArguments] can be `null`
+ /// if no type arguments were declared. The list of [elements] can be `null`
+ /// if the set or map is empty.
SetOrMapLiteral setOrMapLiteral(
{Token constKeyword,
TypeArgumentList typeArguments,
@@ -1018,20 +795,16 @@
List<CollectionElement> elements,
Token rightBracket});
- /**
- * Returns a newly created import show combinator.
- */
+ /// Returns a newly created import show combinator.
ShowCombinator showCombinator(
Token keyword, List<SimpleIdentifier> shownNames);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [keyword] can be `null` if a type was
- * specified. The [type] must be `null` if the keyword is 'var'.
- *
- * Use [simpleFormalParameter2] instead.
- */
+ /// Returns a newly created formal parameter. Either or both of the
+ /// [comment] and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [keyword] can be `null` if a type was
+ /// specified. The [type] must be `null` if the keyword is 'var'.
+ ///
+ /// Use [simpleFormalParameter2] instead.
@deprecated
SimpleFormalParameter simpleFormalParameter(
Comment comment,
@@ -1040,75 +813,56 @@
TypeAnnotation type,
SimpleIdentifier identifier);
- /**
- * Returns a newly created formal parameter. Either or both of the
- * [comment] and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [keyword] can be `null` if a type was
- * specified. The [type] must be `null` if the keyword is 'var'.
- */
+ /// Returns a newly created formal parameter. Either or both of the
+ /// [comment] and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [keyword] can be `null` if a type was
+ /// specified. The [type] must be `null` if the keyword is 'var'.
SimpleFormalParameter simpleFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required SimpleIdentifier identifier});
- /**
- * Returns a newly created identifier.
- */
+ /// Returns a newly created identifier.
SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false});
- /**
- * Returns a newly created simple string literal.
- */
+ /// Returns a newly created simple string literal.
SimpleStringLiteral simpleStringLiteral(Token literal, String value);
- /**
- * Returns a newly created spread element.
- */
+ /// Returns a newly created spread element.
SpreadElement spreadElement({Token spreadOperator, Expression expression});
- /**
- * Returns a newly created string interpolation expression.
- */
+ /// Returns a newly created string interpolation expression.
StringInterpolation stringInterpolation(List<InterpolationElement> elements);
- /**
- * Returns a newly created super invocation to invoke the inherited
- * constructor with the given name with the given arguments. The [period] and
- * [constructorName] can be `null` if the constructor being invoked is the
- * unnamed constructor.
- */
+ /// Returns a newly created super invocation to invoke the inherited
+ /// constructor with the given name with the given arguments. The [period] and
+ /// [constructorName] can be `null` if the constructor being invoked is the
+ /// unnamed constructor.
SuperConstructorInvocation superConstructorInvocation(
Token superKeyword,
Token period,
SimpleIdentifier constructorName,
ArgumentList argumentList);
- /**
- * Returns a newly created super expression.
- */
+ /// Returns a newly created super expression.
SuperExpression superExpression(Token superKeyword);
- /**
- * Returns a newly created switch case. The list of [labels] can be `null`
- * if there are no labels.
- */
+ /// Returns a newly created switch case. The list of [labels] can be `null`
+ /// if there are no labels.
SwitchCase switchCase(List<Label> labels, Token keyword,
Expression expression, Token colon, List<Statement> statements);
- /**
- * Returns a newly created switch default. The list of [labels] can be
- * `null` if there are no labels.
- */
+ /// Returns a newly created switch default. The list of [labels] can be
+ /// `null` if there are no labels.
SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon,
List<Statement> statements);
- /**
- * Returns a newly created switch statement. The list of [members] can be
- * `null` if there are no switch members.
- */
+ /// Returns a newly created switch statement. The list of [members] can be
+ /// `null` if there are no switch members.
SwitchStatement switchStatement(
Token switchKeyword,
Token leftParenthesis,
@@ -1118,82 +872,62 @@
List<SwitchMember> members,
Token rightBracket);
- /**
- * Returns a newly created symbol literal.
- */
+ /// Returns a newly created symbol literal.
SymbolLiteral symbolLiteral(Token poundSign, List<Token> components);
- /**
- * Returns a newly created this expression.
- */
+ /// Returns a newly created this expression.
ThisExpression thisExpression(Token thisKeyword);
- /**
- * Returns a newly created throw expression.
- */
+ /// Returns a newly created throw expression.
ThrowExpression throwExpression(Token throwKeyword, Expression expression);
- /**
- * Returns a newly created top-level variable declaration. Either or both
- * of the [comment] and [metadata] can be `null` if the variable does not have
- * the corresponding attribute.
- */
+ /// Returns a newly created top-level variable declaration. Either or both
+ /// of the [comment] and [metadata] can be `null` if the variable does not
+ /// have the corresponding attribute.
TopLevelVariableDeclaration topLevelVariableDeclaration(
Comment comment,
List<Annotation> metadata,
VariableDeclarationList variableList,
Token semicolon);
- /**
- * Returns a newly created try statement. The list of [catchClauses] can be
- * `null` if there are no catch clauses. The [finallyKeyword] and
- * [finallyBlock] can be `null` if there is no finally clause.
- */
+ /// Returns a newly created try statement. The list of [catchClauses] can be
+ /// `null` if there are no catch clauses. The [finallyKeyword] and
+ /// [finallyBlock] can be `null` if there is no finally clause.
TryStatement tryStatement(Token tryKeyword, Block body,
List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock);
- /**
- * Returns a newly created list of type arguments.
- */
+ /// Returns a newly created list of type arguments.
TypeArgumentList typeArgumentList(
Token leftBracket, List<TypeAnnotation> arguments, Token rightBracket);
- /**
- * Returns a newly created type name. The [typeArguments] can be `null` if
- * there are no type arguments. The [question] can be `null` if there is no
- * question mark.
- */
+ /// Returns a newly created type name. The [typeArguments] can be `null` if
+ /// there are no type arguments. The [question] can be `null` if there is no
+ /// question mark.
TypeName typeName(Identifier name, TypeArgumentList typeArguments,
{Token question});
- /**
- * Returns a newly created type parameter. Either or both of the [comment]
- * and [metadata] can be `null` if the parameter does not have the
- * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
- * the parameter does not have an upper bound.
- */
+ /// Returns a newly created type parameter. Either or both of the [comment]
+ /// and [metadata] can be `null` if the parameter does not have the
+ /// corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
+ /// the parameter does not have an upper bound.
TypeParameter typeParameter(Comment comment, List<Annotation> metadata,
SimpleIdentifier name, Token extendsKeyword, TypeAnnotation bound);
- /**
- * Returns a newly created list of type parameters.
- */
+ /// Returns a newly created list of type parameters.
TypeParameterList typeParameterList(Token leftBracket,
List<TypeParameter> typeParameters, Token rightBracket);
- /**
- * Returns a newly created variable declaration. The [equals] and
- * [initializer] can be `null` if there is no initializer.
- */
+ /// Returns a newly created variable declaration. The [equals] and
+ /// [initializer] can be `null` if there is no initializer.
VariableDeclaration variableDeclaration(
SimpleIdentifier name, Token equals, Expression initializer);
- /**
- * Returns a newly created variable declaration list. Either or both of the
- * [comment] and [metadata] can be `null` if the variable list does not have
- * the corresponding attribute. The [keyword] can be `null` if a type was
- * specified. The [type] must be `null` if the keyword is 'var'.
- */
+ /// Returns a newly created variable declaration list. Either or both of the
+ /// [comment] and [metadata] can be `null` if the variable list does not have
+ /// the corresponding attribute. The [keyword] can be `null` if a type was
+ /// specified. The [type] must be `null` if the keyword is 'var'.
+ ///
+ /// Use [variableDeclarationList2] instead.
VariableDeclarationList variableDeclarationList(
Comment comment,
List<Annotation> metadata,
@@ -1201,27 +935,31 @@
TypeAnnotation type,
List<VariableDeclaration> variables);
- /**
- * Returns a newly created variable declaration statement.
- */
+ /// Returns a newly created variable declaration list. Either or both of the
+ /// [comment] and [metadata] can be `null` if the variable list does not have
+ /// the corresponding attribute. The [keyword] can be `null` if a type was
+ /// specified. The [type] must be `null` if the keyword is 'var'.
+ VariableDeclarationList variableDeclarationList2(
+ {Comment comment,
+ List<Annotation> metadata,
+ Token lateKeyword,
+ Token keyword,
+ TypeAnnotation type,
+ List<VariableDeclaration> variables});
+
+ /// Returns a newly created variable declaration statement.
VariableDeclarationStatement variableDeclarationStatement(
VariableDeclarationList variableList, Token semicolon);
- /**
- * Returns a newly created while statement.
- */
+ /// Returns a newly created while statement.
WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis,
Expression condition, Token rightParenthesis, Statement body);
- /**
- * Returns a newly created with clause.
- */
+ /// Returns a newly created with clause.
WithClause withClause(Token withKeyword, List<TypeName> mixinTypes);
- /**
- * Returns a newly created yield expression. The [star] can be `null` if no
- * star was provided.
- */
+ /// Returns a newly created yield expression. The [star] can be `null` if no
+ /// star was provided.
YieldStatement yieldStatement(
Token yieldKeyword, Token star, Expression expression, Token semicolon);
}
diff --git a/analyzer/lib/dart/ast/precedence.dart b/analyzer/lib/dart/ast/precedence.dart
index a5480d5..aaed019 100644
--- a/analyzer/lib/dart/ast/precedence.dart
+++ b/analyzer/lib/dart/ast/precedence.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, 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.
diff --git a/analyzer/lib/dart/ast/resolution_map.dart b/analyzer/lib/dart/ast/resolution_map.dart
index 3762587..a0cc7e4 100644
--- a/analyzer/lib/dart/ast/resolution_map.dart
+++ b/analyzer/lib/dart/ast/resolution_map.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -6,333 +6,261 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
-/**
- * A collection of methods which may be used to map from nodes in a resolved AST
- * to elements and types in the element model.
- *
- * Clients should not extend, implement or mix-in this class.
- */
+/// A collection of methods which may be used to map from nodes in a resolved
+/// AST to elements and types in the element model.
+///
+/// Clients should not extend, implement or mix-in this class.
+// TODO(brianwilkerson) This was added for unifying with the front_end, and is
+// no longer needed. It should be removed.
abstract class ResolutionMap {
- /**
- * Return the best element available for the function being invoked at [node].
- * If resolution was able to find a better element based on type propagation,
- * that element will be returned. Otherwise, the element found using the
- * result of static analysis will be returned. If resolution has not been
- * performed, then `null` will be returned.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForFunctionExpressionInvocation] instead.
- */
+ /// Return the best element available for the function being invoked at
+ /// [node]. If resolution was able to find a better element based on type
+ /// propagation, that element will be returned. Otherwise, the element found
+ /// using the result of static analysis will be returned. If resolution has
+ /// not been performed, then `null` will be returned.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForFunctionExpressionInvocation] instead.
@deprecated
ExecutableElement bestElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
- /**
- * Return the best element available for the identifier [node]. If resolution
- * was able to find a better element based on type propagation, that element
- * will be returned. Otherwise, the element found using the result of static
- * analysis will be returned. If resolution has not been performed, then
- * `null` will be returned.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForIdentifier] instead.
- */
+ /// Return the best element available for the identifier [node]. If resolution
+ /// was able to find a better element based on type propagation, that element
+ /// will be returned. Otherwise, the element found using the result of static
+ /// analysis will be returned. If resolution has not been performed, then
+ /// `null` will be returned.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForIdentifier] instead.
@deprecated
Element bestElementForIdentifier(Identifier node);
- /**
- * Return the best element available for the expression [node]. If resolution
- * was able to find a better element based on type propagation, that element
- * will be returned. Otherwise, the element found using the result of static
- * analysis will be returned. If resolution has not been performed, then
- * `null` will be returned.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForMethodReference] instead.
- */
+ /// Return the best element available for the expression [node]. If resolution
+ /// was able to find a better element based on type propagation, that element
+ /// will be returned. Otherwise, the element found using the result of static
+ /// analysis will be returned. If resolution has not been performed, then
+ /// `null` will be returned.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForMethodReference] instead.
@deprecated
MethodElement bestElementForMethodReference(MethodReferenceExpression node);
- /**
- * Return the best parameter element information available for the expression
- * [node]. If type propagation was able to find a better parameter element
- * than static analysis, that type will be returned. Otherwise, the result of
- * static analysis will be returned.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticParameterElementForExpression] instead.
- */
+ /// Return the best parameter element information available for the expression
+ /// [node]. If type propagation was able to find a better parameter element
+ /// than static analysis, that type will be returned. Otherwise, the result of
+ /// static analysis will be returned.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticParameterElementForExpression] instead.
@deprecated
ParameterElement bestParameterElementForExpression(Expression node);
- /**
- * Return the best type information available for the expression [node]. If
- * type propagation was able to find a better type than static analysis, that
- * type will be returned. Otherwise, the result of static analysis will be
- * returned. If no type analysis has been performed, then the type 'dynamic'
- * will be returned.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticTypeForExpression] instead.
- */
+ /// Return the best type information available for the expression [node]. If
+ /// type propagation was able to find a better type than static analysis, that
+ /// type will be returned. Otherwise, the result of static analysis will be
+ /// returned. If no type analysis has been performed, then the type 'dynamic'
+ /// will be returned.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticTypeForExpression] instead.
@deprecated
DartType bestTypeForExpression(Expression node);
- /**
- * Return the element annotation representing the annotation [node] in the
- * element model.
- */
+ /// Return the element annotation representing the annotation [node] in the
+ /// element model.
ElementAnnotation elementAnnotationForAnnotation(Annotation node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ClassElement elementDeclaredByClassDeclaration(ClassDeclaration node);
- /**
- * Return the element associated with the compilation unit [node], or `null`
- * if the AST structure has not been resolved.
- */
+ /// Return the element associated with the compilation unit [node], or `null`
+ /// if the AST structure has not been resolved.
CompilationUnitElement elementDeclaredByCompilationUnit(CompilationUnit node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ConstructorElement elementDeclaredByConstructorDeclaration(
ConstructorDeclaration node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
Element elementDeclaredByDeclaration(Declaration node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
LocalVariableElement elementDeclaredByDeclaredIdentifier(
DeclaredIdentifier node);
- /**
- * Return the element associated with the directive [node], or `null` if the
- * AST structure has not been resolved or if this directive could not be
- * resolved.
- */
+ /// Return the element associated with the directive [node], or `null` if the
+ /// AST structure has not been resolved or if this directive could not be
+ /// resolved.
Element elementDeclaredByDirective(Directive node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ClassElement elementDeclaredByEnumDeclaration(EnumDeclaration node);
- /**
- * Return the element representing the parameter [node], or `null` if this
- * parameter has not been resolved.
- */
+ /// Return the element representing the parameter [node], or `null` if this
+ /// parameter has not been resolved.
ParameterElement elementDeclaredByFormalParameter(FormalParameter node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ExecutableElement elementDeclaredByFunctionDeclaration(
FunctionDeclaration node);
- /**
- * Return the element associated with the function expression [node], or
- * `null` if the AST structure has not been resolved.
- */
+ /// Return the element associated with the function expression [node], or
+ /// `null` if the AST structure has not been resolved.
ExecutableElement elementDeclaredByFunctionExpression(
FunctionExpression node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ExecutableElement elementDeclaredByMethodDeclaration(MethodDeclaration node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
ClassElement elementDeclaredByMixinDeclaration(MixinDeclaration node);
- /**
- * Return the element associated with the declaration [node], or `null` if
- * either this node corresponds to a list of declarations or if the AST
- * structure has not been resolved.
- */
+ /// Return the element associated with the declaration [node], or `null` if
+ /// either this node corresponds to a list of declarations or if the AST
+ /// structure has not been resolved.
VariableElement elementDeclaredByVariableDeclaration(
VariableDeclaration node);
- /**
- * Return the element associated with the annotation [node], or `null` if the
- * AST structure has not been resolved or if this annotation could not be
- * resolved.
- */
+ /// Return the element associated with the annotation [node], or `null` if the
+ /// AST structure has not been resolved or if this annotation could not be
+ /// resolved.
Element elementForAnnotation(Annotation node);
- /**
- * Return the element representing the parameter being named by the
- * expression [node], or `null` if the AST structure has not been resolved or
- * if there is no parameter with the same name as this expression.
- */
+ /// Return the element representing the parameter being named by the
+ /// expression [node], or `null` if the AST structure has not been resolved or
+ /// if there is no parameter with the same name as this expression.
ParameterElement elementForNamedExpression(NamedExpression node);
- /**
- * Return a list containing the elements representing the parameters in the
- * list [node]. The list will contain `null`s if the parameters in this list
- * have not been resolved.
- */
+ /// Return a list containing the elements representing the parameters in the
+ /// list [node]. The list will contain `null`s if the parameters in this list
+ /// have not been resolved.
List<ParameterElement> parameterElementsForFormalParameterList(
FormalParameterList node);
- /**
- * Return the element associated with the function being invoked at [node]
- * based on propagated type information, or `null` if the AST structure has
- * not been resolved or the function could not be resolved.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForFunctionExpressionInvocation] instead.
- */
+ /// Return the element associated with the function being invoked at [node]
+ /// based on propagated type information, or `null` if the AST structure has
+ /// not been resolved or the function could not be resolved.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForFunctionExpressionInvocation] instead.
@deprecated
ExecutableElement propagatedElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
- /**
- * Return the element associated with the identifier [node] based on
- * propagated type information, or `null` if the AST structure has not been
- * resolved or if this identifier could not be resolved. One example of the
- * latter case is an identifier that is not defined within the scope in which
- * it appears.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForIdentifier] instead.
- */
+ /// Return the element associated with the identifier [node] based on
+ /// propagated type information, or `null` if the AST structure has not been
+ /// resolved or if this identifier could not be resolved. One example of the
+ /// latter case is an identifier that is not defined within the scope in which
+ /// it appears.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForIdentifier] instead.
@deprecated
Element propagatedElementForIdentifier(Identifier node);
- /**
- * Return the element associated with the expression [node] based on
- * propagated types, or `null` if the AST structure has not been resolved, or
- * there is no meaningful propagated element to return (e.g. because this is a
- * non-compound assignment expression, or because the method referred to could
- * not be resolved).
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticElementForMethodReference] instead.
- */
+ /// Return the element associated with the expression [node] based on
+ /// propagated types, or `null` if the AST structure has not been resolved, or
+ /// there is no meaningful propagated element to return (e.g. because this is
+ /// a non-compound assignment expression, or because the method referred to
+ /// could not be resolved).
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticElementForMethodReference] instead.
@deprecated
MethodElement propagatedElementForMethodReference(
MethodReferenceExpression node);
- /**
- * If the expression [node] is an argument to an invocation, and the AST
- * structure has been resolved, and the function being invoked is known based
- * on propagated type information, and [node] corresponds to one of the
- * parameters of the function being invoked, then return the parameter element
- * representing the parameter to which the value of [node] will be
- * bound. Otherwise, return `null`.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticParameterElementForExpression] instead.
- */
+ /// If the expression [node] is an argument to an invocation, and the AST
+ /// structure has been resolved, and the function being invoked is known based
+ /// on propagated type information, and [node] corresponds to one of the
+ /// parameters of the function being invoked, then return the parameter
+ /// element representing the parameter to which the value of [node] will be
+ /// bound. Otherwise, return `null`.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticParameterElementForExpression] instead.
@deprecated
ParameterElement propagatedParameterElementForExpression(Expression node);
- /**
- * Return the propagated type of the expression [node], or `null` if type
- * propagation has not been performed on the AST structure.
- *
- * Deprecated: The analyzer no longer computes propagated type information.
- * Use [staticTypeForExpression] instead.
- */
+ /// Return the propagated type of the expression [node], or `null` if type
+ /// propagation has not been performed on the AST structure.
+ ///
+ /// Deprecated: The analyzer no longer computes propagated type information.
+ /// Use [staticTypeForExpression] instead.
@deprecated
DartType propagatedTypeForExpression(Expression node);
- /**
- * Return the element associated with the constructor referenced by [node]
- * based on static type information, or `null` if the AST structure has not
- * been resolved or if the constructor could not be resolved.
- */
+ /// Return the element associated with the constructor referenced by [node]
+ /// based on static type information, or `null` if the AST structure has not
+ /// been resolved or if the constructor could not be resolved.
ConstructorElement staticElementForConstructorReference(
ConstructorReferenceNode node);
- /**
- * Return the element associated with the function being invoked at [node]
- * based on static type information, or `null` if the AST structure has not
- * been resolved or the function could not be resolved.
- */
+ /// Return the element associated with the function being invoked at [node]
+ /// based on static type information, or `null` if the AST structure has not
+ /// been resolved or the function could not be resolved.
ExecutableElement staticElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
- /**
- * Return the element associated with the identifier [node] based on static
- * type information, or `null` if the AST structure has not been resolved or
- * if this identifier could not be resolved. One example of the latter case is
- * an identifier that is not defined within the scope in which it appears
- */
+ /// Return the element associated with the identifier [node] based on static
+ /// type information, or `null` if the AST structure has not been resolved or
+ /// if this identifier could not be resolved. One example of the latter case
+ /// is an identifier that is not defined within the scope in which it appears.
Element staticElementForIdentifier(Identifier node);
- /**
- * Return the element associated with the expression [node] based on the
- * static types, or `null` if the AST structure has not been resolved, or
- * there is no meaningful static element to return (e.g. because this is a
- * non-compound assignment expression, or because the method referred to could
- * not be resolved).
- */
+ /// Return the element associated with the expression [node] based on the
+ /// static types, or `null` if the AST structure has not been resolved, or
+ /// there is no meaningful static element to return (e.g. because this is a
+ /// non-compound assignment expression, or because the method referred to
+ /// could not be resolved).
MethodElement staticElementForMethodReference(MethodReferenceExpression node);
- /**
- * Return the function type of the invocation [node] based on the static type
- * information, or `null` if the AST structure has not been resolved, or if
- * the invoke could not be resolved.
- *
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
- */
+ /// Return the function type of the invocation [node] based on the static type
+ /// information, or `null` if the AST structure has not been resolved, or if
+ /// the invoke could not be resolved.
+ ///
+ /// This will usually be a [FunctionType], but it can also be an
+ /// [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
+ /// interface type that implements `Function`.
DartType staticInvokeTypeForInvocationExpression(InvocationExpression node);
- /**
- * If the expression [node] is an argument to an invocation, and the AST
- * structure has been resolved, and the function being invoked is known based
- * on static type information, and [node] corresponds to one of the parameters
- * of the function being invoked, then return the parameter element
- * representing the parameter to which the value of [node] will be
- * bound. Otherwise, return `null`.
- */
+ /// If the expression [node] is an argument to an invocation, and the AST
+ /// structure has been resolved, and the function being invoked is known based
+ /// on static type information, and [node] corresponds to one of the
+ /// parameters of the function being invoked, then return the parameter
+ /// element representing the parameter to which the value of [node] will be
+ /// bound. Otherwise, return `null`.
ParameterElement staticParameterElementForExpression(Expression node);
- /**
- * Return the static type of the expression [node], or `null` if the AST
- * structure has not been resolved.
- */
+ /// Return the static type of the expression [node], or `null` if the AST
+ /// structure has not been resolved.
DartType staticTypeForExpression(Expression node);
- /**
- * Return the type being named by [node], or `null` if the AST structure has
- * not been resolved.
- */
+ /// Return the type being named by [node], or `null` if the AST structure has
+ /// not been resolved.
DartType typeForTypeName(TypeAnnotation node);
- /**
- * Return the element associated with the uri of the directive [node], or
- * `null` if the AST structure has not been resolved or if the URI could not
- * be resolved. Examples of the latter case include a directive that contains
- * an invalid URL or a URL that does not exist.
- */
+ /// Return the element associated with the uri of the directive [node], or
+ /// `null` if the AST structure has not been resolved or if the URI could not
+ /// be resolved. Examples of the latter case include a directive that contains
+ /// an invalid URL or a URL that does not exist.
Element uriElementForDirective(UriBasedDirective node);
}
diff --git a/analyzer/lib/dart/ast/standard_ast_factory.dart b/analyzer/lib/dart/ast/standard_ast_factory.dart
index 9333242..acb1366 100644
--- a/analyzer/lib/dart/ast/standard_ast_factory.dart
+++ b/analyzer/lib/dart/ast/standard_ast_factory.dart
@@ -1,11 +1,9 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast_factory.dart';
import 'package:analyzer/src/dart/ast/ast_factory.dart';
-/**
- * Gets an instance of [AstFactory] based on the standard AST implementation.
- */
+/// Gets an instance of [AstFactory] based on the standard AST implementation.
final AstFactory astFactory = new AstFactoryImpl();
diff --git a/analyzer/lib/dart/ast/standard_resolution_map.dart b/analyzer/lib/dart/ast/standard_resolution_map.dart
index c778063..3353e19 100644
--- a/analyzer/lib/dart/ast/standard_resolution_map.dart
+++ b/analyzer/lib/dart/ast/standard_resolution_map.dart
@@ -1,11 +1,10 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/resolution_map.dart';
import 'package:analyzer/src/dart/ast/resolution_map.dart';
-/**
- * Gets an instance of [ResolutionMap] based on the standard AST implementation.
- */
+/// Gets an instance of [ResolutionMap] based on the standard AST
+/// implementation.
final ResolutionMap resolutionMap = new ResolutionMapImpl();
diff --git a/analyzer/lib/dart/ast/token.dart b/analyzer/lib/dart/ast/token.dart
index 55874de..4262a60 100644
--- a/analyzer/lib/dart/ast/token.dart
+++ b/analyzer/lib/dart/ast/token.dart
@@ -2,30 +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.
-/**
- * Defines the tokens that are produced by the scanner, used by the parser, and
- * referenced from the [AST structure](ast.dart).
- */
+/// Defines the tokens that are produced by the scanner, used by the parser, and
+/// referenced from the [AST structure](ast.dart).
export 'package:front_end/src/scanner/token.dart'
- show
- Keyword,
- Token,
- TokenType,
- NO_PRECEDENCE,
- ASSIGNMENT_PRECEDENCE,
- CASCADE_PRECEDENCE,
- CONDITIONAL_PRECEDENCE,
- IF_NULL_PRECEDENCE,
- LOGICAL_OR_PRECEDENCE,
- LOGICAL_AND_PRECEDENCE,
- EQUALITY_PRECEDENCE,
- RELATIONAL_PRECEDENCE,
- BITWISE_OR_PRECEDENCE,
- BITWISE_XOR_PRECEDENCE,
- BITWISE_AND_PRECEDENCE,
- SHIFT_PRECEDENCE,
- ADDITIVE_PRECEDENCE,
- MULTIPLICATIVE_PRECEDENCE,
- PREFIX_PRECEDENCE,
- POSTFIX_PRECEDENCE,
- SELECTOR_PRECEDENCE;
+ show Keyword, Token, TokenType;
diff --git a/analyzer/lib/dart/ast/visitor.dart b/analyzer/lib/dart/ast/visitor.dart
index ac55621..6646631 100644
--- a/analyzer/lib/dart/ast/visitor.dart
+++ b/analyzer/lib/dart/ast/visitor.dart
@@ -2,79 +2,67 @@
// 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.
-/**
- * Defines AST visitors that support useful patterns for visiting the nodes in
- * an [AST structure](ast.dart).
- *
- * Dart is an evolving language, and the AST structure must evolved with it.
- * When the AST structure changes, the visitor interface will sometimes change
- * as well. If it is desirable to get a compilation error when the structure of
- * the AST has been modified, then you should consider implementing the
- * interface [AstVisitor] directly. Doing so will ensure that changes that
- * introduce new classes of nodes will be flagged. (Of course, not all changes
- * to the AST structure require the addition of a new class of node, and hence
- * cannot be caught this way.)
- *
- * But if automatic detection of these kinds of changes is not necessary then
- * you will probably want to extend one of the classes in this library because
- * doing so will simplify the task of writing your visitor and guard against
- * future changes to the AST structure. For example, the [RecursiveAstVisitor]
- * automates the process of visiting all of the descendants of a node.
- */
+/// Defines AST visitors that support useful patterns for visiting the nodes in
+/// an [AST structure](ast.dart).
+///
+/// Dart is an evolving language, and the AST structure must evolved with it.
+/// When the AST structure changes, the visitor interface will sometimes change
+/// as well. If it is desirable to get a compilation error when the structure of
+/// the AST has been modified, then you should consider implementing the
+/// interface [AstVisitor] directly. Doing so will ensure that changes that
+/// introduce new classes of nodes will be flagged. (Of course, not all changes
+/// to the AST structure require the addition of a new class of node, and hence
+/// cannot be caught this way.)
+///
+/// But if automatic detection of these kinds of changes is not necessary then
+/// you will probably want to extend one of the classes in this library because
+/// doing so will simplify the task of writing your visitor and guard against
+/// future changes to the AST structure. For example, the [RecursiveAstVisitor]
+/// automates the process of visiting all of the descendants of a node.
import 'dart:collection';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/utilities.dart' show UIAsCodeVisitorMixin;
-/**
- * An AST visitor that will recursively visit all of the nodes in an AST
- * structure, similar to [GeneralizingAstVisitor]. This visitor uses a
- * breadth-first ordering rather than the depth-first ordering of
- * [GeneralizingAstVisitor].
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or explicitly invoke the more general visit method. Failure to
- * do so will cause the visit methods for superclasses of the node to not be
- * invoked and will cause the children of the visited node to not be visited.
- *
- * In addition, subclasses should <b>not</b> explicitly visit the children of a
- * node, but should ensure that the method [visitNode] is used to visit the
- * children (either directly or indirectly). Failure to do will break the order
- * in which nodes are visited.
- *
- * Note that, unlike other visitors that begin to visit a structure of nodes by
- * asking the root node in the structure to accept the visitor, this visitor
- * requires that clients start the visit by invoking the method [visitAllNodes]
- * defined on the visitor with the root node as the argument:
- *
- * visitor.visitAllNodes(rootNode);
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will recursively visit all of the nodes in an AST
+/// structure, similar to [GeneralizingAstVisitor]. This visitor uses a
+/// breadth-first ordering rather than the depth-first ordering of
+/// [GeneralizingAstVisitor].
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or explicitly invoke the more general visit method. Failure to
+/// do so will cause the visit methods for superclasses of the node to not be
+/// invoked and will cause the children of the visited node to not be visited.
+///
+/// In addition, subclasses should <b>not</b> explicitly visit the children of a
+/// node, but should ensure that the method [visitNode] is used to visit the
+/// children (either directly or indirectly). Failure to do will break the order
+/// in which nodes are visited.
+///
+/// Note that, unlike other visitors that begin to visit a structure of nodes by
+/// asking the root node in the structure to accept the visitor, this visitor
+/// requires that clients start the visit by invoking the method [visitAllNodes]
+/// defined on the visitor with the root node as the argument:
+///
+/// visitor.visitAllNodes(rootNode);
+///
+/// Clients may extend this class.
class BreadthFirstVisitor<R> extends GeneralizingAstVisitor<R> {
- /**
- * A queue holding the nodes that have not yet been visited in the order in
- * which they ought to be visited.
- */
+ /// A queue holding the nodes that have not yet been visited in the order in
+ /// which they ought to be visited.
Queue<AstNode> _queue = new Queue<AstNode>();
- /**
- * A visitor, used to visit the children of the current node, that will add
- * the nodes it visits to the [_queue].
- */
+ /// A visitor, used to visit the children of the current node, that will add
+ /// the nodes it visits to the [_queue].
_BreadthFirstChildVisitor _childVisitor;
- /**
- * Initialize a newly created visitor.
- */
+ /// Initialize a newly created visitor.
BreadthFirstVisitor() {
_childVisitor = new _BreadthFirstChildVisitor(this);
}
- /**
- * Visit all nodes in the tree starting at the given [root] node, in
- * breadth-first order.
- */
+ /// Visit all nodes in the tree starting at the given [root] node, in
+ /// breadth-first order.
void visitAllNodes(AstNode root) {
_queue.add(root);
while (!_queue.isEmpty) {
@@ -90,33 +78,27 @@
}
}
-/**
- * An AST visitor that will recursively visit all of the nodes in an AST
- * structure. For each node that is visited, the corresponding visit method on
- * one or more other visitors (the 'delegates') will be invoked.
- *
- * For example, if an instance of this class is created with two delegates V1
- * and V2, and that instance is used to visit the expression 'x + 1', then the
- * following visit methods will be invoked:
- * 1. V1.visitBinaryExpression
- * 2. V2.visitBinaryExpression
- * 3. V1.visitSimpleIdentifier
- * 4. V2.visitSimpleIdentifier
- * 5. V1.visitIntegerLiteral
- * 6. V2.visitIntegerLiteral
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// An AST visitor that will recursively visit all of the nodes in an AST
+/// structure. For each node that is visited, the corresponding visit method on
+/// one or more other visitors (the 'delegates') will be invoked.
+///
+/// For example, if an instance of this class is created with two delegates V1
+/// and V2, and that instance is used to visit the expression 'x + 1', then the
+/// following visit methods will be invoked:
+/// 1. V1.visitBinaryExpression
+/// 2. V2.visitBinaryExpression
+/// 3. V1.visitSimpleIdentifier
+/// 4. V2.visitSimpleIdentifier
+/// 5. V1.visitIntegerLiteral
+/// 6. V2.visitIntegerLiteral
+///
+/// Clients may not extend, implement or mix-in this class.
class DelegatingAstVisitor<T> extends UnifyingAstVisitor<T> {
- /**
- * The delegates whose visit methods will be invoked.
- */
+ /// The delegates whose visit methods will be invoked.
final Iterable<AstVisitor<T>> delegates;
- /**
- * Initialize a newly created visitor to use each of the given delegate
- * visitors to visit the nodes of an AST structure.
- */
+ /// Initialize a newly created visitor to use each of the given delegate
+ /// visitors to visit the nodes of an AST structure.
DelegatingAstVisitor(this.delegates);
@override
@@ -129,25 +111,23 @@
}
}
-/**
- * An AST visitor that will recursively visit all of the nodes in an AST
- * structure (like instances of the class [RecursiveAstVisitor]). In addition,
- * when a node of a specific type is visited not only will the visit method for
- * that specific type of node be invoked, but additional methods for the
- * superclasses of that node will also be invoked. For example, using an
- * instance of this class to visit a [Block] will cause the method [visitBlock]
- * to be invoked but will also cause the methods [visitStatement] and
- * [visitNode] to be subsequently invoked. This allows visitors to be written
- * that visit all statements without needing to override the visit method for
- * each of the specific subclasses of [Statement].
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or explicitly invoke the more general visit method. Failure to
- * do so will cause the visit methods for superclasses of the node to not be
- * invoked and will cause the children of the visited node to not be visited.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will recursively visit all of the nodes in an AST
+/// structure (like instances of the class [RecursiveAstVisitor]). In addition,
+/// when a node of a specific type is visited not only will the visit method for
+/// that specific type of node be invoked, but additional methods for the
+/// superclasses of that node will also be invoked. For example, using an
+/// instance of this class to visit a [Block] will cause the method [visitBlock]
+/// to be invoked but will also cause the methods [visitStatement] and
+/// [visitNode] to be subsequently invoked. This allows visitors to be written
+/// that visit all statements without needing to override the visit method for
+/// each of the specific subclasses of [Statement].
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or explicitly invoke the more general visit method. Failure to
+/// do so will cause the visit methods for superclasses of the node to not be
+/// invoked and will cause the children of the visited node to not be visited.
+///
+/// Clients may extend this class.
class GeneralizingAstVisitor<R>
with UIAsCodeVisitorMixin<R>
implements AstVisitor<R> {
@@ -332,7 +312,7 @@
visitForParts(node);
@override
- R visitForStatement2(ForStatement2 node) => visitStatement(node);
+ R visitForStatement(ForStatement node) => visitStatement(node);
R visitFunctionBody(FunctionBody node) => visitNode(node);
@@ -423,16 +403,8 @@
@override
R visitListLiteral(ListLiteral node) => visitTypedLiteral(node);
- @deprecated
- @override
- R visitListLiteral2(ListLiteral2 node) => visitTypedLiteral(node);
-
R visitLiteral(Literal node) => visitExpression(node);
- @deprecated
- @override
- R visitMapLiteral2(MapLiteral2 node) => visitTypedLiteral(node);
-
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitCollectionElement(node);
@@ -512,10 +484,6 @@
@override
R visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
- @deprecated
- @override
- R visitSetLiteral2(SetLiteral2 node) => visitTypedLiteral(node);
-
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => visitTypedLiteral(node);
@@ -623,18 +591,16 @@
R visitYieldStatement(YieldStatement node) => visitStatement(node);
}
-/**
- * An AST visitor that will recursively visit all of the nodes in an AST
- * structure. For example, using an instance of this class to visit a [Block]
- * will also cause all of the statements in the block to be visited.
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or must explicitly ask the visited node to visit its children.
- * Failure to do so will cause the children of the visited node to not be
- * visited.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will recursively visit all of the nodes in an AST
+/// structure. For example, using an instance of this class to visit a [Block]
+/// will also cause all of the statements in the block to be visited.
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or must explicitly ask the visited node to visit its children.
+/// Failure to do so will cause the children of the visited node to not be
+/// visited.
+///
+/// Clients may extend this class.
class RecursiveAstVisitor<R>
with UIAsCodeVisitorMixin<R>
implements AstVisitor<R> {
@@ -921,7 +887,7 @@
}
@override
- R visitForStatement2(ForStatement2 node) {
+ R visitForStatement(ForStatement node) {
node.visitChildren(this);
return null;
}
@@ -1070,20 +1036,6 @@
return null;
}
- @deprecated
- @override
- R visitListLiteral2(ListLiteral2 node) {
- node.visitChildren(this);
- return null;
- }
-
- @deprecated
- @override
- R visitMapLiteral2(MapLiteral2 node) {
- node.visitChildren(this);
- return null;
- }
-
@override
R visitMapLiteralEntry(MapLiteralEntry node) {
node.visitChildren(this);
@@ -1205,13 +1157,6 @@
return null;
}
- @deprecated
- @override
- R visitSetLiteral2(SetLiteral2 node) {
- node.visitChildren(this);
- return null;
- }
-
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) {
node.visitChildren(this);
@@ -1375,14 +1320,12 @@
}
}
-/**
- * An AST visitor that will do nothing when visiting an AST node. It is intended
- * to be a superclass for classes that use the visitor pattern primarily as a
- * dispatch mechanism (and hence don't need to recursively visit a whole
- * structure) and that only need to visit a small number of node types.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will do nothing when visiting an AST node. It is
+/// intended to be a superclass for classes that use the visitor pattern
+/// primarily as a dispatch mechanism (and hence don't need to recursively visit
+/// a whole structure) and that only need to visit a small number of node types.
+///
+/// Clients may extend this class.
class SimpleAstVisitor<R>
with UIAsCodeVisitorMixin<R>
implements AstVisitor<R> {
@@ -1528,7 +1471,7 @@
R visitForPartsWithExpression(ForPartsWithExpression node) => null;
@override
- R visitForStatement2(ForStatement2 node) => null;
+ R visitForStatement(ForStatement node) => null;
@override
R visitFunctionDeclaration(FunctionDeclaration node) => null;
@@ -1605,14 +1548,6 @@
@override
R visitListLiteral(ListLiteral node) => null;
- @deprecated
- @override
- R visitListLiteral2(ListLiteral2 node) => null;
-
- @deprecated
- @override
- R visitMapLiteral2(MapLiteral2 node) => null;
-
@override
R visitMapLiteralEntry(MapLiteralEntry node) => null;
@@ -1675,10 +1610,6 @@
@override
R visitScriptTag(ScriptTag node) => null;
- @deprecated
- @override
- R visitSetLiteral2(SetLiteral2 node) => null;
-
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => null;
@@ -1762,15 +1693,13 @@
R visitYieldStatement(YieldStatement node) => null;
}
-/**
- * An AST visitor that will throw an exception if any of the visit methods that
- * are invoked have not been overridden. It is intended to be a superclass for
- * classes that implement the visitor pattern and need to (a) override all of
- * the visit methods or (b) need to override a subset of the visit method and
- * want to catch when any other visit methods have been invoked.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will throw an exception if any of the visit methods that
+/// are invoked have not been overridden. It is intended to be a superclass for
+/// classes that implement the visitor pattern and need to (a) override all of
+/// the visit methods or (b) need to override a subset of the visit method and
+/// want to catch when any other visit methods have been invoked.
+///
+/// Clients may extend this class.
class ThrowingAstVisitor<R>
with UIAsCodeVisitorMixin<R>
implements AstVisitor<R> {
@@ -1920,7 +1849,7 @@
R visitForPartsWithExpression(ForPartsWithExpression node) => _throw(node);
@override
- R visitForStatement2(ForStatement2 node) => _throw(node);
+ R visitForStatement(ForStatement node) => _throw(node);
@override
R visitFunctionDeclaration(FunctionDeclaration node) => _throw(node);
@@ -1998,14 +1927,6 @@
@override
R visitListLiteral(ListLiteral node) => _throw(node);
- @deprecated
- @override
- R visitListLiteral2(ListLiteral2 node) => _throw(node);
-
- @deprecated
- @override
- R visitMapLiteral2(MapLiteral2 node) => _throw(node);
-
@override
R visitMapLiteralEntry(MapLiteralEntry node) => _throw(node);
@@ -2068,10 +1989,6 @@
@override
R visitScriptTag(ScriptTag node) => _throw(node);
- @deprecated
- @override
- R visitSetLiteral2(SetLiteral2 node) => _throw(node);
-
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => _throw(node);
@@ -2161,26 +2078,18 @@
}
}
-/**
- * An AST visitor that captures visit call timings.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// An AST visitor that captures visit call timings.
+///
+/// Clients may not extend, implement or mix-in this class.
class TimedAstVisitor<T> with UIAsCodeVisitorMixin<T> implements AstVisitor<T> {
- /**
- * The base visitor whose visit methods will be timed.
- */
+ /// The base visitor whose visit methods will be timed.
final AstVisitor<T> _baseVisitor;
- /**
- * Collects elapsed time for visit calls.
- */
+ /// Collects elapsed time for visit calls.
final Stopwatch stopwatch;
- /**
- * Initialize a newly created visitor to time calls to the given base
- * visitor's visits.
- */
+ /// Initialize a newly created visitor to time calls to the given base
+ /// visitor's visits.
TimedAstVisitor(this._baseVisitor, [Stopwatch watch])
: stopwatch = watch ?? new Stopwatch();
@@ -2561,9 +2470,9 @@
}
@override
- T visitForStatement2(ForStatement2 node) {
+ T visitForStatement(ForStatement node) {
stopwatch.start();
- T result = _baseVisitor.visitForStatement2(node);
+ T result = _baseVisitor.visitForStatement(node);
stopwatch.stop();
return result;
}
@@ -2760,24 +2669,6 @@
return result;
}
- @deprecated
- @override
- T visitListLiteral2(ListLiteral2 node) {
- stopwatch.start();
- T result = _baseVisitor.visitListLiteral2(node);
- stopwatch.stop();
- return result;
- }
-
- @deprecated
- @override
- T visitMapLiteral2(MapLiteral2 node) {
- stopwatch.start();
- T result = _baseVisitor.visitMapLiteral2(node);
- stopwatch.stop();
- return result;
- }
-
@override
T visitMapLiteralEntry(MapLiteralEntry node) {
stopwatch.start();
@@ -2939,15 +2830,6 @@
return result;
}
- @deprecated
- @override
- T visitSetLiteral2(SetLiteral2 node) {
- stopwatch.start();
- T result = _baseVisitor.visitSetLiteral2(node);
- stopwatch.stop();
- return result;
- }
-
@override
T visitSetOrMapLiteral(SetOrMapLiteral node) {
stopwatch.start();
@@ -3165,18 +3047,17 @@
}
}
-/**
- * An AST visitor that will recursively visit all of the nodes in an AST
- * structure (like instances of the class [RecursiveAstVisitor]). In addition,
- * every node will also be visited by using a single unified [visitNode] method.
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or explicitly invoke the more general [visitNode] method.
- * Failure to do so will cause the children of the visited node to not be
- * visited.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will recursively visit all of the nodes in an AST
+/// structure (like instances of the class [RecursiveAstVisitor]). In addition,
+/// every node will also be visited by using a single unified [visitNode]
+/// method.
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or explicitly invoke the more general [visitNode] method.
+/// Failure to do so will cause the children of the visited node to not be
+/// visited.
+///
+/// Clients may extend this class.
class UnifyingAstVisitor<R>
with UIAsCodeVisitorMixin<R>
implements AstVisitor<R> {
@@ -3327,7 +3208,7 @@
R visitForPartsWithExpression(ForPartsWithExpression node) => visitNode(node);
@override
- R visitForStatement2(ForStatement2 node) => visitNode(node);
+ R visitForStatement(ForStatement node) => visitNode(node);
@override
R visitFunctionDeclaration(FunctionDeclaration node) => visitNode(node);
@@ -3406,14 +3287,6 @@
@override
R visitListLiteral(ListLiteral node) => visitNode(node);
- @deprecated
- @override
- R visitListLiteral2(ListLiteral2 node) => visitNode(node);
-
- @deprecated
- @override
- R visitMapLiteral2(MapLiteral2 node) => visitNode(node);
-
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
@@ -3482,10 +3355,6 @@
@override
R visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
- @deprecated
- @override
- R visitSetLiteral2(SetLiteral2 node) => visitNode(node);
-
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => visitNode(node);
@@ -3572,19 +3441,13 @@
R visitYieldStatement(YieldStatement node) => visitNode(node);
}
-/**
- * A helper class used to implement the correct order of visits for a
- * [BreadthFirstVisitor].
- */
+/// A helper class used to implement the correct order of visits for a
+/// [BreadthFirstVisitor].
class _BreadthFirstChildVisitor extends UnifyingAstVisitor<void> {
- /**
- * The [BreadthFirstVisitor] being helped by this visitor.
- */
+ /// The [BreadthFirstVisitor] being helped by this visitor.
final BreadthFirstVisitor outerVisitor;
- /**
- * Initialize a newly created visitor to help the [outerVisitor].
- */
+ /// Initialize a newly created visitor to help the [outerVisitor].
_BreadthFirstChildVisitor(this.outerVisitor);
@override
diff --git a/analyzer/lib/dart/constant/value.dart b/analyzer/lib/dart/constant/value.dart
index 64a29c6..7799cc5 100644
--- a/analyzer/lib/dart/constant/value.dart
+++ b/analyzer/lib/dart/constant/value.dart
@@ -2,164 +2,134 @@
// 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.
-/**
- * The interface used to access the result of constant evaluation.
- *
- * Because the analyzer does not have any of the code under analysis loaded, it
- * does not do real evaluation. Instead it performs a symbolic computation and
- * presents those results through this interface.
- *
- * Instances of these constant values are accessed through the
- * [element model](../element/element.dart).
- */
+/// The interface used to access the result of constant evaluation.
+///
+/// Because the analyzer does not have any of the code under analysis loaded, it
+/// does not do real evaluation. Instead it performs a symbolic computation and
+/// presents those results through this interface.
+///
+/// Instances of these constant values are accessed through the
+/// [element model](../element/element.dart).
import 'package:analyzer/dart/element/type.dart';
-/**
- * A representation of the value of a compile-time constant expression.
- *
- * Note that, unlike the mirrors system, the object being represented does *not*
- * exist. This interface allows static analysis tools to determine something
- * about the state of the object that would exist if the code that creates the
- * object were executed, but none of the code being analyzed is actually
- * executed.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// A representation of the value of a compile-time constant expression.
+///
+/// Note that, unlike the mirrors system, the object being represented does *not*
+/// exist. This interface allows static analysis tools to determine something
+/// about the state of the object that would exist if the code that creates the
+/// object were executed, but none of the code being analyzed is actually
+/// executed.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class DartObject {
- /**
- * Return `true` if the value of the object being represented is known.
- *
- * This method will return `false` if
- * * the value being represented is the value of a declared variable (a
- * variable whose value is provided at run-time using a `-D` command-line
- * option), or
- * * the value is a function.
- *
- * The result of this method does not imply anything about the state of
- * object representations returned by the method [getField], those that are
- * elements of the list returned by [toListValue], or the keys or values in
- * the map returned by [toMapValue]. For example, a representation of a list
- * can return `true` even if one or more of the elements of that list would
- * return `false`.
- */
+ /// Return `true` if the value of the object being represented is known.
+ ///
+ /// This method will return `false` if
+ /// * the value being represented is the value of a declared variable (a
+ /// variable whose value is provided at run-time using a `-D` command-line
+ /// option), or
+ /// * the value is a function.
+ ///
+ /// The result of this method does not imply anything about the state of
+ /// object representations returned by the method [getField], those that are
+ /// elements of the list returned by [toListValue], or the keys or values in
+ /// the map returned by [toMapValue]. For example, a representation of a list
+ /// can return `true` even if one or more of the elements of that list would
+ /// return `false`.
bool get hasKnownValue;
- /**
- * Return `true` if the object being represented represents the value 'null'.
- */
+ /// Return `true` if the object being represented represents the value 'null'.
bool get isNull;
- /**
- * Return a representation of the type of the object being represented.
- *
- * For values resulting from the invocation of a 'const' constructor, this
- * will be a representation of the run-time type of the object.
- *
- * For values resulting from a literal expression, this will be a
- * representation of the static type of the value -- `int` for integer
- * literals, `List` for list literals, etc. -- even when the static type is an
- * abstract type (such as `List`) and hence will never be the run-time type of
- * the represented object.
- *
- * For values resulting from any other kind of expression, this will be a
- * representation of the result of evaluating the expression.
- *
- * Return `null` if the expression cannot be evaluated, either because it is
- * not a valid constant expression or because one or more of the values used
- * in the expression does not have a known value.
- *
- * This method can return a representation of the type, even if this object
- * would return `false` from [hasKnownValue].
- */
+ /// Return a representation of the type of the object being represented.
+ ///
+ /// For values resulting from the invocation of a 'const' constructor, this
+ /// will be a representation of the run-time type of the object.
+ ///
+ /// For values resulting from a literal expression, this will be a
+ /// representation of the static type of the value -- `int` for integer
+ /// literals, `List` for list literals, etc. -- even when the static type is an
+ /// abstract type (such as `List`) and hence will never be the run-time type of
+ /// the represented object.
+ ///
+ /// For values resulting from any other kind of expression, this will be a
+ /// representation of the result of evaluating the expression.
+ ///
+ /// Return `null` if the expression cannot be evaluated, either because it is
+ /// not a valid constant expression or because one or more of the values used
+ /// in the expression does not have a known value.
+ ///
+ /// This method can return a representation of the type, even if this object
+ /// would return `false` from [hasKnownValue].
ParameterizedType get type;
- /**
- * Return a representation of the value of the field with the given [name].
- *
- * Return `null` if either the object being represented does not have a field
- * with the given name or if the implementation of the class of the object is
- * invalid, making it impossible to determine that value of the field.
- *
- * Note that, unlike the mirrors API, this method does *not* invoke a getter;
- * it simply returns a representation of the known state of a field.
- */
+ /// Return a representation of the value of the field with the given [name].
+ ///
+ /// Return `null` if either the object being represented does not have a field
+ /// with the given name or if the implementation of the class of the object is
+ /// invalid, making it impossible to determine that value of the field.
+ ///
+ /// Note that, unlike the mirrors API, this method does *not* invoke a getter;
+ /// it simply returns a representation of the known state of a field.
DartObject getField(String name);
- /**
- * Return a boolean corresponding to the value of the object being
- * represented, or `null` if
- * * this object is not of type 'bool',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
+ /// Return a boolean corresponding to the value of the object being
+ /// represented, or `null` if
+ /// * this object is not of type 'bool',
+ /// * the value of the object being represented is not known, or
+ /// * the value of the object being represented is `null`.
bool toBoolValue();
- /**
- * Return a double corresponding to the value of the object being represented,
- * or `null`
- * if
- * * this object is not of type 'double',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
+ /// Return a double corresponding to the value of the object being represented,
+ /// or `null`
+ /// if
+ /// * this object is not of type 'double',
+ /// * the value of the object being represented is not known, or
+ /// * the value of the object being represented is `null`.
double toDoubleValue();
- /**
- * Return an integer corresponding to the value of the object being
- * represented, or `null` if
- * * this object is not of type 'int',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
+ /// Return an integer corresponding to the value of the object being
+ /// represented, or `null` if
+ /// * this object is not of type 'int',
+ /// * the value of the object being represented is not known, or
+ /// * the value of the object being represented is `null`.
int toIntValue();
- /**
- * Return a list corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'List', or
- * * the value of the object being represented is `null`.
- */
+ /// Return a list corresponding to the value of the object being represented,
+ /// or `null` if
+ /// * this object is not of type 'List', or
+ /// * the value of the object being represented is `null`.
List<DartObject> toListValue();
- /**
- * Return a map corresponding to the value of the object being represented, or
- * `null` if
- * * this object is not of type 'Map', or
- * * the value of the object being represented is `null`.
- */
+ /// Return a map corresponding to the value of the object being represented, or
+ /// `null` if
+ /// * this object is not of type 'Map', or
+ /// * the value of the object being represented is `null`.
Map<DartObject, DartObject> toMapValue();
- /**
- * Return a set corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'Set', or
- * * the value of the object being represented is `null`.
- */
+ /// Return a set corresponding to the value of the object being represented,
+ /// or `null` if
+ /// * this object is not of type 'Set', or
+ /// * the value of the object being represented is `null`.
Set<DartObject> toSetValue();
- /**
- * Return a string corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'String',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
+ /// Return a string corresponding to the value of the object being represented,
+ /// or `null` if
+ /// * this object is not of type 'String',
+ /// * the value of the object being represented is not known, or
+ /// * the value of the object being represented is `null`.
String toStringValue();
- /**
- * Return a string corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'Symbol', or
- * * the value of the object being represented is `null`.
- * (We return the string
- */
+ /// Return a string corresponding to the value of the object being represented,
+ /// or `null` if
+ /// * this object is not of type 'Symbol', or
+ /// * the value of the object being represented is `null`.
+ /// (We return the string
String toSymbolValue();
- /**
- * Return the representation of the type corresponding to the value of the
- * object being represented, or `null` if
- * * this object is not of type 'Type', or
- * * the value of the object being represented is `null`.
- */
+ /// Return the representation of the type corresponding to the value of the
+ /// object being represented, or `null` if
+ /// * this object is not of type 'Type', or
+ /// * the value of the object being represented is `null`.
DartType toTypeValue();
}
diff --git a/analyzer/lib/dart/element/element.dart b/analyzer/lib/dart/element/element.dart
index 156688d..7b42b5e 100644
--- a/analyzer/lib/dart/element/element.dart
+++ b/analyzer/lib/dart/element/element.dart
@@ -46,6 +46,7 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
+import 'package:meta/meta.dart';
/// An element that represents a class or a mixin. The class can be defined by
/// either a class declaration (with a class body), a mixin application (without
@@ -520,19 +521,26 @@
/// Return `true` if this element has an annotation of the form `@JS(..)`.
bool get hasJS;
- /// Return `true` if this element has an annotation of the form '@literal'.
+ /// Return `true` if this element has an annotation of the form `@literal`.
bool get hasLiteral;
+ /// Return `true` if this element has an annotation of the form `@mustCallSuper`.
+ bool get hasMustCallSuper;
+
+ /// Return `true` if this element has an annotation of the form
+ /// `@optionalTypeArgs`.
+ bool get hasOptionalTypeArgs;
+
/// Return `true` if this element has an annotation of the form `@override`.
bool get hasOverride;
/// Return `true` if this element has an annotation of the form `@protected`.
bool get hasProtected;
- /// Return `true` if this element has an annotation of the form '@required'.
+ /// Return `true` if this element has an annotation of the form `@required`.
bool get hasRequired;
- /// Return `true` if this element has an annotation of the form '@sealed'.
+ /// Return `true` if this element has an annotation of the form `@sealed`.
bool get hasSealed;
/// Return `true` if this element has an annotation of the form
@@ -747,6 +755,10 @@
/// overriding methods to call super.
bool get isMustCallSuper;
+ /// Return `true` if this annotation marks the associated type as
+ /// having "optional" type arguments.
+ bool get isOptionalTypeArgs;
+
/// Return `true` if this annotation marks the associated method as being
/// expected to override an inherited method.
bool get isOverride;
@@ -831,25 +843,27 @@
static const ElementKind NAME = const ElementKind('NAME', 15, "<name>");
+ static const ElementKind NEVER = const ElementKind('NEVER', 16, "<never>");
+
static const ElementKind PARAMETER =
- const ElementKind('PARAMETER', 16, "parameter");
+ const ElementKind('PARAMETER', 17, "parameter");
static const ElementKind PREFIX =
- const ElementKind('PREFIX', 17, "import prefix");
+ const ElementKind('PREFIX', 18, "import prefix");
- static const ElementKind SETTER = const ElementKind('SETTER', 18, "setter");
+ static const ElementKind SETTER = const ElementKind('SETTER', 19, "setter");
static const ElementKind TOP_LEVEL_VARIABLE =
- const ElementKind('TOP_LEVEL_VARIABLE', 19, "top level variable");
+ const ElementKind('TOP_LEVEL_VARIABLE', 20, "top level variable");
static const ElementKind FUNCTION_TYPE_ALIAS =
- const ElementKind('FUNCTION_TYPE_ALIAS', 20, "function type alias");
+ const ElementKind('FUNCTION_TYPE_ALIAS', 21, "function type alias");
static const ElementKind TYPE_PARAMETER =
- const ElementKind('TYPE_PARAMETER', 21, "type parameter");
+ const ElementKind('TYPE_PARAMETER', 22, "type parameter");
static const ElementKind UNIVERSE =
- const ElementKind('UNIVERSE', 22, "<universe>");
+ const ElementKind('UNIVERSE', 23, "<universe>");
static const List<ElementKind> values = const [
CLASS,
@@ -868,6 +882,7 @@
LOCAL_VARIABLE,
METHOD,
NAME,
+ NEVER,
PARAMETER,
PREFIX,
SETTER,
@@ -1039,7 +1054,7 @@
/// Return `true` if this field was explicitly marked as being covariant.
bool get isCovariant;
- /// Return {@code true} if this element is an enum constant.
+ /// Return `true` if this element is an enum constant.
bool get isEnumConstant;
/// Returns `true` if this field can be overridden in strong mode.
@@ -1316,7 +1331,14 @@
/// A local variable.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class LocalVariableElement implements LocalElement, VariableElement {}
+abstract class LocalVariableElement implements LocalElement, VariableElement {
+ /// Return `true` if this local variable uses late evaluation semantics.
+ ///
+ /// This will always return `false` unless the experiment 'non-nullable' is
+ /// enabled.
+ @experimental
+ bool get isLate;
+}
/// An element that represents a method defined within a type.
///
@@ -1381,23 +1403,35 @@
/// Return `true` if this parameter is an initializing formal parameter.
bool get isInitializingFormal;
- /// Return `true` if this parameter is a named parameter. Named parameters are
- /// always optional, even when they are annotated with the `@required`
- /// annotation.
+ /// Return `true` if this parameter is a named parameter. Named parameters
+ /// that are annotated with the `@required` annotation are considered
+ /// optional. Named parameters that are annotated with the `required` syntax
+ /// are considered required.
bool get isNamed;
/// Return `true` if this parameter is a required parameter. Required
- /// parameters are always positional.
+ /// parameters are always positional, unless the experiment 'non-nullable' is
+ /// enabled, in which case named parameters can also be required.
///
- /// Note: this will return `false` for a named parameter that is annotated
- /// with the `@required` annotation.
+ /// Note: regardless of the state of the 'non-nullable' experiment, this will
+ /// return `false` for a named parameter that is annotated with the
+ /// `@required` annotation.
// TODO(brianwilkerson) Rename this to `isRequired`.
bool get isNotOptional;
/// Return `true` if this parameter is an optional parameter. Optional
- /// parameters can either be positional or named.
+ /// parameters can either be positional or named. Named parameters that are
+ /// annotated with the `@required` annotation are considered optional. Named
+ /// parameters that are annotated with the `required` syntax are considered
+ /// required.
bool get isOptional;
+ /// Return `true` if this parameter is both an optional and named parameter.
+ /// Named parameters that are annotated with the `@required` annotation are
+ /// considered optional. Named parameters that are annotated with the
+ /// `required` syntax are considered required.
+ bool get isOptionalNamed;
+
/// Return `true` if this parameter is both an optional and positional
/// parameter.
bool get isOptionalPositional;
@@ -1406,6 +1440,16 @@
/// parameters can either be required or optional.
bool get isPositional;
+ /// Return `true` if this parameter is both a required and named parameter.
+ /// Named parameters that are annotated with the `@required` annotation are
+ /// considered optional. Named parameters that are annotated with the
+ /// `required` syntax are considered required.
+ bool get isRequiredNamed;
+
+ /// Return `true` if this parameter is both a required and positional
+ /// parameter.
+ bool get isRequiredPositional;
+
/// Return the kind of this parameter.
@deprecated
ParameterKind get parameterKind;
@@ -1504,6 +1548,13 @@
/// will be synthetic.
PropertyAccessorElement get getter;
+ /// Return `true` if this variable uses late evaluation semantics.
+ ///
+ /// This will always return `false` unless the experiment 'non-nullable' is
+ /// enabled.
+ @experimental
+ bool get isLate;
+
/// Return the propagated type of this variable, or `null` if type propagation
/// has not been performed, for example because the variable is not final.
@deprecated
diff --git a/analyzer/lib/dart/element/type.dart b/analyzer/lib/dart/element/type.dart
index c4beb80..ce67ab7 100644
--- a/analyzer/lib/dart/element/type.dart
+++ b/analyzer/lib/dart/element/type.dart
@@ -1,141 +1,109 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/**
- * Defines the type model. The type model is part of the
- * [element model](../dart_element_element/dart_element_element-library.html)
- * in that most types are defined by Dart code (the types `dynamic` and `void`
- * being the notable exceptions). All types are represented by an instance of a
- * subclass of [DartType].
- *
- * Other than `dynamic` and `void`, all of the types define either the interface
- * defined by a class (an instance of [InterfaceType]) or the type of a function
- * (an instance of [FunctionType]).
- *
- * We make a distinction between the declaration of a class (a [ClassElement])
- * and the type defined by that class (an [InterfaceType]). The biggest reason
- * for the distinction is to allow us to more cleanly represent the distinction
- * between type parameters and type arguments. For example, if we define a class
- * as `class Pair<K, V> {}`, the declarations of `K` and `V` represent type
- * parameters. But if we declare a variable as `Pair<String, int> pair;` the
- * references to `String` and `int` are type arguments.
- */
+/// Defines the type model. The type model is part of the
+/// [element model](../dart_element_element/dart_element_element-library.html)
+/// in that most types are defined by Dart code (the types `dynamic` and `void`
+/// being the notable exceptions). All types are represented by an instance of a
+/// subclass of [DartType].
+///
+/// Other than `dynamic` and `void`, all of the types define either the
+/// interface defined by a class (an instance of [InterfaceType]) or the type of
+/// a function (an instance of [FunctionType]).
+///
+/// We make a distinction between the declaration of a class (a [ClassElement])
+/// and the type defined by that class (an [InterfaceType]). The biggest reason
+/// for the distinction is to allow us to more cleanly represent the distinction
+/// between type parameters and type arguments. For example, if we define a
+/// class as `class Pair<K, V> {}`, the declarations of `K` and `V` represent
+/// type parameters. But if we declare a variable as `Pair<String, int> pair;`
+/// the references to `String` and `int` are type arguments.
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart' show InterfaceTypeImpl;
import 'package:analyzer/src/generated/type_system.dart' show TypeSystem;
-/**
- * The type associated with elements in the element model.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// The type associated with elements in the element model.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class DartType {
- /**
- * Return the name of this type as it should appear when presented to users in
- * contexts such as error messages.
- */
+ /// Return the name of this type as it should appear when presented to users
+ /// in contexts such as error messages.
String get displayName;
- /**
- * Return the element representing the declaration of this type, or `null` if
- * the type has not, or cannot, be associated with an element. The former case
- * will occur if the element model is not yet complete; the latter case will
- * occur if this object represents an undefined type.
- */
+ /// Return the element representing the declaration of this type, or `null` if
+ /// the type has not, or cannot, be associated with an element. The former
+ /// case will occur if the element model is not yet complete; the latter case
+ /// will occur if this object represents an undefined type.
Element get element;
- /**
- * Return `true` if this type represents the bottom type.
- */
+ /// Return `true` if this type represents the bottom type.
bool get isBottom;
- /**
- * Return `true` if this type represents the type 'Future' defined in the
- * dart:async library.
- */
+ /// Return `true` if this type represents the type 'Future' defined in the
+ /// dart:async library.
bool get isDartAsyncFuture;
- /**
- * Return `true` if this type represents the type 'FutureOr<T>' defined in the
- * dart:async library.
- */
+ /// Return `true` if this type represents the type 'FutureOr<T>' defined in
+ /// the dart:async library.
bool get isDartAsyncFutureOr;
- /**
- * Return `true` if this type represents the type 'bool' defined in the
- * dart:core library.
- */
+ /// Return `true` if this type represents the type 'bool' defined in the
+ /// dart:core library.
bool get isDartCoreBool;
- /**
- * Return `true` if this type represents the type 'double' defined in the
- * dart:core library.
- */
+ /// Return `true` if this type represents the type 'double' defined in the
+ /// dart:core library.
bool get isDartCoreDouble;
- /**
- * Return `true` if this type represents the type 'Function' defined in the
- * dart:core library.
- */
+ /// Return `true` if this type represents the type 'Function' defined in the
+ /// dart:core library.
bool get isDartCoreFunction;
- /**
- * Return `true` if this type represents the type 'int' defined in the
- * dart:core library.
- */
+ /// Return `true` if this type represents the type 'int' defined in the
+ /// dart:core library.
bool get isDartCoreInt;
- /**
- * Return `true` if this type represents the type 'Null' defined in the
- * dart:core library.
- */
+ /// Return `true` if this type represents the type 'Null' defined in the
+ /// dart:core library.
bool get isDartCoreNull;
- /**
- * Return `true` if this type represents the type 'dynamic'.
- */
+ /// Return `true` if this type represents the type 'String' defined in the
+ /// dart:core library.
+ bool get isDartCoreString;
+
+ /// Return `true` if this type represents the type 'dynamic'.
bool get isDynamic;
- /**
- * Return `true` if this type represents the type 'Object'.
- */
+ /// Return `true` if this type represents the type 'Object'.
bool get isObject;
- /**
- * Return `true` if this type represents a typename that couldn't be resolved.
- */
+ /// Return `true` if this type represents a typename that couldn't be
+ /// resolved.
+ @deprecated
bool get isUndefined;
- /**
- * Return `true` if this type represents the type 'void'.
- */
+ /// Return `true` if this type represents the type 'void'.
bool get isVoid;
- /**
- * Return the name of this type, or `null` if the type does not have a name,
- * such as when the type represents the type of an unnamed function.
- */
+ /// Return the name of this type, or `null` if the type does not have a name,
+ /// such as when the type represents the type of an unnamed function.
String get name;
- /**
- * Implements the function "flatten" defined in the spec, where T is this
- * type:
- *
- * If T = Future<S> then flatten(T) = flatten(S).
- *
- * Otherwise if T <: Future then let S be a type such that T << Future<S>
- * and for all R, if T << Future<R> then S << R. Then flatten(T) = S.
- *
- * In any other circumstance, flatten(T) = T.
- */
+ /// Implements the function "flatten" defined in the spec, where T is this
+ /// type:
+ ///
+ /// If T = Future<S> then flatten(T) = flatten(S).
+ ///
+ /// Otherwise if T <: Future then let S be a type such that T << Future<S>
+ /// and for all R, if T << Future<R> then S << R. Then flatten(T) = S.
+ ///
+ /// In any other circumstance, flatten(T) = T.
DartType flattenFutures(TypeSystem typeSystem);
- /**
- * Return `true` if this type is assignable to the given [type]. A type
- * <i>T</i> may be assigned to a type <i>S</i>, written <i>T</i> ⇔
- * <i>S</i>, iff either <i>T</i> <: <i>S</i> or <i>S</i> <: <i>T</i>.
- */
+ /// Return `true` if this type is assignable to the given [type]. A type
+ /// <i>T</i> may be assigned to a type <i>S</i>, written <i>T</i> ⇔
+ /// <i>S</i>, iff either <i>T</i> <: <i>S</i> or <i>S</i> <: <i>T</i>.
bool isAssignableTo(DartType type);
/// Indicates whether `this` represents a type that is equivalent to `dest`.
@@ -148,196 +116,165 @@
/// `isEquivalentTo` considers them to be equivalent.
bool isEquivalentTo(DartType dest);
- /**
- * Return `true` if this type is more specific than the given [type].
- */
+ /// Return `true` if this type is more specific than the given [type].
bool isMoreSpecificThan(DartType type);
- /**
- * Return `true` if this type is a subtype of the given [type].
- */
+ /// Return `true` if this type is a subtype of the given [type].
bool isSubtypeOf(DartType type);
- /**
- * Return `true` if this type is a supertype of the given [type]. A type
- * <i>S</i> is a supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff
- * <i>T</i> is a subtype of <i>S</i>.
- */
+ /// Return `true` if this type is a supertype of the given [type]. A type
+ /// <i>S</i> is a supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff
+ /// <i>T</i> is a subtype of <i>S</i>.
bool isSupertypeOf(DartType type);
- /**
- * If this type is a [TypeParameterType], returns its bound if it has one, or
- * [objectType] otherwise.
- *
- * For any other type, returns `this`. Applies recursively -- if the bound is
- * itself a type parameter, that is resolved too.
- */
+ /// If this type is a [TypeParameterType], returns its bound if it has one, or
+ /// [objectType] otherwise.
+ ///
+ /// For any other type, returns `this`. Applies recursively -- if the bound is
+ /// itself a type parameter, that is resolved too.
DartType resolveToBound(DartType objectType);
- /**
- * Return the type resulting from substituting the given [argumentTypes] for
- * the given [parameterTypes] in this type. The specification defines this
- * operation in section 2:
- * <blockquote>
- * The notation <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ...,
- * y<sub>n</sub>]E</i> denotes a copy of <i>E</i> in which all occurrences of
- * <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with
- * <i>x<sub>i</sub></i>.
- * </blockquote>
- * Note that, contrary to the specification, this method will not create a
- * copy of this type if no substitutions were required, but will return this
- * type directly.
- *
- * Note too that the current implementation of this method is only guaranteed
- * to work when the parameter types are type variables.
- */
+ /// Return the type resulting from substituting the given [argumentTypes] for
+ /// the given [parameterTypes] in this type. The specification defines this
+ /// operation in section 2:
+ /// <blockquote>
+ /// The notation <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ...,
+ /// y<sub>n</sub>]E</i> denotes a copy of <i>E</i> in which all occurrences of
+ /// <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with
+ /// <i>x<sub>i</sub></i>.
+ /// </blockquote>
+ /// Note that, contrary to the specification, this method will not create a
+ /// copy of this type if no substitutions were required, but will return this
+ /// type directly.
+ ///
+ /// Note too that the current implementation of this method is only guaranteed
+ /// to work when the parameter types are type variables.
DartType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
}
-/**
- * The type of a function, method, constructor, getter, or setter. Function
- * types come in three variations:
- *
- * * The types of functions that only have required parameters. These have the
- * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>.
- * * The types of functions with optional positional parameters. These have the
- * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub>
- * …, T<sub>n+k</sub>]) → T</i>.
- * * The types of functions with named parameters. These have the general form
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>, {T<sub>x1</sub> x1, …,
- * T<sub>xk</sub> xk}) → T</i>.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// The type of a function, method, constructor, getter, or setter. Function
+/// types come in three variations:
+///
+/// * The types of functions that only have required parameters. These have the
+/// general form <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>.
+/// * The types of functions with optional positional parameters. These have the
+/// general form <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub>
+/// …, T<sub>n+k</sub>]) → T</i>.
+/// * The types of functions with named parameters. These have the general form
+/// <i>(T<sub>1</sub>, …, T<sub>n</sub>, {T<sub>x1</sub> x1, …,
+/// T<sub>xk</sub> xk}) → T</i>.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class FunctionType implements ParameterizedType {
- /**
- * Deprecated: use [typeFormals].
- */
+ /// Deprecated: use [typeFormals].
@deprecated
List<TypeParameterElement> get boundTypeParameters;
- /**
- * Return a map from the names of named parameters to the types of the named
- * parameters of this type of function. The entries in the map will be
- * iterated in the same order as the order in which the named parameters were
- * defined. If there were no named parameters declared then the map will be
- * empty.
- */
+ /// Return a map from the names of named parameters to the types of the named
+ /// parameters of this type of function. The entries in the map will be
+ /// iterated in the same order as the order in which the named parameters were
+ /// defined. If there were no named parameters declared then the map will be
+ /// empty.
Map<String, DartType> get namedParameterTypes;
- /**
- * The names of the required positional parameters of this type of function,
- * in the order that the parameters appear.
- */
+ /// The names of the required positional parameters of this type of function,
+ /// in the order that the parameters appear.
List<String> get normalParameterNames;
- /**
- * Return a list containing the types of the normal parameters of this type of
- * function. The parameter types are in the same order as they appear in the
- * declaration of the function.
- */
+ /// Return a list containing the types of the normal parameters of this type
+ /// of function. The parameter types are in the same order as they appear in
+ /// the declaration of the function.
List<DartType> get normalParameterTypes;
- /**
- * The names of the optional positional parameters of this type of function,
- * in the order that the parameters appear.
- */
+ /// The names of the optional positional parameters of this type of function,
+ /// in the order that the parameters appear.
List<String> get optionalParameterNames;
- /**
- * Return a map from the names of optional (positional) parameters to the
- * types of the optional parameters of this type of function. The entries in
- * the map will be iterated in the same order as the order in which the
- * optional parameters were defined. If there were no optional parameters
- * declared then the map will be empty.
- */
+ /// Return a map from the names of optional (positional) parameters to the
+ /// types of the optional parameters of this type of function. The entries in
+ /// the map will be iterated in the same order as the order in which the
+ /// optional parameters were defined. If there were no optional parameters
+ /// declared then the map will be empty.
List<DartType> get optionalParameterTypes;
- /**
- * Return a list containing the parameters elements of this type of function.
- * The parameter types are in the same order as they appear in the declaration
- * of the function.
- */
+ /// Return a list containing the parameters elements of this type of function.
+ /// The parameter types are in the same order as they appear in the
+ /// declaration of the function.
List<ParameterElement> get parameters;
- /**
- * Return the type of object returned by this type of function.
- */
+ /// Return the type of object returned by this type of function.
DartType get returnType;
- /**
- * The formal type parameters of this generic function.
- * For example `<T> T -> T`.
- *
- * These are distinct from the [typeParameters] list, which contains type
- * parameters from surrounding contexts, and thus are free type variables from
- * the perspective of this function type.
- */
+ /// The formal type parameters of this generic function.
+ /// For example `<T> T -> T`.
+ ///
+ /// These are distinct from the [typeParameters] list, which contains type
+ /// parameters from surrounding contexts, and thus are free type variables
+ /// from the perspective of this function type.
List<TypeParameterElement> get typeFormals;
@override
FunctionType instantiate(List<DartType> argumentTypes);
- /**
- * Return `true` if this type is a subtype of the given [type].
- *
- * A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i> is
- * a subtype of the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>)
- * → S</i>, if all of the following conditions are met:
- *
- * * Either
- * * <i>S</i> is void, or
- * * <i>T ⇔ S</i>.
- *
- * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
- * S<sub>i</sub></i>.
- *
- * A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
- * [T<sub>n+1</sub>, …, T<sub>n+k</sub>]) → T</i> is a subtype of
- * the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
- * [S<sub>n+1</sub>, …, S<sub>n+m</sub>]) → S</i>, if all of the
- * following conditions are met:
- *
- * * Either
- * * <i>S</i> is void, or
- * * <i>T ⇔ S</i>.
- *
- * * <i>k</i> >= <i>m</i> and for all <i>i</i>, 1 <= <i>i</i> <= <i>n+m</i>,
- * <i>T<sub>i</sub> ⇔ S<sub>i</sub></i>.
- *
- * A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
- * {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) → T</i> is a subtype
- * of the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
- * {S<sub>y1</sub> y1, …, S<sub>ym</sub> ym}) → S</i>, if all of
- * the following conditions are met:
- * * Either
- * * <i>S</i> is void,
- * * or <i>T ⇔ S</i>.
- *
- * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
- * S<sub>i</sub></i>.
- * * <i>k</i> >= <i>m</i> and <i>y<sub>i</sub></i> in <i>{x<sub>1</sub>,
- * …, x<sub>k</sub>}</i>, 1 <= <i>i</i> <= <i>m</i>.
- * * For all <i>y<sub>i</sub></i> in <i>{y<sub>1</sub>, …,
- * y<sub>m</sub>}</i>, <i>y<sub>i</sub> = x<sub>j</sub> => Tj ⇔ Si</i>.
- *
- * In addition, the following subtype rules apply:
- *
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>, []) → T <: (T<sub>1</sub>,
- * …, T<sub>n</sub>) → T.</i><br>
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
- * …, T<sub>n</sub>, {}) → T.</i><br>
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>, {}) → T <: (T<sub>1</sub>,
- * …, T<sub>n</sub>) → T.</i><br>
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
- * …, T<sub>n</sub>, []) → T.</i>
- *
- * All functions implement the class `Function`. However not all function
- * types are a subtype of `Function`. If an interface type <i>I</i> includes a
- * method named `call()`, and the type of `call()` is the function type
- * <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
- */
+ /// Return `true` if this type is a subtype of the given [type].
+ ///
+ /// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>
+ /// is a subtype of the function type <i>(S<sub>1</sub>, …,
+ /// S<sub>n</sub>) → S</i>, if all of the following conditions are met:
+ ///
+ /// * Either
+ /// * <i>S</i> is void, or
+ /// * <i>T ⇔ S</i>.
+ ///
+ /// * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
+ /// S<sub>i</sub></i>.
+ ///
+ /// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
+ /// [T<sub>n+1</sub>, …, T<sub>n+k</sub>]) → T</i> is a subtype of
+ /// the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
+ /// [S<sub>n+1</sub>, …, S<sub>n+m</sub>]) → S</i>, if all of the
+ /// following conditions are met:
+ ///
+ /// * Either
+ /// * <i>S</i> is void, or
+ /// * <i>T ⇔ S</i>.
+ ///
+ /// * <i>k</i> >= <i>m</i> and for all <i>i</i>, 1 <= <i>i</i> <= <i>n+m</i>,
+ /// <i>T<sub>i</sub> ⇔ S<sub>i</sub></i>.
+ ///
+ /// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
+ /// {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) → T</i> is a
+ /// subtype of the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
+ /// {S<sub>y1</sub> y1, …, S<sub>ym</sub> ym}) → S</i>, if all of
+ /// the following conditions are met:
+ /// * Either
+ /// * <i>S</i> is void,
+ /// * or <i>T ⇔ S</i>.
+ ///
+ /// * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
+ /// S<sub>i</sub></i>.
+ /// * <i>k</i> >= <i>m</i> and <i>y<sub>i</sub></i> in <i>{x<sub>1</sub>,
+ /// …, x<sub>k</sub>}</i>, 1 <= <i>i</i> <= <i>m</i>.
+ /// * For all <i>y<sub>i</sub></i> in <i>{y<sub>1</sub>, …,
+ /// y<sub>m</sub>}</i>, <i>y<sub>i</sub> = x<sub>j</sub> => Tj ⇔
+ /// Si</i>.
+ ///
+ /// In addition, the following subtype rules apply:
+ ///
+ /// <i>(T<sub>1</sub>, …, T<sub>n</sub>, []) → T <:
+ /// (T<sub>1</sub>, …, T<sub>n</sub>) → T.</i><br>
+ /// <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
+ /// …, T<sub>n</sub>, {}) → T.</i><br>
+ /// <i>(T<sub>1</sub>, …, T<sub>n</sub>, {}) → T <:
+ /// (T<sub>1</sub>, …, T<sub>n</sub>) → T.</i><br>
+ /// <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
+ /// …, T<sub>n</sub>, []) → T.</i>
+ ///
+ /// All functions implement the class `Function`. However not all function
+ /// types are a subtype of `Function`. If an interface type <i>I</i> includes
+ /// a method named `call()`, and the type of `call()` is the function type
+ /// <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
@override
bool isSubtypeOf(DartType type);
@@ -345,318 +282,269 @@
FunctionType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
- /**
- * Return the type resulting from substituting the given [argumentTypes] for
- * this type's parameters. This is fully equivalent to
- * `substitute(argumentTypes, getTypeArguments())`.
- */
+ /// Return the type resulting from substituting the given [argumentTypes] for
+ /// this type's parameters. This is fully equivalent to
+ /// `substitute(argumentTypes, getTypeArguments())`.
@deprecated // use instantiate
FunctionType substitute3(List<DartType> argumentTypes);
}
-/**
- * The type introduced by either a class or an interface, or a reference to such
- * a type.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// The type introduced by either a class or an interface, or a reference to
+/// such a type.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class InterfaceType implements ParameterizedType {
- /**
- * Return a list containing all of the accessors (getters and setters)
- * declared in this type.
- */
+ /// Return a list containing all of the accessors (getters and setters)
+ /// declared in this type.
List<PropertyAccessorElement> get accessors;
- /**
- * Return a list containing all of the constructors declared in this type.
- */
+ /// Return a list containing all of the constructors declared in this type.
List<ConstructorElement> get constructors;
@override
ClassElement get element;
- /**
- * Return a list containing all of the interfaces that are implemented by this
- * interface. Note that this is <b>not</b>, in general, equivalent to getting
- * the interfaces from this type's element because the types returned by this
- * method will have had their type parameters replaced.
- */
+ /// Return a list containing all of the interfaces that are implemented by
+ /// this interface. Note that this is <b>not</b>, in general, equivalent to
+ /// getting the interfaces from this type's element because the types returned
+ /// by this method will have had their type parameters replaced.
List<InterfaceType> get interfaces;
- /**
- * Return a list containing all of the methods declared in this type.
- */
+ /// Return a list containing all of the methods declared in this type.
List<MethodElement> get methods;
- /**
- * Return a list containing all of the mixins that are applied to the class
- * being extended in order to derive the superclass of this class. Note that
- * this is <b>not</b>, in general, equivalent to getting the mixins from this
- * type's element because the types returned by this method will have had
- * their type parameters replaced.
- */
+ /// Return a list containing all of the mixins that are applied to the class
+ /// being extended in order to derive the superclass of this class. Note that
+ /// this is <b>not</b>, in general, equivalent to getting the mixins from this
+ /// type's element because the types returned by this method will have had
+ /// their type parameters replaced.
List<InterfaceType> get mixins;
- /**
- * Return the type representing the superclass of this type, or null if this
- * type represents the class 'Object'. Note that this is <b>not</b>, in
- * general, equivalent to getting the superclass from this type's element
- * because the type returned by this method will have had it's type parameters
- * replaced.
- */
+ /// Return the type representing the superclass of this type, or null if this
+ /// type represents the class 'Object'. Note that this is <b>not</b>, in
+ /// general, equivalent to getting the superclass from this type's element
+ /// because the type returned by this method will have had it's type
+ /// parameters replaced.
InterfaceType get superclass;
- /**
- * Return a list containing all of the super-class constraints that this
- * mixin declaration declares. The list will be empty if this class does not
- * represent a mixin declaration.
- */
+ /// Return a list containing all of the super-class constraints that this
+ /// mixin declaration declares. The list will be empty if this class does not
+ /// represent a mixin declaration.
List<InterfaceType> get superclassConstraints;
- /**
- * Return the element representing the getter with the given [name] that is
- * declared in this class, or `null` if this class does not declare a getter
- * with the given name.
- */
+ /// Return the element representing the getter with the given [name] that is
+ /// declared in this class, or `null` if this class does not declare a getter
+ /// with the given name.
PropertyAccessorElement getGetter(String name);
- /**
- * Return the element representing the method with the given [name] that is
- * declared in this class, or `null` if this class does not declare a method
- * with the given name.
- */
+ /// Return the element representing the method with the given [name] that is
+ /// declared in this class, or `null` if this class does not declare a method
+ /// with the given name.
MethodElement getMethod(String name);
- /**
- * Return the element representing the setter with the given [name] that is
- * declared in this class, or `null` if this class does not declare a setter
- * with the given name.
- */
+ /// Return the element representing the setter with the given [name] that is
+ /// declared in this class, or `null` if this class does not declare a setter
+ /// with the given name.
PropertyAccessorElement getSetter(String name);
@override
InterfaceType instantiate(List<DartType> argumentTypes);
- /**
- * Return `true` if this type is a direct supertype of the given [type]. The
- * implicit interface of class <i>I</i> is a direct supertype of the implicit
- * interface of class <i>J</i> iff:
- *
- * * <i>I</i> is Object, and <i>J</i> has no extends clause.
- * * <i>I</i> is listed in the extends clause of <i>J</i>.
- * * <i>I</i> is listed in the implements clause of <i>J</i>.
- * * <i>I</i> is listed in the with clause of <i>J</i>.
- * * <i>J</i> is a mixin application of the mixin of <i>I</i>.
- */
+ /// Return `true` if this type is a direct supertype of the given [type]. The
+ /// implicit interface of class <i>I</i> is a direct supertype of the implicit
+ /// interface of class <i>J</i> iff:
+ ///
+ /// * <i>I</i> is Object, and <i>J</i> has no extends clause.
+ /// * <i>I</i> is listed in the extends clause of <i>J</i>.
+ /// * <i>I</i> is listed in the implements clause of <i>J</i>.
+ /// * <i>I</i> is listed in the with clause of <i>J</i>.
+ /// * <i>J</i> is a mixin application of the mixin of <i>I</i>.
bool isDirectSupertypeOf(InterfaceType type);
- /**
- * Return `true` if this type is more specific than the given [type]. An
- * interface type <i>T</i> is more specific than an interface type <i>S</i>,
- * written <i>T « S</i>, if one of the following conditions is met:
- *
- * * Reflexivity: <i>T</i> is <i>S</i>.
- * * <i>T</i> is bottom.
- * * <i>S</i> is dynamic.
- * * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>.
- * * <i>T</i> is a type parameter and <i>S</i> is the upper bound of <i>T</i>.
- * * Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …,
- * T<sub>n</sub>></i> and S</i> is of the form <i>I<S<sub>1</sub>,
- * …, S<sub>n</sub>></i> and <i>T<sub>i</sub> «
- * S<sub>i</sub></i>, <i>1 <= i <= n</i>.
- * * Transitivity: <i>T « U</i> and <i>U « S</i>.
- */
+ /// Return `true` if this type is more specific than the given [type]. An
+ /// interface type <i>T</i> is more specific than an interface type <i>S</i>,
+ /// written <i>T « S</i>, if one of the following conditions is met:
+ ///
+ /// * Reflexivity: <i>T</i> is <i>S</i>.
+ /// * <i>T</i> is bottom.
+ /// * <i>S</i> is dynamic.
+ /// * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>.
+ /// * <i>T</i> is a type parameter and <i>S</i> is the upper bound of
+ /// <i>T</i>.
+ /// * Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …,
+ /// T<sub>n</sub>></i> and S</i> is of the form <i>I<S<sub>1</sub>,
+ /// …, S<sub>n</sub>></i> and <i>T<sub>i</sub> «
+ /// S<sub>i</sub></i>, <i>1 <= i <= n</i>.
+ /// * Transitivity: <i>T « U</i> and <i>U « S</i>.
@override
bool isMoreSpecificThan(DartType type);
- /**
- * Return `true` if this type is a subtype of the given [type]. An interface
- * type <i>T</i> is a subtype of an interface type <i>S</i>, written <i>T</i>
- * <: <i>S</i>, iff <i>[bottom/dynamic]T</i> « <i>S</i> (<i>T</i> is
- * more specific than <i>S</i>). If an interface type <i>I</i> includes a
- * method named <i>call()</i>, and the type of <i>call()</i> is the function
- * type <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
- */
+ /// Return `true` if this type is a subtype of the given [type]. An interface
+ /// type <i>T</i> is a subtype of an interface type <i>S</i>, written <i>T</i>
+ /// <: <i>S</i>, iff <i>[bottom/dynamic]T</i> « <i>S</i> (<i>T</i> is
+ /// more specific than <i>S</i>). If an interface type <i>I</i> includes a
+ /// method named <i>call()</i>, and the type of <i>call()</i> is the function
+ /// type <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
@override
bool isSubtypeOf(DartType type);
- /**
- * Return the element representing the constructor that results from looking
- * up the constructor with the given [name] in this class with respect to the
- * given [library], or `null` if the look up fails. The behavior of this
- * method is defined by the Dart Language Specification in section 12.11.1:
- * <blockquote>
- * If <i>e</i> is of the form <b>new</b> <i>T.id()</i> then let <i>q<i> be the
- * constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor <i>T<i>.
- * Otherwise, if <i>q</i> is not defined or not accessible, a
- * NoSuchMethodException is thrown.
- * </blockquote>
- */
+ /// Return the element representing the constructor that results from looking
+ /// up the constructor with the given [name] in this class with respect to the
+ /// given [library], or `null` if the look up fails. The behavior of this
+ /// method is defined by the Dart Language Specification in section 12.11.1:
+ /// <blockquote>
+ /// If <i>e</i> is of the form <b>new</b> <i>T.id()</i> then let <i>q<i> be
+ /// the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor
+ /// <i>T<i>. Otherwise, if <i>q</i> is not defined or not accessible, a
+ /// NoSuchMethodException is thrown.
+ /// </blockquote>
ConstructorElement lookUpConstructor(String name, LibraryElement library);
- /**
- * Return the element representing the getter that results from looking up the
- * getter with the given [name] in this class with respect to the given
- * [library], or `null` if the look up fails. The behavior of this method is
- * defined by the Dart Language Specification in section 12.15.1:
- * <blockquote>
- * The result of looking up getter (respectively setter) <i>m</i> in class
- * <i>C</i> with respect to library <i>L</i> is:
- * * If <i>C</i> declares an instance getter (respectively setter) named
- * <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- * setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- * superclass <i>S</i>, then the result of the lookup is the result of
- * looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect
- * to <i>L</i>. Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the getter that results from looking up
+ /// the getter with the given [name] in this class with respect to the given
+ /// [library], or `null` if the look up fails. The behavior of this method is
+ /// defined by the Dart Language Specification in section 12.15.1:
+ /// <blockquote>
+ /// The result of looking up getter (respectively setter) <i>m</i> in class
+ /// <i>C</i> with respect to library <i>L</i> is:
+ /// * If <i>C</i> declares an instance getter (respectively setter) named
+ /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
+ /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
+ /// superclass <i>S</i>, then the result of the lookup is the result of
+ /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
+ /// </blockquote>
PropertyAccessorElement lookUpGetter(String name, LibraryElement library);
- /**
- * Return the element representing the getter that results from looking up the
- * getter with the given [name] in the superclass of this class with respect
- * to the given [library], or `null` if the look up fails. The behavior of
- * this method is defined by the Dart Language Specification in section
- * 12.15.1:
- * <blockquote>
- * The result of looking up getter (respectively setter) <i>m</i> in class
- * <i>C</i> with respect to library <i>L</i> is:
- * * If <i>C</i> declares an instance getter (respectively setter) named
- * <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- * setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- * superclass <i>S</i>, then the result of the lookup is the result of
- * looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect
- * to <i>L</i>. Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the getter that results from looking up
+ /// the getter with the given [name] in the superclass of this class with
+ /// respect to the given [library], or `null` if the look up fails. The
+ /// behavior of this method is defined by the Dart Language Specification in
+ /// section 12.15.1:
+ /// <blockquote>
+ /// The result of looking up getter (respectively setter) <i>m</i> in class
+ /// <i>C</i> with respect to library <i>L</i> is:
+ /// * If <i>C</i> declares an instance getter (respectively setter) named
+ /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
+ /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
+ /// superclass <i>S</i>, then the result of the lookup is the result of
+ /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
+ /// </blockquote>
PropertyAccessorElement lookUpGetterInSuperclass(
String name, LibraryElement library);
- /**
- * Look up the member with the given [name] in this type and all extended
- * and mixed in classes, and by default including [thisType]. If the search
- * fails, this will then search interfaces.
- *
- * Return the element representing the member that was found, or `null` if
- * there is no getter with the given name.
- *
- * The [library] determines if a private member name is visible, and does not
- * need to be supplied for public names.
- */
+ /// Look up the member with the given [name] in this type and all extended
+ /// and mixed in classes, and by default including [thisType]. If the search
+ /// fails, this will then search interfaces.
+ ///
+ /// Return the element representing the member that was found, or `null` if
+ /// there is no getter with the given name.
+ ///
+ /// The [library] determines if a private member name is visible, and does not
+ /// need to be supplied for public names.
PropertyAccessorElement lookUpInheritedGetter(String name,
{LibraryElement library, bool thisType: true});
- /**
- * Look up the member with the given [name] in this type and all extended
- * and mixed in classes, starting from this type. If the search fails,
- * search interfaces.
- *
- * Return the element representing the member that was found, or `null` if
- * there is no getter with the given name.
- *
- * The [library] determines if a private member name is visible, and does not
- * need to be supplied for public names.
- */
+ /// Look up the member with the given [name] in this type and all extended
+ /// and mixed in classes, starting from this type. If the search fails,
+ /// search interfaces.
+ ///
+ /// Return the element representing the member that was found, or `null` if
+ /// there is no getter with the given name.
+ ///
+ /// The [library] determines if a private member name is visible, and does not
+ /// need to be supplied for public names.
ExecutableElement lookUpInheritedGetterOrMethod(String name,
{LibraryElement library});
- /**
- * Look up the member with the given [name] in this type and all extended
- * and mixed in classes, and by default including [thisType]. If the search
- * fails, this will then search interfaces.
- *
- * Return the element representing the member that was found, or `null` if
- * there is no getter with the given name.
- *
- * The [library] determines if a private member name is visible, and does not
- * need to be supplied for public names.
- */
+ /// Look up the member with the given [name] in this type and all extended
+ /// and mixed in classes, and by default including [thisType]. If the search
+ /// fails, this will then search interfaces.
+ ///
+ /// Return the element representing the member that was found, or `null` if
+ /// there is no getter with the given name.
+ ///
+ /// The [library] determines if a private member name is visible, and does not
+ /// need to be supplied for public names.
MethodElement lookUpInheritedMethod(String name,
{LibraryElement library, bool thisType: true});
- /**
- * Look up the member with the given [name] in this type and all extended
- * and mixed in classes, and by default including [thisType]. If the search
- * fails, this will then search interfaces.
- *
- * Return the element representing the member that was found, or `null` if
- * there is no getter with the given name.
- *
- * The [library] determines if a private member name is visible, and does not
- * need to be supplied for public names.
- */
+ /// Look up the member with the given [name] in this type and all extended
+ /// and mixed in classes, and by default including [thisType]. If the search
+ /// fails, this will then search interfaces.
+ ///
+ /// Return the element representing the member that was found, or `null` if
+ /// there is no getter with the given name.
+ ///
+ /// The [library] determines if a private member name is visible, and does not
+ /// need to be supplied for public names.
PropertyAccessorElement lookUpInheritedSetter(String name,
{LibraryElement library, bool thisType: true});
- /**
- * Return the element representing the method that results from looking up the
- * method with the given [name] in this class with respect to the given
- * [library], or `null` if the look up fails. The behavior of this method is
- * defined by the Dart Language Specification in section 12.15.1:
- * <blockquote>
- * The result of looking up method <i>m</i> in class <i>C</i> with respect to
- * library <i>L</i> is:
- * * If <i>C</i> declares an instance method named <i>m</i> that is accessible
- * to <i>L</i>, then that method is the result of the lookup. Otherwise, if
- * <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the
- * result of looking up method <i>m</i> in <i>S</i> with respect to <i>L</i>
- * Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the method that results from looking up
+ /// the method with the given [name] in this class with respect to the given
+ /// [library], or `null` if the look up fails. The behavior of this method is
+ /// defined by the Dart Language Specification in section 12.15.1:
+ /// <blockquote>
+ /// The result of looking up method <i>m</i> in class <i>C</i> with respect to
+ /// library <i>L</i> is:
+ /// * If <i>C</i> declares an instance method named <i>m</i> that is
+ /// accessible to <i>L</i>, then that method is the result of the lookup.
+ /// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
+ /// lookup is the result of looking up method <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i> Otherwise, we say that the lookup has failed.
+ /// </blockquote>
MethodElement lookUpMethod(String name, LibraryElement library);
- /**
- * Return the element representing the method that results from looking up the
- * method with the given [name] in the superclass of this class with respect
- * to the given [library], or `null` if the look up fails. The behavior of
- * this method is defined by the Dart Language Specification in section
- * 12.15.1:
- * <blockquote>
- * The result of looking up method <i>m</i> in class <i>C</i> with respect to
- * library <i>L</i> is:
- * * If <i>C</i> declares an instance method named <i>m</i> that is accessible
- * to <i>L</i>, then that method is the result of the lookup. Otherwise, if
- * <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the
- * result of looking up method <i>m</i> in <i>S</i> with respect to <i>L</i>.
- * Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the method that results from looking up
+ /// the method with the given [name] in the superclass of this class with
+ /// respect to the given [library], or `null` if the look up fails. The
+ /// behavior of this method is defined by the Dart Language Specification in
+ /// section 12.15.1:
+ /// <blockquote>
+ /// The result of looking up method <i>m</i> in class <i>C</i> with respect to
+ /// library <i>L</i> is:
+ /// * If <i>C</i> declares an instance method named <i>m</i> that is
+ /// accessible to <i>L</i>, then that method is the result of the lookup.
+ /// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
+ /// * lookup is the result of looking up method <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i>.
+ /// * Otherwise, we say that the lookup has failed.
+ /// </blockquote>
MethodElement lookUpMethodInSuperclass(String name, LibraryElement library);
- /**
- * Return the element representing the setter that results from looking up the
- * setter with the given [name] in this class with respect to the given
- * [library], or `null` if the look up fails. The behavior of this method is
- * defined by the Dart Language Specification in section 12.16:
- * <blockquote>
- * The result of looking up getter (respectively setter) <i>m</i> in class
- * <i>C</i> with respect to library <i>L</i> is:
- * * If <i>C</i> declares an instance getter (respectively setter) named
- * <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- * setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- * superclass <i>S</i>, then the result of the lookup is the result of
- * looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect
- * to <i>L</i>. Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the setter that results from looking up
+ /// the setter with the given [name] in this class with respect to the given
+ /// [library], or `null` if the look up fails. The behavior of this method is
+ /// defined by the Dart Language Specification in section 12.16:
+ /// <blockquote>
+ /// The result of looking up getter (respectively setter) <i>m</i> in class
+ /// <i>C</i> with respect to library <i>L</i> is:
+ /// * If <i>C</i> declares an instance getter (respectively setter) named
+ /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
+ /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
+ /// superclass <i>S</i>, then the result of the lookup is the result of
+ /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
+ /// </blockquote>
PropertyAccessorElement lookUpSetter(String name, LibraryElement library);
- /**
- * Return the element representing the setter that results from looking up the
- * setter with the given [name] in the superclass of this class with respect
- * to the given [library], or `null` if the look up fails. The behavior of
- * this method is defined by the Dart Language Specification in section 12.16:
- * <blockquote>
- * The result of looking up getter (respectively setter) <i>m</i> in class
- * <i>C</i> with respect to library <i>L</i> is:
- * * If <i>C</i> declares an instance getter (respectively setter) named
- * <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
- * setter) is the result of the lookup. Otherwise, if <i>C</i> has a
- * superclass <i>S</i>, then the result of the lookup is the result of
- * looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect
- * to <i>L</i>. Otherwise, we say that the lookup has failed.
- * </blockquote>
- */
+ /// Return the element representing the setter that results from looking up
+ /// the setter with the given [name] in the superclass of this class with
+ /// respect to the given [library], or `null` if the look up fails. The
+ /// behavior of this method is defined by the Dart Language Specification in
+ /// section 12.16:
+ /// <blockquote>
+ /// The result of looking up getter (respectively setter) <i>m</i> in class
+ /// <i>C</i> with respect to library <i>L</i> is:
+ /// * If <i>C</i> declares an instance getter (respectively setter) named
+ /// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
+ /// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
+ /// superclass <i>S</i>, then the result of the lookup is the result of
+ /// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
+ /// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
+ /// </blockquote>
PropertyAccessorElement lookUpSetterInSuperclass(
String name, LibraryElement library);
@@ -664,84 +552,67 @@
InterfaceType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
- /**
- * Return the type resulting from substituting the given arguments for this
- * type's parameters. This is fully equivalent to `substitute2(argumentTypes,
- * getTypeArguments())`.
- */
+ /// Return the type resulting from substituting the given arguments for this
+ /// type's parameters. This is fully equivalent to `substitute2(argumentTypes,
+ /// getTypeArguments())`.
@deprecated // use instantiate
InterfaceType substitute4(List<DartType> argumentTypes);
- /**
- * Returns a "smart" version of the "least upper bound" of the given types.
- *
- * If these types have the same element and differ only in terms of the type
- * arguments, attempts to find a compatible set of type arguments.
- *
- * Otherwise, returns the same result as [DartType.getLeastUpperBound].
- */
+ /// Returns a "smart" version of the "least upper bound" of the given types.
+ ///
+ /// If these types have the same element and differ only in terms of the type
+ /// arguments, attempts to find a compatible set of type arguments.
+ ///
+ /// Otherwise, returns the same result as [DartType.getLeastUpperBound].
// TODO(brianwilkerson) This needs to be deprecated and moved to TypeSystem.
static InterfaceType getSmartLeastUpperBound(
InterfaceType first, InterfaceType second) =>
InterfaceTypeImpl.getSmartLeastUpperBound(first, second);
}
-/**
- * A type that can track substituted type parameters, either for itself after
- * instantiation, or from a surrounding context.
- *
- * For example, given a class `Foo<T>`, after instantiation with S for T, it
- * will track the substitution `{S/T}`.
- *
- * This substitution will be propagated to its members. For example, say our
- * `Foo<T>` class has a field `T bar;`. When we look up this field, we will get
- * back a [FieldElement] that tracks the substituted type as `{S/T}T`, so when
- * we ask for the field type we will get `S`.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// A type that can track substituted type parameters, either for itself after
+/// instantiation, or from a surrounding context.
+///
+/// For example, given a class `Foo<T>`, after instantiation with S for T, it
+/// will track the substitution `{S/T}`.
+///
+/// This substitution will be propagated to its members. For example, say our
+/// `Foo<T>` class has a field `T bar;`. When we look up this field, we will get
+/// back a [FieldElement] that tracks the substituted type as `{S/T}T`, so when
+/// we ask for the field type we will get `S`.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class ParameterizedType implements DartType {
- /**
- * Return a list containing the actual types of the type arguments. If this
- * type's element does not have type parameters, then the array should be
- * empty (although it is possible for type arguments to be erroneously
- * declared). If the element has type parameters and the actual type does not
- * explicitly include argument values, then the type "dynamic" will be
- * automatically provided.
- */
+ /// Return a list containing the actual types of the type arguments. If this
+ /// type's element does not have type parameters, then the array should be
+ /// empty (although it is possible for type arguments to be erroneously
+ /// declared). If the element has type parameters and the actual type does not
+ /// explicitly include argument values, then the type "dynamic" will be
+ /// automatically provided.
List<DartType> get typeArguments;
- /**
- * Return a list containing all of the type parameters declared for this type.
- */
+ /// Return a list containing all of the type parameters declared for this
+ /// type.
List<TypeParameterElement> get typeParameters;
- /**
- * Return the type resulting from instantiating (replacing) the given
- * [argumentTypes] for this type's bound type parameters.
- */
+ /// Return the type resulting from instantiating (replacing) the given
+ /// [argumentTypes] for this type's bound type parameters.
ParameterizedType instantiate(List<DartType> argumentTypes);
}
-/**
- * The type introduced by a type parameter.
- *
- * Clients may not extend, implement or mix-in this class.
- */
+/// The type introduced by a type parameter.
+///
+/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameterType implements DartType {
- /**
- * Return the type representing the bound associated with this parameter,
- * or `dynamic` if there was no explicit bound.
- */
+ /// Return the type representing the bound associated with this parameter,
+ /// or `dynamic` if there was no explicit bound.
DartType get bound;
- /**
- * An object that can be used to identify this type parameter with `==`.
- *
- * Depending on the use, [bound] may also need to be taken into account.
- * A given type parameter, it may have different bounds in different scopes.
- * Always consult the bound if that could be relevant.
- */
+ /// An object that can be used to identify this type parameter with `==`.
+ ///
+ /// Depending on the use, [bound] may also need to be taken into account.
+ /// A given type parameter, it may have different bounds in different scopes.
+ /// Always consult the bound if that could be relevant.
ElementLocation get definition;
@override
diff --git a/analyzer/lib/dart/element/type_system.dart b/analyzer/lib/dart/element/type_system.dart
index 769a5d9..df6cbe8 100644
--- a/analyzer/lib/dart/element/type_system.dart
+++ b/analyzer/lib/dart/element/type_system.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/type.dart';
+import 'package:meta/meta.dart';
/// A representation of the operations defined for the type system.
///
@@ -50,6 +51,61 @@
/// important.
bool isAssignableTo(DartType leftType, DartType rightType);
+ /// Return `true` if the [type] is a non-nullable type.
+ ///
+ /// We say that a type `T` is non-nullable if `T <: Object`. This is
+ /// equivalent to the syntactic criterion that `T` is any of:
+ /// - `Object`, `int`, `bool`, `Never`, `Function`
+ /// - Any function type
+ /// - Any class type or generic class type
+ /// - `FutureOr<S>` where `S` is non-nullable
+ /// - `X extends S` where `S` is non-nullable
+ /// - `X & S` where `S` is non-nullable
+ ///
+ /// The result of this method is undefined when the experiment 'non-nullable'
+ /// is not enabled.
+ @experimental
+ bool isNonNullable(DartType type);
+
+ /// Return `true` if the [type] is a nullable type.
+ ///
+ /// We say that a type `T` is nullable if `Null <: T`. This is equivalent to
+ /// the syntactic criterion that `T` is any of:
+ /// - `Null`
+ /// - `S?` for some `S`
+ /// - `FutureOr<S>` for some `S` where `S` is nullable
+ /// - `dynamic`
+ /// - `void`
+ ///
+ /// The result of this method is undefined when the experiment 'non-nullable'
+ /// is not enabled.
+ @experimental
+ bool isNullable(DartType type);
+
+ /// Return `true` if the [type] is a potentially non-nullable type.
+ ///
+ /// We say that a type `T` is potentially non-nullable if `T` is not nullable.
+ /// Note that this is different from saying that `T` is non-nullable. For
+ /// example, a type variable `X extends Object?` is a type which is
+ /// potentially non-nullable but not non-nullable.
+ ///
+ /// The result of this method is undefined when the experiment 'non-nullable'
+ /// is not enabled.
+ @experimental
+ bool isPotentiallyNonNullable(DartType type);
+
+ /// Return `true` if the [type] is not a potentially nullable type.
+ ///
+ /// We say that a type `T` is potentially nullable if `T` is not non-nullable.
+ /// Note that this is different from saying that `T` is nullable. For example,
+ /// a type variable `X extends Object?` is a type which is potentially
+ /// nullable but not nullable.
+ ///
+ /// The result of this method is undefined when the experiment 'non-nullable'
+ /// is not enabled.
+ @experimental
+ bool isPotentiallyNullable(DartType type);
+
/// Return `true` if the [leftType] is a subtype of the [rightType].
///
/// For the Dart 2.0 type system, the rules governing the subtype relationship
diff --git a/analyzer/lib/dart/element/visitor.dart b/analyzer/lib/dart/element/visitor.dart
index fa3fa79..fc6d4a6 100644
--- a/analyzer/lib/dart/element/visitor.dart
+++ b/analyzer/lib/dart/element/visitor.dart
@@ -2,86 +2,82 @@
// 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.
-/**
- * Defines element visitors that support useful patterns for visiting the
- * elements in an [element model](element.dart).
- *
- * Dart is an evolving language, and the element model must evolved with it.
- * When the element model changes, the visitor interface will sometimes change
- * as well. If it is desirable to get a compilation error when the structure of
- * the element model has been modified, then you should consider implementing
- * the interface [ElementVisitor] directly. Doing so will ensure that changes
- * that introduce new classes of elements will be flagged. (Of course, not all
- * changes to the element model require the addition of a new class of element,
- * and hence cannot be caught this way.)
- *
- * But if automatic detection of these kinds of changes is not necessary then
- * you will probably want to extend one of the classes in this library because
- * doing so will simplify the task of writing your visitor and guard against
- * future changes to the element model. For example, the
- * [RecursiveElementVisitor] automates the process of visiting all of the
- * descendants of an element.
- */
+/// Defines element visitors that support useful patterns for visiting the
+/// elements in an [element model](element.dart).
+///
+/// Dart is an evolving language, and the element model must evolved with it.
+/// When the element model changes, the visitor interface will sometimes change
+/// as well. If it is desirable to get a compilation error when the structure of
+/// the element model has been modified, then you should consider implementing
+/// the interface [ElementVisitor] directly. Doing so will ensure that changes
+/// that introduce new classes of elements will be flagged. (Of course, not all
+/// changes to the element model require the addition of a new class of element,
+/// and hence cannot be caught this way.)
+///
+/// But if automatic detection of these kinds of changes is not necessary then
+/// you will probably want to extend one of the classes in this library because
+/// doing so will simplify the task of writing your visitor and guard against
+/// future changes to the element model. For example, the
+/// [RecursiveElementVisitor] automates the process of visiting all of the
+/// descendants of an element.
import 'package:analyzer/dart/element/element.dart';
-/**
- * An element visitor that will recursively visit all of the elements in an
- * element model (like instances of the class [RecursiveElementVisitor]). In
- * addition, when an element of a specific type is visited not only will the
- * visit method for that specific type of element be invoked, but additional
- * methods for the supertypes of that element will also be invoked. For example,
- * using an instance of this class to visit a [MethodElement] will cause the
- * method [visitMethodElement] to be invoked but will also cause the methods
- * [visitExecutableElement] and [visitElement] to be subsequently invoked. This
- * allows visitors to be written that visit all executable elements without
- * needing to override the visit method for each of the specific subclasses of
- * [ExecutableElement].
- *
- * Note, however, that unlike many visitors, element visitors visit objects
- * based on the interfaces implemented by those elements. Because interfaces
- * form a graph structure rather than a tree structure the way classes do, and
- * because it is generally undesirable for an object to be visited more than
- * once, this class flattens the interface graph into a pseudo-tree. In
- * particular, this class treats elements as if the element types were
- * structured in the following way:
- *
- * <pre>
- * Element
- * ClassElement
- * CompilationUnitElement
- * ExecutableElement
- * ConstructorElement
- * LocalElement
- * FunctionElement
- * MethodElement
- * PropertyAccessorElement
- * ExportElement
- * HtmlElement
- * ImportElement
- * LabelElement
- * LibraryElement
- * MultiplyDefinedElement
- * PrefixElement
- * TypeAliasElement
- * TypeParameterElement
- * UndefinedElement
- * VariableElement
- * PropertyInducingElement
- * FieldElement
- * TopLevelVariableElement
- * LocalElement
- * LocalVariableElement
- * ParameterElement
- * FieldFormalParameterElement
- * </pre>
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or explicitly invoke the more general visit method. Failure to
- * do so will cause the visit methods for superclasses of the element to not be
- * invoked and will cause the children of the visited node to not be visited.
- *
- * Clients may extend this class.
- */
+/// An element visitor that will recursively visit all of the elements in an
+/// element model (like instances of the class [RecursiveElementVisitor]). In
+/// addition, when an element of a specific type is visited not only will the
+/// visit method for that specific type of element be invoked, but additional
+/// methods for the supertypes of that element will also be invoked. For
+/// example, using an instance of this class to visit a [MethodElement] will
+/// cause the method [visitMethodElement] to be invoked but will also cause the
+/// methods [visitExecutableElement] and [visitElement] to be subsequently
+/// invoked. This allows visitors to be written that visit all executable
+/// elements without needing to override the visit method for each of the
+/// specific subclasses of [ExecutableElement].
+///
+/// Note, however, that unlike many visitors, element visitors visit objects
+/// based on the interfaces implemented by those elements. Because interfaces
+/// form a graph structure rather than a tree structure the way classes do, and
+/// because it is generally undesirable for an object to be visited more than
+/// once, this class flattens the interface graph into a pseudo-tree. In
+/// particular, this class treats elements as if the element types were
+/// structured in the following way:
+///
+/// <pre>
+/// Element
+/// ClassElement
+/// CompilationUnitElement
+/// ExecutableElement
+/// ConstructorElement
+/// LocalElement
+/// FunctionElement
+/// MethodElement
+/// PropertyAccessorElement
+/// ExportElement
+/// HtmlElement
+/// ImportElement
+/// LabelElement
+/// LibraryElement
+/// MultiplyDefinedElement
+/// PrefixElement
+/// TypeAliasElement
+/// TypeParameterElement
+/// UndefinedElement
+/// VariableElement
+/// PropertyInducingElement
+/// FieldElement
+/// TopLevelVariableElement
+/// LocalElement
+/// LocalVariableElement
+/// ParameterElement
+/// FieldFormalParameterElement
+/// </pre>
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or explicitly invoke the more general visit method. Failure to
+/// do so will cause the visit methods for superclasses of the element to not be
+/// invoked and will cause the children of the visited node to not be visited.
+///
+/// Clients may extend this class.
class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => visitElement(element);
@@ -180,19 +176,17 @@
R visitVariableElement(VariableElement element) => visitElement(element);
}
-/**
- * A visitor that will recursively visit all of the element in an element model.
- * For example, using an instance of this class to visit a
- * [CompilationUnitElement] will also cause all of the types in the compilation
- * unit to be visited.
- *
- * Subclasses that override a visit method must either invoke the overridden
- * visit method or must explicitly ask the visited element to visit its
- * children. Failure to do so will cause the children of the visited element to
- * not be visited.
- *
- * Clients may extend this class.
- */
+/// A visitor that will recursively visit all of the element in an element
+/// model. For example, using an instance of this class to visit a
+/// [CompilationUnitElement] will also cause all of the types in the compilation
+/// unit to be visited.
+///
+/// Subclasses that override a visit method must either invoke the overridden
+/// visit method or must explicitly ask the visited element to visit its
+/// children. Failure to do so will cause the children of the visited element to
+/// not be visited.
+///
+/// Clients may extend this class.
class RecursiveElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) {
@@ -315,14 +309,12 @@
}
}
-/**
- * A visitor that will do nothing when visiting an element. It is intended to be
- * a superclass for classes that use the visitor pattern primarily as a dispatch
- * mechanism (and hence don't need to recursively visit a whole structure) and
- * that only need to visit a small number of element types.
- *
- * Clients may extend this class.
- */
+/// A visitor that will do nothing when visiting an element. It is intended to
+/// be a superclass for classes that use the visitor pattern primarily as a
+/// dispatch mechanism (and hence don't need to recursively visit a whole
+/// structure) and that only need to visit a small number of element types.
+///
+/// Clients may extend this class.
class SimpleElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => null;
@@ -386,15 +378,13 @@
R visitTypeParameterElement(TypeParameterElement element) => null;
}
-/**
- * An AST visitor that will throw an exception if any of the visit methods that
- * are invoked have not been overridden. It is intended to be a superclass for
- * classes that implement the visitor pattern and need to (a) override all of
- * the visit methods or (b) need to override a subset of the visit method and
- * want to catch when any other visit methods have been invoked.
- *
- * Clients may extend this class.
- */
+/// An AST visitor that will throw an exception if any of the visit methods that
+/// are invoked have not been overridden. It is intended to be a superclass for
+/// classes that implement the visitor pattern and need to (a) override all of
+/// the visit methods or (b) need to override a subset of the visit method and
+/// want to catch when any other visit methods have been invoked.
+///
+/// Clients may extend this class.
class ThrowingElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => _throw(element);
diff --git a/analyzer/lib/diagnostic/diagnostic.dart b/analyzer/lib/diagnostic/diagnostic.dart
new file mode 100644
index 0000000..43b099a
--- /dev/null
+++ b/analyzer/lib/diagnostic/diagnostic.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2019, 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.
+
+/// A diagnostic, as defined by the [Diagnostic Design Guidelines][guidelines]:
+///
+/// > An indication of a specific problem at a specific location within the
+/// > source code being processed by a development tool.
+///
+/// Clients may not extend, implement or mix-in this class.
+///
+/// [guidelines]: ../doc/diagnostics.md
+abstract class Diagnostic {
+ /// A list of messages that provide context for understanding the problem
+ /// being reported. The list will be empty if there are no such messages.
+ List<DiagnosticMessage> get contextMessages;
+
+ /// A description of how to fix the problem, or `null` if there is no such
+ /// description.
+ String get correctionMessage;
+
+ /// A message describing what is wrong and why.
+ DiagnosticMessage get problemMessage;
+
+ /// The severity associated with the diagnostic.
+ Severity get severity;
+}
+
+/// A single message associated with a [Diagnostic], consisting of the text of
+/// the message and the location associated with it.
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class DiagnosticMessage {
+ /// The absolute and normalized path of the file associated with this message.
+ String get filePath;
+
+ /// The length of the source range associated with this message.
+ int get length;
+
+ /// The text of the message.
+ String get message;
+
+ /// The zero-based offset from the start of the file to the beginning of the
+ /// source range associated with this message.
+ int get offset;
+}
+
+/// An indication of the severity of a [Diagnostic].
+enum Severity { error, warning, info }
diff --git a/analyzer/lib/error/error.dart b/analyzer/lib/error/error.dart
index 459a7c0..59e0168 100644
--- a/analyzer/lib/error/error.dart
+++ b/analyzer/lib/error/error.dart
@@ -4,13 +4,16 @@
import 'dart:collection';
+import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode;
+import 'package:analyzer/src/diagnostic/diagnostic.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
import 'package:analyzer/src/generated/resolver.dart' show ResolverErrorCode;
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/manifest/manifest_warning_code.dart';
import 'package:front_end/src/base/errors.dart';
import 'package:front_end/src/scanner/errors.dart';
@@ -59,10 +62,6 @@
CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
- CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
- CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
- CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
- CheckedModeCompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE,
CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD,
@@ -71,7 +70,6 @@
CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER,
CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS,
CompileTimeErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS,
- CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER,
CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT,
CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME,
@@ -79,7 +77,6 @@
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME,
- CompileTimeErrorCode.BUILT_IN_IDENTIFIER_IN_DECLARATION,
CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD,
CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD,
@@ -89,7 +86,6 @@
CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
- CompileTimeErrorCode.CONST_CONSTRUCTOR_IN_SUBCLASS_OF_MIXIN_APPLICATION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD,
@@ -121,14 +117,18 @@
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
+ CompileTimeErrorCode.DEFAULT_LIST_CONSTRUCTOR_MISMATCH,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS,
CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
+ CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER,
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
CompileTimeErrorCode.DUPLICATE_DEFINITION,
CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT,
CompileTimeErrorCode.DUPLICATE_PART,
+ CompileTimeErrorCode.EQUAL_KEYS_IN_CONST_MAP,
+ CompileTimeErrorCode.EQUAL_ELEMENTS_IN_CONST_SET,
CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY,
CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY,
CompileTimeErrorCode.EXPRESSION_IN_MAP,
@@ -173,10 +173,10 @@
CompileTimeErrorCode.INVALID_CONSTANT,
CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME,
CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS,
- CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC,
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR,
CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER,
CompileTimeErrorCode.INVALID_INLINE_FUNCTION_TYPE,
+ CompileTimeErrorCode.INVALID_OPTIONAL_PARAMETER_TYPE,
CompileTimeErrorCode.INVALID_OVERRIDE,
CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS,
CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST,
@@ -192,6 +192,8 @@
CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL,
CompileTimeErrorCode.MISSING_CONST_IN_SET_LITERAL,
CompileTimeErrorCode.MISSING_DART_LIBRARY,
+ CompileTimeErrorCode.MISSING_DEFAULT_VALUE_FOR_PARAMETER,
+ CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT,
CompileTimeErrorCode.MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE,
CompileTimeErrorCode.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE,
CompileTimeErrorCode.MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER,
@@ -226,15 +228,25 @@
CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY,
CompileTimeErrorCode.NON_CONSTANT_SET_ELEMENT,
CompileTimeErrorCode.NON_CONSTANT_SET_ELEMENT_FROM_DEFERRED_LIBRARY,
+ CompileTimeErrorCode.NON_CONSTANT_SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY,
+ CompileTimeErrorCode.NON_CONSTANT_IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY,
+ // ignore: deprecated_member_use_from_same_package
CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY,
CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
CompileTimeErrorCode.NON_SYNC_FACTORY,
CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS,
+ CompileTimeErrorCode.NOT_ITERABLE_SPREAD,
+ CompileTimeErrorCode.NOT_MAP_SPREAD,
+ CompileTimeErrorCode.NOT_NULL_AWARE_NULL_SPREAD,
CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS,
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_CATCH_CLAUSE,
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_EXTENDS_CLAUSE,
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE,
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_ON_CLAUSE,
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_WITH_CLAUSE,
CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS,
CompileTimeErrorCode.ON_REPEATED,
CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR,
@@ -296,6 +308,8 @@
HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE,
HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION,
+ HintCode.INFERENCE_FAILURE_ON_COLLECTION_LITERAL,
+ HintCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION,
HintCode.INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE,
HintCode.INVALID_FACTORY_ANNOTATION,
HintCode.INVALID_FACTORY_METHOD_DECL,
@@ -331,6 +345,14 @@
HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER,
HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT,
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE,
+ HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT,
+ HintCode.SDK_VERSION_BOOL_OPERATOR,
+ HintCode.SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT,
+ HintCode.SDK_VERSION_GT_GT_GT_OPERATOR,
+ HintCode.SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT,
+ HintCode.SDK_VERSION_NEVER,
+ HintCode.SDK_VERSION_SET_LITERAL,
+ HintCode.SDK_VERSION_UI_AS_CODE,
HintCode.STRICT_RAW_TYPE,
HintCode.SUBTYPE_OF_SEALED_CLASS,
HintCode.TYPE_CHECK_IS_NOT_NULL,
@@ -350,9 +372,13 @@
HintCode.UNUSED_LABEL,
HintCode.UNUSED_LOCAL_VARIABLE,
HintCode.UNUSED_SHOWN_NAME,
- HtmlErrorCode.PARSE_ERROR,
- HtmlWarningCode.INVALID_URI,
- HtmlWarningCode.URI_DOES_NOT_EXIST,
+ ManifestWarningCode.CAMERA_PERMISSIONS_INCOMPATIBLE,
+ ManifestWarningCode.NON_RESIZABLE_ACTIVITY,
+ ManifestWarningCode.NO_TOUCHSCREEN_FEATURE,
+ ManifestWarningCode.PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE,
+ ManifestWarningCode.SETTING_ORIENTATION_ON_ACTIVITY,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_FEATURE,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_HARDWARE,
ParserErrorCode.ABSTRACT_CLASS_MEMBER,
ParserErrorCode.ABSTRACT_ENUM,
ParserErrorCode.ABSTRACT_STATIC_METHOD,
@@ -365,6 +391,7 @@
ParserErrorCode.CATCH_SYNTAX_EXTRA_PARAMETERS,
ParserErrorCode.CLASS_IN_CLASS,
ParserErrorCode.COLON_IN_PLACE_OF_IN,
+ ParserErrorCode.CONFLICTING_MODIFIERS,
ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE,
ParserErrorCode.CONST_AFTER_FACTORY,
ParserErrorCode.CONST_AND_COVARIANT,
@@ -483,6 +510,7 @@
ParserErrorCode.MISSING_TYPEDEF_PARAMETERS,
ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH,
ParserErrorCode.MIXED_PARAMETER_GROUPS,
+ ParserErrorCode.MODIFIER_OUT_OF_ORDER,
ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES,
ParserErrorCode.MULTIPLE_ON_CLAUSES,
ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES,
@@ -519,11 +547,14 @@
ParserErrorCode.STATIC_OPERATOR,
ParserErrorCode.STATIC_SETTER_WITHOUT_BODY,
ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION,
+ ParserErrorCode.INVALID_SUPER_IN_INITIALIZER,
ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE,
ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
+ ParserErrorCode.INVALID_THIS_IN_INITIALIZER,
ParserErrorCode.TOP_LEVEL_OPERATOR,
ParserErrorCode.TYPEDEF_IN_CLASS,
ParserErrorCode.TYPE_ARGUMENTS_ON_TYPE_VARIABLE,
+ ParserErrorCode.TYPE_BEFORE_FACTORY,
ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP,
ParserErrorCode.UNEXPECTED_TOKEN,
ParserErrorCode.VAR_AND_TYPE,
@@ -537,7 +568,6 @@
ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP,
ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER,
ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH,
- ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART,
ResolverErrorCode.PART_OF_UNNAMED_LIBRARY,
ScannerErrorCode.EXPECTED_TOKEN,
ScannerErrorCode.ILLEGAL_CHARACTER,
@@ -600,8 +630,6 @@
StaticWarningCode.CAST_TO_NON_TYPE,
StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
StaticWarningCode.CONST_WITH_ABSTRACT_CLASS,
- StaticWarningCode.EQUAL_KEYS_IN_MAP,
- StaticWarningCode.EQUAL_VALUES_IN_CONST_SET,
StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED,
StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS,
StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED,
@@ -613,15 +641,10 @@
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1,
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2,
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS,
- StaticWarningCode.FUNCTION_WITHOUT_CALL,
StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED,
StaticWarningCode.IMPORT_OF_NON_LIBRARY,
StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- StaticWarningCode.INVALID_OVERRIDE_NAMED,
- StaticWarningCode.INVALID_OVERRIDE_POSITIONAL,
- StaticWarningCode.INVALID_OVERRIDE_REQUIRED,
- StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE,
StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
@@ -692,10 +715,8 @@
StrongModeCode.INVALID_CAST_NEW_EXPR,
StrongModeCode.INVALID_CAST_METHOD,
StrongModeCode.INVALID_CAST_FUNCTION,
- StrongModeCode.INVALID_FIELD_OVERRIDE,
StrongModeCode.INVALID_PARAMETER_DECLARATION,
StrongModeCode.INVALID_SUPER_INVOCATION,
- StrongModeCode.NO_DEFAULT_BOUNDS,
StrongModeCode.NON_GROUND_TYPE_CHECK_INFO,
StrongModeCode.NOT_INSTANTIATED_BOUND,
StrongModeCode.TOP_LEVEL_CYCLE,
@@ -703,7 +724,6 @@
StrongModeCode.TOP_LEVEL_IDENTIFIER_NO_TYPE,
StrongModeCode.TOP_LEVEL_INSTANCE_GETTER,
StrongModeCode.TOP_LEVEL_INSTANCE_METHOD,
- StrongModeCode.TOP_LEVEL_UNSUPPORTED,
TodoCode.TODO,
];
@@ -732,7 +752,7 @@
*
* See [AnalysisErrorListener].
*/
-class AnalysisError {
+class AnalysisError implements Diagnostic {
/**
* An empty array of errors used when no errors are expected.
*/
@@ -770,10 +790,9 @@
*/
final ErrorCode errorCode;
- /**
- * The localized error message.
- */
- String _message;
+ DiagnosticMessage _problemMessage;
+
+ List<DiagnosticMessage> _contextMessages;
/**
* The correction to be displayed for this error, or `null` if there is no
@@ -787,43 +806,40 @@
final Source source;
/**
- * The character offset from the beginning of the source (zero based) where
- * the error occurred.
- */
- int offset = 0;
-
- /**
- * The number of characters from the offset to the end of the source which
- * encompasses the compilation error.
- */
- int length = 0;
-
- /**
- * A flag indicating whether this error can be shown to be a non-issue because
- * of the result of type propagation.
- */
- bool isStaticOnly = false;
-
- /**
* Initialize a newly created analysis error. The error is associated with the
* given [source] and is located at the given [offset] with the given
* [length]. The error will have the given [errorCode] and the list of
- * [arguments] will be used to complete the message.
+ * [arguments] will be used to complete the message and correction. If any
+ * [contextMessages] are provided, they will be recorded with the error.
*/
- AnalysisError(this.source, this.offset, this.length, this.errorCode,
- [List<Object> arguments]) {
- this._message = formatList(errorCode.message, arguments);
+ AnalysisError(this.source, int offset, int length, this.errorCode,
+ [List<Object> arguments, List<DiagnosticMessage> contextMessages]) {
+ String message = formatList(errorCode.message, arguments);
String correctionTemplate = errorCode.correction;
if (correctionTemplate != null) {
this._correction = formatList(correctionTemplate, arguments);
}
+ _problemMessage = new DiagnosticMessageImpl(
+ filePath: source?.fullName,
+ length: length,
+ message: message,
+ offset: offset);
+ _contextMessages = contextMessages;
}
/**
* Initialize a newly created analysis error with given values.
*/
- AnalysisError.forValues(this.source, this.offset, this.length, this.errorCode,
- this._message, this._correction);
+ AnalysisError.forValues(this.source, int offset, int length, this.errorCode,
+ String message, this._correction) {
+ _problemMessage = new DiagnosticMessageImpl(
+ filePath: source?.fullName,
+ length: length,
+ message: message,
+ offset: offset);
+ }
+
+ List<DiagnosticMessage> get contextMessages => _contextMessages ?? const [];
/**
* Return the template used to create the correction to be displayed for this
@@ -833,18 +849,70 @@
String get correction => _correction;
@override
+ String get correctionMessage => _correction;
+
+ @override
int get hashCode {
int hashCode = offset;
- hashCode ^= (_message != null) ? _message.hashCode : 0;
+ hashCode ^= (message != null) ? message.hashCode : 0;
hashCode ^= (source != null) ? source.hashCode : 0;
return hashCode;
}
/**
+ * Return `true` if this error can be shown to be a non-issue because of the
+ * result of type propagation.
+ */
+ @Deprecated(
+ 'Type propagation is no longer performed, so this will never be true')
+ bool get isStaticOnly => false;
+
+ @Deprecated(
+ 'Type propagation is no longer performed, so this can never be true')
+ void set isStaticOnly(bool value) {}
+
+ /**
+ * The number of characters from the offset to the end of the source which
+ * encompasses the compilation error.
+ */
+ int get length => _problemMessage.length;
+
+ /**
* Return the message to be displayed for this error. The message should
* indicate what is wrong and why it is wrong.
*/
- String get message => _message;
+ String get message => _problemMessage.message;
+
+ /**
+ * The character offset from the beginning of the source (zero based) where
+ * the error occurred.
+ */
+ int get offset => _problemMessage.offset;
+
+ /**
+ * The character offset from the beginning of the source (zero based) where
+ * the error occurred.
+ */
+ @Deprecated('Set the offset when the error is created')
+ set offset(int offset) {}
+
+ @override
+ DiagnosticMessage get problemMessage => _problemMessage;
+
+ @override
+ Severity get severity {
+ switch (errorCode.errorSeverity) {
+ case ErrorSeverity.ERROR:
+ return Severity.error;
+ case ErrorSeverity.WARNING:
+ return Severity.warning;
+ case ErrorSeverity.INFO:
+ return Severity.info;
+ default:
+ throw new StateError(
+ 'Invalid error severity: ${errorCode.errorSeverity}');
+ }
+ }
@override
bool operator ==(Object other) {
@@ -860,11 +928,8 @@
if (offset != other.offset || length != other.length) {
return false;
}
- if (isStaticOnly != other.isStaticOnly) {
- return false;
- }
// Deep checks.
- if (_message != other._message) {
+ if (message != other.message) {
return false;
}
if (source != other.source) {
@@ -886,7 +951,7 @@
buffer.write(offset + length - 1);
buffer.write("): ");
//buffer.write("(" + lineNumber + ":" + columnNumber + "): ");
- buffer.write(_message);
+ buffer.write(message);
return buffer.toString();
}
diff --git a/analyzer/lib/error/listener.dart b/analyzer/lib/error/listener.dart
index 5f7e149..9cceca8 100644
--- a/analyzer/lib/error/listener.dart
+++ b/analyzer/lib/error/listener.dart
@@ -235,23 +235,28 @@
}
}
for (_TypeToConvert typeToConvert in typeGroup) {
- Element element = typeToConvert.type.element;
- if (element == null) {
- arguments[typeToConvert.index] = typeToConvert.displayName;
- } else {
- // TODO(brianwilkerson) When analyzer supports info or context
- // messages, expose the additional information that way (rather
- // than being poorly inserted into the problem message).
- StringBuffer buffer = new StringBuffer();
- for (Element element in typeToConvert.allElements()) {
- String name = element.name;
- if (nameToElementMap[name].length > 1) {
- buffer.write(buffer.isEmpty ? 'where ' : ', ');
- buffer.write('$name is defined in ${element.source.fullName}');
+ // TODO(brianwilkerson) When analyzer supports info or context
+ // messages, expose the additional information that way (rather
+ // than being poorly inserted into the problem message).
+ StringBuffer buffer;
+ for (Element element in typeToConvert.allElements()) {
+ String name = element.name;
+ if (nameToElementMap[name].length > 1) {
+ if (buffer == null) {
+ buffer = new StringBuffer();
+ buffer.write('where ');
+ } else {
+ buffer.write(', ');
}
+ buffer.write('$name is defined in ${element.source.fullName}');
}
+ }
+
+ if (buffer != null) {
arguments[typeToConvert.index] =
'${typeToConvert.displayName} ($buffer)';
+ } else {
+ arguments[typeToConvert.index] = typeToConvert.displayName;
}
}
}
@@ -321,20 +326,16 @@
Set<Element> elements = new Set<Element>();
void addElementsFrom(DartType type) {
- Element element = type?.element;
- if (element != null) {
- if (type is InterfaceType && elements.add(element)) {
+ if (type is FunctionType) {
+ addElementsFrom(type.returnType);
+ for (ParameterElement parameter in type.parameters) {
+ addElementsFrom(parameter.type);
+ }
+ } else if (type is InterfaceType) {
+ if (elements.add(type.element)) {
for (DartType typeArgument in type.typeArguments) {
addElementsFrom(typeArgument);
}
- } else if (type is FunctionType && elements.add(element)) {
- addElementsFrom(type.returnType);
- for (DartType typeArgument in type.typeArguments) {
- addElementsFrom(typeArgument);
- }
- for (ParameterElement parameter in type.parameters) {
- addElementsFrom(parameter.type);
- }
}
}
}
diff --git a/analyzer/lib/instrumentation/instrumentation.dart b/analyzer/lib/instrumentation/instrumentation.dart
index dc04bf5..e593f13 100644
--- a/analyzer/lib/instrumentation/instrumentation.dart
+++ b/analyzer/lib/instrumentation/instrumentation.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/plugin/embedded_resolver_provider.dart b/analyzer/lib/plugin/embedded_resolver_provider.dart
index 217ab7f..e16bc00 100644
--- a/analyzer/lib/plugin/embedded_resolver_provider.dart
+++ b/analyzer/lib/plugin/embedded_resolver_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/plugin/resolver_provider.dart b/analyzer/lib/plugin/resolver_provider.dart
index 3c22554..40567da 100644
--- a/analyzer/lib/plugin/resolver_provider.dart
+++ b/analyzer/lib/plugin/resolver_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/analysis_options_provider.dart b/analyzer/lib/source/analysis_options_provider.dart
index 939f634..a35bfbc 100644
--- a/analyzer/lib/source/analysis_options_provider.dart
+++ b/analyzer/lib/source/analysis_options_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/custom_resolver.dart b/analyzer/lib/source/custom_resolver.dart
index 8dfe9f9..2569313 100644
--- a/analyzer/lib/source/custom_resolver.dart
+++ b/analyzer/lib/source/custom_resolver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/embedder.dart b/analyzer/lib/source/embedder.dart
index dfd679f..a1af355 100644
--- a/analyzer/lib/source/embedder.dart
+++ b/analyzer/lib/source/embedder.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/error_processor.dart b/analyzer/lib/source/error_processor.dart
index 3391264..f2efaba 100644
--- a/analyzer/lib/source/error_processor.dart
+++ b/analyzer/lib/source/error_processor.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/line_info.dart b/analyzer/lib/source/line_info.dart
index 5d5be56..5413ae4 100644
--- a/analyzer/lib/source/line_info.dart
+++ b/analyzer/lib/source/line_info.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/source/package_map_provider.dart b/analyzer/lib/source/package_map_provider.dart
index f3c2119..2c33ab5 100644
--- a/analyzer/lib/source/package_map_provider.dart
+++ b/analyzer/lib/source/package_map_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/source/package_map_resolver.dart b/analyzer/lib/source/package_map_resolver.dart
index 6a1d230..cf65834 100644
--- a/analyzer/lib/source/package_map_resolver.dart
+++ b/analyzer/lib/source/package_map_resolver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/source/path_filter.dart b/analyzer/lib/source/path_filter.dart
index ba5454e..26ecec2 100644
--- a/analyzer/lib/source/path_filter.dart
+++ b/analyzer/lib/source/path_filter.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/sdk_ext.dart b/analyzer/lib/source/sdk_ext.dart
index 7f5557b..425553e 100644
--- a/analyzer/lib/source/sdk_ext.dart
+++ b/analyzer/lib/source/sdk_ext.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/source/source_range.dart b/analyzer/lib/source/source_range.dart
index 338ad7a..b2d3069 100644
--- a/analyzer/lib/source/source_range.dart
+++ b/analyzer/lib/source/source_range.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/analysis_options/analysis_options_provider.dart b/analyzer/lib/src/analysis_options/analysis_options_provider.dart
index 550f3e3..5d3e616 100644
--- a/analyzer/lib/src/analysis_options/analysis_options_provider.dart
+++ b/analyzer/lib/src/analysis_options/analysis_options_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/context/cache.dart b/analyzer/lib/src/context/cache.dart
index a1834e2..65349a0 100644
--- a/analyzer/lib/src/context/cache.dart
+++ b/analyzer/lib/src/context/cache.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/context/context.dart b/analyzer/lib/src/context/context.dart
index 10a548d..418bb41 100644
--- a/analyzer/lib/src/context/context.dart
+++ b/analyzer/lib/src/context/context.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -17,7 +17,6 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/plugin/resolver_provider.dart';
import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/dart_work_manager.dart';
import 'package:analyzer/src/task/driver.dart';
/**
@@ -60,11 +59,6 @@
final List<WorkManager> workManagers = <WorkManager>[];
/**
- * The [DartWorkManager] instance that performs Dart specific scheduling.
- */
- DartWorkManager dartWorkManager;
-
- /**
* The analysis driver used to perform analysis.
*/
AnalysisDriver driver;
@@ -88,9 +82,6 @@
*/
bool useSdkCachePartition = true;
- @override
- ResultProvider resultProvider;
-
/**
* The most recently incrementally resolved source, or `null` when it was
* already validated, or the most recent change was not incrementally resolved.
@@ -599,24 +590,6 @@
}
/**
- * Provider for analysis results.
- */
-abstract class ResultProvider {
- /**
- * This method is invoked by an [InternalAnalysisContext] when the state of
- * the [result] of the [entry] is [CacheState.INVALID], so it is about to be
- * computed.
- *
- * If the provider knows how to provide the value, it sets the value into
- * the [entry] with all required dependencies, and returns `true`.
- *
- * Otherwise, it returns `false` to indicate that the result should be
- * computed as usually.
- */
- bool compute(CacheEntry entry, ResultDescriptor result);
-}
-
-/**
* An [AnalysisContext] that only contains sources for a Dart SDK.
*/
class SdkAnalysisContext extends AnalysisContextImpl {
diff --git a/analyzer/lib/src/context/context_root.dart b/analyzer/lib/src/context/context_root.dart
index 744f298..a7da43e 100644
--- a/analyzer/lib/src/context/context_root.dart
+++ b/analyzer/lib/src/context/context_root.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/context/source.dart b/analyzer/lib/src/context/source.dart
index 70abd3d..71abce1 100644
--- a/analyzer/lib/src/context/source.dart
+++ b/analyzer/lib/src/context/source.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/byte_store.dart b/analyzer/lib/src/dart/analysis/byte_store.dart
index 80f7b32..6e7c301 100644
--- a/analyzer/lib/src/dart/analysis/byte_store.dart
+++ b/analyzer/lib/src/dart/analysis/byte_store.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/cache.dart b/analyzer/lib/src/dart/analysis/cache.dart
index 47a32a3..58a7253 100644
--- a/analyzer/lib/src/dart/analysis/cache.dart
+++ b/analyzer/lib/src/dart/analysis/cache.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/crc32.dart b/analyzer/lib/src/dart/analysis/crc32.dart
index 457712e..e571bfc 100644
--- a/analyzer/lib/src/dart/analysis/crc32.dart
+++ b/analyzer/lib/src/dart/analysis/crc32.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/defined_names.dart b/analyzer/lib/src/dart/analysis/defined_names.dart
index 44baa00..4da5300 100644
--- a/analyzer/lib/src/dart/analysis/defined_names.dart
+++ b/analyzer/lib/src/dart/analysis/defined_names.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/dependency/library_builder.dart b/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
index 4740d58..9b9a320 100644
--- a/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
+++ b/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -678,11 +678,13 @@
if (parameters == null) return;
for (var parameter in parameters.parameters) {
- if (parameter.isRequired) {
+ if (parameter.isRequiredPositional) {
signature.addInt(1);
+ } else if (parameter.isRequiredNamed) {
+ signature.addInt(4);
} else if (parameter.isOptionalPositional) {
signature.addInt(2);
- } else {
+ } else if (parameter.isOptionalNamed) {
signature.addInt(3);
}
diff --git a/analyzer/lib/src/dart/analysis/dependency/node.dart b/analyzer/lib/src/dart/analysis/dependency/node.dart
index ef5022d..10baa3c 100644
--- a/analyzer/lib/src/dart/analysis/dependency/node.dart
+++ b/analyzer/lib/src/dart/analysis/dependency/node.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
index 482dc4b..01b5ac3 100644
--- a/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
+++ b/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -464,7 +464,7 @@
}
}
- void _visitForStatement2(ForStatement2 node) {
+ void _visitForStatement(ForStatement node) {
_localScopes.enter();
_visitForLoopParts(node.forLoopParts);
@@ -535,7 +535,7 @@
void _visitListLiteral(ListLiteral node) {
_visitTypeArguments(node.typeArguments);
- var elements = node.elements2;
+ var elements = node.elements;
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
_visitCollectionElement(element);
@@ -619,7 +619,7 @@
void _visitSetOrMapLiteral(SetOrMapLiteral node) {
_visitTypeArguments(node.typeArguments);
- var elements = node.elements2;
+ var elements = node.elements;
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
_visitCollectionElement(element);
@@ -631,7 +631,10 @@
if (node.isSynthetic) return;
var name = node.name;
- if (_localScopes.contains(name) || name == 'void' || name == 'dynamic') {
+ if (_localScopes.contains(name) ||
+ name == 'void' ||
+ name == 'dynamic' ||
+ name == 'Never') {
return;
}
@@ -662,8 +665,8 @@
// nothing
} else if (node is ExpressionStatement) {
_visitExpression(node.expression);
- } else if (node is ForStatement2) {
- _visitForStatement2(node);
+ } else if (node is ForStatement) {
+ _visitForStatement(node);
} else if (node is FunctionDeclarationStatement) {
_visitFunctionDeclarationStatement(node);
} else if (node is IfStatement) {
diff --git a/analyzer/lib/src/dart/analysis/driver.dart b/analyzer/lib/src/dart/analysis/driver.dart
index 3081077..2098c3f 100644
--- a/analyzer/lib/src/dart/analysis/driver.dart
+++ b/analyzer/lib/src/dart/analysis/driver.dart
@@ -94,7 +94,7 @@
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 78;
+ static const int DATA_VERSION = 80;
/**
* The number of exception contexts allowed to write. Once this field is
@@ -103,6 +103,11 @@
static int allowedNumberOfContextsToWrite = 10;
/**
+ * Whether summary2 should be used to resynthesize elements.
+ */
+ static final bool useSummary2 = false;
+
+ /**
* The scheduler that schedules analysis work in this, and possibly other
* analysis drivers.
*/
@@ -740,12 +745,18 @@
* [uri], which is either resynthesized from the provided external summary
* store, or built for a file to which the given [uri] is resolved.
*
+ * Throw [ArgumentError] if the [uri] does not correspond to a file.
+ *
* Throw [ArgumentError] if the [uri] corresponds to a part.
*/
Future<LibraryElement> getLibraryByUri(String uri) async {
var uriObj = Uri.parse(uri);
var file = _fsState.getFileForUri(uriObj);
+ if (file.isUnresolved) {
+ throw ArgumentError('$uri cannot be resolved to a file.');
+ }
+
if (file.isExternalLibrary) {
return _createLibraryContext(file).getLibraryElement(file);
}
@@ -1432,6 +1443,7 @@
libraryContext.isLibraryUri,
libraryContext.analysisContext,
libraryContext.resynthesizer,
+ libraryContext.elementFactory,
libraryContext.inheritanceManager,
library,
_resourceProvider);
@@ -1500,6 +1512,7 @@
libraryContext.isLibraryUri,
libraryContext.analysisContext,
libraryContext.resynthesizer,
+ libraryContext.elementFactory,
libraryContext.inheritanceManager,
library,
_resourceProvider);
@@ -1594,6 +1607,7 @@
_unlinkedSalt,
_linkedSalt,
externalSummaries: _externalSummaries,
+ useSummary2: useSummary2,
);
_fileTracker = new FileTracker(_logger, _fsState, _changeHook);
}
@@ -1608,7 +1622,7 @@
}
}
- if (_libraryContext == null) {
+ if (_libraryContext == null || useSummary2) {
_libraryContext = new LibraryContext(
session: currentSession,
logger: _logger,
@@ -1619,6 +1633,7 @@
sourceFactory: _sourceFactory,
externalSummaries: _externalSummaries,
targetLibrary: library,
+ useSummary2: useSummary2,
);
} else {
_libraryContext.load(library);
diff --git a/analyzer/lib/src/dart/analysis/experiments.dart b/analyzer/lib/src/dart/analysis/experiments.dart
index 5bf37c7..2cfdf21 100644
--- a/analyzer/lib/src/dart/analysis/experiments.dart
+++ b/analyzer/lib/src/dart/analysis/experiments.dart
@@ -2,21 +2,11 @@
// 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.
-// Note: the plan is to generate this file from a YAML representation somewhere
-// in the SDK repo. Please do not add any code to this file that can't be
-// easily code generated based on a knowledge of the current set of experimental
-// flags and their status.
-// TODO(paulberry,kmillikin): once code generation is implemented, replace this
-// notice with a notice that this file is generated and a pointer to the source
-// YAML file and the regeneration tool.
-
-// Note: to demonstrate how code is supposed to be generated for expired flags,
-// this file contains bogus expired flags called "bogus-enabled" and
-// "bogus-disabled". They are not used and can be removed at the time that code
-// generation is implemented.
-
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments_impl.dart';
+import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:meta/meta.dart';
+import 'package:pub_semver/src/version.dart';
export 'package:analyzer/src/dart/analysis/experiments_impl.dart'
show
@@ -52,6 +42,9 @@
/// String to enable the experiment "spread-collections"
static const String spread_collections = 'spread-collections';
+ /// String to enable the experiment "triple-shift"
+ static const String triple_shift = 'triple-shift';
+
/// String to enable the experiment "bogus-disabled"
static const String bogus_disabled = 'bogus-disabled';
@@ -59,53 +52,83 @@
static const String bogus_enabled = 'bogus-enabled';
}
+class ExperimentalFeatures {
+ static const constant_update_2018 = const ExperimentalFeature(
+ 0,
+ EnableString.constant_update_2018,
+ IsEnabledByDefault.constant_update_2018,
+ IsExpired.constant_update_2018,
+ 'Q4 2018 Constant Update');
+
+ static const non_nullable = const ExperimentalFeature(
+ 1,
+ EnableString.non_nullable,
+ IsEnabledByDefault.non_nullable,
+ IsExpired.non_nullable,
+ 'Non Nullable');
+
+ static const control_flow_collections = const ExperimentalFeature(
+ 2,
+ EnableString.control_flow_collections,
+ IsEnabledByDefault.control_flow_collections,
+ IsExpired.control_flow_collections,
+ 'Control Flow Collections',
+ firstSupportedVersion: '2.2.2');
+
+ static const spread_collections = const ExperimentalFeature(
+ 3,
+ EnableString.spread_collections,
+ IsEnabledByDefault.spread_collections,
+ IsExpired.spread_collections,
+ 'Spread Collections',
+ firstSupportedVersion: '2.2.2');
+
+ static const set_literals = const ExperimentalFeature(
+ 4,
+ EnableString.set_literals,
+ IsEnabledByDefault.set_literals,
+ IsExpired.set_literals,
+ 'Set Literals',
+ firstSupportedVersion: '2.2.0');
+
+ static const triple_shift = const ExperimentalFeature(
+ 5,
+ EnableString.triple_shift,
+ IsEnabledByDefault.triple_shift,
+ IsExpired.triple_shift,
+ 'Triple-shift operator');
+
+ static const bogus_disabled = const ExperimentalFeature(
+ 6,
+ EnableString.bogus_disabled,
+ IsEnabledByDefault.bogus_disabled,
+ IsExpired.bogus_disabled,
+ null);
+
+ static const bogus_enabled = const ExperimentalFeature(
+ 7,
+ EnableString.bogus_enabled,
+ IsEnabledByDefault.bogus_enabled,
+ IsExpired.bogus_enabled,
+ null,
+ firstSupportedVersion: '1.0.0');
+}
+
/// A representation of the set of experiments that are active and whether they
/// are enabled.
-class ExperimentStatus {
+class ExperimentStatus implements FeatureSet {
/// A map containing information about all known experimental flags.
static const knownFeatures = <String, ExperimentalFeature>{
- EnableString.constant_update_2018: const ExperimentalFeature(
- 0,
- EnableString.constant_update_2018,
- IsEnabledByDefault.constant_update_2018,
- IsExpired.constant_update_2018,
- 'Q4 2018 Constant Update'),
- EnableString.non_nullable: const ExperimentalFeature(
- 1,
- EnableString.non_nullable,
- IsEnabledByDefault.non_nullable,
- IsExpired.non_nullable,
- 'Non Nullable'),
- EnableString.control_flow_collections: const ExperimentalFeature(
- 2,
- EnableString.control_flow_collections,
- IsEnabledByDefault.control_flow_collections,
- IsExpired.control_flow_collections,
- 'Control Flow Collections'),
- EnableString.spread_collections: const ExperimentalFeature(
- 3,
- EnableString.spread_collections,
- IsEnabledByDefault.spread_collections,
- IsExpired.spread_collections,
- 'Spread Collections'),
- EnableString.set_literals: const ExperimentalFeature(
- null,
- EnableString.set_literals,
- IsEnabledByDefault.set_literals,
- IsExpired.set_literals,
- 'Set Literals'),
- EnableString.bogus_disabled: const ExperimentalFeature(
- null,
- EnableString.bogus_disabled,
- IsEnabledByDefault.bogus_disabled,
- IsExpired.bogus_disabled,
- null),
- EnableString.bogus_enabled: const ExperimentalFeature(
- null,
- EnableString.bogus_enabled,
- IsEnabledByDefault.bogus_enabled,
- IsExpired.bogus_enabled,
- null),
+ EnableString.constant_update_2018:
+ ExperimentalFeatures.constant_update_2018,
+ EnableString.non_nullable: ExperimentalFeatures.non_nullable,
+ EnableString.control_flow_collections:
+ ExperimentalFeatures.control_flow_collections,
+ EnableString.spread_collections: ExperimentalFeatures.spread_collections,
+ EnableString.set_literals: ExperimentalFeatures.set_literals,
+ EnableString.triple_shift: ExperimentalFeatures.triple_shift,
+ EnableString.bogus_disabled: ExperimentalFeatures.bogus_disabled,
+ EnableString.bogus_enabled: ExperimentalFeatures.bogus_enabled,
};
final List<bool> _enableFlags;
@@ -117,15 +140,30 @@
bool control_flow_collections,
bool non_nullable,
bool set_literals,
- bool spread_collections})
+ bool spread_collections,
+ bool triple_shift})
: _enableFlags = <bool>[
constant_update_2018 ?? IsEnabledByDefault.constant_update_2018,
non_nullable ?? IsEnabledByDefault.non_nullable,
- control_flow_collections ??
- IsEnabledByDefault.control_flow_collections,
- spread_collections ?? IsEnabledByDefault.spread_collections,
+ true, // control-flow-collections
+ true, // spread-collections
+ true, // set-literals
+ triple_shift ?? IsEnabledByDefault.triple_shift,
+ false, // bogus-disabled
+ true, // bogus-enabled
];
+ /// Computes a set of features for use in a unit test. Computes the set of
+ /// features enabled in [sdkVersion], plus any specified [additionalFeatures].
+ ///
+ /// If [sdkVersion] is not supplied (or is `null`), then the current set of
+ /// enabled features is used as the starting point.
+ @visibleForTesting
+ ExperimentStatus.forTesting(
+ {String sdkVersion, List<Feature> additionalFeatures: const []})
+ : this._(enableFlagsForTesting(
+ sdkVersion: sdkVersion, additionalFeatures: additionalFeatures));
+
/// Decodes the strings given in [flags] into a representation of the set of
/// experiments that should be enabled.
///
@@ -136,31 +174,65 @@
ExperimentStatus._(this._enableFlags);
- /// Hardcoded state for the expired flag "bogus_disabled"
- bool get bogus_disabled => false;
+ /// Current state for the flag "bogus_disabled"
+ bool get bogus_disabled => isEnabled(ExperimentalFeatures.bogus_disabled);
- /// Hardcoded state for the expired flag "bogus_enabled"
- bool get bogus_enabled => true;
+ /// Current state for the flag "bogus_enabled"
+ bool get bogus_enabled => isEnabled(ExperimentalFeatures.bogus_enabled);
/// Current state for the flag "constant-update-2018"
- bool get constant_update_2018 => _enableFlags[0];
+ bool get constant_update_2018 =>
+ isEnabled(ExperimentalFeatures.constant_update_2018);
/// Current state for the flag "control_flow_collections"
- bool get control_flow_collections => _enableFlags[2];
+ bool get control_flow_collections =>
+ isEnabled(ExperimentalFeatures.control_flow_collections);
+
+ @override
+ int get hashCode {
+ int hash = 0;
+ for (var flag in _enableFlags) {
+ hash = JenkinsSmiHash.combine(hash, flag.hashCode);
+ }
+ return JenkinsSmiHash.finish(hash);
+ }
/// Current state for the flag "non-nullable"
- bool get non_nullable => _enableFlags[1];
+ bool get non_nullable => isEnabled(ExperimentalFeatures.non_nullable);
/// Current state for the flag "set-literals"
- bool get set_literals => true;
+ bool get set_literals => isEnabled(ExperimentalFeatures.set_literals);
/// Current state for the flag "spread_collections"
- bool get spread_collections => _enableFlags[3];
+ bool get spread_collections =>
+ isEnabled(ExperimentalFeatures.spread_collections);
+
+ /// Current state for the flag "triple_shift"
+ bool get triple_shift => isEnabled(ExperimentalFeatures.triple_shift);
+
+ @override
+ operator ==(Object other) {
+ if (other is ExperimentStatus) {
+ if (_enableFlags.length != other._enableFlags.length) return false;
+ for (int i = 0; i < _enableFlags.length; i++) {
+ if (_enableFlags[i] != other._enableFlags[i]) return false;
+ }
+ return true;
+ }
+ return false;
+ }
/// Queries whether the given [feature] is enabled or disabled.
- bool isEnabled(ExperimentalFeature feature) => feature.isExpired
- ? feature.isEnabledByDefault
- : _enableFlags[feature.index];
+ @override
+ bool isEnabled(covariant ExperimentalFeature feature) =>
+ _enableFlags[feature.index];
+
+ @override
+ FeatureSet restrictToVersion(Version version) =>
+ ExperimentStatus._(restrictEnableFlagsToVersion(_enableFlags, version));
+
+ @override
+ String toString() => experimentStatusToString(_enableFlags);
/// Returns a list of strings suitable for passing to
/// [ExperimentStatus.fromStrings].
@@ -174,7 +246,7 @@
static const bool constant_update_2018 = false;
/// Default state of the experiment "control-flow-collections"
- static const bool control_flow_collections = false;
+ static const bool control_flow_collections = true;
/// Default state of the experiment "non-nullable"
static const bool non_nullable = false;
@@ -183,7 +255,10 @@
static const bool set_literals = true;
/// Default state of the experiment "spread-collections"
- static const bool spread_collections = false;
+ static const bool spread_collections = true;
+
+ /// Default state of the experiment "triple-shift"
+ static const bool triple_shift = false;
/// Default state of the experiment "bogus-disabled"
static const bool bogus_disabled = false;
@@ -200,7 +275,7 @@
static const bool constant_update_2018 = false;
/// Expiration status of the experiment "control-flow-collections"
- static const bool control_flow_collections = false;
+ static const bool control_flow_collections = true;
/// Expiration status of the experiment "non-nullable"
static const bool non_nullable = false;
@@ -209,7 +284,10 @@
static const bool set_literals = true;
/// Expiration status of the experiment "spread-collections"
- static const bool spread_collections = false;
+ static const bool spread_collections = true;
+
+ /// Expiration status of the experiment "triple-shift"
+ static const bool triple_shift = false;
/// Expiration status of the experiment "bogus-disabled"
static const bool bogus_disabled = true;
diff --git a/analyzer/lib/src/dart/analysis/experiments_impl.dart b/analyzer/lib/src/dart/analysis/experiments_impl.dart
index 64d4b7e..81a437b 100644
--- a/analyzer/lib/src/dart/analysis/experiments_impl.dart
+++ b/analyzer/lib/src/dart/analysis/experiments_impl.dart
@@ -2,8 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:meta/meta.dart';
+import 'package:pub_semver/pub_semver.dart';
/// The same as [ExperimentStatus.knownFeatures], except when a call to
/// [overrideKnownFeatures] is in progress.
@@ -17,14 +19,9 @@
/// unrecognized flags are ignored, conflicting flags are resolved in favor of
/// the flag appearing last.
List<bool> decodeFlags(List<String> flags) {
- var decodedFlags = <bool>[];
+ var decodedFlags = List<bool>.filled(_knownFeatures.length, false);
for (var feature in _knownFeatures.values) {
- if (feature.isExpired) continue;
- var index = feature.index;
- while (decodedFlags.length <= index) {
- decodedFlags.add(false);
- }
- decodedFlags[index] = feature.isEnabledByDefault;
+ decodedFlags[feature.index] = feature.isEnabledByDefault;
}
for (var entry in _flagStringsToMap(flags).entries) {
decodedFlags[entry.key] = entry.value;
@@ -32,6 +29,34 @@
return decodedFlags;
}
+/// Computes a set of features for use in a unit test. Computes the set of
+/// features enabled in [sdkVersion], plus any specified [additionalFeatures].
+///
+/// If [sdkVersion] is not supplied (or is `null`), then the current set of
+/// enabled features is used as the starting point.
+List<bool> enableFlagsForTesting(
+ {String sdkVersion, List<Feature> additionalFeatures: const []}) {
+ var flags = decodeFlags([]);
+ if (sdkVersion != null) {
+ flags = restrictEnableFlagsToVersion(flags, Version.parse(sdkVersion));
+ }
+ for (ExperimentalFeature feature in additionalFeatures) {
+ flags[feature.index] = true;
+ }
+ return flags;
+}
+
+/// Pretty-prints the given set of enable flags as a set of feature names.
+String experimentStatusToString(List<bool> enableFlags) {
+ var featuresInSet = <String>[];
+ for (var feature in _knownFeatures.values) {
+ if (enableFlags[feature.index]) {
+ featuresInSet.add(feature.enableString);
+ }
+ }
+ return 'FeatureSet{${featuresInSet.join(', ')}}';
+}
+
/// Converts the flags in [status] to a list of strings suitable for
/// passing to [_decodeFlags].
List<String> experimentStatusToStringList(ExperimentStatus status) {
@@ -64,6 +89,19 @@
}
}
+/// Computes a new set of enable flags based on [flags], but with any features
+/// that were not present in [version] set to `false`.
+List<bool> restrictEnableFlagsToVersion(List<bool> flags, Version version) {
+ flags = List.from(flags);
+ for (var feature in _knownFeatures.values) {
+ if (!feature.isEnabledByDefault ||
+ feature.firstSupportedVersion > version) {
+ flags[feature.index] = false;
+ }
+ }
+ return flags;
+}
+
/// Validates whether there are any disagreements between the strings given in
/// [flags1] and the strings given in [flags2].
///
@@ -205,13 +243,10 @@
/// Information about a single experimental flag that the user might use to
/// request that a feature be enabled (or disabled).
-class ExperimentalFeature {
+class ExperimentalFeature implements Feature {
/// Index of the flag in the private data structure maintained by
/// [ExperimentStatus].
///
- /// For expired features, the index should be null, since no enable/disable
- /// state needs to be stored.
- ///
/// This index should not be relied upon to be stable over time. For instance
/// it should not be used to serialize the state of experiments to long term
/// storage if there is any expectation of compatibility between analyzer
@@ -231,13 +266,50 @@
/// Documentation for the feature, if known. `null` for expired flags.
final String documentation;
+ final String _firstSupportedVersion;
+
const ExperimentalFeature(this.index, this.enableString,
- this.isEnabledByDefault, this.isExpired, this.documentation)
- : assert(isExpired ? index == null : index != null);
+ this.isEnabledByDefault, this.isExpired, this.documentation,
+ {String firstSupportedVersion})
+ : _firstSupportedVersion = firstSupportedVersion,
+ assert(index != null),
+ assert(isEnabledByDefault
+ ? firstSupportedVersion != null
+ : firstSupportedVersion == null),
+ assert(enableString != null);
/// The string to disable the feature.
String get disableString => 'no-$enableString';
+ @override
+ String get experimentalFlag => isExpired ? null : enableString;
+
+ @override
+ Version get firstSupportedVersion {
+ if (_firstSupportedVersion == null) {
+ return null;
+ } else {
+ return Version.parse(_firstSupportedVersion);
+ }
+ }
+
+ @override
+ FeatureStatus get status {
+ if (isExpired) {
+ if (isEnabledByDefault) {
+ return FeatureStatus.current;
+ } else {
+ return FeatureStatus.abandoned;
+ }
+ } else {
+ if (isEnabledByDefault) {
+ return FeatureStatus.provisional;
+ } else {
+ return FeatureStatus.future;
+ }
+ }
+ }
+
/// Retrieves the string to enable or disable the feature, depending on
/// [value].
String stringForValue(bool value) => value ? enableString : disableString;
diff --git a/analyzer/lib/src/dart/analysis/file_state.dart b/analyzer/lib/src/dart/analysis/file_state.dart
index 3e1a68a..cac4817 100644
--- a/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/analyzer/lib/src/dart/analysis/file_state.dart
@@ -1,10 +1,11 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
import 'dart:typed_data';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
@@ -12,7 +13,6 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/defined_names.dart';
-import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/analysis/library_graph.dart';
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:analyzer/src/dart/analysis/referenced_names.dart';
@@ -118,6 +118,7 @@
String _unlinkedKey;
AnalysisDriverUnlinkedUnit _driverUnlinkedUnit;
UnlinkedUnit _unlinked;
+ UnlinkedUnit2 _unlinked2;
List<int> _apiSignature;
List<FileState> _importedFiles;
@@ -244,6 +245,9 @@
_fsState.externalSummaries.unlinkedMap.containsKey(uriStr)) {
return !_fsState.externalSummaries.linkedMap.containsKey(uriStr);
}
+ if (_unlinked2 != null) {
+ return _unlinked2.isPartOf;
+ }
return _unlinked.libraryNameOffset == 0 && _unlinked.isPartOf;
}
@@ -434,7 +438,8 @@
return _parse(errorListener);
});
} catch (_) {
- return _createEmptyCompilationUnit();
+ AnalysisOptionsImpl analysisOptions = _fsState._analysisOptions;
+ return _createEmptyCompilationUnit(analysisOptions.contextFeatures);
}
}
@@ -449,6 +454,10 @@
* Return `true` if the API signature changed since the last refresh.
*/
bool refresh({bool allowCached: false}) {
+ if (_fsState.useSummary2) {
+ return _refresh2();
+ }
+
_invalidateCurrentUnresolvedData();
{
@@ -578,7 +587,7 @@
}
@override
- String toString() => path;
+ String toString() => path ?? '<unresolved>';
/**
* Compute the full or partial map of exported declarations for this library.
@@ -643,9 +652,10 @@
return new _ExportedDeclarations(firstCycleId, declarations);
}
- CompilationUnit _createEmptyCompilationUnit() {
+ CompilationUnit _createEmptyCompilationUnit(FeatureSet featureSet) {
var token = new Token.eof(0);
- return astFactory.compilationUnit(token, null, [], [], token)
+ return astFactory.compilationUnit2(
+ beginToken: token, endToken: token, featureSet: featureSet)
..lineInfo = new LineInfo(const <int>[0]);
}
@@ -688,27 +698,29 @@
}
CompilationUnit _parse(AnalysisErrorListener errorListener) {
+ AnalysisOptionsImpl analysisOptions = _fsState._analysisOptions;
+ FeatureSet featureSet = analysisOptions.contextFeatures;
if (source == null) {
- return _createEmptyCompilationUnit();
+ return _createEmptyCompilationUnit(featureSet);
}
- AnalysisOptionsImpl analysisOptions = _fsState._analysisOptions;
- ExperimentStatus experimentStatus = analysisOptions.experimentStatus;
+ // TODO(paulberry): adjust featureSet as appropriate if there is a "@dart"
+ // comment and/or an SDK constraint that restricts what features should be
+ // available. Ideally we would like the parser to make this adjustment (at
+ // least in the case of "@dart") because it's the component that recognizes
+ // "@dart" comments.
CharSequenceReader reader = new CharSequenceReader(content);
- Scanner scanner = new Scanner(source, reader, errorListener);
- scanner.enableGtGtGt = experimentStatus.constant_update_2018;
+ Scanner scanner = new Scanner(source, reader, errorListener)
+ ..configureFeatures(featureSet);
Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
return scanner.tokenize();
});
LineInfo lineInfo = new LineInfo(scanner.lineStarts);
bool useFasta = analysisOptions.useFastaParser;
- Parser parser = new Parser(source, errorListener, useFasta: useFasta);
+ Parser parser = new Parser(source, errorListener,
+ featureSet: featureSet, useFasta: useFasta);
parser.enableOptionalNewAndConst = true;
- parser.enableNonNullable = experimentStatus.non_nullable;
- parser.enableSpreadCollections = experimentStatus.spread_collections;
- parser.enableControlFlowCollections =
- experimentStatus.control_flow_collections;
CompilationUnit unit = parser.parseCompilationUnit(token);
unit.lineInfo = lineInfo;
@@ -719,6 +731,163 @@
return unit;
}
+ bool _refresh2() {
+ _invalidateCurrentUnresolvedData();
+
+ {
+ var rawFileState = _fsState._fileContentCache.get(path, false);
+ _content = rawFileState.content;
+ _exists = rawFileState.exists;
+ _contentHash = rawFileState.contentHash;
+ }
+
+ // Prepare the unlinked bundle key.
+ List<int> contentSignature;
+ {
+ var signature = new ApiSignature();
+ signature.addUint32List(_fsState._unlinkedSalt);
+ signature.addString(_contentHash);
+ contentSignature = signature.toByteList();
+ _unlinkedKey = '${hex.encode(contentSignature)}.unlinked2';
+ }
+
+ // Prepare bytes of the unlinked bundle - existing or new.
+ List<int> bytes;
+ {
+ bytes = _fsState._byteStore.get(_unlinkedKey);
+ if (bytes == null || bytes.isEmpty) {
+ CompilationUnit unit = parse();
+ _fsState._logger.run('Create unlinked for $path', () {
+ var unlinkedUnit = serializeAstUnlinked2(contentSignature, unit);
+ var definedNames = computeDefinedNames(unit);
+ var referencedNames = computeReferencedNames(unit).toList();
+ var subtypedNames = computeSubtypedNames(unit).toList();
+ bytes = new AnalysisDriverUnlinkedUnitBuilder(
+ unit2: unlinkedUnit,
+ definedTopLevelNames: definedNames.topLevelNames.toList(),
+ definedClassMemberNames: definedNames.classMemberNames.toList(),
+ referencedNames: referencedNames,
+ subtypedNames: subtypedNames,
+ ).toBuffer();
+ _fsState._byteStore.put(_unlinkedKey, bytes);
+ });
+ }
+ }
+
+ // Read the unlinked bundle.
+ _driverUnlinkedUnit = new AnalysisDriverUnlinkedUnit.fromBuffer(bytes);
+ _unlinked2 = _driverUnlinkedUnit.unit2;
+ _lineInfo = new LineInfo(_unlinked2.lineStarts);
+
+ // Prepare API signature.
+ var newApiSignature = new Uint8List.fromList(_unlinked2.apiSignature);
+ bool apiSignatureChanged = _apiSignature != null &&
+ !_equalByteLists(_apiSignature, newApiSignature);
+ _apiSignature = newApiSignature;
+
+ // The API signature changed.
+ // Flush affected library cycles.
+ // Flush exported top-level declarations of all files.
+ if (apiSignatureChanged) {
+ _libraryCycle?.invalidate();
+
+ // If this is a part, invalidate the libraries.
+ var libraries = _fsState._partToLibraries[this];
+ if (libraries != null) {
+ for (var library in libraries) {
+ library.libraryCycle?.invalidate();
+ }
+ }
+
+ for (FileState file in _fsState._uriToFile.values) {
+ file._exportedTopLevelDeclarations = null;
+ }
+ }
+
+ // This file is potentially not a library for its previous parts anymore.
+ if (_partedFiles != null) {
+ for (FileState part in _partedFiles) {
+ _fsState._partToLibraries[part]?.remove(this);
+ }
+ }
+
+ // Build the graph.
+ _importedFiles = <FileState>[];
+ _exportedFiles = <FileState>[];
+ _partedFiles = <FileState>[];
+ _exportFilters = <NameFilter>[];
+ for (var uri in _unlinked2.imports) {
+ var file = _fileForRelativeUri(uri);
+ _importedFiles.add(file);
+ }
+ for (var uri in _unlinked2.exports) {
+ var file = _fileForRelativeUri(uri);
+ _exportedFiles.add(file);
+ // TODO(scheglov) implement
+ _exportFilters.add(NameFilter.identity);
+ }
+ for (var uri in _unlinked2.parts) {
+ var file = _fileForRelativeUri(uri);
+ _partedFiles.add(file);
+ _fsState._partToLibraries
+ .putIfAbsent(file, () => <FileState>[])
+ .add(this);
+ }
+ _libraryFiles = [this]..addAll(_partedFiles);
+
+ // Compute referenced files.
+ _directReferencedFiles = new Set<FileState>()
+ ..addAll(_importedFiles)
+ ..addAll(_exportedFiles)
+ ..addAll(_partedFiles);
+ _directReferencedLibraries = Set<FileState>()
+ ..addAll(_importedFiles)
+ ..addAll(_exportedFiles);
+
+ // Update mapping from subtyped names to files.
+ for (var name in _driverUnlinkedUnit.subtypedNames) {
+ var files = _fsState._subtypedNameToFiles[name];
+ if (files == null) {
+ files = new Set<FileState>();
+ _fsState._subtypedNameToFiles[name] = files;
+ }
+ files.add(this);
+ }
+
+ // Return whether the API signature changed.
+ return apiSignatureChanged;
+ }
+
+ static UnlinkedUnit2Builder serializeAstUnlinked2(
+ List<int> contentSignature, CompilationUnit unit) {
+ var exports = <String>[];
+ var imports = <String>['dart:core'];
+ var parts = <String>[];
+ var isPartOf = false;
+ for (var directive in unit.directives) {
+ if (directive is ExportDirective) {
+ var uriStr = directive.uri.stringValue;
+ exports.add(uriStr ?? '');
+ } else if (directive is ImportDirective) {
+ var uriStr = directive.uri.stringValue;
+ imports.add(uriStr ?? '');
+ } else if (directive is PartDirective) {
+ var uriStr = directive.uri.stringValue;
+ parts.add(uriStr ?? '');
+ } else if (directive is PartOfDirective) {
+ isPartOf = true;
+ }
+ }
+ return UnlinkedUnit2Builder(
+ apiSignature: contentSignature,
+ exports: exports,
+ imports: imports,
+ parts: parts,
+ isPartOf: isPartOf,
+ lineStarts: unit.lineInfo.lineStarts,
+ );
+ }
+
/**
* Return `true` if the given byte lists are equal.
*/
@@ -761,6 +930,7 @@
final AnalysisOptions _analysisOptions;
final Uint32List _unlinkedSalt;
final Uint32List _linkedSalt;
+ final bool useSummary2;
/**
* The optional store with externally provided unlinked and corresponding
@@ -841,6 +1011,7 @@
this._unlinkedSalt,
this._linkedSalt, {
this.externalSummaries,
+ this.useSummary2 = false,
}) {
_fileContentCache = _FileContentCache.getInstance(
_resourceProvider,
diff --git a/analyzer/lib/src/dart/analysis/file_tracker.dart b/analyzer/lib/src/dart/analysis/file_tracker.dart
index 1e34697..363b777 100644
--- a/analyzer/lib/src/dart/analysis/file_tracker.dart
+++ b/analyzer/lib/src/dart/analysis/file_tracker.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/fletcher16.dart b/analyzer/lib/src/dart/analysis/fletcher16.dart
index 8eb3e2e..46f3ae6 100644
--- a/analyzer/lib/src/dart/analysis/fletcher16.dart
+++ b/analyzer/lib/src/dart/analysis/fletcher16.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/dart/analysis/index.dart b/analyzer/lib/src/dart/analysis/index.dart
index ac79c40..61b116e 100644
--- a/analyzer/lib/src/dart/analysis/index.dart
+++ b/analyzer/lib/src/dart/analysis/index.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/library_analyzer.dart b/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 7a4b3d0..33e6df3 100644
--- a/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -32,6 +32,8 @@
import 'package:analyzer/src/lint/linter.dart';
import 'package:analyzer/src/lint/linter_visitor.dart';
import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary2/declaration_splicer.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
import 'package:analyzer/src/task/strong/checker.dart';
import 'package:pub_semver/pub_semver.dart';
@@ -53,6 +55,7 @@
final bool Function(Uri) _isLibraryUri;
final AnalysisContext _context;
final ElementResynthesizer _resynthesizer;
+ final LinkedElementFactory _elementFactory;
final TypeProvider _typeProvider;
final TypeSystem _typeSystem;
@@ -85,6 +88,7 @@
this._isLibraryUri,
this._context,
this._resynthesizer,
+ this._elementFactory,
this._inheritance,
this._library,
this._resourceProvider)
@@ -119,8 +123,12 @@
_resolveUriBasedDirectives(file, unit);
});
- _libraryElement = _resynthesizer
- .getElement(new ElementLocationImpl.con3([_library.uriStr]));
+ if (_elementFactory != null) {
+ _libraryElement = _elementFactory.libraryOfUri(_library.uriStr);
+ } else {
+ _libraryElement = _resynthesizer
+ .getElement(new ElementLocationImpl.con3([_library.uriStr]));
+ }
_libraryScope = new LibraryScope(_libraryElement);
_resolveDirectives(units);
@@ -204,7 +212,7 @@
ErrorReporter errorReporter, CompilationUnit unit) {
ConstantVerifier constantVerifier = new ConstantVerifier(
errorReporter, _libraryElement, _typeProvider, _declaredVariables,
- forAnalysisDriver: true);
+ featureSet: unit.featureSet, forAnalysisDriver: true);
unit.accept(constantVerifier);
}
@@ -240,7 +248,7 @@
}
unit.accept(new BestPracticesVerifier(
- errorReporter, _typeProvider, _libraryElement,
+ errorReporter, _typeProvider, _libraryElement, unit, file.content,
typeSystem: _context.typeSystem,
resourceProvider: _resourceProvider,
analysisOptions: _context.analysisOptions));
@@ -345,6 +353,7 @@
CodeChecker checker = new CodeChecker(
_typeProvider,
_context.typeSystem,
+ _inheritance,
errorListener,
_analysisOptions,
);
@@ -622,7 +631,11 @@
}
}
- new DeclarationResolver().resolve(unit, unitElement);
+ if (_elementFactory != null) {
+ new DeclarationSplicer(unitElement).splice(unit);
+ } else {
+ new DeclarationResolver().resolve(unit, unitElement);
+ }
unit.accept(new AstRewriteVisitor(_context.typeSystem, _libraryElement,
source, _typeProvider, errorListener,
@@ -643,15 +656,21 @@
_libraryElement, source, _typeProvider, errorListener,
nameScope: _libraryScope));
- unit.accept(new PartialResolverVisitor(_inheritance, _libraryElement,
- source, _typeProvider, AnalysisErrorListener.NULL_LISTENER));
+ unit.accept(new PartialResolverVisitor(
+ _inheritance,
+ _libraryElement,
+ source,
+ _typeProvider,
+ AnalysisErrorListener.NULL_LISTENER,
+ unit.featureSet));
// Nothing for RESOLVED_UNIT8?
// Nothing for RESOLVED_UNIT9?
// Nothing for RESOLVED_UNIT10?
unit.accept(new ResolverVisitor(
- _inheritance, _libraryElement, source, _typeProvider, errorListener));
+ _inheritance, _libraryElement, source, _typeProvider, errorListener,
+ featureSet: unit.featureSet));
}
/**
diff --git a/analyzer/lib/src/dart/analysis/library_context.dart b/analyzer/lib/src/dart/analysis/library_context.dart
index 9c82bd8..62ba772 100644
--- a/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/analyzer/lib/src/dart/analysis/library_context.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -6,10 +6,10 @@
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/element/element.dart'
show CompilationUnitElement, LibraryElement;
-import 'package:analyzer/src/context/context.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
+import 'package:analyzer/src/dart/analysis/library_graph.dart';
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:analyzer/src/dart/analysis/restricted_analysis_context.dart';
import 'package:analyzer/src/dart/element/element.dart';
@@ -23,6 +23,11 @@
import 'package:analyzer/src/summary/link.dart';
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:analyzer/src/summary/resynthesize.dart';
+import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:analyzer/src/summary2/link.dart' as link2;
+import 'package:analyzer/src/summary2/linked_bundle_context.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
+import 'package:analyzer/src/summary2/reference.dart';
import 'package:meta/meta.dart';
/**
@@ -36,6 +41,7 @@
final PerformanceLog logger;
final ByteStore byteStore;
+ final AnalysisSession analysisSession;
final SummaryDataStore store = new SummaryDataStore([]);
/// The size of the linked data that is loaded by this context.
@@ -43,8 +49,9 @@
/// We use it as an approximation for the heap size of elements.
int _linkedDataInBytes = 0;
- AnalysisContextImpl analysisContext;
+ RestrictedAnalysisContext analysisContext;
SummaryResynthesizer resynthesizer;
+ LinkedElementFactory elementFactory;
InheritanceManager2 inheritanceManager;
LibraryContext({
@@ -57,8 +64,10 @@
@required SourceFactory sourceFactory,
@required SummaryDataStore externalSummaries,
@required FileState targetLibrary,
+ @required bool useSummary2,
}) : this.logger = logger,
- this.byteStore = byteStore {
+ this.byteStore = byteStore,
+ this.analysisSession = session {
if (externalSummaries != null) {
store.addStore(externalSummaries);
}
@@ -69,12 +78,17 @@
sourceFactory,
);
- // Fill the store with summaries required for the initial library.
- load(targetLibrary);
+ if (useSummary2) {
+ load2(targetLibrary);
+ } else {
+ // Fill the store with summaries required for the initial library.
+ load(targetLibrary);
- var provider = new InputPackagesResultProvider(analysisContext, store,
- session: session);
- resynthesizer = provider.resynthesizer;
+ resynthesizer = new StoreBasedSummaryResynthesizer(
+ analysisContext, session, sourceFactory, true, store);
+ analysisContext.typeProvider = resynthesizer.typeProvider;
+ resynthesizer.finishCoreAsyncLibraries();
+ }
inheritanceManager = new InheritanceManager2(analysisContext.typeSystem);
}
@@ -88,10 +102,18 @@
* Computes a [CompilationUnitElement] for the given library/unit pair.
*/
CompilationUnitElement computeUnitElement(FileState library, FileState unit) {
- return resynthesizer.getElement(new ElementLocationImpl.con3(<String>[
- library.uriStr,
- unit.uriStr,
- ]));
+ if (elementFactory != null) {
+ var reference = elementFactory.rootReference
+ .getChild(library.uriStr)
+ .getChild('@unit')
+ .getChild(unit.uriStr);
+ return elementFactory.elementOfReference(reference);
+ } else {
+ return resynthesizer.getElement(new ElementLocationImpl.con3(<String>[
+ library.uriStr,
+ unit.uriStr,
+ ]));
+ }
}
/**
@@ -106,7 +128,11 @@
*/
bool isLibraryUri(Uri uri) {
String uriStr = uri.toString();
- return store.unlinkedMap[uriStr]?.isPartOf == false;
+ if (elementFactory != null) {
+ return elementFactory.isLibraryUri(uriStr);
+ } else {
+ return store.unlinkedMap[uriStr]?.isPartOf == false;
+ }
}
/// Load data required to access elements of the given [targetLibrary].
@@ -193,6 +219,102 @@
}
}
+ /// Load data required to access elements of the given [targetLibrary].
+ void load2(FileState targetLibrary) {
+ var loadedBundles = Set<LibraryCycle>.identity();
+ var inputBundles = <LinkedNodeBundle>[];
+
+ void loadBundle(LibraryCycle cycle) {
+ if (!loadedBundles.add(cycle)) return;
+
+ logger.run('Prepare linked bundle', () {
+ logger.writeln('Libraries: ${cycle.libraries}');
+ cycle.directDependencies.forEach(loadBundle);
+
+ var key = cycle.transitiveSignature + '.linked_bundle';
+ var bytes = byteStore.get(key);
+
+ if (bytes == null) {
+ var inputLibraries = <link2.LinkInputLibrary>[];
+ logger.run('Prepare input libraries', () {
+ for (var libraryFile in cycle.libraries) {
+ var librarySource = libraryFile.source;
+ if (librarySource == null) continue;
+
+ var inputUnits = <link2.LinkInputUnit>[];
+ for (var file in libraryFile.libraryFiles) {
+ var isSynthetic = !file.exists;
+ inputUnits.add(
+ link2.LinkInputUnit(file.source, isSynthetic, file.parse()),
+ );
+ }
+
+ inputLibraries.add(
+ link2.LinkInputLibrary(librarySource, inputUnits),
+ );
+ }
+ logger.writeln('Prepared ${inputLibraries.length} libraries.');
+ });
+
+ link2.LinkResult linkResult;
+ logger.run('Link libraries', () {
+ linkResult = link2.link(
+ analysisContext.analysisOptions,
+ analysisContext.sourceFactory,
+ analysisContext.declaredVariables,
+ inputBundles,
+ inputLibraries,
+ );
+ logger.writeln('Linked ${inputLibraries.length} libraries.');
+ });
+
+ bytes = linkResult.bundle.toBuffer();
+ byteStore.put(key, bytes);
+ logger.writeln('Stored ${bytes.length} bytes.');
+ } else {
+ logger.writeln('Loaded ${bytes.length} bytes.');
+ }
+
+ inputBundles.add(
+ LinkedNodeBundle.fromBuffer(bytes),
+ );
+ });
+ }
+
+ logger.run('Prepare linked bundles', () {
+ var libraryCycle = targetLibrary.libraryCycle;
+ loadBundle(libraryCycle);
+ });
+
+ var rootReference = Reference.root();
+ rootReference.getChild('dart:core').getChild('dynamic').element =
+ DynamicElementImpl.instance;
+ rootReference.getChild('dart:core').getChild('Never').element =
+ NeverElementImpl.instance;
+
+ elementFactory = LinkedElementFactory(
+ analysisContext,
+ analysisSession,
+ rootReference,
+ );
+
+ for (var bundle in inputBundles) {
+ elementFactory.addBundle(
+ LinkedBundleContext(elementFactory, bundle),
+ );
+ }
+
+ var dartCore = elementFactory.libraryOfUri('dart:core');
+ var dartAsync = elementFactory.libraryOfUri('dart:async');
+ var typeProvider = SummaryTypeProvider()
+ ..initializeCore(dartCore)
+ ..initializeAsync(dartAsync);
+ analysisContext.typeProvider = typeProvider;
+
+ dartCore.createLoadLibraryFunction(typeProvider);
+ dartAsync.createLoadLibraryFunction(typeProvider);
+ }
+
/// Return `true` if this context grew too large, and should be recreated.
///
/// It might have been used to analyze libraries that we don't need anymore,
diff --git a/analyzer/lib/src/dart/analysis/library_graph.dart b/analyzer/lib/src/dart/analysis/library_graph.dart
index 74cb08c..3e79078 100644
--- a/analyzer/lib/src/dart/analysis/library_graph.dart
+++ b/analyzer/lib/src/dart/analysis/library_graph.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -8,7 +8,6 @@
import 'package:analyzer/src/summary/api_signature.dart';
import 'package:analyzer/src/summary/link.dart' as graph
show DependencyWalker, Node;
-import 'package:meta/meta.dart';
/// Ensure that the [FileState.libraryCycle] for the [file] and anything it
/// depends on is computed.
@@ -23,7 +22,6 @@
final List<FileState> libraries = [];
/// The library cycles that this cycle references directly.
- @visibleForTesting
final Set<LibraryCycle> directDependencies = new Set<LibraryCycle>();
/// The cycles that use this cycle, used to [invalidate] transitively.
@@ -35,11 +33,11 @@
/// transitive signatures of the cycles that the [libraries] reference
/// directly. So, indirectly it is based on the transitive closure of all
/// files that [libraries] reference (but we don't compute these files).
- String _transitiveSignature;
+ String transitiveSignature;
/// The map from a library in [libraries] to its transitive signature.
///
- /// It is almost the same as [_transitiveSignature], but is also based on
+ /// It is almost the same as [transitiveSignature], but is also based on
/// the URI of this specific library. Currently we store each linked library
/// with its own key, so we need unique keys. However practically we never
/// can use just *one* library of a cycle, we always use the whole cycle.
@@ -49,7 +47,7 @@
LibraryCycle();
- LibraryCycle.external() : _transitiveSignature = '<external>';
+ LibraryCycle.external() : transitiveSignature = '<external>';
/// Invalidate this cycle and any cycles that directly or indirectly use it.
///
@@ -125,6 +123,8 @@
for (var node in scc) {
cycle.libraries.add(node.file);
+ signature.addString(node.file.uriStr);
+
signature.addInt(node.file.libraryFiles.length);
for (var file in node.file.libraryFiles) {
signature.addBytes(file.apiSignature);
@@ -132,13 +132,13 @@
}
// Compute the general library cycle signature.
- cycle._transitiveSignature = signature.toHex();
+ cycle.transitiveSignature = signature.toHex();
// Compute library specific signatures.
for (var node in scc) {
var librarySignatureBuilder = new ApiSignature()
..addString(node.file.uriStr)
- ..addString(cycle._transitiveSignature);
+ ..addString(cycle.transitiveSignature);
var librarySignature = librarySignatureBuilder.toHex();
node.file.internal_setLibraryCycle(
@@ -166,7 +166,7 @@
if (cycle.directDependencies.add(referencedCycle)) {
referencedCycle._directUsers.add(cycle);
- signature.addString(referencedCycle._transitiveSignature);
+ signature.addString(referencedCycle.transitiveSignature);
}
}
}
diff --git a/analyzer/lib/src/dart/analysis/performance_logger.dart b/analyzer/lib/src/dart/analysis/performance_logger.dart
index 47af4cd..6c265db 100644
--- a/analyzer/lib/src/dart/analysis/performance_logger.dart
+++ b/analyzer/lib/src/dart/analysis/performance_logger.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/referenced_names.dart b/analyzer/lib/src/dart/analysis/referenced_names.dart
index 9148fef..ab09542 100644
--- a/analyzer/lib/src/dart/analysis/referenced_names.dart
+++ b/analyzer/lib/src/dart/analysis/referenced_names.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/analysis/session.dart b/analyzer/lib/src/dart/analysis/session.dart
index 6ff7f8f..5c88736 100644
--- a/analyzer/lib/src/dart/analysis/session.dart
+++ b/analyzer/lib/src/dart/analysis/session.dart
@@ -17,38 +17,24 @@
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
-/**
- * A concrete implementation of an analysis session.
- */
+/// A concrete implementation of an analysis session.
class AnalysisSessionImpl implements AnalysisSession {
- /**
- * The analysis driver performing analysis for this session.
- */
+ /// The analysis driver performing analysis for this session.
final driver.AnalysisDriver _driver;
- /**
- * The type provider being used by the analysis driver.
- */
+ /// The type provider being used by the analysis driver.
TypeProvider _typeProvider;
- /**
- * The type system being used by the analysis driver.
- */
+ /// The type system being used by the analysis driver.
TypeSystem _typeSystem;
- /**
- * The URI converter used to convert between URI's and file paths.
- */
+ /// The URI converter used to convert between URI's and file paths.
UriConverter _uriConverter;
- /**
- * The cache of libraries for URIs.
- */
+ /// The cache of libraries for URIs.
final Map<String, LibraryElement> _uriToLibraryCache = {};
- /**
- * Initialize a newly created analysis session.
- */
+ /// Initialize a newly created analysis session.
AnalysisSessionImpl(this._driver);
@override
@@ -190,10 +176,8 @@
return _driver.getUnitElementSignature(path);
}
- /**
- * Check to see that results from this session will be consistent, and throw
- * an [InconsistentAnalysisException] if they might not be.
- */
+ /// Check to see that results from this session will be consistent, and throw
+ /// an [InconsistentAnalysisException] if they might not be.
void _checkConsistency() {
if (_driver.currentSession != this) {
throw new InconsistentAnalysisException();
diff --git a/analyzer/lib/src/dart/analysis/top_level_declaration.dart b/analyzer/lib/src/dart/analysis/top_level_declaration.dart
index b32e636..1658aad 100644
--- a/analyzer/lib/src/dart/analysis/top_level_declaration.dart
+++ b/analyzer/lib/src/dart/analysis/top_level_declaration.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/ast/ast.dart b/analyzer/lib/src/dart/ast/ast.dart
index 8dfa18b..bbc3d44 100644
--- a/analyzer/lib/src/dart/ast/ast.dart
+++ b/analyzer/lib/src/dart/ast/ast.dart
@@ -5,6 +5,7 @@
import 'dart:collection';
import 'dart:math' as math;
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/precedence.dart';
import 'package:analyzer/dart/ast/syntactic_entity.dart';
@@ -443,13 +444,8 @@
_expression = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => RELATIONAL_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.relational;
+ Precedence get precedence => Precedence.relational;
@override
TypeAnnotation get type => _type;
@@ -697,13 +693,8 @@
_leftHandSide = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => ASSIGNMENT_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.assignment;
+ Precedence get precedence => Precedence.assignment;
@deprecated
@override
@@ -924,13 +915,8 @@
_expression = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => PREFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.prefix;
+ Precedence get precedence => Precedence.prefix;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitAwaitExpression(this);
@@ -994,13 +980,8 @@
_leftOperand = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => operator.type.precedence;
-
- @override
- Precedence get precedence2 => Precedence.forTokenType(operator.type);
+ Precedence get precedence => Precedence.forTokenType(operator.type);
@deprecated
@override
@@ -1283,13 +1264,8 @@
@override
Token get endToken => _cascadeSections.endToken;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => CASCADE_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.cascade;
+ Precedence get precedence => Precedence.cascade;
@override
Expression get target => _target;
@@ -2082,7 +2058,10 @@
LocalVariableInfo localVariableInfo = new LocalVariableInfo();
/// Is `true` if this unit has been parsed as non-nullable.
- bool isNonNullable = false;
+ final bool isNonNullable;
+
+ @override
+ final FeatureSet featureSet;
/// Initialize a newly created compilation unit to have the given directives
/// and declarations. The [scriptTag] can be `null` if there is no script tag
@@ -2094,7 +2073,10 @@
ScriptTagImpl scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations,
- this.endToken) {
+ this.endToken,
+ this.featureSet)
+ : this.isNonNullable =
+ featureSet?.isEnabled(Feature.non_nullable) ?? false {
_scriptTag = _becomeParentOf(scriptTag);
_directives = new NodeListImpl<Directive>(this, directives);
_declarations = new NodeListImpl<CompilationUnitMember>(this, declarations);
@@ -2283,13 +2265,8 @@
@override
Token get endToken => _elseExpression.endToken;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => CONDITIONAL_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.conditional;
+ Precedence get precedence => Precedence.conditional;
@override
Expression get thenExpression => _thenExpression;
@@ -2438,7 +2415,6 @@
case CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE:
case CompileTimeErrorCode.CONST_WITH_NON_CONST:
case CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT:
- case CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER:
case CompileTimeErrorCode
.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST:
case CompileTimeErrorCode.INVALID_CONSTANT:
@@ -3042,9 +3018,6 @@
}
@override
- ParameterElement get declaredElement => _parameter.declaredElement;
-
- @override
Token get beginToken => _parameter.beginToken;
@override
@@ -3055,6 +3028,9 @@
Token get covariantKeyword => null;
@override
+ ParameterElement get declaredElement => _parameter.declaredElement;
+
+ @override
Expression get defaultValue => _defaultValue;
@override
@@ -3091,6 +3067,9 @@
}
@override
+ Token get requiredKeyword => null;
+
+ @override
E accept<E>(AstVisitor<E> visitor) =>
visitor.visitDefaultFormalParameter(this);
@@ -3514,6 +3493,7 @@
@override
Iterable<SyntacticEntity> get childEntities => super._childEntities
+ ..add(keyword)
..add(_uri)
..addAll(combinators)
..add(semicolon);
@@ -3699,6 +3679,10 @@
@override
bool get isAssignable => false;
+ @Deprecated('Use precedence')
+ @override
+ Precedence get precedence2 => precedence;
+
@deprecated
@override
ParameterElement get propagatedParameterElement => null;
@@ -3967,6 +3951,7 @@
CommentImpl comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
this.keyword,
TypeAnnotationImpl type,
this.thisKeyword,
@@ -3974,7 +3959,8 @@
SimpleIdentifierImpl identifier,
TypeParameterListImpl typeParameters,
FormalParameterListImpl parameters)
- : super(comment, metadata, covariantKeyword, identifier) {
+ : super(
+ comment, metadata, covariantKeyword, requiredKeyword, identifier) {
_type = _becomeParentOf(type);
_typeParameters = _becomeParentOf(typeParameters);
_parameters = _becomeParentOf(parameters);
@@ -4171,107 +4157,6 @@
}
}
-/// A for-each statement.
-///
-/// forEachStatement ::=
-/// 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block]
-/// | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block]
-@Deprecated('Use ForStatement2Impl')
-class ForEachStatementImpl extends ForStatement2Impl
- implements ForEachStatement {
- /// Initialize a newly created for-each statement whose loop control variable
- /// is declared internally (in the for-loop part). The [awaitKeyword] can be
- /// `null` if this is not an asynchronous for loop.
- ForEachStatementImpl.withDeclaration(
- Token awaitKeyword,
- Token forKeyword,
- Token leftParenthesis,
- DeclaredIdentifierImpl loopVariable,
- Token inKeyword,
- ExpressionImpl iterator,
- Token rightParenthesis,
- StatementImpl body)
- : super(
- awaitKeyword,
- forKeyword,
- leftParenthesis,
- new ForEachPartsWithDeclarationImpl(
- loopVariable, inKeyword, iterator),
- rightParenthesis,
- body);
-
- /// Creates a for-each statement using a caller-provided "parts" data
- /// structure.
- ForEachStatementImpl.withParts(
- Token awaitKeyword,
- Token forKeyword,
- Token leftParenthesis,
- ForEachPartsImpl forLoopParts,
- Token rightParenthesis,
- Statement body)
- : super(awaitKeyword, forKeyword, leftParenthesis, forLoopParts,
- rightParenthesis, body);
-
- /// Initialize a newly created for-each statement whose loop control variable
- /// is declared outside the for loop. The [awaitKeyword] can be `null` if this
- /// is not an asynchronous for loop.
- ForEachStatementImpl.withReference(
- Token awaitKeyword,
- Token forKeyword,
- Token leftParenthesis,
- SimpleIdentifierImpl identifier,
- Token inKeyword,
- ExpressionImpl iterator,
- Token rightParenthesis,
- StatementImpl body)
- : super(
- awaitKeyword,
- forKeyword,
- leftParenthesis,
- new ForEachPartsWithIdentifierImpl(identifier, inKeyword, iterator),
- rightParenthesis,
- body);
-
- @override
- SimpleIdentifier get identifier => forLoopParts is ForEachPartsWithIdentifier
- ? (forLoopParts as ForEachPartsWithIdentifier).identifier
- : null;
-
- @override
- void set identifier(SimpleIdentifier identifier) {
- (forLoopParts as ForEachPartsWithIdentifierImpl).identifier = identifier;
- }
-
- @override
- Token get inKeyword => (forLoopParts as ForEachParts).inKeyword;
-
- @override
- set inKeyword(Token keyword) =>
- (forLoopParts as ForEachPartsImpl).inKeyword = keyword;
-
- @override
- Expression get iterable => (forLoopParts as ForEachParts).iterable;
-
- @override
- void set iterable(Expression expression) {
- (forLoopParts as ForEachPartsImpl).iterable = expression;
- }
-
- @override
- DeclaredIdentifier get loopVariable =>
- forLoopParts is ForEachPartsWithDeclaration
- ? (forLoopParts as ForEachPartsWithDeclaration).loopVariable
- : null;
-
- @override
- void set loopVariable(DeclaredIdentifier variable) {
- (forLoopParts as ForEachPartsWithDeclarationImpl).loopVariable = variable;
- }
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitForEachStatement(this);
-}
-
class ForElementImpl extends CollectionElementImpl
with ForMixin
implements ForElement {
@@ -4342,13 +4227,17 @@
ParameterElement get element => declaredElement;
@override
- bool get isNamed => kind == ParameterKind.NAMED;
+ bool get isNamed =>
+ kind == ParameterKind.NAMED || kind == ParameterKind.NAMED_REQUIRED;
@override
bool get isOptional =>
kind == ParameterKind.NAMED || kind == ParameterKind.POSITIONAL;
@override
+ bool get isOptionalNamed => kind == ParameterKind.NAMED;
+
+ @override
bool get isOptionalPositional => kind == ParameterKind.POSITIONAL;
@override
@@ -4356,7 +4245,14 @@
kind == ParameterKind.POSITIONAL || kind == ParameterKind.REQUIRED;
@override
- bool get isRequired => kind == ParameterKind.REQUIRED;
+ bool get isRequired =>
+ kind == ParameterKind.REQUIRED || kind == ParameterKind.NAMED_REQUIRED;
+
+ @override
+ bool get isRequiredNamed => kind == ParameterKind.NAMED_REQUIRED;
+
+ @override
+ bool get isRequiredPositional => kind == ParameterKind.REQUIRED;
@override
// Overridden to remove the 'deprecated' annotation.
@@ -4641,20 +4537,12 @@
}
}
-abstract class ForStatement2Impl extends StatementImpl
- with ForMixin
- implements ForStatement2 {
- /// The body of the loop.
- StatementImpl _body;
-
+@Deprecated('Replaced by ForStatementImpl')
+class ForStatement2Impl extends ForStatementImpl implements ForStatement2 {
/// Initialize a newly created for statement.
- ForStatement2Impl(
- Token awaitKeyword,
- Token forKeyword,
- Token leftParenthesis,
- ForLoopPartsImpl forLoopParts,
- Token rightParenthesis,
- StatementImpl body) {
+ ForStatement2Impl(Token awaitKeyword, Token forKeyword, Token leftParenthesis,
+ ForLoopPartsImpl forLoopParts, Token rightParenthesis, StatementImpl body)
+ : super._() {
this.awaitKeyword = awaitKeyword;
this.forKeyword = forKeyword;
this.leftParenthesis = leftParenthesis;
@@ -4663,6 +4551,28 @@
_body = _becomeParentOf(body);
}
+ @override
+ E accept<E>(AstVisitor<E> visitor) => visitor.visitForStatement2(this);
+}
+
+abstract class ForStatementImpl extends StatementImpl
+ with ForMixin
+ implements ForStatement {
+ /// The body of the loop.
+ StatementImpl _body;
+
+ /// Initialize a newly created for statement.
+ factory ForStatementImpl(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopPartsImpl forLoopParts,
+ Token rightParenthesis,
+ // ignore: deprecated_member_use_from_same_package
+ StatementImpl body) = ForStatement2Impl;
+
+ ForStatementImpl._();
+
Statement get body => _body;
void set body(Statement statement) {
@@ -4678,7 +4588,7 @@
Token get endToken => _body.endToken;
@override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitForStatement2(this);
+ E accept<E>(AstVisitor<E> visitor) => visitor.visitForStatement(this);
@override
void visitChildren(AstVisitor visitor) {
@@ -4687,111 +4597,6 @@
}
}
-/// A for statement.
-///
-/// forStatement ::=
-/// 'for' '(' forLoopParts ')' [Statement]
-///
-/// forLoopParts ::=
-/// forInitializerStatement ';' [Expression]? ';' [Expression]?
-///
-/// forInitializerStatement ::=
-/// [DefaultFormalParameter]
-/// | [Expression]?
-@Deprecated('Use ForStatement2Impl')
-class ForStatementImpl extends ForStatement2Impl implements ForStatement {
- /// Initialize a newly created for statement. Either the [variableList] or the
- /// [initialization] must be `null`. Either the [condition] and the list of
- /// [updaters] can be `null` if the loop does not have the corresponding
- /// attribute.
- ForStatementImpl(
- Token forKeyword,
- Token leftParenthesis,
- VariableDeclarationListImpl variableList,
- ExpressionImpl initialization,
- Token leftSeparator,
- ExpressionImpl condition,
- Token rightSeparator,
- List<Expression> updaters,
- Token rightParenthesis,
- StatementImpl body)
- : super(
- null,
- forKeyword,
- leftParenthesis,
- variableList == null
- ? new ForPartsWithExpressionImpl(initialization, leftSeparator,
- condition, rightSeparator, updaters)
- : new ForPartsWithDeclarationsImpl(variableList, leftSeparator,
- condition, rightSeparator, updaters),
- rightParenthesis,
- body);
-
- /// Creates a for-each statement using a caller-provided "parts" data
- /// structure.
- ForStatementImpl.withParts(
- Token awaitKeyword,
- Token forKeyword,
- Token leftParenthesis,
- ForPartsImpl forLoopParts,
- Token rightParenthesis,
- Statement body)
- : super(awaitKeyword, forKeyword, leftParenthesis, forLoopParts,
- rightParenthesis, body);
-
- @override
- Expression get condition => (forLoopParts as ForParts).condition;
-
- @override
- void set condition(Expression expression) {
- (forLoopParts as ForPartsImpl).condition = expression;
- }
-
- @override
- Expression get initialization => forLoopParts is ForPartsWithExpression
- ? (forLoopParts as ForPartsWithExpression).initialization
- : null;
-
- @override
- void set initialization(Expression initialization) {
- if (forLoopParts is ForPartsWithExpressionImpl) {
- (forLoopParts as ForPartsWithExpressionImpl).initialization =
- initialization;
- }
- }
-
- @override
- Token get leftSeparator => (forLoopParts as ForParts).leftSeparator;
-
- @override
- set leftSeparator(Token separator) =>
- (forLoopParts as ForPartsImpl).leftSeparator = separator;
-
- @override
- Token get rightSeparator => (forLoopParts as ForParts).rightSeparator;
-
- @override
- set rightSeparator(Token separator) =>
- (forLoopParts as ForPartsImpl).rightSeparator = separator;
-
- @override
- NodeList<Expression> get updaters => (forLoopParts as ForParts).updaters;
-
- @override
- VariableDeclarationList get variables =>
- forLoopParts is ForPartsWithDeclarations
- ? (forLoopParts as ForPartsWithDeclarations).variables
- : null;
-
- @override
- void set variables(VariableDeclarationList variableList) {
- (forLoopParts as ForPartsWithDeclarationsImpl).variables = variableList;
- }
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitForStatement(this);
-}
-
/// A node representing the body of a function or method.
///
/// functionBody ::=
@@ -5080,13 +4885,8 @@
_parameters = _becomeParentOf(parameters as FormalParameterListImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@override
TypeParameterList get typeParameters => _typeParameters;
@@ -5154,13 +4954,8 @@
_function = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@deprecated
@override
@@ -5301,11 +5096,13 @@
CommentImpl comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
TypeAnnotationImpl returnType,
SimpleIdentifierImpl identifier,
TypeParameterListImpl typeParameters,
FormalParameterListImpl parameters)
- : super(comment, metadata, covariantKeyword, identifier) {
+ : super(
+ comment, metadata, covariantKeyword, requiredKeyword, identifier) {
_returnType = _becomeParentOf(returnType);
_typeParameters = _becomeParentOf(typeParameters);
_parameters = _becomeParentOf(parameters);
@@ -5419,6 +5216,10 @@
@override
DartType type;
+ /// Return the element associated with the function type, or `null` if the
+ /// AST structure has not been resolved.
+ GenericFunctionTypeElement declaredElement;
+
/// Initialize a newly created generic function type.
GenericFunctionTypeImpl(TypeAnnotationImpl returnType, this.functionKeyword,
TypeParameterListImpl typeParameters, FormalParameterListImpl parameters,
@@ -5878,6 +5679,7 @@
@override
Iterable<SyntacticEntity> get childEntities => super._childEntities
+ ..add(keyword)
..add(_uri)
..add(deferredKeyword)
..add(asKeyword)
@@ -6002,13 +5804,8 @@
@override
bool get isCascaded => period != null;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@deprecated
@override
@@ -6178,13 +5975,8 @@
/// Return `true` if this is an implicit constructor invocations.
bool get isImplicit => keyword == null;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
/// Return the type arguments associated with the constructor, rather than
/// with the class in which the constructor is defined. It is always an error
@@ -6278,7 +6070,8 @@
AnalysisContext context = library.context;
ErrorReporter errorReporter = new ErrorReporter(listener, element.source);
accept(new ConstantVerifier(errorReporter, library, context.typeProvider,
- context.declaredVariables));
+ context.declaredVariables,
+ featureSet: FeatureSet.fromEnableFlags([])));
} finally {
keyword = oldKeyword;
}
@@ -6611,13 +6404,8 @@
_expression = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => RELATIONAL_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.relational;
+ Precedence get precedence => Precedence.relational;
@override
TypeAnnotation get type => _type;
@@ -6843,13 +6631,8 @@
return buffer.toString();
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@deprecated
@override
@@ -6867,72 +6650,6 @@
}
}
-/// A list literal.
-///
-/// listLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] '>')?
-/// '[' ([CollectionLiteralElement] ','?)? ']'
-///
-/// This is the class that is used to represent a list literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [ListLiteral] will be
-/// used.
-@Deprecated('Replaced by ListLiteralImpl')
-class ListLiteral2Impl extends TypedLiteralImpl implements ListLiteral2 {
- @override
- Token leftBracket;
-
- /// The elements used to compute the elements of the list.
- NodeList<CollectionElement> _elements;
-
- @override
- Token rightBracket;
-
- /// Initialize a newly created list literal. The [constKeyword] can be `null`
- /// if the literal is not a constant. The [typeArguments] can be `null` if no
- /// type arguments were declared. The list of [elements] can be `null` if the
- /// list is empty.
- ListLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
- this.leftBracket, List<CollectionElement> elements, this.rightBracket)
- : super(constKeyword, typeArguments) {
- _elements = new NodeListImpl<CollectionElement>(this, elements);
- }
-
- @override
- Token get beginToken {
- if (constKeyword != null) {
- return constKeyword;
- }
- TypeArgumentList typeArguments = this.typeArguments;
- if (typeArguments != null) {
- return typeArguments.beginToken;
- }
- return leftBracket;
- }
-
- @override
- // TODO(paulberry): add commas.
- Iterable<SyntacticEntity> get childEntities => super._childEntities
- ..add(leftBracket)
- ..addAll(_elements)
- ..add(rightBracket);
-
- @override
- NodeList<CollectionElement> get elements => _elements;
-
- @override
- Token get endToken => rightBracket;
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitListLiteral2(this);
-
- @override
- void visitChildren(AstVisitor visitor) {
- super.visitChildren(visitor);
- _elements.accept(visitor);
- }
-}
-
class ListLiteralImpl extends TypedLiteralImpl implements ListLiteral {
/// The left square bracket.
@override
@@ -6990,9 +6707,10 @@
..add(rightBracket);
@override
- NodeList<Expression> get elements => _elements;
+ NodeList<CollectionElement> get elements => _elements;
@override
+ @Deprecated('Replaced by elements')
NodeList<CollectionElement> get elements2 => _elements;
@override
@@ -7019,13 +6737,8 @@
/// | [NullLiteral]
/// | [StringLiteral]
abstract class LiteralImpl extends ExpressionImpl implements Literal {
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
}
/// Additional information about local variables within a function or method
@@ -7043,32 +6756,6 @@
new Set<VariableElement>();
}
-/// A literal map.
-///
-/// mapLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
-/// '{' ([MapElement] (',' [MapElement])* ','?)? '}'
-///
-/// This is the class that is used to represent a map literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [MapLiteral] will be used.
-@Deprecated('Replaced by SetOrMapLiteralImpl')
-class MapLiteral2Impl extends SetOrMapLiteralImpl implements MapLiteral2 {
- /// Initialize a newly created map literal. The [constKeyword] can be `null`
- /// if the literal is not a constant. The [typeArguments] can be `null` if no
- /// type arguments were declared. The [entries] can be `null` if the map is
- /// empty.
- MapLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
- Token leftBracket, List<CollectionElement> entries, Token rightBracket)
- : super(constKeyword, typeArguments, leftBracket, entries, rightBracket);
-
- @override
- NodeList<CollectionElement> get entries => _elements;
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitMapLiteral2(this);
-}
-
/// A single key/value pair in a map literal.
///
/// mapLiteralEntry ::=
@@ -7128,24 +6815,6 @@
}
}
-@Deprecated('Use SetOrMapLiteral')
-class MapLiteralImpl extends SetOrMapLiteralImpl implements MapLiteral {
- /// Initialize a newly created map literal. The [constKeyword] can be `null`
- /// if the literal is not a constant. The [typeArguments] can be `null` if no
- /// type arguments were declared. The [entries] can be `null` if the map is
- /// empty.
- MapLiteralImpl(Token constKeyword, TypeArgumentListImpl typeArguments,
- Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket)
- : super._map(
- constKeyword, typeArguments, leftBracket, entries, rightBracket);
-
- @override
- NodeList<MapLiteralEntry> get entries => _elements;
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitMapLiteral(this);
-}
-
/// A method declaration.
///
/// methodDeclaration ::=
@@ -7434,13 +7103,8 @@
_methodNameType = methodNameType;
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@override
Expression get realTarget {
@@ -7653,13 +7317,8 @@
_name = _becomeParentOf(identifier as LabelImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => NO_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.none;
+ Precedence get precedence => Precedence.none;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitNamedExpression(this);
@@ -7999,14 +7658,21 @@
/// The 'covariant' keyword, or `null` if the keyword was not used.
Token covariantKeyword;
+ /// The 'required' keyword, or `null` if the keyword was not used.
+ Token requiredKeyword;
+
/// The name of the parameter being declared.
SimpleIdentifierImpl _identifier;
/// Initialize a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute.
- NormalFormalParameterImpl(CommentImpl comment, List<Annotation> metadata,
- this.covariantKeyword, SimpleIdentifierImpl identifier) {
+ NormalFormalParameterImpl(
+ CommentImpl comment,
+ List<Annotation> metadata,
+ this.covariantKeyword,
+ this.requiredKeyword,
+ SimpleIdentifierImpl identifier) {
_comment = _becomeParentOf(comment);
_metadata = new NodeListImpl<Annotation>(this, metadata);
_identifier = _becomeParentOf(identifier);
@@ -8210,13 +7876,8 @@
_expression = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@override
Expression get unParenthesized {
@@ -8410,13 +8071,8 @@
_operand = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@deprecated
@override
@@ -8522,13 +8178,8 @@
@override
String get name => "${_prefix.name}.${_identifier.name}";
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@override
SimpleIdentifier get prefix => _prefix;
@@ -8603,13 +8254,8 @@
_operand = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => PREFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.prefix;
+ Precedence get precedence => Precedence.prefix;
@deprecated
@override
@@ -8690,13 +8336,8 @@
bool get isCascaded =>
operator != null && operator.type == TokenType.PERIOD_PERIOD;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => POSTFIX_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.postfix;
+ Precedence get precedence => Precedence.postfix;
@override
SimpleIdentifier get propertyName => _propertyName;
@@ -8837,13 +8478,8 @@
@override
Token get endToken => rethrowKeyword;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => ASSIGNMENT_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.assignment;
+ Precedence get precedence => Precedence.assignment;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitRethrowExpression(this);
@@ -8934,51 +8570,6 @@
}
}
-/// A literal set.
-///
-/// setLiteral ::=
-/// 'const'? ('<' [TypeAnnotation] '>')?
-/// '{' [CollectionElement] (',' [Expression])* ','? '}'
-/// | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
-///
-/// This is the class that is used to represent a set literal when either the
-/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
-/// If neither of those experiments are enabled, then [SetLiteral] will be used.
-@Deprecated('Replaced by SetOrMapLiteralImpl')
-class SetLiteral2Impl extends SetOrMapLiteralImpl implements SetLiteral2 {
- /// Initialize a newly created set literal. The [constKeyword] can be `null`
- /// if the literal is not a constant. The [typeArguments] can be `null` if no
- /// type arguments were declared. The [elements] can be `null` if the set is
- /// empty.
- SetLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
- Token leftBracket, List<CollectionElement> elements, Token rightBracket)
- : super(constKeyword, typeArguments, leftBracket, elements, rightBracket);
-
- @override
- NodeList<CollectionElement> get elements => _elements;
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitSetLiteral2(this);
-}
-
-@Deprecated('Use SetOrMapLiteralImpl')
-class SetLiteralImpl extends SetOrMapLiteralImpl implements SetLiteral {
- /// Initialize a newly created set literal. The [constKeyword] can be `null`
- /// if the literal is not a constant. The [typeArguments] can be `null` if no
- /// type arguments were declared. The [elements] can be `null` if the set is
- /// empty.
- SetLiteralImpl(Token constKeyword, TypeArgumentListImpl typeArguments,
- Token leftBracket, List<Expression> elements, Token rightBracket)
- : super._set(
- constKeyword, typeArguments, leftBracket, elements, rightBracket);
-
- @override
- NodeList<Expression> get elements => _elements;
-
- @override
- E accept<E>(AstVisitor<E> visitor) => visitor.visitSetLiteral(this);
-}
-
class SetOrMapLiteralImpl extends TypedLiteralImpl implements SetOrMapLiteral {
@override
Token leftBracket;
@@ -9017,30 +8608,6 @@
_resolvedKind = _SetOrMapKind.unresolved;
}
- /// Temporary constructor to support MapLiteral2Impl.
- SetOrMapLiteralImpl._map(
- Token constKeyword,
- TypeArgumentListImpl typeArguments,
- this.leftBracket,
- List<MapLiteralEntry> elements,
- this.rightBracket)
- : super(constKeyword, typeArguments) {
- _elements = new NodeListImpl<MapLiteralEntry>(this, elements);
- _resolvedKind = _SetOrMapKind.map;
- }
-
- /// Temporary constructor to support SetLiteral2Impl.
- SetOrMapLiteralImpl._set(
- Token constKeyword,
- TypeArgumentListImpl typeArguments,
- this.leftBracket,
- List<Expression> elements,
- this.rightBracket)
- : super(constKeyword, typeArguments) {
- _elements = new NodeListImpl<Expression>(this, elements);
- _resolvedKind = _SetOrMapKind.set;
- }
-
@override
Token get beginToken {
if (constKeyword != null) {
@@ -9057,10 +8624,14 @@
// TODO(paulberry): add commas.
Iterable<SyntacticEntity> get childEntities => super._childEntities
..add(leftBracket)
- ..addAll(elements2)
+ ..addAll(elements)
..add(rightBracket);
@override
+ NodeList<CollectionElement> get elements => _elements;
+
+ @override
+ @Deprecated('Replaced by elements')
NodeList<CollectionElement> get elements2 => _elements;
@override
@@ -9159,10 +8730,12 @@
CommentImpl comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
this.keyword,
TypeAnnotationImpl type,
SimpleIdentifierImpl identifier)
- : super(comment, metadata, covariantKeyword, identifier) {
+ : super(
+ comment, metadata, covariantKeyword, requiredKeyword, identifier) {
_type = _becomeParentOf(type);
}
@@ -9274,13 +8847,8 @@
@override
String get name => token.lexeme;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@deprecated
@override
@@ -9344,12 +8912,6 @@
return false;
}
}
- // ignore: deprecated_member_use_from_same_package
- if (parent is ForEachStatement) {
- if (identical(parent.identifier, target)) {
- return false;
- }
- }
if (parent is FieldFormalParameter) {
if (identical(parent.identifier, target)) {
return false;
@@ -9393,9 +8955,6 @@
return identical(parent.leftHandSide, target);
} else if (parent is ForEachPartsWithIdentifier) {
return identical(parent.identifier, target);
- // ignore: deprecated_member_use_from_same_package
- } else if (parent is ForEachStatement) {
- return identical(parent.identifier, target);
}
return false;
}
@@ -9842,13 +9401,8 @@
@override
Token get endToken => superKeyword;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitSuperExpression(this);
@@ -10113,13 +9667,8 @@
@override
Token get endToken => thisKeyword;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitThisExpression(this);
@@ -10169,13 +9718,8 @@
_expression = _becomeParentOf(expression as ExpressionImpl);
}
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => ASSIGNMENT_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.assignment;
+ Precedence get precedence => Precedence.assignment;
@override
E accept<E>(AstVisitor<E> visitor) => visitor.visitThrowExpression(this);
@@ -10857,6 +10401,12 @@
}
@override
+ bool get isLate {
+ AstNode parent = this.parent;
+ return parent is VariableDeclarationList && parent.isLate;
+ }
+
+ @override
SimpleIdentifier get name => _name;
@override
@@ -10882,16 +10432,20 @@
/// (',' [VariableDeclaration])*
///
/// finalConstVarOrType ::=
-/// | 'final' [TypeName]?
-/// | 'const' [TypeName]?
+/// 'final' 'late'? [TypeAnnotation]?
+/// | 'const' [TypeAnnotation]?
/// | 'var'
-/// | [TypeName]
+/// | 'late'? [TypeAnnotation]
class VariableDeclarationListImpl extends AnnotatedNodeImpl
implements VariableDeclarationList {
/// The token representing the 'final', 'const' or 'var' keyword, or `null` if
/// no keyword was included.
Token keyword;
+ /// The token representing the 'late' keyword, or `null` if the late modifier
+ /// was not included.
+ Token lateKeyword;
+
/// The type of the variables being declared, or `null` if no type was
/// provided.
TypeAnnotationImpl _type;
@@ -10906,6 +10460,7 @@
VariableDeclarationListImpl(
CommentImpl comment,
List<Annotation> metadata,
+ this.lateKeyword,
this.keyword,
TypeAnnotationImpl type,
List<VariableDeclaration> variables)
@@ -10941,6 +10496,9 @@
bool get isFinal => keyword?.keyword == Keyword.FINAL;
@override
+ bool get isLate => lateKeyword != null;
+
+ @override
TypeAnnotation get type => _type;
@override
diff --git a/analyzer/lib/src/dart/ast/ast_factory.dart b/analyzer/lib/src/dart/ast/ast_factory.dart
index 3c4ba3e..95b5867 100644
--- a/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -1,7 +1,8 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/ast_factory.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
@@ -178,14 +179,27 @@
new CommentReferenceImpl(newKeyword, identifier);
@override
+ @deprecated
CompilationUnit compilationUnit(
Token beginToken,
ScriptTag scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations,
- Token endToken) =>
- new CompilationUnitImpl(
- beginToken, scriptTag, directives, declarations, endToken);
+ Token endToken,
+ [FeatureSet featureSet]) =>
+ new CompilationUnitImpl(beginToken, scriptTag, directives, declarations,
+ endToken, featureSet);
+
+ @override
+ CompilationUnit compilationUnit2(
+ {Token beginToken,
+ ScriptTag scriptTag,
+ List<Directive> directives,
+ List<CompilationUnitMember> declarations,
+ Token endToken,
+ FeatureSet featureSet}) =>
+ new CompilationUnitImpl(beginToken, scriptTag, directives, declarations,
+ endToken, featureSet);
@override
ConditionalExpression conditionalExpression(
@@ -387,7 +401,7 @@
SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters) =>
- new FieldFormalParameterImpl(comment, metadata, null, keyword, type,
+ new FieldFormalParameterImpl(comment, metadata, null, null, keyword, type,
thisKeyword, period, identifier, typeParameters, parameters);
@override
@@ -395,6 +409,7 @@
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required Token thisKeyword,
@@ -402,8 +417,18 @@
@required SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters}) =>
- new FieldFormalParameterImpl(comment, metadata, covariantKeyword, keyword,
- type, thisKeyword, period, identifier, typeParameters, parameters);
+ new FieldFormalParameterImpl(
+ comment,
+ metadata,
+ covariantKeyword,
+ requiredKeyword,
+ keyword,
+ type,
+ thisKeyword,
+ period,
+ identifier,
+ typeParameters,
+ parameters);
@override
ForEachPartsWithDeclaration forEachPartsWithDeclaration(
@@ -461,27 +486,35 @@
initialization, leftSeparator, condition, rightSeparator, updaters);
@override
- ForStatement2 forStatement2(
+ ForStatement forStatement(
{Token awaitKeyword,
Token forKeyword,
Token leftParenthesis,
ForLoopParts forLoopParts,
Token rightParenthesis,
Statement body}) {
- if (forLoopParts is ForEachParts) {
- // ignore: deprecated_member_use_from_same_package
- return ForEachStatementImpl.withParts(awaitKeyword, forKeyword,
- leftParenthesis, forLoopParts, rightParenthesis, body);
- } else if (forLoopParts is ForParts) {
- // ignore: deprecated_member_use_from_same_package
- return ForStatementImpl.withParts(awaitKeyword, forKeyword,
- leftParenthesis, forLoopParts, rightParenthesis, body);
- } else {
- throw new StateError('Unrecognized for loop parts');
- }
+ return ForStatementImpl(awaitKeyword, forKeyword, leftParenthesis,
+ forLoopParts, rightParenthesis, body);
}
@override
+ @Deprecated('Replaced by forStatement')
+ ForStatement forStatement2(
+ {Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ Statement body}) =>
+ forStatement(
+ awaitKeyword: awaitKeyword,
+ forKeyword: forKeyword,
+ leftParenthesis: leftParenthesis,
+ forLoopParts: forLoopParts,
+ rightParenthesis: rightParenthesis,
+ body: body);
+
+ @override
FunctionDeclaration functionDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -530,20 +563,21 @@
SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters) =>
- new FunctionTypedFormalParameterImpl(comment, metadata, null, returnType,
- identifier, typeParameters, parameters);
+ new FunctionTypedFormalParameterImpl(comment, metadata, null, null,
+ returnType, identifier, typeParameters, parameters);
@override
FunctionTypedFormalParameter functionTypedFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
TypeAnnotation returnType,
@required SimpleIdentifier identifier,
TypeParameterList typeParameters,
@required FormalParameterList parameters}) =>
new FunctionTypedFormalParameterImpl(comment, metadata, covariantKeyword,
- returnType, identifier, typeParameters, parameters);
+ requiredKeyword, returnType, identifier, typeParameters, parameters);
@override
GenericFunctionType genericFunctionType(
@@ -693,39 +727,6 @@
constKeyword, typeArguments, leftBracket, elements, rightBracket);
}
- @Deprecated('Use listLiteral')
- @override
- ListLiteral2 listLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> elements,
- Token rightBracket}) =>
- new ListLiteral2Impl(
- constKeyword, typeArguments, leftBracket, elements, rightBracket);
-
- @override
- @Deprecated('Use setOrMapLiteral')
- MapLiteral mapLiteral(
- Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<MapLiteralEntry> entries,
- Token rightBracket) =>
- new MapLiteralImpl(
- constKeyword, typeArguments, leftBracket, entries, rightBracket);
-
- @deprecated
- @override
- MapLiteral2 mapLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> entries,
- Token rightBracket}) {
- throw new UnsupportedError('Not supported');
- }
-
@override
MapLiteralEntry mapLiteralEntry(
Expression key, Token separator, Expression value) =>
@@ -878,24 +879,6 @@
ScriptTag scriptTag(Token scriptTag) => new ScriptTagImpl(scriptTag);
@override
- @Deprecated('Use setOrMapLiteral')
- SetLiteral setLiteral(Token constKeyword, TypeArgumentList typeArguments,
- Token leftBracket, List<Expression> elements, Token rightBracket) =>
- new SetLiteralImpl(
- constKeyword, typeArguments, leftBracket, elements, rightBracket);
-
- @deprecated
- @override
- SetLiteral2 setLiteral2(
- {Token constKeyword,
- TypeArgumentList typeArguments,
- Token leftBracket,
- List<CollectionElement> elements,
- Token rightBracket}) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
SetOrMapLiteral setOrMapLiteral(
{Token constKeyword,
TypeArgumentList typeArguments,
@@ -918,18 +901,19 @@
TypeAnnotation type,
SimpleIdentifier identifier) =>
new SimpleFormalParameterImpl(
- comment, metadata, null, keyword, type, identifier);
+ comment, metadata, null, null, keyword, type, identifier);
@override
SimpleFormalParameter simpleFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
+ Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required SimpleIdentifier identifier}) =>
- new SimpleFormalParameterImpl(
- comment, metadata, covariantKeyword, keyword, type, identifier);
+ new SimpleFormalParameterImpl(comment, metadata, covariantKeyword,
+ requiredKeyword, keyword, type, identifier);
@override
SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}) {
@@ -1051,7 +1035,19 @@
TypeAnnotation type,
List<VariableDeclaration> variables) =>
new VariableDeclarationListImpl(
- comment, metadata, keyword, type, variables);
+ comment, metadata, null, keyword, type, variables);
+
+ @override
+ VariableDeclarationList variableDeclarationList2(
+ {Comment comment,
+ List<Annotation> metadata,
+ Token lateKeyword,
+ Token keyword,
+ TypeAnnotation type,
+ List<VariableDeclaration> variables}) {
+ return new VariableDeclarationListImpl(
+ comment, metadata, lateKeyword, keyword, type, variables);
+ }
@override
VariableDeclarationStatement variableDeclarationStatement(
diff --git a/analyzer/lib/src/dart/ast/constant_evaluator.dart b/analyzer/lib/src/dart/ast/constant_evaluator.dart
index a919a7f..430631f 100644
--- a/analyzer/lib/src/dart/ast/constant_evaluator.dart
+++ b/analyzer/lib/src/dart/ast/constant_evaluator.dart
@@ -261,7 +261,7 @@
@override
Object visitListLiteral(ListLiteral node) {
List<Object> list = new List<Object>();
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
if (element is Expression) {
Object value = element.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
@@ -278,22 +278,6 @@
}
@override
- @deprecated
- Object visitMapLiteral(MapLiteral node) {
- Map<String, Object> map = new HashMap<String, Object>();
- for (MapLiteralEntry entry in node.entries) {
- Object key = entry.key.accept(this);
- Object value = entry.value.accept(this);
- if (key is String && !identical(value, NOT_A_CONSTANT)) {
- map[key] = value;
- } else {
- return NOT_A_CONSTANT;
- }
- }
- return map;
- }
-
- @override
Object visitMethodInvocation(MethodInvocation node) => visitNode(node);
@override
@@ -348,7 +332,7 @@
// didn't add support for set literals. As a result, this assumes that we're
// looking at a map literal until we prove otherwise.
Map<String, Object> map = new HashMap<String, Object>();
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
if (element is MapLiteralEntry) {
Object key = element.key.accept(this);
Object value = element.value.accept(this);
diff --git a/analyzer/lib/src/dart/ast/resolution_map.dart b/analyzer/lib/src/dart/ast/resolution_map.dart
index 8d59a9e..3fa4ea4 100644
--- a/analyzer/lib/src/dart/ast/resolution_map.dart
+++ b/analyzer/lib/src/dart/ast/resolution_map.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/dart/ast/utilities.dart b/analyzer/lib/src/dart/ast/utilities.dart
index cb913fe..5ac34d1 100644
--- a/analyzer/lib/src/dart/ast/utilities.dart
+++ b/analyzer/lib/src/dart/ast/utilities.dart
@@ -285,12 +285,13 @@
@override
CompilationUnit visitCompilationUnit(CompilationUnit node) {
- CompilationUnit clone = astFactory.compilationUnit(
- cloneToken(node.beginToken),
- cloneNode(node.scriptTag),
- cloneNodeList(node.directives),
- cloneNodeList(node.declarations),
- cloneToken(node.endToken));
+ CompilationUnit clone = astFactory.compilationUnit2(
+ beginToken: cloneToken(node.beginToken),
+ scriptTag: cloneNode(node.scriptTag),
+ directives: cloneNodeList(node.directives),
+ declarations: cloneNodeList(node.declarations),
+ endToken: cloneToken(node.endToken),
+ featureSet: node.featureSet);
clone.lineInfo = node.lineInfo;
return clone;
}
@@ -490,6 +491,7 @@
@override
ForElement visitForElement(ForElement node) => astFactory.forElement(
+ awaitKeyword: cloneToken(node.awaitKeyword),
forKeyword: cloneToken(node.forKeyword),
leftParenthesis: cloneToken(node.leftParenthesis),
forLoopParts: cloneNode(node.forLoopParts),
@@ -526,14 +528,13 @@
updaters: cloneNodeList(node.updaters));
@override
- ForStatement2 visitForStatement2(ForStatement2 node) =>
- astFactory.forStatement2(
- awaitKeyword: cloneToken(node.awaitKeyword),
- forKeyword: cloneToken(node.forKeyword),
- leftParenthesis: cloneToken(node.leftParenthesis),
- forLoopParts: cloneNode(node.forLoopParts),
- rightParenthesis: cloneToken(node.rightParenthesis),
- body: cloneNode(node.body));
+ ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
+ awaitKeyword: cloneToken(node.awaitKeyword),
+ forKeyword: cloneToken(node.forKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ forLoopParts: cloneNode(node.forLoopParts),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ body: cloneNode(node.body));
@override
FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
@@ -729,30 +730,9 @@
cloneToken(node.constKeyword),
cloneNode(node.typeArguments),
cloneToken(node.leftBracket),
- cloneNodeList(node.elements2),
+ cloneNodeList(node.elements),
cloneToken(node.rightBracket));
- @deprecated
- @override
- ListLiteral2 visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
- @deprecated
- MapLiteral visitMapLiteral(MapLiteral node) => astFactory.mapLiteral(
- cloneToken(node.constKeyword),
- cloneNode(node.typeArguments),
- cloneToken(node.leftBracket),
- cloneNodeList(node.entries),
- cloneToken(node.rightBracket));
-
- @deprecated
- @override
- MapLiteral2 visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
astFactory.mapLiteralEntry(cloneNode(node.key),
@@ -888,27 +868,12 @@
astFactory.scriptTag(cloneToken(node.scriptTag));
@override
- @deprecated
- SetLiteral visitSetLiteral(SetLiteral node) => astFactory.setLiteral(
- cloneToken(node.constKeyword),
- cloneNode(node.typeArguments),
- cloneToken(node.leftBracket),
- cloneNodeList(node.elements),
- cloneToken(node.rightBracket));
-
- @deprecated
- @override
- SetLiteral2 visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
SetOrMapLiteral visitSetOrMapLiteral(SetOrMapLiteral node) {
var result = astFactory.setOrMapLiteral(
constKeyword: cloneToken(node.constKeyword),
typeArguments: cloneNode(node.typeArguments),
leftBracket: cloneToken(node.leftBracket),
- elements: cloneNodeList(node.elements2),
+ elements: cloneNodeList(node.elements),
rightBracket: cloneToken(node.rightBracket));
if (node.isMap) {
(result as SetOrMapLiteralImpl).becomeMap();
@@ -1654,7 +1619,8 @@
@override
bool visitForElement(ForElement node) {
ForElement other = _other as ForElement;
- return isEqualTokens(node.forKeyword, other.forKeyword) &&
+ return isEqualTokens(node.awaitKeyword, other.awaitKeyword) &&
+ isEqualTokens(node.forKeyword, other.forKeyword) &&
isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
isEqualNodes(node.forLoopParts, other.forLoopParts) &&
isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
@@ -1692,9 +1658,10 @@
}
@override
- bool visitForStatement2(ForStatement2 node) {
- ForStatement2 other = _other as ForStatement2;
+ bool visitForStatement(ForStatement node) {
+ ForStatement other = _other as ForStatement;
return isEqualTokens(node.forKeyword, other.forKeyword) &&
+ isEqualTokens(node.awaitKeyword, other.awaitKeyword) &&
isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
isEqualNodes(node.forLoopParts, other.forLoopParts) &&
isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
@@ -1921,22 +1888,10 @@
return isEqualTokens(node.constKeyword, other.constKeyword) &&
isEqualNodes(node.typeArguments, other.typeArguments) &&
isEqualTokens(node.leftBracket, other.leftBracket) &&
- _isEqualNodeLists(node.elements2, other.elements2) &&
+ _isEqualNodeLists(node.elements, other.elements) &&
isEqualTokens(node.rightBracket, other.rightBracket);
}
- @deprecated
- @override
- bool visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @deprecated
- @override
- bool visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry other = _other as MapLiteralEntry;
@@ -2114,19 +2069,13 @@
return isEqualTokens(node.scriptTag, other.scriptTag);
}
- @deprecated
- @override
- bool visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
bool visitSetOrMapLiteral(SetOrMapLiteral node) {
SetOrMapLiteral other = _other as SetOrMapLiteral;
return isEqualTokens(node.constKeyword, other.constKeyword) &&
isEqualNodes(node.typeArguments, other.typeArguments) &&
isEqualTokens(node.leftBracket, other.leftBracket) &&
- _isEqualNodeLists(node.elements2, other.elements2) &&
+ _isEqualNodeLists(node.elements, other.elements) &&
isEqualTokens(node.rightBracket, other.rightBracket);
}
@@ -2694,12 +2643,13 @@
@override
CompilationUnit visitCompilationUnit(CompilationUnit node) {
- CompilationUnitImpl copy = astFactory.compilationUnit(
- _mapToken(node.beginToken),
- _cloneNode(node.scriptTag),
- _cloneNodeList(node.directives),
- _cloneNodeList(node.declarations),
- _mapToken(node.endToken));
+ CompilationUnitImpl copy = astFactory.compilationUnit2(
+ beginToken: _mapToken(node.beginToken),
+ scriptTag: _cloneNode(node.scriptTag),
+ directives: _cloneNodeList(node.directives),
+ declarations: _cloneNodeList(node.declarations),
+ endToken: _mapToken(node.endToken),
+ featureSet: node.featureSet);
copy.lineInfo = node.lineInfo;
copy.declaredElement = node.declaredElement;
return copy;
@@ -2908,6 +2858,7 @@
@override
ForElement visitForElement(ForElement node) => astFactory.forElement(
+ awaitKeyword: _mapToken(node.awaitKeyword),
forKeyword: _mapToken(node.forKeyword),
leftParenthesis: _mapToken(node.leftParenthesis),
forLoopParts: _cloneNode(node.forLoopParts),
@@ -2944,13 +2895,13 @@
updaters: _cloneNodeList(node.updaters));
@override
- ForStatement2 visitForStatement2(ForStatement2 node) =>
- astFactory.forStatement2(
- forKeyword: _mapToken(node.forKeyword),
- leftParenthesis: _mapToken(node.leftParenthesis),
- forLoopParts: _cloneNode(node.forLoopParts),
- rightParenthesis: _mapToken(node.rightParenthesis),
- body: _cloneNode(node.body));
+ ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
+ awaitKeyword: _mapToken(node.awaitKeyword),
+ forKeyword: _mapToken(node.forKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ forLoopParts: _cloneNode(node.forLoopParts),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ body: _cloneNode(node.body));
@override
FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
@@ -3183,39 +3134,13 @@
_mapToken(node.constKeyword),
_cloneNode(node.typeArguments),
_mapToken(node.leftBracket),
- _cloneNodeList(node.elements2),
+ _cloneNodeList(node.elements),
_mapToken(node.rightBracket));
copy.staticType = node.staticType;
return copy;
}
@override
- ListLiteral2 visitListLiteral2(ListLiteral2 node) => astFactory.listLiteral2(
- constKeyword: _mapToken(node.constKeyword),
- typeArguments: _cloneNode(node.typeArguments),
- leftBracket: _mapToken(node.leftBracket),
- elements: _cloneNodeList(node.elements),
- rightBracket: _mapToken(node.rightBracket));
-
- @override
- MapLiteral visitMapLiteral(MapLiteral node) {
- MapLiteral copy = astFactory.mapLiteral(
- _mapToken(node.constKeyword),
- _cloneNode(node.typeArguments),
- _mapToken(node.leftBracket),
- _cloneNodeList(node.entries),
- _mapToken(node.rightBracket));
- copy.staticType = node.staticType;
- return copy;
- }
-
- @deprecated
- @override
- MapLiteral2 visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
astFactory.mapLiteralEntry(_cloneNode(node.key),
_mapToken(node.separator), _cloneNode(node.value));
@@ -3393,30 +3318,12 @@
astFactory.scriptTag(_mapToken(node.scriptTag));
@override
- SetLiteral visitSetLiteral(SetLiteral node) {
- SetLiteral copy = astFactory.setLiteral(
- _mapToken(node.constKeyword),
- _cloneNode(node.typeArguments),
- _mapToken(node.leftBracket),
- _cloneNodeList(node.elements),
- _mapToken(node.rightBracket));
- copy.staticType = node.staticType;
- return copy;
- }
-
- @deprecated
- @override
- SetLiteral2 visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
SetOrMapLiteral visitSetOrMapLiteral(SetOrMapLiteral node) {
SetOrMapLiteral copy = astFactory.setOrMapLiteral(
constKeyword: _mapToken(node.constKeyword),
typeArguments: _cloneNode(node.typeArguments),
leftBracket: _mapToken(node.leftBracket),
- elements: _cloneNodeList(node.elements2),
+ elements: _cloneNodeList(node.elements),
rightBracket: _mapToken(node.rightBracket));
copy.staticType = node.staticType;
return copy;
@@ -4423,12 +4330,12 @@
}
@override
- bool visitForStatement2(ForStatement2 node) {
+ bool visitForStatement(ForStatement node) {
if (identical(node.forLoopParts, _oldNode)) {
- (node as ForStatement2Impl).forLoopParts = _newNode as ForLoopParts;
+ (node as ForStatementImpl).forLoopParts = _newNode as ForLoopParts;
return true;
} else if (identical(node.body, _oldNode)) {
- (node as ForStatement2Impl).body = _newNode as Statement;
+ (node as ForStatementImpl).body = _newNode as Statement;
return true;
}
return visitNode(node);
@@ -4689,24 +4596,12 @@
@override
bool visitListLiteral(ListLiteral node) {
- if (_replaceInList(node.elements2)) {
+ if (_replaceInList(node.elements)) {
return true;
}
return visitTypedLiteral(node);
}
- @deprecated
- @override
- bool visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @deprecated
- @override
- bool visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
if (identical(node.key, _oldNode)) {
@@ -4935,15 +4830,9 @@
@override
bool visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
- @deprecated
- @override
- bool visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
bool visitSetOrMapLiteral(SetOrMapLiteral node) {
- if (_replaceInList(node.elements2)) {
+ if (_replaceInList(node.elements)) {
return true;
}
return visitTypedLiteral(node);
@@ -5740,24 +5629,10 @@
}
@override
- @deprecated
- bool visitForEachStatement(ForEachStatement node) {
- ForEachStatement toNode = this._toNode as ForEachStatement;
- return _and(
- _isEqualTokens(node.forKeyword, toNode.forKeyword),
- _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
- _isEqualNodes(node.loopVariable, toNode.loopVariable),
- _isEqualNodes(node.identifier, toNode.identifier),
- _isEqualTokens(node.inKeyword, toNode.inKeyword),
- _isEqualNodes(node.iterable, toNode.iterable),
- _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
- _isEqualNodes(node.body, toNode.body));
- }
-
- @override
bool visitForElement(ForElement node) {
ForElement toNode = this._toNode as ForElement;
return _and(
+ _isEqualTokens(node.awaitKeyword, toNode.awaitKeyword),
_isEqualTokens(node.forKeyword, toNode.forKeyword),
_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
_isEqualNodes(node.forLoopParts, toNode.forLoopParts),
@@ -5799,26 +5674,10 @@
}
@override
- @deprecated
bool visitForStatement(ForStatement node) {
ForStatement toNode = this._toNode as ForStatement;
return _and(
- _isEqualTokens(node.forKeyword, toNode.forKeyword),
- _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
- _isEqualNodes(node.variables, toNode.variables),
- _isEqualNodes(node.initialization, toNode.initialization),
- _isEqualTokens(node.leftSeparator, toNode.leftSeparator),
- _isEqualNodes(node.condition, toNode.condition),
- _isEqualTokens(node.rightSeparator, toNode.rightSeparator),
- _isEqualNodeLists(node.updaters, toNode.updaters),
- _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
- _isEqualNodes(node.body, toNode.body));
- }
-
- @override
- bool visitForStatement2(ForStatement2 node) {
- ForStatement2 toNode = this._toNode as ForStatement2;
- return _and(
+ _isEqualTokens(node.awaitKeyword, toNode.awaitKeyword),
_isEqualTokens(node.forKeyword, toNode.forKeyword),
_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
_isEqualNodes(node.forLoopParts, toNode.forLoopParts),
@@ -6109,7 +5968,7 @@
_isEqualTokens(node.constKeyword, toNode.constKeyword),
_isEqualNodes(node.typeArguments, toNode.typeArguments),
_isEqualTokens(node.leftBracket, toNode.leftBracket),
- _isEqualNodeLists(node.elements2, toNode.elements2),
+ _isEqualNodeLists(node.elements, toNode.elements),
_isEqualTokens(node.rightBracket, toNode.rightBracket))) {
toNode.staticType = node.staticType;
return true;
@@ -6117,34 +5976,6 @@
return false;
}
- @deprecated
- @override
- bool visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
- @deprecated
- bool visitMapLiteral(MapLiteral node) {
- MapLiteral toNode = this._toNode as MapLiteral;
- if (_and(
- _isEqualTokens(node.constKeyword, toNode.constKeyword),
- _isEqualNodes(node.typeArguments, toNode.typeArguments),
- _isEqualTokens(node.leftBracket, toNode.leftBracket),
- _isEqualNodeLists(node.entries, toNode.entries),
- _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
- toNode.staticType = node.staticType;
- return true;
- }
- return false;
- }
-
- @deprecated
- @override
- bool visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry toNode = this._toNode as MapLiteralEntry;
@@ -6384,35 +6215,13 @@
}
@override
- @deprecated
- bool visitSetLiteral(SetLiteral node) {
- SetLiteral toNode = this._toNode as SetLiteral;
- if (_and(
- _isEqualTokens(node.constKeyword, toNode.constKeyword),
- _isEqualNodes(node.typeArguments, toNode.typeArguments),
- _isEqualTokens(node.leftBracket, toNode.leftBracket),
- _isEqualNodeLists(node.elements, toNode.elements),
- _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
- toNode.staticType = node.staticType;
- return true;
- }
- return false;
- }
-
- @deprecated
- @override
- bool visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @override
bool visitSetOrMapLiteral(SetOrMapLiteral node) {
SetOrMapLiteral toNode = this._toNode as SetOrMapLiteral;
if (_and(
_isEqualTokens(node.constKeyword, toNode.constKeyword),
_isEqualNodes(node.typeArguments, toNode.typeArguments),
_isEqualTokens(node.leftBracket, toNode.leftBracket),
- _isEqualNodeLists(node.elements2, toNode.elements2),
+ _isEqualNodeLists(node.elements, toNode.elements),
_isEqualTokens(node.rightBracket, toNode.rightBracket))) {
toNode.staticType = node.staticType;
return true;
@@ -6880,31 +6689,12 @@
}
@override
- @deprecated
- void visitForEachStatement(ForEachStatement node) {
- DeclaredIdentifier loopVariable = node.loopVariable;
- if (loopVariable != null) {
- _addToScope(loopVariable.identifier);
- }
- super.visitForEachStatement(node);
- }
-
- @override
void visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
_addVariables(node.variables.variables);
super.visitForPartsWithDeclarations(node);
}
@override
- @deprecated
- void visitForStatement(ForStatement node) {
- if (!identical(_immediateChild, node.variables) && node.variables != null) {
- _addVariables(node.variables.variables);
- }
- super.visitForStatement(node);
- }
-
- @override
void visitFunctionDeclaration(FunctionDeclaration node) {
if (node.parent is! FunctionDeclarationStatement) {
_declarationNode = node;
@@ -7271,6 +7061,9 @@
@override
void visitDefaultFormalParameter(DefaultFormalParameter node) {
+ if (node.isRequiredNamed) {
+ _writer.print('required ');
+ }
_visitNode(node.parameter);
if (node.separator != null) {
if (node.separator.lexeme != ":") {
@@ -7451,7 +7244,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement(ForStatement node) {
if (node.awaitKeyword != null) {
_writer.print('await ');
}
@@ -7660,22 +7453,10 @@
_visitTokenWithSuffix(node.constKeyword, ' ');
_visitNode(node.typeArguments);
_writer.print('[');
- _visitNodeListWithSeparator(node.elements2, ', ');
+ _visitNodeListWithSeparator(node.elements, ', ');
_writer.print(']');
}
- @deprecated
- @override
- void visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @deprecated
- @override
- void visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
void visitMapLiteralEntry(MapLiteralEntry node) {
_visitNode(node.key);
@@ -7840,12 +7621,6 @@
_writer.print(node.scriptTag.lexeme);
}
- @deprecated
- @override
- void visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
void visitSetOrMapLiteral(SetOrMapLiteral node) {
if (node.constKeyword != null) {
@@ -7854,7 +7629,7 @@
}
_visitNode(node.typeArguments);
_writer.print('{');
- _visitNodeListWithSeparator(node.elements2, ', ');
+ _visitNodeListWithSeparator(node.elements, ', ');
_writer.print('}');
}
@@ -8010,6 +7785,7 @@
@override
void visitVariableDeclarationList(VariableDeclarationList node) {
_visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
+ _visitTokenWithSuffix(node.lateKeyword, " ");
_visitTokenWithSuffix(node.keyword, " ");
_visitNodeWithSuffix(node.type, " ");
_visitNodeListWithSeparator(node.variables, ", ");
@@ -8223,7 +7999,12 @@
if (i > 0) {
sink.write(separator);
}
- nodes[i].accept(this);
+ var node = nodes[i];
+ if (node != null) {
+ node.accept(this);
+ } else {
+ sink.write('<null>');
+ }
}
}
}
@@ -8545,6 +8326,9 @@
@override
void visitDefaultFormalParameter(DefaultFormalParameter node) {
+ if (node.isRequiredNamed) {
+ sink.write('required ');
+ }
safelyVisitNode(node.parameter);
if (node.separator != null) {
if (node.separator.lexeme != ":") {
@@ -8725,7 +8509,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement(ForStatement node) {
if (node.awaitKeyword != null) {
sink.write('await ');
}
@@ -8934,22 +8718,10 @@
safelyVisitTokenWithSuffix(node.constKeyword, ' ');
safelyVisitNode(node.typeArguments);
sink.write('[');
- safelyVisitNodeListWithSeparator(node.elements2, ', ');
+ safelyVisitNodeListWithSeparator(node.elements, ', ');
sink.write(']');
}
- @deprecated
- @override
- void visitListLiteral2(ListLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
- @deprecated
- @override
- void visitMapLiteral2(MapLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
void visitMapLiteralEntry(MapLiteralEntry node) {
safelyVisitNode(node.key);
@@ -9114,18 +8886,12 @@
sink.write(node.scriptTag.lexeme);
}
- @deprecated
- @override
- void visitSetLiteral2(SetLiteral2 node) {
- throw new UnsupportedError('Not supported');
- }
-
@override
void visitSetOrMapLiteral(SetOrMapLiteral node) {
safelyVisitTokenWithSuffix(node.constKeyword, ' ');
safelyVisitNode(node.typeArguments);
sink.write('{');
- safelyVisitNodeListWithSeparator(node.elements2, ', ');
+ safelyVisitNodeListWithSeparator(node.elements, ', ');
sink.write('}');
}
@@ -9281,6 +9047,7 @@
@override
void visitVariableDeclarationList(VariableDeclarationList node) {
safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
+ safelyVisitTokenWithSuffix(node.lateKeyword, " ");
safelyVisitTokenWithSuffix(node.keyword, " ");
safelyVisitNodeWithSuffix(node.type, " ");
safelyVisitNodeListWithSeparator(node.variables, ", ");
@@ -9319,7 +9086,7 @@
void _writeOperand(Expression node, Expression operand) {
if (operand != null) {
- bool needsParenthesis = operand.precedence2 < node.precedence2;
+ bool needsParenthesis = operand.precedence < node.precedence;
if (needsParenthesis) {
sink.write('(');
}
@@ -9331,44 +9098,12 @@
}
}
-/// Mixin allowing visitor classes to forward visit methods for AST structures
-/// that will be deleted as part of the implementation of the "UI as code"
-/// feature.
-///
-/// We will be removing the classes `ForEachStatement`, `ForStatement`,
-/// `MapLiteral`, and `SetLiteral` as part of implementing the "UI as code"
-/// feature. In order to allow this change to be rolled out to clients in a
-/// staged fashion, we first update each visitor so that it forwards the old
-/// visit methods to their new counterparts; this will allow clients to begin
-/// rewriting their visitors in terms of the new data structures now.
-///
-/// This mixin exists so that we don't have to duplicate the forwarding logic in
-/// every concrete visitor class.
-///
-/// This class will be removed when the above classes (and their corresponding
-/// visit methods) are removed.
+/// Mixin allowing visitor classes to forward the visit method for
+/// `ForStatement2` to `ForStatement`
mixin UIAsCodeVisitorMixin<R> implements AstVisitor<R> {
@override
@deprecated
- R visitForEachStatement(ForEachStatement node) {
- return visitForStatement2(node);
- }
-
- @override
- @deprecated
- R visitForStatement(ForStatement node) {
- return visitForStatement2(node);
- }
-
- @override
- @deprecated
- R visitMapLiteral(MapLiteral node) {
- return visitSetOrMapLiteral(node);
- }
-
- @override
- @deprecated
- R visitSetLiteral(SetLiteral node) {
- return visitSetOrMapLiteral(node);
+ R visitForStatement2(ForStatement2 node) {
+ return visitForStatement(node);
}
}
diff --git a/analyzer/lib/src/dart/constant/constant_verifier.dart b/analyzer/lib/src/dart/constant/constant_verifier.dart
index e6281f5..55e3ef0 100644
--- a/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
@@ -13,6 +14,7 @@
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/constant/evaluation.dart';
+import 'package:analyzer/src/dart/constant/potentially_constant.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -30,49 +32,54 @@
/// The type provider used to access the known types.
final TypeProvider _typeProvider;
- /// The type system in use.
- final TypeSystem _typeSystem;
-
/// The set of variables declared using '-D' on the command line.
final DeclaredVariables declaredVariables;
- /// The type representing the type 'bool'.
- InterfaceType _boolType;
-
/// The type representing the type 'int'.
- InterfaceType _intType;
-
- /// The type representing the type 'num'.
- InterfaceType _numType;
-
- /// The type representing the type 'string'.
- InterfaceType _stringType;
+ final InterfaceType _intType;
/// The current library that is being analyzed.
final LibraryElement _currentLibrary;
- ConstantEvaluationEngine _evaluationEngine;
+ final bool _constantUpdate2018Enabled;
+
+ final ConstantEvaluationEngine _evaluationEngine;
/// Initialize a newly created constant verifier.
///
/// @param errorReporter the error reporter by which errors will be reported
- ConstantVerifier(this._errorReporter, LibraryElement currentLibrary,
- this._typeProvider, this.declaredVariables,
- {bool forAnalysisDriver: false})
- : _currentLibrary = currentLibrary,
- _typeSystem = currentLibrary.context.typeSystem {
- this._boolType = _typeProvider.boolType;
- this._intType = _typeProvider.intType;
- this._numType = _typeProvider.numType;
- this._stringType = _typeProvider.stringType;
- this._evaluationEngine = new ConstantEvaluationEngine(
- _typeProvider, declaredVariables,
- forAnalysisDriver: forAnalysisDriver,
- typeSystem: _typeSystem,
- experimentStatus:
- (currentLibrary.context.analysisOptions as AnalysisOptionsImpl)
- .experimentStatus);
- }
+ ///
+ /// TODO(paulberry): make [featureSet] a required parameter.
+ ConstantVerifier(ErrorReporter errorReporter, LibraryElement currentLibrary,
+ TypeProvider typeProvider, DeclaredVariables declaredVariables,
+ {bool forAnalysisDriver: false, FeatureSet featureSet})
+ : this._(
+ errorReporter,
+ currentLibrary,
+ typeProvider,
+ declaredVariables,
+ forAnalysisDriver,
+ currentLibrary.context.typeSystem,
+ featureSet ??
+ (currentLibrary.context.analysisOptions as AnalysisOptionsImpl)
+ .contextFeatures);
+
+ ConstantVerifier._(
+ this._errorReporter,
+ this._currentLibrary,
+ this._typeProvider,
+ this.declaredVariables,
+ bool forAnalysisDriver,
+ TypeSystem typeSystem,
+ FeatureSet featureSet)
+ : _constantUpdate2018Enabled =
+ featureSet.isEnabled(Feature.constant_update_2018),
+ _intType = _typeProvider.intType,
+ _evaluationEngine = new ConstantEvaluationEngine(
+ _typeProvider, declaredVariables,
+ forAnalysisDriver: forAnalysisDriver,
+ typeSystem: typeSystem,
+ experimentStatus: featureSet);
@override
void visitAnnotation(Annotation node) {
@@ -146,12 +153,11 @@
DartType elementType = nodeType.typeArguments[0];
var verifier = _ConstLiteralVerifier(
this,
- isConst: true,
errorCode: CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT,
forList: true,
listElementType: elementType,
);
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
verifier.verify(element);
}
}
@@ -166,56 +172,55 @@
@override
void visitSetOrMapLiteral(SetOrMapLiteral node) {
super.visitSetOrMapLiteral(node);
- bool isConst = node.isConst;
if (node.isSet) {
- if (isConst) {
+ if (node.isConst) {
InterfaceType nodeType = node.staticType;
var elementType = nodeType.typeArguments[0];
var duplicateElements = <Expression>[];
var verifier = _ConstLiteralVerifier(
this,
- isConst: isConst,
errorCode: CompileTimeErrorCode.NON_CONSTANT_SET_ELEMENT,
forSet: true,
setElementType: elementType,
setUniqueValues: Set<DartObject>(),
- setDuplicateElements: duplicateElements,
+ setDuplicateExpressions: duplicateElements,
);
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
verifier.verify(element);
}
for (var duplicateElement in duplicateElements) {
_errorReporter.reportErrorForNode(
- StaticWarningCode.EQUAL_VALUES_IN_CONST_SET,
+ CompileTimeErrorCode.EQUAL_ELEMENTS_IN_CONST_SET,
duplicateElement,
);
}
}
} else if (node.isMap) {
- InterfaceType nodeType = node.staticType;
- var keyType = nodeType.typeArguments[0];
- var valueType = nodeType.typeArguments[1];
- bool reportEqualKeys = true;
- var duplicateKeyElements = <Expression>[];
- var verifier = _ConstLiteralVerifier(
- this,
- isConst: isConst,
- errorCode: CompileTimeErrorCode.NON_CONSTANT_MAP_ELEMENT,
- forMap: true,
- mapKeyType: keyType,
- mapValueType: valueType,
- mapUniqueKeys: Set<DartObject>(),
- mapDuplicateKeyElements: duplicateKeyElements,
- );
- for (CollectionElement entry in node.elements2) {
- verifier.verify(entry);
- }
- if (reportEqualKeys) {
- for (var duplicateKeyElement in duplicateKeyElements) {
- _errorReporter.reportErrorForNode(
- StaticWarningCode.EQUAL_KEYS_IN_MAP,
- duplicateKeyElement,
- );
+ if (node.isConst) {
+ InterfaceType nodeType = node.staticType;
+ var keyType = nodeType.typeArguments[0];
+ var valueType = nodeType.typeArguments[1];
+ bool reportEqualKeys = true;
+ var duplicateKeyElements = <Expression>[];
+ var verifier = _ConstLiteralVerifier(
+ this,
+ errorCode: CompileTimeErrorCode.NON_CONSTANT_MAP_ELEMENT,
+ forMap: true,
+ mapKeyType: keyType,
+ mapValueType: valueType,
+ mapUniqueKeys: Set<DartObject>(),
+ mapDuplicateKeyExpressions: duplicateKeyElements,
+ );
+ for (CollectionElement entry in node.elements) {
+ verifier.verify(entry);
+ }
+ if (reportEqualKeys) {
+ for (var duplicateKeyElement in duplicateKeyElements) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.EQUAL_KEYS_IN_CONST_MAP,
+ duplicateKeyElement,
+ );
+ }
}
}
}
@@ -416,6 +421,29 @@
}
}
+ void _reportNotPotentialConstants(AstNode node) {
+ var notPotentiallyConstants = getNotPotentiallyConstants(node);
+ if (notPotentiallyConstants.isEmpty) return;
+
+ for (var notConst in notPotentiallyConstants) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_CONSTANT,
+ notConst,
+ );
+ }
+ }
+
+ /// Validates that all arguments in the [argumentList] are potentially
+ /// constant expressions.
+ void _reportNotPotentialConstantsArguments(ArgumentList argumentList) {
+ if (argumentList == null) {
+ return;
+ }
+ for (Expression argument in argumentList.arguments) {
+ _reportNotPotentialConstants(argument);
+ }
+ }
+
/// Validate that the given expression is a compile time constant. Return the
/// value of the compile time constant, or `null` if the expression is not a
/// compile time constant.
@@ -449,26 +477,20 @@
/// Validates that the expressions of the initializers of the given constant
/// [constructor] are all compile time constants.
void _validateConstructorInitializers(ConstructorDeclaration constructor) {
- List<ParameterElement> parameterElements =
- constructor.parameters.parameterElements;
NodeList<ConstructorInitializer> initializers = constructor.initializers;
for (ConstructorInitializer initializer in initializers) {
if (initializer is AssertInitializer) {
- _validateInitializerExpression(
- parameterElements, initializer.condition);
+ _reportNotPotentialConstants(initializer.condition);
Expression message = initializer.message;
if (message != null) {
- _validateInitializerExpression(parameterElements, message);
+ _reportNotPotentialConstants(message);
}
} else if (initializer is ConstructorFieldInitializer) {
- _validateInitializerExpression(
- parameterElements, initializer.expression);
+ _reportNotPotentialConstants(initializer.expression);
} else if (initializer is RedirectingConstructorInvocation) {
- _validateInitializerInvocationArguments(
- parameterElements, initializer.argumentList);
+ _reportNotPotentialConstantsArguments(initializer.argumentList);
} else if (initializer is SuperConstructorInvocation) {
- _validateInitializerInvocationArguments(
- parameterElements, initializer.argumentList);
+ _reportNotPotentialConstantsArguments(initializer.argumentList);
}
}
}
@@ -541,149 +563,61 @@
}
}
}
-
- /// Validates that the given expression is a compile time constant.
- ///
- /// @param parameterElements the elements of parameters of constant
- /// constructor, they are considered as a valid potentially constant
- /// expressions
- /// @param expression the expression to validate
- void _validateInitializerExpression(
- List<ParameterElement> parameterElements, Expression expression) {
- RecordingErrorListener errorListener = new RecordingErrorListener();
- ErrorReporter subErrorReporter =
- new ErrorReporter(errorListener, _errorReporter.source);
- DartObjectImpl result = expression.accept(
- new _ConstantVerifier_validateInitializerExpression(_typeSystem,
- _evaluationEngine, subErrorReporter, this, parameterElements));
- _reportErrors(errorListener.errors,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER);
- if (result != null) {
- _reportErrorIfFromDeferredLibrary(
- expression,
- CompileTimeErrorCode
- .NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
- }
- }
-
- /// Validates that all of the arguments of a constructor initializer are
- /// compile time constants.
- ///
- /// @param parameterElements the elements of parameters of constant
- /// constructor, they are considered as a valid potentially constant
- /// expressions
- /// @param argumentList the argument list to validate
- void _validateInitializerInvocationArguments(
- List<ParameterElement> parameterElements, ArgumentList argumentList) {
- if (argumentList == null) {
- return;
- }
- for (Expression argument in argumentList.arguments) {
- _validateInitializerExpression(parameterElements, argument);
- }
- }
-}
-
-class _ConstantVerifier_validateInitializerExpression extends ConstantVisitor {
- final TypeSystem typeSystem;
- final ConstantVerifier verifier;
-
- List<ParameterElement> parameterElements;
-
- _ConstantVerifier_validateInitializerExpression(
- this.typeSystem,
- ConstantEvaluationEngine evaluationEngine,
- ErrorReporter errorReporter,
- this.verifier,
- this.parameterElements)
- : super(evaluationEngine, errorReporter);
-
- @override
- DartObjectImpl visitSimpleIdentifier(SimpleIdentifier node) {
- Element element = node.staticElement;
- int length = parameterElements.length;
- for (int i = 0; i < length; i++) {
- ParameterElement parameterElement = parameterElements[i];
- if (identical(parameterElement, element) && parameterElement != null) {
- DartType type = parameterElement.type;
- if (type != null) {
- if (type.isDynamic) {
- return new DartObjectImpl(
- verifier._typeProvider.objectType, DynamicState.DYNAMIC_STATE);
- } else if (typeSystem.isSubtypeOf(type, verifier._boolType)) {
- return new DartObjectImpl(
- verifier._typeProvider.boolType, BoolState.UNKNOWN_VALUE);
- } else if (typeSystem.isSubtypeOf(
- type, verifier._typeProvider.doubleType)) {
- return new DartObjectImpl(
- verifier._typeProvider.doubleType, DoubleState.UNKNOWN_VALUE);
- } else if (typeSystem.isSubtypeOf(type, verifier._intType)) {
- return new DartObjectImpl(
- verifier._typeProvider.intType, IntState.UNKNOWN_VALUE);
- } else if (typeSystem.isSubtypeOf(type, verifier._numType)) {
- return new DartObjectImpl(
- verifier._typeProvider.numType, NumState.UNKNOWN_VALUE);
- } else if (typeSystem.isSubtypeOf(type, verifier._stringType)) {
- return new DartObjectImpl(
- verifier._typeProvider.stringType, StringState.UNKNOWN_VALUE);
- }
- //
- // We don't test for other types of objects (such as List, Map,
- // Function or Type) because there are no operations allowed on such
- // types other than '==' and '!=', which means that we don't need to
- // know the type when there is no specific data about the state of
- // such objects.
- //
- }
- return new DartObjectImpl(
- type is InterfaceType ? type : verifier._typeProvider.objectType,
- GenericState.UNKNOWN_VALUE);
- }
- }
- return super.visitSimpleIdentifier(node);
- }
}
class _ConstLiteralVerifier {
final ConstantVerifier verifier;
- final bool isConst;
final Set<DartObject> mapUniqueKeys;
- final List<Expression> mapDuplicateKeyElements;
+ final List<Expression> mapDuplicateKeyExpressions;
final ErrorCode errorCode;
final DartType listElementType;
final DartType mapKeyType;
final DartType mapValueType;
final DartType setElementType;
final Set<DartObject> setUniqueValues;
- final List<CollectionElement> setDuplicateElements;
+ final List<CollectionElement> setDuplicateExpressions;
final bool forList;
final bool forMap;
final bool forSet;
_ConstLiteralVerifier(
this.verifier, {
- this.isConst,
this.mapUniqueKeys,
- this.mapDuplicateKeyElements,
+ this.mapDuplicateKeyExpressions,
this.errorCode,
this.listElementType,
this.mapKeyType,
this.mapValueType,
this.setElementType,
this.setUniqueValues,
- this.setDuplicateElements,
+ this.setDuplicateExpressions,
this.forList = false,
this.forMap = false,
this.forSet = false,
});
+ ErrorCode get _fromDeferredErrorCode {
+ if (forList) {
+ return CompileTimeErrorCode
+ .NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY;
+ } else if (forSet) {
+ return CompileTimeErrorCode
+ .NON_CONSTANT_SET_ELEMENT_FROM_DEFERRED_LIBRARY;
+ }
+
+ return null;
+ }
+
bool verify(CollectionElement element) {
if (element is Expression) {
- if (!isConst) return true;
-
var value = verifier._validate(element, errorCode);
if (value == null) return false;
+ if (_fromDeferredErrorCode != null) {
+ verifier._reportErrorIfFromDeferredLibrary(
+ element, _fromDeferredErrorCode);
+ }
+
if (forList) {
return _validateListExpression(element, value);
}
@@ -694,36 +628,54 @@
return true;
} else if (element is ForElement) {
- if (!isConst) return true;
-
verifier._errorReporter.reportErrorForNode(errorCode, element);
return false;
} else if (element is IfElement) {
- if (!isConst) return true;
-
+ if (!verifier._constantUpdate2018Enabled) {
+ verifier._errorReporter.reportErrorForNode(errorCode, element);
+ return false;
+ }
var conditionValue = verifier._validate(element.condition, errorCode);
var conditionBool = conditionValue?.toBoolValue();
// The errors have already been reported.
if (conditionBool == null) return false;
- var thenValid = !conditionBool || verify(element.thenElement);
+ verifier._reportErrorIfFromDeferredLibrary(
+ element.condition,
+ CompileTimeErrorCode
+ .NON_CONSTANT_IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY);
- var elseValid = conditionBool ||
- element.elseElement == null ||
- verify(element.elseElement);
-
- // TODO(scheglov) Check that not taken branches are constants
+ var thenValid = true;
+ var elseValid = true;
+ if (conditionBool) {
+ thenValid = verify(element.thenElement);
+ if (element.elseElement != null) {
+ elseValid = _reportNotPotentialConstants(element.elseElement);
+ }
+ } else {
+ thenValid = _reportNotPotentialConstants(element.thenElement);
+ if (element.elseElement != null) {
+ elseValid = verify(element.elseElement);
+ }
+ }
return thenValid && elseValid;
} else if (element is MapLiteralEntry) {
return _validateMapLiteralEntry(element);
} else if (element is SpreadElement) {
- if (!isConst) return true;
-
+ if (!verifier._constantUpdate2018Enabled) {
+ verifier._errorReporter.reportErrorForNode(errorCode, element);
+ return false;
+ }
var value = verifier._validate(element.expression, errorCode);
if (value == null) return false;
+ verifier._reportErrorIfFromDeferredLibrary(
+ element.expression,
+ CompileTimeErrorCode
+ .NON_CONSTANT_SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY);
+
if (forList || forSet) {
return _validateListOrSetSpread(element, value);
}
@@ -739,6 +691,36 @@
);
}
+ /// Return `true` if the [node] is a potential constant.
+ bool _reportNotPotentialConstants(AstNode node) {
+ var notPotentiallyConstants = getNotPotentiallyConstants(node);
+ if (notPotentiallyConstants.isEmpty) return true;
+
+ for (var notConst in notPotentiallyConstants) {
+ CompileTimeErrorCode errorCode;
+ if (forList) {
+ errorCode = CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT;
+ } else if (forMap) {
+ errorCode = CompileTimeErrorCode.NON_CONSTANT_MAP_ELEMENT;
+ for (var parent = notConst; parent != null; parent = parent.parent) {
+ if (parent is MapLiteralEntry) {
+ if (parent.key == notConst) {
+ errorCode = CompileTimeErrorCode.NON_CONSTANT_MAP_KEY;
+ } else {
+ errorCode = CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE;
+ }
+ break;
+ }
+ }
+ } else if (forSet) {
+ errorCode = CompileTimeErrorCode.NON_CONSTANT_SET_ELEMENT;
+ }
+ verifier._errorReporter.reportErrorForNode(errorCode, notConst);
+ }
+
+ return false;
+ }
+
bool _validateListExpression(Expression expression, DartObjectImpl value) {
if (!verifier._evaluationEngine.runtimeTypeMatch(value, listElementType)) {
verifier._errorReporter.reportErrorForNode(
@@ -784,6 +766,15 @@
}
}
+ if (forSet) {
+ var iterableValue = listValue ?? setValue;
+ for (var item in iterableValue) {
+ if (!setUniqueValues.add(item)) {
+ setDuplicateExpressions.add(element.expression);
+ }
+ }
+ }
+
return true;
}
@@ -793,95 +784,87 @@
var keyExpression = entry.key;
var valueExpression = entry.value;
- if (isConst) {
- var keyValue = verifier._validate(
- keyExpression,
- CompileTimeErrorCode.NON_CONSTANT_MAP_KEY,
- );
+ var keyValue = verifier._validate(
+ keyExpression,
+ CompileTimeErrorCode.NON_CONSTANT_MAP_KEY,
+ );
+ var valueValue = verifier._validate(
+ valueExpression,
+ CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE,
+ );
- var valueValue = verifier._validate(
- valueExpression,
- CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE,
- );
+ if (keyValue != null) {
+ var keyType = keyValue.type;
- if (keyValue != null) {
- var keyType = keyValue.type;
-
- if (!verifier._evaluationEngine
- .runtimeTypeMatch(keyValue, mapKeyType)) {
- verifier._errorReporter.reportErrorForNode(
- StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
- keyExpression,
- [keyType, mapKeyType],
- );
- }
-
- if (verifier._implementsEqualsWhenNotAllowed(keyType)) {
- verifier._errorReporter.reportErrorForNode(
- CompileTimeErrorCode
- .CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
- keyExpression,
- [keyType],
- );
- }
-
- verifier._reportErrorIfFromDeferredLibrary(
+ if (!verifier._evaluationEngine.runtimeTypeMatch(keyValue, mapKeyType)) {
+ verifier._errorReporter.reportErrorForNode(
+ StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
keyExpression,
- CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY,
- );
-
- if (!mapUniqueKeys.add(keyValue)) {
- mapDuplicateKeyElements.add(keyExpression);
- }
- }
-
- if (valueValue != null) {
- if (!verifier._evaluationEngine
- .runtimeTypeMatch(valueValue, mapValueType)) {
- verifier._errorReporter.reportErrorForNode(
- StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
- valueExpression,
- [valueValue.type, mapValueType],
- );
- }
-
- verifier._reportErrorIfFromDeferredLibrary(
- valueExpression,
- CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY,
+ [keyType, mapKeyType],
);
}
- } else {
- // Note: we throw the errors away because this isn't actually a const.
- var nullErrorReporter = new ErrorReporter(
- AnalysisErrorListener.NULL_LISTENER,
- verifier._errorReporter.source,
- );
- var keyValue = keyExpression.accept(
- new ConstantVisitor(verifier._evaluationEngine, nullErrorReporter),
- );
- if (keyValue != null) {
- if (!mapUniqueKeys.add(keyValue)) {
- mapDuplicateKeyElements.add(keyExpression);
- }
+ if (verifier._implementsEqualsWhenNotAllowed(keyType)) {
+ verifier._errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
+ keyExpression,
+ [keyType],
+ );
}
- return true;
+ verifier._reportErrorIfFromDeferredLibrary(
+ keyExpression,
+ CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY,
+ );
+
+ if (!mapUniqueKeys.add(keyValue)) {
+ mapDuplicateKeyExpressions.add(keyExpression);
+ }
}
+
+ if (valueValue != null) {
+ if (!verifier._evaluationEngine
+ .runtimeTypeMatch(valueValue, mapValueType)) {
+ verifier._errorReporter.reportErrorForNode(
+ StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
+ valueExpression,
+ [valueValue.type, mapValueType],
+ );
+ }
+
+ verifier._reportErrorIfFromDeferredLibrary(
+ valueExpression,
+ CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY,
+ );
+ }
+
return true;
}
bool _validateMapSpread(SpreadElement element, DartObjectImpl value) {
- if (value.toMapValue() != null ||
- value.isNull && _isNullableSpread(element)) {
+ if (value.isNull && _isNullableSpread(element)) {
return true;
}
-
+ Map<DartObject, DartObject> map = value.toMapValue();
+ if (map != null) {
+ // TODO(brianwilkerson) Figure out how to improve the error messages. They
+ // currently point to the whole spread expression, but the key and/or
+ // value being referenced might not be located there (if it's referenced
+ // through a const variable).
+ for (var entry in map.entries) {
+ DartObjectImpl keyValue = entry.key;
+ if (keyValue != null) {
+ if (!mapUniqueKeys.add(keyValue)) {
+ mapDuplicateKeyExpressions.add(element.expression);
+ }
+ }
+ }
+ return true;
+ }
verifier._errorReporter.reportErrorForNode(
CompileTimeErrorCode.CONST_SPREAD_EXPECTED_MAP,
element.expression,
);
-
return false;
}
@@ -910,7 +893,7 @@
);
if (!setUniqueValues.add(value)) {
- setDuplicateElements.add(expression);
+ setDuplicateExpressions.add(expression);
}
return true;
diff --git a/analyzer/lib/src/dart/constant/evaluation.dart b/analyzer/lib/src/dart/constant/evaluation.dart
index cc56403..6633be9 100644
--- a/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/analyzer/lib/src/dart/constant/evaluation.dart
@@ -15,6 +15,7 @@
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/src/dart/constant/potentially_constant.dart';
import 'package:analyzer/src/dart/constant/utilities.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/element.dart';
@@ -901,9 +902,6 @@
if (obj.isNull) {
return true;
}
- if (type.isUndefined) {
- return false;
- }
var objType = obj.type;
if (objType.isDartCoreInt && type.isDartCoreDouble) {
// Work around dartbug.com/35993 by allowing `int` to be used in a place
@@ -918,6 +916,10 @@
// fixed.
return true;
}
+ // TODO(scheglov ) Switch to using this, but not now, dartbug.com/33441
+ if (typeSystem.isSubtypeOf(objType, type)) {
+ return true;
+ }
return objType.isSubtypeOf(type);
}
@@ -1010,58 +1012,7 @@
/**
* A visitor used to evaluate constant expressions to produce their compile-time
- * value. According to the Dart Language Specification: <blockquote> A constant
- * expression is one of the following:
- *
- * * A literal number.
- * * A literal boolean.
- * * A literal string where any interpolated expression is a compile-time
- * constant that evaluates to a numeric, string or boolean value or to
- * <b>null</b>.
- * * A literal symbol.
- * * <b>null</b>.
- * * A qualified reference to a static constant variable.
- * * An identifier expression that denotes a constant variable, class or type
- * alias.
- * * A constant constructor invocation.
- * * A constant list literal.
- * * A constant map literal.
- * * A simple or qualified identifier denoting a top-level function or a static
- * method.
- * * A parenthesized expression <i>(e)</i> where <i>e</i> is a constant
- * expression.
- * * An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i>
- * where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
- * expressions and <i>identical()</i> is statically bound to the predefined
- * dart function <i>identical()</i> discussed above.
- * * An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i> or
- * <i>e<sub>1</sub> != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and
- * <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric,
- * string or boolean value.
- * * An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> &&
- * e<sub>2</sub></i> or <i>e<sub>1</sub> || e<sub>2</sub></i>, where <i>e</i>,
- * <i>e1</sub></i> and <i>e2</sub></i> are constant expressions that evaluate
- * to a boolean value.
- * * An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^
- * e<sub>2</sub></i>, <i>e<sub>1</sub> & e<sub>2</sub></i>,
- * <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub> >>
- * e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where
- * <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
- * expressions that evaluate to an integer value or to <b>null</b>.
- * * An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> +
- * e<sub>2</sub></i>, <i>e<sub>1</sub> - e<sub>2</sub></i>, <i>e<sub>1</sub> *
- * e<sub>2</sub></i>, <i>e<sub>1</sub> / e<sub>2</sub></i>, <i>e<sub>1</sub>
- * ~/ e<sub>2</sub></i>, <i>e<sub>1</sub> > e<sub>2</sub></i>,
- * <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >=
- * e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or
- * <i>e<sub>1</sub> % e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i>
- * and <i>e<sub>2</sub></i> are constant expressions that evaluate to a
- * numeric value or to <b>null</b>.
- * * An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> :
- * e<sub>3</sub></i> where <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and
- * <i>e<sub>3</sub></i> are constant expressions, and <i>e<sub>1</sub></i>
- * evaluates to a boolean value.
- * </blockquote>
+ * value.
*/
class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
/**
@@ -1206,6 +1157,10 @@
return _dartObjectComputer.eagerXor(
node, leftResult, rightResult, experimentStatus.constant_update_2018);
} else if (operatorType == TokenType.EQ_EQ) {
+ if (experimentStatus.constant_update_2018) {
+ return _dartObjectComputer.lazyEqualEqual(
+ node, leftResult, rightResult);
+ }
return _dartObjectComputer.equalEqual(node, leftResult, rightResult);
} else if (operatorType == TokenType.GT) {
return _dartObjectComputer.greaterThan(node, leftResult, rightResult);
@@ -1264,8 +1219,10 @@
return conditionResult;
}
if (conditionResult.toBoolValue() == true) {
+ _reportNotPotentialConstants(node.elseExpression);
return node.thenExpression.accept(this);
} else if (conditionResult.toBoolValue() == false) {
+ _reportNotPotentialConstants(node.thenExpression);
return node.elseExpression.accept(this);
}
// We used to return an object with a known type and an unknown value, but
@@ -1370,7 +1327,7 @@
}
bool errorOccurred = false;
List<DartObjectImpl> list = [];
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
errorOccurred = errorOccurred | _addElementsToList(list, element);
}
if (errorOccurred) {
@@ -1499,7 +1456,7 @@
}
bool errorOccurred = false;
Map<DartObjectImpl, DartObjectImpl> map = {};
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
errorOccurred = errorOccurred | _addElementsToMap(map, element);
}
if (errorOccurred) {
@@ -1526,7 +1483,7 @@
}
bool errorOccurred = false;
Set<DartObjectImpl> set = new Set<DartObjectImpl>();
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
errorOccurred = errorOccurred | _addElementsToSet(set, element);
}
if (errorOccurred) {
@@ -1603,8 +1560,7 @@
*/
bool _addElementsToList(List<DartObject> list, CollectionElement element) {
if (element is IfElement) {
- DartObjectImpl conditionResult = element.condition.accept(this);
- bool conditionValue = conditionResult?.toBoolValue();
+ bool conditionValue = _evaluateCondition(element.condition);
if (conditionValue == null) {
return true;
} else if (conditionValue) {
@@ -1641,8 +1597,7 @@
bool _addElementsToMap(
Map<DartObjectImpl, DartObjectImpl> map, CollectionElement element) {
if (element is IfElement) {
- DartObjectImpl conditionResult = element.condition.accept(this);
- bool conditionValue = conditionResult?.toBoolValue();
+ bool conditionValue = _evaluateCondition(element.condition);
if (conditionValue == null) {
return true;
} else if (conditionValue) {
@@ -1679,8 +1634,7 @@
*/
bool _addElementsToSet(Set<DartObject> set, CollectionElement element) {
if (element is IfElement) {
- DartObjectImpl conditionResult = element.condition.accept(this);
- bool conditionValue = conditionResult?.toBoolValue();
+ bool conditionValue = _evaluateCondition(element.condition);
if (conditionValue == null) {
return true;
} else if (conditionValue) {
@@ -1730,6 +1684,27 @@
}
/**
+ * Evaluate the given [condition] with the assumption that it must be a
+ * `bool`.
+ */
+ bool _evaluateCondition(Expression condition) {
+ DartObjectImpl conditionResult = condition.accept(this);
+ bool conditionValue = conditionResult?.toBoolValue();
+ if (conditionValue == null) {
+ // TODO(brianwilkerson) Figure out why the static type is sometimes null.
+ DartType staticType = condition.staticType;
+ if (staticType == null ||
+ typeSystem.isAssignableTo(staticType, _typeProvider.boolType)) {
+ // If the static type is not assignable, then we will have already
+ // reported this error.
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, condition);
+ }
+ }
+ return conditionValue;
+ }
+
+ /**
* Return the constant value of the static constant represented by the given
* [element]. The [node] is the node to be used if an error needs to be
* reported.
@@ -1790,6 +1765,18 @@
return identifier.name == 'length';
}
+ void _reportNotPotentialConstants(AstNode node) {
+ var notPotentiallyConstants = getNotPotentiallyConstants(node);
+ if (notPotentiallyConstants.isEmpty) return;
+
+ for (var notConst in notPotentiallyConstants) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_CONSTANT,
+ notConst,
+ );
+ }
+ }
+
/**
* Return the value of the given [expression], or a representation of 'null'
* if the expression cannot be evaluated.
@@ -2026,6 +2013,18 @@
return null;
}
+ DartObjectImpl lazyEqualEqual(Expression node, DartObjectImpl leftOperand,
+ DartObjectImpl rightOperand) {
+ if (leftOperand != null && rightOperand != null) {
+ try {
+ return leftOperand.lazyEqualEqual(_typeProvider, rightOperand);
+ } on EvaluationException catch (exception) {
+ _errorReporter.reportErrorForNode(exception.errorCode, node);
+ }
+ }
+ return null;
+ }
+
DartObjectImpl lazyOr(BinaryExpression node, DartObjectImpl leftOperand,
DartObjectImpl rightOperandComputer()) {
if (leftOperand != null) {
diff --git a/analyzer/lib/src/dart/constant/potentially_constant.dart b/analyzer/lib/src/dart/constant/potentially_constant.dart
new file mode 100644
index 0000000..65e2023
--- /dev/null
+++ b/analyzer/lib/src/dart/constant/potentially_constant.dart
@@ -0,0 +1,366 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+
+/// Some [ConstructorElement]s can be temporary marked as "const" to check
+/// if doing this is valid.
+final temporaryConstConstructorElements = new Expando<bool>();
+
+/// Check if the [node] and all its sub-nodes are potentially constant.
+///
+/// Return the list of nodes that are not potentially constant.
+List<AstNode> getNotPotentiallyConstants(AstNode node) {
+ var collector = _Collector();
+ collector.collect(node);
+ return collector.nodes;
+}
+
+/// Return `true` if the [node] is a constant type expression.
+bool isConstantTypeExpression(TypeAnnotation node) {
+ if (node is TypeName) {
+ if (_isConstantTypeName(node.name)) {
+ var arguments = node.typeArguments?.arguments;
+ if (arguments != null) {
+ for (var argument in arguments) {
+ if (!isConstantTypeExpression(argument)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ if (node.type is DynamicTypeImpl) {
+ return true;
+ }
+ if (node.type is VoidType) {
+ return true;
+ }
+ return false;
+ }
+
+ if (node is GenericFunctionType) {
+ var returnType = node.returnType;
+ if (returnType != null) {
+ if (!isConstantTypeExpression(returnType)) {
+ return false;
+ }
+ }
+
+ var typeParameters = node.typeParameters?.typeParameters;
+ if (typeParameters != null) {
+ for (var parameter in typeParameters) {
+ var bound = parameter.bound;
+ if (bound != null && !isConstantTypeExpression(bound)) {
+ return false;
+ }
+ }
+ }
+
+ var formalParameters = node.parameters?.parameters;
+ if (formalParameters != null) {
+ for (var parameter in formalParameters) {
+ if (parameter is SimpleFormalParameter) {
+ if (!isConstantTypeExpression(parameter.type)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+bool _isConstantTypeName(Identifier name) {
+ var element = name.staticElement;
+ if (element is ClassElement || element is GenericTypeAliasElement) {
+ if (name is PrefixedIdentifier) {
+ if (name.isDeferred) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+class _Collector {
+ final List<AstNode> nodes = [];
+
+ void collect(AstNode node) {
+ if (node is BooleanLiteral ||
+ node is DoubleLiteral ||
+ node is IntegerLiteral ||
+ node is NullLiteral ||
+ node is SimpleStringLiteral ||
+ node is SymbolLiteral) {
+ return;
+ }
+
+ if (node is AdjacentStrings) {
+ for (var string in node.strings) {
+ collect(string);
+ }
+ return;
+ }
+
+ if (node is StringInterpolation) {
+ for (var component in node.elements) {
+ if (component is InterpolationExpression) {
+ collect(component.expression);
+ }
+ }
+ return;
+ }
+
+ if (node is Identifier) {
+ return _identifier(node);
+ }
+
+ if (node is InstanceCreationExpression) {
+ if (!node.isConst) {
+ nodes.add(node);
+ }
+ return;
+ }
+
+ if (node is TypedLiteral) {
+ return _typeLiteral(node);
+ }
+
+ if (node is ParenthesizedExpression) {
+ collect(node.expression);
+ return;
+ }
+
+ if (node is MethodInvocation) {
+ return _methodInvocation(node);
+ }
+
+ if (node is NamedExpression) {
+ return collect(node.expression);
+ }
+
+ if (node is BinaryExpression) {
+ collect(node.leftOperand);
+ collect(node.rightOperand);
+ return;
+ }
+
+ if (node is PrefixExpression) {
+ var operator = node.operator.type;
+ if (operator == TokenType.BANG ||
+ operator == TokenType.MINUS ||
+ operator == TokenType.TILDE) {
+ collect(node.operand);
+ return;
+ }
+ nodes.add(node);
+ return;
+ }
+
+ if (node is ConditionalExpression) {
+ collect(node.condition);
+ collect(node.thenExpression);
+ collect(node.elseExpression);
+ return;
+ }
+
+ if (node is PropertyAccess) {
+ return _propertyAccess(node);
+ }
+
+ if (node is AsExpression) {
+ if (!isConstantTypeExpression(node.type)) {
+ nodes.add(node.type);
+ }
+ collect(node.expression);
+ return;
+ }
+
+ if (node is IsExpression) {
+ if (!isConstantTypeExpression(node.type)) {
+ nodes.add(node.type);
+ }
+ collect(node.expression);
+ return;
+ }
+
+ if (node is MapLiteralEntry) {
+ collect(node.key);
+ collect(node.value);
+ return;
+ }
+
+ if (node is SpreadElement) {
+ collect(node.expression);
+ return;
+ }
+
+ if (node is IfElement) {
+ collect(node.condition);
+ collect(node.thenElement);
+ if (node.elseElement != null) {
+ collect(node.elseElement);
+ }
+ return;
+ }
+
+ nodes.add(node);
+ }
+
+ void _identifier(Identifier node) {
+ var element = node.staticElement;
+
+ if (node is PrefixedIdentifier) {
+ if (node.isDeferred) {
+ nodes.add(node);
+ return;
+ }
+ if (node.identifier.name == 'length') {
+ collect(node.prefix);
+ return;
+ }
+ if (element is MethodElement && element.isStatic) {
+ if (!_isConstantTypeName(node.prefix)) {
+ nodes.add(node);
+ }
+ return;
+ }
+ }
+
+ if (element is ParameterElement) {
+ var enclosing = element.enclosingElement;
+ if (enclosing is ConstructorElement &&
+ isConstConstructorElement(enclosing)) {
+ if (node.thisOrAncestorOfType<ConstructorInitializer>() != null) {
+ return;
+ }
+ }
+ nodes.add(node);
+ return;
+ }
+
+ if (element is VariableElement) {
+ if (!element.isConst) {
+ nodes.add(node);
+ }
+ return;
+ }
+ if (element is PropertyAccessorElement && element.isGetter) {
+ var variable = element.variable;
+ if (!variable.isConst) {
+ nodes.add(node);
+ }
+ return;
+ }
+ if (_isConstantTypeName(node)) {
+ return;
+ }
+ if (element is FunctionElement) {
+ return;
+ }
+ if (element is MethodElement && element.isStatic) {
+ return;
+ }
+ nodes.add(node);
+ }
+
+ void _methodInvocation(MethodInvocation node) {
+ var arguments = node.argumentList?.arguments;
+ if (arguments?.length == 2 && node.methodName.name == 'identical') {
+ var library = node.methodName?.staticElement?.library;
+ if (library?.isDartCore == true) {
+ collect(arguments[0]);
+ collect(arguments[1]);
+ return;
+ }
+ }
+ nodes.add(node);
+ }
+
+ void _propertyAccess(PropertyAccess node) {
+ if (node.propertyName.name == 'length') {
+ collect(node.target);
+ return;
+ }
+
+ var target = node.target;
+ if (target is PrefixedIdentifier) {
+ if (target.isDeferred) {
+ nodes.add(node);
+ return;
+ }
+
+ var element = node.propertyName.staticElement;
+ if (element is PropertyAccessorElement && element.isGetter) {
+ var variable = element.variable;
+ if (!variable.isConst) {
+ nodes.add(node.propertyName);
+ }
+ return;
+ }
+ }
+
+ nodes.add(node);
+ }
+
+ void _typeLiteral(TypedLiteral node) {
+ if (!node.isConst) {
+ nodes.add(node);
+ return;
+ }
+
+ if (node is ListLiteral) {
+ var typeArguments = node.typeArguments?.arguments;
+ if (typeArguments?.length == 1) {
+ var elementType = typeArguments[0];
+ if (!isConstantTypeExpression(elementType)) {
+ nodes.add(elementType);
+ }
+ }
+
+ for (var element in node.elements) {
+ collect(element);
+ }
+ return;
+ }
+
+ if (node is SetOrMapLiteral) {
+ var typeArguments = node.typeArguments?.arguments;
+ if (typeArguments?.length == 1) {
+ var elementType = typeArguments[0];
+ if (!isConstantTypeExpression(elementType)) {
+ nodes.add(elementType);
+ }
+ }
+
+ if (typeArguments?.length == 2) {
+ var keyType = typeArguments[0];
+ var valueType = typeArguments[1];
+ if (!isConstantTypeExpression(keyType)) {
+ nodes.add(keyType);
+ }
+ if (!isConstantTypeExpression(valueType)) {
+ nodes.add(valueType);
+ }
+ }
+
+ for (var element in node.elements) {
+ collect(element);
+ }
+ }
+ }
+
+ static bool isConstConstructorElement(ConstructorElement element) {
+ if (element.isConst) return true;
+ return temporaryConstConstructorElements[element] ?? false;
+ }
+}
diff --git a/analyzer/lib/src/dart/constant/utilities.dart b/analyzer/lib/src/dart/constant/utilities.dart
index 6e5f535..60cecdd 100644
--- a/analyzer/lib/src/dart/constant/utilities.dart
+++ b/analyzer/lib/src/dart/constant/utilities.dart
@@ -95,17 +95,6 @@
}
@override
- @deprecated
- MapLiteral visitMapLiteral(MapLiteral node) {
- MapLiteral literal = super.visitMapLiteral(node);
- literal.staticType = node.staticType;
- if (node.constKeyword == null && node.isConst) {
- literal.constKeyword = new KeywordToken(Keyword.CONST, node.offset);
- }
- return literal;
- }
-
- @override
RedirectingConstructorInvocation visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) {
RedirectingConstructorInvocation invocation =
@@ -115,17 +104,6 @@
}
@override
- @deprecated
- SetLiteral visitSetLiteral(SetLiteral node) {
- SetLiteral literal = super.visitSetLiteral(node);
- literal.staticType = node.staticType;
- if (node.constKeyword == null && node.isConst) {
- literal.constKeyword = new KeywordToken(Keyword.CONST, node.offset);
- }
- return literal;
- }
-
- @override
SetOrMapLiteral visitSetOrMapLiteral(SetOrMapLiteral node) {
SetOrMapLiteral literal = super.visitSetOrMapLiteral(node);
literal.staticType = node.staticType;
@@ -196,13 +174,13 @@
} else {
if (node.isMap) {
// Values of keys are computed to check that they are unique.
- for (var entry in node.elements2) {
+ for (var entry in node.elements) {
// TODO(mfairhurst): How do if/for loops/spreads affect this?
_find(entry);
}
} else if (node.isSet) {
// values of sets are computed to check that they are unique.
- for (var entry in node.elements2) {
+ for (var entry in node.elements) {
_find(entry);
}
}
diff --git a/analyzer/lib/src/dart/constant/value.dart b/analyzer/lib/src/dart/constant/value.dart
index fcaa320..1b93859 100644
--- a/analyzer/lib/src/dart/constant/value.dart
+++ b/analyzer/lib/src/dart/constant/value.dart
@@ -109,6 +109,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
BoolState lazyOr(InstanceState rightOperandComputer()) {
if (value == true) {
return TRUE_STATE;
@@ -563,6 +568,31 @@
_state.lazyAnd(() => rightOperandComputer()?._state));
/**
+ * Return the result of invoking the '==' operator on this object with the
+ * [rightOperand]. The [typeProvider] is the type provider used to find known
+ * types.
+ *
+ * Throws an [EvaluationException] if the operator is not appropriate for an
+ * object of this kind.
+ */
+ DartObjectImpl lazyEqualEqual(
+ TypeProvider typeProvider, DartObjectImpl rightOperand) {
+ if (isNull || rightOperand.isNull) {
+ return new DartObjectImpl(
+ typeProvider.boolType,
+ isNull && rightOperand.isNull
+ ? BoolState.TRUE_STATE
+ : BoolState.FALSE_STATE);
+ }
+ if (isBoolNumStringOrNull) {
+ return new DartObjectImpl(
+ typeProvider.boolType, _state.lazyEqualEqual(rightOperand._state));
+ }
+ throw new EvaluationException(
+ CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING);
+ }
+
+ /**
* Return the result of invoking the '||' operator on this object with the
* [rightOperand]. The [typeProvider] is the type provider used to find known
* types.
@@ -1077,6 +1107,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
BoolState lessThan(InstanceState rightOperand) {
assertNumOrNull(rightOperand);
if (value == null) {
@@ -1313,6 +1348,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return BoolState.UNKNOWN_VALUE;
+ }
+
+ @override
BoolState lazyOr(InstanceState rightOperandComputer()) {
InstanceState rightOperand = rightOperandComputer();
assertBool(rightOperand);
@@ -1452,6 +1492,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() => _element == null ? "-unknown-" : _element.name;
}
@@ -1544,6 +1589,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() {
StringBuffer buffer = new StringBuffer();
List<String> fieldNames = _fieldMap.keys.toList();
@@ -1855,6 +1905,15 @@
}
/**
+ * Return the result of invoking the '==' operator on this object with the
+ * [rightOperand].
+ *
+ * Throws an [EvaluationException] if the operator is not appropriate for an
+ * object of this kind.
+ */
+ BoolState lazyEqualEqual(InstanceState rightOperand);
+
+ /**
* Return the result of invoking the '||' operator on this object with the
* [rightOperand].
*
@@ -2348,6 +2407,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
BoolState lessThan(InstanceState rightOperand) {
assertNumOrNull(rightOperand);
if (value == null) {
@@ -2413,9 +2477,15 @@
if (rightValue >= 0) {
// TODO(brianwilkerson) After the analyzer package has a minimum SDK
// constraint that includes support for the real operator, consider
- // changing this to the following line:
+ // changing the line below to
// return new IntState(value >>> rightValue);
- return new IntState(value ~/ (1 << rightValue));
+ int divisor = 1 << rightValue;
+ if (divisor == 0) {
+ // The `rightValue` is large enough to cause all of the non-zero bits
+ // in the left operand to be shifted out of the value.
+ return new IntState(0);
+ }
+ return new IntState(value ~/ divisor);
}
} else if (rightOperand is DynamicState || rightOperand is NumState) {
return UNKNOWN_VALUE;
@@ -2634,6 +2704,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() {
StringBuffer buffer = new StringBuffer();
buffer.write('[');
@@ -2718,6 +2793,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() {
StringBuffer buffer = new StringBuffer();
buffer.write('{');
@@ -2785,6 +2865,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
BoolState logicalNot() {
throw new EvaluationException(
CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
@@ -2874,6 +2959,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return BoolState.UNKNOWN_VALUE;
+ }
+
+ @override
BoolState lessThan(InstanceState rightOperand) {
assertNumOrNull(rightOperand);
return BoolState.UNKNOWN_VALUE;
@@ -2976,6 +3066,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() {
StringBuffer buffer = new StringBuffer();
buffer.write('{');
@@ -3072,6 +3167,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
IntState stringLength() {
if (value == null) {
return IntState.UNKNOWN_VALUE;
@@ -3139,6 +3239,11 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() => value == null ? "-unknown-" : "#$value";
}
@@ -3198,5 +3303,10 @@
}
@override
+ BoolState lazyEqualEqual(InstanceState rightOperand) {
+ return isIdentical(rightOperand);
+ }
+
+ @override
String toString() => _type?.toString() ?? "-unknown-";
}
diff --git a/analyzer/lib/src/dart/element/element.dart b/analyzer/lib/src/dart/element/element.dart
index 5cf726d..a04e0f5 100644
--- a/analyzer/lib/src/dart/element/element.dart
+++ b/analyzer/lib/src/dart/element/element.dart
@@ -32,6 +32,7 @@
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary2/linked_unit_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
+import 'package:analyzer/src/util/comment.dart';
/// Assert that the given [object] is null, which in the places where this
/// function is called means that the element is not resynthesized.
@@ -61,7 +62,7 @@
AbstractClassElementImpl(String name, int offset) : super(name, offset);
AbstractClassElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created class element to have the given [name].
@@ -453,6 +454,9 @@
/// methods might be different.
int version = 0;
+ /// This callback is set during mixins inference to handle reentrant calls.
+ List<InterfaceType> Function(ClassElementImpl) linkedMixinInferenceCallback;
+
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
ClassElementImpl(String name, int offset)
@@ -460,11 +464,9 @@
super(name, offset);
ClassElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
- Reference reference, LinkedNode linkedNode)
+ Reference reference, AstNode linkedNode)
: _unlinkedClass = null,
- super.forLinkedNode(enclosing, reference, linkedNode) {
- enclosing.linkedContext.loadClassMemberReferences(reference);
- }
+ super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created class element to have the given [name].
ClassElementImpl.forNode(Identifier name)
@@ -484,11 +486,10 @@
@override
List<PropertyAccessorElement> get accessors {
- if (linkedNode != null) {
- if (_accessors != null) return _accessors;
+ if (_accessors != null) return _accessors;
- if (linkedNode.kind == LinkedNodeKind.classDeclaration ||
- linkedNode.kind == LinkedNodeKind.mixinDeclaration) {
+ if (linkedNode != null) {
+ if (linkedNode is ClassOrMixinDeclaration) {
_createPropertiesAndAccessors();
assert(_accessors != null);
return _accessors;
@@ -496,12 +497,14 @@
return _accessors = const [];
}
}
+
if (_accessors == null) {
if (_unlinkedClass != null) {
_resynthesizeFieldsAndPropertyAccessors();
}
}
- return _accessors ?? const <PropertyAccessorElement>[];
+
+ return _accessors ??= const <PropertyAccessorElement>[];
}
@override
@@ -519,6 +522,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedClass != null) {
return _unlinkedClass.codeRange?.length;
}
@@ -527,6 +533,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedClass != null) {
return _unlinkedClass.codeRange?.offset;
}
@@ -546,14 +555,26 @@
if (linkedNode != null) {
var context = enclosingUnit.linkedContext;
var containerRef = reference.getChild('@constructor');
- if (linkedNode.kind == LinkedNodeKind.classDeclaration) {
- _constructors = linkedNode.classOrMixinDeclaration_members
- .where((node) => node.kind == LinkedNodeKind.constructorDeclaration)
- .map((node) {
- var name = context.getConstructorDeclarationName(node);
- var reference = containerRef.getChild(name);
- return ConstructorElementImpl.forLinkedNode(reference, node, this);
- }).toList();
+ _constructors = context.getConstructors(linkedNode).map((node) {
+ var name = node.name?.name ?? '';
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as ConstructorElement;
+ }
+ return ConstructorElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
+
+ if (_constructors.isEmpty) {
+ return _constructors = [
+ ConstructorElementImpl.forLinkedNode(
+ this,
+ containerRef.getChild(''),
+ null,
+ )
+ ..isSynthetic = true
+ ..name = ''
+ ..nameOffset = -1,
+ ];
}
}
@@ -584,16 +605,17 @@
}
}
- // There are no explicit constructors.
- // Create the implicit default constructor.
+ _constructors = const <ConstructorElement>[];
+ }
+
+ if (_constructors.isEmpty) {
var constructor = new ConstructorElementImpl('', -1);
constructor.isSynthetic = true;
constructor.enclosingElement = this;
_constructors = <ConstructorElement>[constructor];
}
- assert(_constructors != null);
- return _constructors ?? const <ConstructorElement>[];
+ return _constructors;
}
/// Set the constructors contained in this class to the given [constructors].
@@ -611,9 +633,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.annotatedNode_comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (_unlinkedClass != null) {
return _unlinkedClass.documentationComment?.text;
@@ -626,11 +648,10 @@
@override
List<FieldElement> get fields {
- if (linkedNode != null) {
- if (_fields != null) return _fields;
+ if (_fields != null) return _fields;
- if (linkedNode.kind == LinkedNodeKind.classDeclaration ||
- linkedNode.kind == LinkedNodeKind.mixinDeclaration) {
+ if (linkedNode != null) {
+ if (linkedNode is ClassOrMixinDeclaration) {
_createPropertiesAndAccessors();
assert(_fields != null);
return _fields;
@@ -638,11 +659,13 @@
_fields = const [];
}
}
+
if (_fields == null) {
if (_unlinkedClass != null) {
_resynthesizeFieldsAndPropertyAccessors();
}
}
+
return _fields ?? const <FieldElement>[];
}
@@ -653,10 +676,16 @@
}
bool get hasBeenInferred {
+ if (linkedNode != null) {
+ return linkedContext.hasOverrideInferenceDone(linkedNode);
+ }
return _unlinkedClass != null || _hasBeenInferred;
}
void set hasBeenInferred(bool hasBeenInferred) {
+ if (linkedNode != null) {
+ return linkedContext.setOverrideInferenceDone(linkedNode);
+ }
_assertNotResynthesized(_unlinkedClass);
_hasBeenInferred = hasBeenInferred;
}
@@ -740,10 +769,13 @@
var context = enclosingUnit.linkedContext;
var implementsClause = context.getImplementsClause(linkedNode);
if (implementsClause != null) {
- return _interfaces = implementsClause.implementsClause_interfaces
- .map((node) => context.getInterfaceType(node.typeName_type))
- .where((type) => type != null)
+ return _interfaces = implementsClause.interfaces
+ .map((node) => node.type)
+ .whereType<InterfaceType>()
+ .where(_isInterfaceTypeInterface)
.toList();
+ } else {
+ return _interfaces = const [];
}
} else if (_unlinkedClass != null) {
var unlinkedInterfaces = _unlinkedClass.interfaces;
@@ -784,11 +816,7 @@
@override
bool get isAbstract {
if (linkedNode != null) {
- if (linkedNode.kind == LinkedNodeKind.classDeclaration) {
- return linkedNode.classDeclaration_abstractKeyword != 0;
- } else {
- return linkedNode.classTypeAlias_abstractKeyword != 0;
- }
+ return enclosingUnit.linkedContext.isAbstract(linkedNode);
}
if (_unlinkedClass != null) {
return _unlinkedClass.isAbstract;
@@ -799,7 +827,7 @@
@override
bool get isMixinApplication {
if (linkedNode != null) {
- return linkedNode.kind == LinkedNodeKind.classTypeAlias;
+ return linkedNode is ClassTypeAlias;
}
if (_unlinkedClass != null) {
return _unlinkedClass.isMixinApplication;
@@ -822,6 +850,14 @@
}
@override
+ bool get isSimplyBounded {
+ if (linkedNode != null) {
+ return linkedContext.isSimplyBounded(linkedNode);
+ }
+ return super.isSimplyBounded;
+ }
+
+ @override
bool get isValidMixin {
if (hasReferenceToSuper) {
return false;
@@ -855,19 +891,17 @@
if (linkedNode != null) {
var context = enclosingUnit.linkedContext;
var containerRef = reference.getChild('@method');
- if (linkedNode.kind == LinkedNodeKind.classDeclaration ||
- linkedNode.kind == LinkedNodeKind.mixinDeclaration) {
- return _methods = linkedNode.classOrMixinDeclaration_members
- .where((node) => node.kind == LinkedNodeKind.methodDeclaration)
- .where((node) => node.methodDeclaration_propertyKeyword == 0)
- .map((node) {
- var name = context.getSimpleName(node.methodDeclaration_name);
- var reference = containerRef.getChild(name);
- return MethodElementImpl.forLinkedNode(reference, node, this);
- }).toList();
- } else {
- return _methods = const <MethodElement>[];
- }
+ return _methods = context
+ .getMethods(linkedNode)
+ .where((node) => node.propertyKeyword == null)
+ .map((node) {
+ var name = node.name.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as MethodElement;
+ }
+ return MethodElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
}
if (_unlinkedClass != null) {
@@ -919,23 +953,25 @@
@override
List<InterfaceType> get mixins {
+ if (linkedMixinInferenceCallback != null) {
+ _mixins = linkedMixinInferenceCallback(this);
+ }
+
if (_mixins != null) {
return _mixins;
}
if (linkedNode != null) {
var context = enclosingUnit.linkedContext;
- LinkedNode withClause;
- if (linkedNode.kind == LinkedNodeKind.classDeclaration) {
- withClause = linkedNode.classDeclaration_withClause;
- } else {
- withClause = linkedNode.classTypeAlias_withClause;
- }
+ var withClause = context.getWithClause(linkedNode);
if (withClause != null) {
- return _mixins = withClause.withClause_mixinTypes
- .map((node) => context.getInterfaceType(node.typeName_type))
- .where((type) => type != null)
+ return _mixins = withClause.mixinTypes
+ .map((node) => node.type)
+ .whereType<InterfaceType>()
+ .where(_isInterfaceTypeInterface)
.toList();
+ } else {
+ return _mixins = const [];
}
} else if (_unlinkedClass != null) {
var unlinkedMixins = _unlinkedClass.mixins;
@@ -991,6 +1027,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedClass != null) {
return _unlinkedClass.nameOffset;
@@ -1005,37 +1045,37 @@
@override
InterfaceType get supertype {
- if (_supertype == null) {
- if (linkedNode != null) {
- LinkedNode superclass;
- if (linkedNode.kind == LinkedNodeKind.classDeclaration) {
- superclass = linkedNode
- .classDeclaration_extendsClause?.extendsClause_superclass;
- } else {
- superclass = linkedNode.classTypeAlias_superclass;
- }
- if (superclass != null) {
- var context = enclosingUnit.linkedContext;
- _supertype = context.getInterfaceType(superclass.typeName_type);
- } else if (!linkedNode.classDeclaration_isDartObject) {
- _supertype = context.typeProvider.objectType;
- }
- } else if (_unlinkedClass != null) {
- if (_unlinkedClass.supertype != null) {
- DartType type = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, _unlinkedClass.supertype);
- if (_isInterfaceTypeClass(type)) {
- _supertype = type;
- } else {
- _supertype = context.typeProvider.objectType;
- }
- } else if (_unlinkedClass.hasNoSupertype) {
- return null;
+ if (_supertype != null) return _supertype;
+
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+
+ var coreTypes = context.bundleContext.elementFactory.coreTypes;
+ if (identical(this, coreTypes.objectClass)) {
+ return null;
+ }
+
+ var type = context.getSuperclass(linkedNode)?.type;
+ if (_isInterfaceTypeClass(type)) {
+ return _supertype = type;
+ }
+ return _supertype = this.context.typeProvider.objectType;
+ } else if (_unlinkedClass != null) {
+ if (_unlinkedClass.supertype != null) {
+ DartType type = enclosingUnit.resynthesizerContext
+ .resolveTypeRef(this, _unlinkedClass.supertype);
+ if (_isInterfaceTypeClass(type)) {
+ _supertype = type;
} else {
_supertype = context.typeProvider.objectType;
}
+ } else if (_unlinkedClass.hasNoSupertype) {
+ return null;
+ } else {
+ _supertype = context.typeProvider.objectType;
}
}
+
return _supertype;
}
@@ -1054,27 +1094,6 @@
return _type;
}
- @override
- List<TypeParameterElement> get typeParameters {
- if (_typeParameterElements != null) return _typeParameterElements;
-
- if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
- var containerRef = reference.getChild('@typeParameter');
- var typeParameters = context.getTypeParameters(linkedNode);
- if (typeParameters == null) {
- return _typeParameterElements = const [];
- }
- return _typeParameterElements = typeParameters.map((node) {
- var name = context.getSimpleName(node.typeParameter_name);
- var reference = containerRef.getChild(name);
- reference.node = node;
- return TypeParameterElementImpl.forLinkedNode(this, reference, node);
- }).toList();
- }
- return super.typeParameters;
- }
-
/// Set the type parameters defined for this class to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
@@ -1300,9 +1319,9 @@
var accessorList = <PropertyAccessorElementImpl>[];
var fieldList = <FieldElementImpl>[];
- var fields = context.classFields(linkedNode);
+ var fields = context.getFields(linkedNode);
for (var field in fields) {
- var name = context.getVariableName(field);
+ var name = field.name.name;
var fieldElement = FieldElementImpl.forLinkedNodeFactory(
this,
reference.getChild('@field').getChild(name),
@@ -1316,44 +1335,43 @@
}
}
- for (var node in linkedNode.classOrMixinDeclaration_members) {
- if (node.kind == LinkedNodeKind.methodDeclaration) {
- var isGetter = context.isGetterMethod(node);
- var isSetter = context.isSetterMethod(node);
- if (!isGetter && !isSetter) continue;
+ var methods = context.getMethods(linkedNode);
+ for (var method in methods) {
+ var isGetter = method.isGetter;
+ var isSetter = method.isSetter;
+ if (!isGetter && !isSetter) continue;
- var name = context.getMethodName(node);
- var containerRef = isGetter
- ? reference.getChild('@getter')
- : reference.getChild('@setter');
+ var name = method.name.name;
+ var containerRef = isGetter
+ ? reference.getChild('@getter')
+ : reference.getChild('@setter');
- var accessorElement = PropertyAccessorElementImpl.forLinkedNode(
- this,
- containerRef.getChild(name),
- node,
- );
- accessorList.add(accessorElement);
+ var accessorElement = PropertyAccessorElementImpl.forLinkedNode(
+ this,
+ containerRef.getChild(name),
+ method,
+ );
+ accessorList.add(accessorElement);
- var fieldRef = reference.getChild('@field').getChild(name);
- FieldElementImpl field = fieldRef.element;
- if (field == null) {
- field = new FieldElementImpl(name, -1);
- fieldRef.element = field;
- field.enclosingElement = this;
- field.isSynthetic = true;
- field.isFinal = isGetter;
- field.isStatic = accessorElement.isStatic;
- fieldList.add(field);
- } else {
- field.isFinal = false;
- }
+ var fieldRef = reference.getChild('@field').getChild(name);
+ FieldElementImpl field = fieldRef.element;
+ if (field == null) {
+ field = new FieldElementImpl(name, -1);
+ fieldRef.element = field;
+ field.enclosingElement = this;
+ field.isSynthetic = true;
+ field.isFinal = isGetter;
+ field.isStatic = accessorElement.isStatic;
+ fieldList.add(field);
+ } else {
+ field.isFinal = false;
+ }
- accessorElement.variable = field;
- if (isGetter) {
- field.getter = accessorElement;
- } else {
- field.setter = accessorElement;
- }
+ accessorElement.variable = field;
+ if (isGetter) {
+ field.getter = accessorElement;
+ } else {
+ field.setter = accessorElement;
}
}
@@ -1632,7 +1650,7 @@
super(null, -1);
CompilationUnitElementImpl.forLinkedNode(LibraryElementImpl enclosingLibrary,
- this.linkedContext, Reference reference, LinkedNode linkedNode)
+ this.linkedContext, Reference reference, CompilationUnit linkedNode)
: resynthesizerContext = null,
_unlinkedUnit = null,
_unlinkedPart = null,
@@ -1649,25 +1667,26 @@
@override
List<PropertyAccessorElement> get accessors {
+ if (_accessors != null) return _accessors;
+
if (linkedNode != null) {
- if (_accessors != null) return _accessors;
_createPropertiesAndAccessors(this);
assert(_accessors != null);
return _accessors;
}
- if (_accessors == null) {
- if (_unlinkedUnit != null) {
- _explicitTopLevelAccessors ??=
- resynthesizerContext.buildTopLevelAccessors();
- _explicitTopLevelVariables ??=
- resynthesizerContext.buildTopLevelVariables();
- }
- if (_explicitTopLevelAccessors != null) {
- _accessors = <PropertyAccessorElementImpl>[]
- ..addAll(_explicitTopLevelAccessors.accessors)
- ..addAll(_explicitTopLevelVariables.implicitAccessors);
- }
+
+ if (_unlinkedUnit != null) {
+ _explicitTopLevelAccessors ??=
+ resynthesizerContext.buildTopLevelAccessors();
+ _explicitTopLevelVariables ??=
+ resynthesizerContext.buildTopLevelVariables();
}
+ if (_explicitTopLevelAccessors != null) {
+ _accessors = <PropertyAccessorElementImpl>[]
+ ..addAll(_explicitTopLevelAccessors.accessors)
+ ..addAll(_explicitTopLevelVariables.implicitAccessors);
+ }
+
return _accessors ?? const <PropertyAccessorElement>[];
}
@@ -1682,6 +1701,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedUnit != null) {
return _unlinkedUnit.codeRange?.length;
}
@@ -1690,6 +1712,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedUnit != null) {
return _unlinkedUnit.codeRange?.offset;
}
@@ -1707,25 +1732,27 @@
@override
List<ClassElement> get enums {
+ if (_enums != null) return _enums;
+
if (linkedNode != null) {
- if (_enums != null) return _enums;
- var context = enclosingUnit.linkedContext;
var containerRef = reference.getChild('@enum');
- _enums = linkedNode.compilationUnit_declarations
- .where((node) => node.kind == LinkedNodeKind.enumDeclaration)
- .map((node) {
- var name = context.getUnitMemberName(node);
+ CompilationUnit linkedNode = this.linkedNode;
+ _enums = linkedNode.declarations.whereType<EnumDeclaration>().map((node) {
+ var name = node.name.name;
var reference = containerRef.getChild(name);
- reference.node = node;
+ if (reference.hasElementFor(node)) {
+ return reference.element as EnumElementImpl;
+ }
return EnumElementImpl.forLinkedNode(this, reference, node);
}).toList();
}
+
if (_unlinkedUnit != null) {
- _enums ??= _unlinkedUnit.enums
+ return _enums = _unlinkedUnit.enums
.map((e) => new EnumElementImpl.forSerialized(e, this))
.toList(growable: false);
}
- return _enums ?? const <ClassElement>[];
+ return _enums ??= const <ClassElement>[];
}
/// Set the enums contained in this compilation unit to the given [enums].
@@ -1742,16 +1769,17 @@
if (_functions != null) return _functions;
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
+ CompilationUnit linkedNode = this.linkedNode;
var containerRef = reference.getChild('@function');
- _functions = linkedNode.compilationUnit_declarations
- .where((node) =>
- node.kind == LinkedNodeKind.functionDeclaration &&
- !context.isGetterFunction(node) &&
- !context.isSetterFunction(node))
+ return _functions = linkedNode.declarations
+ .whereType<FunctionDeclaration>()
+ .where((node) => !node.isGetter && !node.isSetter)
.map((node) {
- var name = context.getUnitMemberName(node);
+ var name = node.name.name;
var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as FunctionElementImpl;
+ }
return FunctionElementImpl.forLinkedNode(this, reference, node);
}).toList();
} else if (_unlinkedUnit != null) {
@@ -1777,13 +1805,22 @@
if (_typeAliases != null) return _typeAliases;
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
+ CompilationUnit linkedNode = this.linkedNode;
var containerRef = reference.getChild('@typeAlias');
- _typeAliases = linkedNode.compilationUnit_declarations
- .where((node) => node.kind == LinkedNodeKind.functionTypeAlias)
- .map((node) {
- var name = context.getUnitMemberName(node);
+ return _typeAliases = linkedNode.declarations.where((node) {
+ return node is FunctionTypeAlias || node is GenericTypeAlias;
+ }).map((node) {
+ String name;
+ if (node is FunctionTypeAlias) {
+ name = node.name.name;
+ } else {
+ name = (node as GenericTypeAlias).name.name;
+ }
+
var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as GenericTypeAliasElementImpl;
+ }
return GenericTypeAliasElementImpl.forLinkedNode(this, reference, node);
}).toList();
}
@@ -1830,8 +1867,24 @@
@override
List<ClassElement> get mixins {
+ if (_mixins != null) return _mixins;
+
+ if (linkedNode != null) {
+ CompilationUnit linkedNode = this.linkedNode;
+ var containerRef = reference.getChild('@mixin');
+ var declarations = linkedNode.declarations;
+ return _mixins = declarations.whereType<MixinDeclaration>().map((node) {
+ var name = node.name.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as MixinElementImpl;
+ }
+ return MixinElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
+ }
+
if (_unlinkedUnit != null) {
- _mixins ??= _unlinkedUnit.mixins
+ return _mixins = _unlinkedUnit.mixins
.map((c) => new MixinElementImpl.forSerialized(c, this))
.toList(growable: false);
}
@@ -1909,24 +1962,39 @@
@override
List<ClassElement> get types {
+ if (_types != null) return _types;
+
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
+ CompilationUnit linkedNode = this.linkedNode;
var containerRef = reference.getChild('@class');
- _types = linkedNode.compilationUnit_declarations
- .where((node) =>
- node.kind == LinkedNodeKind.classDeclaration ||
- node.kind == LinkedNodeKind.classTypeAlias)
- .map((node) {
- var name = context.getUnitMemberName(node);
+ _types = <ClassElement>[];
+ for (var node in linkedNode.declarations) {
+ String name;
+ if (node is ClassDeclaration) {
+ name = node.name.name;
+ } else if (node is ClassTypeAlias) {
+ name = node.name.name;
+ } else {
+ continue;
+ }
var reference = containerRef.getChild(name);
- reference.node = node;
- return ClassElementImpl.forLinkedNode(this, reference, node);
- }).toList();
- } else if (_unlinkedUnit != null) {
- _types ??= _unlinkedUnit.classes
+ if (reference.hasElementFor(node)) {
+ _types.add(reference.element);
+ } else {
+ _types.add(
+ ClassElementImpl.forLinkedNode(this, reference, node),
+ );
+ }
+ }
+ return _types;
+ }
+
+ if (_unlinkedUnit != null) {
+ return _types = _unlinkedUnit.classes
.map((c) => new ClassElementImpl.forSerialized(c, this))
.toList(growable: false);
}
+
return _types ?? const <ClassElement>[];
}
@@ -2101,9 +2169,12 @@
var variableList = <TopLevelVariableElementImpl>[];
variableMap[unit] = variableList;
- var variables = context.topLevelVariables(unit.linkedNode);
+ var unitNode = unit.linkedContext.unit_withDeclarations;
+ var unitDeclarations = unitNode.declarations;
+
+ var variables = context.topLevelVariables(unitNode);
for (var variable in variables) {
- var name = context.getVariableName(variable);
+ var name = variable.name.name;
var reference = unit.reference.getChild('@variable').getChild(name);
var variableElement = TopLevelVariableElementImpl.forLinkedNodeFactory(
unit,
@@ -2118,13 +2189,13 @@
}
}
- for (var node in unit.linkedNode.compilationUnit_declarations) {
- if (node.kind == LinkedNodeKind.functionDeclaration) {
- var isGetter = context.isGetterFunction(node);
- var isSetter = context.isSetterFunction(node);
+ for (var node in unitDeclarations) {
+ if (node is FunctionDeclaration) {
+ var isGetter = node.isGetter;
+ var isSetter = node.isSetter;
if (!isGetter && !isSetter) continue;
- var name = context.getUnitMemberName(node);
+ var name = node.name.name;
var containerRef = isGetter
? unit.reference.getChild('@getter')
: unit.reference.getChild('@setter');
@@ -2180,7 +2251,7 @@
ConstFieldElementImpl(String name, int offset) : super(name, offset);
ConstFieldElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created field element to have the given [name].
@@ -2202,7 +2273,7 @@
: super(enumElement);
ConstFieldElementImpl_EnumValue.forLinkedNode(EnumElementImpl enumElement,
- Reference reference, LinkedNode linkedNode, this._index)
+ Reference reference, AstNode linkedNode, this._index)
: _unlinkedEnumValue = null,
super.forLinkedNode(enumElement, reference, linkedNode);
@@ -2212,9 +2283,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.annotatedNode_comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (_unlinkedEnumValue != null) {
return _unlinkedEnumValue.documentationComment?.text;
@@ -2259,9 +2330,7 @@
@override
int get nameOffset {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getSimpleOffset(
- linkedNode.enumConstantDeclaration_name,
- );
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
int offset = super.nameOffset;
if (offset == -1) {
@@ -2320,7 +2389,7 @@
}
ConstFieldElementImpl_ofEnum.forLinkedNode(
- this._enum, Reference reference, LinkedNode linkedNode)
+ this._enum, Reference reference, AstNode linkedNode)
: super.forLinkedNode(_enum, reference, linkedNode);
@override
@@ -2399,8 +2468,8 @@
/// and [offset].
ConstructorElementImpl(String name, int offset) : super(name, offset);
- ConstructorElementImpl.forLinkedNode(Reference reference,
- LinkedNode linkedNode, ClassElementImpl enclosingClass)
+ ConstructorElementImpl.forLinkedNode(ClassElementImpl enclosingClass,
+ Reference reference, ConstructorDeclaration linkedNode)
: super.forLinkedNode(enclosingClass, reference, linkedNode);
/// Initialize a newly created constructor element to have the given [name].
@@ -2414,13 +2483,20 @@
/// Return the constant initializers for this element, which will be empty if
/// there are no initializers, or `null` if there was an error in the source.
List<ConstructorInitializer> get constantInitializers {
- if (_constantInitializers == null) {
- if (serializedExecutable != null) {
- _constantInitializers = serializedExecutable.constantInitializers
- .map((i) => _buildConstructorInitializer(i))
- .toList(growable: false);
- }
+ if (_constantInitializers != null) return _constantInitializers;
+
+ if (linkedNode != null) {
+ return _constantInitializers = linkedContext.getConstructorInitializers(
+ linkedNode,
+ );
}
+
+ if (serializedExecutable != null) {
+ return _constantInitializers = serializedExecutable.constantInitializers
+ .map((i) => _buildConstructorInitializer(i))
+ .toList(growable: false);
+ }
+
return _constantInitializers;
}
@@ -2455,7 +2531,8 @@
@override
bool get isConst {
if (linkedNode != null) {
- return linkedNode.constructorDeclaration_constKeyword != 0;
+ ConstructorDeclaration linkedNode = this.linkedNode;
+ return linkedNode.constKeyword != null;
}
if (serializedExecutable != null) {
return serializedExecutable.isConst;
@@ -2504,7 +2581,8 @@
@override
bool get isFactory {
if (linkedNode != null) {
- return linkedNode.constructorDeclaration_factoryKeyword != 0;
+ ConstructorDeclaration linkedNode = this.linkedNode;
+ return linkedNode.factoryKeyword != null;
}
if (serializedExecutable != null) {
return serializedExecutable.isFactory;
@@ -2560,22 +2638,39 @@
@override
ConstructorElement get redirectedConstructor {
- if (_redirectedConstructor == null) {
- if (serializedExecutable != null) {
- if (serializedExecutable.isRedirectedConstructor) {
- if (serializedExecutable.isFactory) {
- _redirectedConstructor = enclosingUnit.resynthesizerContext
- .resolveConstructorRef(enclosingElement,
- serializedExecutable.redirectedConstructor);
- } else {
- _redirectedConstructor = enclosingElement.getNamedConstructor(
- serializedExecutable.redirectedConstructorName);
+ if (_redirectedConstructor != null) return _redirectedConstructor;
+
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+ if (isFactory) {
+ var node = context.getConstructorRedirected(linkedNode);
+ return _redirectedConstructor = node?.staticElement;
+ } else {
+ var initializers = context.getConstructorInitializers(linkedNode);
+ for (var initializer in initializers) {
+ if (initializer is RedirectingConstructorInvocation) {
+ return _redirectedConstructor = initializer.staticElement;
}
- } else {
- return null;
}
}
+ return null;
}
+
+ if (serializedExecutable != null) {
+ if (serializedExecutable.isRedirectedConstructor) {
+ if (serializedExecutable.isFactory) {
+ _redirectedConstructor = enclosingUnit.resynthesizerContext
+ .resolveConstructorRef(
+ enclosingElement, serializedExecutable.redirectedConstructor);
+ } else {
+ _redirectedConstructor = enclosingElement.getNamedConstructor(
+ serializedExecutable.redirectedConstructorName);
+ }
+ } else {
+ return null;
+ }
+ }
+
return _redirectedConstructor;
}
@@ -2702,7 +2797,7 @@
: super(name, offset);
ConstTopLevelVariableElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created top-level variable element to have the given
@@ -2792,6 +2887,10 @@
DefaultFieldFormalParameterElementImpl(String name, int nameOffset)
: super(name, nameOffset);
+ DefaultFieldFormalParameterElementImpl.forLinkedNode(
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
+ : super.forLinkedNode(enclosing, reference, linkedNode);
+
/// Initialize a newly created parameter element to have the given [name].
DefaultFieldFormalParameterElementImpl.forNode(Identifier name)
: super.forNode(name);
@@ -2811,7 +2910,7 @@
: super(name, nameOffset);
DefaultParameterElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created parameter element to have the given [name].
@@ -2877,6 +2976,10 @@
/// literal.
static String _LITERAL_VARIABLE_NAME = "literal";
+ /// The name of the top-level variable used to mark a type as having
+ /// "optional" type arguments.
+ static String _OPTIONAL_TYPE_ARGS_VARIABLE_NAME = "optionalTypeArgs";
+
/// The name of the top-level variable used to mark a function as running
/// a single test.
static String _IS_TEST_VARIABLE_NAME = "isTest";
@@ -3026,6 +3129,12 @@
element.library?.name == _META_LIB_NAME;
@override
+ bool get isOptionalTypeArgs =>
+ element is PropertyAccessorElement &&
+ element.name == _OPTIONAL_TYPE_ARGS_VARIABLE_NAME &&
+ element.library?.name == _META_LIB_NAME;
+
+ @override
bool get isOverride =>
element is PropertyAccessorElement &&
element.name == _OVERRIDE_VARIABLE_NAME &&
@@ -3107,7 +3216,7 @@
ElementImpl _enclosingElement;
Reference reference;
- final LinkedNode linkedNode;
+ final AstNode linkedNode;
/// The name of this element.
String _name;
@@ -3149,7 +3258,7 @@
/// Initialize from linked node.
ElementImpl.forLinkedNode(
this._enclosingElement, this.reference, this.linkedNode) {
- reference?.element = this;
+ reference?.element ??= this;
}
/// Initialize a newly created element to have the given [name].
@@ -3297,6 +3406,30 @@
}
@override
+ bool get hasMustCallSuper {
+ var metadata = this.metadata;
+ for (var i = 0; i < metadata.length; i++) {
+ var annotation = metadata[i];
+ if (annotation.isMustCallSuper) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @override
+ bool get hasOptionalTypeArgs {
+ var metadata = this.metadata;
+ for (var i = 0; i < metadata.length; i++) {
+ var annotation = metadata[i];
+ if (annotation.isOptionalTypeArgs) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @override
bool get hasOverride {
var metadata = this.metadata;
for (var i = 0; i < metadata.length; i++) {
@@ -3431,6 +3564,10 @@
@override
Source get librarySource => library?.source;
+ LinkedUnitContext get linkedContext {
+ return _enclosingElement.linkedContext;
+ }
+
@override
ElementLocation get location {
if (_cachedLocation == null) {
@@ -3445,7 +3582,7 @@
List<ElementAnnotation> get metadata {
if (linkedNode != null) {
if (_metadata != null) return _metadata;
- var metadata = enclosingUnit.linkedContext.getMetadataOrEmpty(linkedNode);
+ var metadata = linkedContext.getMetadata(linkedNode);
return _metadata = _buildAnnotations2(enclosingUnit, metadata);
}
return _metadata ?? const <ElementAnnotation>[];
@@ -3659,7 +3796,7 @@
/// Return annotations for the given [nodeList] in the [unit].
List<ElementAnnotation> _buildAnnotations2(
- CompilationUnitElementImpl unit, List<LinkedNode> nodeList) {
+ CompilationUnitElementImpl unit, List<Annotation> nodeList) {
var length = nodeList.length;
if (length == 0) {
return const <ElementAnnotation>[];
@@ -3667,9 +3804,10 @@
var annotations = new List<ElementAnnotation>(length);
for (int i = 0; i < length; i++) {
- var ast = unit.linkedContext.readNode(nodeList[i]);
- annotations[i] = ElementAnnotationImpl(enclosingUnit)
- ..annotationAst = ast;
+ var ast = nodeList[i];
+ annotations[i] = ElementAnnotationImpl(unit)
+ ..annotationAst = ast
+ ..element = ast.element;
}
return annotations;
}
@@ -3861,7 +3999,7 @@
super(name, offset);
EnumElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
- Reference reference, LinkedNode linkedNode)
+ Reference reference, EnumDeclaration linkedNode)
: _unlinkedEnum = null,
super.forLinkedNode(enclosing, reference, linkedNode);
@@ -3904,6 +4042,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedEnum != null) {
return _unlinkedEnum.codeRange?.length;
}
@@ -3912,6 +4053,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedEnum != null) {
return _unlinkedEnum.codeRange?.offset;
}
@@ -3930,9 +4074,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.annotatedNode_comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (_unlinkedEnum != null) {
return _unlinkedEnum.documentationComment?.text;
@@ -4030,6 +4174,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedEnum != null && _unlinkedEnum.nameOffset != 0) {
return _unlinkedEnum.nameOffset;
@@ -4142,13 +4290,12 @@
}
// Build fields for all enum constants.
- var constants = linkedNode.enumDeclaration_constants;
+ var containerRef = this.reference.getChild('@constant');
+ var constants = linkedContext.getEnumConstants(linkedNode);
for (var i = 0; i < constants.length; ++i) {
var constant = constants[i];
- var name = enclosingUnit.linkedContext.getSimpleName(
- constant.enumConstantDeclaration_name,
- );
- var reference = this.reference.getChild('@constant').getChild(name);
+ var name = constant.name.name;
+ var reference = containerRef.getChild(name);
var field = new ConstFieldElementImpl_EnumValue.forLinkedNode(
this, reference, constant, i);
fields.add(field);
@@ -4189,11 +4336,9 @@
/// Initialize using the given linked node.
ExecutableElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: serializedExecutable = null,
- super.forLinkedNode(enclosing, reference, linkedNode) {
- reference.element = this;
- }
+ super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created executable element to have the given [name].
ExecutableElementImpl.forNode(Identifier name)
@@ -4213,6 +4358,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (serializedExecutable != null) {
return serializedExecutable.codeRange?.length;
}
@@ -4221,6 +4369,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (serializedExecutable != null) {
return serializedExecutable.codeRange?.offset;
}
@@ -4246,9 +4397,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.annotatedNode_comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (serializedExecutable != null) {
return serializedExecutable.documentationComment?.text;
@@ -4270,6 +4421,9 @@
@override
bool get hasImplicitReturnType {
+ if (linkedNode != null) {
+ return linkedContext.hasImplicitReturnType(linkedNode);
+ }
if (serializedExecutable != null) {
return serializedExecutable.returnType == null &&
serializedExecutable.kind != UnlinkedExecutableKind.constructor;
@@ -4285,6 +4439,9 @@
@override
bool get isAbstract {
+ if (linkedNode != null) {
+ return !isExternal && enclosingUnit.linkedContext.isAbstract(linkedNode);
+ }
if (serializedExecutable != null) {
return serializedExecutable.isAbstract;
}
@@ -4353,9 +4510,7 @@
@override
int get nameOffset {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getSimpleOffset(
- linkedNode.namedCompilationUnitMember_name,
- );
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
int offset = super.nameOffset;
@@ -4367,44 +4522,26 @@
@override
List<ParameterElement> get parameters {
- if (_parameters == null) {
- if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
- var containerRef = reference.getChild('@parameter');
- var formalParameters = context.getFormalParameters(linkedNode);
- if (formalParameters != null) {
- _parameters = formalParameters.map((node) {
- if (node.kind == LinkedNodeKind.defaultFormalParameter) {
- var parameterNode = node.defaultFormalParameter_parameter;
- var name = context.getFormalParameterName(parameterNode);
- var reference = containerRef.getChild(name);
- reference.node = node;
- return DefaultParameterElementImpl.forLinkedNode(
- this,
- reference,
- node,
- );
- } else {
- var name = context.getFormalParameterName(node);
- var reference = containerRef.getChild(name);
- reference.node = node;
- return ParameterElementImpl.forLinkedNodeFactory(
- this,
- reference,
- node,
- );
- }
- }).toList();
- } else {
- _parameters = const [];
- }
- }
- if (serializedExecutable != null) {
- _parameters = ParameterElementImpl.resynthesizeList(
- serializedExecutable.parameters, this);
- }
+ if (_parameters != null) return _parameters;
+
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+ var containerRef = reference.getChild('@parameter');
+ var formalParameters = context.getFormalParameters(linkedNode);
+ _parameters = ParameterElementImpl.forLinkedNodeList(
+ this,
+ context,
+ containerRef,
+ formalParameters,
+ );
}
- return _parameters ?? const <ParameterElement>[];
+
+ if (serializedExecutable != null) {
+ _parameters = ParameterElementImpl.resynthesizeList(
+ serializedExecutable.parameters, this);
+ }
+
+ return _parameters ??= const <ParameterElement>[];
}
/// Set the parameters defined by this executable element to the given
@@ -4420,8 +4557,9 @@
@override
DartType get returnType {
if (linkedNode != null) {
- return _returnType ??=
- enclosingUnit.linkedContext.getReturnType(linkedNode);
+ if (_returnType != null) return _returnType;
+ var context = enclosingUnit.linkedContext;
+ return _returnType = context.getReturnType(linkedNode);
}
if (serializedExecutable != null &&
_declaredReturnType == null &&
@@ -4438,6 +4576,9 @@
}
void set returnType(DartType returnType) {
+ if (linkedNode != null) {
+ linkedContext.setReturnType(linkedNode, returnType);
+ }
_assertNotResynthesized(serializedExecutable);
_returnType = _checkElementOfType(returnType);
}
@@ -4480,19 +4621,19 @@
buffer.write('<');
for (int i = 0; i < typeParameterCount; i++) {
if (i > 0) {
- buffer.write(", ");
+ buffer.write(', ');
}
(typeParameters[i] as TypeParameterElementImpl).appendTo(buffer);
}
buffer.write('>');
}
- buffer.write("(");
+ buffer.write('(');
String closing = null;
ParameterKind kind = ParameterKind.REQUIRED;
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- buffer.write(", ");
+ buffer.write(', ');
}
ParameterElement parameter = parameters[i];
// ignore: deprecated_member_use_from_same_package
@@ -4501,12 +4642,15 @@
if (closing != null) {
buffer.write(closing);
}
- if (parameterKind == ParameterKind.POSITIONAL) {
- buffer.write("[");
- closing = "]";
- } else if (parameterKind == ParameterKind.NAMED) {
- buffer.write("{");
- closing = "}";
+ if (parameter.isOptionalPositional) {
+ buffer.write('[');
+ closing = ']';
+ } else if (parameter.isNamed) {
+ buffer.write('{');
+ if (parameter.isRequiredNamed) {
+ buffer.write('required ');
+ }
+ closing = '}';
} else {
closing = null;
}
@@ -4517,7 +4661,7 @@
if (closing != null) {
buffer.write(closing);
}
- buffer.write(")");
+ buffer.write(')');
}
if (type != null) {
buffer.write(ElementImpl.RIGHT_ARROW);
@@ -4570,6 +4714,12 @@
_unlinkedExportNonPublic = null,
super(null, offset);
+ ExportElementImpl.forLinkedNode(
+ LibraryElementImpl enclosing, ExportDirective linkedNode)
+ : _unlinkedExportPublic = null,
+ _unlinkedExportNonPublic = null,
+ super.forLinkedNode(enclosing, null, linkedNode);
+
/// Initialize using the given serialized information.
ExportElementImpl.forSerialized(this._unlinkedExportPublic,
this._unlinkedExportNonPublic, LibraryElementImpl enclosingLibrary)
@@ -4577,12 +4727,21 @@
@override
List<NamespaceCombinator> get combinators {
- if (_combinators == null) {
- if (_unlinkedExportPublic != null) {
- _combinators = ImportElementImpl._buildCombinators(
- _unlinkedExportPublic.combinators);
- }
+ if (_combinators != null) return _combinators;
+
+ if (linkedNode != null) {
+ ExportDirective node = linkedNode;
+ return _combinators = ImportElementImpl._buildCombinators2(
+ enclosingUnit.linkedContext,
+ node.combinators,
+ );
}
+
+ if (_unlinkedExportPublic != null) {
+ return _combinators = ImportElementImpl._buildCombinators(
+ _unlinkedExportPublic.combinators);
+ }
+
return _combinators ?? const <NamespaceCombinator>[];
}
@@ -4592,14 +4751,24 @@
}
@override
+ CompilationUnitElementImpl get enclosingUnit {
+ LibraryElementImpl enclosingLibrary = enclosingElement;
+ return enclosingLibrary._definingCompilationUnit;
+ }
+
+ @override
LibraryElement get exportedLibrary {
- if (_exportedLibrary == null) {
- if (_unlinkedExportNonPublic != null) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- _exportedLibrary =
- library.resynthesizerContext.buildExportedLibrary(uri);
- }
+ if (_exportedLibrary != null) return _exportedLibrary;
+
+ if (linkedNode != null) {
+ return _exportedLibrary = linkedContext.directiveLibrary(linkedNode);
}
+
+ if (_unlinkedExportNonPublic != null) {
+ LibraryElementImpl library = enclosingElement as LibraryElementImpl;
+ _exportedLibrary = library.resynthesizerContext.buildExportedLibrary(uri);
+ }
+
return _exportedLibrary;
}
@@ -4632,6 +4801,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return linkedContext.getDirectiveOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedExportNonPublic != null) {
return _unlinkedExportNonPublic.offset;
@@ -4700,7 +4873,7 @@
FieldElementImpl(String name, int offset) : super(name, offset);
FieldElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode) {
if (!linkedNode.isSynthetic) {
var enclosingRef = enclosing.reference;
@@ -4720,8 +4893,9 @@
}
factory FieldElementImpl.forLinkedNodeFactory(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode) {
- if (enclosing.enclosingUnit.linkedContext.isConst(linkedNode)) {
+ ClassElementImpl enclosing, Reference reference, AstNode linkedNode) {
+ var context = enclosing.enclosingUnit.linkedContext;
+ if (context.shouldBeConstFieldElement(linkedNode)) {
return ConstFieldElementImpl.forLinkedNode(
enclosing,
reference,
@@ -4760,9 +4934,14 @@
@override
bool get isCovariant {
+ if (linkedNode != null) {
+ return linkedContext.isExplicitlyCovariant(linkedNode);
+ }
+
if (_unlinkedVariable != null) {
return _unlinkedVariable.isCovariant;
}
+
return hasModifier(Modifier.COVARIANT);
}
@@ -4827,7 +5006,7 @@
: super(name, nameOffset);
FieldFormalParameterElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created parameter element to have the given [name].
@@ -4843,6 +5022,9 @@
FieldElement get field {
if (_field == null) {
String fieldName;
+ if (linkedNode != null) {
+ fieldName = linkedContext.getFieldFormalParameterName(linkedNode);
+ }
if (unlinkedParam != null) {
fieldName = unlinkedParam.name;
}
@@ -4872,11 +5054,6 @@
@override
DartType get type {
- if (linkedNode != null) {
- return _type ??= enclosingUnit.linkedContext.getType(
- linkedNode.fieldFormalParameter_type2,
- );
- }
if (unlinkedParam != null &&
unlinkedParam.type == null &&
!unlinkedParam.isFunctionTyped &&
@@ -4911,9 +5088,9 @@
/// [offset].
FunctionElementImpl(String name, int offset) : super(name, offset);
- FunctionElementImpl.forLinkedNode(CompilationUnitElementImpl enclosingUnit,
- Reference reference, LinkedNode linkedNode)
- : super.forLinkedNode(enclosingUnit, reference, linkedNode);
+ FunctionElementImpl.forLinkedNode(ElementImpl enclosing, Reference reference,
+ FunctionDeclaration linkedNode)
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created function element to have the given [name].
FunctionElementImpl.forNode(Identifier name) : super.forNode(name);
@@ -4940,6 +5117,14 @@
}
@override
+ String get displayName {
+ if (linkedNode != null) {
+ return reference.name;
+ }
+ return super.displayName;
+ }
+
+ @override
TypeParameterizedElementMixin get enclosingTypeParameterContext {
return (enclosingElement as ElementImpl).typeParameterContext;
}
@@ -4966,13 +5151,11 @@
ElementKind get kind => ElementKind.FUNCTION;
@override
- DartType get returnType {
+ String get name {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getType(
- linkedNode.functionDeclaration_returnType2,
- );
+ return reference.name;
}
- return super.returnType;
+ return super.name;
}
@override
@@ -5143,6 +5326,10 @@
/// The type defined by this element.
FunctionType _type;
+ GenericFunctionTypeElementImpl.forLinkedNode(
+ ElementImpl enclosingElement, Reference reference, AstNode linkedNode)
+ : super.forLinkedNode(enclosingElement, reference, linkedNode);
+
/// Initialize a newly created function element to have no name and the given
/// [nameOffset]. This is used for function expressions, that have no name.
GenericFunctionTypeElementImpl.forOffset(int nameOffset)
@@ -5167,6 +5354,15 @@
@override
List<ParameterElement> get parameters {
if (_parameters == null) {
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+ return _parameters = ParameterElementImpl.forLinkedNodeList(
+ this,
+ context,
+ reference.getChild('@parameter'),
+ context.getFormalParameters(linkedNode),
+ );
+ }
if (_entityRef != null) {
_parameters = ParameterElementImpl.resynthesizeList(
_entityRef.syntheticParams, this);
@@ -5188,6 +5384,10 @@
@override
DartType get returnType {
if (_returnType == null) {
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+ return _returnType = context.getReturnType(linkedNode);
+ }
if (_entityRef != null) {
_returnType = enclosingUnit.resynthesizerContext.resolveTypeRef(
this, _entityRef.syntheticReturnType,
@@ -5217,6 +5417,16 @@
_type = type;
}
+ @override
+ List<TypeParameterElement> get typeParameters {
+ if (linkedNode != null) {
+ if (linkedNode is FunctionTypeAlias) {
+ return const <TypeParameterElement>[];
+ }
+ }
+ return super.typeParameters;
+ }
+
/// Set the type parameters defined by this function type element to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
@@ -5300,7 +5510,7 @@
GenericTypeAliasElementImpl.forLinkedNode(
CompilationUnitElementImpl enclosingUnit,
Reference reference,
- LinkedNode linkedNode)
+ AstNode linkedNode)
: _unlinkedTypedef = null,
super.forLinkedNode(enclosingUnit, reference, linkedNode);
@@ -5316,6 +5526,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedTypedef != null) {
return _unlinkedTypedef.codeRange?.length;
}
@@ -5324,6 +5537,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedTypedef != null) {
return _unlinkedTypedef.codeRange?.offset;
}
@@ -5336,9 +5552,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.annotatedNode_comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (_unlinkedTypedef != null) {
return _unlinkedTypedef.documentationComment?.text;
@@ -5362,25 +5578,26 @@
if (_function != null) return _function;
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
- _function = new GenericFunctionTypeElementImpl.forOffset(-1);
- _function.enclosingElement = this;
- _function.returnType = context.getType(
- linkedNode.functionTypeAlias_returnType2,
- );
- var containerRef = reference.getChild('@parameter');
- var formalParameters = context.getFormalParameters(linkedNode);
- _function.parameters = formalParameters.map((node) {
- var name = context.getFormalParameterName(node);
- var reference = containerRef.getChild(name);
- reference.node = node;
- return ParameterElementImpl.forLinkedNodeFactory(
+ if (linkedNode is GenericTypeAlias) {
+ var context = enclosingUnit.linkedContext;
+ var function = context.getGeneticTypeAliasFunction(linkedNode);
+ if (function != null) {
+ var reference = context.getGenericFunctionTypeReference(function);
+ return _function = GenericFunctionTypeElementImpl.forLinkedNode(
+ this,
+ reference,
+ function,
+ );
+ } else {
+ return null;
+ }
+ } else {
+ return _function = GenericFunctionTypeElementImpl.forLinkedNode(
this,
- reference,
- node,
+ reference.getChild('@function'),
+ linkedNode,
);
- }).toList();
- return _function;
+ }
}
if (_unlinkedTypedef != null) {
@@ -5419,6 +5636,21 @@
_function = function;
}
+ bool get hasSelfReference {
+ if (linkedNode != null) {
+ return linkedContext.getHasTypedefSelfReference(linkedNode);
+ }
+ return false;
+ }
+
+ @override
+ bool get isSimplyBounded {
+ if (linkedNode != null) {
+ return linkedContext.isSimplyBounded(linkedNode);
+ }
+ return super.isSimplyBounded;
+ }
+
@override
ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
@@ -5444,6 +5676,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedTypedef != null) {
return _unlinkedTypedef.nameOffset;
@@ -5579,20 +5815,38 @@
/// The unlinked representation of the combinator in the summary.
final UnlinkedCombinator _unlinkedCombinator;
+ final LinkedUnitContext linkedContext;
+ final HideCombinator linkedNode;
+
/// The names that are not to be made visible in the importing library even if
/// they are defined in the imported library.
List<String> _hiddenNames;
- HideElementCombinatorImpl() : _unlinkedCombinator = null;
+ HideElementCombinatorImpl()
+ : _unlinkedCombinator = null,
+ linkedContext = null,
+ linkedNode = null;
+
+ HideElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode)
+ : _unlinkedCombinator = null;
/// Initialize using the given serialized information.
- HideElementCombinatorImpl.forSerialized(this._unlinkedCombinator);
+ HideElementCombinatorImpl.forSerialized(this._unlinkedCombinator)
+ : linkedContext = null,
+ linkedNode = null;
@override
List<String> get hiddenNames {
- if (_unlinkedCombinator != null) {
- _hiddenNames ??= _unlinkedCombinator.hides.toList(growable: false);
+ if (_hiddenNames != null) return _hiddenNames;
+
+ if (linkedNode != null) {
+ return _hiddenNames = linkedNode.hiddenNames.map((i) => i.name).toList();
}
+
+ if (_unlinkedCombinator != null) {
+ return _hiddenNames = _unlinkedCombinator.hides.toList(growable: false);
+ }
+
return _hiddenNames ?? const <String>[];
}
@@ -5654,7 +5908,7 @@
super(null, offset);
ImportElementImpl.forLinkedNode(
- LibraryElementImpl enclosing, LinkedNode linkedNode)
+ LibraryElementImpl enclosing, ImportDirective linkedNode)
: _unlinkedImport = null,
_linkedDependency = null,
super.forLinkedNode(enclosing, null, linkedNode);
@@ -5666,11 +5920,20 @@
@override
List<NamespaceCombinator> get combinators {
- if (_combinators == null) {
- if (_unlinkedImport != null) {
- _combinators = _buildCombinators(_unlinkedImport.combinators);
- }
+ if (_combinators != null) return _combinators;
+
+ if (linkedNode != null) {
+ ImportDirective node = linkedNode;
+ return _combinators = ImportElementImpl._buildCombinators2(
+ enclosingUnit.linkedContext,
+ node.combinators,
+ );
}
+
+ if (_unlinkedImport != null) {
+ return _combinators = _buildCombinators(_unlinkedImport.combinators);
+ }
+
return _combinators ?? const <NamespaceCombinator>[];
}
@@ -5699,15 +5962,9 @@
if (_importedLibrary != null) return _importedLibrary;
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
- var relativeUriStr = context.getStringContent(
- linkedNode.uriBasedDirective_uri,
- );
- var relativeUri = Uri.parse(relativeUriStr);
- var uri = resolveRelativeUri(librarySource.uri, relativeUri);
- var elementFactory = context.bundleContext.elementFactory;
- return _importedLibrary = elementFactory.libraryOfUri('$uri');
+ return _importedLibrary = linkedContext.directiveLibrary(linkedNode);
}
+
if (_linkedDependency != null) {
if (_importedLibrary == null) {
LibraryElementImpl library = enclosingElement as LibraryElementImpl;
@@ -5719,6 +5976,7 @@
}
}
}
+
return _importedLibrary;
}
@@ -5729,6 +5987,10 @@
@override
bool get isDeferred {
+ if (linkedNode != null) {
+ ImportDirective linkedNode = this.linkedNode;
+ return linkedNode.deferredKeyword != null;
+ }
if (_unlinkedImport != null) {
return _unlinkedImport.isDeferred;
}
@@ -5748,11 +6010,6 @@
@override
List<ElementAnnotation> get metadata {
- if (linkedNode != null) {
- if (_metadata != null) return _metadata;
- var metadata = enclosingUnit.linkedContext.getMetadataOrEmpty(linkedNode);
- return _metadata = _buildAnnotations2(enclosingUnit, metadata);
- }
if (_metadata == null) {
if (_unlinkedImport != null) {
return _metadata = _buildAnnotations(
@@ -5769,6 +6026,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return linkedContext.getDirectiveOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedImport != null) {
if (_unlinkedImport.isImplicit) {
@@ -5786,12 +6047,27 @@
}
PrefixElement get prefix {
- if (_prefix == null) {
- if (_unlinkedImport != null && _unlinkedImport.prefixReference != 0) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- _prefix = new PrefixElementImpl.forSerialized(_unlinkedImport, library);
+ if (_prefix != null) return _prefix;
+
+ if (linkedNode != null) {
+ ImportDirective linkedNode = this.linkedNode;
+ var prefix = linkedNode.prefix;
+ if (prefix != null) {
+ var name = prefix.name;
+ var library = enclosingElement as LibraryElementImpl;
+ _prefix = new PrefixElementImpl.forLinkedNode(
+ library,
+ library.reference.getChild('@prefix').getChild(name),
+ prefix,
+ );
}
}
+
+ if (_unlinkedImport != null && _unlinkedImport.prefixReference != 0) {
+ LibraryElementImpl library = enclosingElement as LibraryElementImpl;
+ _prefix = new PrefixElementImpl.forSerialized(_unlinkedImport, library);
+ }
+
return _prefix;
}
@@ -5897,6 +6173,19 @@
return const <NamespaceCombinator>[];
}
}
+
+ static List<NamespaceCombinator> _buildCombinators2(
+ LinkedUnitContext context, List<Combinator> combinators) {
+ return combinators.map((node) {
+ if (node is HideCombinator) {
+ return HideElementCombinatorImpl.forLinkedNode(context, node);
+ }
+ if (node is ShowCombinator) {
+ return ShowElementCombinatorImpl.forLinkedNode(context, node);
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }).toList();
+ }
}
/// A concrete implementation of a [LabelElement].
@@ -6028,12 +6317,16 @@
this.nameLength,
this.linkedContext,
Reference reference,
- LinkedNode linkedNode)
+ CompilationUnit linkedNode)
: resynthesizerContext = null,
unlinkedDefiningUnit = null,
super.forLinkedNode(null, reference, linkedNode) {
_name = name;
_nameOffset = offset;
+ setResolutionCapability(
+ LibraryResolutionCapability.resolvedTypeNames, true);
+ setResolutionCapability(
+ LibraryResolutionCapability.constantExpressions, true);
}
/// Initialize a newly created library element in the given [context] to have
@@ -6096,6 +6389,10 @@
@override
String get documentationComment {
+ if (linkedNode != null) {
+ var comment = linkedContext.getLibraryDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
+ }
if (unlinkedDefiningUnit != null) {
return unlinkedDefiningUnit.libraryDocumentationComment?.text;
}
@@ -6103,9 +6400,21 @@
}
FunctionElement get entryPoint {
- if (resynthesizerContext != null) {
- _entryPoint ??= resynthesizerContext.findEntryPoint();
+ if (_entryPoint != null) return _entryPoint;
+
+ if (linkedContext != null) {
+ var namespace = library.exportNamespace;
+ var entryPoint = namespace.get(FunctionElement.MAIN_FUNCTION_NAME);
+ if (entryPoint is FunctionElement) {
+ return _entryPoint = entryPoint;
+ }
+ return null;
}
+
+ if (resynthesizerContext != null) {
+ return _entryPoint = resynthesizerContext.findEntryPoint();
+ }
+
return _entryPoint;
}
@@ -6127,9 +6436,17 @@
@override
Namespace get exportNamespace {
+ if (_exportNamespace != null) return _exportNamespace;
+
+ if (linkedNode != null) {
+ var elements = linkedContext.bundleContext.elementFactory;
+ return _exportNamespace = elements.buildExportNamespace(source.uri);
+ }
+
if (resynthesizerContext != null) {
_exportNamespace ??= resynthesizerContext.buildExportNamespace();
}
+
return _exportNamespace;
}
@@ -6139,34 +6456,42 @@
@override
List<ExportElement> get exports {
- if (_exports == null) {
- if (unlinkedDefiningUnit != null) {
- List<UnlinkedExportNonPublic> unlinkedNonPublicExports =
- unlinkedDefiningUnit.exports;
- List<UnlinkedExportPublic> unlinkedPublicExports =
- unlinkedDefiningUnit.publicNamespace.exports;
- assert(unlinkedDefiningUnit.exports.length ==
- unlinkedPublicExports.length);
- int length = unlinkedNonPublicExports.length;
- if (length != 0) {
- List<ExportElement> exports = new List<ExportElement>();
- for (int i = 0; i < length; i++) {
- UnlinkedExportPublic serializedExportPublic =
- unlinkedPublicExports[i];
- UnlinkedExportNonPublic serializedExportNonPublic =
- unlinkedNonPublicExports[i];
- ExportElementImpl exportElement =
- new ExportElementImpl.forSerialized(
- serializedExportPublic, serializedExportNonPublic, library);
- exports.add(exportElement);
- }
- _exports = exports;
- } else {
- _exports = const <ExportElement>[];
+ if (_exports != null) return _exports;
+
+ if (linkedNode != null) {
+ var unit = linkedContext.unit_withDirectives;
+ return _exports = unit.directives
+ .whereType<ExportDirective>()
+ .map((node) => ExportElementImpl.forLinkedNode(this, node))
+ .toList();
+ }
+
+ if (unlinkedDefiningUnit != null) {
+ List<UnlinkedExportNonPublic> unlinkedNonPublicExports =
+ unlinkedDefiningUnit.exports;
+ List<UnlinkedExportPublic> unlinkedPublicExports =
+ unlinkedDefiningUnit.publicNamespace.exports;
+ assert(
+ unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length);
+ int length = unlinkedNonPublicExports.length;
+ if (length != 0) {
+ List<ExportElement> exports = new List<ExportElement>();
+ for (int i = 0; i < length; i++) {
+ UnlinkedExportPublic serializedExportPublic =
+ unlinkedPublicExports[i];
+ UnlinkedExportNonPublic serializedExportNonPublic =
+ unlinkedNonPublicExports[i];
+ ExportElementImpl exportElement = new ExportElementImpl.forSerialized(
+ serializedExportPublic, serializedExportNonPublic, library);
+ exports.add(exportElement);
}
+ _exports = exports;
+ } else {
+ _exports = const <ExportElement>[];
}
}
- return _exports ?? const <ExportElement>[];
+
+ return _exports ??= const <ExportElement>[];
}
/// Set the specifications of all of the exports defined in this library to
@@ -6181,6 +6506,19 @@
@override
bool get hasExtUri {
+ if (linkedNode != null) {
+ var unit = linkedContext.unit_withDirectives;
+ for (var import in unit.directives) {
+ if (import is ImportDirective) {
+ var uriStr = linkedContext.getSelectedUri(import);
+ if (DartUriResolver.isDartExtUri(uriStr)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
if (unlinkedDefiningUnit != null) {
List<UnlinkedImport> unlinkedImports = unlinkedDefiningUnit.imports;
for (UnlinkedImport import in unlinkedImports) {
@@ -6228,20 +6566,32 @@
@override
List<ImportElement> get imports {
- if (_imports == null) {
- if (linkedNode != null) {
- return _imports = linkedNode.compilationUnit_directives
- .where((node) => node.kind == LinkedNodeKind.importDirective)
- .map((node) {
- return ImportElementImpl.forLinkedNode(this, node);
- }).toList();
+ if (_imports != null) return _imports;
+
+ if (linkedNode != null) {
+ var unit = linkedContext.unit_withDirectives;
+ _imports = unit.directives
+ .whereType<ImportDirective>()
+ .map((node) => ImportElementImpl.forLinkedNode(this, node))
+ .toList();
+ var hasCore = _imports.any((import) {
+ return import.importedLibrary?.isDartCore ?? false;
+ });
+ if (!hasCore) {
+ var elements = linkedContext.bundleContext.elementFactory;
+ _imports.add(ImportElementImpl(-1)
+ ..importedLibrary = elements.libraryOfUri('dart:core')
+ ..isSynthetic = true);
}
- if (unlinkedDefiningUnit != null) {
- _imports = buildImportsFromSummary(this, unlinkedDefiningUnit.imports,
- resynthesizerContext.linkedLibrary.importDependencies);
- }
+ return _imports;
}
- return _imports ?? const <ImportElement>[];
+
+ if (unlinkedDefiningUnit != null) {
+ _imports = buildImportsFromSummary(this, unlinkedDefiningUnit.imports,
+ resynthesizerContext.linkedLibrary.importDependencies);
+ }
+
+ return _imports ??= const <ImportElement>[];
}
/// Set the specifications of all of the imports defined in this library to
@@ -6310,6 +6660,14 @@
}
@override
+ bool get isSynthetic {
+ if (linkedNode != null) {
+ return linkedContext.isSynthetic;
+ }
+ return super.isSynthetic;
+ }
+
+ @override
ElementKind get kind => ElementKind.LIBRARY;
@override
@@ -6403,21 +6761,19 @@
@override
List<ElementAnnotation> get metadata {
+ if (_metadata != null) return _metadata;
+
if (linkedNode != null) {
- if (_metadata != null) return _metadata;
- CompilationUnitElementImpl enclosingUnit = _definingCompilationUnit;
- var context = enclosingUnit.linkedContext;
- var metadata = context.getMetadataOrEmpty(linkedNode);
- return _metadata = _buildAnnotations2(enclosingUnit, metadata);
+ var metadata = linkedContext.getLibraryMetadata(linkedNode);
+ return _metadata = _buildAnnotations2(definingCompilationUnit, metadata);
}
- if (_metadata == null) {
- if (unlinkedDefiningUnit != null) {
- _metadata = _buildAnnotations(
- _definingCompilationUnit as CompilationUnitElementImpl,
- unlinkedDefiningUnit.libraryAnnotations);
- return _metadata;
- }
+
+ if (unlinkedDefiningUnit != null) {
+ return _metadata = _buildAnnotations(
+ _definingCompilationUnit as CompilationUnitElementImpl,
+ unlinkedDefiningUnit.libraryAnnotations);
}
+
return super.metadata;
}
@@ -6441,8 +6797,15 @@
@override
Namespace get publicNamespace {
+ if (_publicNamespace != null) return _publicNamespace;
+
+ if (linkedNode != null) {
+ return _publicNamespace =
+ NamespaceBuilder().createPublicNamespaceForLibrary(this);
+ }
+
if (resynthesizerContext != null) {
- _publicNamespace ??= resynthesizerContext.buildPublicNamespace();
+ return _publicNamespace = resynthesizerContext.buildPublicNamespace();
}
return _publicNamespace;
}
@@ -6748,6 +7111,17 @@
}
@override
+ bool get isLate {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.isLate(linkedNode);
+ }
+ if (_unlinkedVariable != null) {
+ return _unlinkedVariable.isLate;
+ }
+ return hasModifier(Modifier.LATE);
+ }
+
+ @override
bool get isPotentiallyMutatedInClosure => true;
@override
@@ -6794,8 +7168,8 @@
/// given [offset].
MethodElementImpl(String name, int offset) : super(name, offset);
- MethodElementImpl.forLinkedNode(Reference reference, LinkedNode linkedNode,
- ClassElementImpl enclosingClass)
+ MethodElementImpl.forLinkedNode(ClassElementImpl enclosingClass,
+ Reference reference, MethodDeclaration linkedNode)
: super.forLinkedNode(enclosingClass, reference, linkedNode);
/// Initialize a newly created method element to have the given [name].
@@ -6829,14 +7203,6 @@
super.enclosingElement as ClassElementImpl;
@override
- bool get isAbstract {
- if (linkedNode != null) {
- return !isExternal && enclosingUnit.linkedContext.isAbstract(linkedNode);
- }
- return super.isAbstract;
- }
-
- @override
bool get isOperator {
String name = displayName;
if (name.isEmpty) {
@@ -6852,7 +7218,7 @@
@override
bool get isStatic {
if (linkedNode != null) {
- return linkedNode.methodDeclaration_modifierKeyword != 0;
+ return enclosingUnit.linkedContext.isStatic(linkedNode);
}
if (serializedExecutable != null) {
return serializedExecutable.isStatic;
@@ -6879,16 +7245,6 @@
}
@override
- DartType get returnType {
- if (linkedNode != null) {
- return enclosingUnit.linkedContext.getType(
- linkedNode.methodDeclaration_returnType2,
- );
- }
- return super.returnType;
- }
-
- @override
T accept<T>(ElementVisitor<T> visitor) => visitor.visitMethodElement(this);
@override
@@ -6954,6 +7310,10 @@
/// given [offset] in the file that contains the declaration of this element.
MixinElementImpl(String name, int offset) : super(name, offset);
+ MixinElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
+ Reference reference, MixinDeclaration linkedNode)
+ : super.forLinkedNode(enclosing, reference, linkedNode);
+
/// Initialize a newly created class element to have the given [name].
MixinElementImpl.forNode(Identifier name) : super.forNode(name);
@@ -6969,24 +7329,43 @@
bool get isMixin => true;
@override
+ List<InterfaceType> get mixins => const <InterfaceType>[];
+
+ @override
List<InterfaceType> get superclassConstraints {
- if (_superclassConstraints == null) {
- if (_unlinkedClass != null) {
- List<InterfaceType> constraints;
- if (_unlinkedClass.superclassConstraints.isNotEmpty) {
- ResynthesizerContext context = enclosingUnit.resynthesizerContext;
- constraints = _unlinkedClass.superclassConstraints
- .map((EntityRef t) => context.resolveTypeRef(this, t))
- .where(_isInterfaceTypeInterface)
- .cast<InterfaceType>()
- .toList(growable: false);
- }
- if (constraints == null || constraints.isEmpty) {
- constraints = [context.typeProvider.objectType];
- }
- _superclassConstraints = constraints;
+ if (_superclassConstraints != null) return _superclassConstraints;
+
+ if (linkedNode != null) {
+ List<InterfaceType> constraints;
+ var onClause = enclosingUnit.linkedContext.getOnClause(linkedNode);
+ if (onClause != null) {
+ constraints = onClause.superclassConstraints
+ .map((node) => node.type)
+ .whereType<InterfaceType>()
+ .toList();
}
+ if (constraints == null || constraints.isEmpty) {
+ constraints = [context.typeProvider.objectType];
+ }
+ return _superclassConstraints = constraints;
}
+
+ if (_unlinkedClass != null) {
+ List<InterfaceType> constraints;
+ if (_unlinkedClass.superclassConstraints.isNotEmpty) {
+ ResynthesizerContext context = enclosingUnit.resynthesizerContext;
+ constraints = _unlinkedClass.superclassConstraints
+ .map((EntityRef t) => context.resolveTypeRef(this, t))
+ .where(_isInterfaceTypeInterface)
+ .cast<InterfaceType>()
+ .toList(growable: false);
+ }
+ if (constraints == null || constraints.isEmpty) {
+ constraints = [context.typeProvider.objectType];
+ }
+ return _superclassConstraints = constraints;
+ }
+
return _superclassConstraints ?? const <InterfaceType>[];
}
@@ -7002,11 +7381,17 @@
@override
List<String> get superInvokedNames {
- if (_superInvokedNames == null) {
- if (_unlinkedClass != null) {
- _superInvokedNames = _unlinkedClass.superInvokedNames;
- }
+ if (_superInvokedNames != null) return _superInvokedNames;
+
+ if (linkedNode != null) {
+ return _superInvokedNames =
+ linkedContext.getMixinSuperInvokedNames(linkedNode);
}
+
+ if (_unlinkedClass != null) {
+ return _superInvokedNames = _unlinkedClass.superInvokedNames;
+ }
+
return _superInvokedNames ?? const <String>[];
}
@@ -7107,25 +7492,28 @@
/// type being referred to is the return type.
static const Modifier IMPLICIT_TYPE = const Modifier('IMPLICIT_TYPE', 12);
+ /// Indicates that modifier 'lazy' was applied to the element.
+ static const Modifier LATE = const Modifier('LATE', 13);
+
/// Indicates that a class is a mixin application.
static const Modifier MIXIN_APPLICATION =
- const Modifier('MIXIN_APPLICATION', 13);
+ const Modifier('MIXIN_APPLICATION', 14);
/// Indicates that a class contains an explicit reference to 'super'.
static const Modifier REFERENCES_SUPER =
- const Modifier('REFERENCES_SUPER', 14);
+ const Modifier('REFERENCES_SUPER', 15);
/// Indicates that the pseudo-modifier 'set' was applied to the element.
- static const Modifier SETTER = const Modifier('SETTER', 15);
+ static const Modifier SETTER = const Modifier('SETTER', 16);
/// Indicates that the modifier 'static' was applied to the element.
- static const Modifier STATIC = const Modifier('STATIC', 16);
+ static const Modifier STATIC = const Modifier('STATIC', 17);
/// Indicates that the element does not appear in the source code but was
/// implicitly created. For example, if a class does not define any
/// constructors, an implicit zero-argument constructor will be created and it
/// will be marked as being synthetic.
- static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 17);
+ static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 18);
static const List<Modifier> values = const [
ABSTRACT,
@@ -7141,6 +7529,7 @@
GETTER,
HAS_EXT_URI,
IMPLICIT_TYPE,
+ LATE,
MIXIN_APPLICATION,
REFERENCES_SUPER,
SETTER,
@@ -7221,6 +7610,12 @@
bool get hasLiteral => false;
@override
+ bool get hasMustCallSuper => false;
+
+ @override
+ bool get hasOptionalTypeArgs => false;
+
+ @override
bool get hasOverride => false;
@override
@@ -7417,6 +7812,30 @@
}
}
+/// The synthetic element representing the declaration of the type `Never`.
+class NeverElementImpl extends ElementImpl implements TypeDefiningElement {
+ /// Return the unique instance of this class.
+ static NeverElementImpl get instance =>
+ BottomTypeImpl.instance.element as NeverElementImpl;
+
+ @override
+ BottomTypeImpl type;
+
+ /// Initialize a newly created instance of this class. Instances of this class
+ /// should <b>not</b> be created except as part of creating the type
+ /// associated with this element. The single instance of this class should be
+ /// accessed through the method [instance].
+ NeverElementImpl() : super('Never', -1) {
+ setModifier(Modifier.SYNTHETIC, true);
+ }
+
+ @override
+ ElementKind get kind => ElementKind.NEVER;
+
+ @override
+ T accept<T>(ElementVisitor<T> visitor) => null;
+}
+
/// A [VariableElementImpl], which is not a parameter.
abstract class NonParameterVariableElementImpl extends VariableElementImpl {
/// The unlinked representation of the variable in the summary.
@@ -7429,7 +7848,7 @@
super(name, offset);
NonParameterVariableElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: _unlinkedVariable = null,
super.forLinkedNode(enclosing, reference, linkedNode);
@@ -7445,6 +7864,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedVariable != null) {
return _unlinkedVariable.codeRange?.length;
}
@@ -7453,6 +7875,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedVariable != null) {
return _unlinkedVariable.codeRange?.offset;
}
@@ -7462,9 +7887,9 @@
@override
String get documentationComment {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getCommentText(
- linkedNode.variableDeclaration_declaration.comment,
- );
+ var context = enclosingUnit.linkedContext;
+ var comment = context.getDocumentationComment(linkedNode);
+ return getCommentNodeRawText(comment);
}
if (_unlinkedVariable != null) {
return _unlinkedVariable.documentationComment?.text;
@@ -7474,6 +7899,9 @@
@override
bool get hasImplicitType {
+ if (linkedNode != null) {
+ return linkedContext.hasImplicitType(linkedNode);
+ }
if (_unlinkedVariable != null) {
return _unlinkedVariable.type == null;
}
@@ -7489,6 +7917,11 @@
@override
FunctionElement get initializer {
if (_initializer == null) {
+ if (linkedNode != null) {
+ if (linkedContext.readInitializer(linkedNode) != null) {
+ _initializer = new FunctionElementImpl('', -1)..isSynthetic = true;
+ }
+ }
if (_unlinkedVariable != null) {
UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer;
if (unlinkedInitializer != null) {
@@ -7550,9 +7983,7 @@
@override
String get name {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getSimpleName(
- linkedNode.variableDeclaration_name,
- );
+ return reference.name;
}
if (_unlinkedVariable != null) {
return _unlinkedVariable.name;
@@ -7563,10 +7994,9 @@
@override
int get nameOffset {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getSimpleOffset(
- linkedNode.variableDeclaration_name,
- );
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
+
int offset = super.nameOffset;
if (offset == 0) {
if (_unlinkedVariable != null) {
@@ -7589,12 +8019,19 @@
@override
void set type(DartType type) {
+ if (linkedNode != null) {
+ return linkedContext.setVariableType(linkedNode, type);
+ }
_assertNotResynthesized(_unlinkedVariable);
_type = _checkElementOfType(type);
}
@override
TopLevelInferenceError get typeInferenceError {
+ if (linkedNode != null) {
+ return linkedContext.getTypeInferenceError(linkedNode);
+ }
+
if (_unlinkedVariable != null) {
return enclosingUnit.resynthesizerContext
.getTypeInferenceError(_unlinkedVariable.inferredTypeSlot);
@@ -7614,6 +8051,16 @@
/// The unlinked representation of the parameter in the summary.
final UnlinkedParam unlinkedParam;
+ /// A list containing all of the parameters defined by this parameter element.
+ /// There will only be parameters if this parameter is a function typed
+ /// parameter.
+ List<ParameterElement> _parameters;
+
+ /// A list containing all of the type parameters defined for this parameter
+ /// element. There will only be parameters if this parameter is a function
+ /// typed parameter.
+ List<TypeParameterElement> _typeParameters;
+
/// The kind of this parameter.
ParameterKind _parameterKind;
@@ -7636,27 +8083,23 @@
super(name, nameOffset);
ParameterElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, FormalParameter linkedNode)
: unlinkedParam = null,
super.forLinkedNode(enclosing, reference, linkedNode);
factory ParameterElementImpl.forLinkedNodeFactory(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode) {
- var kind = linkedNode.kind;
- if (kind == LinkedNodeKind.fieldFormalParameter) {
+ ElementImpl enclosing, Reference reference, FormalParameter node) {
+ if (node is FieldFormalParameter) {
return FieldFormalParameterElementImpl.forLinkedNode(
enclosing,
reference,
- linkedNode,
+ node,
);
- } else if (kind == LinkedNodeKind.simpleFormalParameter) {
- return ParameterElementImpl.forLinkedNode(
- enclosing,
- reference,
- linkedNode,
- );
+ } else if (node is FunctionTypedFormalParameter ||
+ node is SimpleFormalParameter) {
+ return ParameterElementImpl.forLinkedNode(enclosing, reference, node);
} else {
- throw UnimplementedError('$kind');
+ throw UnimplementedError('${node.runtimeType}');
}
}
@@ -7676,7 +8119,7 @@
{bool synthetic: false}) {
ParameterElementImpl element;
if (unlinkedParameter.isInitializingFormal) {
- if (unlinkedParameter.kind == UnlinkedParamKind.required) {
+ if (unlinkedParameter.kind == UnlinkedParamKind.requiredPositional) {
element = new FieldFormalParameterElementImpl.forSerialized(
unlinkedParameter, enclosingElement);
} else {
@@ -7684,7 +8127,7 @@
unlinkedParameter, enclosingElement);
}
} else {
- if (unlinkedParameter.kind == UnlinkedParamKind.required) {
+ if (unlinkedParameter.kind == UnlinkedParamKind.requiredPositional) {
element = new ParameterElementImpl.forSerialized(
unlinkedParameter, enclosingElement);
} else {
@@ -7708,6 +8151,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (unlinkedParam != null) {
return unlinkedParam.codeRange?.length;
}
@@ -7716,6 +8162,9 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (unlinkedParam != null) {
return unlinkedParam.codeRange?.offset;
}
@@ -7724,6 +8173,10 @@
@override
String get defaultValueCode {
+ if (linkedNode != null) {
+ return linkedContext.getDefaultValueCode(linkedNode);
+ }
+
if (unlinkedParam != null) {
if (unlinkedParam.initializer?.bodyExpr == null) {
return null;
@@ -7741,6 +8194,9 @@
@override
bool get hasImplicitType {
+ if (linkedNode != null) {
+ return linkedContext.hasImplicitType(linkedNode);
+ }
if (unlinkedParam != null) {
return unlinkedParam.type == null && !unlinkedParam.isFunctionTyped;
}
@@ -7757,6 +8213,9 @@
/// when it overrides a method in a supertype that has a corresponding
/// covariant parameter.
bool get inheritsCovariant {
+ if (linkedNode != null) {
+ return linkedContext.getInheritsCovariant(linkedNode);
+ }
if (unlinkedParam != null) {
return enclosingUnit.resynthesizerContext
.inheritsCovariant(unlinkedParam.inheritsCovariantSlot);
@@ -7767,6 +8226,11 @@
/// Record whether or not this parameter inherits from a covariant parameter.
void set inheritsCovariant(bool value) {
+ if (linkedNode != null) {
+ linkedContext.setInheritsCovariant(linkedNode, value);
+ return;
+ }
+
_assertNotResynthesized(unlinkedParam);
_inheritsCovariant = value;
}
@@ -7774,6 +8238,11 @@
@override
FunctionElement get initializer {
if (_initializer == null) {
+ if (linkedNode != null) {
+ if (linkedContext.readInitializer(linkedNode) != null) {
+ _initializer = new FunctionElementImpl('', -1)..isSynthetic = true;
+ }
+ }
if (unlinkedParam != null) {
UnlinkedExecutable unlinkedInitializer = unlinkedParam.initializer;
if (unlinkedInitializer != null) {
@@ -7811,13 +8280,6 @@
@override
bool get isCovariant {
- if (linkedNode != null) {
- if (linkedNode.kind == LinkedNodeKind.defaultFormalParameter) {
- var parameter = linkedNode.defaultFormalParameter_parameter;
- return parameter.normalFormalParameter_isCovariant;
- }
- return linkedNode.normalFormalParameter_isCovariant;
- }
if (isExplicitlyCovariant || inheritsCovariant) {
return true;
}
@@ -7826,6 +8288,9 @@
/// Return true if this parameter is explicitly marked as being covariant.
bool get isExplicitlyCovariant {
+ if (linkedNode != null) {
+ return linkedContext.isExplicitlyCovariant(linkedNode);
+ }
if (unlinkedParam != null) {
return unlinkedParam.isExplicitlyCovariant;
}
@@ -7842,14 +8307,8 @@
@override
bool get isFinal {
if (linkedNode != null) {
- if (linkedNode.kind == LinkedNodeKind.defaultFormalParameter) {
- var parameter = linkedNode.defaultFormalParameter_parameter;
- return parameter.simpleFormalParameter_keyword != 0;
- }
- if (linkedNode.kind == LinkedNodeKind.fieldFormalParameter) {
- return false;
- }
- return linkedNode.simpleFormalParameter_keyword != 0;
+ FormalParameter linkedNode = this.linkedNode;
+ return linkedNode.isFinal;
}
if (unlinkedParam != null) {
return unlinkedParam.isFinal;
@@ -7898,9 +8357,7 @@
@override
int get nameOffset {
if (linkedNode != null) {
- return enclosingUnit.linkedContext.getSimpleOffset(
- linkedNode.normalFormalParameter_identifier,
- );
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
int offset = super.nameOffset;
@@ -7908,7 +8365,8 @@
if (unlinkedParam != null) {
if (isSynthetic ||
(unlinkedParam.name.isEmpty &&
- unlinkedParam.kind != UnlinkedParamKind.named &&
+ unlinkedParam.kind != UnlinkedParamKind.requiredNamed &&
+ unlinkedParam.kind != UnlinkedParamKind.optionalNamed &&
enclosingElement is GenericFunctionTypeElement)) {
return -1;
}
@@ -7923,26 +8381,24 @@
if (_parameterKind != null) return _parameterKind;
if (linkedNode != null) {
- if (linkedNode.kind == LinkedNodeKind.defaultFormalParameter) {
- if (linkedNode.defaultFormalParameter_isNamed) {
- return _parameterKind = ParameterKind.NAMED;
- } else {
- return _parameterKind = ParameterKind.POSITIONAL;
- }
- }
- return _parameterKind = ParameterKind.REQUIRED;
+ FormalParameter linkedNode = this.linkedNode;
+ // ignore: deprecated_member_use_from_same_package
+ return linkedNode.kind;
}
if (unlinkedParam != null) {
switch (unlinkedParam.kind) {
- case UnlinkedParamKind.named:
+ case UnlinkedParamKind.optionalNamed:
_parameterKind = ParameterKind.NAMED;
break;
- case UnlinkedParamKind.positional:
+ case UnlinkedParamKind.optionalPositional:
_parameterKind = ParameterKind.POSITIONAL;
break;
- case UnlinkedParamKind.required:
+ case UnlinkedParamKind.requiredPositional:
_parameterKind = ParameterKind.REQUIRED;
break;
+ case UnlinkedParamKind.requiredNamed:
+ _parameterKind = ParameterKind.NAMED_REQUIRED;
+ break;
}
}
return _parameterKind;
@@ -7955,22 +8411,47 @@
@override
List<ParameterElement> get parameters {
- return const <ParameterElement>[];
+ if (_parameters != null) return _parameters;
+
+ if (linkedNode != null) {
+ var context = enclosingUnit.linkedContext;
+ var formalParameters = context.getFormalParameters(linkedNode);
+ if (formalParameters != null) {
+ var containerRef = reference.getChild('@parameter');
+ return _parameters = ParameterElementImpl.forLinkedNodeList(
+ this,
+ context,
+ containerRef,
+ formalParameters,
+ );
+ } else {
+ return _parameters ??= const <ParameterElement>[];
+ }
+ }
+
+ if (unlinkedParam != null) {
+ _resynthesizeTypeAndParameters();
+ return _parameters ??= const <ParameterElement>[];
+ }
+
+ return _parameters ??= const <ParameterElement>[];
+ }
+
+ /// Set the parameters defined by this executable element to the given
+ /// [parameters].
+ void set parameters(List<ParameterElement> parameters) {
+ for (ParameterElement parameter in parameters) {
+ (parameter as ParameterElementImpl).enclosingElement = this;
+ }
+ this._parameters = parameters;
}
@override
DartType get type {
if (linkedNode != null) {
if (_type != null) return _type;
- if (linkedNode.kind == LinkedNodeKind.defaultFormalParameter) {
- var parameter = linkedNode.defaultFormalParameter_parameter;
- return _type = enclosingUnit.linkedContext.getType(
- parameter.simpleFormalParameter_type2,
- );
- }
- return _type = enclosingUnit.linkedContext.getType(
- linkedNode.simpleFormalParameter_type2,
- );
+ var context = enclosingUnit.linkedContext;
+ return _type = context.getType(linkedNode);
}
_resynthesizeTypeAndParameters();
return super.type;
@@ -7978,6 +8459,10 @@
@override
TopLevelInferenceError get typeInferenceError {
+ if (linkedNode != null) {
+ return linkedContext.getTypeInferenceError(linkedNode);
+ }
+
if (unlinkedParam != null) {
return enclosingUnit.resynthesizerContext
.getTypeInferenceError(unlinkedParam.inferredTypeSlot);
@@ -7988,7 +8473,34 @@
@override
List<TypeParameterElement> get typeParameters {
- return const <TypeParameterElement>[];
+ if (_typeParameters != null) return _typeParameters;
+
+ if (linkedNode != null) {
+ var typeParameters = linkedContext.getTypeParameters2(linkedNode);
+ if (typeParameters == null) {
+ return _typeParameters = const [];
+ }
+ var containerRef = reference.getChild('@typeParameter');
+ return _typeParameters =
+ typeParameters.typeParameters.map<TypeParameterElement>((node) {
+ var reference = containerRef.getChild(node.name.name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as TypeParameterElement;
+ }
+ return TypeParameterElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
+ }
+
+ return _typeParameters ??= const <TypeParameterElement>[];
+ }
+
+ /// Set the type parameters defined by this parameter element to the given
+ /// [typeParameters].
+ void set typeParameters(List<TypeParameterElement> typeParameters) {
+ for (TypeParameterElement parameter in typeParameters) {
+ (parameter as TypeParameterElementImpl).enclosingElement = this;
+ }
+ this._typeParameters = typeParameters;
}
@override
@@ -8014,21 +8526,20 @@
@override
void appendTo(StringBuffer buffer) {
- String left = "";
- String right = "";
- while (true) {
- if (parameterKind == ParameterKind.NAMED) {
- left = "{";
- right = "}";
- } else if (parameterKind == ParameterKind.POSITIONAL) {
- left = "[";
- right = "]";
- } else if (parameterKind == ParameterKind.REQUIRED) {}
- break;
+ if (isNamed) {
+ buffer.write('{');
+ if (isRequiredNamed) {
+ buffer.write('required ');
+ }
+ appendToWithoutDelimiters(buffer);
+ buffer.write('}');
+ } else if (isOptionalPositional) {
+ buffer.write('[');
+ appendToWithoutDelimiters(buffer);
+ buffer.write(']');
+ } else {
+ appendToWithoutDelimiters(buffer);
}
- buffer.write(left);
- appendToWithoutDelimiters(buffer);
- buffer.write(right);
}
@deprecated
@@ -8060,9 +8571,10 @@
var typeElement = new GenericFunctionTypeElementImpl.forOffset(-1);
typeElement.enclosingElement = this;
- typeElement.parameters = ParameterElementImpl.resynthesizeList(
+ _parameters = ParameterElementImpl.resynthesizeList(
unlinkedParam.parameters, typeElement,
synthetic: isSynthetic);
+ typeElement.parameters = _parameters;
typeElement.returnType = enclosingUnit.resynthesizerContext
.resolveTypeRef(this, unlinkedParam.type);
@@ -8080,6 +8592,57 @@
}
}
+ static List<ParameterElement> forLinkedNodeList(
+ ElementImpl enclosing,
+ LinkedUnitContext context,
+ Reference containerRef,
+ List<FormalParameter> formalParameters) {
+ if (formalParameters == null) {
+ return const [];
+ }
+
+ return formalParameters.map((node) {
+ if (node is DefaultFormalParameter) {
+ NormalFormalParameter parameterNode = node.parameter;
+ var name = parameterNode.identifier?.name ?? '';
+ var reference = containerRef.getChild(name);
+ reference.node2 = node;
+ if (parameterNode is FieldFormalParameter) {
+ return DefaultFieldFormalParameterElementImpl.forLinkedNode(
+ enclosing,
+ reference,
+ node,
+ );
+ } else {
+ return DefaultParameterElementImpl.forLinkedNode(
+ enclosing,
+ reference,
+ node,
+ );
+ }
+ } else {
+ if (node.identifier == null) {
+ return ParameterElementImpl.forLinkedNodeFactory(
+ enclosing,
+ containerRef.getChild(''),
+ node,
+ );
+ } else {
+ var name = node.identifier.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as ParameterElement;
+ }
+ return ParameterElementImpl.forLinkedNodeFactory(
+ enclosing,
+ reference,
+ node,
+ );
+ }
+ }
+ }).toList();
+ }
+
/// Create and return [ParameterElement]s for the given [unlinkedParameters].
static List<ParameterElement> resynthesizeList(
List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement,
@@ -8115,11 +8678,28 @@
@override
bool get inheritsCovariant {
PropertyInducingElement variable = setter.variable;
- if (variable is FieldElementImpl && variable._unlinkedVariable != null) {
- return enclosingUnit.resynthesizerContext
- .inheritsCovariant(variable._unlinkedVariable.inheritsCovariantSlot);
+ if (variable is FieldElementImpl) {
+ if (variable.linkedNode != null) {
+ var context = variable.linkedContext;
+ return context.getInheritsCovariant(variable.linkedNode);
+ }
+ if (variable._unlinkedVariable != null) {
+ return enclosingUnit.resynthesizerContext.inheritsCovariant(
+ variable._unlinkedVariable.inheritsCovariantSlot);
+ }
}
- return super.inheritsCovariant;
+ return false;
+ }
+
+ @override
+ void set inheritsCovariant(bool value) {
+ PropertyInducingElement variable = setter.variable;
+ if (variable is FieldElementImpl) {
+ if (variable.linkedNode != null) {
+ var context = variable.linkedContext;
+ return context.setInheritsCovariant(variable.linkedNode, value);
+ }
+ }
}
@override
@@ -8152,10 +8732,14 @@
/// [ParameterElement].
mixin ParameterElementMixin implements ParameterElement {
@override
- bool get isNamed => parameterKind == ParameterKind.NAMED;
+ bool get isNamed =>
+ parameterKind == ParameterKind.NAMED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
- bool get isNotOptional => parameterKind == ParameterKind.REQUIRED;
+ bool get isNotOptional =>
+ parameterKind == ParameterKind.REQUIRED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
bool get isOptional =>
@@ -8163,6 +8747,9 @@
parameterKind == ParameterKind.POSITIONAL;
@override
+ bool get isOptionalNamed => parameterKind == ParameterKind.NAMED;
+
+ @override
bool get isOptionalPositional => parameterKind == ParameterKind.POSITIONAL;
@override
@@ -8171,21 +8758,22 @@
parameterKind == ParameterKind.REQUIRED;
@override
+ bool get isRequiredNamed => parameterKind == ParameterKind.NAMED_REQUIRED;
+
+ @override
+ bool get isRequiredPositional => parameterKind == ParameterKind.REQUIRED;
+
+ @override
// Overridden to remove the 'deprecated' annotation.
ParameterKind get parameterKind;
@override
void appendToWithoutDelimiters(StringBuffer buffer) {
buffer.write(type);
- buffer.write(" ");
+ buffer.write(' ');
buffer.write(displayName);
if (defaultValueCode != null) {
- if (parameterKind == ParameterKind.NAMED) {
- buffer.write(": ");
- }
- if (parameterKind == ParameterKind.POSITIONAL) {
- buffer.write(" = ");
- }
+ buffer.write(' = ');
buffer.write(defaultValueCode);
}
}
@@ -8202,6 +8790,11 @@
: _unlinkedImport = null,
super(name, nameOffset);
+ PrefixElementImpl.forLinkedNode(
+ ElementImpl enclosing, Reference reference, SimpleIdentifier linkedNode)
+ : _unlinkedImport = null,
+ super.forLinkedNode(enclosing, reference, linkedNode);
+
/// Initialize a newly created prefix element to have the given [name].
PrefixElementImpl.forNode(Identifier name)
: _unlinkedImport = null,
@@ -8220,9 +8813,6 @@
super.enclosingElement as LibraryElement;
@override
- String get identifier => "_${super.identifier}";
-
- @override
List<LibraryElement> get importedLibraries => const <LibraryElement>[];
@override
@@ -8230,6 +8820,9 @@
@override
String get name {
+ if (linkedNode != null) {
+ return reference.name;
+ }
if (_name == null) {
if (_unlinkedImport != null) {
LibraryElementImpl library = enclosingElement as LibraryElementImpl;
@@ -8242,6 +8835,9 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return (linkedNode as SimpleIdentifier).offset;
+ }
int offset = super.nameOffset;
if (offset == 0 && _unlinkedImport != null) {
return _unlinkedImport.prefixOffset;
@@ -8270,7 +8866,7 @@
PropertyAccessorElementImpl(String name, int offset) : super(name, offset);
PropertyAccessorElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created property accessor element to have the given
@@ -8343,14 +8939,6 @@
}
@override
- bool get isAbstract {
- if (linkedNode != null) {
- return enclosingUnit.linkedContext.isAbstract(linkedNode);
- }
- return super.isAbstract;
- }
-
- @override
bool get isGetter {
if (linkedNode != null) {
return enclosingUnit.linkedContext.isGetter(linkedNode);
@@ -8401,7 +8989,11 @@
@override
String get name {
if (linkedNode != null) {
- return reference.name;
+ var name = reference.name;
+ if (isSetter) {
+ return '$name=';
+ }
+ return name;
}
if (serializedExecutable != null) {
return serializedExecutable.name;
@@ -8538,7 +9130,7 @@
PropertyInducingElementImpl(String name, int offset) : super(name, offset);
PropertyInducingElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created element to have the given [name].
@@ -8552,6 +9144,17 @@
@override
bool get isConstantEvaluated => true;
+ @override
+ bool get isLate {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.isLate(linkedNode);
+ }
+ if (_unlinkedVariable != null) {
+ return _unlinkedVariable.isLate;
+ }
+ return hasModifier(Modifier.LATE);
+ }
+
@deprecated
@override
DartType get propagatedType => null;
@@ -8563,9 +9166,7 @@
DartType get type {
if (linkedNode != null) {
if (_type != null) return _type;
- return _type = enclosingUnit.linkedContext.getType(
- linkedNode.variableDeclaration_type2,
- );
+ return _type = linkedContext.getType(linkedNode);
}
if (isSynthetic && _type == null) {
if (getter != null) {
@@ -8638,6 +9239,9 @@
/// The unlinked representation of the combinator in the summary.
final UnlinkedCombinator _unlinkedCombinator;
+ final LinkedUnitContext linkedContext;
+ final ShowCombinator linkedNode;
+
/// The names that are to be made visible in the importing library if they are
/// defined in the imported library.
List<String> _shownNames;
@@ -8649,10 +9253,18 @@
/// The offset of the 'show' keyword of this element.
int _offset = 0;
- ShowElementCombinatorImpl() : _unlinkedCombinator = null;
+ ShowElementCombinatorImpl()
+ : _unlinkedCombinator = null,
+ linkedContext = null,
+ linkedNode = null;
+
+ ShowElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode)
+ : _unlinkedCombinator = null;
/// Initialize using the given serialized information.
- ShowElementCombinatorImpl.forSerialized(this._unlinkedCombinator);
+ ShowElementCombinatorImpl.forSerialized(this._unlinkedCombinator)
+ : linkedContext = null,
+ linkedNode = null;
@override
int get end {
@@ -8669,6 +9281,9 @@
@override
int get offset {
+ if (linkedNode != null) {
+ return linkedNode.keyword.offset;
+ }
if (_unlinkedCombinator != null) {
return _unlinkedCombinator.offset;
}
@@ -8682,9 +9297,16 @@
@override
List<String> get shownNames {
- if (_unlinkedCombinator != null) {
- _shownNames ??= _unlinkedCombinator.shows.toList(growable: false);
+ if (_shownNames != null) return _shownNames;
+
+ if (linkedNode != null) {
+ return _shownNames = linkedNode.shownNames.map((i) => i.name).toList();
}
+
+ if (_unlinkedCombinator != null) {
+ return _shownNames = _unlinkedCombinator.shows.toList(growable: false);
+ }
+
return _shownNames ?? const <String>[];
}
@@ -8739,7 +9361,7 @@
TopLevelVariableElementImpl(String name, int offset) : super(name, offset);
TopLevelVariableElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode) {
if (!linkedNode.isSynthetic) {
var enclosingRef = enclosing.reference;
@@ -8759,7 +9381,7 @@
}
factory TopLevelVariableElementImpl.forLinkedNodeFactory(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode) {
+ ElementImpl enclosing, Reference reference, AstNode linkedNode) {
if (enclosing.enclosingUnit.linkedContext.isConst(linkedNode)) {
return ConstTopLevelVariableElementImpl.forLinkedNode(
enclosing,
@@ -8821,9 +9443,7 @@
super(name, offset);
TypeParameterElementImpl.forLinkedNode(
- TypeParameterizedElementMixin enclosing,
- Reference reference,
- LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, TypeParameter linkedNode)
: _unlinkedTypeParam = null,
super.forLinkedNode(enclosing, reference, linkedNode);
@@ -8850,13 +9470,8 @@
if (_bound != null) return _bound;
if (linkedNode != null) {
- var bound = linkedNode.typeParameter_bound;
- if (bound != null) {
- var context = enclosingUnit.linkedContext;
- return _bound = context.getTypeAnnotationType(bound);
- } else {
- return null;
- }
+ var context = enclosingUnit.linkedContext;
+ return _bound = context.getTypeParameterBound(linkedNode)?.type;
}
if (_unlinkedTypeParam != null) {
@@ -8878,6 +9493,9 @@
@override
int get codeLength {
+ if (linkedNode != null) {
+ return linkedContext.getCodeLength(linkedNode);
+ }
if (_unlinkedTypeParam != null) {
return _unlinkedTypeParam.codeRange?.length;
}
@@ -8886,12 +9504,25 @@
@override
int get codeOffset {
+ if (linkedNode != null) {
+ return linkedContext.getCodeOffset(linkedNode);
+ }
if (_unlinkedTypeParam != null) {
return _unlinkedTypeParam.codeRange?.offset;
}
return super.codeOffset;
}
+ /// The default value of the type parameter. It is used to provide the
+ /// corresponding missing type argument in type annotations and as the
+ /// fall-back type value in type inference.
+ DartType get defaultType {
+ if (linkedNode != null) {
+ return linkedContext.getDefaultType(linkedNode);
+ }
+ return null;
+ }
+
@override
String get displayName => name;
@@ -8910,7 +9541,8 @@
@override
String get name {
if (linkedNode != null) {
- return reference.name;
+ TypeParameter node = this.linkedNode;
+ return node.name.name;
}
if (_unlinkedTypeParam != null) {
return _unlinkedTypeParam.name;
@@ -8920,6 +9552,10 @@
@override
int get nameOffset {
+ if (linkedNode != null) {
+ return enclosingUnit.linkedContext.getNameOffset(linkedNode);
+ }
+
int offset = super.nameOffset;
if (offset == 0 && _unlinkedTypeParam != null) {
return _unlinkedTypeParam.nameOffset;
@@ -8928,13 +9564,7 @@
}
TypeParameterType get type {
- if (linkedNode != null) {
- _type ??= new TypeParameterTypeImpl(this);
- }
- if (_unlinkedTypeParam != null) {
- _type ??= new TypeParameterTypeImpl(this);
- }
- return _type;
+ return _type ??= new TypeParameterTypeImpl(this);
}
void set type(TypeParameterType type) {
@@ -8984,16 +9614,17 @@
if (_typeParameterElements != null) return _typeParameterElements;
if (linkedNode != null) {
- var context = enclosingUnit.linkedContext;
- var containerRef = reference.getChild('@typeParameter');
- var typeParameters = context.getTypeParameters(linkedNode);
+ var typeParameters = linkedContext.getTypeParameters2(linkedNode);
if (typeParameters == null) {
return _typeParameterElements = const [];
}
- return _typeParameterElements = typeParameters.map((node) {
- var name = context.getSimpleName(node.typeParameter_name);
- var reference = containerRef.getChild(name);
- reference.node = node;
+ var containerRef = reference.getChild('@typeParameter');
+ return _typeParameterElements =
+ typeParameters.typeParameters.map<TypeParameterElement>((node) {
+ var reference = containerRef.getChild(node.name.name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as TypeParameterElement;
+ }
return TypeParameterElementImpl.forLinkedNode(this, reference, node);
}).toList();
}
@@ -9107,7 +9738,7 @@
UriReferencedElementImpl(String name, int offset) : super(name, offset);
UriReferencedElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize using the given serialized information.
@@ -9171,7 +9802,7 @@
VariableElementImpl(String name, int offset) : super(name, offset);
VariableElementImpl.forLinkedNode(
- ElementImpl enclosing, Reference reference, LinkedNode linkedNode)
+ ElementImpl enclosing, Reference reference, AstNode linkedNode)
: super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created variable element to have the given [name].
@@ -9277,6 +9908,9 @@
DartType get type => _type ?? _declaredType;
void set type(DartType type) {
+ if (linkedNode != null) {
+ return linkedContext.setVariableType(linkedNode, type);
+ }
_type = _checkElementOfType(type);
}
diff --git a/analyzer/lib/src/dart/element/handle.dart b/analyzer/lib/src/dart/element/handle.dart
index 67f47f7..f316eb7 100644
--- a/analyzer/lib/src/dart/element/handle.dart
+++ b/analyzer/lib/src/dart/element/handle.dart
@@ -395,6 +395,12 @@
bool get hasLiteral => actualElement.hasLiteral;
@override
+ bool get hasMustCallSuper => actualElement.hasMustCallSuper;
+
+ @override
+ bool get hasOptionalTypeArgs => actualElement.hasOptionalTypeArgs;
+
+ @override
bool get hasOverride => actualElement.hasOverride;
@override
@@ -981,6 +987,9 @@
super.actualElement as LocalVariableElement;
@override
+ bool get isLate => actualElement.isLate;
+
+ @override
ElementKind get kind => ElementKind.LOCAL_VARIABLE;
@override
@@ -1168,14 +1177,17 @@
@override
PropertyAccessorElement get getter => actualElement.getter;
+ @override
+ bool get isConstantEvaluated => actualElement.isConstantEvaluated;
+
+ @override
+ bool get isLate => actualElement.isLate;
+
@deprecated
@override
DartType get propagatedType => null;
@override
- bool get isConstantEvaluated => actualElement.isConstantEvaluated;
-
- @override
PropertyAccessorElement get setter => actualElement.setter;
}
@@ -1256,10 +1268,10 @@
FunctionElement get initializer => actualElement.initializer;
@override
- bool get isConstantEvaluated => actualElement.isConstantEvaluated;
+ bool get isConst => actualElement.isConst;
@override
- bool get isConst => actualElement.isConst;
+ bool get isConstantEvaluated => actualElement.isConstantEvaluated;
@override
bool get isFinal => actualElement.isFinal;
diff --git a/analyzer/lib/src/dart/element/inheritance_manager2.dart b/analyzer/lib/src/dart/element/inheritance_manager2.dart
index b2fb92f..8bdc5c7 100644
--- a/analyzer/lib/src/dart/element/inheritance_manager2.dart
+++ b/analyzer/lib/src/dart/element/inheritance_manager2.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/dart/element/member.dart b/analyzer/lib/src/dart/element/member.dart
index 845d59d..fc58f4f 100644
--- a/analyzer/lib/src/dart/element/member.dart
+++ b/analyzer/lib/src/dart/element/member.dart
@@ -255,6 +255,9 @@
@override
bool get isEnumConstant => baseElement.isEnumConstant;
+ @override
+ bool get isLate => baseElement.isLate;
+
@deprecated
@override
bool get isVirtual => baseElement.isVirtual;
@@ -425,6 +428,12 @@
bool get hasLiteral => _baseElement.hasLiteral;
@override
+ bool get hasMustCallSuper => _baseElement.hasMustCallSuper;
+
+ @override
+ bool get hasOptionalTypeArgs => _baseElement.hasOptionalTypeArgs;
+
+ @override
bool get hasOverride => _baseElement.hasOverride;
@override
@@ -642,10 +651,10 @@
if (closing != null) {
buffer.write(closing);
}
- if (parameterKind == ParameterKind.POSITIONAL) {
+ if (parameter.isOptionalPositional) {
buffer.write("[");
closing = "]";
- } else if (parameterKind == ParameterKind.NAMED) {
+ } else if (parameter.isNamed) {
buffer.write("{");
closing = "}";
} else {
diff --git a/analyzer/lib/src/dart/element/type.dart b/analyzer/lib/src/dart/element/type.dart
index 5fbed4f..e1b62e2 100644
--- a/analyzer/lib/src/dart/element/type.dart
+++ b/analyzer/lib/src/dart/element/type.dart
@@ -56,35 +56,16 @@
*/
class BottomTypeImpl extends TypeImpl {
/**
- * The unique instance of this class, with indeterminate nullability.
+ * The unique instance of this class.
*/
- static final BottomTypeImpl instance = instanceIndeterminate;
-
- /**
- * The unique instance of this class, nullable.
- */
- static final BottomTypeImpl instanceNullable =
- new BottomTypeImpl._(Nullability.nullable);
-
- /**
- * The unique instance of this class, with indeterminate nullability.
- */
- static final BottomTypeImpl instanceIndeterminate =
- new BottomTypeImpl._(Nullability.indeterminate);
-
- /**
- * The unique instance of this class, non-nullable.
- */
- static final BottomTypeImpl instanceNonNullable =
- new BottomTypeImpl._(Nullability.nonNullable);
-
- @override
- final Nullability nullability;
+ static final BottomTypeImpl instance = new BottomTypeImpl._();
/**
* Prevent the creation of instances of this class.
*/
- BottomTypeImpl._(this.nullability) : super(null, "<bottom>");
+ BottomTypeImpl._() : super(new NeverElementImpl(), "Never") {
+ (element as NeverElementImpl).type = this;
+ }
@override
int get hashCode => 0;
@@ -93,6 +74,9 @@
bool get isBottom => true;
@override
+ NullabilitySuffix get nullabilitySuffix => NullabilitySuffix.none;
+
+ @override
bool operator ==(Object object) => identical(object, this);
@override
@@ -134,16 +118,9 @@
this;
@override
- TypeImpl withNullability(Nullability nullability) {
- switch (nullability) {
- case Nullability.nullable:
- return instanceNullable;
- case Nullability.indeterminate:
- return instanceIndeterminate;
- case Nullability.nonNullable:
- return instanceNonNullable;
- }
- throw StateError('Unexpected nullability: $nullability');
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ // The bottom type is always non-nullable.
+ return this;
}
}
@@ -153,7 +130,7 @@
*/
class CircularFunctionTypeImpl extends DynamicTypeImpl
implements _FunctionTypeImplLazy {
- CircularFunctionTypeImpl() : super._circular(Nullability.indeterminate);
+ CircularFunctionTypeImpl() : super._circular();
@override
List<ParameterElement> get baseParameters => const <ParameterElement>[];
@@ -262,7 +239,7 @@
FunctionTypeImpl substitute3(List<DartType> argumentTypes) => this;
@override
- TypeImpl withNullability(Nullability nullability) => this;
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) => this;
@override
void _forEachParameterType(
@@ -294,7 +271,7 @@
* `...`.
*/
class CircularTypeImpl extends DynamicTypeImpl {
- CircularTypeImpl() : super._circular(Nullability.indeterminate);
+ CircularTypeImpl() : super._circular();
@override
bool operator ==(Object object) => object is CircularTypeImpl;
@@ -332,9 +309,9 @@
DeferredFunctionTypeImpl(this._computeElement, String name,
List<DartType> typeArguments, bool isInstantiated,
- {Nullability nullability = Nullability.indeterminate})
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star})
: super._(null, name, null, typeArguments, null, null, isInstantiated,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
@override
FunctionTypedElement get element {
@@ -346,11 +323,11 @@
}
@override
- TypeImpl withNullability(Nullability nullability) {
- if (this.nullability == nullability) return this;
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ if (this.nullabilitySuffix == nullabilitySuffix) return this;
return DeferredFunctionTypeImpl(
_computeElement, name, typeArguments, isInstantiated,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
}
@@ -359,35 +336,14 @@
*/
class DynamicTypeImpl extends TypeImpl {
/**
- * The unique instance of this class, with indeterminate nullability.
+ * The unique instance of this class.
*/
- static final DynamicTypeImpl instance = instanceIndeterminate;
-
- /**
- * The unique instance of this class, nullable.
- */
- static final DynamicTypeImpl instanceNullable =
- new DynamicTypeImpl._(Nullability.nullable);
-
- /**
- * The unique instance of this class, with indeterminate nullability.
- */
- static final DynamicTypeImpl instanceIndeterminate =
- new DynamicTypeImpl._(Nullability.indeterminate);
-
- /**
- * The unique instance of this class, non-nullable.
- */
- static final DynamicTypeImpl instanceNonNullable =
- new DynamicTypeImpl._(Nullability.nonNullable);
-
- @override
- final Nullability nullability;
+ static final DynamicTypeImpl instance = new DynamicTypeImpl._();
/**
* Prevent the creation of instances of this class.
*/
- DynamicTypeImpl._(this.nullability)
+ DynamicTypeImpl._()
: super(new DynamicElementImpl(), Keyword.DYNAMIC.lexeme) {
(element as DynamicElementImpl).type = this;
}
@@ -395,8 +351,7 @@
/**
* Constructor used by [CircularTypeImpl].
*/
- DynamicTypeImpl._circular(this.nullability)
- : super(instance.element, Keyword.DYNAMIC.lexeme);
+ DynamicTypeImpl._circular() : super(instance.element, Keyword.DYNAMIC.lexeme);
@override
int get hashCode => 1;
@@ -405,6 +360,9 @@
bool get isDynamic => true;
@override
+ NullabilitySuffix get nullabilitySuffix => NullabilitySuffix.none;
+
+ @override
bool operator ==(Object object) => identical(object, this);
@override
@@ -451,16 +409,9 @@
}
@override
- TypeImpl withNullability(Nullability nullability) {
- switch (nullability) {
- case Nullability.nullable:
- return instanceNullable;
- case Nullability.indeterminate:
- return instanceIndeterminate;
- case Nullability.nonNullable:
- return instanceNonNullable;
- }
- throw StateError('Unexpected nullability: $nullability');
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ // The dynamic type is always nullable.
+ return this;
}
}
@@ -469,7 +420,7 @@
*/
abstract class FunctionTypeImpl extends TypeImpl implements FunctionType {
@override
- final Nullability nullability;
+ final NullabilitySuffix nullabilitySuffix;
/**
* Initialize a newly created function type to be declared by the given
@@ -477,13 +428,13 @@
* [typeParameters], which permits later substitution.
*/
factory FunctionTypeImpl(FunctionTypedElement element,
- {Nullability nullability = Nullability.indeterminate}) {
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star}) {
if (element is FunctionTypeAliasElement) {
throw new StateError('Use FunctionTypeImpl.forTypedef for typedefs');
}
return new _FunctionTypeImplLazy._(
element, null, null, null, null, null, false,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
/**
@@ -494,10 +445,10 @@
* See https://github.com/dart-lang/sdk/issues/34657.
*/
factory FunctionTypeImpl.forTypedef(FunctionTypeAliasElement element,
- {Nullability nullability = Nullability.indeterminate}) {
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star}) {
return new _FunctionTypeImplLazy._(
element, element?.name, null, null, null, null, false,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
/**
@@ -510,7 +461,7 @@
*/
factory FunctionTypeImpl.fresh(FunctionType original,
{bool force = false,
- Nullability nullability = Nullability.indeterminate}) {
+ NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star}) {
// We build up a substitution for the type parameters,
// {variablesFresh/variables} then apply it.
@@ -553,25 +504,25 @@
var name = original.name ?? "";
var element = original.element;
var function = new FunctionElementImpl(name, -1);
- function.enclosingElement = element.enclosingElement;
+ function.enclosingElement = element?.enclosingElement;
function.isSynthetic = true;
function.returnType = newType.returnType;
function.typeParameters = freshVarElements;
function.shareParameters(newType.parameters);
return function.type =
- new FunctionTypeImpl(function, nullability: nullability);
+ new FunctionTypeImpl(function, nullabilitySuffix: nullabilitySuffix);
}
/// Creates a function type that's not associated with any element in the
/// element tree.
factory FunctionTypeImpl.synthetic(DartType returnType,
List<TypeParameterElement> typeFormals, List<ParameterElement> parameters,
- {Nullability nullability = Nullability.indeterminate}) {
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star}) {
return new _FunctionTypeImplStrict._(returnType, typeFormals, parameters,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
- FunctionTypeImpl._(Element element, String name, this.nullability)
+ FunctionTypeImpl._(Element element, String name, this.nullabilitySuffix)
: super(element, name);
@deprecated
@@ -653,10 +604,16 @@
@override
Map<String, DartType> get namedParameterTypes {
+ // TODO(brianwilkerson) This implementation breaks the contract because the
+ // parameters will not necessarily be returned in the order in which they
+ // were declared.
Map<String, DartType> types = <String, DartType>{};
_forEachParameterType(ParameterKind.NAMED, (name, type) {
types[name] = type;
});
+ _forEachParameterType(ParameterKind.NAMED_REQUIRED, (name, type) {
+ types[name] = type;
+ });
return types;
}
@@ -723,6 +680,9 @@
@override
void appendTo(StringBuffer buffer, Set<TypeImpl> visitedTypes,
{bool withNullability = false}) {
+ // TODO(paulberry): update to use the new "Function" syntax to avoid
+ // ambiguity with NNBD, and eliminate code duplication with
+ // _ElementWriter.writeType. See issue #35818.
if (visitedTypes.add(this)) {
if (typeFormals.isNotEmpty) {
// To print a type with type variables, first make sure we have unique
@@ -930,7 +890,7 @@
return this;
}
return new _FunctionTypeImplStrict._(returnType, typeFormals, parameters,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
@@ -1106,7 +1066,7 @@
var tOptional = <ParameterElement>[];
var tNamed = <String, ParameterElement>{};
for (var p in tParams) {
- if (p.isNotOptional) {
+ if (p.isRequiredPositional) {
tRequired.add(p);
} else if (p.isOptionalPositional) {
tOptional.add(p);
@@ -1120,7 +1080,7 @@
var sOptional = <ParameterElement>[];
var sNamed = <String, ParameterElement>{};
for (var p in sParams) {
- if (p.isNotOptional) {
+ if (p.isRequiredPositional) {
sRequired.add(p);
} else if (p.isOptionalPositional) {
sOptional.add(p);
@@ -1297,7 +1257,7 @@
*/
class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
@override
- final Nullability nullability;
+ final NullabilitySuffix nullabilitySuffix;
/**
* A list containing the actual types of the type arguments.
@@ -1340,7 +1300,7 @@
* Initialize a newly created type to be declared by the given [element].
*/
InterfaceTypeImpl(ClassElement element,
- [this.prunedTypedefs, this.nullability = Nullability.indeterminate])
+ [this.prunedTypedefs, this.nullabilitySuffix = NullabilitySuffix.star])
: super(element, element.displayName);
/**
@@ -1349,14 +1309,14 @@
*/
InterfaceTypeImpl.elementWithNameAndArgs(
ClassElement element, String name, this._typeArgumentsComputer,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: prunedTypedefs = null,
super(element, name) {
_typeArguments = null;
}
InterfaceTypeImpl.explicit(ClassElement element, List<DartType> typeArguments,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: prunedTypedefs = null,
_typeArguments = typeArguments,
super(element, element.displayName);
@@ -1366,7 +1326,7 @@
* should only be used in cases where there is no declaration of the type.
*/
InterfaceTypeImpl.named(String name,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: prunedTypedefs = null,
super(null, name);
@@ -1374,11 +1334,11 @@
* Private constructor.
*/
InterfaceTypeImpl._(Element element, String name, this.prunedTypedefs,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: super(element, name);
InterfaceTypeImpl._withNullability(InterfaceTypeImpl original,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: _typeArguments = original._typeArguments,
_typeArgumentsComputer = original._typeArgumentsComputer,
prunedTypedefs = original.prunedTypedefs,
@@ -1541,6 +1501,15 @@
}
@override
+ bool get isDartCoreString {
+ ClassElement element = this.element;
+ if (element == null) {
+ return false;
+ }
+ return element.name == "String" && element.library.isDartCore;
+ }
+
+ @override
bool get isObject => element.supertype == null && !element.isMixin;
@override
@@ -2220,7 +2189,7 @@
// base types.
assert(this.prunedTypedefs == null);
InterfaceTypeImpl result = new InterfaceTypeImpl._(element, name, prune,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
result.typeArguments = typeArguments
.map((DartType t) => (t as TypeImpl).pruned(prune))
.toList();
@@ -2249,7 +2218,7 @@
return this;
} else {
return new InterfaceTypeImpl._(element, name, prunedTypedefs,
- nullability: nullability)
+ nullabilitySuffix: nullabilitySuffix)
..typeArguments = typeArguments;
}
}
@@ -2273,7 +2242,7 @@
}
InterfaceTypeImpl newType =
- new InterfaceTypeImpl(element, prune, nullability);
+ new InterfaceTypeImpl(element, prune, nullabilitySuffix);
newType.typeArguments = newTypeArguments;
return newType;
}
@@ -2284,9 +2253,10 @@
instantiate(argumentTypes);
@override
- TypeImpl withNullability(Nullability nullability) {
- if (this.nullability == nullability) return this;
- return InterfaceTypeImpl._withNullability(this, nullability: nullability);
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ if (this.nullabilitySuffix == nullabilitySuffix) return this;
+ return InterfaceTypeImpl._withNullability(this,
+ nullabilitySuffix: nullabilitySuffix);
}
/**
@@ -2673,16 +2643,19 @@
}
}
- Nullability computeNullability() {
- Nullability first = (firstType as InterfaceTypeImpl).nullability;
- Nullability second = (secondType as InterfaceTypeImpl).nullability;
- if (first == Nullability.nullable || second == Nullability.nullable) {
- return Nullability.nullable;
- } else if (first == Nullability.indeterminate ||
- second == Nullability.indeterminate) {
- return Nullability.indeterminate;
+ NullabilitySuffix computeNullability() {
+ NullabilitySuffix first =
+ (firstType as InterfaceTypeImpl).nullabilitySuffix;
+ NullabilitySuffix second =
+ (secondType as InterfaceTypeImpl).nullabilitySuffix;
+ if (first == NullabilitySuffix.question ||
+ second == NullabilitySuffix.question) {
+ return NullabilitySuffix.question;
+ } else if (first == NullabilitySuffix.star ||
+ second == NullabilitySuffix.star) {
+ return NullabilitySuffix.star;
}
- return Nullability.nonNullable;
+ return NullabilitySuffix.none;
}
InterfaceTypeImpl lub =
@@ -2752,24 +2725,35 @@
}
/**
- * The nullability of a type.
+ * Suffix indicating the nullability of a type.
+ *
+ * This enum describes whether a `?` or `*` would be used at the end of the
+ * canonical representation of a type. It's subtly different the notions of
+ * "nullable", "non-nullable", "potentially nullable", and "potentially
+ * non-nullable" defined by the spec. For example, the type `Null` is nullable,
+ * even though it lacks a trailing `?`.
*/
-enum Nullability {
+enum NullabilitySuffix {
/**
- * An indication that the type includes the value `null`.
+ * An indication that the canonical representation of the type under
+ * consideration ends with `?`. Types having this nullability suffix should
+ * be interpreted as being unioned with the Null type.
*/
- nullable,
+ question,
/**
- * An indication that the type is a legacy type which may be interpreted as
- * either nullable or non-nullable as appropriate.
+ * An indication that the canonical representation of the type under
+ * consideration ends with `*`. Types having this nullability suffix are
+ * called "legacy types"; it has not yet been determined whether they should
+ * be unioned with the Null type.
*/
- indeterminate,
+ star,
/**
- * An indication that the type does not include the value `null`.
+ * An indication that the canonical representation of the type under
+ * consideration does not end with either `?` or `*`.
*/
- nonNullable
+ none
}
/**
@@ -2825,6 +2809,9 @@
bool get isDartCoreNull => false;
@override
+ bool get isDartCoreString => false;
+
+ @override
bool get isDynamic => false;
@override
@@ -2837,9 +2824,9 @@
bool get isVoid => false;
/**
- * Return the nullability of this type.
+ * Return the nullability suffix of this type.
*/
- Nullability get nullability;
+ NullabilitySuffix get nullabilitySuffix;
/**
* Append a textual representation of this type to the given [buffer]. The set
@@ -2970,20 +2957,24 @@
}
/**
- * Return the same type, but with the given [nullability].
+ * Return the same type, but with the given [nullabilitySuffix].
*/
- TypeImpl withNullability(Nullability nullability);
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix);
void _appendNullability(StringBuffer buffer) {
- switch (nullability) {
- case Nullability.nullable:
+ if (isDynamic || isBottom || isVoid) {
+ // These types don't have nullability variations, so don't append
+ // anything.
+ return;
+ }
+ switch (nullabilitySuffix) {
+ case NullabilitySuffix.question:
buffer.write('?');
break;
- case Nullability.indeterminate:
+ case NullabilitySuffix.star:
buffer.write('*');
break;
- case Nullability.nonNullable:
- buffer.write('!');
+ case NullabilitySuffix.none:
break;
}
}
@@ -3071,14 +3062,14 @@
static bool _appendingBounds = false;
@override
- final Nullability nullability;
+ final NullabilitySuffix nullabilitySuffix;
/**
* Initialize a newly created type parameter type to be declared by the given
* [element] and to have the given name.
*/
TypeParameterTypeImpl(TypeParameterElement element,
- {this.nullability = Nullability.indeterminate})
+ {this.nullabilitySuffix = NullabilitySuffix.star})
: super(element, element.name);
@override
@@ -3242,16 +3233,16 @@
}
// TODO(scheglov) Proposed substitution rules for nullability.
- Nullability resultNullability;
- Nullability argumentNullability = argumentType.nullability;
- if (argumentNullability == Nullability.nullable ||
- nullability == Nullability.nullable) {
- resultNullability = Nullability.nullable;
- } else if (argumentNullability == Nullability.indeterminate ||
- nullability == Nullability.indeterminate) {
- resultNullability = Nullability.indeterminate;
+ NullabilitySuffix resultNullability;
+ NullabilitySuffix argumentNullability = argumentType.nullabilitySuffix;
+ if (argumentNullability == NullabilitySuffix.question ||
+ nullabilitySuffix == NullabilitySuffix.question) {
+ resultNullability = NullabilitySuffix.question;
+ } else if (argumentNullability == NullabilitySuffix.star ||
+ nullabilitySuffix == NullabilitySuffix.star) {
+ resultNullability = NullabilitySuffix.star;
} else {
- resultNullability = Nullability.nonNullable;
+ resultNullability = NullabilitySuffix.none;
}
return argumentType.withNullability(resultNullability);
@@ -3261,9 +3252,9 @@
}
@override
- TypeImpl withNullability(Nullability nullability) {
- if (this.nullability == nullability) return this;
- return TypeParameterTypeImpl(element, nullability: nullability);
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ if (this.nullabilitySuffix == nullabilitySuffix) return this;
+ return TypeParameterTypeImpl(element, nullabilitySuffix: nullabilitySuffix);
}
/**
@@ -3285,87 +3276,6 @@
}
/**
- * The unique instance of the class `UndefinedTypeImpl` implements the type of
- * type names that couldn't be resolved.
- *
- * This class behaves like DynamicTypeImpl in almost every respect, to reduce
- * cascading errors.
- */
-class UndefinedTypeImpl extends TypeImpl {
- /**
- * The unique instance of this class.
- */
- static final UndefinedTypeImpl instance = new UndefinedTypeImpl._();
-
- /**
- * Prevent the creation of instances of this class.
- */
- UndefinedTypeImpl._()
- : super(DynamicElementImpl.instance, Keyword.DYNAMIC.lexeme);
-
- @override
- int get hashCode => 1;
-
- @override
- bool get isDynamic => true;
-
- @override
- bool get isUndefined => true;
-
- @override
- Nullability get nullability => Nullability.indeterminate;
-
- @override
- bool operator ==(Object object) => identical(object, this);
-
- @override
- bool isMoreSpecificThan(DartType type,
- [bool withDynamic = false, Set<Element> visitedElements]) {
- // T is S
- if (identical(this, type)) {
- return true;
- }
- // else
- return withDynamic;
- }
-
- @override
- bool isSubtypeOf(DartType type) => true;
-
- @override
- bool isSupertypeOf(DartType type) => true;
-
- @override
- TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
-
- @override
- DartType replaceTopAndBottom(TypeProvider typeProvider,
- {bool isCovariant = true}) {
- if (isCovariant) {
- return typeProvider.nullType;
- } else {
- return this;
- }
- }
-
- @override
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes,
- [List<FunctionTypeAliasElement> prune]) {
- int length = parameterTypes.length;
- for (int i = 0; i < length; i++) {
- if (parameterTypes[i] == this) {
- return argumentTypes[i];
- }
- }
- return this;
- }
-
- @override
- TypeImpl withNullability(Nullability nullability) => this;
-}
-
-/**
* The type `void`.
*/
abstract class VoidType implements DartType {
@@ -3381,33 +3291,12 @@
/**
* The unique instance of this class, with indeterminate nullability.
*/
- static final VoidTypeImpl instance = instanceIndeterminate;
-
- /**
- * The unique instance of this class, nullable.
- */
- static final VoidTypeImpl instanceNullable =
- new VoidTypeImpl._(Nullability.nullable);
-
- /**
- * The unique instance of this class, with indeterminate nullability.
- */
- static final VoidTypeImpl instanceIndeterminate =
- new VoidTypeImpl._(Nullability.indeterminate);
-
- /**
- * The unique instance of this class, non-nullable.
- */
- static final VoidTypeImpl instanceNonNullable =
- new VoidTypeImpl._(Nullability.nonNullable);
-
- @override
- final Nullability nullability;
+ static final VoidTypeImpl instance = new VoidTypeImpl._();
/**
* Prevent the creation of instances of this class.
*/
- VoidTypeImpl._(this.nullability) : super(null, Keyword.VOID.lexeme);
+ VoidTypeImpl._() : super(null, Keyword.VOID.lexeme);
@override
int get hashCode => 2;
@@ -3416,6 +3305,9 @@
bool get isVoid => true;
@override
+ NullabilitySuffix get nullabilitySuffix => NullabilitySuffix.none;
+
+ @override
bool operator ==(Object object) => identical(object, this);
@override
@@ -3452,16 +3344,9 @@
this;
@override
- TypeImpl withNullability(Nullability nullability) {
- switch (nullability) {
- case Nullability.nullable:
- return instanceNullable;
- case Nullability.indeterminate:
- return instanceIndeterminate;
- case Nullability.nonNullable:
- return instanceNonNullable;
- }
- throw StateError('Unexpected nullability: $nullability');
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ // The void type is always nullable.
+ return this;
}
}
@@ -3514,9 +3399,9 @@
this._returnType,
this._parameters,
this._isInstantiated,
- {Nullability nullability = Nullability.indeterminate})
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star})
: _typeParameters = null,
- super._(element, name, nullability);
+ super._(element, name, nullabilitySuffix);
/**
* Return the base parameter elements of this function element.
@@ -3556,7 +3441,7 @@
@override
List<String> get normalParameterNames {
return baseParameters
- .where((parameter) => parameter.isNotOptional)
+ .where((parameter) => parameter.isRequiredPositional)
.map((parameter) => parameter.name)
.toList();
}
@@ -3723,7 +3608,7 @@
return new _FunctionTypeImplLazy._(element, name, prunedTypedefs,
newTypeArgs, _returnType, _parameters, true,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
@@ -3745,7 +3630,7 @@
.toList(growable: false);
return new _FunctionTypeImplLazy._(element, name, prune, typeArgs,
_returnType, _parameters, _isInstantiated,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
}
@@ -3774,15 +3659,15 @@
TypeImpl.substitute(typeArguments, argumentTypes, parameterTypes);
return new _FunctionTypeImplLazy._(element, name, prune, typeArgs,
_returnType, _parameters, _isInstantiated,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
- TypeImpl withNullability(Nullability nullability) {
- if (this.nullability == nullability) return this;
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ if (this.nullabilitySuffix == nullabilitySuffix) return this;
return _FunctionTypeImplLazy._(element, name, prunedTypedefs,
_typeArguments, _returnType, _parameters, _isInstantiated,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
@@ -3830,8 +3715,8 @@
final List<ParameterElement> parameters;
_FunctionTypeImplStrict._(this.returnType, this.typeFormals, this.parameters,
- {Nullability nullability = Nullability.indeterminate})
- : super._(null, null, nullability);
+ {NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star})
+ : super._(null, null, nullabilitySuffix);
@override
List<TypeParameterElement> get boundTypeParameters => typeFormals;
@@ -3843,8 +3728,10 @@
List<FunctionTypeAliasElement> get newPrune => const [];
@override
- List<String> get normalParameterNames =>
- parameters.where((p) => p.isNotOptional).map((p) => p.name).toList();
+ List<String> get normalParameterNames => parameters
+ .where((p) => p.isRequiredPositional)
+ .map((p) => p.name)
+ .toList();
@override
List<String> get optionalParameterNames => parameters
@@ -3887,7 +3774,7 @@
returnType.substitute2(argumentTypes, parameterTypes),
const [],
_transformOrShare(parameters, transformParameter),
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
@@ -3947,14 +3834,14 @@
}
return new _FunctionTypeImplStrict._(
newReturnType, newTypeFormals, newParameters,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
- TypeImpl withNullability(Nullability nullability) {
- if (this.nullability == nullability) return this;
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
+ if (this.nullabilitySuffix == nullabilitySuffix) return this;
return _FunctionTypeImplStrict._(returnType, typeFormals, parameters,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
}
@override
diff --git a/analyzer/lib/src/dart/element/type_algebra.dart b/analyzer/lib/src/dart/element/type_algebra.dart
new file mode 100644
index 0000000..d73ab28
--- /dev/null
+++ b/analyzer/lib/src/dart/element/type_algebra.dart
@@ -0,0 +1,413 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_visitor.dart';
+import 'package:analyzer/src/summary2/function_type_builder.dart';
+import 'package:analyzer/src/summary2/named_type_builder.dart';
+
+/// Generates a fresh copy of the given type parameters, with their bounds
+/// substituted to reference the new parameters.
+///
+/// The returned object contains the fresh type parameter list as well as a
+/// mapping to be used for replacing other types to use the new type parameters.
+FreshTypeParameters getFreshTypeParameters(
+ List<TypeParameterElement> typeParameters) {
+ var freshParameters = new List<TypeParameterElementImpl>.generate(
+ typeParameters.length,
+ (i) => new TypeParameterElementImpl(typeParameters[i].name, -1),
+ growable: true,
+ );
+
+ var map = <TypeParameterElement, DartType>{};
+ for (int i = 0; i < typeParameters.length; ++i) {
+ map[typeParameters[i]] = new TypeParameterTypeImpl(freshParameters[i]);
+ }
+
+ var substitution = Substitution.fromMap(map);
+
+ for (int i = 0; i < typeParameters.length; ++i) {
+ var bound = typeParameters[i].bound;
+ if (bound != null) {
+ var newBound = substitution.substituteType(bound);
+ freshParameters[i].bound = newBound;
+ }
+ }
+
+ return new FreshTypeParameters(freshParameters, substitution);
+}
+
+/// Returns a type where all occurrences of the given type parameters have been
+/// replaced with the corresponding types.
+///
+/// This will copy only the sub-terms of [type] that contain substituted
+/// variables; all other [DartType] objects will be reused.
+///
+/// In particular, if no type parameters were substituted, this is guaranteed
+/// to return the [type] instance (not a copy), so the caller may use
+/// [identical] to efficiently check if a distinct type was created.
+DartType substitute(
+ DartType type,
+ Map<TypeParameterElement, DartType> substitution,
+) {
+ if (substitution.isEmpty) {
+ return type;
+ }
+ return Substitution.fromMap(substitution).substituteType(type);
+}
+
+class FreshTypeParameters {
+ final List<TypeParameterElement> freshTypeParameters;
+ final Substitution substitution;
+
+ FreshTypeParameters(this.freshTypeParameters, this.substitution);
+
+ FunctionType applyToFunctionType(FunctionType type) {
+ return new FunctionTypeImpl.synthetic(
+ substitute(type.returnType),
+ freshTypeParameters,
+ type.parameters.map((parameter) {
+ return ParameterElementImpl.synthetic(
+ parameter.name,
+ substitute(parameter.type),
+ // ignore: deprecated_member_use_from_same_package
+ parameter.parameterKind,
+ );
+ }).toList(),
+ );
+ }
+
+ DartType substitute(DartType type) => substitution.substituteType(type);
+}
+
+abstract class Substitution {
+ static const Substitution empty = _NullSubstitution.instance;
+
+ const Substitution();
+
+ DartType getSubstitute(TypeParameterElement parameter, bool upperBound);
+
+ DartType substituteType(DartType type, {bool contravariant: false}) {
+ return new _TopSubstitutor(this, contravariant).visit(type);
+ }
+
+ /// Substitutes the type parameters on the class of [type] with the
+ /// type arguments provided in [type].
+ static Substitution fromInterfaceType(InterfaceType type) {
+ if (type.typeArguments.isEmpty) {
+ return _NullSubstitution.instance;
+ }
+ return fromPairs(type.element.typeParameters, type.typeArguments);
+ }
+
+ /// Substitutes each parameter to the type it maps to in [map].
+ static Substitution fromMap(Map<TypeParameterElement, DartType> map) {
+ if (map.isEmpty) {
+ return _NullSubstitution.instance;
+ }
+ return new _MapSubstitution(map, map);
+ }
+
+ /// Substitutes the Nth parameter in [parameters] with the Nth type in
+ /// [types].
+ static Substitution fromPairs(
+ List<TypeParameterElement> parameters,
+ List<DartType> types,
+ ) {
+ assert(parameters.length == types.length);
+ if (parameters.isEmpty) {
+ return _NullSubstitution.instance;
+ }
+ return fromMap(
+ new Map<TypeParameterElement, DartType>.fromIterables(
+ parameters,
+ types,
+ ),
+ );
+ }
+
+ /// Substitutes all occurrences of the given type parameters with the
+ /// corresponding upper or lower bound, depending on the variance of the
+ /// context where it occurs.
+ ///
+ /// For example the type `(T) => T` with the bounds `bottom <: T <: num`
+ /// becomes `(bottom) => num` (in this example, `num` is the upper bound,
+ /// and `bottom` is the lower bound).
+ ///
+ /// This is a way to obtain an upper bound for a type while eliminating all
+ /// references to certain type variables.
+ static Substitution fromUpperAndLowerBounds(
+ Map<TypeParameterElement, DartType> upper,
+ Map<TypeParameterElement, DartType> lower,
+ ) {
+ if (upper.isEmpty && lower.isEmpty) {
+ return _NullSubstitution.instance;
+ }
+ return new _MapSubstitution(upper, lower);
+ }
+}
+
+class _FreshTypeParametersSubstitutor extends _TypeSubstitutor {
+ final Map<TypeParameterElement, DartType> substitution = {};
+
+ _FreshTypeParametersSubstitutor(_TypeSubstitutor outer) : super(outer);
+
+ TypeParameterElement freshTypeParameter(TypeParameterElement element) {
+ var freshElement = new TypeParameterElementImpl(element.name, -1);
+ var freshType = new TypeParameterTypeImpl(freshElement);
+ freshElement.type = freshType;
+ substitution[element] = freshType;
+ if (element.bound != null) {
+ freshElement.bound = visit(element.bound);
+ }
+ return freshElement;
+ }
+
+ DartType lookup(TypeParameterElement parameter, bool upperBound) {
+ return substitution[parameter];
+ }
+}
+
+class _MapSubstitution extends Substitution {
+ final Map<TypeParameterElement, DartType> upper;
+ final Map<TypeParameterElement, DartType> lower;
+
+ _MapSubstitution(this.upper, this.lower);
+
+ DartType getSubstitute(TypeParameterElement parameter, bool upperBound) {
+ return upperBound ? upper[parameter] : lower[parameter];
+ }
+}
+
+class _NullSubstitution extends Substitution {
+ static const _NullSubstitution instance = const _NullSubstitution();
+
+ const _NullSubstitution();
+
+ DartType getSubstitute(TypeParameterElement parameter, bool upperBound) {
+ return new TypeParameterTypeImpl(parameter);
+ }
+
+ @override
+ DartType substituteType(DartType type, {bool contravariant: false}) => type;
+}
+
+class _TopSubstitutor extends _TypeSubstitutor {
+ final Substitution substitution;
+
+ _TopSubstitutor(this.substitution, bool contravariant) : super(null) {
+ if (contravariant) {
+ invertVariance();
+ }
+ }
+
+ @override
+ TypeParameterElement freshTypeParameter(TypeParameterElement element) {
+ throw 'Create a fresh environment first';
+ }
+
+ @override
+ DartType lookup(TypeParameterElement parameter, bool upperBound) {
+ return substitution.getSubstitute(parameter, upperBound);
+ }
+}
+
+abstract class _TypeSubstitutor extends DartTypeVisitor<DartType> {
+ final _TypeSubstitutor outer;
+ bool covariantContext = true;
+
+ /// The number of times a variable from this environment has been used in
+ /// a substitution.
+ ///
+ /// There is a strict requirement that we must return the same instance for
+ /// types that were not altered by the substitution. This counter lets us
+ /// check quickly if anything happened in a substitution.
+ int useCounter = 0;
+
+ _TypeSubstitutor(this.outer) {
+ covariantContext = outer == null ? true : outer.covariantContext;
+ }
+
+ void bumpCountersUntil(_TypeSubstitutor target) {
+ var substitutor = this;
+ while (substitutor != target) {
+ substitutor.useCounter++;
+ substitutor = substitutor.outer;
+ }
+ target.useCounter++;
+ }
+
+ TypeParameterElement freshTypeParameter(TypeParameterElement element);
+
+ List<TypeParameterElement> freshTypeParameters(
+ List<TypeParameterElement> parameters) {
+ if (parameters.isEmpty) {
+ return const <TypeParameterElement>[];
+ }
+ return parameters.map(freshTypeParameter).toList();
+ }
+
+ DartType getSubstitute(TypeParameterElement parameter) {
+ var environment = this;
+ while (environment != null) {
+ var replacement = environment.lookup(parameter, covariantContext);
+ if (replacement != null) {
+ bumpCountersUntil(environment);
+ return replacement;
+ }
+ environment = environment.outer;
+ }
+ return null;
+ }
+
+ void invertVariance() {
+ covariantContext = !covariantContext;
+ }
+
+ DartType lookup(TypeParameterElement parameter, bool upperBound);
+
+ _FreshTypeParametersSubstitutor newInnerEnvironment() {
+ return new _FreshTypeParametersSubstitutor(this);
+ }
+
+ DartType visit(DartType type) {
+ return DartTypeVisitor.visit(type, this);
+ }
+
+ @override
+ DartType visitBottomType(BottomTypeImpl type) => type;
+
+ @override
+ DartType visitDynamicType(DynamicTypeImpl type) => type;
+
+ @override
+ DartType visitFunctionType(FunctionType type) {
+ // This is a bit tricky because we have to generate fresh type parameters
+ // in order to change the bounds. At the same time, if the function type
+ // was unaltered, we have to return the [type] object (not a copy!).
+ // Substituting a type for a fresh type variable should not be confused
+ // with a "real" substitution.
+ //
+ // Create an inner environment to generate fresh type parameters. The use
+ // counter on the inner environment tells if the fresh type parameters have
+ // any uses, but does not tell if the resulting function type is distinct.
+ // Our own use counter will get incremented if something from our
+ // environment has been used inside the function.
+ var inner = type.typeFormals.isEmpty ? this : newInnerEnvironment();
+ int before = this.useCounter;
+
+ // Invert the variance when translating parameters.
+ inner.invertVariance();
+
+ var typeFormals = inner.freshTypeParameters(type.typeFormals);
+
+ var parameters = type.parameters.map((parameter) {
+ var type = inner.visit(parameter.type);
+ return ParameterElementImpl.synthetic(
+ parameter.name,
+ type,
+ // ignore: deprecated_member_use_from_same_package
+ parameter.parameterKind,
+ );
+ }).toList();
+
+ inner.invertVariance();
+
+ var returnType = inner.visit(type.returnType);
+
+ if (this.useCounter == before) return type;
+
+ return FunctionTypeImpl.synthetic(returnType, typeFormals, parameters);
+ }
+
+ @override
+ DartType visitFunctionTypeBuilder(FunctionTypeBuilder type) {
+ // This is a bit tricky because we have to generate fresh type parameters
+ // in order to change the bounds. At the same time, if the function type
+ // was unaltered, we have to return the [type] object (not a copy!).
+ // Substituting a type for a fresh type variable should not be confused
+ // with a "real" substitution.
+ //
+ // Create an inner environment to generate fresh type parameters. The use
+ // counter on the inner environment tells if the fresh type parameters have
+ // any uses, but does not tell if the resulting function type is distinct.
+ // Our own use counter will get incremented if something from our
+ // environment has been used inside the function.
+ var inner = type.typeFormals.isEmpty ? this : newInnerEnvironment();
+ int before = this.useCounter;
+
+ // Invert the variance when translating parameters.
+ inner.invertVariance();
+
+ var typeFormals = inner.freshTypeParameters(type.typeFormals);
+
+ var parameters = type.parameters.map((parameter) {
+ var type = inner.visit(parameter.type);
+ return ParameterElementImpl.synthetic(
+ parameter.name,
+ type,
+ // ignore: deprecated_member_use_from_same_package
+ parameter.parameterKind,
+ );
+ }).toList();
+
+ inner.invertVariance();
+
+ var returnType = inner.visit(type.returnType);
+
+ if (this.useCounter == before) return type;
+
+ return FunctionTypeBuilder(
+ typeFormals,
+ parameters,
+ returnType,
+ type.nullabilitySuffix,
+ );
+ }
+
+ @override
+ DartType visitInterfaceType(InterfaceType type) {
+ if (type.typeArguments.isEmpty) {
+ return type;
+ }
+
+ int before = useCounter;
+ var typeArguments = type.typeArguments.map(visit).toList();
+ if (useCounter == before) {
+ return type;
+ }
+
+ return new InterfaceTypeImpl.explicit(type.element, typeArguments);
+ }
+
+ @override
+ DartType visitNamedType(NamedTypeBuilder type) {
+ if (type.arguments.isEmpty) {
+ return type;
+ }
+
+ int before = useCounter;
+ var arguments = type.arguments.map(visit).toList();
+ if (useCounter == before) {
+ return type;
+ }
+
+ return new NamedTypeBuilder(
+ type.element,
+ arguments,
+ type.nullabilitySuffix,
+ );
+ }
+
+ @override
+ DartType visitTypeParameterType(TypeParameterType type) {
+ return getSubstitute(type.element) ?? type;
+ }
+
+ @override
+ DartType visitVoidType(VoidType type) => type;
+}
diff --git a/analyzer/lib/src/dart/element/type_visitor.dart b/analyzer/lib/src/dart/element/type_visitor.dart
new file mode 100644
index 0000000..08b8de6
--- /dev/null
+++ b/analyzer/lib/src/dart/element/type_visitor.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/summary2/function_type_builder.dart';
+import 'package:analyzer/src/summary2/named_type_builder.dart';
+
+class DartTypeVisitor<R> {
+ const DartTypeVisitor();
+
+ R defaultDartType(DartType type) => null;
+
+ R visitBottomType(BottomTypeImpl type) => defaultDartType(type);
+
+ R visitDynamicType(DynamicTypeImpl type) => defaultDartType(type);
+
+ R visitFunctionType(FunctionType type) => defaultDartType(type);
+
+ R visitFunctionTypeBuilder(FunctionTypeBuilder type) => defaultDartType(type);
+
+ R visitInterfaceType(InterfaceType type) => defaultDartType(type);
+
+ R visitNamedType(NamedTypeBuilder type) => defaultDartType(type);
+
+ R visitTypeParameterType(TypeParameterType type) => defaultDartType(type);
+
+ R visitVoidType(VoidType type) => defaultDartType(type);
+
+ static R visit<R>(DartType type, DartTypeVisitor<R> visitor) {
+ if (type is BottomTypeImpl) {
+ return visitor.visitBottomType(type);
+ }
+ if (type is DynamicTypeImpl) {
+ return visitor.visitDynamicType(type);
+ }
+ if (type is FunctionType) {
+ return visitor.visitFunctionType(type);
+ }
+ if (type is FunctionTypeBuilder) {
+ return visitor.visitFunctionTypeBuilder(type);
+ }
+ if (type is InterfaceType) {
+ return visitor.visitInterfaceType(type);
+ }
+ if (type is NamedTypeBuilder) {
+ return visitor.visitNamedType(type);
+ }
+ if (type is TypeParameterType) {
+ return visitor.visitTypeParameterType(type);
+ }
+ if (type is VoidType) {
+ return visitor.visitVoidType(type);
+ }
+ throw UnimplementedError('(${type.runtimeType}) $type');
+ }
+}
diff --git a/analyzer/lib/src/dart/element/wrapped.dart b/analyzer/lib/src/dart/element/wrapped.dart
index 10c3f75..5a9be7c 100644
--- a/analyzer/lib/src/dart/element/wrapped.dart
+++ b/analyzer/lib/src/dart/element/wrapped.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -71,6 +71,12 @@
bool get hasLoadLibraryFunction => wrappedUnit.hasLoadLibraryFunction;
@override
+ bool get hasMustCallSuper => wrappedUnit.hasMustCallSuper;
+
+ @override
+ bool get hasOptionalTypeArgs => wrappedUnit.hasOptionalTypeArgs;
+
+ @override
bool get hasOverride => wrappedUnit.hasOverride;
@override
@@ -261,6 +267,12 @@
bool get hasLiteral => wrappedImport.hasLiteral;
@override
+ bool get hasMustCallSuper => wrappedImport.hasMustCallSuper;
+
+ @override
+ bool get hasOptionalTypeArgs => wrappedImport.hasOptionalTypeArgs;
+
+ @override
bool get hasOverride => wrappedImport.hasOverride;
@override
@@ -466,6 +478,12 @@
bool get hasLoadLibraryFunction => wrappedLib.hasLoadLibraryFunction;
@override
+ bool get hasMustCallSuper => wrappedLib.hasMustCallSuper;
+
+ @override
+ bool get hasOptionalTypeArgs => wrappedLib.hasOptionalTypeArgs;
+
+ @override
bool get hasOverride => wrappedLib.hasOverride;
@override
diff --git a/analyzer/lib/src/dart/error/hint_codes.dart b/analyzer/lib/src/dart/error/hint_codes.dart
index 39f9dee..a11b0d2 100644
--- a/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/analyzer/lib/src/dart/error/hint_codes.dart
@@ -34,7 +34,7 @@
static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode(
'DEAD_CODE_CATCH_FOLLOWING_CATCH',
"Dead code: catch clauses after a 'catch (e)' or "
- "an 'on Object catch (e)' are never reached.",
+ "an 'on Object catch (e)' are never reached.",
correction:
"Try reordering the catch clauses so that they can be reached, or "
"removing the unreachable catch clauses.");
@@ -51,7 +51,7 @@
static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode(
'DEAD_CODE_ON_CATCH_SUBTYPE',
"Dead code: this on-catch block will never be executed because '{0}' is "
- "a subtype of '{1}' and hence will have been caught above.",
+ "a subtype of '{1}' and hence will have been caught above.",
correction:
"Try reordering the catch clauses so that this block can be reached, or "
"removing the unreachable catch clause.");
@@ -148,7 +148,7 @@
const HintCode(
'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
"A file in the 'lib' directory shouldn't import a file outside the "
- "'lib' directory.",
+ "'lib' directory.",
correction: "Try removing the import, or "
"moving the imported file inside the 'lib' directory.");
@@ -163,7 +163,7 @@
const HintCode(
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
"A file outside the 'lib' directory shouldn't reference a file "
- "inside the 'lib' directory using a relative path.",
+ "inside the 'lib' directory using a relative path.",
correction: "Try using a package: URI instead.");
/**
@@ -173,11 +173,30 @@
const HintCode(
'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
"The library '{0}' defines a top-level function named 'loadLibrary' "
- "which is hidden by deferring this library.",
+ "which is hidden by deferring this library.",
correction: "Try changing the import to not be deferred, or "
"rename the function in the imported library.");
/**
+ * When "strict-inference" is enabled, collection literal types must be
+ * inferred via the context type, or have type arguments.
+ */
+ static const HintCode INFERENCE_FAILURE_ON_COLLECTION_LITERAL = HintCode(
+ 'INFERENCE_FAILURE_ON_COLLECTION_LITERAL',
+ "The type argument(s) of '{0}' cannot be inferred.",
+ correction: "Use explicit type argument(s) for '{0}'.");
+
+ /**
+ * When "strict-inference" is enabled, types in instance creation
+ * (constructor calls) must be inferred via the context type, or have type
+ * arguments.
+ */
+ static const HintCode INFERENCE_FAILURE_ON_INSTANCE_CREATION = HintCode(
+ 'INFERENCE_FAILURE_ON_INSTANCE_CREATION',
+ "The type argument(s) of '{0}' cannot be inferred.",
+ correction: "Use explicit type argument(s) for '{0}'.");
+
+ /**
* When "strict-inference" in enabled, uninitialized variables must be
* declared with a specific type.
*/
@@ -185,18 +204,10 @@
const HintCode(
'INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE',
"The type of {0} cannot be inferred without either a type or "
- "initializer.",
+ "initializer.",
correction: "Try specifying the type of the variable.");
/**
- * When "strict-raw-types" is enabled, raw types must be inferred via the
- * context type, or have type arguments other than dynamic.
- */
- static const HintCode STRICT_RAW_TYPE = HintCode('STRICT_RAW_TYPE',
- "The generic type '{0}' should have explicit type arguments but doesn't.",
- correction: "Use explicit type arguments for '{0}'.");
-
- /**
* This hint is generated anywhere a @factory annotation is associated with
* anything other than a method.
*/
@@ -250,7 +261,7 @@
static const HintCode INVALID_REQUIRED_PARAM = const HintCode(
'INVALID_REQUIRED_PARAM',
"The type parameter '{0}' is annotated with @required but only named "
- "parameters without default value can be annotated with it.",
+ "parameters without default value can be annotated with it.",
correction: "Remove @required.");
/**
@@ -263,7 +274,7 @@
static const HintCode INVALID_SEALED_ANNOTATION = const HintCode(
'INVALID_SEALED_ANNOTATION',
"The member '{0}' is annotated with '@sealed' but only classes can be "
- "annotated with it.",
+ "annotated with it.",
correction: "Remove @sealed.");
/**
@@ -277,7 +288,7 @@
static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = const HintCode(
'INVALID_USE_OF_PROTECTED_MEMBER',
"The member '{0}' can only be used within instance members of subclasses "
- "of '{1}'.");
+ "of '{1}'.");
/// This hint is generated anywhere where a member annotated with
/// `@visibleForTemplate` is used outside of a "template" Dart file.
@@ -308,7 +319,7 @@
static const HintCode INVALID_VISIBILITY_ANNOTATION = const HintCode(
'INVALID_VISIBILITY_ANNOTATION',
"The member '{0}' is annotated with '{1}', but this annotation is only "
- "meaningful on declarations of public members.");
+ "meaningful on declarations of public members.");
/**
* Hint for the `x is double` type checks.
@@ -316,16 +327,18 @@
static const HintCode IS_DOUBLE = const HintCode(
'IS_DOUBLE',
"When compiled to JS, this test might return true when the left hand "
- "side is an int.",
+ "side is an int.",
correction: "Try testing for 'num' instead.");
/**
* Hint for the `x is int` type checks.
*/
+ // TODO(brianwilkerson) This hint isn't being generated. Decide whether to
+ // generate it or remove it.
static const HintCode IS_INT = const HintCode(
'IS_INT',
"When compiled to JS, this test might return true when the left hand "
- "side is a double.",
+ "side is a double.",
correction: "Try testing for 'num' instead.");
/**
@@ -334,16 +347,18 @@
static const HintCode IS_NOT_DOUBLE = const HintCode(
'IS_NOT_DOUBLE',
"When compiled to JS, this test might return false when the left hand "
- "side is an int.",
+ "side is an int.",
correction: "Try testing for 'num' instead.");
/**
* Hint for the `x is! int` type checks.
*/
+ // TODO(brianwilkerson) This hint isn't being generated. Decide whether to
+ // generate it or remove it.
static const HintCode IS_NOT_INT = const HintCode(
'IS_NOT_INT',
"When compiled to JS, this test might return false when the left hand "
- "side is a double.",
+ "side is a double.",
correction: "Try testing for 'num' instead.");
/**
@@ -353,7 +368,7 @@
static const HintCode MISSING_JS_LIB_ANNOTATION = const HintCode(
'MISSING_JS_LIB_ANNOTATION',
"The @JS() annotation can only be used if it is also declared on the "
- "library directive.",
+ "library directive.",
correction: "Try adding the annotation to the library directive.");
/**
@@ -390,7 +405,7 @@
static const HintCode MISSING_RETURN = const HintCode(
'MISSING_RETURN',
"This function has a return type of '{0}', but doesn't end with a "
- "return statement.",
+ "return statement.",
correction: "Try adding a return statement, "
"or changing the return type to 'void'.");
@@ -401,7 +416,7 @@
static const HintCode MIXIN_ON_SEALED_CLASS = const HintCode(
'MIXIN_ON_SEALED_CLASS',
"The class '{0}' should not be used as a mixin constraint because it is "
- "sealed, and any class mixing in this mixin has '{0}' as a superclass.",
+ "sealed, and any class mixing in this mixin has '{0}' as a superclass.",
correction:
"Try composing with this class, or refer to its documentation for "
"more information.");
@@ -413,8 +428,8 @@
static const HintCode MUST_BE_IMMUTABLE = const HintCode(
'MUST_BE_IMMUTABLE',
"This class (or a class which this class inherits from) is marked as "
- "'@immutable', but one or more of its instance fields are not final: "
- "{0}");
+ "'@immutable', but one or more of its instance fields are not final: "
+ "{0}");
/**
* Generate a hint for methods that override methods annotated `@mustCallSuper`
@@ -426,7 +441,7 @@
static const HintCode MUST_CALL_SUPER = const HintCode(
'MUST_CALL_SUPER',
"This method overrides a method annotated as @mustCallSuper in '{0}', "
- "but does not invoke the overridden method.");
+ "but does not invoke the overridden method.");
/**
* Generate a hint for non-const instance creation using a constructor
@@ -435,7 +450,7 @@
static const HintCode NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR = const HintCode(
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
"This instance creation must be 'const', because the {0} constructor is "
- "marked as '@literal'.",
+ "marked as '@literal'.",
correction: "Try adding a 'const' keyword.");
/**
@@ -446,7 +461,7 @@
const HintCode(
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
"This instance creation must be 'const', because the {0} constructor is "
- "marked as '@literal'.",
+ "marked as '@literal'.",
correction: "Try replacing the 'new' keyword with 'const'.");
/**
@@ -464,7 +479,7 @@
static const HintCode NULL_AWARE_IN_CONDITION = const HintCode(
'NULL_AWARE_IN_CONDITION',
"The value of the '?.' operator can be 'null', which isn't appropriate "
- "in a condition.",
+ "in a condition.",
correction:
"Try replacing the '?.' with a '.', testing the left-hand side for null if "
"necessary.");
@@ -476,7 +491,7 @@
static const HintCode NULL_AWARE_IN_LOGICAL_OPERATOR = const HintCode(
'NULL_AWARE_IN_LOGICAL_OPERATOR',
"The value of the '?.' operator can be 'null', which isn't appropriate "
- "as an operand of a logical operator.");
+ "as an operand of a logical operator.");
/**
* Hint for classes that override equals, but not hashCode.
@@ -545,18 +560,106 @@
static const HintCode SDK_VERSION_ASYNC_EXPORTED_FROM_CORE = const HintCode(
'SDK_VERSION_ASYNC_EXPORTED_FROM_CORE',
"The class '{0}' was not exported from 'dart:core' until version 2.1, "
- "but this code is required to be able to run on earlier versions.",
+ "but this code is required to be able to run on earlier versions.",
correction:
"Try either importing 'dart:async' or updating the SDK constraints.");
/**
+ * An as expression being used in a const context is expected to run on
+ * versions of the SDK that did not support them.
+ */
+ static const HintCode SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT = const HintCode(
+ 'SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT',
+ "The use of an as expression in a constant expression wasn't "
+ "supported until version 2.2.2, but this code is required to be able "
+ "to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * The operator '&', '|' or '^' is being used on boolean values in code that
+ * is expected to run on versions of the SDK that did not support it.
+ */
+ static const HintCode SDK_VERSION_BOOL_OPERATOR = const HintCode(
+ 'SDK_VERSION_BOOL_OPERATOR',
+ "Using the operator '{0}' for 'bool's was not supported until version "
+ "2.2.2, but this code is required to be able to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * The operator '==' is being used on non-primitive values in code that
+ * is expected to run on versions of the SDK that did not support it.
+ */
+ static const HintCode SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT = const HintCode(
+ 'SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT',
+ "Using the operator '==' for non-primitive types was not supported until "
+ "version 2.2.2, but this code is required to be able to run on earlier "
+ "versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * The operator '>>>' is being used in code that is expected to run on
+ * versions of the SDK that did not support it.
+ */
+ static const HintCode SDK_VERSION_GT_GT_GT_OPERATOR = const HintCode(
+ 'SDK_VERSION_GT_GT_GT_OPERATOR',
+ "The operator '>>>' was not supported until version 2.2.2, but this code "
+ "is required to be able to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * An is expression being used in a const context is expected to run on
+ * versions of the SDK that did not support them.
+ */
+ static const HintCode SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT = const HintCode(
+ 'SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT',
+ "The use of an is expression in a constant expression wasn't "
+ "supported until version 2.2.2, but this code is required to be able "
+ "to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * A set literal is being used in code that is expected to run on versions of
+ * the SDK that did not support them.
+ */
+ static const HintCode SDK_VERSION_SET_LITERAL = const HintCode(
+ 'SDK_VERSION_SET_LITERAL',
+ "Set literals were not supported until version 2.2, "
+ "but this code is required to be able to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * The type Never is being used in code that is expected to run on versions of
+ * the SDK that did not support it.
+ */
+ static const HintCode SDK_VERSION_NEVER = const HintCode(
+ 'SDK_VERSION_NEVER', "The type Never is not yet supported.");
+
+ /**
+ * The for, if or spread element is being used in code that is expected to run
+ * on versions of the SDK that did not support them.
+ */
+ static const HintCode SDK_VERSION_UI_AS_CODE = const HintCode(
+ 'SDK_VERSION_UI_AS_CODE',
+ "The for, if and spread elements were not supported until version 2.2.2, "
+ "but this code is required to be able to run on earlier versions.",
+ correction: "Try updating the SDK constraints.");
+
+ /**
+ * When "strict-raw-types" is enabled, raw types must be inferred via the
+ * context type, or have type arguments.
+ */
+ static const HintCode STRICT_RAW_TYPE = HintCode('STRICT_RAW_TYPE',
+ "The generic type '{0}' should have explicit type arguments but doesn't.",
+ correction: "Use explicit type arguments for '{0}'.");
+
+ /**
* This hint is generated anywhere where a `@sealed` class or mixin is used as
* a super-type of a class.
*/
static const HintCode SUBTYPE_OF_SEALED_CLASS = const HintCode(
'SUBTYPE_OF_SEALED_CLASS',
"The class '{0}' should not be extended, mixed in, or implemented "
- "because it is sealed.",
+ "because it is sealed.",
correction:
"Try composing instead of inheriting, or refer to its documentation "
"for more information.");
diff --git a/analyzer/lib/src/dart/error/syntactic_errors.dart b/analyzer/lib/src/dart/error/syntactic_errors.dart
index 62e8d17..5110557 100644
--- a/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -65,13 +65,18 @@
static const ParserErrorCode COLON_IN_PLACE_OF_IN = _COLON_IN_PLACE_OF_IN;
- static const ParserErrorCode CONST_AFTER_FACTORY = _CONST_AFTER_FACTORY;
+ static const ParserErrorCode CONFLICTING_MODIFIERS = _CONFLICTING_MODIFIERS;
- static const ParserErrorCode CONST_AND_COVARIANT = _CONST_AND_COVARIANT;
+ // TODO(danrubel): Remove this unused error code
+ static const ParserErrorCode CONST_AFTER_FACTORY = _MODIFIER_OUT_OF_ORDER;
+
+ // TODO(danrubel): Remove this unused error code
+ static const ParserErrorCode CONST_AND_COVARIANT = _CONFLICTING_MODIFIERS;
static const ParserErrorCode CONST_AND_FINAL = _CONST_AND_FINAL;
- static const ParserErrorCode CONST_AND_VAR = _CONST_AND_VAR;
+ // TODO(danrubel): Remove this unused error code
+ static const ParserErrorCode CONST_AND_VAR = _CONFLICTING_MODIFIERS;
static const ParserErrorCode CONST_CLASS = _CONST_CLASS;
@@ -101,7 +106,8 @@
static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE =
_CONTINUE_WITHOUT_LABEL_IN_CASE;
- static const ParserErrorCode COVARIANT_AFTER_FINAL = _COVARIANT_AFTER_FINAL;
+ // TODO(danrubel): Remove this unused error code
+ static const ParserErrorCode COVARIANT_AFTER_FINAL = _MODIFIER_OUT_OF_ORDER;
static const ParserErrorCode COVARIANT_AFTER_VAR = _COVARIANT_AFTER_VAR;
@@ -379,11 +385,17 @@
"The modifier 'async*' isn't allowed for an expression function body.",
correction: "Try converting the body to a block.");
+ static const ParserErrorCode INVALID_SUPER_IN_INITIALIZER =
+ _INVALID_SUPER_IN_INITIALIZER;
+
static const ParserErrorCode INVALID_SYNC = const ParserErrorCode(
'INVALID_SYNC',
"The modifier 'sync' isn't allowed for an expression function body.",
correction: "Try converting the body to a block.");
+ static const ParserErrorCode INVALID_THIS_IN_INITIALIZER =
+ _INVALID_THIS_IN_INITIALIZER;
+
static const ParserErrorCode INVALID_UNICODE_ESCAPE = _INVALID_UNICODE_ESCAPE;
static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST =
@@ -515,6 +527,8 @@
"Can't have both positional and named parameters in a single parameter list.",
correction: "Try choosing a single style of optional parameters.");
+ static const ParserErrorCode MODIFIER_OUT_OF_ORDER = _MODIFIER_OUT_OF_ORDER;
+
static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES =
_MULTIPLE_EXTENDS_CLAUSES;
@@ -687,6 +701,8 @@
static const ParserErrorCode TYPE_ARGUMENTS_ON_TYPE_VARIABLE =
_TYPE_ARGUMENTS_ON_TYPE_VARIABLE;
+ static const ParserErrorCode TYPE_BEFORE_FACTORY = _TYPE_BEFORE_FACTORY;
+
static const ParserErrorCode TYPEDEF_IN_CLASS = _TYPEDEF_IN_CLASS;
/**
@@ -710,7 +726,7 @@
static const ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER =
const ParserErrorCode('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER',
- "The default value of a positional parameter should be preceeded by '='.",
+ "The default value of a positional parameter should be preceded by '='.",
correction: "Try replacing the ':' with '='.");
/**
diff --git a/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index fd3008b..25c445b 100644
--- a/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -63,16 +63,16 @@
_CLASS_IN_CLASS,
_COLON_IN_PLACE_OF_IN,
_CONSTRUCTOR_WITH_RETURN_TYPE,
- _CONST_AFTER_FACTORY,
- _CONST_AND_COVARIANT,
+ _MODIFIER_OUT_OF_ORDER,
+ _TYPE_BEFORE_FACTORY,
_CONST_AND_FINAL,
- _CONST_AND_VAR,
+ _CONFLICTING_MODIFIERS,
_CONST_CLASS,
_VAR_AS_TYPE_NAME,
_CONST_FACTORY,
_CONST_METHOD,
_CONTINUE_WITHOUT_LABEL_IN_CASE,
- _COVARIANT_AFTER_FINAL,
+ _INVALID_THIS_IN_INITIALIZER,
_COVARIANT_AND_STATIC,
_COVARIANT_MEMBER,
_DEFERRED_AFTER_PREFIX,
@@ -102,6 +102,7 @@
_MISSING_CATCH_OR_FINALLY,
_EXPERIMENT_NOT_ENABLED,
_EXPECTED_ELSE_OR_COMMA,
+ _INVALID_SUPER_IN_INITIALIZER,
];
const ParserErrorCode _ABSTRACT_CLASS_MEMBER = const ParserErrorCode(
@@ -134,29 +135,20 @@
'COLON_IN_PLACE_OF_IN', r"For-in loops use 'in' rather than a colon.",
correction: "Try replacing the colon with the keyword 'in'.");
+const ParserErrorCode _CONFLICTING_MODIFIERS = const ParserErrorCode(
+ 'CONFLICTING_MODIFIERS',
+ r"Members can't be declared to be both '#string' and '#string2'.",
+ correction: "Try removing one of the keywords.");
+
const ParserErrorCode _CONSTRUCTOR_WITH_RETURN_TYPE = const ParserErrorCode(
'CONSTRUCTOR_WITH_RETURN_TYPE', r"Constructors can't have a return type.",
correction: "Try removing the return type.");
-const ParserErrorCode _CONST_AFTER_FACTORY = const ParserErrorCode(
- 'CONST_AFTER_FACTORY',
- r"The modifier 'const' should be before the modifier 'factory'.",
- correction: "Try re-ordering the modifiers.");
-
-const ParserErrorCode _CONST_AND_COVARIANT = const ParserErrorCode(
- 'CONST_AND_COVARIANT',
- r"Members can't be declared to be both 'const' and 'covariant'.",
- correction: "Try removing either the 'const' or 'covariant' keyword.");
-
const ParserErrorCode _CONST_AND_FINAL = const ParserErrorCode(
'CONST_AND_FINAL',
r"Members can't be declared to be both 'const' and 'final'.",
correction: "Try removing either the 'const' or 'final' keyword.");
-const ParserErrorCode _CONST_AND_VAR = const ParserErrorCode(
- 'CONST_AND_VAR', r"Members can't be declared to be both 'const' and 'var'.",
- correction: "Try removing either the 'const' or 'var' keyword.");
-
const ParserErrorCode _CONST_CLASS = const ParserErrorCode(
'CONST_CLASS', r"Classes can't be declared to be 'const'.",
correction:
@@ -182,11 +174,6 @@
correction:
"Try adding a label associated with one of the case clauses to the continue statement.");
-const ParserErrorCode _COVARIANT_AFTER_FINAL = const ParserErrorCode(
- 'COVARIANT_AFTER_FINAL',
- r"The modifier 'covariant' should be before the modifier 'final'.",
- correction: "Try re-ordering the modifiers.");
-
const ParserErrorCode _COVARIANT_AFTER_VAR = const ParserErrorCode(
'COVARIANT_AFTER_VAR',
r"The modifier 'covariant' should be before the modifier 'var'.",
@@ -214,7 +201,7 @@
const ParserErrorCode _DUPLICATED_MODIFIER = const ParserErrorCode(
'DUPLICATED_MODIFIER', r"The modifier '#lexeme' was already specified.",
- correction: "Try removing all but one occurance of the modifier.");
+ correction: "Try removing all but one occurence of the modifier.");
const ParserErrorCode _DUPLICATE_DEFERRED = const ParserErrorCode(
'DUPLICATE_DEFERRED',
@@ -248,13 +235,13 @@
const ParserErrorCode _EXPERIMENT_NOT_ENABLED = const ParserErrorCode(
'EXPERIMENT_NOT_ENABLED',
- r"This requires the --#string experiment to be enabled.",
+ r"This requires the '#string' experiment to be enabled.",
correction:
"Try enabling this experiment by adding it to the command line when compiling and running.");
const ParserErrorCode _EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE =
const ParserErrorCode('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
- r"Export directives must preceed part directives.",
+ r"Export directives must precede part directives.",
correction:
"Try moving the export directives before the part directives.");
@@ -358,7 +345,7 @@
const ParserErrorCode _IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE =
const ParserErrorCode('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
- r"Import directives must preceed part directives.",
+ r"Import directives must precede part directives.",
correction:
"Try moving the import directives before the part directives.");
@@ -386,6 +373,14 @@
r"The operator '?.' cannot be used with 'super' because 'super' cannot be null.",
correction: "Try replacing '?.' with '.'");
+const ParserErrorCode _INVALID_SUPER_IN_INITIALIZER = const ParserErrorCode(
+ 'INVALID_SUPER_IN_INITIALIZER',
+ r"Can only use 'super' in an initializer for calling the superclass constructor (e.g. 'super()' or 'super.namedConstructor()')");
+
+const ParserErrorCode _INVALID_THIS_IN_INITIALIZER = const ParserErrorCode(
+ 'INVALID_THIS_IN_INITIALIZER',
+ r"Can only use 'this' in an initializer for field initialization (e.g. 'this.x = something') and constructor redirection (e.g. 'this()' or 'this.namedConstructor())");
+
const ParserErrorCode _INVALID_UNICODE_ESCAPE = const ParserErrorCode(
'INVALID_UNICODE_ESCAPE',
r"An escape sequence starting with '\u' must be followed by 4 hexadecimal digits or from 1 to 6 digits between '{' and '}'.");
@@ -428,7 +423,7 @@
const ParserErrorCode _MISSING_KEYWORD_OPERATOR = const ParserErrorCode(
'MISSING_KEYWORD_OPERATOR',
- r"Operator declarations must be preceeded by the keyword 'operator'.",
+ r"Operator declarations must be preceded by the keyword 'operator'.",
correction: "Try adding the keyword 'operator'.");
const ParserErrorCode _MISSING_PREFIX_IN_DEFERRED_IMPORT =
@@ -439,6 +434,11 @@
const ParserErrorCode _MISSING_STATEMENT =
const ParserErrorCode('MISSING_STATEMENT', r"Expected a statement.");
+const ParserErrorCode _MODIFIER_OUT_OF_ORDER = const ParserErrorCode(
+ 'MODIFIER_OUT_OF_ORDER',
+ r"The modifier '#string' should be before the modifier '#string2'.",
+ correction: "Try re-ordering the modifiers.");
+
const ParserErrorCode _MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode(
'MULTIPLE_EXTENDS_CLAUSES',
r"Each class definition can have at most one extends clause.",
@@ -540,6 +540,10 @@
r"Can't use type arguments with type variable '#name'.",
correction: "Try removing the type arguments.");
+const ParserErrorCode _TYPE_BEFORE_FACTORY = const ParserErrorCode(
+ 'TYPE_BEFORE_FACTORY', r"Factory constructors cannot have a return type.",
+ correction: "Try removing the type appearing before 'factory'.");
+
const ParserErrorCode _VAR_AND_TYPE = const ParserErrorCode('VAR_AND_TYPE',
r"Variables can't be declared using both 'var' and a type name.",
correction: "Try removing 'var.'");
diff --git a/analyzer/lib/src/dart/resolver/definite_assignment.dart b/analyzer/lib/src/dart/resolver/definite_assignment.dart
index 838c611..bcf3d5e 100644
--- a/analyzer/lib/src/dart/resolver/definite_assignment.dart
+++ b/analyzer/lib/src/dart/resolver/definite_assignment.dart
@@ -530,7 +530,7 @@
_current = _current.union(continueSet);
}
- void beginForStatement2(ForStatement2 statement) {
+ void beginForStatement2(ForStatement statement) {
// Not strongly necessary, because we discard everything anyway.
// Just for consistency, so that `break` is handled without `null`.
_statementToStackIndex[statement] = _stack.length;
diff --git a/analyzer/lib/src/dart/resolver/exit_detector.dart b/analyzer/lib/src/dart/resolver/exit_detector.dart
index 432367d..a0d6371 100644
--- a/analyzer/lib/src/dart/resolver/exit_detector.dart
+++ b/analyzer/lib/src/dart/resolver/exit_detector.dart
@@ -231,7 +231,7 @@
}
@override
- bool visitForStatement2(ForStatement2 node) {
+ bool visitForStatement(ForStatement node) {
bool outerBreakValue = _enclosingBlockContainsBreak;
_enclosingBlockContainsBreak = false;
ForLoopParts parts = node.forLoopParts;
@@ -393,7 +393,7 @@
@override
bool visitListLiteral(ListLiteral node) {
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
if (_nodeExits(element)) {
return true;
}
@@ -464,7 +464,7 @@
@override
bool visitSetOrMapLiteral(SetOrMapLiteral node) {
- for (CollectionElement element in node.elements2) {
+ for (CollectionElement element in node.elements) {
if (_nodeExits(element)) {
return true;
}
diff --git a/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 9e54c4c..b1781ea 100644
--- a/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -359,6 +359,8 @@
if (r > numOfRequiredParams) {
r = numOfRequiredParams;
}
+ // TODO(brianwilkerson) Handle the fact that named parameters can now be
+ // required.
namedParametersList.addAll(_getNamedParameterNames(element));
}
return _createSyntheticExecutableElement(
@@ -426,6 +428,8 @@
parameter.parameterKind = ParameterKind.POSITIONAL;
parameters[i] = parameter;
}
+ // TODO(brianwilkerson) Handle the fact that named parameters can now be
+ // required.
for (int m = 0; m < namedParameters.length; m++, i++) {
ParameterElementImpl parameter =
new ParameterElementImpl(namedParameters[m], 0);
diff --git a/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index 6471484..844dfd9 100644
--- a/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/dart/resolver/scope.dart b/analyzer/lib/src/dart/resolver/scope.dart
index f1fb360..ccd4a4c 100644
--- a/analyzer/lib/src/dart/resolver/scope.dart
+++ b/analyzer/lib/src/dart/resolver/scope.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -725,6 +726,7 @@
// which is not possible for `dynamic`.
if (library.isDartCore) {
definedNames['dynamic'] = DynamicElementImpl.instance;
+ definedNames['Never'] = BottomTypeImpl.instance.element;
}
return new Namespace(definedNames);
diff --git a/analyzer/lib/src/dart/scanner/scanner.dart b/analyzer/lib/src/dart/scanner/scanner.dart
index ab852cf..566caf2 100644
--- a/analyzer/lib/src/dart/scanner/scanner.dart
+++ b/analyzer/lib/src/dart/scanner/scanner.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:analyzer/dart/analysis/features.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
@@ -59,6 +60,12 @@
bool enableGtGtGt = false;
/**
+ * A flag indicating whether the scanner should recognize the `late` and
+ * `required` keywords.
+ */
+ bool enableNonNullable = false;
+
+ /**
* Initialize a newly created scanner to scan characters from the given
* [source]. The given character [reader] will be used to read the characters
* in the source. The given [_errorListener] will be informed of any errors
@@ -84,6 +91,16 @@
this._preserveComments = preserveComments;
}
+ /// Configures the scanner appropriately for the given [featureSet].
+ ///
+ /// TODO(paulberry): stop exposing `enableGtGtGt` and `enableNonNullable` so
+ /// that callers are forced to use this API. Note that this would be a
+ /// breaking change.
+ void configureFeatures(FeatureSet featureSet) {
+ enableGtGtGt = featureSet.isEnabled(Feature.triple_shift);
+ enableNonNullable = featureSet.isEnabled(Feature.non_nullable);
+ }
+
void reportError(
ScannerErrorCode errorCode, int offset, List<Object> arguments) {
_errorListener
@@ -104,7 +121,8 @@
Token tokenize() {
fasta.ScannerResult result = fasta.scanString(_contents,
- enableGtGtGt: enableGtGtGt,
+ configuration: fasta.ScannerConfiguration(
+ enableGtGtGt: enableGtGtGt, enableNonNullable: enableNonNullable),
includeComments: _preserveComments,
scanLazyAssignmentOperators: scanLazyAssignmentOperators);
@@ -133,4 +151,13 @@
}
return firstToken;
}
+
+ /// Return a ScannerConfiguration based upon the specified feature set.
+ static fasta.ScannerConfiguration buildConfig(FeatureSet featureSet) =>
+ featureSet == null
+ ? fasta.ScannerConfiguration()
+ : fasta.ScannerConfiguration(
+ enableGtGtGt: featureSet.isEnabled(Feature.triple_shift),
+ enableGtGtGtEq: featureSet.isEnabled(Feature.triple_shift),
+ enableNonNullable: featureSet.isEnabled(Feature.non_nullable));
}
diff --git a/analyzer/lib/src/dart/sdk/patch.dart b/analyzer/lib/src/dart/sdk/patch.dart
index 532ae5e..72c191f 100644
--- a/analyzer/lib/src/dart/sdk/patch.dart
+++ b/analyzer/lib/src/dart/sdk/patch.dart
@@ -1,7 +1,8 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/listener.dart';
@@ -58,7 +59,8 @@
'The patch file ${patchFile.path} for $source does not exist.');
}
Source patchSource = patchFile.createSource();
- CompilationUnit patchUnit = parse(patchSource, errorListener);
+ CompilationUnit patchUnit =
+ parse(patchSource, errorListener, unit.featureSet);
// Prepare for reporting errors.
_baseDesc = source.toString();
@@ -405,16 +407,17 @@
* Parse the given [source] into AST.
*/
@visibleForTesting
- static CompilationUnit parse(
- Source source, AnalysisErrorListener errorListener) {
+ static CompilationUnit parse(Source source,
+ AnalysisErrorListener errorListener, FeatureSet featureSet) {
String code = source.contents.data;
CharSequenceReader reader = new CharSequenceReader(code);
- Scanner scanner = new Scanner(source, reader, errorListener);
+ Scanner scanner = new Scanner(source, reader, errorListener)
+ ..configureFeatures(featureSet);
Token token = scanner.tokenize();
LineInfo lineInfo = new LineInfo(scanner.lineStarts);
- Parser parser = new Parser(source, errorListener);
+ Parser parser = new Parser(source, errorListener, featureSet: featureSet);
CompilationUnit unit = parser.parseCompilationUnit(token);
unit.lineInfo = lineInfo;
return unit;
diff --git a/analyzer/lib/src/dart/sdk/sdk.dart b/analyzer/lib/src/dart/sdk/sdk.dart
index e20937d..22ab2f2 100644
--- a/analyzer/lib/src/dart/sdk/sdk.dart
+++ b/analyzer/lib/src/dart/sdk/sdk.dart
@@ -6,6 +6,7 @@
import 'dart:convert';
import 'dart:io' as io;
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/exception/exception.dart';
@@ -20,7 +21,6 @@
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
-import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:path/path.dart' as pathos;
import 'package:yaml/yaml.dart';
@@ -86,16 +86,6 @@
_analysisContext = new SdkAnalysisContext(_analysisOptions);
SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
_analysisContext.sourceFactory = factory;
- if (_useSummary) {
- PackageBundle sdkBundle = getLinkedBundle();
- if (sdkBundle != null) {
- SummaryDataStore dataStore =
- new SummaryDataStore([], resourceProvider: resourceProvider);
- dataStore.addBundle(null, sdkBundle);
- _analysisContext.resultProvider =
- new InputPackagesResultProvider(_analysisContext, dataStore);
- }
- }
}
return _analysisContext;
}
@@ -140,6 +130,16 @@
});
}
+ /**
+ * Return info for debugging https://github.com/dart-lang/sdk/issues/35226.
+ */
+ Map<String, Object> debugInfo() {
+ return <String, Object>{
+ 'runtimeType': '$runtimeType',
+ 'libraryMap': libraryMap.debugInfo(),
+ };
+ }
+
@override
Source fromFileUri(Uri uri) {
File file =
@@ -230,16 +230,6 @@
return source;
}
- /**
- * Return info for debugging https://github.com/dart-lang/sdk/issues/35226.
- */
- Map<String, Object> debugInfo() {
- return <String, Object>{
- 'runtimeType': '$runtimeType',
- 'libraryMap': libraryMap.debugInfo(),
- };
- }
-
String _getPath(File file) {
List<SdkLibrary> libraries = libraryMap.sdkLibraries;
int length = libraries.length;
@@ -562,16 +552,6 @@
}
/**
- * Return info for debugging https://github.com/dart-lang/sdk/issues/35226.
- */
- @override
- Map<String, Object> debugInfo() {
- var result = super.debugInfo();
- result['directory'] = _sdkDirectory.path;
- return result;
- }
-
- /**
* Determine the search order for trying to locate the [_LIBRARIES_FILE].
*/
Iterable<File> get _libraryMapLocations sync* {
@@ -585,6 +565,16 @@
.getChildAssumingFile(_LIBRARIES_FILE);
}
+ /**
+ * Return info for debugging https://github.com/dart-lang/sdk/issues/35226.
+ */
+ @override
+ Map<String, Object> debugInfo() {
+ var result = super.debugInfo();
+ result['directory'] = _sdkDirectory.path;
+ return result;
+ }
+
@override
String getRelativePathFromFile(File file) {
String filePath = file.path;
@@ -908,9 +898,13 @@
*/
LibraryMap readFromSource(Source source, String libraryFileContents) {
BooleanErrorListener errorListener = new BooleanErrorListener();
+ // TODO(paulberry): initialize the feature set appropriately based on the
+ // version of the SDK we are reading, and enable flags.
+ var featureSet = FeatureSet.fromEnableFlags([]);
Scanner scanner = new Scanner(
- source, new CharSequenceReader(libraryFileContents), errorListener);
- Parser parser = new Parser(source, errorListener);
+ source, new CharSequenceReader(libraryFileContents), errorListener)
+ ..configureFeatures(featureSet);
+ Parser parser = new Parser(source, errorListener, featureSet: featureSet);
CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
SdkLibrariesReader_LibraryBuilder libraryBuilder =
new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths);
diff --git a/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart b/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart
new file mode 100644
index 0000000..1449906
--- /dev/null
+++ b/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart
@@ -0,0 +1,142 @@
+// Copyright (c) 2019, 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.
+
+/// Information about the directives found in Dartdoc comments.
+class DartdocDirectiveInfo {
+ // TODO(brianwilkerson) Consider moving the method
+ // DartUnitHoverComputer.computeDocumentation to this class.
+
+ /// A regular expression used to match a macro directive. There is one group
+ /// that contains the name of the template.
+ static final macroRegExp = new RegExp(r'{@macro\s+([^}]+)}');
+
+ /// A regular expression used to match a template directive. There are two
+ /// groups. The first contains the name of the template, the second contains
+ /// the body of the template.
+ static final templateRegExp = new RegExp(
+ r'[ ]*{@template\s+(.+?)}([\s\S]+?){@endtemplate}[ ]*\n?',
+ multiLine: true);
+
+ /// A regular expression used to match a youtube or animation directive.
+ ///
+ /// These are in the form:
+ /// `{@youtube 560 315 https://www.youtube.com/watch?v=2uaoEDOgk_I}`.
+ static final videoRegExp =
+ new RegExp(r'{@(youtube|animation)\s+[^}]+\s+[^}]+\s+([^}]+)}');
+
+ /// A table mapping the names of templates to the unprocessed bodies of the
+ /// templates.
+ final Map<String, String> templateMap = {};
+
+ /// Initialize a newly created set of information about Dartdoc directives.
+ DartdocDirectiveInfo();
+
+ /// Add corresponding pairs from the [names] and [values] to the set of
+ /// defined templates.
+ void addTemplateNamesAndValues(List<String> names, List<String> values) {
+ int length = names.length;
+ assert(length == values.length);
+ for (int i = 0; i < length; i++) {
+ templateMap[names[i]] = values[i];
+ }
+ }
+
+ /// Process the given Dartdoc [comment], extracting the template directive if
+ /// there is one.
+ void extractTemplate(String comment) {
+ for (Match match in templateRegExp.allMatches(comment)) {
+ String name = match.group(1).trim();
+ String body = match.group(2).trim();
+ templateMap[name] = _stripDelimiters(body).join('\n');
+ }
+ }
+
+ /// Process the given Dartdoc [comment], replacing any known dartdoc
+ /// directives with the associated content.
+ ///
+ /// Macro directives are replaced with the body of the corresponding template.
+ ///
+ /// Youtube and animation directives are replaced with markdown hyperlinks.
+ String processDartdoc(String comment) {
+ List<String> lines = _stripDelimiters(comment);
+ for (int i = lines.length - 1; i >= 0; i--) {
+ String line = lines[i];
+ Match match = macroRegExp.firstMatch(line);
+ if (match != null) {
+ String name = match.group(1);
+ String value = templateMap[name];
+ if (value != null) {
+ lines[i] = value;
+ }
+ continue;
+ }
+
+ match = videoRegExp.firstMatch(line);
+ if (match != null) {
+ String uri = match.group(2);
+ if (uri != null && uri.isNotEmpty) {
+ String label = uri;
+ if (label.startsWith('https://')) {
+ label = label.substring('https://'.length);
+ }
+ lines[i] = '[$label]($uri)';
+ }
+ continue;
+ }
+ }
+ return lines.join('\n');
+ }
+
+ /// Remove the delimiters from the given [comment].
+ List<String> _stripDelimiters(String comment) {
+ if (comment == null) {
+ return null;
+ }
+ //
+ // Remove /** */.
+ //
+ if (comment.startsWith('/**')) {
+ comment = comment.substring(3);
+ }
+ if (comment.endsWith('*/')) {
+ comment = comment.substring(0, comment.length - 2);
+ }
+ comment = comment.trim();
+ //
+ // Remove leading '* ' and '/// '.
+ //
+ List<String> lines = comment.split('\n');
+ int firstNonEmpty = lines.length + 1;
+ int lastNonEmpty = -1;
+ for (var i = 0; i < lines.length; i++) {
+ String line = lines[i];
+ line = line.trim();
+ if (line.startsWith('*')) {
+ line = line.substring(1);
+ if (line.startsWith(' ')) {
+ line = line.substring(1);
+ }
+ } else if (line.startsWith('///')) {
+ line = line.substring(3);
+ if (line.startsWith(' ')) {
+ line = line.substring(1);
+ }
+ }
+ if (line.isNotEmpty) {
+ if (i < firstNonEmpty) {
+ firstNonEmpty = i;
+ }
+ if (i > lastNonEmpty) {
+ lastNonEmpty = i;
+ }
+ }
+ lines[i] = line;
+ }
+ if (lastNonEmpty < firstNonEmpty) {
+ // All of the lines are empty.
+ return <String>[];
+ }
+ return lines.sublist(firstNonEmpty, lastNonEmpty + 1);
+ }
+}
diff --git a/analyzer/lib/src/diagnostic/diagnostic.dart b/analyzer/lib/src/diagnostic/diagnostic.dart
new file mode 100644
index 0000000..d45ad27
--- /dev/null
+++ b/analyzer/lib/src/diagnostic/diagnostic.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/diagnostic/diagnostic.dart';
+import 'package:meta/meta.dart';
+
+/// A concrete implementation of a diagnostic message.
+class DiagnosticMessageImpl implements DiagnosticMessage {
+ @override
+ final String filePath;
+
+ @override
+ final int length;
+
+ @override
+ final String message;
+
+ @override
+ final int offset;
+
+ /// Initialize a newly created message to represent a [message] reported in
+ /// the file at the given [filePath] at the given [offset] and with the given
+ /// [length].
+ DiagnosticMessageImpl(
+ {@required this.filePath,
+ @required this.length,
+ @required this.message,
+ @required this.offset});
+}
diff --git a/analyzer/lib/src/diagnostic/diagnostic_factory.dart b/analyzer/lib/src/diagnostic/diagnostic_factory.dart
new file mode 100644
index 0000000..7b359dd
--- /dev/null
+++ b/analyzer/lib/src/diagnostic/diagnostic_factory.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/source/line_info.dart';
+import 'package:analyzer/src/diagnostic/diagnostic.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+/// A factory used to create diagnostics.
+class DiagnosticFactory {
+ /// Initialize a newly created diagnostic factory.
+ DiagnosticFactory();
+
+ /// Return a diagnostic indicating that the given [identifier] was referenced
+ /// before it was declared.
+ AnalysisError referencedBeforeDeclaration(
+ Source source, Identifier identifier,
+ {Element element}) {
+ String name = identifier.name;
+ Element staticElement = element ?? identifier.staticElement;
+ List<DiagnosticMessage> contextMessages;
+ int declarationOffset = staticElement.nameOffset;
+ if (declarationOffset >= 0 && staticElement != null) {
+ CompilationUnitElement unit = staticElement
+ .getAncestor((element) => element is CompilationUnitElement);
+ CharacterLocation location = unit.lineInfo.getLocation(declarationOffset);
+ contextMessages = [
+ new DiagnosticMessageImpl(
+ filePath: source.fullName,
+ message:
+ "The declaration of '$name' is on line ${location.lineNumber}.",
+ offset: declarationOffset,
+ length: staticElement.nameLength)
+ ];
+ }
+ return new AnalysisError(
+ source,
+ identifier.offset,
+ identifier.length,
+ CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION,
+ [name],
+ contextMessages);
+ }
+}
diff --git a/analyzer/lib/src/error/codes.dart b/analyzer/lib/src/error/codes.dart
index d6c964c..8a3e142 100644
--- a/analyzer/lib/src/error/codes.dart
+++ b/analyzer/lib/src/error/codes.dart
@@ -8,7 +8,6 @@
export 'package:analyzer/src/dart/error/hint_codes.dart';
export 'package:analyzer/src/dart/error/lint_codes.dart';
export 'package:analyzer/src/dart/error/todo_codes.dart';
-export 'package:analyzer/src/html/error/html_codes.dart';
/**
* The error codes used for compile time errors caused by constant evaluation
@@ -35,7 +34,7 @@
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
"A value of type '{0}' can't be assigned to the field '{1}', which "
- "has type '{2}'.");
+ "has type '{2}'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
@@ -46,7 +45,7 @@
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
"A value of type '{0}' can't be assigned to a parameter of type "
- "'{1}'.");
+ "'{1}'.");
/**
* 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error
@@ -65,78 +64,7 @@
const CheckedModeCompileTimeErrorCode(
'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE',
"The initializer type '{0}' can't be assigned to the field type "
- "'{1}'.");
-
- /**
- * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i>
- * ... <i>e<sub>n</sub></i>] is evaluated as follows:
- * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and
- * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i>
- *
- * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
- * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of
- * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be
- * the type of the named parameter <i>q</i> of <i>f</i>. It is a static
- * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>,
- * 1 <= j <= m</i>.
- *
- * Parameters:
- * 0: the actual type of the list element
- * 1: the expected type of the list element
- */
- static const CheckedModeCompileTimeErrorCode
- LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode(
- 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' can't be assigned to the list type '{1}'.");
-
- /**
- * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>>
- * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> :
- * <i>e<sub>n</sub></i>] is evaluated as follows:
- * * The operator []= is invoked on <i>m</i> with first argument
- * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <=
- * i <= n</i>
- *
- * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
- * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of
- * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be
- * the type of the named parameter <i>q</i> of <i>f</i>. It is a static
- * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1
- * <= j <= m</i>.
- */
- static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE =
- const CheckedModeCompileTimeErrorCode('MAP_KEY_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' can't be assigned to the map key type '{1}'.");
-
- /**
- * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>>
- * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> :
- * <i>e<sub>n</sub></i>] is evaluated as follows:
- * * The operator []= is invoked on <i>m</i> with first argument
- * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <=
- * i <= n</i>
- *
- * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
- * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of
- * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be
- * the type of the named parameter <i>q</i> of <i>f</i>. It is a static
- * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1
- * <= j <= m</i>.
- */
- static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE =
- const CheckedModeCompileTimeErrorCode(
- 'MAP_VALUE_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' can't be assigned to the map value type "
- "'{1}'.");
-
- /**
- * Parameters:
- * 0: the actual type of the set element
- * 1: the expected type of the set element
- */
- static const CheckedModeCompileTimeErrorCode SET_ELEMENT_TYPE_NOT_ASSIGNABLE =
- const CheckedModeCompileTimeErrorCode('SET_ELEMENT_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' can't be assigned to the set type '{1}'.");
+ "'{1}'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
@@ -146,7 +74,7 @@
const CheckedModeCompileTimeErrorCode(
'VARIABLE_TYPE_MISMATCH',
"A value of type '{0}' can't be assigned to a variable of type "
- "'{1}'.");
+ "'{1}'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -194,7 +122,7 @@
const CompileTimeErrorCode(
'ACCESS_PRIVATE_ENUM_FIELD',
"The private fields of an enum can't be accessed, even within the "
- "same library.");
+ "same library.");
/**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported
@@ -217,8 +145,8 @@
const CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH',
"This literal must be both a map and a set, because some elements "
- "spread a 'Map' and others spread an 'Iterable', but that isn't "
- "allowed.",
+ "spread a 'Map' and others spread an 'Iterable', but that isn't "
+ "allowed.",
correction:
"Try removing or changing some of the elements so that all of "
"the elements are consistent.");
@@ -227,8 +155,8 @@
const CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER',
"This literal must be either a map or a set, but none of the "
- "elements have enough type information to know which, and that isn't "
- "allowed.",
+ "elements have enough type information to know which, and that isn't "
+ "allowed.",
correction:
"Try adding type arguments to the literal (one for sets, two "
"for maps).");
@@ -261,18 +189,6 @@
"An annotation (metadata) can't use type arguments.");
/**
- * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does
- * not denote a formal parameter.
- *
- * Parameters:
- * 0: the name of the identifier in the argument definition test that is not a
- * parameter
- */
- static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER =
- const CompileTimeErrorCode(
- 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' isn't a parameter.");
-
- /**
* 17.6.3 Asynchronous For-in: It is a compile-time error if an asynchronous
* for-in statement appears inside a synchronous function.
*/
@@ -359,22 +275,6 @@
correction: "Try choosing a different name for the type parameter.");
/**
- * 16.33 Identifier Reference: It is a compile-time error if a built-in
- * identifier is used as the declared name of a prefix, class, type parameter
- * or type alias.
- *
- * Parameters:
- * 0: the built-in identifier that is being used
- *
- * TODO(scheglov) It would be nice to get more specific errors.
- * https://github.com/dart-lang/sdk/issues/31811
- */
- static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_IN_DECLARATION =
- const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_IN_DECLARATION',
- "The built-in identifier '{0}' can't be used as a name.",
- correction: "Try choosing a different name.");
-
- /**
* 13.9 Switch: It is a compile-time error if the class <i>C</i> implements
* the operator <i>==</i>.
*
@@ -397,7 +297,7 @@
const CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD',
"'{0}' can't be used to name both a constructor and a static field "
- "in this class.",
+ "in this class.",
correction: "Try renaming either the constructor or the field.");
/**
@@ -412,7 +312,7 @@
const CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD',
"'{0}' can't be used to name both a constructor and a static method "
- "in this class.",
+ "in this class.",
correction: "Try renaming either the constructor or the method.");
/**
@@ -429,9 +329,9 @@
const CompileTimeErrorCode(
'CONFLICTING_FIELD_AND_METHOD',
"Class '{0}' can't define field '{1}' and have method '{2}.{1}' "
- "with the same name.",
+ "with the same name.",
correction: "Try converting the getter to a method, or "
- "renaming the field to a name that doesn't conflit.");
+ "renaming the field to a name that doesn't conflict.");
/**
* 10.10 Superinterfaces: It is a compile-time error if a class `C` has two
@@ -448,7 +348,7 @@
const CompileTimeErrorCode(
'CONFLICTING_GENERIC_INTERFACES',
"The class '{0}' cannot implement both '{1}' and '{2}' because the "
- "type arguments are different.");
+ "type arguments are different.");
/**
* 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
@@ -464,9 +364,9 @@
const CompileTimeErrorCode(
'CONFLICTING_METHOD_AND_FIELD',
"Class '{0}' can't define method '{1}' and have field '{2}.{1}' "
- "with the same name.",
+ "with the same name.",
correction: "Try converting the method to a getter, or "
- "renaming the method to a name that doesn't conflit.");
+ "renaming the method to a name that doesn't conflict.");
/**
* 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
@@ -482,9 +382,9 @@
const CompileTimeErrorCode(
'CONFLICTING_STATIC_AND_INSTANCE',
"Class '{0}' can't define static member '{1}' and have instance "
- "member '{2}.{1}' with the same name.",
+ "member '{2}.{1}' with the same name.",
correction:
- "Try renaming the member to a name that doesn't conflit.");
+ "Try renaming the member to a name that doesn't conflict.");
/**
* 7. Classes: It is a compile time error if a generic class declares a type
@@ -498,7 +398,7 @@
const CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CLASS',
"'{0}' can't be used to name both a type variable and the class in "
- "which the type variable is defined.",
+ "which the type variable is defined.",
correction: "Try renaming either the type variable or the class.");
/**
@@ -513,15 +413,9 @@
const CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
"'{0}' can't be used to name both a type variable and a member in "
- "this class.",
+ "this class.",
correction: "Try renaming either the type variable or the member.");
- static const CompileTimeErrorCode
- CONST_CONSTRUCTOR_IN_SUBCLASS_OF_MIXIN_APPLICATION =
- const CompileTimeErrorCode(
- 'CONST_CONSTRUCTOR_IN_SUBCLASS_OF_MIXIN_APPLICATION',
- "Can't extend a mixin application and be 'const'.");
-
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
@@ -545,7 +439,7 @@
const CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST',
"Can't define the const constructor because the field '{0}' "
- "is initialized with a non-constant value.",
+ "is initialized with a non-constant value.",
correction: "Try initializing the field to a constant value, or "
"removing the keyword 'const' from the constructor.");
@@ -564,7 +458,7 @@
const CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD',
"Const constructor can't be declared for a class with a mixin "
- "that declares an instance field.",
+ "that declares an instance field.",
correction: "Try removing the 'const' keyword or "
"removing the 'with' clause from the class declaration, "
"or removing fields from the mixin class.");
@@ -582,7 +476,7 @@
const CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
"Constant constructor can't call non-constant super constructor of "
- "'{0}'.",
+ "'{0}'.",
correction: "Try calling a const constructor in the superclass, or "
"removing the keyword 'const' from the constructor.");
@@ -638,7 +532,7 @@
const CompileTimeErrorCode(
'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used to "
- "initialized a const variable.",
+ "initialized a const variable.",
correction:
"Try initializing the variable without referencing members of the "
"deferred library, or "
@@ -675,7 +569,7 @@
const CompileTimeErrorCode(
'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
"The constant map entry key expression type '{0}' can't override "
- "the == operator.",
+ "the == operator.",
correction: "Try using a different value for the key, or "
"removing the keyword 'const' from the map.");
@@ -699,7 +593,7 @@
const CompileTimeErrorCode(
'CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS',
"The constant set element type '{0}' can't override "
- "the == operator.",
+ "the == operator.",
correction: "Try using a different value for the element, or "
"removing the keyword 'const' from the set.");
@@ -712,7 +606,7 @@
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL',
"In constant expressions, operands of this operator must be of type "
- "'bool'.");
+ "'bool'.");
/**
* 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
@@ -723,7 +617,7 @@
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL_INT',
"In constant expressions, operands of this operator must be of type "
- "'bool' or 'int'.");
+ "'bool' or 'int'.");
/**
* 16.12.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
@@ -734,7 +628,7 @@
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL_NUM_STRING',
"In constant expressions, operands of this operator must be of type "
- "'bool', 'num', 'String' or 'null'.");
+ "'bool', 'num', 'String' or 'null'.");
/**
* 16.12.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
@@ -745,7 +639,7 @@
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_INT',
"In constant expressions, operands of this operator must be of type "
- "'int'.");
+ "'int'.");
/**
* 16.12.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 *
@@ -757,13 +651,13 @@
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_NUM',
"In constant expressions, operands of this operator must be of type "
- "'num'.");
+ "'num'.");
static const CompileTimeErrorCode CONST_EVAL_TYPE_TYPE =
const CompileTimeErrorCode(
'CONST_EVAL_TYPE_TYPE',
"In constant expressions, operands of this operator must be of type "
- "'Type'.");
+ "'Type'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
@@ -781,7 +675,7 @@
const CompileTimeErrorCode(
'CONST_EVAL_THROWS_IDBZE',
"Evaluation of this constant expression throws an "
- "IntegerDivisionByZeroException.");
+ "IntegerDivisionByZeroException.");
/**
* 16.12.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>,
@@ -800,7 +694,7 @@
const CompileTimeErrorCode(
'CONST_WITH_INVALID_TYPE_PARAMETERS',
"The type '{0}' is declared with {1} type parameters, but {2} type "
- "arguments were given.",
+ "arguments were given.",
correction:
"Try adjusting the number of type arguments to match the number of "
"type parameters.");
@@ -867,7 +761,7 @@
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR =
const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR',
"The class '{0}' doesn't have a constant constructor '{1}'.",
- correction: "Try calling a different contructor.");
+ correction: "Try calling a different constructor.");
/**
* 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
@@ -879,7 +773,7 @@
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
"The class '{0}' doesn't have a default constant constructor.",
- correction: "Try calling a different contructor.");
+ correction: "Try calling a different constructor.");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are
@@ -891,6 +785,17 @@
correction: "Try removing the default value.");
/**
+ * It is an error to call the default List constructor with a length argument
+ * and a type argument which is potentially non-nullable.
+ */
+ static const CompileTimeErrorCode DEFAULT_LIST_CONSTRUCTOR_MISMATCH =
+ const CompileTimeErrorCode(
+ 'DEFAULT_LIST_CONSTRUCTOR_MISMATCH',
+ "A list whose values cannot be 'null' cannot be given an initial length "
+ "because the initial values would all be 'null'.",
+ correction: "Try removing the argument.");
+
+ /**
* 6.2.1 Required Formals: By means of a function signature that names the
* parameter and describes its type as a function type. It is a compile-time
* error if any default values are specified in the signature of such a
@@ -910,10 +815,19 @@
const CompileTimeErrorCode(
'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR',
"Default values aren't allowed in factory constructors that redirect "
- "to another constructor.",
+ "to another constructor.",
correction: "Try removing the default value.");
/**
+ * It is an error if a required named parameter has a default value.
+ */
+ static const CompileTimeErrorCode DEFAULT_VALUE_ON_REQUIRED_PARAMETER =
+ const CompileTimeErrorCode('DEFAULT_VALUE_ON_REQUIRED_PARAMETER',
+ "Required named parameters cannot have a default value.",
+ correction: "Try removing either the default value or the 'required' "
+ "modifier.");
+
+ /**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
* with the same name declared in the same scope.
*/
@@ -980,6 +894,22 @@
"correcting one of the names to reference a different named parameter.");
/**
+ * 16.10 Maps: It is a compile-time error if two keys of a constant map
+ * literal are equal according to their `==` operator (16.27).
+ */
+ static const CompileTimeErrorCode EQUAL_KEYS_IN_CONST_MAP =
+ const CompileTimeErrorCode('EQUAL_KEYS_IN_CONST_MAP',
+ "Two keys in a constant map literal can't be equal.");
+
+ /**
+ * 16.11 Sets: It is a compile-time error if two elements of a constant set
+ * literal are equal according to their `==` operator (16.27).
+ */
+ static const CompileTimeErrorCode EQUAL_ELEMENTS_IN_CONST_SET =
+ const CompileTimeErrorCode('EQUAL_ELEMENTS_IN_CONST_SET',
+ "Two values in a constant set can't be equal.");
+
+ /**
* SDK implementation libraries can be exported only by other SDK libraries.
*
* Parameters:
@@ -1128,7 +1058,7 @@
const CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
"Fields can't be initialized in both the parameter list and the "
- "initializers.",
+ "initializers.",
correction: "Try removing one of the initializations.");
/**
@@ -1263,7 +1193,7 @@
static const CompileTimeErrorCode IMPLEMENTS_REPEATED =
const CompileTimeErrorCode(
'IMPLEMENTS_REPEATED', "'{0}' can only be implemented once.",
- correction: "Try removing all but one occurance of the class name.");
+ correction: "Try removing all but one occurrence of the class name.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the superclass of a
@@ -1276,7 +1206,7 @@
static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS =
const CompileTimeErrorCode('IMPLEMENTS_SUPER_CLASS',
"'{0}' can't be used in both 'extends' and 'implements' clauses.",
- correction: "Try removing one of the occurances.");
+ correction: "Try removing one of the occurrences.");
/**
* 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the
@@ -1363,7 +1293,7 @@
const CompileTimeErrorCode(
'INCONSISTENT_INHERITANCE_GETTER_AND_METHOD',
"'{0}' is inherited as a getter (from '{1}') and also a "
- "method (from '{2}').",
+ "method (from '{2}').",
correction:
"Try adjusting the supertypes of this class to remove the "
"inconsistency.");
@@ -1402,7 +1332,7 @@
const CompileTimeErrorCode(
'INITIALIZER_FOR_STATIC_FIELD',
"'{0}' is a static field in the enclosing class. Fields initialized "
- "in a constructor can't be static.",
+ "in a constructor can't be static.",
correction: "Try removing the initialization.");
/**
@@ -1438,7 +1368,7 @@
const CompileTimeErrorCode(
'INITIALIZING_FORMAL_FOR_STATIC_FIELD',
"'{0}' is a static field in the enclosing class. Fields initialized "
- "in a constructor can't be static.",
+ "in a constructor can't be static.",
correction: "Try removing the initialization.");
/**
@@ -1486,8 +1416,8 @@
const CompileTimeErrorCode(
'INTEGER_LITERAL_IMPRECISE_AS_DOUBLE',
"The integer literal is being used as a double, but can't be "
- 'represented as a 64 bit double without overflow and/or loss of '
- 'precision: {0}',
+ 'represented as a 64 bit double without overflow and/or loss of '
+ 'precision: {0}',
correction:
'Try using the BigInt class, or switch to the closest valid '
'double: {1}');
@@ -1502,7 +1432,7 @@
const CompileTimeErrorCode(
'INVALID_ANNOTATION',
"Annotation must be either a const variable reference or const "
- "constructor invocation.");
+ "constructor invocation.");
/**
* 15 Metadata: Metadata consists of a series of annotations, each of which
@@ -1531,19 +1461,6 @@
correction: "Try using a top-level variable or a field.");
/**
- * 15.31 Identifier Reference: It is a compile-time error if any of the
- * identifiers async, await or yield is used as an identifier in a function
- * body marked with either async, async* or sync*.
- */
- static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC =
- const CompileTimeErrorCode(
- 'INVALID_IDENTIFIER_IN_ASYNC',
- "The identifier '{0}' can't be used in a function marked with "
- "'async', 'async*' or 'sync*'.",
- correction: "Try using a different name, or "
- "remove the modifier on the function body.");
-
- /**
* 9. Functions: It is a compile-time error if an async, async* or sync*
* modifier is attached to the body of a setter or constructor.
*/
@@ -1587,7 +1504,7 @@
const CompileTimeErrorCode(
'INVALID_FACTORY_NAME_NOT_A_CLASS',
"The name of a factory constructor must be the same as the name of "
- "the immediately enclosing class.");
+ "the immediately enclosing class.");
static const CompileTimeErrorCode INVALID_INLINE_FUNCTION_TYPE =
const CompileTimeErrorCode('INVALID_INLINE_FUNCTION_TYPE',
@@ -1596,6 +1513,20 @@
"Try using a generic function type (returnType 'Function(' parameters ')').");
/**
+ * It is an error if an optional parameter (named or otherwise) with no
+ * default value has a potentially non-nullable type. This is produced in
+ * cases where there is no valid default value.
+ */
+ static const CompileTimeErrorCode INVALID_OPTIONAL_PARAMETER_TYPE =
+ const CompileTimeErrorCode(
+ 'INVALID_OPTIONAL_PARAMETER_TYPE',
+ "The parameter '{0}' cannot have a value of 'null' because of its "
+ "type, but no default value it valid, so it must be a required "
+ "parameter.",
+ correction: "Try making this nullable (by adding a '?') or "
+ "making this a required parameter.");
+
+ /**
* If a class declaration has a member declaration, the signature of that
* member declaration becomes the signature in the interface. It's a
* compile-time error if that signature is not a valid override of all
@@ -1636,7 +1567,7 @@
const CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
"Constant list literals can't include a type parameter as a type "
- "argument, such as '{0}'.",
+ "argument, such as '{0}'.",
correction:
"Try replacing the type parameter with a different type.");
@@ -1651,7 +1582,7 @@
const CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
"Constant map literals can't include a type parameter as a type "
- "argument, such as '{0}'.",
+ "argument, such as '{0}'.",
correction:
"Try replacing the type parameter with a different type.");
@@ -1659,7 +1590,7 @@
const CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_SET',
"Constant set literals can't include a type parameter as a type "
- "argument, such as '{0}'.",
+ "argument, such as '{0}'.",
correction:
"Try replacing the type parameter with a different type.");
@@ -1670,7 +1601,7 @@
const CompileTimeErrorCode(
'INVALID_USE_OF_COVARIANT',
"The 'covariant' keyword can only be used for parameters in instance "
- "methods or before non-final instance fields.",
+ "methods or before non-final instance fields.",
correction: "Try removing the 'covariant' keyword.");
/**
@@ -1746,7 +1677,7 @@
const CompileTimeErrorCode(
'MISSING_CONST_IN_LIST_LITERAL',
"List literals must be prefixed with 'const' when used as a constant "
- "expression.",
+ "expression.",
correction: "Try adding the keyword 'const' before the literal.");
/**
@@ -1756,7 +1687,7 @@
const CompileTimeErrorCode(
'MISSING_CONST_IN_MAP_LITERAL',
"Map literals must be prefixed with 'const' when used as a constant "
- "expression.",
+ "expression.",
correction: "Try adding the keyword 'const' before the literal.");
/**
@@ -1766,7 +1697,7 @@
const CompileTimeErrorCode(
'MISSING_CONST_IN_SET_LITERAL',
"Set literals must be prefixed with 'const' when used as a constant "
- "expression.",
+ "expression.",
correction: "Try adding the keyword 'const' before the literal.");
static const CompileTimeErrorCode MISSING_DART_LIBRARY =
@@ -1775,6 +1706,33 @@
correction: "Check your Dart SDK installation for completeness.");
/**
+ * It is an error if an optional parameter (named or otherwise) with no
+ * default value has a potentially non-nullable type.
+ */
+ static const CompileTimeErrorCode MISSING_DEFAULT_VALUE_FOR_PARAMETER =
+ const CompileTimeErrorCode(
+ 'MISSING_DEFAULT_VALUE_FOR_PARAMETER',
+ "The parameter '{0}' cannot have a value of 'null' because of its "
+ "type, so it must either be a required parameter or have a "
+ "default value.",
+ correction:
+ "Try adding either a default value or the 'required' modifier.");
+
+ /**
+ * It is an error if a named parameter that is marked as being required is
+ * not bound to an argument at a call site.
+ *
+ * Parameters:
+ * 0: the name of the parameter
+ */
+ static const CompileTimeErrorCode MISSING_REQUIRED_ARGUMENT =
+ const CompileTimeErrorCode(
+ 'MISSING_REQUIRED_ARGUMENT',
+ "The named parameter '{0}' is required so "
+ "there needs to be a corresponding argument.",
+ correction: "Try adding the required argument.");
+
+ /**
* It's a compile-time error to apply a mixin containing super-invocations to
* a class that doesn't have a concrete implementation of the super-invoked
* members compatible with the super-constraint interface.
@@ -1794,19 +1752,22 @@
const CompileTimeErrorCode(
'MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE',
"The super-invoked member '{0}' has the type '{1}', but the "
- "concrete member in the class has type '{2}'.");
+ "concrete member in the class has type '{2}'.");
/**
* It's a compile-time error to apply a mixin to a class that doesn't
- * implement all the on type requirements of the mixin declaration.
+ * implement all the `on` type requirements of the mixin declaration.
*
* Parameters:
- * 0: the display name of the not implemented type
+ * 0: the display name of the mixin
+ * 1: the display name of the superclass
+ * 2: the display name of the type that is not implemented
*/
static const CompileTimeErrorCode
MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE = const CompileTimeErrorCode(
'MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE',
- "The class doesn't implement the required class '{0}'.",
+ "'{0}' cannot be mixed onto '{1}' "
+ "because '{1}' does not implement '{2}'.",
correction: "Try extending the class '{0}'.");
/**
@@ -1822,7 +1783,7 @@
const CompileTimeErrorCode(
'MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER',
"The class doesn't have a concrete implementation of the "
- "super-invoked member '{0}'.");
+ "super-invoked member '{0}'.");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin
@@ -1835,7 +1796,7 @@
const CompileTimeErrorCode(
'MIXIN_CLASS_DECLARES_CONSTRUCTOR',
"The class '{0}' can't be used as a mixin because it declares a "
- "constructor.");
+ "constructor.");
/**
* The <i>mixinMember</i> production allows the same instance or static
@@ -1864,22 +1825,22 @@
const CompileTimeErrorCode(
'MIXIN_INFERENCE_INCONSISTENT_MATCHING_CLASSES',
"Type parameters could not be inferred for the mixin '{0}' because "
- "the base class implements the mixin's supertype constraint "
- "'{1}' in multiple conflicting ways");
+ "the base class implements the mixin's supertype constraint "
+ "'{1}' in multiple conflicting ways");
static const CompileTimeErrorCode MIXIN_INFERENCE_NO_MATCHING_CLASS =
const CompileTimeErrorCode(
'MIXIN_INFERENCE_NO_MATCHING_CLASS',
"Type parameters could not be inferred for the mixin '{0}' because "
- "the base class does not implement the mixin's supertype "
- "constraint '{1}'");
+ "the base class does not implement the mixin's supertype "
+ "constraint '{1}'");
static const CompileTimeErrorCode MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION =
const CompileTimeErrorCode(
'MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION',
"Type parameters could not be inferred for the mixin '{0}' because "
- "no type parameter substitution could be found matching the mixin's "
- "supertype constraints");
+ "no type parameter substitution could be found matching the mixin's "
+ "supertype constraints");
/**
* 9 Mixins: It is a compile-time error if a mixin is derived from a class
@@ -1892,7 +1853,7 @@
const CompileTimeErrorCode(
'MIXIN_INHERITS_FROM_NOT_OBJECT',
"The class '{0}' can't be used as a mixin because it extends a class "
- "other than Object.");
+ "other than Object.");
/**
* A mixin declaration introduces a mixin and an interface, but not a class.
@@ -1945,7 +1906,7 @@
const CompileTimeErrorCode(
'MIXIN_REFERENCES_SUPER',
"The class '{0}' can't be used as a mixin because it references "
- "'super'.");
+ "'super'.");
static const CompileTimeErrorCode
MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS = const CompileTimeErrorCode(
@@ -2061,7 +2022,7 @@
const CompileTimeErrorCode(
'NON_CONST_MAP_AS_EXPRESSION_STATEMENT',
"A non-constant map or set literal without type arguments can't be "
- "used as an expression statement.");
+ "used as an expression statement.");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) {
@@ -2097,7 +2058,7 @@
const CompileTimeErrorCode(
'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as a case "
- "expression.",
+ "expression.",
correction:
"Try re-writing the switch as a series of if statements, or "
"changing the import to not be deferred.");
@@ -2122,7 +2083,7 @@
const CompileTimeErrorCode(
'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as a default "
- "parameter value.",
+ "parameter value.",
correction:
"Try leaving the default as null and initializing the parameter "
"inside the function body.");
@@ -2149,7 +2110,7 @@
const CompileTimeErrorCode(
'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in "
- "a 'const' list.",
+ "a 'const' list.",
correction:
"Try removing the keyword 'const' from the list literal.");
@@ -2173,7 +2134,7 @@
const CompileTimeErrorCode(
'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as keys in a "
- "const map literal.",
+ "const map literal.",
correction: "Try removing the keyword 'const' from the map literal.");
/**
@@ -2205,7 +2166,7 @@
NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY = const CompileTimeErrorCode(
'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in "
- "a const map literal.",
+ "a const map literal.",
correction: "Try removing the keyword 'const' from the map literal.");
/**
@@ -2227,38 +2188,38 @@
correction: "Try removing the keyword 'const' from the set literal.");
static const CompileTimeErrorCode
+ NON_CONSTANT_SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY =
+ const CompileTimeErrorCode(
+ 'NON_CONSTANT_SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY',
+ "Constant values from a deferred library can't be spread into a "
+ "const literal.",
+ correction: "Try making the deferred import non-deferred.");
+
+ static const CompileTimeErrorCode
+ NON_CONSTANT_IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY =
+ const CompileTimeErrorCode(
+ 'NON_CONSTANT_IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY',
+ "Constant values from a deferred library can't be used as values in "
+ "an if condition inside a const collection literal.",
+ correction: "Try making the deferred import non-deferred.");
+
+ static const CompileTimeErrorCode
NON_CONSTANT_SET_ELEMENT_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'NON_CONSTANT_SET_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in "
- "a 'const' set.",
+ "a 'const' set.",
correction: "Try removing the keyword 'const' from the set literal.");
/**
- * 7.6.3 Constant Constructors: Any expression that appears within the
- * initializer list of a constant constructor must be a potentially constant
- * expression, or a compile-time error occurs.
+ * This error code is no longer being generated. It should be removed when the
+ * reference to it in the linter has been removed and rolled into the SDK.
*/
+ @deprecated
static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER =
const CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER',
"Initializer expressions in constant constructors must be constants.");
- /**
- * 7.6.3 Constant Constructors: Any expression that appears within the
- * initializer list of a constant constructor must be a potentially constant
- * expression, or a compile-time error occurs.
- *
- * 12.1 Constants: A qualified reference to a static constant variable that is
- * not qualified by a deferred prefix.
- */
- static const CompileTimeErrorCode
- NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY =
- const CompileTimeErrorCode(
- 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as constant "
- "initializers.",
- correction: "Try changing the import to not be deferred.");
-
static const CompileTimeErrorCode NON_SYNC_FACTORY =
const CompileTimeErrorCode('NON_SYNC_FACTORY',
"Factory bodies can't use 'async', 'async*', or 'sync*'.");
@@ -2279,6 +2240,18 @@
"{0} required argument(s) expected, but {1} found.",
correction: "Try adding the missing arguments.");
+ static const CompileTimeErrorCode NOT_ITERABLE_SPREAD =
+ const CompileTimeErrorCode('NOT_ITERABLE_SPREAD',
+ "Spread elements in list or set literals must implement 'Iterable'.");
+
+ static const CompileTimeErrorCode NOT_MAP_SPREAD = const CompileTimeErrorCode(
+ 'NOT_MAP_SPREAD',
+ "Spread elements in map literals must implement 'Map'.");
+
+ static const CompileTimeErrorCode NOT_NULL_AWARE_NULL_SPREAD =
+ const CompileTimeErrorCode('NOT_NULL_AWARE_NULL_SPREAD',
+ "The Null typed expression can't be used with a non-null-aware spread.");
+
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
* superinitializer appears and let <i>S</i> be the superclass of <i>C</i>.
@@ -2294,6 +2267,53 @@
"making the called constructor not be a factory constructor.");
/**
+ * It is an error if the type `T` in the on-catch clause `on T catch` is
+ * potentially nullable.
+ */
+ static const CompileTimeErrorCode NULLABLE_TYPE_IN_CATCH_CLAUSE =
+ const CompileTimeErrorCode(
+ 'NULLABLE_TYPE_IN_CATCH_CLAUSE',
+ "A nullable type cannot be used in an 'on' clause because it isn't valid "
+ "to throw 'null'.",
+ correction: "Try removing the question mark.");
+
+ /**
+ * It is a compile-time error for a class to extend, implement, or mixin a
+ * type of the form T? for any T.
+ */
+ static const CompileTimeErrorCode NULLABLE_TYPE_IN_EXTENDS_CLAUSE =
+ const CompileTimeErrorCode('NULLABLE_TYPE_IN_EXTENDS_CLAUSE',
+ "A class cannot extend a nullable type.",
+ correction: "Try removing the question mark.");
+
+ /**
+ * It is a compile-time error for a class to extend, implement, or mixin a
+ * type of the form T? for any T.
+ */
+ static const CompileTimeErrorCode NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE =
+ const CompileTimeErrorCode('NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE',
+ "A class or mixin cannot implement a nullable type.",
+ correction: "Try removing the question mark.");
+
+ /**
+ * It is a compile-time error for a class to extend, implement, or mixin a
+ * type of the form T? for any T.
+ */
+ static const CompileTimeErrorCode NULLABLE_TYPE_IN_ON_CLAUSE =
+ const CompileTimeErrorCode('NULLABLE_TYPE_IN_ON_CLAUSE',
+ "A mixin cannot have a nullable type as a superclass constraint.",
+ correction: "Try removing the question mark.");
+
+ /**
+ * It is a compile-time error for a class to extend, implement, or mixin a
+ * type of the form T? for any T.
+ */
+ static const CompileTimeErrorCode NULLABLE_TYPE_IN_WITH_CLAUSE =
+ const CompileTimeErrorCode('NULLABLE_TYPE_IN_WITH_CLAUSE',
+ "A class or mixin cannot mix in a nullable type.",
+ correction: "Try removing the question mark.");
+
+ /**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause
* for class Object.
*/
@@ -2312,7 +2332,7 @@
static const CompileTimeErrorCode ON_REPEATED = const CompileTimeErrorCode(
'ON_REPEATED',
"'{0}' can only be used in super-class constraints only once.",
- correction: "Try removing all but one occurance of the class name.");
+ correction: "Try removing all but one occurrence of the class name.");
/**
* 7.1.1 Operators: It is a compile-time error to declare an optional
@@ -2343,7 +2363,7 @@
const CompileTimeErrorCode(
'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER',
"The name '{0}' is already used as an import prefix and can't be "
- "used to name a top-level element.",
+ "used to name a top-level element.",
correction:
"Try renaming either the top-level element or the prefix.");
@@ -2355,7 +2375,7 @@
const CompileTimeErrorCode(
'PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT',
"The name '{0}' refers to an import prefix, so it must be followed "
- "by '.'.",
+ "by '.'.",
correction:
"Try correcting the name to refer to something other than a prefix, or "
"renaming the prefix.");
@@ -2368,7 +2388,7 @@
const CompileTimeErrorCode(
'PRIVATE_COLLISION_IN_MIXIN_APPLICATION',
"The private name '{0}', defined by '{1}', "
- "conflicts with the same name defined by '{2}'.",
+ "conflicts with the same name defined by '{2}'.",
correction: "Try removing '{1}' from the 'with' clause.");
/**
@@ -2505,7 +2525,7 @@
const CompileTimeErrorCode(
'REDIRECT_TO_NON_CLASS',
"The name '{0}' isn't a type and can't be used in a redirected "
- "constructor.",
+ "constructor.",
correction: "Try redirecting to a different constructor.");
/**
@@ -2516,7 +2536,7 @@
const CompileTimeErrorCode(
'REDIRECT_TO_NON_CONST_CONSTRUCTOR',
"Constant factory constructor can't delegate to a non-constant "
- "constructor.",
+ "constructor.",
correction: "Try redirecting to a different constructor.");
/**
@@ -2594,7 +2614,7 @@
const CompileTimeErrorCode(
'SHARED_DEFERRED_PREFIX',
"The prefix of a deferred import can't be used in other import "
- "directives.",
+ "directives.",
correction: "Try renaming one of the prefixes.");
/**
@@ -2687,7 +2707,7 @@
const CompileTimeErrorCode(
'TYPE_ALIAS_CANNOT_REFERENCE_ITSELF',
"Typedefs can't reference themselves directly or recursively via "
- "another typedef.");
+ "another typedef.");
static const CompileTimeErrorCode TYPE_PARAMETER_ON_CONSTRUCTOR =
const CompileTimeErrorCode('TYPE_PARAMETER_ON_CONSTRUCTOR',
@@ -2867,7 +2887,7 @@
const CompileTimeErrorCode(
'YIELD_EACH_IN_NON_GENERATOR',
"Yield-each statements must be in a generator function "
- "(one marked with either 'async*' or 'sync*').",
+ "(one marked with either 'async*' or 'sync*').",
correction:
"Try adding 'async*' or 'sync*' to the enclosing function.");
@@ -2879,7 +2899,7 @@
const CompileTimeErrorCode(
'YIELD_IN_NON_GENERATOR',
"Yield statements must be in a generator function "
- "(one marked with either 'async*' or 'sync*').",
+ "(one marked with either 'async*' or 'sync*').",
correction:
"Try adding 'async*' or 'sync*' to the enclosing function.");
@@ -2920,7 +2940,7 @@
const StaticTypeWarningCode(
'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
"List literals require exactly one type argument or none, "
- "but {0} found.",
+ "but {0} found.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -2931,7 +2951,7 @@
const StaticTypeWarningCode(
'EXPECTED_ONE_SET_TYPE_ARGUMENTS',
"Set literals require exactly one type argument or none, "
- "but {0} found.",
+ "but {0} found.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -2945,7 +2965,7 @@
const StaticTypeWarningCode(
'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
"Map literals require exactly two type arguments or none, "
- "but {0} found.",
+ "but {0} found.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -2956,7 +2976,7 @@
const StaticTypeWarningCode(
'ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE',
"Functions marked 'async*' must have a return type assignable to "
- "'Stream'.",
+ "'Stream'.",
correction: "Try fixing the return type of the function, or "
"removing the modifier 'async*' from the function body.");
@@ -2968,7 +2988,7 @@
const StaticTypeWarningCode(
'ILLEGAL_ASYNC_RETURN_TYPE',
"Functions marked 'async' must have a return type assignable to "
- "'Future'.",
+ "'Future'.",
correction: "Try fixing the return type of the function, or "
"removing the modifier 'async' from the function body.");
@@ -3248,6 +3268,8 @@
* 0: the name of the getter
* 1: the name of the enclosing type where the getter is being looked for
*/
+ // TODO(brianwilkerson) When the "target" is an enum, report
+ // UNDEFINED_ENUM_CONSTANT instead.
static const StaticTypeWarningCode UNDEFINED_GETTER =
const StaticTypeWarningCode('UNDEFINED_GETTER',
"The getter '{0}' isn't defined for the class '{1}'.",
@@ -3300,7 +3322,7 @@
const StaticTypeWarningCode(
'UNDEFINED_PREFIXED_NAME',
"The name '{0}' is being referenced through the prefix '{1}', but it "
- "isn't defined in any of the libraries imported using that prefix.",
+ "isn't defined in any of the libraries imported using that prefix.",
correction: "Try correcting the prefix or "
"importing the library that defines '{0}'.");
@@ -3428,7 +3450,7 @@
const StaticTypeWarningCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
"The type '{0}' is declared with {1} type parameters, "
- "but {2} type arguments were given.",
+ "but {2} type arguments were given.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -3458,7 +3480,7 @@
const StaticTypeWarningCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
"The method '{0}' is declared with {1} type parameters, "
- "but {2} type arguments were given.",
+ "but {2} type arguments were given.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -3483,7 +3505,7 @@
const StaticTypeWarningCode(
'YIELD_OF_INVALID_TYPE',
"The type '{0}' implied by the 'yield' expression must be assignable "
- "to '{1}'.");
+ "to '{1}'.");
/**
* 17.6.2 For-in. If the iterable expression does not implement Iterable,
@@ -3511,7 +3533,7 @@
const StaticTypeWarningCode(
'FOR_IN_OF_INVALID_ELEMENT_TYPE',
"The type '{0}' used in the 'for' loop must implement {1} with a "
- "type argument that can be assigned to '{2}'.");
+ "type argument that can be assigned to '{2}'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -3673,7 +3695,7 @@
const StaticWarningCode(
'CASE_BLOCK_NOT_TERMINATED',
"The last statement of the 'case' should be 'break', 'continue', "
- "'rethrow', 'return' or 'throw'.",
+ "'rethrow', 'return' or 'throw'.",
correction: "Try adding one of the required statements.");
/**
@@ -3711,21 +3733,6 @@
correction: "Try creating an instance of a subtype.");
/**
- * 12.7 Maps: It is a static warning if the values of any two keys in a map
- * literal are equal.
- */
- static const StaticWarningCode EQUAL_KEYS_IN_MAP = const StaticWarningCode(
- 'EQUAL_KEYS_IN_MAP', "Two keys in a map literal can't be equal.");
-
- /**
- * It is a compile-time error if any two of the values in a constant set are
- * equal according to `==`.
- */
- static const StaticWarningCode EQUAL_VALUES_IN_CONST_SET =
- const StaticWarningCode('EQUAL_VALUES_IN_CONST_SET',
- "Two values in a constant set can't be equal.");
-
- /**
* 14.2 Exports: It is a static warning to export two different libraries with
* the same name.
*
@@ -3781,7 +3788,7 @@
const StaticWarningCode(
'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
"Fields can't be initialized in the constructor if they are final "
- "and have already been initialized at their declaration.",
+ "and have already been initialized at their declaration.",
correction: "Try removing one of the initializations.");
/**
@@ -3797,7 +3804,7 @@
const StaticWarningCode(
'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR',
"'{0}' is final and was given a value when it was declared, "
- "so it can't be set to a new value.",
+ "so it can't be set to a new value.",
correction: "Try removing one of the initializations.");
/**
@@ -3907,16 +3914,6 @@
correction: "Try adding initializers for the fields.");
/**
- * 15.5 Function Types: It is a static warning if a concrete class implements
- * Function and does not have a concrete method named call().
- */
- static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode(
- 'FUNCTION_WITHOUT_CALL',
- "Concrete classes that implement 'Function' must implement the method 'call'.",
- correction:
- "Try implementing a 'call' method, or don't implement 'Function'.");
-
- /**
* 14.1 Imports: It is a static warning to import two different libraries with
* the same name.
*
@@ -3955,7 +3952,7 @@
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED',
"Parameters can't override default values, "
- "this method overrides '{0}.{1}' where '{2}' has a different value.",
+ "this method overrides '{0}.{1}' where '{2}' has a different value.",
correction: "Try using the same default value in both methods.",
errorSeverity: ErrorSeverity.WARNING);
@@ -3971,84 +3968,11 @@
const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL',
"Parameters can't override default values, this method overrides "
- "'{0}.{1}' where this positional parameter has a different value.",
+ "'{0}.{1}' where this positional parameter has a different value.",
correction: "Try using the same default value in both methods.",
errorSeverity: ErrorSeverity.WARNING);
/**
- * 7.1 Instance Methods: It is a static warning if an instance method
- * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not
- * declare all the named parameters declared by <i>m2</i>.
- *
- * Parameters:
- * 0: the number of named parameters in the overridden member
- * 1: the signature of the overridden member
- * 2: the name of the class from the overridden method
- */
- static const StaticWarningCode INVALID_OVERRIDE_NAMED =
- const StaticWarningCode(
- 'INVALID_OVERRIDE_NAMED',
- "Missing the named parameter '{0}' "
- "to match the overridden method from '{1}' from '{2}'.",
- correction: "Try adding the named parameter to this method, or "
- "removing it from the overridden method.");
-
- /**
- * 7.1 Instance Methods: It is a static warning if an instance method
- * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer
- * positional parameters than <i>m2</i>.
- *
- * Parameters:
- * 0: the number of positional parameters in the overridden member
- * 1: the signature of the overridden member
- * 2: the name of the class from the overridden method
- */
- static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL =
- const StaticWarningCode(
- 'INVALID_OVERRIDE_POSITIONAL',
- "Must have at least {0} parameters "
- "to match the overridden method '{1}' from '{2}'.",
- correction: "Try adding the necessary parameters.");
-
- /**
- * 7.1 Instance Methods: It is a static warning if an instance method
- * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a
- * greater number of required parameters than <i>m2</i>.
- *
- * Parameters:
- * 0: the number of required parameters in the overridden member
- * 1: the signature of the overridden member
- * 2: the name of the class from the overridden method
- */
- static const StaticWarningCode INVALID_OVERRIDE_REQUIRED =
- const StaticWarningCode(
- 'INVALID_OVERRIDE_REQUIRED',
- "Must have {0} required parameters or less "
- "to match the overridden method '{1}' from '{2}'.",
- correction: "Try removing the extra parameters.");
-
- /**
- * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a
- * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of
- * <i>m2</i>.
- *
- * Parameters:
- * 0: the name of the actual parameter type
- * 1: the name of the expected parameter type, not assignable to the actual
- * parameter type
- * 2: the name of the class where the overridden setter is declared
- *
- * See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE].
- */
- static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE =
- const StaticWarningCode(
- 'INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE',
- "The parameter type '{0}' isn't assignable to '{1}' as required by "
- "the setter it is overriding from '{2}'.",
- correction:
- "Try changing the parameter types so that they are compatible.");
-
- /**
* 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i>
* … <i>e<sub>n</sub></i>] is evaluated as follows:
* * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and
@@ -4122,7 +4046,7 @@
const StaticWarningCode(
'MISMATCHED_GETTER_AND_SETTER_TYPES',
"The return type of getter '{0}' is '{1}' which isn't assignable "
- "to the type '{2}' of its setter '{3}'.",
+ "to the type '{2}' of its setter '{3}'.",
correction: "Try changing the types so that they are compatible.");
/**
@@ -4182,7 +4106,7 @@
const StaticWarningCode(
'NEW_WITH_INVALID_TYPE_PARAMETERS',
"The type '{0}' is declared with {1} type parameters, "
- "but {2} type arguments were given.",
+ "but {2} type arguments were given.",
correction: "Try adjusting the number of type arguments.");
/**
@@ -4540,7 +4464,7 @@
const StaticWarningCode(
'SWITCH_EXPRESSION_NOT_ASSIGNABLE',
"Type '{0}' of the switch expression isn't assignable to "
- "the type '{1}' of case expressions.");
+ "the type '{1}' of case expressions.");
/**
* 15.1 Static Types: It is a static warning to use a deferred type in a type
@@ -4664,7 +4588,7 @@
const StaticWarningCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
'The expression is nullable and must be null-checked before it can be'
- ' used.',
+ ' used.',
correction:
'Try casting or check the value is not null before using it.');
@@ -4790,29 +4714,29 @@
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_LITERAL_LIST',
"The list literal type '{0}' isn't of expected type '{1}'. The list's "
- "type can be changed with an explicit generic type argument or by "
- "changing the element types.");
+ "type can be changed with an explicit generic type argument or by "
+ "changing the element types.");
static const StrongModeCode INVALID_CAST_LITERAL_MAP = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_LITERAL_MAP',
"The map literal type '{0}' isn't of expected type '{1}'. The maps's "
- "type can be changed with an explicit generic type arguments or by "
- "changing the key and value types.");
+ "type can be changed with an explicit generic type arguments or by "
+ "changing the key and value types.");
static const StrongModeCode INVALID_CAST_LITERAL_SET = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_LITERAL_SET',
"The set literal type '{0}' isn't of expected type '{1}'. The set's "
- "type can be changed with an explicit generic type argument or by "
- "changing the element types.");
+ "type can be changed with an explicit generic type argument or by "
+ "changing the element types.");
static const StrongModeCode INVALID_CAST_FUNCTION_EXPR = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_FUNCTION_EXPR',
"The function expression type '{0}' isn't of type '{1}'. "
- "This means its parameter or return type does not match what is "
- "expected. Consider changing parameter type(s) or the returned type(s).");
+ "This means its parameter or return type does not match what is "
+ "expected. Consider changing parameter type(s) or the returned type(s).");
static const StrongModeCode INVALID_CAST_NEW_EXPR = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
@@ -4823,21 +4747,21 @@
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_METHOD',
"The method tear-off '{0}' has type '{1}' that isn't of expected type "
- "'{2}'. This means its parameter or return type does not match what is "
- "expected.");
+ "'{2}'. This means its parameter or return type does not match what is "
+ "expected.");
static const StrongModeCode INVALID_CAST_FUNCTION = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_CAST_FUNCTION',
"The function '{0}' has type '{1}' that isn't of expected type "
- "'{2}'. This means its parameter or return type does not match what is "
- "expected.");
+ "'{2}'. This means its parameter or return type does not match what is "
+ "expected.");
static const StrongModeCode INVALID_SUPER_INVOCATION = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_SUPER_INVOCATION',
"super call must be last in an initializer "
- "list (see https://goo.gl/EY6hDP): '{0}'.");
+ "list (see https://goo.gl/EY6hDP): '{0}'.");
static const StrongModeCode NON_GROUND_TYPE_CHECK_INFO = const StrongModeCode(
ErrorType.HINT,
@@ -4847,11 +4771,6 @@
static const StrongModeCode DYNAMIC_INVOKE = const StrongModeCode(
ErrorType.HINT, 'DYNAMIC_INVOKE', "'{0}' requires a dynamic invoke.");
- static const StrongModeCode INVALID_FIELD_OVERRIDE = const StrongModeCode(
- ErrorType.COMPILE_TIME_ERROR,
- 'INVALID_FIELD_OVERRIDE',
- "Field declaration '{3}.{1}' can't be overridden in '{0}'.");
-
static const StrongModeCode IMPLICIT_DYNAMIC_PARAMETER = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_PARAMETER',
@@ -4914,12 +4833,6 @@
"Missing type arguments for calling generic function type '{0}'.",
correction: _implicitDynamicCorrection);
- static const StrongModeCode NO_DEFAULT_BOUNDS = const StrongModeCode(
- ErrorType.COMPILE_TIME_ERROR,
- 'NO_DEFAULT_BOUNDS',
- "Type has no default bounds",
- correction: "Try adding explicit type arguments to type");
-
static const StrongModeCode NOT_INSTANTIATED_BOUND = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'NOT_INSTANTIATED_BOUND',
@@ -4956,22 +4869,16 @@
ErrorType.STATIC_WARNING,
'TOP_LEVEL_INSTANCE_GETTER',
"The type of '{0}' can't be inferred because it refers to an instance "
- "getter, '{1}', which has an implicit type.",
+ "getter, '{1}', which has an implicit type.",
correction: "Add an explicit type for either '{0}' or '{1}'.");
static const StrongModeCode TOP_LEVEL_INSTANCE_METHOD = const StrongModeCode(
ErrorType.STATIC_WARNING,
'TOP_LEVEL_INSTANCE_METHOD',
"The type of '{0}' can't be inferred because it refers to an instance "
- "method, '{1}', which has an implicit type.",
+ "method, '{1}', which has an implicit type.",
correction: "Add an explicit type for either '{0}' or '{1}'.");
- static const StrongModeCode TOP_LEVEL_UNSUPPORTED = const StrongModeCode(
- ErrorType.HINT,
- 'TOP_LEVEL_UNSUPPORTED',
- "The type of '{0}' can't be inferred because {1} expressions aren't supported.",
- correction: "Try adding an explicit type for '{0}'.");
-
@override
final ErrorType type;
diff --git a/analyzer/lib/src/error/literal_element_verifier.dart b/analyzer/lib/src/error/literal_element_verifier.dart
new file mode 100644
index 0000000..89dcdce
--- /dev/null
+++ b/analyzer/lib/src/error/literal_element_verifier.dart
@@ -0,0 +1,220 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+
+/// Verifier for [CollectionElement]s in list, set, or map literals.
+class LiteralElementVerifier {
+ final TypeProvider typeProvider;
+ final TypeSystem typeSystem;
+ final ErrorReporter errorReporter;
+ final bool Function(Expression) checkForUseOfVoidResult;
+
+ final bool forList;
+ final bool forSet;
+ final DartType elementType;
+
+ final bool forMap;
+ final DartType mapKeyType;
+ final DartType mapValueType;
+
+ LiteralElementVerifier(
+ this.typeProvider,
+ this.typeSystem,
+ this.errorReporter,
+ this.checkForUseOfVoidResult, {
+ this.forList = false,
+ this.forSet = false,
+ this.elementType,
+ this.forMap = false,
+ this.mapKeyType,
+ this.mapValueType,
+ });
+
+ void verify(CollectionElement element) {
+ _verifyElement(element);
+ }
+
+ /// Check that the given [type] is assignable to the [elementType], otherwise
+ /// report the list or set error on the [errorNode].
+ void _checkAssignableToElementType(DartType type, AstNode errorNode) {
+ if (!typeSystem.isAssignableTo(type, elementType)) {
+ var errorCode = forList
+ ? StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
+ : StaticWarningCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE;
+ errorReporter.reportTypeErrorForNode(
+ errorCode,
+ errorNode,
+ [type, elementType],
+ );
+ }
+ }
+
+ /// Verify that the given [element] can be assigned to the [elementType] of
+ /// the enclosing list, set, of map literal.
+ void _verifyElement(CollectionElement element) {
+ if (element is Expression) {
+ if (forList || forSet) {
+ if (!elementType.isVoid && checkForUseOfVoidResult(element)) {
+ return;
+ }
+ _checkAssignableToElementType(element.staticType, element);
+ } else {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.EXPRESSION_IN_MAP, element);
+ }
+ } else if (element is ForElement) {
+ _verifyElement(element.body);
+ } else if (element is IfElement) {
+ _verifyElement(element.thenElement);
+ _verifyElement(element.elseElement);
+ } else if (element is MapLiteralEntry) {
+ if (forMap) {
+ _verifyMapLiteralEntry(element);
+ } else {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.MAP_ENTRY_NOT_IN_MAP, element);
+ }
+ } else if (element is SpreadElement) {
+ var isNullAware = element.spreadOperator.type ==
+ TokenType.PERIOD_PERIOD_PERIOD_QUESTION;
+ Expression expression = element.expression;
+ if (forList || forSet) {
+ _verifySpreadForListOrSet(isNullAware, expression);
+ } else if (forMap) {
+ _verifySpreadForMap(isNullAware, expression);
+ }
+ }
+ }
+
+ /// Verify that the [entry]'s key and value are assignable to [mapKeyType]
+ /// and [mapValueType].
+ void _verifyMapLiteralEntry(MapLiteralEntry entry) {
+ if (!mapKeyType.isVoid && checkForUseOfVoidResult(entry.key)) {
+ return;
+ }
+
+ if (!mapValueType.isVoid && checkForUseOfVoidResult(entry.value)) {
+ return;
+ }
+
+ var keyType = entry.key.staticType;
+ if (!typeSystem.isAssignableTo(keyType, mapKeyType)) {
+ errorReporter.reportTypeErrorForNode(
+ StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
+ entry.key,
+ [keyType, mapKeyType],
+ );
+ }
+
+ var valueType = entry.value.staticType;
+ if (!typeSystem.isAssignableTo(valueType, mapValueType)) {
+ errorReporter.reportTypeErrorForNode(
+ StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
+ entry.value,
+ [valueType, mapValueType],
+ );
+ }
+ }
+
+ /// Verify that the type of the elements of the given [expression] can be
+ /// assigned to the [elementType] of the enclosing collection.
+ void _verifySpreadForListOrSet(bool isNullAware, Expression expression) {
+ var expressionType = expression.staticType;
+ if (expressionType.isDynamic) return;
+
+ if (expressionType.isDartCoreNull) {
+ if (!isNullAware) {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.NOT_NULL_AWARE_NULL_SPREAD,
+ expression,
+ );
+ }
+ return;
+ }
+
+ InterfaceType iterableType;
+ var iterableObjectType = typeProvider.iterableObjectType;
+ if (expressionType is InterfaceTypeImpl &&
+ typeSystem.isSubtypeOf(expressionType, iterableObjectType)) {
+ iterableType = expressionType.asInstanceOf(
+ iterableObjectType.element,
+ );
+ }
+
+ if (iterableType == null) {
+ return errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.NOT_ITERABLE_SPREAD,
+ expression,
+ );
+ }
+
+ var iterableElementType = iterableType.typeArguments[0];
+ if (!typeSystem.isAssignableTo(iterableElementType, elementType)) {
+ var errorCode = forList
+ ? StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
+ : StaticWarningCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE;
+ errorReporter.reportTypeErrorForNode(
+ errorCode,
+ expression,
+ [iterableElementType, elementType],
+ );
+ }
+ }
+
+ /// Verify that the [expression] is a subtype of `Map<Object, Object>`, and
+ /// its key and values are assignable to [mapKeyType] and [mapValueType].
+ void _verifySpreadForMap(bool isNullAware, Expression expression) {
+ var expressionType = expression.staticType;
+ if (expressionType.isDynamic) return;
+
+ if (expressionType.isDartCoreNull) {
+ if (!isNullAware) {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.NOT_NULL_AWARE_NULL_SPREAD,
+ expression,
+ );
+ }
+ return;
+ }
+
+ InterfaceType mapType;
+ var mapObjectObjectType = typeProvider.mapObjectObjectType;
+ if (expressionType is InterfaceTypeImpl &&
+ typeSystem.isSubtypeOf(expressionType, mapObjectObjectType)) {
+ mapType = expressionType.asInstanceOf(mapObjectObjectType.element);
+ }
+
+ if (mapType == null) {
+ return errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.NOT_MAP_SPREAD,
+ expression,
+ );
+ }
+
+ var keyType = mapType.typeArguments[0];
+ if (!typeSystem.isAssignableTo(keyType, mapKeyType)) {
+ errorReporter.reportTypeErrorForNode(
+ StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
+ expression,
+ [keyType, mapKeyType],
+ );
+ }
+
+ var valueType = mapType.typeArguments[1];
+ if (!typeSystem.isAssignableTo(valueType, mapValueType)) {
+ errorReporter.reportTypeErrorForNode(
+ StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
+ expression,
+ [valueType, mapValueType],
+ );
+ }
+ }
+}
diff --git a/analyzer/lib/src/fasta/ast_builder.dart b/analyzer/lib/src/fasta/ast_builder.dart
index 29d4bd9..ccc46ca 100644
--- a/analyzer/lib/src/fasta/ast_builder.dart
+++ b/analyzer/lib/src/fasta/ast_builder.dart
@@ -1,7 +1,8 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
@@ -29,6 +30,8 @@
messageFieldInitializerOutsideConstructor,
messageIllegalAssignmentToNonAssignable,
messageInterpolationInUri,
+ messageInvalidSuperInInitializer,
+ messageInvalidThisInInitializer,
messageMissingAssignableSelector,
messageNativeClauseShouldBeAnnotation,
messageStaticConstructor,
@@ -102,7 +105,10 @@
bool parseFunctionBodies = true;
- /// `true` if non-nullable behavior is enabled
+ /// `true` if non-nullable behavior is enabled.
+ ///
+ /// When setting this field, be sure to set `scanner.enableNonNullable`
+ /// to the same value.
bool enableNonNullable = false;
/// `true` if spread-collections behavior is enabled
@@ -111,6 +117,11 @@
/// `true` if control-flow-collections behavior is enabled
bool enableControlFlowCollections = false;
+ /// `true` if triple-shift behavior is enabled
+ bool enableTripleShift = false;
+
+ FeatureSet _featureSet;
+
AstBuilder(ErrorReporter errorReporter, this.fileUri, this.isFullAst,
[Uri uri])
: this.errorReporter = new FastaErrorReporter(errorReporter),
@@ -162,11 +173,12 @@
}
@override
- void beginFormalParameter(Token token, MemberKind kind, Token covariantToken,
- Token varFinalOrConst) {
+ void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
+ Token covariantToken, Token varFinalOrConst) {
push(new _Modifiers()
..covariantKeyword = covariantToken
- ..finalConstOrVarKeyword = varFinalOrConst);
+ ..finalConstOrVarKeyword = varFinalOrConst
+ ..requiredToken = requiredToken);
}
@override
@@ -248,10 +260,13 @@
}
@override
- void beginVariablesDeclaration(Token token, Token varFinalOrConst) {
+ void beginVariablesDeclaration(
+ Token token, Token lateToken, Token varFinalOrConst) {
debugEvent("beginVariablesDeclaration");
- if (varFinalOrConst != null) {
- push(new _Modifiers()..finalConstOrVarKeyword = varFinalOrConst);
+ if (varFinalOrConst != null || lateToken != null) {
+ push(new _Modifiers()
+ ..finalConstOrVarKeyword = varFinalOrConst
+ ..lateToken = lateToken);
} else {
push(NullValue.Modifiers);
}
@@ -269,6 +284,21 @@
}
}
+ /// Configures the parser appropriately for the given [featureSet].
+ ///
+ /// TODO(paulberry): stop exposing `enableNonNullable`,
+ /// `enableSpreadCollections`, `enableControlFlowCollections`, and
+ /// `enableTripleShift` so that callers are forced to use this API. Note that
+ /// this will not be a breaking change, because this code is in `lib/src`.
+ void configureFeatures(FeatureSet featureSet) {
+ enableNonNullable = featureSet.isEnabled(Feature.non_nullable);
+ enableSpreadCollections = featureSet.isEnabled(Feature.spread_collections);
+ enableControlFlowCollections =
+ featureSet.isEnabled(Feature.control_flow_collections);
+ enableTripleShift = featureSet.isEnabled(Feature.triple_shift);
+ _featureSet = featureSet;
+ }
+
@override
void debugEvent(String name) {
// printEvent('AstBuilder: $name');
@@ -395,6 +425,13 @@
Expression left = pop();
reportErrorIfSuper(right);
push(ast.binaryExpression(left, operatorToken, right));
+ if (!enableTripleShift && operatorToken.type == TokenType.GT_GT_GT) {
+ handleRecoverableError(
+ templateExperimentNotEnabled
+ .withArguments(EnableString.triple_shift),
+ operatorToken,
+ operatorToken);
+ }
}
}
@@ -467,10 +504,13 @@
Token beginToken = pop();
checkEmpty(endToken.charOffset);
- CompilationUnitImpl unit = ast.compilationUnit(
- beginToken, scriptTag, directives, declarations, endToken)
- as CompilationUnitImpl;
- unit.isNonNullable = enableNonNullable;
+ CompilationUnitImpl unit = ast.compilationUnit2(
+ beginToken: beginToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ declarations: declarations,
+ endToken: endToken,
+ featureSet: _featureSet) as CompilationUnitImpl;
push(unit);
}
@@ -681,27 +721,27 @@
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token semicolon) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token semicolon) {
assert(optional(';', semicolon));
debugEvent("Fields");
List<VariableDeclaration> variables = popTypedList(count);
TypeAnnotation type = pop();
- _Modifiers modifiers = new _Modifiers()
- ..staticKeyword = staticToken
- ..covariantKeyword = covariantToken
- ..finalConstOrVarKeyword = varFinalOrConst;
- var variableList = ast.variableDeclarationList(
- null, null, modifiers?.finalConstOrVarKeyword, type, variables);
- Token covariantKeyword = modifiers?.covariantKeyword;
+ var variableList = ast.variableDeclarationList2(
+ lateKeyword: lateToken,
+ keyword: varFinalOrConst,
+ type: type,
+ variables: variables,
+ );
+ Token covariantKeyword = covariantToken;
List<Annotation> metadata = pop();
Comment comment = _findComment(metadata, beginToken);
(classDeclaration ?? mixinDeclaration).members.add(ast.fieldDeclaration2(
comment: comment,
metadata: metadata,
covariantKeyword: covariantKeyword,
- staticKeyword: modifiers?.staticKeyword,
+ staticKeyword: staticToken,
fieldList: variableList,
semicolon: semicolon));
}
@@ -727,7 +767,7 @@
Token forToken = pop();
Token awaitToken = pop(NullValue.AwaitToken);
- push(ast.forStatement2(
+ push(ast.forStatement(
awaitKeyword: awaitToken,
forKeyword: forToken,
leftParenthesis: leftParenthesis,
@@ -776,6 +816,10 @@
_Modifiers modifiers = pop();
Token keyword = modifiers?.finalConstOrVarKeyword;
Token covariantKeyword = modifiers?.covariantKeyword;
+ Token requiredKeyword = modifiers?.requiredToken;
+ if (!enableNonNullable) {
+ reportNonNullableModifierError(requiredKeyword);
+ }
List<Annotation> metadata = pop();
Comment comment = _findComment(metadata,
thisKeyword ?? typeOrFunctionTypedParameter?.beginToken ?? nameToken);
@@ -791,6 +835,7 @@
comment: comment,
metadata: metadata,
covariantKeyword: covariantKeyword,
+ requiredKeyword: requiredKeyword,
returnType: typeOrFunctionTypedParameter.returnType,
typeParameters: typeOrFunctionTypedParameter.typeParameters,
parameters: typeOrFunctionTypedParameter.parameters);
@@ -800,6 +845,7 @@
comment: comment,
metadata: metadata,
covariantKeyword: covariantKeyword,
+ requiredKeyword: requiredKeyword,
type: typeOrFunctionTypedParameter.returnType,
thisKeyword: thisKeyword,
period: periodAfterThis,
@@ -813,6 +859,7 @@
comment: comment,
metadata: metadata,
covariantKeyword: covariantKeyword,
+ requiredKeyword: requiredKeyword,
keyword: keyword,
type: type,
identifier: name);
@@ -821,6 +868,7 @@
comment: comment,
metadata: metadata,
covariantKeyword: covariantKeyword,
+ requiredKeyword: requiredKeyword,
keyword: keyword,
type: type,
thisKeyword: thisKeyword,
@@ -829,7 +877,8 @@
}
}
- ParameterKind analyzerKind = _toAnalyzerParameterKind(kind);
+ ParameterKind analyzerKind =
+ _toAnalyzerParameterKind(kind, requiredKeyword);
FormalParameter parameter = node;
if (analyzerKind != ParameterKind.REQUIRED) {
parameter = ast.defaultFormalParameter(
@@ -880,7 +929,7 @@
Token leftParen = pop();
Token forToken = pop();
- push(ast.forStatement2(
+ push(ast.forStatement(
forKeyword: forToken,
leftParenthesis: leftParen,
forLoopParts: forLoopParts,
@@ -1123,8 +1172,31 @@
initializerObject.methodName,
initializerObject.argumentList));
} else {
- // Invalid initializer
- // TODO(danrubel): Capture this in the AST.
+ // Recovery: Invalid initializer
+ if (target is FunctionExpressionInvocation) {
+ var targetFunct = target.function;
+ if (targetFunct is SuperExpression) {
+ initializers.add(ast.superConstructorInvocation(
+ targetFunct.superKeyword, null, null, target.argumentList));
+ // TODO(danrubel): Consider generating this error in the parser
+ // This error is also reported in the body builder
+ handleRecoverableError(messageInvalidSuperInInitializer,
+ targetFunct.superKeyword, targetFunct.superKeyword);
+ } else if (targetFunct is ThisExpression) {
+ initializers.add(ast.redirectingConstructorInvocation(
+ targetFunct.thisKeyword, null, null, target.argumentList));
+ // TODO(danrubel): Consider generating this error in the parser
+ // This error is also reported in the body builder
+ handleRecoverableError(messageInvalidThisInInitializer,
+ targetFunct.thisKeyword, targetFunct.thisKeyword);
+ } else {
+ throw new UnsupportedError(
+ 'unsupported initializer $initializerObject');
+ }
+ } else {
+ throw new UnsupportedError(
+ 'unsupported initializer $initializerObject');
+ }
}
} else if (initializerObject is AssignmentExpression) {
Token thisKeyword;
@@ -1158,6 +1230,36 @@
initializerObject.rightHandSide));
} else if (initializerObject is AssertInitializer) {
initializers.add(initializerObject);
+ } else if (initializerObject is PropertyAccess) {
+ // Recovery: Invalid initializer
+ Expression target = initializerObject.target;
+ if (target is FunctionExpressionInvocation) {
+ var targetFunct = target.function;
+ if (targetFunct is SuperExpression) {
+ initializers.add(ast.superConstructorInvocation(
+ targetFunct.superKeyword, null, null, target.argumentList));
+ // TODO(danrubel): Consider generating this error in the parser
+ // This error is also reported in the body builder
+ handleRecoverableError(messageInvalidSuperInInitializer,
+ targetFunct.superKeyword, targetFunct.superKeyword);
+ } else if (targetFunct is ThisExpression) {
+ initializers.add(ast.redirectingConstructorInvocation(
+ targetFunct.thisKeyword, null, null, target.argumentList));
+ // TODO(danrubel): Consider generating this error in the parser
+ // This error is also reported in the body builder
+ handleRecoverableError(messageInvalidThisInInitializer,
+ targetFunct.thisKeyword, targetFunct.thisKeyword);
+ } else {
+ throw new UnsupportedError(
+ 'unsupported initializer $initializerObject');
+ }
+ } else {
+ throw new UnsupportedError(
+ 'unsupported initializer $initializerObject');
+ }
+ } else {
+ throw new UnsupportedError('unsupported initializer:'
+ ' ${initializerObject.runtimeType} :: $initializerObject');
}
}
@@ -1657,20 +1759,25 @@
debugEvent("TopLevelDeclaration");
}
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token semicolon) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token semicolon) {
assert(optional(';', semicolon));
debugEvent("TopLevelFields");
List<VariableDeclaration> variables = popTypedList(count);
TypeAnnotation type = pop();
- _Modifiers modifiers = new _Modifiers()
- ..staticKeyword = staticToken
- ..covariantKeyword = covariantToken
- ..finalConstOrVarKeyword = varFinalOrConst;
- Token keyword = modifiers?.finalConstOrVarKeyword;
- var variableList =
- ast.variableDeclarationList(null, null, keyword, type, variables);
+ var variableList = ast.variableDeclarationList2(
+ lateKeyword: lateToken,
+ keyword: varFinalOrConst,
+ type: type,
+ variables: variables,
+ );
List<Annotation> metadata = pop();
Comment comment = _findComment(metadata, beginToken);
declarations.add(ast.topLevelVariableDeclaration(
@@ -1780,8 +1887,14 @@
Comment comment = _findComment(metadata,
variables[0].beginToken ?? type?.beginToken ?? modifiers.beginToken);
push(ast.variableDeclarationStatement(
- ast.variableDeclarationList(
- comment, metadata, keyword, type, variables),
+ ast.variableDeclarationList2(
+ comment: comment,
+ metadata: metadata,
+ lateKeyword: modifiers?.lateToken,
+ keyword: keyword,
+ type: type,
+ variables: variables,
+ ),
semicolon));
}
@@ -1869,6 +1982,12 @@
messageMissingAssignableSelector, lhs.beginToken, lhs.endToken);
}
push(ast.assignmentExpression(lhs, token, rhs));
+ if (!enableTripleShift && token.type == TokenType.GT_GT_GT_EQ) {
+ handleRecoverableError(
+ templateExperimentNotEnabled.withArguments(EnableString.triple_shift),
+ token,
+ token);
+ }
}
void handleAsyncModifier(Token asyncToken, Token starToken) {
@@ -2080,6 +2199,11 @@
push(ast.emptyStatement(semicolon));
}
+ @override
+ void handleErrorToken(ErrorToken token) {
+ translateErrorToken(token, errorReporter.reportScannerError);
+ }
+
void handleExpressionFunctionBody(Token arrowToken, Token semicolon) {
assert(optional('=>', arrowToken) || optional('=', arrowToken));
assert(optionalOrNull(';', semicolon));
@@ -2523,9 +2647,13 @@
}
}
}
- // ignore: deprecated_member_use_from_same_package
- push(ast.setLiteral(
- constKeyword, typeArguments, leftBrace, setEntries, rightBrace));
+ push(ast.setOrMapLiteral(
+ constKeyword: constKeyword,
+ typeArguments: typeArguments,
+ leftBracket: leftBrace,
+ elements: setEntries,
+ rightBracket: rightBrace,
+ ));
} else {
final mapEntries = <MapLiteralEntry>[];
if (elements != null) {
@@ -2546,9 +2674,13 @@
}
}
}
- // ignore: deprecated_member_use_from_same_package
- push(ast.mapLiteral(
- constKeyword, typeArguments, leftBrace, mapEntries, rightBrace));
+ push(ast.setOrMapLiteral(
+ constKeyword: constKeyword,
+ typeArguments: typeArguments,
+ leftBracket: leftBrace,
+ elements: mapEntries,
+ rightBracket: rightBrace,
+ ));
}
}
}
@@ -3156,10 +3288,14 @@
return variableDeclaration;
}
- ParameterKind _toAnalyzerParameterKind(FormalParameterKind type) {
+ ParameterKind _toAnalyzerParameterKind(
+ FormalParameterKind type, Token requiredKeyword) {
if (type == FormalParameterKind.optionalPositional) {
return ParameterKind.POSITIONAL;
} else if (type == FormalParameterKind.optionalNamed) {
+ if (requiredKeyword != null) {
+ return ParameterKind.NAMED_REQUIRED;
+ }
return ParameterKind.NAMED;
} else {
return ParameterKind.REQUIRED;
@@ -3194,34 +3330,8 @@
Token finalConstOrVarKeyword;
Token staticKeyword;
Token covariantKeyword;
-
- _Modifiers([List<Token> modifierTokens]) {
- // No need to check the order and uniqueness of the modifiers, or that
- // disallowed modifiers are not used; the parser should do that.
- // TODO(paulberry,ahe): implement the necessary logic in the parser.
- if (modifierTokens != null) {
- for (var token in modifierTokens) {
- var s = token.lexeme;
- if (identical('abstract', s)) {
- abstractKeyword = token;
- } else if (identical('const', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('external', s)) {
- externalKeyword = token;
- } else if (identical('final', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('static', s)) {
- staticKeyword = token;
- } else if (identical('var', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('covariant', s)) {
- covariantKeyword = token;
- } else {
- unhandled("$s", "modifier", token.charOffset, null);
- }
- }
- }
- }
+ Token requiredToken;
+ Token lateToken;
/// Return the token that is lexically first.
Token get beginToken {
@@ -3231,7 +3341,9 @@
externalKeyword,
finalConstOrVarKeyword,
staticKeyword,
- covariantKeyword
+ covariantKeyword,
+ requiredToken,
+ lateToken,
]) {
if (firstToken == null) {
firstToken = token;
diff --git a/analyzer/lib/src/fasta/token_utils.dart b/analyzer/lib/src/fasta/token_utils.dart
index 2037396..c5ad5c2 100644
--- a/analyzer/lib/src/fasta/token_utils.dart
+++ b/analyzer/lib/src/fasta/token_utils.dart
@@ -4,45 +4,6 @@
import 'package:front_end/src/scanner/token.dart' show CommentToken, Token;
-import 'package:front_end/src/fasta/scanner/token_constants.dart';
-
-import 'package:front_end/src/scanner/errors.dart' show translateErrorToken;
-
-import 'package:front_end/src/scanner/errors.dart' as analyzer
- show ScannerErrorCode;
-
-/// Class capable of converting a stream of Fasta tokens to a stream of analyzer
-/// tokens.
-///
-/// This is a class rather than an ordinary method so that it can be subclassed
-/// in tests.
-class ToAnalyzerTokenStreamConverter {
- /// Converts a stream of Fasta tokens (starting with [token] and continuing to
- /// EOF) to a stream of analyzer tokens. This modifies the fasta token stream
- /// to be an analyzer token stream by removing error tokens and reporting
- /// those errors to the associated error listener.
- Token convertTokens(Token firstToken) {
- Token token = new Token.eof(-1)..setNext(firstToken);
- Token next = firstToken;
- while (!next.isEof) {
- if (next.type.kind == BAD_INPUT_TOKEN) {
- translateErrorToken(next, reportError);
- token.setNext(next.next);
- } else {
- token = next;
- }
- next = token.next;
- }
- return firstToken;
- }
-
- /// Handles an error found during [convertTokens].
- ///
- /// Intended to be overridden by derived classes; by default, does nothing.
- void reportError(analyzer.ScannerErrorCode errorCode, int offset,
- List<Object> arguments) {}
-}
-
/// Search for the token before [target] starting the search with [start].
/// Return `null` if [target] is a comment token
/// or the previous token cannot be found.
diff --git a/analyzer/lib/src/file_system/file_system.dart b/analyzer/lib/src/file_system/file_system.dart
index 183b8d1..28bd8b2 100644
--- a/analyzer/lib/src/file_system/file_system.dart
+++ b/analyzer/lib/src/file_system/file_system.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/ast.dart b/analyzer/lib/src/generated/ast.dart
index 3b0eba2..a1900ab 100644
--- a/analyzer/lib/src/generated/ast.dart
+++ b/analyzer/lib/src/generated/ast.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/constant.dart b/analyzer/lib/src/generated/constant.dart
index b4a0bda..ea8336f 100644
--- a/analyzer/lib/src/generated/constant.dart
+++ b/analyzer/lib/src/generated/constant.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/dart/analysis/declared_variables.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/constant/evaluation.dart';
import 'package:analyzer/src/dart/constant/value.dart';
@@ -128,9 +129,15 @@
new ConstantEvaluationEngine(_typeProvider, new DeclaredVariables(),
typeSystem: _typeSystem),
errorReporter));
+ List<AnalysisError> errors = errorListener.errors;
+ if (errors.isNotEmpty) {
+ return EvaluationResult.forErrors(errors);
+ }
if (result != null) {
return EvaluationResult.forValue(result);
}
- return EvaluationResult.forErrors(errorListener.errors);
+ // We should not get here. Either there should be a valid value or there
+ // should be an error explaining why a value could not be generated.
+ return EvaluationResult.forErrors(errors);
}
}
diff --git a/analyzer/lib/src/generated/declaration_resolver.dart b/analyzer/lib/src/generated/declaration_resolver.dart
index 7175395..582ab2d 100644
--- a/analyzer/lib/src/generated/declaration_resolver.dart
+++ b/analyzer/lib/src/generated/declaration_resolver.dart
@@ -137,10 +137,7 @@
});
}
- bool isFunctionTyped = normalParameter is FunctionTypedFormalParameter ||
- normalParameter is FieldFormalParameter &&
- normalParameter.parameters != null;
- _walk(new ElementWalker.forParameter(element, isFunctionTyped), () {
+ _walk(new ElementWalker.forParameter(element), () {
normalParameter.accept(this);
});
@@ -202,8 +199,7 @@
if (node.parent is! DefaultFormalParameter) {
ParameterElement element =
_match(node.identifier, _walker.getParameter());
- bool isFunctionTyped = node.parameters != null;
- _walk(new ElementWalker.forParameter(element, isFunctionTyped), () {
+ _walk(new ElementWalker.forParameter(element), () {
super.visitFieldFormalParameter(node);
});
resolveMetadata(node, node.metadata, element);
@@ -264,7 +260,7 @@
if (node.parent is! DefaultFormalParameter) {
ParameterElement element =
_match(node.identifier, _walker.getParameter());
- _walk(new ElementWalker.forParameter(element, true), () {
+ _walk(new ElementWalker.forParameter(element), () {
super.visitFunctionTypedFormalParameter(node);
});
resolveMetadata(node, node.metadata, element);
@@ -405,7 +401,7 @@
_match(node.identifier, _walker.getParameter());
(node as SimpleFormalParameterImpl).declaredElement = element;
_setGenericFunctionType(node.type, element.type);
- _walk(new ElementWalker.forParameter(element, false), () {
+ _walk(new ElementWalker.forParameter(element), () {
super.visitSimpleFormalParameter(node);
});
resolveMetadata(node, node.metadata, element);
@@ -739,7 +735,7 @@
/// corresponding type arguments of the [typeArguments].
static void _applyTypeArgumentsToList(LibraryElement enclosingLibraryElement,
DartType type, List<TypeAnnotation> typeArguments) {
- if (type != null && type.isUndefined) {
+ if (type != null && type.isDynamic) {
for (TypeAnnotation argument in typeArguments) {
applyToTypeAnnotation(enclosingLibraryElement, type, argument);
}
@@ -851,18 +847,10 @@
/// Creates an [ElementWalker] which walks the child elements of a parameter
/// element.
- ElementWalker.forParameter(ParameterElement element, bool functionTyped)
+ ElementWalker.forParameter(ParameterElement element)
: element = element,
_parameters = element.parameters,
- _typeParameters = element.typeParameters {
- // If the parameter node is function typed, extract type parameters and
- // formal parameters from its generic function type element.
- if (functionTyped) {
- GenericFunctionTypeElement typeElement = element.type.element;
- _typeParameters = typeElement.typeParameters;
- _parameters = typeElement.parameters;
- }
- }
+ _typeParameters = element.typeParameters;
/// Creates an [ElementWalker] which walks the child elements of a typedef
/// element.
diff --git a/analyzer/lib/src/generated/element.dart b/analyzer/lib/src/generated/element.dart
index 5518d7c..da03617 100644
--- a/analyzer/lib/src/generated/element.dart
+++ b/analyzer/lib/src/generated/element.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/element_handle.dart b/analyzer/lib/src/generated/element_handle.dart
index 115c44d..4c798bd 100644
--- a/analyzer/lib/src/generated/element_handle.dart
+++ b/analyzer/lib/src/generated/element_handle.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/element_resolver.dart b/analyzer/lib/src/generated/element_resolver.dart
index 9a99f54..27097db 100644
--- a/analyzer/lib/src/generated/element_resolver.dart
+++ b/analyzer/lib/src/generated/element_resolver.dart
@@ -536,6 +536,11 @@
@override
void visitPostfixExpression(PostfixExpression node) {
Expression operand = node.operand;
+ if (node.operator.type == TokenType.BANG) {
+ // Null-assertion operator (`!`). There's nothing to do, since this is a
+ // built-in operation (there's no associated operator declaration).
+ return;
+ }
String methodName = _getPostfixOperator(node);
DartType staticType = _getStaticType(operand);
MethodElement staticMethod = _lookUpMethod(operand, staticType, methodName);
@@ -847,7 +852,7 @@
// in-lining _resolveArgumentsToFunction below).
ClassDeclaration declaration =
node.thisOrAncestorOfType<ClassDeclaration>();
- Identifier superclassName = declaration.extendsClause?.superclass?.name;
+ Identifier superclassName = declaration?.extendsClause?.superclass?.name;
if (superclassName != null &&
_resolver.nameScope.shouldIgnoreUndefined(superclassName)) {
return;
@@ -953,10 +958,16 @@
/**
* Return the name of the method invoked by the given postfix [expression].
*/
- String _getPostfixOperator(PostfixExpression expression) =>
- (expression.operator.type == TokenType.PLUS_PLUS)
- ? TokenType.PLUS.lexeme
- : TokenType.MINUS.lexeme;
+ String _getPostfixOperator(PostfixExpression expression) {
+ if (expression.operator.type == TokenType.PLUS_PLUS) {
+ return TokenType.PLUS.lexeme;
+ } else if (expression.operator.type == TokenType.MINUS_MINUS) {
+ return TokenType.MINUS.lexeme;
+ } else {
+ throw new UnsupportedError(
+ 'Unsupported postfix operator ${expression.operator.lexeme}');
+ }
+ }
/**
* Return the name of the method invoked by the given postfix [expression].
@@ -1877,13 +1888,8 @@
@override
int get offset => targetIdentifier.offset;
- @Deprecated('In the next major release, type will change to `Precedence`. '
- 'Switch to `precedence2` to prepare for this change.')
@override
- int get precedence => SELECTOR_PRECEDENCE;
-
- @override
- Precedence get precedence2 => Precedence.primary;
+ Precedence get precedence => Precedence.primary;
@deprecated
@override
diff --git a/analyzer/lib/src/generated/engine.dart b/analyzer/lib/src/generated/engine.dart
index 55671cc..8f4c1b3 100644
--- a/analyzer/lib/src/generated/engine.dart
+++ b/analyzer/lib/src/generated/engine.dart
@@ -6,6 +6,7 @@
import 'dart:collection';
import 'dart:typed_data';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -28,7 +29,6 @@
import 'package:analyzer/src/plugin/resolver_provider.dart';
import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/summary/api_signature.dart';
-import 'package:analyzer/src/task/api/dart.dart';
import 'package:analyzer/src/task/api/model.dart';
import 'package:analyzer/src/task/manager.dart';
import 'package:front_end/src/fasta/scanner/token.dart';
@@ -39,605 +39,473 @@
export 'package:analyzer/src/generated/timestamped_data.dart'
show TimestampedData;
-/**
- * Used by [AnalysisOptions] to allow function bodies to be analyzed in some
- * sources but not others.
- */
+/// Used by [AnalysisOptions] to allow function bodies to be analyzed in some
+/// sources but not others.
typedef bool AnalyzeFunctionBodiesPredicate(Source source);
-/**
- * A context in which a single analysis can be performed and incrementally
- * maintained. The context includes such information as the version of the SDK
- * being analyzed against as well as the package-root used to resolve 'package:'
- * URI's. (Both of which are known indirectly through the [SourceFactory].)
- *
- * An analysis context also represents the state of the analysis, which includes
- * knowing which sources have been included in the analysis (either directly or
- * indirectly) and the results of the analysis. Sources must be added and
- * removed from the context using the method [applyChanges], which is also used
- * to notify the context when sources have been modified and, consequently,
- * previously known results might have been invalidated.
- *
- * There are two ways to access the results of the analysis. The most common is
- * to use one of the 'get' methods to access the results. The 'get' methods have
- * the advantage that they will always return quickly, but have the disadvantage
- * that if the results are not currently available they will return either
- * nothing or in some cases an incomplete result. The second way to access
- * results is by using one of the 'compute' methods. The 'compute' methods will
- * always attempt to compute the requested results but might block the caller
- * for a significant period of time.
- *
- * When results have been invalidated, have never been computed (as is the case
- * for newly added sources), or have been removed from the cache, they are
- * <b>not</b> automatically recreated. They will only be recreated if one of the
- * 'compute' methods is invoked.
- *
- * However, this is not always acceptable. Some clients need to keep the
- * analysis results up-to-date. For such clients there is a mechanism that
- * allows them to incrementally perform needed analysis and get notified of the
- * consequent changes to the analysis results. This mechanism is realized by the
- * method [performAnalysisTask].
- *
- * Analysis engine allows for having more than one context. This can be used,
- * for example, to perform one analysis based on the state of files on disk and
- * a separate analysis based on the state of those files in open editors. It can
- * also be used to perform an analysis based on a proposed future state, such as
- * the state after a refactoring.
- */
+/// A context in which a single analysis can be performed and incrementally
+/// maintained. The context includes such information as the version of the SDK
+/// being analyzed against as well as the package-root used to resolve 'package:'
+/// URI's. (Both of which are known indirectly through the [SourceFactory].)
+///
+/// An analysis context also represents the state of the analysis, which includes
+/// knowing which sources have been included in the analysis (either directly or
+/// indirectly) and the results of the analysis. Sources must be added and
+/// removed from the context using the method [applyChanges], which is also used
+/// to notify the context when sources have been modified and, consequently,
+/// previously known results might have been invalidated.
+///
+/// There are two ways to access the results of the analysis. The most common is
+/// to use one of the 'get' methods to access the results. The 'get' methods have
+/// the advantage that they will always return quickly, but have the disadvantage
+/// that if the results are not currently available they will return either
+/// nothing or in some cases an incomplete result. The second way to access
+/// results is by using one of the 'compute' methods. The 'compute' methods will
+/// always attempt to compute the requested results but might block the caller
+/// for a significant period of time.
+///
+/// When results have been invalidated, have never been computed (as is the case
+/// for newly added sources), or have been removed from the cache, they are
+/// <b>not</b> automatically recreated. They will only be recreated if one of the
+/// 'compute' methods is invoked.
+///
+/// However, this is not always acceptable. Some clients need to keep the
+/// analysis results up-to-date. For such clients there is a mechanism that
+/// allows them to incrementally perform needed analysis and get notified of the
+/// consequent changes to the analysis results. This mechanism is realized by the
+/// method [performAnalysisTask].
+///
+/// Analysis engine allows for having more than one context. This can be used,
+/// for example, to perform one analysis based on the state of files on disk and
+/// a separate analysis based on the state of those files in open editors. It can
+/// also be used to perform an analysis based on a proposed future state, such as
+/// the state after a refactoring.
abstract class AnalysisContext {
- /**
- * The file resolver provider used to override the way file URI's are
- * resolved in some contexts.
- */
+ /// The file resolver provider used to override the way file URI's are
+ /// resolved in some contexts.
ResolverProvider fileResolverProvider;
- /**
- * Return the set of analysis options controlling the behavior of this
- * context. Clients should not modify the returned set of options.
- */
+ /// Return the set of analysis options controlling the behavior of this
+ /// context. Clients should not modify the returned set of options.
AnalysisOptions get analysisOptions;
- /**
- * Set the set of analysis options controlling the behavior of this context to
- * the given [options]. Clients can safely assume that all necessary analysis
- * results have been invalidated.
- */
+ /// Set the set of analysis options controlling the behavior of this context to
+ /// the given [options]. Clients can safely assume that all necessary analysis
+ /// results have been invalidated.
void set analysisOptions(AnalysisOptions options);
- /**
- * Set the order in which sources will be analyzed by [performAnalysisTask] to
- * match the order of the sources in the given list of [sources]. If a source
- * that needs to be analyzed is not contained in the list, then it will be
- * treated as if it were at the end of the list. If the list is empty (or
- * `null`) then no sources will be given priority over other sources.
- *
- * Changes made to the list after this method returns will <b>not</b> be
- * reflected in the priority order.
- */
+ /// Set the order in which sources will be analyzed by [performAnalysisTask] to
+ /// match the order of the sources in the given list of [sources]. If a source
+ /// that needs to be analyzed is not contained in the list, then it will be
+ /// treated as if it were at the end of the list. If the list is empty (or
+ /// `null`) then no sources will be given priority over other sources.
+ ///
+ /// Changes made to the list after this method returns will <b>not</b> be
+ /// reflected in the priority order.
void set analysisPriorityOrder(List<Source> sources);
- /**
- * Return the set of declared variables used when computing constant values.
- */
+ /// Return the set of declared variables used when computing constant values.
DeclaredVariables get declaredVariables;
- /**
- * Return a list containing all of the sources known to this context that
- * represent HTML files. The contents of the list can be incomplete.
- */
+ /// Return a list containing all of the sources known to this context that
+ /// represent HTML files. The contents of the list can be incomplete.
List<Source> get htmlSources;
- /**
- * The stream that is notified when a source either starts or stops being
- * analyzed implicitly.
- */
+ /// The stream that is notified when a source either starts or stops being
+ /// analyzed implicitly.
Stream<ImplicitAnalysisEvent> get implicitAnalysisEvents;
- /**
- * Returns `true` if this context was disposed using [dispose].
- */
+ /// Returns `true` if this context was disposed using [dispose].
bool get isDisposed;
- /**
- * Return a list containing all of the sources known to this context that
- * represent the defining compilation unit of a library that can be run within
- * a browser. The sources that are returned represent libraries that have a
- * 'main' method and are either referenced by an HTML file or import, directly
- * or indirectly, a client-only library. The contents of the list can be
- * incomplete.
- */
+ /// Return a list containing all of the sources known to this context that
+ /// represent the defining compilation unit of a library that can be run within
+ /// a browser. The sources that are returned represent libraries that have a
+ /// 'main' method and are either referenced by an HTML file or import, directly
+ /// or indirectly, a client-only library. The contents of the list can be
+ /// incomplete.
List<Source> get launchableClientLibrarySources;
- /**
- * Return a list containing all of the sources known to this context that
- * represent the defining compilation unit of a library that can be run
- * outside of a browser. The contents of the list can be incomplete.
- */
+ /// Return a list containing all of the sources known to this context that
+ /// represent the defining compilation unit of a library that can be run
+ /// outside of a browser. The contents of the list can be incomplete.
List<Source> get launchableServerLibrarySources;
- /**
- * Return a list containing all of the sources known to this context that
- * represent the defining compilation unit of a library. The contents of the
- * list can be incomplete.
- */
+ /// Return a list containing all of the sources known to this context that
+ /// represent the defining compilation unit of a library. The contents of the
+ /// list can be incomplete.
List<Source> get librarySources;
- /**
- * Return a client-provided name used to identify this context, or `null` if
- * the client has not provided a name.
- */
+ /// Return a client-provided name used to identify this context, or `null` if
+ /// the client has not provided a name.
String get name;
- /**
- * Set the client-provided name used to identify this context to the given
- * [name].
- */
+ /// Set the client-provided name used to identify this context to the given
+ /// [name].
set name(String name);
- /**
- * The stream that is notified when sources have been added or removed,
- * or the source's content has changed.
- */
+ /// The stream that is notified when sources have been added or removed,
+ /// or the source's content has changed.
Stream<SourcesChangedEvent> get onSourcesChanged;
- /**
- * Return the source factory used to create the sources that can be analyzed
- * in this context.
- */
+ /// Return the source factory used to create the sources that can be analyzed
+ /// in this context.
SourceFactory get sourceFactory;
- /**
- * Set the source factory used to create the sources that can be analyzed in
- * this context to the given source [factory]. Clients can safely assume that
- * all analysis results have been invalidated.
- */
+ /// Set the source factory used to create the sources that can be analyzed in
+ /// this context to the given source [factory]. Clients can safely assume that
+ /// all analysis results have been invalidated.
void set sourceFactory(SourceFactory factory);
- /**
- * Return a list containing all of the sources known to this context.
- */
+ /// Return a list containing all of the sources known to this context.
List<Source> get sources;
- /**
- * Return a type provider for this context or throw [AnalysisException] if
- * either `dart:core` or `dart:async` cannot be resolved.
- */
+ /// Return a type provider for this context or throw [AnalysisException] if
+ /// either `dart:core` or `dart:async` cannot be resolved.
TypeProvider get typeProvider;
- /**
- * Return a type system for this context.
- */
+ /// Return a type system for this context.
TypeSystem get typeSystem;
- /**
- * Add the given [listener] to the list of objects that are to be notified
- * when various analysis results are produced in this context.
- */
+ /// Add the given [listener] to the list of objects that are to be notified
+ /// when various analysis results are produced in this context.
void addListener(AnalysisListener listener);
- /**
- * Apply the given [delta] to change the level of analysis that will be
- * performed for the sources known to this context.
- */
+ /// Apply the given [delta] to change the level of analysis that will be
+ /// performed for the sources known to this context.
void applyAnalysisDelta(AnalysisDelta delta);
- /**
- * Apply the changes specified by the given [changeSet] to this context. Any
- * analysis results that have been invalidated by these changes will be
- * removed.
- */
+ /// Apply the changes specified by the given [changeSet] to this context. Any
+ /// analysis results that have been invalidated by these changes will be
+ /// removed.
void applyChanges(ChangeSet changeSet);
- /**
- * Return the documentation comment for the given [element] as it appears in
- * the original source (complete with the beginning and ending delimiters) for
- * block documentation comments, or lines starting with `"///"` and separated
- * with `"\n"` characters for end-of-line documentation comments, or `null` if
- * the element does not have a documentation comment associated with it. This
- * can be a long-running operation if the information needed to access the
- * comment is not cached.
- *
- * Throws an [AnalysisException] if the documentation comment could not be
- * determined because the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- */
+ /// Return the documentation comment for the given [element] as it appears in
+ /// the original source (complete with the beginning and ending delimiters) for
+ /// block documentation comments, or lines starting with `"///"` and separated
+ /// with `"\n"` characters for end-of-line documentation comments, or `null` if
+ /// the element does not have a documentation comment associated with it. This
+ /// can be a long-running operation if the information needed to access the
+ /// comment is not cached.
+ ///
+ /// Throws an [AnalysisException] if the documentation comment could not be
+ /// determined because the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
String computeDocumentationComment(Element element);
- /**
- * Return a list containing all of the errors associated with the given
- * [source]. If the errors are not already known then the source will be
- * analyzed in order to determine the errors associated with it.
- *
- * Throws an [AnalysisException] if the errors could not be determined because
- * the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getErrors].
- */
+ /// Return a list containing all of the errors associated with the given
+ /// [source]. If the errors are not already known then the source will be
+ /// analyzed in order to determine the errors associated with it.
+ ///
+ /// Throws an [AnalysisException] if the errors could not be determined because
+ /// the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getErrors].
List<AnalysisError> computeErrors(Source source);
- /**
- * Return the kind of the given [source], computing it's kind if it is not
- * already known. Return [SourceKind.UNKNOWN] if the source is not contained
- * in this context.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getKindOf].
- */
+ /// Return the kind of the given [source], computing it's kind if it is not
+ /// already known. Return [SourceKind.UNKNOWN] if the source is not contained
+ /// in this context.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getKindOf].
SourceKind computeKindOf(Source source);
- /**
- * Return the element model corresponding to the library defined by the given
- * [source]. If the element model does not yet exist it will be created. The
- * process of creating an element model for a library can long-running,
- * depending on the size of the library and the number of libraries that are
- * imported into it that also need to have a model built for them.
- *
- * Throws an [AnalysisException] if the element model could not be determined
- * because the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getLibraryElement].
- */
+ /// Return the element model corresponding to the library defined by the given
+ /// [source]. If the element model does not yet exist it will be created. The
+ /// process of creating an element model for a library can long-running,
+ /// depending on the size of the library and the number of libraries that are
+ /// imported into it that also need to have a model built for them.
+ ///
+ /// Throws an [AnalysisException] if the element model could not be determined
+ /// because the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getLibraryElement].
LibraryElement computeLibraryElement(Source source);
- /**
- * Return the line information for the given [source], or `null` if the source
- * is not of a recognized kind (neither a Dart nor HTML file). If the line
- * information was not previously known it will be created. The line
- * information is used to map offsets from the beginning of the source to line
- * and column pairs.
- *
- * Throws an [AnalysisException] if the line information could not be
- * determined because the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getLineInfo].
- */
+ /// Return the line information for the given [source], or `null` if the source
+ /// is not of a recognized kind (neither a Dart nor HTML file). If the line
+ /// information was not previously known it will be created. The line
+ /// information is used to map offsets from the beginning of the source to line
+ /// and column pairs.
+ ///
+ /// Throws an [AnalysisException] if the line information could not be
+ /// determined because the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getLineInfo].
LineInfo computeLineInfo(Source source);
- /**
- * Return a future which will be completed with the fully resolved AST for a
- * single compilation unit within the given library, once that AST is up to
- * date.
- *
- * If the resolved AST can't be computed for some reason, the future will be
- * completed with an error. One possible error is AnalysisNotScheduledError,
- * which means that the resolved AST can't be computed because the given
- * source file is not scheduled to be analyzed within the context of the
- * given library.
- */
+ /// Return a future which will be completed with the fully resolved AST for a
+ /// single compilation unit within the given library, once that AST is up to
+ /// date.
+ ///
+ /// If the resolved AST can't be computed for some reason, the future will be
+ /// completed with an error. One possible error is AnalysisNotScheduledError,
+ /// which means that the resolved AST can't be computed because the given
+ /// source file is not scheduled to be analyzed within the context of the
+ /// given library.
CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync(
Source source, Source librarySource);
- /**
- * Perform work until the given [result] has been computed for the given
- * [target]. Return the computed value.
- */
+ /// Perform work until the given [result] has been computed for the given
+ /// [target]. Return the computed value.
V computeResult<V>(AnalysisTarget target, ResultDescriptor<V> result);
- /**
- * Notifies the context that the client is going to stop using this context.
- */
+ /// Notifies the context that the client is going to stop using this context.
void dispose();
- /**
- * Return `true` if the given [source] exists.
- *
- * This method should be used rather than the method [Source.exists] because
- * contexts can have local overrides of the content of a source that the
- * source is not aware of and a source with local content is considered to
- * exist even if there is no file on disk.
- */
+ /// Return `true` if the given [source] exists.
+ ///
+ /// This method should be used rather than the method [Source.exists] because
+ /// contexts can have local overrides of the content of a source that the
+ /// source is not aware of and a source with local content is considered to
+ /// exist even if there is no file on disk.
bool exists(Source source);
- /**
- * Return the element model corresponding to the compilation unit defined by
- * the given [unitSource] in the library defined by the given [librarySource],
- * or `null` if the element model does not currently exist or if the library
- * cannot be analyzed for some reason.
- */
+ /// Return the element model corresponding to the compilation unit defined by
+ /// the given [unitSource] in the library defined by the given [librarySource],
+ /// or `null` if the element model does not currently exist or if the library
+ /// cannot be analyzed for some reason.
CompilationUnitElement getCompilationUnitElement(
Source unitSource, Source librarySource);
- /**
- * Return configuration data associated with the given key or the [key]'s
- * default value if no state has been associated.
- *
- * See [setConfigurationData].
- */
+ /// Return configuration data associated with the given key or the [key]'s
+ /// default value if no state has been associated.
+ ///
+ /// See [setConfigurationData].
@deprecated
V getConfigurationData<V>(ResultDescriptor<V> key);
- /**
- * Return the contents and timestamp of the given [source].
- *
- * This method should be used rather than the method [Source.getContents]
- * because contexts can have local overrides of the content of a source that
- * the source is not aware of.
- */
+ /// Return the contents and timestamp of the given [source].
+ ///
+ /// This method should be used rather than the method [Source.getContents]
+ /// because contexts can have local overrides of the content of a source that
+ /// the source is not aware of.
TimestampedData<String> getContents(Source source);
- /**
- * Return the element referenced by the given [location], or `null` if the
- * element is not immediately available or if there is no element with the
- * given location. The latter condition can occur, for example, if the
- * location describes an element from a different context or if the element
- * has been removed from this context as a result of some change since it was
- * originally obtained.
- */
+ /// Return the element referenced by the given [location], or `null` if the
+ /// element is not immediately available or if there is no element with the
+ /// given location. The latter condition can occur, for example, if the
+ /// location describes an element from a different context or if the element
+ /// has been removed from this context as a result of some change since it was
+ /// originally obtained.
Element getElement(ElementLocation location);
- /**
- * Return an analysis error info containing the list of all of the errors and
- * the line info associated with the given [source]. The list of errors will
- * be empty if the source is not known to this context or if there are no
- * errors in the source. The errors contained in the list can be incomplete.
- *
- * See [computeErrors].
- */
+ /// Return an analysis error info containing the list of all of the errors and
+ /// the line info associated with the given [source]. The list of errors will
+ /// be empty if the source is not known to this context or if there are no
+ /// errors in the source. The errors contained in the list can be incomplete.
+ ///
+ /// See [computeErrors].
AnalysisErrorInfo getErrors(Source source);
- /**
- * Return the sources for the HTML files that reference the compilation unit
- * with the given [source]. If the source does not represent a Dart source or
- * is not known to this context, the returned list will be empty. The contents
- * of the list can be incomplete.
- */
+ /// Return the sources for the HTML files that reference the compilation unit
+ /// with the given [source]. If the source does not represent a Dart source or
+ /// is not known to this context, the returned list will be empty. The contents
+ /// of the list can be incomplete.
List<Source> getHtmlFilesReferencing(Source source);
- /**
- * Return the kind of the given [source], or `null` if the kind is not known
- * to this context.
- *
- * See [computeKindOf].
- */
+ /// Return the kind of the given [source], or `null` if the kind is not known
+ /// to this context.
+ ///
+ /// See [computeKindOf].
SourceKind getKindOf(Source source);
- /**
- * Return the sources for the defining compilation units of any libraries of
- * which the given [source] is a part. The list will normally contain a single
- * library because most Dart sources are only included in a single library,
- * but it is possible to have a part that is contained in multiple identically
- * named libraries. If the source represents the defining compilation unit of
- * a library, then the returned list will contain the given source as its only
- * element. If the source does not represent a Dart source or is not known to
- * this context, the returned list will be empty. The contents of the list can
- * be incomplete.
- */
+ /// Return the sources for the defining compilation units of any libraries of
+ /// which the given [source] is a part. The list will normally contain a single
+ /// library because most Dart sources are only included in a single library,
+ /// but it is possible to have a part that is contained in multiple identically
+ /// named libraries. If the source represents the defining compilation unit of
+ /// a library, then the returned list will contain the given source as its only
+ /// element. If the source does not represent a Dart source or is not known to
+ /// this context, the returned list will be empty. The contents of the list can
+ /// be incomplete.
List<Source> getLibrariesContaining(Source source);
- /**
- * Return the sources for the defining compilation units of any libraries that
- * depend on the library defined by the given [librarySource]. One library
- * depends on another if it either imports or exports that library.
- */
+ /// Return the sources for the defining compilation units of any libraries that
+ /// depend on the library defined by the given [librarySource]. One library
+ /// depends on another if it either imports or exports that library.
List<Source> getLibrariesDependingOn(Source librarySource);
- /**
- * Return the sources for the defining compilation units of any libraries that
- * are referenced from the HTML file defined by the given [htmlSource].
- */
+ /// Return the sources for the defining compilation units of any libraries that
+ /// are referenced from the HTML file defined by the given [htmlSource].
List<Source> getLibrariesReferencedFromHtml(Source htmlSource);
- /**
- * Return the element model corresponding to the library defined by the given
- * [source], or `null` if the element model does not currently exist or if the
- * library cannot be analyzed for some reason.
- */
+ /// Return the element model corresponding to the library defined by the given
+ /// [source], or `null` if the element model does not currently exist or if the
+ /// library cannot be analyzed for some reason.
LibraryElement getLibraryElement(Source source);
- /**
- * Return the line information for the given [source], or `null` if the line
- * information is not known. The line information is used to map offsets from
- * the beginning of the source to line and column pairs.
- *
- * See [computeLineInfo].
- */
+ /// Return the line information for the given [source], or `null` if the line
+ /// information is not known. The line information is used to map offsets from
+ /// the beginning of the source to line and column pairs.
+ ///
+ /// See [computeLineInfo].
LineInfo getLineInfo(Source source);
- /**
- * Return the modification stamp for the [source], or a negative value if the
- * source does not exist. A modification stamp is a non-negative integer with
- * the property that if the contents of the source have not been modified
- * since the last time the modification stamp was accessed then the same value
- * will be returned, but if the contents of the source have been modified one
- * or more times (even if the net change is zero) the stamps will be different.
- *
- * This method should be used rather than the method
- * [Source.getModificationStamp] because contexts can have local overrides of
- * the content of a source that the source is not aware of.
- */
+ /// Return the modification stamp for the [source], or a negative value if the
+ /// source does not exist. A modification stamp is a non-negative integer with
+ /// the property that if the contents of the source have not been modified
+ /// since the last time the modification stamp was accessed then the same value
+ /// will be returned, but if the contents of the source have been modified one
+ /// or more times (even if the net change is zero) the stamps will be different.
+ ///
+ /// This method should be used rather than the method
+ /// [Source.getModificationStamp] because contexts can have local overrides of
+ /// the content of a source that the source is not aware of.
int getModificationStamp(Source source);
- /**
- * Return a fully resolved AST for the compilation unit defined by the given
- * [unitSource] within the given [library], or `null` if the resolved AST is
- * not already computed.
- *
- * See [resolveCompilationUnit].
- */
+ /// Return a fully resolved AST for the compilation unit defined by the given
+ /// [unitSource] within the given [library], or `null` if the resolved AST is
+ /// not already computed.
+ ///
+ /// See [resolveCompilationUnit].
CompilationUnit getResolvedCompilationUnit(
Source unitSource, LibraryElement library);
- /**
- * Return a fully resolved AST for the compilation unit defined by the given
- * [unitSource] within the library defined by the given [librarySource], or
- * `null` if the resolved AST is not already computed.
- *
- * See [resolveCompilationUnit2].
- */
+ /// Return a fully resolved AST for the compilation unit defined by the given
+ /// [unitSource] within the library defined by the given [librarySource], or
+ /// `null` if the resolved AST is not already computed.
+ ///
+ /// See [resolveCompilationUnit2].
CompilationUnit getResolvedCompilationUnit2(
Source unitSource, Source librarySource);
- /**
- * Return the value of the given [result] for the given [target].
- *
- * If the corresponding [target] does not exist, or the [result] is not
- * computed yet, then the default value is returned.
- */
+ /// Return the value of the given [result] for the given [target].
+ ///
+ /// If the corresponding [target] does not exist, or the [result] is not
+ /// computed yet, then the default value is returned.
V getResult<V>(AnalysisTarget target, ResultDescriptor<V> result);
- /**
- * Return a list of the sources being analyzed in this context whose full path
- * is equal to the given [path].
- */
+ /// Return a list of the sources being analyzed in this context whose full path
+ /// is equal to the given [path].
List<Source> getSourcesWithFullName(String path);
- /**
- * Invalidates hints in the given [librarySource] and included parts.
- */
+ /// Invalidates hints in the given [librarySource] and included parts.
void invalidateLibraryHints(Source librarySource);
- /**
- * Return `true` if the given [librarySource] is known to be the defining
- * compilation unit of a library that can be run on a client (references
- * 'dart:html', either directly or indirectly).
- *
- * <b>Note:</b> In addition to the expected case of returning `false` if the
- * source is known to be a library that cannot be run on a client, this method
- * will also return `false` if the source is not known to be a library or if
- * we do not know whether it can be run on a client.
- */
+ /// Return `true` if the given [librarySource] is known to be the defining
+ /// compilation unit of a library that can be run on a client (references
+ /// 'dart:html', either directly or indirectly).
+ ///
+ /// <b>Note:</b> In addition to the expected case of returning `false` if the
+ /// source is known to be a library that cannot be run on a client, this method
+ /// will also return `false` if the source is not known to be a library or if
+ /// we do not know whether it can be run on a client.
bool isClientLibrary(Source librarySource);
- /**
- * Return `true` if the given [librarySource] is known to be the defining
- * compilation unit of a library that can be run on the server (does not
- * reference 'dart:html', either directly or indirectly).
- *
- * <b>Note:</b> In addition to the expected case of returning `false` if the
- * source is known to be a library that cannot be run on the server, this
- * method will also return `false` if the source is not known to be a library
- * or if we do not know whether it can be run on the server.
- */
+ /// Return `true` if the given [librarySource] is known to be the defining
+ /// compilation unit of a library that can be run on the server (does not
+ /// reference 'dart:html', either directly or indirectly).
+ ///
+ /// <b>Note:</b> In addition to the expected case of returning `false` if the
+ /// source is known to be a library that cannot be run on the server, this
+ /// method will also return `false` if the source is not known to be a library
+ /// or if we do not know whether it can be run on the server.
bool isServerLibrary(Source librarySource);
- /**
- * Return the stream that is notified when a result with the given
- * [descriptor] is changed, e.g. computed or invalidated.
- */
+ /// Return the stream that is notified when a result with the given
+ /// [descriptor] is changed, e.g. computed or invalidated.
Stream<ResultChangedEvent> onResultChanged(ResultDescriptor descriptor);
- /**
- * Return the stream that is notified when a new value for the given
- * [descriptor] is computed.
- */
+ /// Return the stream that is notified when a new value for the given
+ /// [descriptor] is computed.
@deprecated
Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor);
- /**
- * Parse the content of the given [source] to produce an AST structure. The
- * resulting AST structure may or may not be resolved, and may have a slightly
- * different structure depending upon whether it is resolved.
- *
- * Throws an [AnalysisException] if the analysis could not be performed
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- */
+ /// Parse the content of the given [source] to produce an AST structure. The
+ /// resulting AST structure may or may not be resolved, and may have a slightly
+ /// different structure depending upon whether it is resolved.
+ ///
+ /// Throws an [AnalysisException] if the analysis could not be performed
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
CompilationUnit parseCompilationUnit(Source source);
- /**
- * Perform the next unit of work required to keep the analysis results
- * up-to-date and return information about the consequent changes to the
- * analysis results. This method can be long running.
- *
- * The implementation that uses the task model notifies subscribers of
- * [onResultChanged] about computed results.
- *
- * The following results are computed for Dart sources.
- *
- * 1. For explicit and implicit sources:
- * [PARSED_UNIT]
- * [RESOLVED_UNIT]
- *
- * 2. For explicit sources:
- * [DART_ERRORS].
- *
- * 3. For explicit and implicit library sources:
- * [LIBRARY_ELEMENT].
- */
+ /// Perform the next unit of work required to keep the analysis results
+ /// up-to-date and return information about the consequent changes to the
+ /// analysis results. This method can be long running.
+ ///
+ /// The implementation that uses the task model notifies subscribers of
+ /// [onResultChanged] about computed results.
+ ///
+ /// The following results are computed for Dart sources.
+ ///
+ /// 1. For explicit and implicit sources:
+ /// [PARSED_UNIT]
+ /// [RESOLVED_UNIT]
+ ///
+ /// 2. For explicit sources:
+ /// [DART_ERRORS].
+ ///
+ /// 3. For explicit and implicit library sources:
+ /// [LIBRARY_ELEMENT].
AnalysisResult performAnalysisTask();
- /**
- * Remove the given [listener] from the list of objects that are to be
- * notified when various analysis results are produced in this context.
- */
+ /// Remove the given [listener] from the list of objects that are to be
+ /// notified when various analysis results are produced in this context.
void removeListener(AnalysisListener listener);
- /**
- * Return a fully resolved AST for the compilation unit defined by the given
- * [unitSource] within the given [library].
- *
- * Throws an [AnalysisException] if the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getResolvedCompilationUnit].
- */
+ /// Return a fully resolved AST for the compilation unit defined by the given
+ /// [unitSource] within the given [library].
+ ///
+ /// Throws an [AnalysisException] if the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getResolvedCompilationUnit].
CompilationUnit resolveCompilationUnit(
Source unitSource, LibraryElement library);
- /**
- * Return a fully resolved AST for the compilation unit defined by the given
- * [unitSource] within the library defined by the given [librarySource].
- *
- * Throws an [AnalysisException] if the analysis could not be performed.
- *
- * <b>Note:</b> This method cannot be used in an async environment.
- *
- * See [getResolvedCompilationUnit2].
- */
+ /// Return a fully resolved AST for the compilation unit defined by the given
+ /// [unitSource] within the library defined by the given [librarySource].
+ ///
+ /// Throws an [AnalysisException] if the analysis could not be performed.
+ ///
+ /// <b>Note:</b> This method cannot be used in an async environment.
+ ///
+ /// See [getResolvedCompilationUnit2].
CompilationUnit resolveCompilationUnit2(
Source unitSource, Source librarySource);
- /**
- * Set the contents of the given [source] to the given [contents] and mark the
- * source as having changed. The additional [offset] and [length] information
- * is used by the context to determine what reanalysis is necessary.
- */
+ /// Set the contents of the given [source] to the given [contents] and mark the
+ /// source as having changed. The additional [offset] and [length] information
+ /// is used by the context to determine what reanalysis is necessary.
void setChangedContents(
Source source, String contents, int offset, int oldLength, int newLength);
- /**
- * Associate this configuration [data] object with the given descriptor [key].
- *
- * See [getConfigurationData].
- */
+ /// Associate this configuration [data] object with the given descriptor [key].
+ ///
+ /// See [getConfigurationData].
@deprecated
void setConfigurationData(ResultDescriptor key, Object data);
- /**
- * Set the contents of the given [source] to the given [contents] and mark the
- * source as having changed. This has the effect of overriding the default
- * contents of the source. If the contents are `null` the override is removed
- * so that the default contents will be returned.
- */
+ /// Set the contents of the given [source] to the given [contents] and mark the
+ /// source as having changed. This has the effect of overriding the default
+ /// contents of the source. If the contents are `null` the override is removed
+ /// so that the default contents will be returned.
void setContents(Source source, String contents);
}
-/**
- * A representation of changes to the types of analysis that should be
- * performed.
- */
+/// A representation of changes to the types of analysis that should be
+/// performed.
class AnalysisDelta {
- /**
- * A mapping from source to what type of analysis should be performed on that
- * source.
- */
+ /// A mapping from source to what type of analysis should be performed on that
+ /// source.
Map<Source, AnalysisLevel> _analysisMap =
new HashMap<Source, AnalysisLevel>();
- /**
- * Return a collection of the sources that have been added. This is equivalent
- * to calling [getAnalysisLevels] and collecting all sources that do not have
- * an analysis level of [AnalysisLevel.NONE].
- */
+ /// Return a collection of the sources that have been added. This is equivalent
+ /// to calling [getAnalysisLevels] and collecting all sources that do not have
+ /// an analysis level of [AnalysisLevel.NONE].
List<Source> get addedSources {
List<Source> result = new List<Source>();
_analysisMap.forEach((Source source, AnalysisLevel level) {
@@ -648,15 +516,11 @@
return result;
}
- /**
- * Return a mapping of sources to the level of analysis that should be
- * performed.
- */
+ /// Return a mapping of sources to the level of analysis that should be
+ /// performed.
Map<Source, AnalysisLevel> get analysisLevels => _analysisMap;
- /**
- * Record that the given [source] should be analyzed at the given [level].
- */
+ /// Record that the given [source] should be analyzed at the given [level].
void setAnalysisLevel(Source source, AnalysisLevel level) {
_analysisMap[source] = level;
}
@@ -671,10 +535,8 @@
return buffer.toString();
}
- /**
- * Append to the given [buffer] all sources with the given analysis [level],
- * prefixed with a label and a separator if [needsSeparator] is `true`.
- */
+ /// Append to the given [buffer] all sources with the given analysis [level],
+ /// prefixed with a label and a separator if [needsSeparator] is `true`.
bool _appendSources(
StringBuffer buffer, bool needsSeparator, AnalysisLevel level) {
bool first = true;
@@ -697,80 +559,55 @@
}
}
-/**
- * The entry point for the functionality provided by the analysis engine. There
- * is a single instance of this class.
- */
+/// The entry point for the functionality provided by the analysis engine. There
+/// is a single instance of this class.
class AnalysisEngine {
- /**
- * The suffix used for Dart source files.
- */
+ /// The suffix used for Dart source files.
static const String SUFFIX_DART = "dart";
- /**
- * The short suffix used for HTML files.
- */
+ /// The short suffix used for HTML files.
static const String SUFFIX_HTM = "htm";
- /**
- * The long suffix used for HTML files.
- */
+ /// The long suffix used for HTML files.
static const String SUFFIX_HTML = "html";
- /**
- * The deprecated file name used for analysis options files.
- */
+ /// The deprecated file name used for analysis options files.
static const String ANALYSIS_OPTIONS_FILE = '.analysis_options';
- /**
- * The file name used for analysis options files.
- */
+ /// The file name used for analysis options files.
static const String ANALYSIS_OPTIONS_YAML_FILE = 'analysis_options.yaml';
- /**
- * The file name used for pubspec files.
- */
+ /// The file name used for pubspec files.
static const String PUBSPEC_YAML_FILE = 'pubspec.yaml';
- /**
- * The unique instance of this class.
- */
+ /// The file name used for Android manifest files.
+ static const String ANDROID_MANIFEST_FILE = 'AndroidManifest.xml';
+
+ /// The unique instance of this class.
static final AnalysisEngine instance = new AnalysisEngine._();
- /**
- * The logger that should receive information about errors within the analysis
- * engine.
- */
+ /// The logger that should receive information about errors within the analysis
+ /// engine.
Logger _logger = Logger.NULL;
- /**
- * The instrumentation service that is to be used by this analysis engine.
- */
+ /// The instrumentation service that is to be used by this analysis engine.
InstrumentationService _instrumentationService =
InstrumentationService.NULL_SERVICE;
- /**
- * The partition manager being used to manage the shared partitions.
- */
+ /// The partition manager being used to manage the shared partitions.
final PartitionManager partitionManager = new PartitionManager();
- /**
- * The task manager used to manage the tasks used to analyze code.
- */
+ /// The task manager used to manage the tasks used to analyze code.
TaskManager _taskManager;
AnalysisEngine._();
- /**
- * Return the instrumentation service that is to be used by this analysis
- * engine.
- */
+ /// Return the instrumentation service that is to be used by this analysis
+ /// engine.
InstrumentationService get instrumentationService => _instrumentationService;
- /**
- * Set the instrumentation service that is to be used by this analysis engine
- * to the given [service].
- */
+ /// Set the instrumentation service that is to be used by this analysis engine
+ /// to the given [service].
void set instrumentationService(InstrumentationService service) {
if (service == null) {
_instrumentationService = InstrumentationService.NULL_SERVICE;
@@ -779,23 +616,17 @@
}
}
- /**
- * Return the logger that should receive information about errors within the
- * analysis engine.
- */
+ /// Return the logger that should receive information about errors within the
+ /// analysis engine.
Logger get logger => _logger;
- /**
- * Set the logger that should receive information about errors within the
- * analysis engine to the given [logger].
- */
+ /// Set the logger that should receive information about errors within the
+ /// analysis engine to the given [logger].
void set logger(Logger logger) {
this._logger = logger ?? Logger.NULL;
}
- /**
- * Return the task manager used to manage the tasks used to analyze code.
- */
+ /// Return the task manager used to manage the tasks used to analyze code.
TaskManager get taskManager {
if (_taskManager == null) {
_taskManager = new TaskManager();
@@ -803,34 +634,26 @@
return _taskManager;
}
- /**
- * Clear any caches holding on to analysis results so that a full re-analysis
- * will be performed the next time an analysis context is created.
- */
+ /// Clear any caches holding on to analysis results so that a full re-analysis
+ /// will be performed the next time an analysis context is created.
void clearCaches() {
partitionManager.clearCache();
// See https://github.com/dart-lang/sdk/issues/30314.
StringToken.canonicalizer.clear();
}
- /**
- * Create and return a new context in which analysis can be performed.
- */
+ /// Create and return a new context in which analysis can be performed.
AnalysisContext createAnalysisContext() {
return new AnalysisContextImpl();
}
- /**
- * A utility method that clients can use to process all of the required
- * plugins. This method can only be used by clients that do not need to
- * process any other plugins.
- */
+ /// A utility method that clients can use to process all of the required
+ /// plugins. This method can only be used by clients that do not need to
+ /// process any other plugins.
@deprecated
void processRequiredPlugins() {}
- /**
- * Return `true` if the given [fileName] is an analysis options file.
- */
+ /// Return `true` if the given [fileName] is an analysis options file.
static bool isAnalysisOptionsFileName(String fileName,
[pathos.Context context]) {
if (fileName == null) {
@@ -841,10 +664,8 @@
basename == ANALYSIS_OPTIONS_YAML_FILE;
}
- /**
- * Return `true` if the given [fileName] is assumed to contain Dart source
- * code.
- */
+ /// Return `true` if the given [fileName] is assumed to contain Dart source
+ /// code.
static bool isDartFileName(String fileName) {
if (fileName == null) {
return false;
@@ -852,85 +673,65 @@
String extension = FileNameUtilities.getExtension(fileName).toLowerCase();
return extension == SUFFIX_DART;
}
+
+ /// Return `true` if the given [fileName] is AndroidManifest.xml
+ static bool isManifestFileName(String fileName) {
+ if (fileName == null) {
+ return false;
+ }
+ return fileName.endsWith(AnalysisEngine.ANDROID_MANIFEST_FILE);
+ }
}
-/**
- * The analysis errors and line information for the errors.
- */
+/// The analysis errors and line information for the errors.
abstract class AnalysisErrorInfo {
- /**
- * Return the errors that as a result of the analysis, or `null` if there were
- * no errors.
- */
+ /// Return the errors that as a result of the analysis, or `null` if there were
+ /// no errors.
List<AnalysisError> get errors;
- /**
- * Return the line information associated with the errors, or `null` if there
- * were no errors.
- */
+ /// Return the line information associated with the errors, or `null` if there
+ /// were no errors.
LineInfo get lineInfo;
}
-/**
- * The analysis errors and line info associated with a source.
- */
+/// The analysis errors and line info associated with a source.
class AnalysisErrorInfoImpl implements AnalysisErrorInfo {
- /**
- * The analysis errors associated with a source, or `null` if there are no
- * errors.
- */
+ /// The analysis errors associated with a source, or `null` if there are no
+ /// errors.
@override
final List<AnalysisError> errors;
- /**
- * The line information associated with the errors, or `null` if there are no
- * errors.
- */
+ /// The line information associated with the errors, or `null` if there are no
+ /// errors.
final LineInfo lineInfo;
- /**
- * Initialize an newly created error info with the given [errors] and
- * [lineInfo].
- */
+ /// Initialize an newly created error info with the given [errors] and
+ /// [lineInfo].
AnalysisErrorInfoImpl(this.errors, this.lineInfo);
}
-/**
- * The levels at which a source can be analyzed.
- */
+/// The levels at which a source can be analyzed.
class AnalysisLevel implements Comparable<AnalysisLevel> {
- /**
- * Indicates a source should be fully analyzed.
- */
+ /// Indicates a source should be fully analyzed.
static const AnalysisLevel ALL = const AnalysisLevel('ALL', 0);
- /**
- * Indicates a source should be resolved and that errors, warnings and hints
- * are needed.
- */
+ /// Indicates a source should be resolved and that errors, warnings and hints
+ /// are needed.
static const AnalysisLevel ERRORS = const AnalysisLevel('ERRORS', 1);
- /**
- * Indicates a source should be resolved, but that errors, warnings and hints
- * are not needed.
- */
+ /// Indicates a source should be resolved, but that errors, warnings and hints
+ /// are not needed.
static const AnalysisLevel RESOLVED = const AnalysisLevel('RESOLVED', 2);
- /**
- * Indicates a source is not of interest to the client.
- */
+ /// Indicates a source is not of interest to the client.
static const AnalysisLevel NONE = const AnalysisLevel('NONE', 3);
static const List<AnalysisLevel> values = const [ALL, ERRORS, RESOLVED, NONE];
- /**
- * The name of this analysis level.
- */
+ /// The name of this analysis level.
final String name;
- /**
- * The ordinal value of the analysis level.
- */
+ /// The ordinal value of the analysis level.
final int ordinal;
const AnalysisLevel(this.name, this.ordinal);
@@ -945,288 +746,207 @@
String toString() => name;
}
-/**
- * An object that is listening for results being produced by an analysis
- * context.
- */
+/// An object that is listening for results being produced by an analysis
+/// context.
abstract class AnalysisListener {
- /**
- * Reports that a task, described by the given [taskDescription] is about to
- * be performed by the given [context].
- */
+ /// Reports that a task, described by the given [taskDescription] is about to
+ /// be performed by the given [context].
void aboutToPerformTask(AnalysisContext context, String taskDescription);
- /**
- * Reports that the [errors] associated with the given [source] in the given
- * [context] has been updated to the given errors. The [lineInfo] is the line
- * information associated with the source.
- */
+ /// Reports that the [errors] associated with the given [source] in the given
+ /// [context] has been updated to the given errors. The [lineInfo] is the line
+ /// information associated with the source.
void computedErrors(AnalysisContext context, Source source,
List<AnalysisError> errors, LineInfo lineInfo);
- /**
- * Reports that the given [source] is no longer included in the set of sources
- * that are being analyzed by the given analysis [context].
- */
+ /// Reports that the given [source] is no longer included in the set of sources
+ /// that are being analyzed by the given analysis [context].
void excludedSource(AnalysisContext context, Source source);
- /**
- * Reports that the given [source] is now included in the set of sources that
- * are being analyzed by the given analysis [context].
- */
+ /// Reports that the given [source] is now included in the set of sources that
+ /// are being analyzed by the given analysis [context].
void includedSource(AnalysisContext context, Source source);
- /**
- * Reports that the given Dart [source] was parsed in the given [context],
- * producing the given [unit].
- */
+ /// Reports that the given Dart [source] was parsed in the given [context],
+ /// producing the given [unit].
void parsedDart(AnalysisContext context, Source source, CompilationUnit unit);
- /**
- * Reports that the given Dart [source] was resolved in the given [context].
- */
+ /// Reports that the given Dart [source] was resolved in the given [context].
void resolvedDart(
AnalysisContext context, Source source, CompilationUnit unit);
}
-/**
- * Futures returned by [AnalysisContext] for pending analysis results will
- * complete with this error if it is determined that analysis results will
- * never become available (e.g. because the requested source is not subject to
- * analysis, or because the requested source is a part file which is not a part
- * of any known library).
- */
+/// Futures returned by [AnalysisContext] for pending analysis results will
+/// complete with this error if it is determined that analysis results will
+/// never become available (e.g. because the requested source is not subject to
+/// analysis, or because the requested source is a part file which is not a part
+/// of any known library).
class AnalysisNotScheduledError implements Exception {}
-/**
- * A set of analysis options used to control the behavior of an analysis
- * context.
- */
+/// A set of analysis options used to control the behavior of an analysis
+/// context.
abstract class AnalysisOptions {
- /**
- * The length of the list returned by [signature].
- */
+ /// The length of the list returned by [signature].
static const int signatureLength = 4;
- /**
- * Function that returns `true` if analysis is to parse and analyze function
- * bodies for a given source.
- */
+ /// Function that returns `true` if analysis is to parse and analyze function
+ /// bodies for a given source.
AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate;
- /**
- * Return the maximum number of sources for which AST structures should be
- * kept in the cache.
- *
- * DEPRECATED: This setting no longer has any effect.
- */
+ /// Return the maximum number of sources for which AST structures should be
+ /// kept in the cache.
+ ///
+ /// DEPRECATED: This setting no longer has any effect.
@deprecated
int get cacheSize;
- /**
- * Return `true` if analysis is to generate dart2js related hint results.
- */
+ /// A flag indicating whether to run checks on AndroidManifest.xml file to
+ /// see if it is complaint with Chrome OS.
+ bool get chromeOsManifestChecks;
+
+ /// The set of features that are globally enabled for this context.
+ FeatureSet get contextFeatures;
+
+ /// Return `true` if analysis is to generate dart2js related hint results.
bool get dart2jsHint;
- /**
- * Return `true` if cache flushing should be disabled. Setting this option to
- * `true` can improve analysis speed at the expense of memory usage. It may
- * also be useful for working around bugs.
- *
- * This option should not be used when the analyzer is part of a long running
- * process (such as the analysis server) because it has the potential to
- * prevent memory from being reclaimed.
- */
+ /// Return `true` if cache flushing should be disabled. Setting this option to
+ /// `true` can improve analysis speed at the expense of memory usage. It may
+ /// also be useful for working around bugs.
+ ///
+ /// This option should not be used when the analyzer is part of a long running
+ /// process (such as the analysis server) because it has the potential to
+ /// prevent memory from being reclaimed.
bool get disableCacheFlushing;
- /**
- * Return `true` if the parser is to parse asserts in the initializer list of
- * a constructor.
- */
+ /// Return `true` if the parser is to parse asserts in the initializer list of
+ /// a constructor.
@deprecated
bool get enableAssertInitializer;
- /**
- * Return `true` to enable custom assert messages (DEP 37).
- */
+ /// Return `true` to enable custom assert messages (DEP 37).
@deprecated
bool get enableAssertMessage;
- /**
- * Return `true` to if analysis is to enable async support.
- */
+ /// Return `true` to if analysis is to enable async support.
@deprecated
bool get enableAsync;
- /**
- * Return `true` to enable interface libraries (DEP 40).
- */
+ /// Return `true` to enable interface libraries (DEP 40).
@deprecated
bool get enableConditionalDirectives;
- /**
- * Return a list containing the names of the experiments that are enabled in
- * the context associated with these options.
- *
- * The process around these experiments is described in this
- * [doc](https://github.com/dart-lang/sdk/blob/master/docs/process/experimental-flags.md).
- */
+ /// Return a list containing the names of the experiments that are enabled in
+ /// the context associated with these options.
+ ///
+ /// The process around these experiments is described in this
+ /// [doc](https://github.com/dart-lang/sdk/blob/master/docs/process/experimental-flags.md).
List<String> get enabledExperiments;
- /**
- * Return a list of the names of the packages for which, if they define a
- * plugin, the plugin should be enabled.
- */
+ /// Return a list of the names of the packages for which, if they define a
+ /// plugin, the plugin should be enabled.
List<String> get enabledPluginNames;
- /**
- * Return `true` to enable generic methods (DEP 22).
- */
+ /// Return `true` to enable generic methods (DEP 22).
@deprecated
bool get enableGenericMethods => null;
- /**
- * Return `true` if access to field formal parameters should be allowed in a
- * constructor's initializer list.
- */
+ /// Return `true` if access to field formal parameters should be allowed in a
+ /// constructor's initializer list.
@deprecated
bool get enableInitializingFormalAccess;
- /**
- * Return `true` to enable the lazy compound assignment operators '&&=' and
- * '||='.
- */
+ /// Return `true` to enable the lazy compound assignment operators '&&=' and
+ /// '||='.
bool get enableLazyAssignmentOperators;
- /**
- * Return `true` if mixins are allowed to inherit from types other than
- * Object, and are allowed to reference `super`.
- */
+ /// Return `true` if mixins are allowed to inherit from types other than
+ /// Object, and are allowed to reference `super`.
@deprecated
bool get enableSuperMixins;
- /**
- * Return `true` if timing data should be gathered during execution.
- */
+ /// Return `true` if timing data should be gathered during execution.
bool get enableTiming;
- /**
- * Return `true` to enable the use of URIs in part-of directives.
- */
+ /// Return `true` to enable the use of URIs in part-of directives.
@deprecated
bool get enableUriInPartOf;
- /**
- * Return a list of error processors that are to be used when reporting
- * errors in some analysis context.
- */
+ /// Return a list of error processors that are to be used when reporting
+ /// errors in some analysis context.
List<ErrorProcessor> get errorProcessors;
- /**
- * Return a list of exclude patterns used to exclude some sources from
- * analysis.
- */
+ /// Return a list of exclude patterns used to exclude some sources from
+ /// analysis.
List<String> get excludePatterns;
- /**
- * Return `true` if errors, warnings and hints should be generated for sources
- * that are implicitly being analyzed. The default value is `true`.
- */
+ /// Return `true` if errors, warnings and hints should be generated for sources
+ /// that are implicitly being analyzed. The default value is `true`.
bool get generateImplicitErrors;
- /**
- * Return `true` if errors, warnings and hints should be generated for sources
- * in the SDK. The default value is `false`.
- */
+ /// Return `true` if errors, warnings and hints should be generated for sources
+ /// in the SDK. The default value is `false`.
bool get generateSdkErrors;
- /**
- * Return `true` if analysis is to generate hint results (e.g. type inference
- * based information and pub best practices).
- */
+ /// Return `true` if analysis is to generate hint results (e.g. type inference
+ /// based information and pub best practices).
bool get hint;
- /**
- * Return `true` if analysis is to generate lint warnings.
- */
+ /// Return `true` if analysis is to generate lint warnings.
bool get lint;
- /**
- * Return a list of the lint rules that are to be run in an analysis context
- * if [lint] returns `true`.
- */
+ /// Return a list of the lint rules that are to be run in an analysis context
+ /// if [lint] returns `true`.
List<Linter> get lintRules;
- /**
- * A mapping from Dart SDK library name (e.g. "dart:core") to a list of paths
- * to patch files that should be applied to the library.
- */
+ /// A mapping from Dart SDK library name (e.g. "dart:core") to a list of paths
+ /// to patch files that should be applied to the library.
Map<String, List<String>> get patchPaths;
- /**
- * Return `true` if analysis is to parse comments.
- */
+ /// Return `true` if analysis is to parse comments.
bool get preserveComments;
- /**
- * Return `true` if analyzer should enable the use of Dart 2.0 features.
- *
- * This getter is deprecated, and is hard-coded to always return true.
- */
+ /// Return `true` if analyzer should enable the use of Dart 2.0 features.
+ ///
+ /// This getter is deprecated, and is hard-coded to always return true.
@Deprecated(
'This getter is deprecated and is hard-coded to always return true.')
bool get previewDart2;
- /**
- * The version range for the SDK specified in `pubspec.yaml`, or `null` if
- * there is no `pubspec.yaml` or if it does not contain an SDK range.
- */
+ /// The version range for the SDK specified in `pubspec.yaml`, or `null` if
+ /// there is no `pubspec.yaml` or if it does not contain an SDK range.
VersionConstraint get sdkVersionConstraint;
- /**
- * Return the opaque signature of the options.
- *
- * The length of the list is guaranteed to equal [signatureLength].
- */
+ /// Return the opaque signature of the options.
+ ///
+ /// The length of the list is guaranteed to equal [signatureLength].
Uint32List get signature;
- /**
- * Return `true` if strong mode analysis should be used.
- *
- * This getter is deprecated, and is hard-coded to always return true.
- */
+ /// Return `true` if strong mode analysis should be used.
+ ///
+ /// This getter is deprecated, and is hard-coded to always return true.
@Deprecated(
'This getter is deprecated and is hard-coded to always return true.')
bool get strongMode;
- /**
- * Return `true` if dependencies between computed results should be tracked
- * by analysis cache. This option should only be set to `false` if analysis
- * is performed in such a way that none of the inputs is ever changed
- * during the life time of the context.
- */
+ /// Return `true` if dependencies between computed results should be tracked
+ /// by analysis cache. This option should only be set to `false` if analysis
+ /// is performed in such a way that none of the inputs is ever changed
+ /// during the life time of the context.
bool get trackCacheDependencies;
- /**
- * Return `true` if analyzer should use the Dart 2.0 Front End parser.
- */
+ /// Return `true` if analyzer should use the Dart 2.0 Front End parser.
bool get useFastaParser;
- /**
- * Reset the state of this set of analysis options to its original state.
- */
+ /// Reset the state of this set of analysis options to its original state.
void resetToDefaults();
- /**
- * Set the values of the cross-context options to match those in the given set
- * of [options].
- */
+ /// Set the values of the cross-context options to match those in the given set
+ /// of [options].
@deprecated
void setCrossContextOptionsFrom(AnalysisOptions options);
- /**
- * Determine whether two signatures returned by [signature] are equal.
- */
+ /// Determine whether two signatures returned by [signature] are equal.
static bool signaturesEqual(Uint32List a, Uint32List b) {
assert(a.length == signatureLength);
assert(b.length == signatureLength);
@@ -1242,40 +962,28 @@
}
}
-/**
- * A set of analysis options used to control the behavior of an analysis
- * context.
- */
+/// A set of analysis options used to control the behavior of an analysis
+/// context.
class AnalysisOptionsImpl implements AnalysisOptions {
- /**
- * DEPRECATED: The maximum number of sources for which data should be kept in
- * the cache.
- *
- * This constant no longer has any effect.
- */
+ /// DEPRECATED: The maximum number of sources for which data should be kept in
+ /// the cache.
+ ///
+ /// This constant no longer has any effect.
@deprecated
static const int DEFAULT_CACHE_SIZE = 64;
- /**
- * The length of the list returned by [unlinkedSignature].
- */
+ /// The length of the list returned by [unlinkedSignature].
static const int unlinkedSignatureLength = 4;
- /**
- * A predicate indicating whether analysis is to parse and analyze function
- * bodies.
- */
+ /// A predicate indicating whether analysis is to parse and analyze function
+ /// bodies.
AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate =
_analyzeAllFunctionBodies;
- /**
- * The cached [unlinkedSignature].
- */
+ /// The cached [unlinkedSignature].
Uint32List _unlinkedSignature;
- /**
- * The cached [signature].
- */
+ /// The cached [signature].
Uint32List _signature;
@override
@@ -1290,10 +998,7 @@
List<String> _enabledExperiments = const <String>[];
- /**
- * Parsed [enabledExperiments].
- */
- ExperimentStatus _experimentStatus = ExperimentStatus();
+ ExperimentStatus _contextFeatures = ExperimentStatus();
@override
List<String> enabledPluginNames = const <String>[];
@@ -1304,15 +1009,11 @@
@override
bool enableTiming = false;
- /**
- * A list of error processors that are to be used when reporting errors in
- * some analysis context.
- */
+ /// A list of error processors that are to be used when reporting errors in
+ /// some analysis context.
List<ErrorProcessor> _errorProcessors;
- /**
- * A list of exclude patterns used to exclude some sources from analysis.
- */
+ /// A list of exclude patterns used to exclude some sources from analysis.
List<String> _excludePatterns;
@override
@@ -1327,10 +1028,8 @@
@override
bool lint = false;
- /**
- * The lint rules that are to be run in an analysis context if [lint] returns
- * `true`.
- */
+ /// The lint rules that are to be run in an analysis context if [lint] returns
+ /// `true`.
List<Linter> _lintRules;
Map<String, List<String>> patchPaths = {};
@@ -1338,11 +1037,9 @@
@override
bool preserveComments = true;
- /**
- * A flag indicating whether strong-mode inference hints should be
- * used. This flag is not exposed in the interface, and should be
- * replaced by something more general.
- */
+ /// A flag indicating whether strong-mode inference hints should be
+ /// used. This flag is not exposed in the interface, and should be
+ /// replaced by something more general.
// TODO(leafp): replace this with something more general
bool strongModeHints = false;
@@ -1355,52 +1052,43 @@
@override
bool disableCacheFlushing = false;
- /**
- * A flag indicating whether implicit casts are allowed in [strongMode]
- * (they are always allowed in Dart 1.0 mode).
- *
- * This option is experimental and subject to change.
- */
+ /// A flag indicating whether implicit casts are allowed in [strongMode]
+ /// (they are always allowed in Dart 1.0 mode).
+ ///
+ /// This option is experimental and subject to change.
bool implicitCasts = true;
- /**
- * A flag indicating whether implicit dynamic type is allowed, on by default.
- *
- * This flag can be used without necessarily enabling [strongMode], but it is
- * designed with strong mode's type inference in mind. Without type inference,
- * it will raise many errors. Also it does not provide type safety without
- * strong mode.
- *
- * This option is experimental and subject to change.
- */
+ /// A flag indicating whether implicit dynamic type is allowed, on by default.
+ ///
+ /// This flag can be used without necessarily enabling [strongMode], but it is
+ /// designed with strong mode's type inference in mind. Without type inference,
+ /// it will raise many errors. Also it does not provide type safety without
+ /// strong mode.
+ ///
+ /// This option is experimental and subject to change.
bool implicitDynamic = true;
- /**
- * A flag indicating whether inference failures are allowed, off by default.
- *
- * This option is experimental and subject to change.
- */
+ /// A flag indicating whether inference failures are allowed, off by default.
+ ///
+ /// This option is experimental and subject to change.
bool strictInference = false;
- /**
- * Whether raw types (types without explicit type arguments, such as `List`)
- * should be reported as potential problems.
- *
- * Raw types are a common source of `dynamic` being introduced implicitly.
- * This often leads to cast failures later on in the program.
- */
+ /// Whether raw types (types without explicit type arguments, such as `List`)
+ /// should be reported as potential problems.
+ ///
+ /// Raw types are a common source of `dynamic` being introduced implicitly.
+ /// This often leads to cast failures later on in the program.
bool strictRawTypes = false;
- /**
- * Initialize a newly created set of analysis options to have their default
- * values.
- */
+ @override
+ bool chromeOsManifestChecks = false;
+
+ /// Initialize a newly created set of analysis options to have their default
+ /// values.
AnalysisOptionsImpl();
- /**
- * Initialize a newly created set of analysis options to have the same values
- * as those in the given set of analysis [options].
- */
+ /// Initialize a newly created set of analysis options to have the same values
+ /// as those in the given set of analysis [options].
AnalysisOptionsImpl.from(AnalysisOptions options) {
analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
dart2jsHint = options.dart2jsHint;
@@ -1460,6 +1148,14 @@
_analyzeFunctionBodiesPredicate = value;
}
+ @override
+ FeatureSet get contextFeatures => _contextFeatures;
+
+ set contextFeatures(FeatureSet featureSet) {
+ _contextFeatures = featureSet;
+ _enabledExperiments = _contextFeatures.toStringList();
+ }
+
@deprecated
@override
bool get enableAssertInitializer => true;
@@ -1481,9 +1177,7 @@
@deprecated
void set enableAsync(bool enable) {}
- /**
- * A flag indicating whether interface libraries are to be supported (DEP 40).
- */
+ /// A flag indicating whether interface libraries are to be supported (DEP 40).
bool get enableConditionalDirectives => true;
@deprecated
@@ -1494,7 +1188,7 @@
set enabledExperiments(List<String> enabledExperiments) {
_enabledExperiments = enabledExperiments;
- _experimentStatus = ExperimentStatus.fromStrings(enabledExperiments);
+ _contextFeatures = ExperimentStatus.fromStrings(enabledExperiments);
}
@override
@@ -1531,10 +1225,8 @@
List<ErrorProcessor> get errorProcessors =>
_errorProcessors ??= const <ErrorProcessor>[];
- /**
- * Set the list of error [processors] that are to be used when reporting
- * errors in some analysis context.
- */
+ /// Set the list of error [processors] that are to be used when reporting
+ /// errors in some analysis context.
void set errorProcessors(List<ErrorProcessor> processors) {
_errorProcessors = processors;
}
@@ -1542,23 +1234,17 @@
@override
List<String> get excludePatterns => _excludePatterns ??= const <String>[];
- /**
- * Set the exclude patterns used to exclude some sources from analysis to
- * those in the given list of [patterns].
- */
+ /// Set the exclude patterns used to exclude some sources from analysis to
+ /// those in the given list of [patterns].
void set excludePatterns(List<String> patterns) {
_excludePatterns = patterns;
}
- /**
- * The set of enabled experiments.
- */
- ExperimentStatus get experimentStatus => _experimentStatus;
+ /// The set of enabled experiments.
+ ExperimentStatus get experimentStatus => _contextFeatures;
- /**
- * Return `true` to enable mixin declarations.
- * https://github.com/dart-lang/language/issues/12
- */
+ /// Return `true` to enable mixin declarations.
+ /// https://github.com/dart-lang/language/issues/12
@deprecated
bool get isMixinSupportEnabled => true;
@@ -1568,10 +1254,8 @@
@override
List<Linter> get lintRules => _lintRules ??= const <Linter>[];
- /**
- * Set the lint rules that are to be run in an analysis context if [lint]
- * returns `true`.
- */
+ /// Set the lint rules that are to be run in an analysis context if [lint]
+ /// returns `true`.
void set lintRules(List<Linter> rules) {
_lintRules = rules;
}
@@ -1641,11 +1325,9 @@
"The strongMode field is deprecated, and shouldn't be assigned to")
set strongMode(bool value) {}
- /**
- * Return the opaque signature of the options that affect unlinked data.
- *
- * The length of the list is guaranteed to equal [unlinkedSignatureLength].
- */
+ /// Return the opaque signature of the options that affect unlinked data.
+ ///
+ /// The length of the list is guaranteed to equal [unlinkedSignatureLength].
Uint32List get unlinkedSignature {
if (_unlinkedSignature == null) {
ApiSignature buffer = new ApiSignature();
@@ -1702,9 +1384,7 @@
}
}
- /**
- * Return whether the given lists of lints are equal.
- */
+ /// Return whether the given lists of lints are equal.
static bool compareLints(List<Linter> a, List<Linter> b) {
if (a.length != b.length) {
return false;
@@ -1717,175 +1397,129 @@
return true;
}
- /**
- * Predicate used for [analyzeFunctionBodiesPredicate] when
- * [analyzeFunctionBodies] is set to `true`.
- */
+ /// Predicate used for [analyzeFunctionBodiesPredicate] when
+ /// [analyzeFunctionBodies] is set to `true`.
static bool _analyzeAllFunctionBodies(Source _) => true;
- /**
- * Predicate used for [analyzeFunctionBodiesPredicate] when
- * [analyzeFunctionBodies] is set to `false`.
- */
+ /// Predicate used for [analyzeFunctionBodiesPredicate] when
+ /// [analyzeFunctionBodies] is set to `false`.
static bool _analyzeNoFunctionBodies(Source _) => false;
}
-/**
- *
- */
+///
class AnalysisResult {
- /**
- * The change notices associated with this result, or `null` if there were no
- * changes and there is no more work to be done.
- */
+ /// The change notices associated with this result, or `null` if there were no
+ /// changes and there is no more work to be done.
final List<ChangeNotice> _notices;
- /**
- * The number of milliseconds required to determine which task was to be
- * performed.
- */
+ /// The number of milliseconds required to determine which task was to be
+ /// performed.
final int getTime;
- /**
- * The name of the class of the task that was performed.
- */
+ /// The name of the class of the task that was performed.
final String taskClassName;
- /**
- * The number of milliseconds required to perform the task.
- */
+ /// The number of milliseconds required to perform the task.
final int performTime;
- /**
- * Initialize a newly created analysis result to have the given values. The
- * [notices] is the change notices associated with this result. The [getTime]
- * is the number of milliseconds required to determine which task was to be
- * performed. The [taskClassName] is the name of the class of the task that
- * was performed. The [performTime] is the number of milliseconds required to
- * perform the task.
- */
+ /// Initialize a newly created analysis result to have the given values. The
+ /// [notices] is the change notices associated with this result. The [getTime]
+ /// is the number of milliseconds required to determine which task was to be
+ /// performed. The [taskClassName] is the name of the class of the task that
+ /// was performed. The [performTime] is the number of milliseconds required to
+ /// perform the task.
AnalysisResult(
this._notices, this.getTime, this.taskClassName, this.performTime);
- /**
- * Return the change notices associated with this result, or `null` if there
- * were no changes and there is no more work to be done.
- */
+ /// Return the change notices associated with this result, or `null` if there
+ /// were no changes and there is no more work to be done.
List<ChangeNotice> get changeNotices => _notices;
- /**
- * Return `true` if there is more to be performed after the task that was
- * performed.
- */
+ /// Return `true` if there is more to be performed after the task that was
+ /// performed.
bool get hasMoreWork => _notices != null;
}
-/**
- * Statistics about cache consistency validation.
- */
+/// Statistics about cache consistency validation.
class CacheConsistencyValidationStatistics {
- /**
- * Number of sources which were changed, but the context was not notified
- * about it, so this fact was detected only during cache consistency
- * validation.
- */
+ /// Number of sources which were changed, but the context was not notified
+ /// about it, so this fact was detected only during cache consistency
+ /// validation.
int numOfChanged = 0;
- /**
- * Number of sources which stopped existing, but the context was not notified
- * about it, so this fact was detected only during cache consistency
- * validation.
- */
+ /// Number of sources which stopped existing, but the context was not notified
+ /// about it, so this fact was detected only during cache consistency
+ /// validation.
int numOfRemoved = 0;
- /**
- * Reset all counters.
- */
+ /// Reset all counters.
void reset() {
numOfChanged = 0;
numOfRemoved = 0;
}
}
-/**
- * Interface for cache consistency validation in an [InternalAnalysisContext].
- */
+/// Interface for cache consistency validation in an [InternalAnalysisContext].
abstract class CacheConsistencyValidator {
- /**
- * Return sources for which the contexts needs to know modification times.
- */
+ /// Return sources for which the contexts needs to know modification times.
List<Source> getSourcesToComputeModificationTimes();
- /**
- * Notify the validator that modification [times] were computed for [sources].
- * If a source does not exist, its modification time is `-1`.
- *
- * It's up to the validator and the context how to use this information,
- * the list of sources the context has might have been changed since the
- * previous invocation of [getSourcesToComputeModificationTimes].
- *
- * Check the cache for any invalid entries (entries whose modification time
- * does not match the modification time of the source associated with the
- * entry). Invalid entries will be marked as invalid so that the source will
- * be re-analyzed. Return `true` if at least one entry was invalid.
- */
+ /// Notify the validator that modification [times] were computed for [sources].
+ /// If a source does not exist, its modification time is `-1`.
+ ///
+ /// It's up to the validator and the context how to use this information,
+ /// the list of sources the context has might have been changed since the
+ /// previous invocation of [getSourcesToComputeModificationTimes].
+ ///
+ /// Check the cache for any invalid entries (entries whose modification time
+ /// does not match the modification time of the source associated with the
+ /// entry). Invalid entries will be marked as invalid so that the source will
+ /// be re-analyzed. Return `true` if at least one entry was invalid.
bool sourceModificationTimesComputed(List<Source> sources, List<int> times);
}
-/**
- * The possible states of cached data.
- */
+/// The possible states of cached data.
class CacheState implements Comparable<CacheState> {
- /**
- * The data is not in the cache and the last time an attempt was made to
- * compute the data an exception occurred, making it pointless to attempt to
- * compute the data again.
- *
- * Valid Transitions:
- * * [INVALID] if a source was modified that might cause the data to be
- * computable
- */
+ /// The data is not in the cache and the last time an attempt was made to
+ /// compute the data an exception occurred, making it pointless to attempt to
+ /// compute the data again.
+ ///
+ /// Valid Transitions:
+ /// * [INVALID] if a source was modified that might cause the data to be
+ /// computable
static const CacheState ERROR = const CacheState('ERROR', 0);
- /**
- * The data is not in the cache because it was flushed from the cache in order
- * to control memory usage. If the data is recomputed, results do not need to
- * be reported.
- *
- * Valid Transitions:
- * * [IN_PROCESS] if the data is being recomputed
- * * [INVALID] if a source was modified that causes the data to need to be
- * recomputed
- */
+ /// The data is not in the cache because it was flushed from the cache in order
+ /// to control memory usage. If the data is recomputed, results do not need to
+ /// be reported.
+ ///
+ /// Valid Transitions:
+ /// * [IN_PROCESS] if the data is being recomputed
+ /// * [INVALID] if a source was modified that causes the data to need to be
+ /// recomputed
static const CacheState FLUSHED = const CacheState('FLUSHED', 1);
- /**
- * The data might or might not be in the cache but is in the process of being
- * recomputed.
- *
- * Valid Transitions:
- * * [ERROR] if an exception occurred while trying to compute the data
- * * [VALID] if the data was successfully computed and stored in the cache
- */
+ /// The data might or might not be in the cache but is in the process of being
+ /// recomputed.
+ ///
+ /// Valid Transitions:
+ /// * [ERROR] if an exception occurred while trying to compute the data
+ /// * [VALID] if the data was successfully computed and stored in the cache
static const CacheState IN_PROCESS = const CacheState('IN_PROCESS', 2);
- /**
- * The data is not in the cache and needs to be recomputed so that results can
- * be reported.
- *
- * Valid Transitions:
- * * [IN_PROCESS] if an attempt is being made to recompute the data
- */
+ /// The data is not in the cache and needs to be recomputed so that results can
+ /// be reported.
+ ///
+ /// Valid Transitions:
+ /// * [IN_PROCESS] if an attempt is being made to recompute the data
static const CacheState INVALID = const CacheState('INVALID', 3);
- /**
- * The data is in the cache and up-to-date.
- *
- * Valid Transitions:
- * * [FLUSHED] if the data is removed in order to manage memory usage
- * * [INVALID] if a source was modified in such a way as to invalidate the
- * previous data
- */
+ /// The data is in the cache and up-to-date.
+ ///
+ /// Valid Transitions:
+ /// * [FLUSHED] if the data is removed in order to manage memory usage
+ /// * [INVALID] if a source was modified in such a way as to invalidate the
+ /// previous data
static const CacheState VALID = const CacheState('VALID', 4);
static const List<CacheState> values = const [
@@ -1896,14 +1530,10 @@
VALID
];
- /**
- * The name of this cache state.
- */
+ /// The name of this cache state.
final String name;
- /**
- * The ordinal value of the cache state.
- */
+ /// The ordinal value of the cache state.
final int ordinal;
const CacheState(this.name, this.ordinal);
@@ -1918,70 +1548,48 @@
String toString() => name;
}
-/**
- * An object that represents a change to the analysis results associated with a
- * given source.
- */
+/// An object that represents a change to the analysis results associated with a
+/// given source.
abstract class ChangeNotice implements AnalysisErrorInfo {
- /**
- * The parsed, but maybe not resolved Dart AST that changed as a result of
- * the analysis, or `null` if the AST was not changed.
- */
+ /// The parsed, but maybe not resolved Dart AST that changed as a result of
+ /// the analysis, or `null` if the AST was not changed.
CompilationUnit get parsedDartUnit;
- /**
- * The fully resolved Dart AST that changed as a result of the analysis, or
- * `null` if the AST was not changed.
- */
+ /// The fully resolved Dart AST that changed as a result of the analysis, or
+ /// `null` if the AST was not changed.
CompilationUnit get resolvedDartUnit;
- /**
- * Return the source for which the result is being reported.
- */
+ /// Return the source for which the result is being reported.
Source get source;
}
-/**
- * An implementation of a [ChangeNotice].
- */
+/// An implementation of a [ChangeNotice].
class ChangeNoticeImpl implements ChangeNotice {
- /**
- * The source for which the result is being reported.
- */
+ /// The source for which the result is being reported.
@override
final Source source;
- /**
- * The parsed, but maybe not resolved Dart AST that changed as a result of
- * the analysis, or `null` if the AST was not changed.
- */
+ /// The parsed, but maybe not resolved Dart AST that changed as a result of
+ /// the analysis, or `null` if the AST was not changed.
@override
CompilationUnit parsedDartUnit;
- /**
- * The fully resolved Dart AST that changed as a result of the analysis, or
- * `null` if the AST was not changed.
- */
+ /// The fully resolved Dart AST that changed as a result of the analysis, or
+ /// `null` if the AST was not changed.
@override
CompilationUnit resolvedDartUnit;
- /**
- * The errors that changed as a result of the analysis, or `null` if errors
- * were not changed.
- */
+ /// The errors that changed as a result of the analysis, or `null` if errors
+ /// were not changed.
List<AnalysisError> _errors;
- /**
- * The line information associated with the source, or `null` if errors were
- * not changed.
- */
+ /// The line information associated with the source, or `null` if errors were
+ /// not changed.
LineInfo _lineInfo;
- /**
- * Initialize a newly created notice associated with the given source.
- *
- * @param source the source for which the change is being reported
- */
+ /// Initialize a newly created notice associated with the given source.
+ ///
+ /// @param source the source for which the change is being reported
ChangeNoticeImpl(this.source);
@override
@@ -1990,10 +1598,8 @@
@override
LineInfo get lineInfo => _lineInfo;
- /**
- * Set the errors that changed as a result of the analysis to the given
- * [errors] and set the line information to the given [lineInfo].
- */
+ /// Set the errors that changed as a result of the analysis to the given
+ /// [errors] and set the line information to the given [lineInfo].
void setErrors(List<AnalysisError> errors, LineInfo lineInfo) {
this._errors = errors;
this._lineInfo = lineInfo;
@@ -2007,61 +1613,43 @@
String toString() => "Changes for ${source.fullName}";
}
-/**
- * An indication of which sources have been added, changed, removed, or deleted.
- * In the case of a changed source, there are multiple ways of indicating the
- * nature of the change.
- *
- * No source should be added to the change set more than once, either with the
- * same or a different kind of change. It does not make sense, for example, for
- * a source to be both added and removed, and it is redundant for a source to be
- * marked as changed in its entirety and changed in some specific range.
- */
+/// An indication of which sources have been added, changed, removed, or deleted.
+/// In the case of a changed source, there are multiple ways of indicating the
+/// nature of the change.
+///
+/// No source should be added to the change set more than once, either with the
+/// same or a different kind of change. It does not make sense, for example, for
+/// a source to be both added and removed, and it is redundant for a source to be
+/// marked as changed in its entirety and changed in some specific range.
class ChangeSet {
- /**
- * A list containing the sources that have been added.
- */
+ /// A list containing the sources that have been added.
final List<Source> addedSources = new List<Source>();
- /**
- * A list containing the sources that have been changed.
- */
+ /// A list containing the sources that have been changed.
final List<Source> changedSources = new List<Source>();
- /**
- * A table mapping the sources whose content has been changed to the current
- * content of those sources.
- */
+ /// A table mapping the sources whose content has been changed to the current
+ /// content of those sources.
Map<Source, String> _changedContent = new HashMap<Source, String>();
- /**
- * A table mapping the sources whose content has been changed within a single
- * range to the current content of those sources and information about the
- * affected range.
- */
+ /// A table mapping the sources whose content has been changed within a single
+ /// range to the current content of those sources and information about the
+ /// affected range.
final HashMap<Source, ChangeSet_ContentChange> changedRanges =
new HashMap<Source, ChangeSet_ContentChange>();
- /**
- * A list containing the sources that have been removed.
- */
+ /// A list containing the sources that have been removed.
final List<Source> removedSources = new List<Source>();
- /**
- * A list containing the source containers specifying additional sources that
- * have been removed.
- */
+ /// A list containing the source containers specifying additional sources that
+ /// have been removed.
final List<SourceContainer> removedContainers = new List<SourceContainer>();
- /**
- * Return a table mapping the sources whose content has been changed to the
- * current content of those sources.
- */
+ /// Return a table mapping the sources whose content has been changed to the
+ /// current content of those sources.
Map<Source, String> get changedContents => _changedContent;
- /**
- * Return `true` if this change set does not contain any changes.
- */
+ /// Return `true` if this change set does not contain any changes.
bool get isEmpty =>
addedSources.isEmpty &&
changedSources.isEmpty &&
@@ -2070,57 +1658,45 @@
removedSources.isEmpty &&
removedContainers.isEmpty;
- /**
- * Record that the specified [source] has been added and that its content is
- * the default contents of the source.
- */
+ /// Record that the specified [source] has been added and that its content is
+ /// the default contents of the source.
void addedSource(Source source) {
addedSources.add(source);
}
- /**
- * Record that the specified [source] has been changed and that its content is
- * the given [contents].
- */
+ /// Record that the specified [source] has been changed and that its content is
+ /// the given [contents].
void changedContent(Source source, String contents) {
_changedContent[source] = contents;
}
- /**
- * Record that the specified [source] has been changed and that its content is
- * the given [contents]. The [offset] is the offset into the current contents.
- * The [oldLength] is the number of characters in the original contents that
- * were replaced. The [newLength] is the number of characters in the
- * replacement text.
- */
+ /// Record that the specified [source] has been changed and that its content is
+ /// the given [contents]. The [offset] is the offset into the current contents.
+ /// The [oldLength] is the number of characters in the original contents that
+ /// were replaced. The [newLength] is the number of characters in the
+ /// replacement text.
void changedRange(Source source, String contents, int offset, int oldLength,
int newLength) {
changedRanges[source] =
new ChangeSet_ContentChange(contents, offset, oldLength, newLength);
}
- /**
- * Record that the specified [source] has been changed. If the content of the
- * source was previously overridden, this has no effect (the content remains
- * overridden). To cancel (or change) the override, use [changedContent]
- * instead.
- */
+ /// Record that the specified [source] has been changed. If the content of the
+ /// source was previously overridden, this has no effect (the content remains
+ /// overridden). To cancel (or change) the override, use [changedContent]
+ /// instead.
void changedSource(Source source) {
changedSources.add(source);
}
- /**
- * Record that the specified source [container] has been removed.
- */
+ /// Record that the specified source [container] has been removed.
void removedContainer(SourceContainer container) {
if (container != null) {
removedContainers.add(container);
}
}
- /**
- * Record that the specified [source] has been removed.
- */
+ /// Record that the specified [source] has been removed.
void removedSource(Source source) {
if (source != null) {
removedSources.add(source);
@@ -2158,11 +1734,9 @@
return buffer.toString();
}
- /**
- * Append the given [sources] to the given [buffer], prefixed with the given
- * [label] and a separator if [needsSeparator] is `true`. Return `true` if
- * future lists of sources will need a separator.
- */
+ /// Append the given [sources] to the given [buffer], prefixed with the given
+ /// [label] and a separator if [needsSeparator] is `true`. Return `true` if
+ /// future lists of sources will need a separator.
bool _appendSources(StringBuffer buffer, List<Source> sources,
bool needsSeparator, String label) {
if (sources.isEmpty) {
@@ -2181,11 +1755,9 @@
return true;
}
- /**
- * Append the given [sources] to the given [builder], prefixed with the given
- * [label] and a separator if [needsSeparator] is `true`. Return `true` if
- * future lists of sources will need a separator.
- */
+ /// Append the given [sources] to the given [builder], prefixed with the given
+ /// [label] and a separator if [needsSeparator] is `true`. Return `true` if
+ /// future lists of sources will need a separator.
bool _appendSources2(StringBuffer buffer, Map<Source, dynamic> sources,
bool needsSeparator, String label) {
if (sources.isEmpty) {
@@ -2205,64 +1777,42 @@
}
}
-/**
- * A change to the content of a source.
- */
+/// A change to the content of a source.
class ChangeSet_ContentChange {
- /**
- * The new contents of the source.
- */
+ /// The new contents of the source.
final String contents;
- /**
- * The offset into the current contents.
- */
+ /// The offset into the current contents.
final int offset;
- /**
- * The number of characters in the original contents that were replaced
- */
+ /// The number of characters in the original contents that were replaced
final int oldLength;
- /**
- * The number of characters in the replacement text.
- */
+ /// The number of characters in the replacement text.
final int newLength;
- /**
- * Initialize a newly created change object to represent a change to the
- * content of a source. The [contents] is the new contents of the source. The
- * [offset] is the offset into the current contents. The [oldLength] is the
- * number of characters in the original contents that were replaced. The
- * [newLength] is the number of characters in the replacement text.
- */
+ /// Initialize a newly created change object to represent a change to the
+ /// content of a source. The [contents] is the new contents of the source. The
+ /// [offset] is the offset into the current contents. The [oldLength] is the
+ /// number of characters in the original contents that were replaced. The
+ /// [newLength] is the number of characters in the replacement text.
ChangeSet_ContentChange(
this.contents, this.offset, this.oldLength, this.newLength);
}
-/**
- * [ComputedResult] describes a value computed for a [ResultDescriptor].
- */
+/// [ComputedResult] describes a value computed for a [ResultDescriptor].
@deprecated
class ComputedResult<V> {
- /**
- * The context in which the value was computed.
- */
+ /// The context in which the value was computed.
final AnalysisContext context;
- /**
- * The descriptor of the result which was computed.
- */
+ /// The descriptor of the result which was computed.
final ResultDescriptor<V> descriptor;
- /**
- * The target for which the result was computed.
- */
+ /// The target for which the result was computed.
final AnalysisTarget target;
- /**
- * The computed value.
- */
+ /// The computed value.
final V value;
ComputedResult(this.context, this.descriptor, this.target, this.value);
@@ -2271,25 +1821,17 @@
String toString() => 'Computed $descriptor of $target in $context';
}
-/**
- * An event indicating when a source either starts or stops being implicitly
- * analyzed.
- */
+/// An event indicating when a source either starts or stops being implicitly
+/// analyzed.
class ImplicitAnalysisEvent {
- /**
- * The source whose status has changed.
- */
+ /// The source whose status has changed.
final Source source;
- /**
- * A flag indicating whether the source is now being analyzed.
- */
+ /// A flag indicating whether the source is now being analyzed.
final bool isAnalyzed;
- /**
- * Initialize a newly created event to indicate that the given [source] has
- * changed it status to match the [isAnalyzed] flag.
- */
+ /// Initialize a newly created event to indicate that the given [source] has
+ /// changed it status to match the [isAnalyzed] flag.
ImplicitAnalysisEvent(this.source, this.isAnalyzed);
@override
@@ -2297,225 +1839,156 @@
'${isAnalyzed ? '' : 'not '}analyzing ${source.fullName}';
}
-/**
- * Additional behavior for an analysis context that is required by internal
- * users of the context.
- */
+/// Additional behavior for an analysis context that is required by internal
+/// users of the context.
abstract class InternalAnalysisContext implements AnalysisContext {
- /**
- * The result provider for [aboutToComputeResult].
- */
- ResultProvider resultProvider;
-
- /**
- * A table mapping the sources known to the context to the information known
- * about the source.
- */
+ /// A table mapping the sources known to the context to the information known
+ /// about the source.
AnalysisCache get analysisCache;
- /**
- * The cache consistency validator for this context.
- */
+ /// The cache consistency validator for this context.
CacheConsistencyValidator get cacheConsistencyValidator;
- /**
- * Allow the client to supply its own content cache. This will take the
- * place of the content cache created by default, allowing clients to share
- * the content cache between contexts.
- */
+ /// Allow the client to supply its own content cache. This will take the
+ /// place of the content cache created by default, allowing clients to share
+ /// the content cache between contexts.
set contentCache(ContentCache value);
- /**
- * Get the [EmbedderYamlLocator] for this context.
- */
+ /// Get the [EmbedderYamlLocator] for this context.
@deprecated
EmbedderYamlLocator get embedderYamlLocator;
- /**
- * Return a list of the explicit targets being analyzed by this context.
- */
+ /// Return a list of the explicit targets being analyzed by this context.
List<AnalysisTarget> get explicitTargets;
- /**
- * Return `true` if the context is active, i.e. is being analyzed now.
- */
+ /// Return `true` if the context is active, i.e. is being analyzed now.
bool get isActive;
- /**
- * Specify whether the context is active, i.e. is being analyzed now.
- */
+ /// Specify whether the context is active, i.e. is being analyzed now.
set isActive(bool value);
- /**
- * Return the [StreamController] reporting [InvalidatedResult]s for everything
- * in this context's cache.
- */
+ /// Return the [StreamController] reporting [InvalidatedResult]s for everything
+ /// in this context's cache.
ReentrantSynchronousStream<InvalidatedResult> get onResultInvalidated;
- /**
- * Return a list containing all of the sources that have been marked as
- * priority sources. Clients must not modify the returned list.
- */
+ /// Return a list containing all of the sources that have been marked as
+ /// priority sources. Clients must not modify the returned list.
List<Source> get prioritySources;
- /**
- * Return a list of the priority targets being analyzed by this context.
- */
+ /// Return a list of the priority targets being analyzed by this context.
List<AnalysisTarget> get priorityTargets;
- /**
- * The partition that contains analysis results that are not shared with other
- * contexts.
- */
+ /// The partition that contains analysis results that are not shared with other
+ /// contexts.
CachePartition get privateAnalysisCachePartition;
- /**
- * Sets the [TypeProvider] for this context.
- */
+ /// Sets the [TypeProvider] for this context.
void set typeProvider(TypeProvider typeProvider);
- /**
- * A list of all [WorkManager]s used by this context.
- */
+ /// A list of all [WorkManager]s used by this context.
List<WorkManager> get workManagers;
- /**
- * This method is invoked when the state of the [result] of the [entry] is
- * [CacheState.INVALID], so it is about to be computed.
- *
- * If the context knows how to provide the value, it sets the value into
- * the [entry] with all required dependencies, and returns `true`.
- *
- * Otherwise, it returns `false` to indicate that the result should be
- * computed as usually.
- */
+ /// This method is invoked when the state of the [result] of the [entry] is
+ /// [CacheState.INVALID], so it is about to be computed.
+ ///
+ /// If the context knows how to provide the value, it sets the value into
+ /// the [entry] with all required dependencies, and returns `true`.
+ ///
+ /// Otherwise, it returns `false` to indicate that the result should be
+ /// computed as usually.
bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result);
- /**
- * Return a list containing the sources of the libraries that are exported by
- * the library with the given [source]. The list will be empty if the given
- * source is invalid, if the given source does not represent a library, or if
- * the library does not export any other libraries.
- *
- * Throws an [AnalysisException] if the exported libraries could not be
- * computed.
- */
+ /// Return a list containing the sources of the libraries that are exported by
+ /// the library with the given [source]. The list will be empty if the given
+ /// source is invalid, if the given source does not represent a library, or if
+ /// the library does not export any other libraries.
+ ///
+ /// Throws an [AnalysisException] if the exported libraries could not be
+ /// computed.
List<Source> computeExportedLibraries(Source source);
- /**
- * Return a list containing the sources of the libraries that are imported by
- * the library with the given [source]. The list will be empty if the given
- * source is invalid, if the given source does not represent a library, or if
- * the library does not import any other libraries.
- *
- * Throws an [AnalysisException] if the imported libraries could not be
- * computed.
- */
+ /// Return a list containing the sources of the libraries that are imported by
+ /// the library with the given [source]. The list will be empty if the given
+ /// source is invalid, if the given source does not represent a library, or if
+ /// the library does not import any other libraries.
+ ///
+ /// Throws an [AnalysisException] if the imported libraries could not be
+ /// computed.
List<Source> computeImportedLibraries(Source source);
- /**
- * Return all the resolved [CompilationUnit]s for the given [source] if not
- * flushed, otherwise return `null` and ensures that the [CompilationUnit]s
- * will be eventually returned to the client from [performAnalysisTask].
- */
+ /// Return all the resolved [CompilationUnit]s for the given [source] if not
+ /// flushed, otherwise return `null` and ensures that the [CompilationUnit]s
+ /// will be eventually returned to the client from [performAnalysisTask].
List<CompilationUnit> ensureResolvedDartUnits(Source source);
- /**
- * Return the cache entry associated with the given [target].
- */
+ /// Return the cache entry associated with the given [target].
CacheEntry getCacheEntry(AnalysisTarget target);
- /**
- * Return context that owns the given [source].
- */
+ /// Return context that owns the given [source].
InternalAnalysisContext getContextFor(Source source);
- /**
- * Return a change notice for the given [source], creating one if one does not
- * already exist.
- */
+ /// Return a change notice for the given [source], creating one if one does not
+ /// already exist.
ChangeNoticeImpl getNotice(Source source);
- /**
- * Return a namespace containing mappings for all of the public names defined
- * by the given [library].
- */
+ /// Return a namespace containing mappings for all of the public names defined
+ /// by the given [library].
Namespace getPublicNamespace(LibraryElement library);
- /**
- * Respond to a change which has been made to the given [source] file.
- * [originalContents] is the former contents of the file, and [newContents]
- * is the updated contents. If [notify] is true, a source changed event is
- * triggered.
- *
- * Normally it should not be necessary for clients to call this function,
- * since it will be automatically invoked in response to a call to
- * [applyChanges] or [setContents]. However, if this analysis context is
- * sharing its content cache with other contexts, then the client must
- * manually update the content cache and call this function for each context.
- *
- * Return `true` if the change was significant to this context (i.e. [source]
- * is either implicitly or explicitly analyzed by this context, and a change
- * actually occurred).
- */
+ /// Respond to a change which has been made to the given [source] file.
+ /// [originalContents] is the former contents of the file, and [newContents]
+ /// is the updated contents. If [notify] is true, a source changed event is
+ /// triggered.
+ ///
+ /// Normally it should not be necessary for clients to call this function,
+ /// since it will be automatically invoked in response to a call to
+ /// [applyChanges] or [setContents]. However, if this analysis context is
+ /// sharing its content cache with other contexts, then the client must
+ /// manually update the content cache and call this function for each context.
+ ///
+ /// Return `true` if the change was significant to this context (i.e. [source]
+ /// is either implicitly or explicitly analyzed by this context, and a change
+ /// actually occurred).
bool handleContentsChanged(
Source source, String originalContents, String newContents, bool notify);
- /**
- * Given an [elementMap] mapping the source for the libraries represented by
- * the corresponding elements to the elements representing the libraries,
- * record those mappings.
- */
+ /// Given an [elementMap] mapping the source for the libraries represented by
+ /// the corresponding elements to the elements representing the libraries,
+ /// record those mappings.
void recordLibraryElements(Map<Source, LibraryElement> elementMap);
- /**
- * Return `true` if errors should be produced for the given [source].
- */
+ /// Return `true` if errors should be produced for the given [source].
bool shouldErrorsBeAnalyzed(Source source);
- /**
- * For testing only: flush all representations of the AST (both resolved and
- * unresolved) for the given [source] out of the cache.
- */
+ /// For testing only: flush all representations of the AST (both resolved and
+ /// unresolved) for the given [source] out of the cache.
void test_flushAstStructures(Source source);
- /**
- * Visit all entries of the content cache.
- */
+ /// Visit all entries of the content cache.
void visitContentCache(ContentCacheVisitor visitor);
}
-/**
- * An object that can be used to receive information about errors within the
- * analysis engine. Implementations usually write this information to a file,
- * but can also record the information for later use (such as during testing) or
- * even ignore the information.
- */
+/// An object that can be used to receive information about errors within the
+/// analysis engine. Implementations usually write this information to a file,
+/// but can also record the information for later use (such as during testing) or
+/// even ignore the information.
abstract class Logger {
- /**
- * A logger that ignores all logging.
- */
+ /// A logger that ignores all logging.
static final Logger NULL = new NullLogger();
- /**
- * Log the given message as an error. The [message] is expected to be an
- * explanation of why the error occurred or what it means. The [exception] is
- * expected to be the reason for the error. At least one argument must be
- * provided.
- */
+ /// Log the given message as an error. The [message] is expected to be an
+ /// explanation of why the error occurred or what it means. The [exception] is
+ /// expected to be the reason for the error. At least one argument must be
+ /// provided.
void logError(String message, [CaughtException exception]);
- /**
- * Log the given informational message. The [message] is expected to be an
- * explanation of why the error occurred or what it means. The [exception] is
- * expected to be the reason for the error.
- */
+ /// Log the given informational message. The [message] is expected to be an
+ /// explanation of why the error occurred or what it means. The [exception] is
+ /// expected to be the reason for the error.
void logInformation(String message, [CaughtException exception]);
}
-/**
- * An implementation of [Logger] that does nothing.
- */
+/// An implementation of [Logger] that does nothing.
class NullLogger implements Logger {
@override
void logError(String message, [CaughtException exception]) {}
@@ -2524,109 +1997,71 @@
void logInformation(String message, [CaughtException exception]) {}
}
-/**
- * An exception created when an analysis attempt fails because a source was
- * deleted between the time the analysis started and the time the results of the
- * analysis were ready to be recorded.
- */
+/// An exception created when an analysis attempt fails because a source was
+/// deleted between the time the analysis started and the time the results of the
+/// analysis were ready to be recorded.
class ObsoleteSourceAnalysisException extends AnalysisException {
- /**
- * The source that was removed while it was being analyzed.
- */
+ /// The source that was removed while it was being analyzed.
Source _source;
- /**
- * Initialize a newly created exception to represent the removal of the given
- * [source].
- */
+ /// Initialize a newly created exception to represent the removal of the given
+ /// [source].
ObsoleteSourceAnalysisException(Source source)
: super(
"The source '${source.fullName}' was removed while it was being analyzed") {
this._source = source;
}
- /**
- * Return the source that was removed while it was being analyzed.
- */
+ /// Return the source that was removed while it was being analyzed.
Source get source => _source;
}
-/**
- * Container with global [AnalysisContext] performance statistics.
- */
+/// Container with global [AnalysisContext] performance statistics.
class PerformanceStatistics {
- /**
- * The [PerformanceTag] for `package:analyzer`.
- */
+ /// The [PerformanceTag] for `package:analyzer`.
static PerformanceTag analyzer = new PerformanceTag('analyzer');
- /**
- * The [PerformanceTag] for time spent in reading files.
- */
+ /// The [PerformanceTag] for time spent in reading files.
static PerformanceTag io = analyzer.createChild('io');
- /**
- * The [PerformanceTag] for general phases of analysis.
- */
+ /// The [PerformanceTag] for general phases of analysis.
static PerformanceTag analysis = analyzer.createChild('analysis');
- /**
- * The [PerformanceTag] for time spent in scanning.
- */
+ /// The [PerformanceTag] for time spent in scanning.
static PerformanceTag scan = analyzer.createChild('scan');
- /**
- * The [PerformanceTag] for time spent in parsing.
- */
+ /// The [PerformanceTag] for time spent in parsing.
static PerformanceTag parse = analyzer.createChild('parse');
- /**
- * The [PerformanceTag] for time spent in resolving.
- */
+ /// The [PerformanceTag] for time spent in resolving.
static PerformanceTag resolve = new PerformanceTag('resolve');
- /**
- * The [PerformanceTag] for time spent in error verifier.
- */
+ /// The [PerformanceTag] for time spent in error verifier.
static PerformanceTag errors = analysis.createChild('errors');
- /**
- * The [PerformanceTag] for time spent in hints generator.
- */
+ /// The [PerformanceTag] for time spent in hints generator.
static PerformanceTag hints = analysis.createChild('hints');
- /**
- * The [PerformanceTag] for time spent in linting.
- */
+ /// The [PerformanceTag] for time spent in linting.
static PerformanceTag lints = analysis.createChild('lints');
- /**
- * The [PerformanceTag] for time spent computing cycles.
- */
+ /// The [PerformanceTag] for time spent computing cycles.
static PerformanceTag cycles = new PerformanceTag('cycles');
- /**
- * The [PerformanceTag] for time spent in summaries support.
- */
+ /// The [PerformanceTag] for time spent in summaries support.
static PerformanceTag summary = analyzer.createChild('summary');
- /**
- * Statistics about cache consistency validation.
- */
+ /// Statistics about cache consistency validation.
static final CacheConsistencyValidationStatistics
cacheConsistencyValidationStatistics =
new CacheConsistencyValidationStatistics();
}
-/**
- * An visitor that removes any resolution information from an AST structure when
- * used to visit that structure.
- */
+/// An visitor that removes any resolution information from an AST structure when
+/// used to visit that structure.
class ResolutionEraser extends GeneralizingAstVisitor<void> {
- /**
- * A flag indicating whether the elements associated with declarations should
- * be erased.
- */
+ /// A flag indicating whether the elements associated with declarations should
+ /// be erased.
bool eraseDeclarations = true;
@override
@@ -2748,9 +2183,7 @@
super.visitSuperConstructorInvocation(node);
}
- /**
- * Remove any resolution information from the given AST structure.
- */
+ /// Remove any resolution information from the given AST structure.
static void erase(AstNode node, {bool eraseDeclarations: true}) {
ResolutionEraser eraser = new ResolutionEraser();
eraser.eraseDeclarations = eraseDeclarations;
@@ -2758,48 +2191,32 @@
}
}
-/**
- * [ResultChangedEvent] describes a change to an analysis result.
- */
+/// [ResultChangedEvent] describes a change to an analysis result.
class ResultChangedEvent<V> {
- /**
- * The context in which the result was changed.
- */
+ /// The context in which the result was changed.
final AnalysisContext context;
- /**
- * The target for which the result was changed.
- */
+ /// The target for which the result was changed.
final AnalysisTarget target;
- /**
- * The descriptor of the result which was changed.
- */
+ /// The descriptor of the result which was changed.
final ResultDescriptor<V> descriptor;
- /**
- * If the result [wasComputed], the new value of the result. If the result
- * [wasInvalidated], the value of before it was invalidated, may be the
- * default value if the result was flushed.
- */
+ /// If the result [wasComputed], the new value of the result. If the result
+ /// [wasInvalidated], the value of before it was invalidated, may be the
+ /// default value if the result was flushed.
final V value;
- /**
- * Is `true` if the result was computed, or `false` is is was invalidated.
- */
+ /// Is `true` if the result was computed, or `false` is is was invalidated.
final bool _wasComputed;
ResultChangedEvent(this.context, this.target, this.descriptor, this.value,
this._wasComputed);
- /**
- * Returns `true` if the result was computed.
- */
+ /// Returns `true` if the result was computed.
bool get wasComputed => _wasComputed;
- /**
- * Returns `true` if the result was invalidated.
- */
+ /// Returns `true` if the result was invalidated.
bool get wasInvalidated => !_wasComputed;
@override
@@ -2809,34 +2226,24 @@
}
}
-/**
- * [SourcesChangedEvent] indicates which sources have been added, removed,
- * or whose contents have changed.
- */
+/// [SourcesChangedEvent] indicates which sources have been added, removed,
+/// or whose contents have changed.
class SourcesChangedEvent {
- /**
- * The internal representation of what has changed. Clients should not access
- * this field directly.
- */
+ /// The internal representation of what has changed. Clients should not access
+ /// this field directly.
final ChangeSet _changeSet;
- /**
- * Construct an instance representing the given changes.
- */
+ /// Construct an instance representing the given changes.
SourcesChangedEvent(ChangeSet changeSet) : _changeSet = changeSet;
- /**
- * Construct an instance representing a source content change.
- */
+ /// Construct an instance representing a source content change.
factory SourcesChangedEvent.changedContent(Source source, String contents) {
ChangeSet changeSet = new ChangeSet();
changeSet.changedContent(source, contents);
return new SourcesChangedEvent(changeSet);
}
- /**
- * Construct an instance representing a source content change.
- */
+ /// Construct an instance representing a source content change.
factory SourcesChangedEvent.changedRange(Source source, String contents,
int offset, int oldLength, int newLength) {
ChangeSet changeSet = new ChangeSet();
@@ -2844,9 +2251,7 @@
return new SourcesChangedEvent(changeSet);
}
- /**
- * Return the collection of sources for which content has changed.
- */
+ /// Return the collection of sources for which content has changed.
Iterable<Source> get changedSources {
List<Source> changedSources = new List.from(_changeSet.changedSources);
changedSources.addAll(_changeSet.changedContents.keys);
@@ -2854,14 +2259,10 @@
return changedSources;
}
- /**
- * Return `true` if any sources were added.
- */
+ /// Return `true` if any sources were added.
bool get wereSourcesAdded => _changeSet.addedSources.length > 0;
- /**
- * Return `true` if any sources were removed or deleted.
- */
+ /// Return `true` if any sources were removed or deleted.
bool get wereSourcesRemoved =>
_changeSet.removedSources.length > 0 ||
_changeSet.removedContainers.length > 0;
diff --git a/analyzer/lib/src/generated/error.dart b/analyzer/lib/src/generated/error.dart
index 3d71368..fe431d2 100644
--- a/analyzer/lib/src/generated/error.dart
+++ b/analyzer/lib/src/generated/error.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/error_verifier.dart b/analyzer/lib/src/generated/error_verifier.dart
index 9bd55f1..8eb5579 100644
--- a/analyzer/lib/src/generated/error_verifier.dart
+++ b/analyzer/lib/src/generated/error_verifier.dart
@@ -14,13 +14,16 @@
import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/constant/evaluation.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/inheritance_manager2.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/diagnostic/diagnostic_factory.dart';
import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/error/literal_element_verifier.dart';
import 'package:analyzer/src/error/pending_error.dart';
import 'package:analyzer/src/generated/element_resolver.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -472,6 +475,7 @@
try {
_isInCatchClause = true;
_checkForTypeAnnotationDeferredClass(node.exceptionType);
+ _checkForPotentiallyNullableType(node.exceptionType);
super.visitCatchClause(node);
} finally {
_isInCatchClause = previousIsInCatchClause;
@@ -743,6 +747,7 @@
void visitFormalParameterList(FormalParameterList node) {
_checkDuplicateDefinitionInParameterList(node);
_checkUseOfCovariantInParameters(node);
+ _checkUseOfDefaultValuesInParameters(node);
super.visitFormalParameterList(node);
}
@@ -837,6 +842,8 @@
}
_checkForImplicitDynamicInvoke(node);
_checkForNullableDereference(node.function);
+ _checkForMissingRequiredParam(
+ node.staticInvokeType, node.argumentList, node);
super.visitFunctionExpressionInvocation(node);
}
@@ -872,7 +879,7 @@
}
// TODO(paulberry): remove this once dartbug.com/28515 is fixed.
- if (node.typeParameters != null) {
+ if (node.typeParameters != null && !AnalysisDriver.useSummary2) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED,
node);
@@ -944,6 +951,8 @@
_checkForConstOrNewWithAbstractClass(node, typeName, type);
_checkForConstOrNewWithEnum(node, typeName, type);
_checkForConstOrNewWithMixin(node, typeName, type);
+ _checkForMissingRequiredParam(
+ node.staticElement?.type, node.argumentList, node.constructorName);
if (_isInConstInstanceCreation) {
_checkForConstWithNonConst(node);
_checkForConstWithUndefinedConstructor(
@@ -952,6 +961,7 @@
} else {
_checkForNewWithUndefinedConstructor(node, constructorName, typeName);
}
+ _checkForListConstructor(node, type);
}
_checkForImplicitDynamicType(typeName);
super.visitInstanceCreationExpression(node);
@@ -993,7 +1003,7 @@
_checkTypeArgumentCount(typeArguments, 1,
StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS);
}
- _checkForRawTypedLiteral(node);
+ _checkForInferenceFailureOnCollectionLiteral(node);
_checkForImplicitDynamicTypedLiteral(node);
_checkForListElementTypeNotAssignable(node);
@@ -1043,6 +1053,8 @@
}
_checkTypeArguments(node);
_checkForImplicitDynamicInvoke(node);
+ _checkForMissingRequiredParam(
+ node.staticInvokeType, node.argumentList, node.methodName);
if (node.operator?.type != TokenType.QUESTION_PERIOD &&
methodName.name != 'toString' &&
methodName.name != 'noSuchMethod') {
@@ -1102,9 +1114,11 @@
@override
void visitPostfixExpression(PostfixExpression node) {
- _checkForAssignmentToFinal(node.operand);
- _checkForIntNotAssignable(node.operand);
- _checkForNullableDereference(node.operand);
+ if (node.operator.type != TokenType.BANG) {
+ _checkForAssignmentToFinal(node.operand);
+ _checkForIntNotAssignable(node.operand);
+ _checkForNullableDereference(node.operand);
+ }
super.visitPostfixExpression(node);
}
@@ -1160,6 +1174,11 @@
@override
void visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) {
+ DartType type =
+ resolutionMap.staticElementForConstructorReference(node)?.type;
+ if (type != null) {
+ _checkForMissingRequiredParam(type, node.argumentList, node);
+ }
_isInConstructorInitializer = true;
try {
super.visitRedirectingConstructorInvocation(node);
@@ -1200,11 +1219,10 @@
_checkTypeArgumentCount(typeArguments, 2,
StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS);
}
- _checkForRawTypedLiteral(node);
+ _checkForInferenceFailureOnCollectionLiteral(node);
_checkForImplicitDynamicTypedLiteral(node);
_checkForMapTypeNotAssignable(node);
_checkForNonConstMapAsExpressionStatement3(node);
- _checkForExpressions(node.elements2);
} else if (node.isSet) {
if (typeArguments != null) {
if (node.isConst) {
@@ -1217,10 +1235,9 @@
_checkTypeArgumentCount(typeArguments, 1,
StaticTypeWarningCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS);
}
- _checkForRawTypedLiteral(node);
+ _checkForInferenceFailureOnCollectionLiteral(node);
_checkForImplicitDynamicTypedLiteral(node);
_checkForSetElementTypeNotAssignable3(node);
- _checkForMapEntries(node.elements2);
}
super.visitSetOrMapLiteral(node);
}
@@ -1256,6 +1273,11 @@
@override
void visitSuperConstructorInvocation(SuperConstructorInvocation node) {
+ DartType type =
+ resolutionMap.staticElementForConstructorReference(node)?.type;
+ if (type != null) {
+ _checkForMissingRequiredParam(type, node.argumentList, node);
+ }
_isInConstructorInitializer = true;
try {
super.visitSuperConstructorInvocation(node);
@@ -1316,7 +1338,12 @@
@override
void visitTypeName(TypeName node) {
_checkForTypeArgumentNotMatchingBounds(node);
- _checkForRawTypeName(node);
+ if (node.parent is ConstructorName &&
+ node.parent.parent is InstanceCreationExpression) {
+ _checkForInferenceFailureOnInstanceCreation(node, node.parent.parent);
+ } else {
+ _checkForRawTypeName(node);
+ }
super.visitTypeName(node);
}
@@ -1924,7 +1951,7 @@
List<FieldElement> notInitFinalFields = <FieldElement>[];
fieldElementsMap.forEach((FieldElement fieldElement, INIT_STATE state) {
if (state == INIT_STATE.NOT_INIT) {
- if (fieldElement.isFinal) {
+ if (fieldElement.isFinal && !fieldElement.isLate) {
notInitFinalFields.add(fieldElement);
}
}
@@ -2229,63 +2256,6 @@
}
/**
- * Verify that the type of the elements of the given [spreadExpression] (the
- * [spreadExpressionType]) can be assigned to the element type of the
- * enclosing collection (the [elementType]). If not, report an error with the
- * given [errorCode].
- */
- void _checkForArgumentTypeNotAssignableInSpread(
- Expression spreadExpression,
- DartType spreadExpressionType,
- DartType elementType,
- ErrorCode errorCode) {
- if (spreadExpressionType != null && elementType != null) {
- if (!elementType.isVoid && _checkForUseOfVoidResult(spreadExpression)) {
- return;
- }
- if (spreadExpressionType is InterfaceType) {
- if (_typeSystem.isSubtypeOf(
- spreadExpressionType, _typeProvider.iterableObjectType)) {
- InterfaceType iterableType =
- (spreadExpressionType as InterfaceTypeImpl)
- .asInstanceOf(_typeProvider.iterableType.element);
- if (iterableType != null) {
- // The `iterableType` will be `null` when `spreadExpressionType` is
- // `Null`. Fall through in that case to perform the default type
- // check.
- List<DartType> typeArguments = iterableType.typeArguments;
- if (typeArguments.length == 1) {
- _checkForAssignableExpressionAtType(
- spreadExpression, typeArguments[0], elementType, errorCode);
- return;
- }
- }
- } else if (_typeSystem.isSubtypeOf(
- spreadExpressionType, _typeProvider.mapObjectObjectType)) {
- // TODO(brianwilkerson) Handle spreads involving maps? This method
- // isn't currently called for maps, but might be if it's reworked as
- // expected.
-// InterfaceType mapType =
-// (spreadExpressionType as InterfaceTypeImpl)
-// .asInstanceOf(_typeProvider.mapType.element);
-// if (mapType != null) {
-// List<DartType> typeArguments = mapType.typeArguments;
-// if (typeArguments.length == 2) {
-// _checkForAssignableExpressionAtType(
-// spreadExpression, typeArguments[0], keyType, errorCode);
-// _checkForAssignableExpressionAtType(
-// spreadExpression, typeArguments[1], valueType, errorCode);
-// return;
-// }
-// }
- }
- }
- _checkForAssignableExpressionAtType(
- spreadExpression, spreadExpressionType, elementType, errorCode);
- }
- }
-
- /**
* Verify that the given [expression] can be assigned to its corresponding
* parameters. The [expectedStaticType] is the expected static type.
*
@@ -2544,34 +2514,6 @@
}
/**
- * Verify that the given [element] can be assigned to the [elementType] of the
- * enclosing list or set literal. Report an error with the given [errorCode]
- * if not.
- *
- * This method corresponds to
- * [BestPracticesVerifier.checkForArgumentTypeNotAssignableWithExpectedTypes].
- */
- void _checkForCollectionElementTypeNotAssignableWithElementType(
- CollectionElement element, DartType elementType, ErrorCode errorCode) {
- if (element is ForElement) {
- _checkForCollectionElementTypeNotAssignableWithElementType(
- element.body, elementType, errorCode);
- } else if (element is IfElement) {
- _checkForCollectionElementTypeNotAssignableWithElementType(
- element.thenElement, elementType, errorCode);
- _checkForCollectionElementTypeNotAssignableWithElementType(
- element.elseElement, elementType, errorCode);
- } else if (element is Expression) {
- _checkForArgumentTypeNotAssignable(
- element, elementType, getStaticType(element), errorCode);
- } else if (element is SpreadElement) {
- Expression expression = element.expression;
- _checkForArgumentTypeNotAssignableInSpread(
- expression, getStaticType(expression), elementType, errorCode);
- }
- }
-
- /**
* Verify that the [_enclosingClass] does not have a method and getter pair
* with the same name on, via inheritance.
*
@@ -2609,8 +2551,8 @@
_errorReporter.reportErrorForElement(
CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD, method, [
_enclosingClass.displayName,
- inherited.enclosingElement.displayName,
- name
+ name,
+ inherited.enclosingElement.displayName
]);
}
}
@@ -3063,7 +3005,7 @@
AstNode parent = node.parent;
Token awaitKeyword;
- if (parent is ForStatement2) {
+ if (parent is ForStatement) {
awaitKeyword = parent.awaitKeyword;
} else if (parent is ForElement) {
awaitKeyword = parent.awaitKeyword;
@@ -3175,32 +3117,6 @@
}
/**
- * Create a diagnostic if any of the leaf elements in the given collection of
- * [elements] is an expression.
- */
- void _checkForExpression(CollectionElement element) {
- if (element is ForElement) {
- _checkForExpression(element.body);
- } else if (element is IfElement) {
- _checkForExpression(element.thenElement);
- _checkForExpression(element.elseElement);
- } else if (element is Expression) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.EXPRESSION_IN_MAP, element);
- }
- }
-
- /**
- * Create a diagnostic if any of the leaf elements in the given collection of
- * [elements] is an expression.
- */
- void _checkForExpressions(NodeList<CollectionElement> elements) {
- for (CollectionElement element in elements) {
- _checkForExpression(element);
- }
- }
-
- /**
* Verify that the given extends [clause] does not extend a deferred class.
*
* See [CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS].
@@ -3398,7 +3314,7 @@
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
variable.name,
[variable.name.name]);
- } else {
+ } else if (!_isNonNullable || !variable.isLate) {
_errorReporter.reportErrorForNode(
StaticWarningCode.FINAL_NOT_INITIALIZED,
variable.name,
@@ -3778,6 +3694,46 @@
[directive.uri.stringValue]);
}
+ /// Checks a collection literal for an inference failure, and reports the
+ /// appropriate error if [AnalysisOptionsImpl.strictInference] is set.
+ ///
+ /// This checks if [node] does not have explicit or inferred type arguments.
+ /// When that happens, it reports a
+ /// HintCode.INFERENCE_FAILURE_ON_COLLECTION_LITERAL error.
+ void _checkForInferenceFailureOnCollectionLiteral(TypedLiteral node) {
+ if (!_options.strictInference || node == null) return;
+ if (node.typeArguments != null) {
+ // Type has explicit type arguments.
+ return;
+ }
+ var type = node.staticType;
+ if (_isMissingTypeArguments(node, type, type.element, node)) {
+ _errorReporter.reportErrorForNode(
+ HintCode.INFERENCE_FAILURE_ON_COLLECTION_LITERAL, node, [type.name]);
+ }
+ }
+
+ /// Checks a type on an instance creation expression for an inference
+ /// failure, and reports the appropriate error if
+ /// [AnalysisOptionsImpl.strictInference] is set.
+ ///
+ /// This checks if [node] refers to a generic type and does not have explicit
+ /// or inferred type arguments. When that happens, it reports a
+ /// HintMode.INFERENCE_FAILURE_ON_INSTANCE_CREATION error.
+ void _checkForInferenceFailureOnInstanceCreation(
+ TypeName node, InstanceCreationExpression inferenceContextNode) {
+ if (!_options.strictInference || node == null) return;
+ if (node.typeArguments != null) {
+ // Type has explicit type arguments.
+ return;
+ }
+ if (_isMissingTypeArguments(
+ node, node.type, node.name.staticElement, inferenceContextNode)) {
+ _errorReporter.reportErrorForNode(
+ HintCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION, node, [node.type]);
+ }
+ }
+
/**
* Check that the given [typeReference] is not a type reference and that then
* the [name] is reference to an instance member.
@@ -3954,6 +3910,17 @@
}
}
+ void _checkForListConstructor(
+ InstanceCreationExpression node, InterfaceType type) {
+ if (node.argumentList.arguments.length == 1 &&
+ _isDartCoreList(type) &&
+ _typeSystem.isPotentiallyNonNullable(type.typeArguments[0])) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.DEFAULT_LIST_CONSTRUCTOR_MISMATCH,
+ node.constructorName);
+ }
+ }
+
/**
* Verify that the elements of the given list [literal] are subtypes of the
* list's static type.
@@ -3975,85 +3942,16 @@
DartType listElementType = typeArguments[0];
// Check every list element.
- for (CollectionElement element in literal.elements2) {
- _checkForCollectionElementTypeNotAssignableWithElementType(element,
- listElementType, StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE);
- }
- }
-
- /**
- * Verify that the given [element] can be assigned to the [elementType] of the
- * enclosing list or set literal. Report an error with the given [errorCode]
- * if not.
- *
- * This method corresponds to
- * [BestPracticesVerifier.checkForArgumentTypeNotAssignableWithExpectedTypes].
- */
- void _checkForMapElementTypeNotAssignableWithKeyOrValueType(
- CollectionElement element,
- DartType keyType,
- DartType valueType,
- ErrorCode keyErrorCode,
- ErrorCode valueErrorCode) {
- if (element is ForElement) {
- _checkForMapElementTypeNotAssignableWithKeyOrValueType(
- element.body, keyType, valueType, keyErrorCode, valueErrorCode);
- } else if (element is IfElement) {
- _checkForMapElementTypeNotAssignableWithKeyOrValueType(
- element.thenElement,
- keyType,
- valueType,
- keyErrorCode,
- valueErrorCode);
- _checkForMapElementTypeNotAssignableWithKeyOrValueType(
- element.elseElement,
- keyType,
- valueType,
- keyErrorCode,
- valueErrorCode);
- } else if (element is MapLiteralEntry) {
- _checkForArgumentTypeNotAssignableWithExpectedTypes(
- element.key, keyType, keyErrorCode);
- _checkForArgumentTypeNotAssignableWithExpectedTypes(
- element.value, valueType, valueErrorCode);
- } else if (element is SpreadElement) {
- Expression expression = element.expression;
- DartType expressionType = getStaticType(expression);
- if (expressionType is ParameterizedType) {
- List<DartType> typeArguments = expressionType.typeArguments;
- if (typeArguments.length == 2) {
- _checkForArgumentTypeNotAssignable(
- expression, keyType, typeArguments[0], keyErrorCode);
- _checkForArgumentTypeNotAssignable(
- expression, valueType, typeArguments[1], valueErrorCode);
- }
- }
- }
- }
-
- /**
- * Create a diagnostic if any of the leaf elements in the given collection of
- * [elements] is a map entry.
- */
- void _checkForMapEntries(NodeList<CollectionElement> elements) {
- for (CollectionElement element in elements) {
- _checkForMapEntry(element);
- }
- }
-
- /**
- * Create a diagnostic if any of the leaf elements in the given collection of
- * [elements] is a map entry.
- */
- void _checkForMapEntry(CollectionElement element) {
- if (element is ForElement) {
- _checkForMapEntry(element.body);
- } else if (element is IfElement) {
- _checkForMapEntry(element.thenElement);
- _checkForMapEntry(element.elseElement);
- } else if (element is MapLiteralEntry) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.MAP_ENTRY_NOT_IN_MAP, element);
+ var verifier = LiteralElementVerifier(
+ _typeProvider,
+ _typeSystem,
+ _errorReporter,
+ _checkForUseOfVoidResult,
+ forList: true,
+ elementType: listElementType,
+ );
+ for (CollectionElement element in literal.elements) {
+ verifier.verify(element);
}
}
@@ -4078,14 +3976,17 @@
DartType keyType = typeArguments[0];
DartType valueType = typeArguments[1];
- NodeList<CollectionElement> entries = literal.elements2;
- for (CollectionElement entry in entries) {
- _checkForMapElementTypeNotAssignableWithKeyOrValueType(
- entry,
- keyType,
- valueType,
- StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
- StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE);
+ var verifier = LiteralElementVerifier(
+ _typeProvider,
+ _typeSystem,
+ _errorReporter,
+ _checkForUseOfVoidResult,
+ forMap: true,
+ mapKeyType: keyType,
+ mapValueType: valueType,
+ );
+ for (CollectionElement element in literal.elements) {
+ verifier.verify(element);
}
}
}
@@ -4230,6 +4131,24 @@
}
}
+ void _checkForMissingRequiredParam(
+ DartType type, ArgumentList argumentList, AstNode node) {
+ if (type is FunctionType) {
+ for (ParameterElement parameter in type.parameters) {
+ if (parameter.isRequiredNamed) {
+ String parameterName = parameter.name;
+ if (!RequiredConstantsComputer._containsNamedExpression(
+ argumentList, parameterName)) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT,
+ node,
+ [parameterName]);
+ }
+ }
+ }
+ }
+ }
+
/**
* Verify that the given function [body] does not contain return statements
* that both have and do not have return values.
@@ -4340,8 +4259,11 @@
if (!isSatisfied) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE,
- mixinName.name,
- [constraint.displayName]);
+ mixinName.name, [
+ mixinName.type.displayName,
+ _enclosingClass.supertype,
+ constraint.displayName
+ ]);
return true;
}
}
@@ -4488,7 +4410,7 @@
return;
}
MethodElement element = _findOverriddenMemberThatMustCallSuper(node);
- if (element != null) {
+ if (element != null && _hasConcreteSuperMethod(node)) {
_InvocationCollector collector = new _InvocationCollector();
node.accept(collector);
if (!collector.superCalls.contains(element.name)) {
@@ -4727,8 +4649,8 @@
if (expression == null ||
!_isNonNullable ||
expression.staticType == null ||
- (expression.staticType as TypeImpl).nullability !=
- Nullability.nullable) {
+ (expression.staticType as TypeImpl).nullabilitySuffix !=
+ NullabilitySuffix.question) {
return false;
}
@@ -4849,6 +4771,18 @@
}
/**
+ * Verify that the [type] is not potentially nullable.
+ */
+ void _checkForPotentiallyNullableType(TypeAnnotation type) {
+ if (_options.experimentStatus.non_nullable &&
+ type?.type != null &&
+ _typeSystem.isPotentiallyNullable(type.type)) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_CATCH_CLAUSE, type);
+ }
+ }
+
+ /**
* Check that the given named optional [parameter] does not begin with '_'.
*
* See [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER].
@@ -4870,69 +4804,6 @@
CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, parameter);
}
- /// Similar to [_checkForRawTypeName] but for list/map/set literals.
- void _checkForRawTypedLiteral(TypedLiteral node) {
- if (!_options.strictRawTypes || node == null) return;
- if (node.typeArguments != null) {
- // Type has explicit type arguments.
- return;
- }
- var type = node.staticType;
- return _checkForRawTypeErrors(node, type, type.element, node);
- }
-
- /// Given a [node] without type arguments that refers to [element], issues
- /// an error if [type] is a generic type, and the type arguments were not
- /// supplied from inference or a non-dynamic default instantiation.
- ///
- /// This function is used by other node-specific raw type checking functions
- /// (for example [_checkForRawTypeName]), and should only be called when
- /// we already know [AnalysisOptionsImpl.strictRawTypes] is true and [node]
- /// has no explicit `typeArguments`.
- ///
- /// [inferenceContextNode] is the node that has the downwards context type,
- /// if any. For example an [InstanceCreationExpression].
- ///
- /// The raw type error [HintCode.STRICT_RAW_TYPE] will *not* be reported when
- /// any of the following are true:
- ///
- /// - [inferenceContextNode] has an inference context type that does not
- /// contain `?`
- /// - [type] does not have any `dynamic` type arguments.
- /// - the element is marked with `@optionalTypeArgs` from "package:meta".
- void _checkForRawTypeErrors(AstNode node, DartType type, Element element,
- Expression inferenceContextNode) {
- assert(_options.strictRawTypes);
- // Check if this type has type arguments and at least one is dynamic.
- // If so, we may need to issue a strict-raw-types error.
- if (type is ParameterizedType &&
- type.typeArguments.any((t) => t.isDynamic)) {
- // If we have an inference context node, check if the type was inferred
- // from it. Some cases will not have a context type, such as the type
- // annotation `List` in `List list;`
- if (inferenceContextNode != null) {
- var contextType = InferenceContext.getContext(inferenceContextNode);
- if (contextType != null && UnknownInferredType.isKnown(contextType)) {
- // Type was inferred from downwards context: not an error.
- return;
- }
- }
- if (element.metadata.isNotEmpty) {
- for (var annotation in element.metadata) {
- var e = annotation.element;
- // TODO(jmesserly): similar "package:meta" annotations are added to
- // the element as boolean getters, that may be worth considering.
- if (e?.name == 'optionalTypeArgs' &&
- e.librarySource.uri.toString() == 'package:meta/meta.dart') {
- // Type is marked with `@optionalTypeArgs`: not an error.
- return;
- }
- }
- }
- _errorReporter.reportErrorForNode(HintCode.STRICT_RAW_TYPE, node, [type]);
- }
- }
-
/// Checks a type annotation for a raw generic type, and reports the
/// appropriate error if [AnalysisOptionsImpl.strictRawTypes] is set.
///
@@ -4945,16 +4816,11 @@
// Type has explicit type arguments.
return;
}
- var parent = node.parent;
- InstanceCreationExpression inferenceContextNode;
- if (parent is ConstructorName) {
- var grandparent = parent.parent;
- if (grandparent is InstanceCreationExpression) {
- inferenceContextNode = grandparent;
- }
+ if (_isMissingTypeArguments(
+ node, node.type, node.name.staticElement, null)) {
+ _errorReporter
+ .reportErrorForNode(HintCode.STRICT_RAW_TYPE, node, [node.type]);
}
- return _checkForRawTypeErrors(
- node, node.type, node.name.staticElement, inferenceContextNode);
}
/**
@@ -5129,10 +4995,8 @@
_hiddenElements != null &&
_hiddenElements.contains(node.staticElement) &&
node.parent is! CommentReference) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION,
- node,
- [node.name]);
+ _errorReporter.reportError(new DiagnosticFactory()
+ .referencedBeforeDeclaration(_errorReporter.source, node));
}
}
@@ -5298,9 +5162,16 @@
DartType setElementType = typeArguments[0];
// Check every set element.
- for (CollectionElement element in literal.elements2) {
- _checkForCollectionElementTypeNotAssignableWithElementType(element,
- setElementType, StaticWarningCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE);
+ var verifier = LiteralElementVerifier(
+ _typeProvider,
+ _typeSystem,
+ _errorReporter,
+ _checkForUseOfVoidResult,
+ forSet: true,
+ elementType: setElementType,
+ );
+ for (CollectionElement element in literal.elements) {
+ verifier.verify(element);
}
}
}
@@ -5387,7 +5258,7 @@
}
/**
- * Verify that the given type [name] is not a deferred type.
+ * Verify that the [type] is not a deferred type.
*
* See [StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS].
*/
@@ -5425,6 +5296,8 @@
// should be unnecessary.
FunctionTypeAliasElement typedefElement = element.enclosingElement;
parameterElements = typedefElement.typeParameters;
+ } else if (type is FunctionType) {
+ parameterElements = type.typeFormals;
} else {
// There are no other kinds of parameterized types.
throw new UnimplementedError(
@@ -5594,8 +5467,8 @@
}
if (target.staticType != null &&
- (target.staticType as TypeImpl).nullability ==
- Nullability.nonNullable) {
+ (target.staticType as TypeImpl).nullabilitySuffix ==
+ NullabilitySuffix.none) {
_errorReporter.reportErrorForToken(
HintCode.UNNECESSARY_NULL_AWARE_CALL, operator, []);
}
@@ -5792,7 +5665,7 @@
}
NodeList<FormalParameter> parameters = parameterList.parameters;
- if (parameters.length != 1 || !parameters[0].isRequired) {
+ if (parameters.length != 1 || !parameters[0].isRequiredPositional) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER,
setterName);
@@ -6035,6 +5908,59 @@
}
}
+ void _checkUseOfDefaultValuesInParameters(FormalParameterList node) {
+ AstNode parent = node.parent;
+ if (parent is FieldFormalParameter ||
+ parent is FunctionTypeAlias ||
+ parent is FunctionTypedFormalParameter ||
+ parent is GenericFunctionType) {
+ // These locations are not allowed to have default values.
+ return;
+ }
+ NodeList<FormalParameter> parameters = node.parameters;
+ int length = parameters.length;
+ for (int i = 0; i < length; i++) {
+ FormalParameter parameter = parameters[i];
+ if (parameter.isOptional) {
+ DartType type = parameter.declaredElement.type;
+ if (type.isDartAsyncFutureOr) {
+ type = (type as ParameterizedType).typeArguments[0];
+ }
+ if ((parameter as DefaultFormalParameter).defaultValue == null) {
+ if (_typeSystem.isPotentiallyNonNullable(type)) {
+ SimpleIdentifier parameterName = _parameterName(parameter);
+ if (type is TypeParameterType) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_OPTIONAL_PARAMETER_TYPE,
+ parameterName ?? parameter,
+ [parameterName?.name ?? '?']);
+ } else {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.MISSING_DEFAULT_VALUE_FOR_PARAMETER,
+ parameterName ?? parameter,
+ [parameterName?.name ?? '?']);
+ }
+ }
+ } else if (!_typeSystem.isNonNullable(type) &&
+ _typeSystem.isPotentiallyNonNullable(type)) {
+ // If the type is both potentially non-nullable and not
+ // non-nullable, then it cannot be used for an optional parameter.
+ SimpleIdentifier parameterName = _parameterName(parameter);
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_OPTIONAL_PARAMETER_TYPE,
+ parameterName ?? parameter,
+ [parameterName?.name ?? '?']);
+ }
+ } else if (parameter.isRequiredNamed) {
+ if ((parameter as DefaultFormalParameter).defaultValue != null) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER,
+ _parameterName(parameter) ?? parameter);
+ }
+ }
+ }
+ }
+
InterfaceType _findInterfaceTypeForMixin(TypeName mixin,
InterfaceType supertypeConstraint, List<InterfaceType> interfaceTypes) {
var element = supertypeConstraint.element;
@@ -6080,20 +6006,40 @@
return result;
}
+ /// Find a method which is overridden by [node] and which is annotated with
+ /// `@mustCallSuper`.
+ ///
+ /// As per the definition of `mustCallSuper` [1], every method which overrides
+ /// a method annotated with `@mustCallSuper` is implicitly annotated with
+ /// `@mustCallSuper`.
+ ///
+ /// [1] https://pub.dartlang.org/documentation/meta/latest/meta/mustCallSuper-constant.html
MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) {
- ExecutableElement overriddenMember =
- _getOverriddenMember(node.declaredElement);
- List<ExecutableElement> seen = <ExecutableElement>[];
- while (
- overriddenMember is MethodElement && !seen.contains(overriddenMember)) {
- for (ElementAnnotation annotation in overriddenMember.metadata) {
- if (annotation.isMustCallSuper) {
- return overriddenMember;
- }
+ Element member = node.declaredElement;
+ ClassElement classElement = member.enclosingElement;
+ String name = member.name;
+
+ // Walk up the type hierarchy from [classElement], ignoring direct interfaces.
+ Queue<ClassElement> superclasses =
+ Queue.of(classElement.mixins.map((i) => i.element))
+ ..addAll(classElement.superclassConstraints.map((i) => i.element))
+ ..add(classElement.supertype?.element);
+ Set<ClassElement> visitedClasses = new Set<ClassElement>();
+ while (superclasses.isNotEmpty) {
+ ClassElement ancestor = superclasses.removeFirst();
+ if (ancestor == null || !visitedClasses.add(ancestor)) {
+ continue;
}
- seen.add(overriddenMember);
- // Keep looking up the chain.
- overriddenMember = _getOverriddenMember(overriddenMember);
+ ExecutableElement member = ancestor.getMethod(name) ??
+ ancestor.getGetter(name) ??
+ ancestor.getSetter(name);
+ if (member is MethodElement && member.hasMustCallSuper) {
+ return member;
+ }
+ superclasses
+ ..addAll(ancestor.mixins.map((i) => i.element))
+ ..addAll(ancestor.superclassConstraints.map((i) => i.element))
+ ..add(ancestor.supertype?.element);
}
return null;
}
@@ -6200,23 +6146,6 @@
return buffer.toString();
}
- ExecutableElement _getOverriddenMember(Element member) {
- ClassElement classElement = member.enclosingElement;
- String name = member.name;
- ClassElement superclass = classElement.supertype?.element;
- Set<ClassElement> visitedClasses = new Set<ClassElement>();
- while (superclass != null && visitedClasses.add(superclass)) {
- ExecutableElement member = superclass.getMethod(name) ??
- superclass.getGetter(name) ??
- superclass.getSetter(name);
- if (member != null) {
- return member;
- }
- superclass = superclass.supertype?.element;
- }
- return null;
- }
-
/**
* Return the type of the first and only parameter of the given [setter].
*/
@@ -6230,6 +6159,19 @@
return setterParameters[0].type;
}
+ /// Returns whether [node] overrides a concrete method.
+ bool _hasConcreteSuperMethod(MethodDeclaration node) {
+ ClassElement classElement = node.declaredElement.enclosingElement;
+ String name = node.declaredElement.name;
+
+ Queue<ClassElement> superclasses =
+ Queue.of(classElement.mixins.map((i) => i.element))
+ ..addAll(classElement.superclassConstraints.map((i) => i.element))
+ ..add(classElement.supertype?.element);
+ return superclasses.any(
+ (parent) => parent.lookUpConcreteMethod(name, parent.library) != null);
+ }
+
/**
* Return `true` if the given [constructor] redirects to itself, directly or
* indirectly.
@@ -6261,6 +6203,9 @@
if (element == null) {
return false;
}
+ if (element is GenericTypeAliasElementImpl && element.linkedNode != null) {
+ return element.hasSelfReference;
+ }
var visitor = new _HasTypedefSelfReferenceVisitor(element.function);
element.accept(visitor);
return visitor.hasSelfReference;
@@ -6278,6 +6223,14 @@
}
}
+ bool _isDartCoreList(InterfaceType type) {
+ ClassElement element = type.element;
+ if (element == null) {
+ return false;
+ }
+ return element.name == "List" && element.library.isDartCore;
+ }
+
bool _isFunctionType(DartType type) {
if (type.isDynamic || type.isDartCoreNull) {
return true;
@@ -6291,6 +6244,46 @@
return false;
}
+ /// Given a [node] without type arguments that refers to [element], issues
+ /// an error if [type] is a generic type, and the type arguments were not
+ /// supplied from inference or a non-dynamic default instantiation.
+ ///
+ /// This function is used by other node-specific type checking functions, and
+ /// should only be called when [node] has no explicit `typeArguments`.
+ ///
+ /// [inferenceContextNode] is the node that has the downwards context type,
+ /// if any. For example an [InstanceCreationExpression].
+ ///
+ /// This function will return false if any of the following are true:
+ ///
+ /// - [inferenceContextNode] has an inference context type that does not
+ /// contain `?`
+ /// - [type] does not have any `dynamic` type arguments.
+ /// - the element is marked with `@optionalTypeArgs` from "package:meta".
+ bool _isMissingTypeArguments(AstNode node, DartType type, Element element,
+ Expression inferenceContextNode) {
+ // Check if this type has type arguments and at least one is dynamic.
+ // If so, we may need to issue a strict-raw-types error.
+ if (type is ParameterizedType &&
+ type.typeArguments.any((t) => t.isDynamic)) {
+ // If we have an inference context node, check if the type was inferred
+ // from it. Some cases will not have a context type, such as the type
+ // annotation `List` in `List list;`
+ if (inferenceContextNode != null) {
+ var contextType = InferenceContext.getContext(inferenceContextNode);
+ if (contextType != null && UnknownInferredType.isKnown(contextType)) {
+ // Type was inferred from downwards context: not an error.
+ return false;
+ }
+ }
+ if (element.hasOptionalTypeArgs) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
/**
* Return `true` if the given 'this' [expression] is in a valid context.
*/
@@ -6343,6 +6336,17 @@
return false;
}
+ /// Return the name of the [parameter], or `null` if the parameter does not
+ /// have a name.
+ SimpleIdentifier _parameterName(FormalParameter parameter) {
+ if (parameter is NormalFormalParameter) {
+ return parameter.identifier;
+ } else if (parameter is DefaultFormalParameter) {
+ return parameter.parameter.identifier;
+ }
+ return null;
+ }
+
/// Determines if the given [typeName] occurs in a context where super-bounded
/// types are allowed.
bool _shouldAllowSuperBoundedTypes(TypeName typeName) {
@@ -6557,7 +6561,7 @@
DartType type, ArgumentList argumentList, AstNode node) {
if (type is FunctionType) {
for (ParameterElement parameter in type.parameters) {
- if (parameter.isNamed) {
+ if (parameter.isOptionalNamed) {
ElementAnnotationImpl annotation = _getRequiredAnnotation(parameter);
if (annotation != null) {
String parameterName = parameter.name;
@@ -6572,7 +6576,11 @@
}
}
- bool _containsNamedExpression(ArgumentList args, String name) {
+ ElementAnnotationImpl _getRequiredAnnotation(ParameterElement param) => param
+ .metadata
+ .firstWhere((ElementAnnotation e) => e.isRequired, orElse: () => null);
+
+ static bool _containsNamedExpression(ArgumentList args, String name) {
NodeList<Expression> arguments = args.arguments;
for (int i = arguments.length - 1; i >= 0; i--) {
Expression expression = arguments[i];
@@ -6584,10 +6592,6 @@
}
return false;
}
-
- ElementAnnotationImpl _getRequiredAnnotation(ParameterElement param) => param
- .metadata
- .firstWhere((ElementAnnotation e) => e.isRequired, orElse: () => null);
}
class _HasTypedefSelfReferenceVisitor extends GeneralizingElementVisitor<void> {
diff --git a/analyzer/lib/src/generated/parser.dart b/analyzer/lib/src/generated/parser.dart
index cd39326..21a62ae 100644
--- a/analyzer/lib/src/generated/parser.dart
+++ b/analyzer/lib/src/generated/parser.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -7,6 +7,7 @@
import 'dart:collection';
import "dart:math" as math;
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
@@ -194,18 +195,37 @@
bool allowNativeClause;
+ FeatureSet _featureSet;
+
/// Initialize a newly created parser to parse tokens in the given [_source]
/// and to report any errors that are found to the given [_errorListener].
+ ///
+ /// In a future major version release of the analyzer, the [featureSet]
+ /// argument will be required.
factory Parser(Source source, AnalysisErrorListener errorListener,
- {bool useFasta}) {
+ {bool useFasta, FeatureSet featureSet}) {
if (useFasta ?? Parser.useFasta) {
- return new _Parser2(source, errorListener, allowNativeClause: true);
+ var parser = new _Parser2(source, errorListener, allowNativeClause: true);
+ if (featureSet != null) {
+ parser.configureFeatures(featureSet);
+ }
+ return parser;
} else {
- return new Parser.withoutFasta(source, errorListener);
+ return new Parser.withoutFasta(source, errorListener,
+ featureSet: featureSet);
}
}
- Parser.withoutFasta(this._source, this._errorListener);
+ /// Creates a parser using the old (legacy) analyzer parsing logic.
+ ///
+ /// In a future major version release of the analyzer, the [featureSet]
+ /// argument will be required.
+ Parser.withoutFasta(this._source, this._errorListener,
+ {FeatureSet featureSet}) {
+ if (featureSet != null) {
+ _configureFeatures(featureSet);
+ }
+ }
/// Return the current token.
Token get currentToken => _currentToken;
@@ -226,6 +246,7 @@
void set enableAssertInitializer(bool enable) {}
/// Enables or disables parsing of control flow collections.
+ @Deprecated('Pass a FeatureSet to the constructor instead')
void set enableControlFlowCollections(bool value) {
if (value) {
throw new UnimplementedError('control_flow_collections experiment'
@@ -234,6 +255,7 @@
}
/// Enables or disables non-nullable by default.
+ @Deprecated('Pass a FeatureSet to the constructor instead')
void set enableNonNullable(bool value) {
if (value) {
throw new UnimplementedError(
@@ -258,6 +280,7 @@
}
/// Enables or disables parsing of spread collections.
+ @Deprecated('Pass a FeatureSet to the constructor instead')
void set enableSpreadCollections(bool value) {
if (value) {
throw new UnimplementedError(
@@ -265,6 +288,15 @@
}
}
+ /// Enables or disables parsing of the triple shift operators.
+ @Deprecated('Pass a FeatureSet to the constructor instead')
+ void set enableTripleShift(bool value) {
+ if (value) {
+ throw new UnimplementedError('triple_shift experiment'
+ ' not supported by analyzer parser');
+ }
+ }
+
/// Return `true` if the parser is to allow URI's in part-of directives.
@deprecated
bool get enableUriInPartOf => true;
@@ -331,6 +363,12 @@
return buffer.toString();
}
+ /// Configures the parser appropriately for the given [featureSet].
+ @Deprecated('Pass a FeatureSet to the constructor instead')
+ void configureFeatures(FeatureSet featureSet) {
+ _configureFeatures(featureSet);
+ }
+
/// Return a synthetic identifier.
SimpleIdentifier createSyntheticIdentifier({bool isDeclaration: false}) {
Token syntheticToken;
@@ -1612,7 +1650,8 @@
try {
BooleanErrorListener listener = new BooleanErrorListener();
Scanner scanner = new Scanner(
- null, new SubSequenceReader(referenceSource, sourceOffset), listener);
+ null, new SubSequenceReader(referenceSource, sourceOffset), listener)
+ ..configureFeatures(_featureSet);
scanner.setSourceStart(1, 1);
Token firstToken = scanner.tokenize();
if (listener.errorReported) {
@@ -1898,7 +1937,8 @@
} on _TooDeepTreeError {
_reportErrorForToken(ParserErrorCode.STACK_OVERFLOW, _currentToken);
Token eof = new Token.eof(0);
- return astFactory.compilationUnit(eof, null, null, null, eof);
+ return astFactory.compilationUnit2(
+ beginToken: eof, endToken: eof, featureSet: _featureSet);
}
if (member != null) {
declarations.add(member);
@@ -1947,8 +1987,13 @@
// }
}
}
- return astFactory.compilationUnit(
- firstToken, scriptTag, directives, declarations, _currentToken);
+ return astFactory.compilationUnit2(
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ declarations: declarations,
+ endToken: _currentToken,
+ featureSet: _featureSet);
}
/// Parse a compilation unit member. The [commentAndMetadata] is the metadata
@@ -2398,12 +2443,20 @@
while (!_matches(TokenType.EOF)) {
_advance();
}
- return astFactory.compilationUnit(
- firstToken, scriptTag, directives, null, _currentToken);
+ return astFactory.compilationUnit2(
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ endToken: _currentToken,
+ featureSet: _featureSet);
}
}
- return astFactory.compilationUnit(
- firstToken, scriptTag, directives, null, _currentToken);
+ return astFactory.compilationUnit2(
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ endToken: _currentToken,
+ featureSet: _featureSet);
}
/// Parse a documentation comment based on the given list of documentation
@@ -2962,7 +3015,7 @@
inKeyword: inKeyword,
iterable: iterator);
}
- return astFactory.forStatement2(
+ return astFactory.forStatement(
forKeyword: forKeyword,
leftParenthesis: leftParenthesis,
forLoopParts: forLoopParts,
@@ -3002,7 +3055,7 @@
}
Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
Statement body = parseStatement2();
- return astFactory.forStatement2(
+ return astFactory.forStatement(
forKeyword: forKeyword,
leftParenthesis: leftParenthesis,
forLoopParts: forLoopParts,
@@ -3679,9 +3732,11 @@
Token modifier, TypeArgumentList typeArguments) {
Token leftBracket = getAndAdvance();
if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
- // ignore: deprecated_member_use_from_same_package
- return astFactory.mapLiteral(
- modifier, typeArguments, leftBracket, null, getAndAdvance());
+ return astFactory.setOrMapLiteral(
+ constKeyword: modifier,
+ typeArguments: typeArguments,
+ leftBracket: leftBracket,
+ rightBracket: getAndAdvance());
}
bool wasInInitializer = _inInitializer;
_inInitializer = false;
@@ -3689,16 +3744,22 @@
List<MapLiteralEntry> entries = <MapLiteralEntry>[parseMapLiteralEntry()];
while (_optional(TokenType.COMMA)) {
if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
- // ignore: deprecated_member_use_from_same_package
- return astFactory.mapLiteral(
- modifier, typeArguments, leftBracket, entries, getAndAdvance());
+ return astFactory.setOrMapLiteral(
+ constKeyword: modifier,
+ typeArguments: typeArguments,
+ leftBracket: leftBracket,
+ elements: entries,
+ rightBracket: getAndAdvance());
}
entries.add(parseMapLiteralEntry());
}
Token rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET);
- // ignore: deprecated_member_use_from_same_package
- return astFactory.mapLiteral(
- modifier, typeArguments, leftBracket, entries, rightBracket);
+ return astFactory.setOrMapLiteral(
+ constKeyword: modifier,
+ typeArguments: typeArguments,
+ leftBracket: leftBracket,
+ elements: entries,
+ rightBracket: rightBracket);
} finally {
_inInitializer = wasInInitializer;
}
@@ -4032,7 +4093,7 @@
_tokenMatchesKeyword(_peek(), Keyword.FOR)) {
Token awaitToken = _currentToken;
Statement statement = parseForStatement();
- if (!(statement is ForStatement2 && statement.forLoopParts is ForParts)) {
+ if (!(statement is ForStatement && statement.forLoopParts is ForParts)) {
_reportErrorForToken(
CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT, awaitToken);
}
@@ -5535,6 +5596,26 @@
return false;
}
+ void _configureFeatures(FeatureSet featureSet) {
+ if (featureSet.isEnabled(Feature.control_flow_collections)) {
+ throw new UnimplementedError('control_flow_collections experiment'
+ ' not supported by analyzer parser');
+ }
+ if (featureSet.isEnabled(Feature.non_nullable)) {
+ throw new UnimplementedError(
+ 'non-nullable experiment not supported by analyzer parser');
+ }
+ if (featureSet.isEnabled(Feature.spread_collections)) {
+ throw new UnimplementedError(
+ 'spread_collections experiment not supported by analyzer parser');
+ }
+ if (featureSet.isEnabled(Feature.triple_shift)) {
+ throw new UnimplementedError('triple_shift experiment'
+ ' not supported by analyzer parser');
+ }
+ _featureSet = featureSet;
+ }
+
/// Convert the given [method] declaration into the nearest valid top-level
/// function declaration (that is, the function declaration that most closely
/// captures the components of the given method declaration).
diff --git a/analyzer/lib/src/generated/parser_fasta.dart b/analyzer/lib/src/generated/parser_fasta.dart
index b93eb52..f7c72e0 100644
--- a/analyzer/lib/src/generated/parser_fasta.dart
+++ b/analyzer/lib/src/generated/parser_fasta.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -24,12 +24,15 @@
final AstBuilder astBuilder;
ParserAdapter(this.currentToken, ErrorReporter errorReporter, Uri fileUri,
- {bool allowNativeClause: false})
+ {bool allowNativeClause: false, FeatureSet featureSet})
: fastaParser = new fasta.Parser(null),
astBuilder = new AstBuilder(errorReporter, fileUri, true) {
fastaParser.listener = astBuilder;
astBuilder.parser = fastaParser;
astBuilder.allowNativeClause = allowNativeClause;
+ if (featureSet != null) {
+ astBuilder.configureFeatures(featureSet);
+ }
}
@override
@@ -37,6 +40,16 @@
astBuilder.allowNativeClause = value;
}
+ @override
+ void set enableControlFlowCollections(bool value) {
+ if (IsExpired.control_flow_collections &&
+ value != IsEnabledByDefault.control_flow_collections) {
+ throw new StateError('control_flow_collections may only be set'
+ ' to ${IsEnabledByDefault.control_flow_collections}');
+ }
+ astBuilder.enableControlFlowCollections = value;
+ }
+
/// Enables or disables non-nullable by default.
void set enableNonNullable(bool value) {
if (IsExpired.non_nullable && value != IsEnabledByDefault.non_nullable) {
@@ -69,13 +82,12 @@
}
@override
- void set enableControlFlowCollections(bool value) {
- if (IsExpired.control_flow_collections &&
- value != IsEnabledByDefault.control_flow_collections) {
- throw new StateError('control_flow_collections may only be set'
- ' to ${IsEnabledByDefault.control_flow_collections}');
+ void set enableTripleShift(bool value) {
+ if (IsExpired.triple_shift && value != IsEnabledByDefault.triple_shift) {
+ throw new StateError('triple_shift may only be set'
+ ' to ${IsEnabledByDefault.triple_shift}');
}
- astBuilder.enableControlFlowCollections = value;
+ astBuilder.enableTripleShift = value;
}
@override
@@ -99,6 +111,11 @@
}
@override
+ void configureFeatures(FeatureSet featureSet) {
+ astBuilder.configureFeatures(featureSet);
+ }
+
+ @override
Expression parseAdditiveExpression() => parseExpression2();
@override
diff --git a/analyzer/lib/src/generated/resolver.dart b/analyzer/lib/src/generated/resolver.dart
index 88fce5b..94b83c9 100644
--- a/analyzer/lib/src/generated/resolver.dart
+++ b/analyzer/lib/src/generated/resolver.dart
@@ -4,6 +4,7 @@
import 'dart:collection';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/ast_factory.dart';
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
@@ -26,6 +27,7 @@
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/exit_detector.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
+import 'package:analyzer/src/diagnostic/diagnostic_factory.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/element_resolver.dart';
@@ -298,7 +300,9 @@
BestPracticesVerifier(
this._errorReporter,
TypeProvider typeProvider,
- this._currentLibrary, {
+ this._currentLibrary,
+ CompilationUnit unit,
+ String content, {
TypeSystem typeSystem,
ResourceProvider resourceProvider,
DeclaredVariables declaredVariables,
@@ -317,7 +321,7 @@
_workspacePackage = workspace.findPackageFor(libraryPath);
_linterContext = LinterContextImpl(
null /* allUnits */,
- null /* currentUnit */,
+ new LinterContextUnit(content, unit),
declaredVariables,
typeProvider,
_typeSystem,
@@ -743,15 +747,6 @@
return false;
}
- bool isLibraryInWorkspacePackage(LibraryElement library) {
- if (_workspacePackage == null || library == null) {
- // Better to not make a big claim that they _are_ in the same package,
- // if we were unable to determine what package [_currentLibrary] is in.
- return false;
- }
- return _workspacePackage.contains(library.source.fullName);
- }
-
if (!_inDeprecatedMember &&
element != null &&
isDeprecated(element) &&
@@ -776,7 +771,7 @@
}
LibraryElement library =
element is LibraryElement ? element : element.library;
- HintCode hintCode = isLibraryInWorkspacePackage(library)
+ HintCode hintCode = _isLibraryInWorkspacePackage(library)
? HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE
: HintCode.DEPRECATED_MEMBER_USE;
_errorReporter.reportErrorForNode(hintCode, node, [displayName]);
@@ -972,8 +967,7 @@
void _checkForInvalidSealedSuperclass(NamedCompilationUnitMember node) {
bool currentPackageContains(Element element) {
- String elementLibraryPath = element.library.source.fullName;
- return _workspacePackage.contains(elementLibraryPath);
+ return _isLibraryInWorkspacePackage(element.library);
}
// [NamedCompilationUnitMember.declaredElement] is not necessarily a
@@ -1278,6 +1272,15 @@
}
}
+ bool _isLibraryInWorkspacePackage(LibraryElement library) {
+ if (_workspacePackage == null || library == null) {
+ // Better to not make a big claim that they _are_ in the same package,
+ // if we were unable to determine what package [_currentLibrary] is in.
+ return false;
+ }
+ return _workspacePackage.contains(library.source);
+ }
+
/// Check for the passed class declaration for the
/// [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE] hint code.
///
@@ -1833,7 +1836,7 @@
}
void _checkForDeadNullCoalesce(TypeImpl lhsType, Expression rhs) {
- if (lhsType.nullability == Nullability.nonNullable) {
+ if (_isNonNullableUnit && _typeSystem.isNonNullable(lhsType)) {
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, rhs, []);
}
}
@@ -3331,9 +3334,10 @@
Source source,
TypeProvider typeProvider,
AnalysisErrorListener errorListener,
+ FeatureSet featureSet,
{Scope nameScope})
: super(inheritance, definingLibrary, source, typeProvider, errorListener,
- nameScope: nameScope);
+ featureSet: featureSet, nameScope: nameScope);
/// Resolve the instance fields in the given compilation unit [node].
void resolveCompilationUnit(CompilationUnit node) {
@@ -3509,9 +3513,10 @@
Source source,
TypeProvider typeProvider,
AnalysisErrorListener errorListener,
+ FeatureSet featureSet,
{Scope nameScope})
: super(inheritance, definingLibrary, source, typeProvider, errorListener,
- nameScope: nameScope);
+ featureSet: featureSet, nameScope: nameScope);
@override
void visitBlockFunctionBody(BlockFunctionBody node) {
@@ -3622,10 +3627,6 @@
const ResolverErrorCode('CONTINUE_LABEL_ON_SWITCH',
"A continue label resolves to switch, must be loop or switch member");
- static const ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART =
- const ResolverErrorCode('MISSING_LIBRARY_DIRECTIVE_WITH_PART',
- "Libraries that have parts must have a library directive");
-
/// Parts: It is a static warning if the referenced part declaration
/// <i>p</i> names a library that does not have a library tag.
///
@@ -3636,7 +3637,7 @@
const ResolverErrorCode(
'PART_OF_UNNAMED_LIBRARY',
"Library is unnamed. Expected a URI not a library name '{0}' in the "
- "part-of directive.",
+ "part-of directive.",
correction:
"Try changing the part-of directive to a URI, or try including a"
" different part.");
@@ -3665,6 +3666,8 @@
final AnalysisOptionsImpl _analysisOptions;
+ final bool _uiAsCodeEnabled;
+
/// The object used to resolve the element associated with the current node.
ElementResolver elementResolver;
@@ -3722,16 +3725,45 @@
/// the node that will first be visited. If `null` or unspecified, a new
/// [LibraryScope] will be created based on [definingLibrary] and
/// [typeProvider].
+ ///
+ /// TODO(paulberry): make [featureSet] a required parameter (this will be a
+ /// breaking change).
ResolverVisitor(
+ InheritanceManager2 inheritance,
+ LibraryElement definingLibrary,
+ Source source,
+ TypeProvider typeProvider,
+ AnalysisErrorListener errorListener,
+ {FeatureSet featureSet,
+ Scope nameScope,
+ bool propagateTypes: true,
+ reportConstEvaluationErrors: true})
+ : this._(
+ inheritance,
+ definingLibrary,
+ source,
+ typeProvider,
+ errorListener,
+ featureSet ??
+ definingLibrary.context.analysisOptions.contextFeatures,
+ nameScope,
+ propagateTypes,
+ reportConstEvaluationErrors);
+
+ ResolverVisitor._(
this.inheritance,
LibraryElement definingLibrary,
Source source,
TypeProvider typeProvider,
AnalysisErrorListener errorListener,
- {Scope nameScope,
- bool propagateTypes: true,
- reportConstEvaluationErrors: true})
+ FeatureSet featureSet,
+ Scope nameScope,
+ bool propagateTypes,
+ reportConstEvaluationErrors)
: _analysisOptions = definingLibrary.context.analysisOptions,
+ _uiAsCodeEnabled =
+ featureSet.isEnabled(Feature.control_flow_collections) ||
+ featureSet.isEnabled(Feature.spread_collections),
super(definingLibrary, source, typeProvider, errorListener,
nameScope: nameScope) {
this.elementResolver = new ElementResolver(this,
@@ -3855,6 +3887,17 @@
// TODO(brianwilkerson) Remove this method.
}
+ /// Set information about enclosing declarations.
+ void prepareEnclosingDeclarations({
+ ClassElement enclosingClassElement,
+ ExecutableElement enclosingExecutableElement,
+ }) {
+ _enclosingClassDeclaration = null;
+ enclosingClass = enclosingClassElement;
+ typeAnalyzer.thisType = enclosingClass?.type;
+ _enclosingFunction = enclosingExecutableElement;
+ }
+
/// A client is about to resolve a member in the given class declaration.
void prepareToResolveMembersInClass(ClassDeclaration node) {
_enclosingClassDeclaration = node;
@@ -4377,7 +4420,7 @@
}
@override
- void visitForStatement2InScope(ForStatement2 node) {
+ void visitForStatementInScope(ForStatement node) {
ForLoopParts forLoopParts = node.forLoopParts;
if (forLoopParts is ForParts) {
if (forLoopParts is ForPartsWithDeclarations) {
@@ -4623,7 +4666,7 @@
DartType elementType = listType.typeArguments[0];
DartType iterableType =
typeProvider.iterableType.instantiate([elementType]);
- _pushCollectionTypesDownToAll(node.elements2,
+ _pushCollectionTypesDownToAll(node.elements,
elementType: elementType, iterableType: iterableType);
InferenceContext.setType(node, listType);
} else {
@@ -4633,7 +4676,6 @@
}
@override
- @override
void visitMethodDeclaration(MethodDeclaration node) {
ExecutableElement outerFunction = _enclosingFunction;
FunctionBody outerFunctionBody = _currentFunctionBody;
@@ -4798,31 +4840,19 @@
DartType elementType = literalType.typeArguments[0];
DartType iterableType =
typeProvider.iterableType.instantiate([elementType]);
- _pushCollectionTypesDownToAll(node.elements2,
+ _pushCollectionTypesDownToAll(node.elements,
elementType: elementType, iterableType: iterableType);
- if (!_analysisOptions.experimentStatus.spread_collections &&
- !_analysisOptions.experimentStatus.control_flow_collections &&
- node.elements2.isEmpty &&
+ if (!_uiAsCodeEnabled &&
+ node.elements.isEmpty &&
node.typeArguments == null &&
node.isMap) {
// The node is really an empty set literal with no type arguments.
- // Rewrite the AST.
- // ignore: deprecated_member_use_from_same_package
- SetOrMapLiteral setLiteral = new AstFactoryImpl().setLiteral(
- node.constKeyword,
- null,
- node.leftBracket,
- null,
- node.rightBracket);
- InferenceContext.setType(
- setLiteral, InferenceContext.getContext(node));
- NodeReplacer.replace(node, setLiteral);
- node = setLiteral;
+ (node as SetOrMapLiteralImpl).becomeMap();
}
} else if (typeArguments.length == 2) {
DartType keyType = typeArguments[0];
DartType valueType = typeArguments[1];
- _pushCollectionTypesDownToAll(node.elements2,
+ _pushCollectionTypesDownToAll(node.elements,
iterableType: literalType, keyType: keyType, valueType: valueType);
}
(node as SetOrMapLiteralImpl).contextType = literalType;
@@ -4954,7 +4984,13 @@
InterfaceType wrapperType = _enclosingFunction.isSynchronous
? typeProvider.iterableType
: typeProvider.streamType;
- type = typeSystem.mostSpecificTypeArgument(type, wrapperType);
+ if (type is InterfaceType) {
+ var asInstanceType =
+ (type as InterfaceTypeImpl).asInstanceOf(wrapperType.element);
+ if (asInstanceType != null) {
+ type = asInstanceType.typeArguments[0];
+ }
+ }
}
if (type != null) {
inferenceContext.addReturnOrYieldType(type);
@@ -5029,7 +5065,7 @@
_fromTypeArguments(literal.typeArguments);
DartType contextType = InferenceContext.getContext(literal);
_LiteralResolution contextResolution = _fromContextType(contextType);
- _LeafElements elementCounts = new _LeafElements(literal.elements2);
+ _LeafElements elementCounts = new _LeafElements(literal.elements);
_LiteralResolution elementResolution = elementCounts.resolution;
List<_LiteralResolution> unambiguousResolutions = [];
@@ -5070,7 +5106,7 @@
: unambiguousResolutions[0];
} else if (unambiguousResolutions.length == 1) {
return unambiguousResolutions[0];
- } else if (literal.elements2.isEmpty) {
+ } else if (literal.elements.isEmpty) {
return _LiteralResolution(
_LiteralResolutionKind.map,
typeProvider.mapType.instantiate(
@@ -5163,7 +5199,7 @@
FunctionType _inferArgumentTypesForGeneric(AstNode inferenceNode,
DartType uninstantiatedType, TypeArgumentList typeArguments,
- {AstNode errorNode}) {
+ {AstNode errorNode, bool isConst: false}) {
errorNode ??= inferenceNode;
TypeSystem ts = typeSystem;
if (typeArguments == null &&
@@ -5176,6 +5212,7 @@
const <DartType>[],
InferenceContext.getContext(inferenceNode),
downwards: true,
+ isConst: isConst,
errorReporter: errorReporter,
errorNode: errorNode);
}
@@ -5217,7 +5254,7 @@
inferred = _inferArgumentTypesForGeneric(
node, constructorType, constructor.type.typeArguments,
- errorNode: node.constructorName);
+ isConst: node.isConst, errorNode: node.constructorName);
if (inferred != null) {
ArgumentList arguments = node.argumentList;
@@ -5427,7 +5464,7 @@
int length = parameters.length;
for (int i = 0; i < length; i++) {
ParameterElement parameter = parameters[i];
- if (parameter.isNotOptional) {
+ if (parameter.isRequiredPositional) {
unnamedParameters.add(parameter);
unnamedParameterCount++;
requiredParameterCount++;
@@ -5835,13 +5872,13 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement(ForStatement node) {
Scope outerNameScope = nameScope;
ImplicitLabelScope outerImplicitScope = _implicitLabelScope;
try {
nameScope = new EnclosedScope(nameScope);
_implicitLabelScope = _implicitLabelScope.nest(node);
- visitForStatement2InScope(node);
+ visitForStatementInScope(node);
} finally {
nameScope = outerNameScope;
_implicitLabelScope = outerImplicitScope;
@@ -5851,7 +5888,7 @@
/// Visit the given [node] after it's scope has been created. This replaces
/// the normal call to the inherited visit method so that ResolverVisitor can
/// intervene when type propagation is enabled.
- void visitForStatement2InScope(ForStatement2 node) {
+ void visitForStatementInScope(ForStatement node) {
// TODO(brianwilkerson) Investigate the possibility of removing the
// visit...InScope methods now that type propagation is no longer done.
node.forLoopParts?.accept(this);
@@ -5946,8 +5983,7 @@
new CaughtException(new AnalysisException(), null));
} else {
nameScope = new EnclosedScope(nameScope);
- GenericFunctionTypeElement typeElement = parameterElement.type.element;
- List<TypeParameterElement> typeParameters = typeElement.typeParameters;
+ var typeParameters = parameterElement.typeParameters;
int length = typeParameters.length;
for (int i = 0; i < length; i++) {
nameScope.define(typeParameters[i]);
@@ -6254,7 +6290,6 @@
class TypeNameResolver {
final TypeSystem typeSystem;
final DartType dynamicType;
- final DartType undefinedType;
final bool isNonNullableUnit;
final AnalysisOptionsImpl analysisOptions;
final LibraryElement definingLibrary;
@@ -6279,7 +6314,6 @@
this.errorListener,
{this.shouldUseWithClauseInferredTypes: true})
: dynamicType = typeProvider.dynamicType,
- undefinedType = typeProvider.undefinedType,
analysisOptions = definingLibrary.context.analysisOptions;
/// Report an error with the given error code and arguments.
@@ -6321,8 +6355,8 @@
return;
}
if (nameScope.shouldIgnoreUndefined(typeName)) {
- typeName.staticType = undefinedType;
- node.type = undefinedType;
+ typeName.staticType = dynamicType;
+ node.type = dynamicType;
return;
}
//
@@ -6342,8 +6376,8 @@
element = nameScope.lookup(prefix, definingLibrary);
if (element is PrefixElement) {
if (nameScope.shouldIgnoreUndefined(typeName)) {
- typeName.staticType = undefinedType;
- node.type = undefinedType;
+ typeName.staticType = dynamicType;
+ node.type = dynamicType;
return;
}
AstNode grandParent = parent.parent;
@@ -6381,8 +6415,8 @@
}
}
if (nameScope.shouldIgnoreUndefined(typeName)) {
- typeName.staticType = undefinedType;
- node.type = undefinedType;
+ typeName.staticType = dynamicType;
+ node.type = dynamicType;
return;
}
}
@@ -6499,8 +6533,8 @@
if (element is MultiplyDefinedElement) {
_setElement(typeName, element);
}
- typeName.staticType = undefinedType;
- node.type = undefinedType;
+ typeName.staticType = dynamicType;
+ node.type = dynamicType;
return;
}
@@ -6513,6 +6547,9 @@
if (element == DynamicElementImpl.instance) {
_setElement(typeName, element);
type = DynamicTypeImpl.instance;
+ } else if (element is NeverElementImpl) {
+ _setElement(typeName, element);
+ type = element.type;
} else if (element is FunctionTypeAliasElement) {
_setElement(typeName, element);
type = element.type as TypeImpl;
@@ -6558,8 +6595,8 @@
} else if (element is LocalVariableElement ||
(element is FunctionElement &&
element.enclosingElement is ExecutableElement)) {
- reportErrorForNode(CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION,
- typeName, [typeName.name]);
+ errorListener.onError(new DiagnosticFactory()
+ .referencedBeforeDeclaration(source, typeName, element: element));
} else {
reportErrorForNode(
StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]);
@@ -6638,16 +6675,16 @@
return StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
}
- Nullability _getNullability(bool hasQuestion) {
- Nullability nullability;
+ NullabilitySuffix _getNullability(bool hasQuestion) {
+ NullabilitySuffix nullability;
if (isNonNullableUnit) {
if (hasQuestion) {
- nullability = Nullability.nullable;
+ nullability = NullabilitySuffix.question;
} else {
- nullability = Nullability.nonNullable;
+ nullability = NullabilitySuffix.none;
}
} else {
- nullability = Nullability.indeterminate;
+ nullability = NullabilitySuffix.star;
}
return nullability;
}
@@ -6673,7 +6710,7 @@
DartType _getType(TypeAnnotation annotation) {
DartType type = annotation.type;
if (type == null) {
- return undefinedType;
+ return dynamicType;
}
return type;
}
@@ -6791,6 +6828,25 @@
bool _isTypeNameInTypeArgumentList(TypeName typeName) =>
typeName.parent is TypeArgumentList;
+ /// Given a [typeName] that has a question mark, report an error and return
+ /// `true` if it appears in a location where a nullable type is not allowed.
+ void _reportInvalidNullableType(TypeName typeName) {
+ AstNode parent = typeName.parent;
+ if (parent is ExtendsClause || parent is ClassTypeAlias) {
+ reportErrorForNode(
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_EXTENDS_CLAUSE, typeName);
+ } else if (parent is ImplementsClause) {
+ reportErrorForNode(
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE, typeName);
+ } else if (parent is OnClause) {
+ reportErrorForNode(
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_ON_CLAUSE, typeName);
+ } else if (parent is WithClause) {
+ reportErrorForNode(
+ CompileTimeErrorCode.NULLABLE_TYPE_IN_WITH_CLAUSE, typeName);
+ }
+ }
+
void _resolveClassElement(TypeName node, Identifier typeName,
TypeArgumentList argumentList, ClassElement element) {
_setElement(typeName, element);
@@ -6830,19 +6886,22 @@
var parent = node.parent;
- Nullability nullability;
+ NullabilitySuffix nullabilitySuffix;
if (parent is ClassTypeAlias ||
parent is ExtendsClause ||
parent is ImplementsClause ||
parent is OnClause ||
parent is WithClause) {
- nullability = Nullability.nonNullable;
+ if (node.question != null) {
+ _reportInvalidNullableType(node);
+ }
+ nullabilitySuffix = NullabilitySuffix.none;
} else {
- nullability = _getNullability(node.question != null);
+ nullabilitySuffix = _getNullability(node.question != null);
}
var type = InterfaceTypeImpl.explicit(element, typeArguments,
- nullability: nullability);
+ nullabilitySuffix: nullabilitySuffix);
if (shouldUseWithClauseInferredTypes) {
if (parent is WithClause && parameterCount != 0) {
@@ -7168,6 +7227,9 @@
/// Return the type representing the built-in type 'Map'.
InterfaceType get mapType;
+ /// Return the type representing the built-in type 'Never'.
+ DartType get neverType;
+
/// Return a list containing all of the types that cannot be either extended
/// or implemented.
List<InterfaceType> get nonSubtypableTypes;
@@ -7205,9 +7267,6 @@
/// Return the type representing the built-in type 'Type'.
InterfaceType get typeType;
- /// Return the type representing typenames that can't be resolved.
- DartType get undefinedType;
-
/// Return 'true' if [id] is the name of a getter on
/// the Object type.
bool isObjectGetter(String id);
@@ -7226,11 +7285,11 @@
abstract class TypeProviderBase implements TypeProvider {
@override
List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[
+ boolType,
+ doubleType,
+ intType,
nullType,
numType,
- intType,
- doubleType,
- boolType,
stringType
];
@@ -7259,18 +7318,12 @@
/// The type representing the built-in type 'bool'.
InterfaceType _boolType;
- /// The type representing the type 'bottom'.
- DartType _bottomType;
-
/// The type representing the built-in type 'double'.
InterfaceType _doubleType;
/// The type representing the built-in type 'Deprecated'.
InterfaceType _deprecatedType;
- /// The type representing the built-in type 'dynamic'.
- DartType _dynamicType;
-
/// The type representing the built-in type 'Function'.
InterfaceType _functionType;
@@ -7313,9 +7366,6 @@
/// An shared object representing the value 'null'.
DartObjectImpl _nullObject;
- /// The type representing the type 'Set'.
- InterfaceType _setType;
-
/// The type representing the type 'Null'.
InterfaceType _nullType;
@@ -7325,6 +7375,9 @@
/// The type representing the built-in type 'Object'.
InterfaceType _objectType;
+ /// The type representing the type 'Set'.
+ InterfaceType _setType;
+
/// The type representing the built-in type 'StackTrace'.
InterfaceType _stackTraceType;
@@ -7343,31 +7396,17 @@
/// The type representing the built-in type 'Type'.
InterfaceType _typeType;
- /// The type representing typenames that can't be resolved.
- DartType _undefinedType;
-
/// Initialize a newly created type provider to provide the types defined in
/// the given [coreLibrary] and [asyncLibrary].
TypeProviderImpl(LibraryElement coreLibrary, LibraryElement asyncLibrary) {
- Namespace coreNamespace =
- new NamespaceBuilder().createPublicNamespaceForLibrary(coreLibrary);
- Namespace asyncNamespace =
- new NamespaceBuilder().createPublicNamespaceForLibrary(asyncLibrary);
- _initializeFrom(coreNamespace, asyncNamespace);
- }
-
- /// Initialize a newly created type provider to provide the types defined in
- /// the given [Namespace]s.
- TypeProviderImpl.forNamespaces(
- Namespace coreNamespace, Namespace asyncNamespace) {
- _initializeFrom(coreNamespace, asyncNamespace);
+ _initializeFrom(coreLibrary, asyncLibrary);
}
@override
InterfaceType get boolType => _boolType;
@override
- DartType get bottomType => _bottomType;
+ DartType get bottomType => BottomTypeImpl.instance;
@override
InterfaceType get deprecatedType => _deprecatedType;
@@ -7376,7 +7415,7 @@
InterfaceType get doubleType => _doubleType;
@override
- DartType get dynamicType => _dynamicType;
+ DartType get dynamicType => DynamicTypeImpl.instance;
@override
InterfaceType get functionType => _functionType;
@@ -7418,6 +7457,9 @@
InterfaceType get mapType => _mapType;
@override
+ DartType get neverType => BottomTypeImpl.instance;
+
+ @override
DartObjectImpl get nullObject {
if (_nullObject == null) {
_nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE);
@@ -7455,15 +7497,8 @@
@override
InterfaceType get typeType => _typeType;
- @override
- DartType get undefinedType => _undefinedType;
-
- /// Return the type with the given name from the given namespace, or `null` if
- /// there is no class with the given name.
- ///
- /// @param namespace the namespace in which to search for the given name
- /// @param typeName the name of the type being searched for
- /// @return the type that was found
+ /// Return the type with the given [typeName] from the given [namespace], or
+ /// `null` if there is no class with the given name.
InterfaceType _getType(Namespace namespace, String typeName) {
Element element = namespace.get(typeName);
if (element == null) {
@@ -7476,36 +7511,39 @@
/// Initialize the types provided by this type provider from the given
/// [Namespace]s.
- void _initializeFrom(Namespace coreNamespace, Namespace asyncNamespace) {
- _boolType = _getType(coreNamespace, "bool");
- _bottomType = BottomTypeImpl.instance;
- _deprecatedType = _getType(coreNamespace, "Deprecated");
- _doubleType = _getType(coreNamespace, "double");
- _dynamicType = DynamicTypeImpl.instance;
- _functionType = _getType(coreNamespace, "Function");
- _futureOrType = _getType(asyncNamespace, "FutureOr");
- _futureType = _getType(asyncNamespace, "Future");
- _intType = _getType(coreNamespace, "int");
- _iterableType = _getType(coreNamespace, "Iterable");
- _listType = _getType(coreNamespace, "List");
- _mapType = _getType(coreNamespace, "Map");
- _nullType = _getType(coreNamespace, "Null");
- _numType = _getType(coreNamespace, "num");
- _objectType = _getType(coreNamespace, "Object");
- _setType = _getType(coreNamespace, "Set");
- _stackTraceType = _getType(coreNamespace, "StackTrace");
- _streamType = _getType(asyncNamespace, "Stream");
- _stringType = _getType(coreNamespace, "String");
- _symbolType = _getType(coreNamespace, "Symbol");
- _typeType = _getType(coreNamespace, "Type");
- _undefinedType = UndefinedTypeImpl.instance;
- _futureDynamicType = _futureType.instantiate(<DartType>[_dynamicType]);
+ void _initializeFrom(
+ LibraryElement coreLibrary, LibraryElement asyncLibrary) {
+ Namespace coreNamespace =
+ new NamespaceBuilder().createPublicNamespaceForLibrary(coreLibrary);
+ Namespace asyncNamespace =
+ new NamespaceBuilder().createPublicNamespaceForLibrary(asyncLibrary);
+
+ _boolType = _getType(coreNamespace, 'bool');
+ _deprecatedType = _getType(coreNamespace, 'Deprecated');
+ _doubleType = _getType(coreNamespace, 'double');
+ _functionType = _getType(coreNamespace, 'Function');
+ _futureOrType = _getType(asyncNamespace, 'FutureOr');
+ _futureType = _getType(asyncNamespace, 'Future');
+ _intType = _getType(coreNamespace, 'int');
+ _iterableType = _getType(coreNamespace, 'Iterable');
+ _listType = _getType(coreNamespace, 'List');
+ _mapType = _getType(coreNamespace, 'Map');
+ _nullType = _getType(coreNamespace, 'Null');
+ _numType = _getType(coreNamespace, 'num');
+ _objectType = _getType(coreNamespace, 'Object');
+ _setType = _getType(coreNamespace, 'Set');
+ _stackTraceType = _getType(coreNamespace, 'StackTrace');
+ _streamType = _getType(asyncNamespace, 'Stream');
+ _stringType = _getType(coreNamespace, 'String');
+ _symbolType = _getType(coreNamespace, 'Symbol');
+ _typeType = _getType(coreNamespace, 'Type');
+ _futureDynamicType = _futureType.instantiate(<DartType>[dynamicType]);
_futureNullType = _futureType.instantiate(<DartType>[_nullType]);
- _iterableDynamicType = _iterableType.instantiate(<DartType>[_dynamicType]);
+ _iterableDynamicType = _iterableType.instantiate(<DartType>[dynamicType]);
_iterableObjectType = _iterableType.instantiate(<DartType>[_objectType]);
_mapObjectObjectType =
_mapType.instantiate(<DartType>[_objectType, _objectType]);
- _streamDynamicType = _streamType.instantiate(<DartType>[_dynamicType]);
+ _streamDynamicType = _streamType.instantiate(<DartType>[dynamicType]);
// FutureOr<T> is still fairly new, so if we're analyzing an SDK that
// doesn't have it yet, create an element for it.
_futureOrType ??= createPlaceholderFutureOr(_futureType, _objectType);
@@ -7517,6 +7555,8 @@
/// we can analyze older SDKs.
static InterfaceType createPlaceholderFutureOr(
InterfaceType futureType, InterfaceType objectType) {
+ // TODO(brianwilkerson) Remove this method now that the class has been
+ // defined.
var compilationUnit =
futureType.element.getAncestor((e) => e is CompilationUnitElement);
var element = ElementFactory.classElement('FutureOr', objectType, ['T']);
@@ -7550,9 +7590,6 @@
/// The type representing the type 'dynamic'.
DartType _dynamicType;
- /// The type representing typenames that can't be resolved.
- DartType _undefinedType;
-
/// The flag specifying if currently visited class references 'super'
/// expression.
bool _hasReferenceToSuper = false;
@@ -7608,7 +7645,6 @@
: super(definingLibrary, source, typeProvider, errorListener,
nameScope: nameScope) {
_dynamicType = typeProvider.dynamicType;
- _undefinedType = typeProvider.undefinedType;
_typeSystem = TypeSystem.create(definingLibrary.context);
_typeNameResolver = new TypeNameResolver(_typeSystem, typeProvider,
isNonNullableUnit, definingLibrary, source, errorListener,
@@ -8278,7 +8314,10 @@
TypeAnnotation returnType, FormalParameterList parameterList) {
DartType type = parameter.type;
GenericFunctionTypeElementImpl typeElement = type.element;
- typeElement.returnType = _computeReturnType(returnType);
+ // With summary2 we use synthetic FunctionType(s).
+ if (typeElement != null) {
+ typeElement.returnType = _computeReturnType(returnType);
+ }
}
}
@@ -8545,8 +8584,9 @@
/// created based on [definingLibrary] and [typeProvider].
VariableResolverVisitor(LibraryElement definingLibrary, Source source,
TypeProvider typeProvider, AnalysisErrorListener errorListener,
- {Scope nameScope})
- : super(definingLibrary, source, typeProvider, errorListener,
+ {Scope nameScope, LocalVariableInfo localVariableInfo})
+ : _localVariableInfo = localVariableInfo,
+ super(definingLibrary, source, typeProvider, errorListener,
nameScope: nameScope);
@override
diff --git a/analyzer/lib/src/generated/scanner.dart b/analyzer/lib/src/generated/scanner.dart
index 3b21b2f..e1d6904 100644
--- a/analyzer/lib/src/generated/scanner.dart
+++ b/analyzer/lib/src/generated/scanner.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/sdk_io.dart b/analyzer/lib/src/generated/sdk_io.dart
index cbdb6fe..86ef733 100644
--- a/analyzer/lib/src/generated/sdk_io.dart
+++ b/analyzer/lib/src/generated/sdk_io.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -7,6 +7,7 @@
import 'dart:collection';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/src/context/context.dart';
@@ -277,9 +278,13 @@
*/
LibraryMap readFromSource(Source source, String libraryFileContents) {
BooleanErrorListener errorListener = new BooleanErrorListener();
+ // TODO(paulberry): initialize the feature set appropriately based on the
+ // version of the SDK we are reading, and enable flags.
+ var featureSet = FeatureSet.fromEnableFlags([]);
Scanner scanner = new Scanner(
- source, new CharSequenceReader(libraryFileContents), errorListener);
- Parser parser = new Parser(source, errorListener);
+ source, new CharSequenceReader(libraryFileContents), errorListener)
+ ..configureFeatures(featureSet);
+ Parser parser = new Parser(source, errorListener, featureSet: featureSet);
CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
SdkLibrariesReader_LibraryBuilder libraryBuilder =
new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths);
diff --git a/analyzer/lib/src/generated/source.dart b/analyzer/lib/src/generated/source.dart
index f2d604f..1152e24 100644
--- a/analyzer/lib/src/generated/source.dart
+++ b/analyzer/lib/src/generated/source.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/static_type_analyzer.dart b/analyzer/lib/src/generated/static_type_analyzer.dart
index 377affe..eb5a7a8 100644
--- a/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -10,10 +10,12 @@
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/analysis/driver.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart' show ConstructorMember;
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
@@ -123,9 +125,9 @@
List<ParameterElement> parameters = node.parameterElements;
{
Iterator<ParameterElement> positional =
- parameters.where((p) => !p.isNamed).iterator;
+ parameters.where((p) => p.isPositional).iterator;
Iterator<ParameterElement> fnPositional =
- functionType.parameters.where((p) => !p.isNamed).iterator;
+ functionType.parameters.where((p) => p.isPositional).iterator;
while (positional.moveNext() && fnPositional.moveNext()) {
inferType(positional.current, fnPositional.current.type);
}
@@ -161,7 +163,7 @@
parameters = [];
} else {
// Also use upwards information to infer the type.
- elementTypes = node.elements2
+ elementTypes = node.elements
.map((element) => _computeElementType(element))
.where((t) => t != null)
.toList();
@@ -175,6 +177,7 @@
InterfaceType inferred = ts.inferGenericFunctionOrType<InterfaceType>(
_typeProvider.listType, parameters, elementTypes, contextType,
downwards: downwards,
+ isConst: node.isConst,
errorReporter: _resolver.errorReporter,
errorNode: node);
return inferred;
@@ -190,6 +193,7 @@
ParameterizedType inferred = ts.inferGenericFunctionOrType(
_typeProvider.mapType, [], [], contextType,
downwards: true,
+ isConst: node.isConst,
errorReporter: _resolver.errorReporter,
errorNode: node);
return inferred;
@@ -204,6 +208,7 @@
DartType inferred = ts.inferGenericFunctionOrType<InterfaceType>(
_typeProvider.setType, [], [], contextType,
downwards: true,
+ isConst: node.isConst,
errorReporter: _resolver.errorReporter,
errorNode: node);
return inferred;
@@ -723,13 +728,19 @@
@override
void visitPostfixExpression(PostfixExpression node) {
Expression operand = node.operand;
- DartType staticType = _getStaticType(operand, read: true);
+ TypeImpl staticType = _getStaticType(operand, read: true);
- // No need to check for `intVar++`, the result is `int`.
- if (!staticType.isDartCoreInt) {
- var operatorElement = node.staticElement;
- var operatorReturnType = _computeStaticReturnType(operatorElement);
- _checkForInvalidAssignmentIncDec(node, operand, operatorReturnType);
+ if (node.operator.type == TokenType.BANG) {
+ // TODO(paulberry): This does the wrong thing if staticType is a type
+ // parameter type.
+ staticType = staticType.withNullability(NullabilitySuffix.none);
+ } else {
+ // No need to check for `intVar++`, the result is `int`.
+ if (!staticType.isDartCoreInt) {
+ var operatorElement = node.staticElement;
+ var operatorReturnType = _computeStaticReturnType(operatorElement);
+ _checkForInvalidAssignmentIncDec(node, operand, operatorReturnType);
+ }
}
_recordStaticType(node, staticType);
@@ -1467,7 +1478,7 @@
Expression iterable;
if (parent is ForEachPartsWithDeclaration) {
AstNode parentParent = parent.parent;
- if (parentParent is ForStatement2Impl) {
+ if (parentParent is ForStatementImpl) {
awaitKeyword = parentParent.awaitKeyword;
} else if (parentParent is ForElement) {
awaitKeyword = parentParent.awaitKeyword;
@@ -1519,8 +1530,7 @@
void _inferGenericInvocationExpression(InvocationExpression node) {
ArgumentList arguments = node.argumentList;
var type = node.function.staticType;
- var freshType =
- type is FunctionType ? new FunctionTypeImpl.fresh(type) : type;
+ var freshType = _getFreshType(type);
FunctionType inferred = _inferGenericInvoke(
node, freshType, node.typeArguments, arguments, node.function);
@@ -1546,7 +1556,8 @@
DartType fnType,
TypeArgumentList typeArguments,
ArgumentList argumentList,
- AstNode errorNode) {
+ AstNode errorNode,
+ {bool isConst: false}) {
TypeSystem ts = _typeSystem;
if (typeArguments == null &&
fnType is FunctionType &&
@@ -1568,7 +1579,9 @@
}
return ts.inferGenericFunctionOrType(
fnType, params, argTypes, InferenceContext.getContext(node),
- errorReporter: _resolver.errorReporter, errorNode: errorNode);
+ isConst: isConst,
+ errorReporter: _resolver.errorReporter,
+ errorNode: errorNode);
}
return null;
}
@@ -1606,7 +1619,8 @@
ArgumentList arguments = node.argumentList;
FunctionType inferred = _inferGenericInvoke(node, constructorType,
- constructor.type.typeArguments, arguments, node.constructorName);
+ constructor.type.typeArguments, arguments, node.constructorName,
+ isConst: node.isConst);
if (inferred != null && inferred != originalElement.type) {
// Fix up the parameter elements based on inferred method.
@@ -1780,7 +1794,7 @@
var literalImpl = literal as SetOrMapLiteralImpl;
DartType contextType = literalImpl.contextType;
literalImpl.contextType = null; // Not needed anymore.
- NodeList<CollectionElement> elements = literal.elements2;
+ NodeList<CollectionElement> elements = literal.elements;
List<_InferredCollectionElementTypeInformation> inferredTypes = [];
bool canBeAMap = true;
bool mustBeAMap = false;
@@ -1888,7 +1902,9 @@
..addAll(valueTypes);
return (_typeSystem as Dart2TypeSystem).inferGenericFunctionOrType(
_typeProvider.mapType, typeParameters, elementTypes, contextType,
- errorReporter: _resolver.errorReporter, errorNode: node);
+ isConst: node.isConst,
+ errorReporter: _resolver.errorReporter,
+ errorNode: node);
}
DartType _toSetType(SetOrMapLiteral node, DartType contextType,
@@ -1908,7 +1924,9 @@
growable: true);
return (_typeSystem as Dart2TypeSystem).inferGenericFunctionOrType(
_typeProvider.setType, parameters, elementTypes, contextType,
- errorReporter: _resolver.errorReporter, errorNode: node);
+ isConst: node.isConst,
+ errorReporter: _resolver.errorReporter,
+ errorNode: node);
}
/**
@@ -1945,6 +1963,19 @@
function.type = new FunctionTypeImpl(function);
return new FunctionTypeImpl.fresh(function.type);
}
+
+ static DartType _getFreshType(DartType type) {
+ if (type is FunctionType) {
+ if (AnalysisDriver.useSummary2) {
+ var parameters = getFreshTypeParameters(type.typeFormals);
+ return parameters.applyToFunctionType(type);
+ } else {
+ return new FunctionTypeImpl.fresh(type);
+ }
+ } else {
+ return type;
+ }
+ }
}
class _InferredCollectionElementTypeInformation {
diff --git a/analyzer/lib/src/generated/testing/ast_test_factory.dart b/analyzer/lib/src/generated/testing/ast_test_factory.dart
index a2e6994..ab12e27 100644
--- a/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -275,14 +275,16 @@
String scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations) =>
- astFactory.compilationUnit(
- TokenFactory.tokenFromType(TokenType.EOF),
- scriptTag == null ? null : AstTestFactory.scriptTag(scriptTag),
- directives == null ? new List<Directive>() : directives,
- declarations == null
+ astFactory.compilationUnit2(
+ beginToken: TokenFactory.tokenFromType(TokenType.EOF),
+ scriptTag:
+ scriptTag == null ? null : AstTestFactory.scriptTag(scriptTag),
+ directives: directives == null ? new List<Directive>() : directives,
+ declarations: declarations == null
? new List<CompilationUnitMember>()
: declarations,
- TokenFactory.tokenFromType(TokenType.EOF));
+ endToken: TokenFactory.tokenFromType(TokenType.EOF),
+ featureSet: null);
static ConditionalExpression conditionalExpression(Expression condition,
Expression thenExpression, Expression elseExpression) =>
@@ -494,29 +496,29 @@
static FieldFormalParameter fieldFormalParameter2(String identifier) =>
fieldFormalParameter(null, null, identifier);
- @Deprecated('Use forStatement2')
- static ForStatement2 forEachStatement(DeclaredIdentifier loopVariable,
- Expression iterator, Statement body) =>
- astFactory.forStatement2(
- forKeyword: TokenFactory.tokenFromKeyword(Keyword.FOR),
- leftParenthesis: TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- forLoopParts: astFactory.forEachPartsWithDeclaration(
- loopVariable: loopVariable,
- inKeyword: TokenFactory.tokenFromKeyword(Keyword.IN),
- iterable: iterator),
- rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- body: body);
+ static ForEachPartsWithDeclaration forEachPartsWithDeclaration(
+ DeclaredIdentifier loopVariable, Expression iterable) =>
+ astFactory.forEachPartsWithDeclaration(
+ loopVariable: loopVariable,
+ inKeyword: TokenFactory.tokenFromKeyword(Keyword.IN),
+ iterable: iterable);
- @Deprecated('Use forStatement2')
- static ForStatement2 forEachStatement2(
- SimpleIdentifier identifier, Expression iterator, Statement body) =>
- astFactory.forStatement2(
+ static ForEachPartsWithIdentifier forEachPartsWithIdentifier(
+ SimpleIdentifier identifier, Expression iterable) =>
+ astFactory.forEachPartsWithIdentifier(
+ identifier: identifier,
+ inKeyword: TokenFactory.tokenFromKeyword(Keyword.IN),
+ iterable: iterable);
+
+ static ForElement forElement(
+ ForLoopParts forLoopParts, CollectionElement body,
+ {bool hasAwait: false}) =>
+ astFactory.forElement(
+ awaitKeyword:
+ hasAwait ? TokenFactory.tokenFromKeyword(Keyword.AWAIT) : null,
forKeyword: TokenFactory.tokenFromKeyword(Keyword.FOR),
leftParenthesis: TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- forLoopParts: astFactory.forEachPartsWithIdentifier(
- identifier: identifier,
- inKeyword: TokenFactory.tokenFromKeyword(Keyword.IN),
- iterable: iterator),
+ forLoopParts: forLoopParts,
rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
body: body);
@@ -529,32 +531,33 @@
null,
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
- @Deprecated('Use forStatement2')
- static ForStatement2 forStatement(Expression initialization,
- Expression condition, List<Expression> updaters, Statement body) =>
- astFactory.forStatement2(
- forKeyword: TokenFactory.tokenFromKeyword(Keyword.FOR),
- leftParenthesis: TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- forLoopParts: astFactory.forPartsWithExpression(
- initialization: initialization,
- leftSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- condition: condition,
- rightSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- updaters: updaters),
- rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- body: body);
+ static ForPartsWithDeclarations forPartsWithDeclarations(
+ VariableDeclarationList variables,
+ Expression condition,
+ List<Expression> updaters) =>
+ astFactory.forPartsWithDeclarations(
+ variables: variables,
+ leftSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
+ condition: condition,
+ rightSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
+ updaters: updaters);
- static ForStatement2 forStatement2(VariableDeclarationList variableList,
- Expression condition, List<Expression> updaters, Statement body) =>
- astFactory.forStatement2(
+ static ForPartsWithExpression forPartsWithExpression(
+ Expression initialization,
+ Expression condition,
+ List<Expression> updaters) =>
+ astFactory.forPartsWithExpression(
+ initialization: initialization,
+ leftSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
+ condition: condition,
+ rightSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
+ updaters: updaters);
+
+ static ForStatement forStatement(ForLoopParts forLoopParts, Statement body) =>
+ astFactory.forStatement(
forKeyword: TokenFactory.tokenFromKeyword(Keyword.FOR),
leftParenthesis: TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- forLoopParts: astFactory.forPartsWithDeclarations(
- variables: variableList,
- leftSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- condition: condition,
- rightSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- updaters: updaters),
+ forLoopParts: forLoopParts,
rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
body: body);
@@ -839,21 +842,6 @@
elements,
TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
- @Deprecated('Use setOrMapLiteral')
- static SetOrMapLiteral mapLiteral(
- Keyword keyword, TypeArgumentList typeArguments,
- [List<MapLiteralEntry> entries]) =>
- astFactory.mapLiteral(
- keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
- typeArguments,
- TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
- entries,
- TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
-
- @Deprecated('Use setOrMapLiteral')
- static SetOrMapLiteral mapLiteral2([List<MapLiteralEntry> entries]) =>
- mapLiteral(null, null, entries);
-
static MapLiteralEntry mapLiteralEntry(String key, Expression value) =>
astFactory.mapLiteralEntry(
string2(key), TokenFactory.tokenFromType(TokenType.COLON), value);
@@ -1093,16 +1081,6 @@
static ScriptTag scriptTag(String scriptTag) =>
astFactory.scriptTag(TokenFactory.tokenFromString(scriptTag));
- @Deprecated('Use setOrMapLiteral')
- static SetOrMapLiteral setLiteral(Keyword keyword,
- TypeArgumentList typeArguments, List<Expression> elements) =>
- astFactory.setLiteral(
- keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
- typeArguments,
- TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
- elements,
- TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
-
static SetOrMapLiteral setOrMapLiteral(
Keyword keyword, TypeArgumentList typeArguments,
[List<CollectionElement> elements]) =>
diff --git a/analyzer/lib/src/generated/testing/test_type_provider.dart b/analyzer/lib/src/generated/testing/test_type_provider.dart
index 30b176b..da58fd1 100644
--- a/analyzer/lib/src/generated/testing/test_type_provider.dart
+++ b/analyzer/lib/src/generated/testing/test_type_provider.dart
@@ -119,6 +119,11 @@
InterfaceType _mapObjectObjectType;
/**
+ * The type representing the built-in type 'Never'.
+ */
+ InterfaceType _neverType;
+
+ /**
* An shared object representing the value 'null'.
*/
DartObjectImpl _nullObject;
@@ -174,11 +179,6 @@
InterfaceType _typeType;
/**
- * The type representing type names that can't be resolved.
- */
- DartType _undefinedType;
-
- /**
* The analysis context, if any. Used to create an appropriate 'dart:async'
* library to back `Future<T>`.
*/
@@ -442,6 +442,16 @@
}
@override
+ InterfaceType get neverType {
+ if (_neverType == null) {
+ ClassElementImpl neverElement =
+ ElementFactory.classElement('Never', objectType);
+ _neverType = neverElement.type;
+ }
+ return _neverType;
+ }
+
+ @override
DartObjectImpl get nullObject {
if (_nullObject == null) {
_nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE);
@@ -597,21 +607,15 @@
return _typeType;
}
- @override
- DartType get undefinedType {
- if (_undefinedType == null) {
- _undefinedType = UndefinedTypeImpl.instance;
- }
- return _undefinedType;
- }
-
void _initDartAsync() {
Source asyncSource;
- if (_driver == null) {
+ if (_driver != null) {
+ asyncSource = _driver.sourceFactory.forUri(DartSdk.DART_ASYNC);
+ } else if (_context != null) {
asyncSource = _context.sourceFactory.forUri(DartSdk.DART_ASYNC);
_context.setContents(asyncSource, "");
} else {
- asyncSource = _driver.sourceFactory.forUri(DartSdk.DART_ASYNC);
+ asyncSource = null;
}
CompilationUnitElementImpl asyncUnit = new CompilationUnitElementImpl();
LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode(
diff --git a/analyzer/lib/src/generated/timestamped_data.dart b/analyzer/lib/src/generated/timestamped_data.dart
index 18e6323..7084cbd 100644
--- a/analyzer/lib/src/generated/timestamped_data.dart
+++ b/analyzer/lib/src/generated/timestamped_data.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/generated/type_system.dart b/analyzer/lib/src/generated/type_system.dart
index 6e978a6..f1ed12b 100644
--- a/analyzer/lib/src/generated/type_system.dart
+++ b/analyzer/lib/src/generated/type_system.dart
@@ -11,6 +11,7 @@
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_system.dart' as public;
import 'package:analyzer/error/listener.dart' show ErrorReporter;
+import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart' show TypeParameterMember;
import 'package:analyzer/src/dart/element/type.dart';
@@ -225,7 +226,8 @@
DartType returnContextType,
{ErrorReporter errorReporter,
AstNode errorNode,
- bool downwards: false}) {
+ bool downwards: false,
+ bool isConst: false}) {
// TODO(jmesserly): expose typeFormals on ParameterizedType.
List<TypeParameterElement> typeFormals = typeFormalsAsElements(genericType);
if (typeFormals.isEmpty) {
@@ -242,6 +244,9 @@
genericType is FunctionType ? genericType.returnType : genericType;
if (returnContextType != null) {
+ if (isConst) {
+ returnContextType = _eliminateTypeVariables(returnContextType);
+ }
inferrer.constrainReturnType(declaredReturnType, returnContextType);
}
@@ -319,6 +324,9 @@
Set<DartType> visitedTypes = new HashSet<DartType>();
void appendParameters(DartType type) {
+ if (type == null) {
+ return;
+ }
if (visitedTypes.contains(type)) {
return;
}
@@ -326,6 +334,13 @@
if (type is TypeParameterType && all.contains(type)) {
parameters ??= <TypeParameterType>[];
parameters.add(type);
+ } else if (AnalysisDriver.useSummary2) {
+ if (type is FunctionType) {
+ appendParameters(type.returnType);
+ type.parameters.map((p) => p.type).forEach(appendParameters);
+ } else if (type is InterfaceType) {
+ type.typeArguments.forEach(appendParameters);
+ }
} else if (type is ParameterizedType) {
type.typeArguments.forEach(appendParameters);
}
@@ -652,6 +667,30 @@
}
/**
+ * Eliminates type variables from the context [type], replacing them with
+ * `Null` or `Object` as appropriate.
+ *
+ * For example in `List<T> list = const []`, the context type for inferring
+ * the list should be changed from `List<T>` to `List<Null>` so the constant
+ * doesn't depend on the type variables `T` (because it can't be canonicalized
+ * at compile time, as `T` is unknown).
+ *
+ * Conceptually this is similar to the "least closure", except instead of
+ * eliminating `?` ([UnknownInferredType]) it eliminates all type variables
+ * ([TypeParameterType]).
+ *
+ * The equivalent CFE code can be found in the `TypeVariableEliminator` class.
+ */
+ DartType _eliminateTypeVariables(DartType type) {
+ return _substituteType(type, true, (type, lowerBound) {
+ if (type is TypeParameterType) {
+ return lowerBound ? typeProvider.nullType : typeProvider.objectType;
+ }
+ return type;
+ });
+ }
+
+ /**
* Compute the greatest lower bound of function types [f] and [g].
*
* The spec rules for GLB on function types, informally, are pretty simple:
@@ -743,6 +782,8 @@
}
// Union the named parameters together.
+ // TODO(brianwilkerson) Handle the fact that named parameters can now be
+ // required.
Map<String, DartType> fNamed = f.namedParameterTypes;
Map<String, DartType> gNamed = g.namedParameterTypes;
for (String name in fNamed.keys.toSet()..addAll(gNamed.keys)) {
@@ -891,22 +932,46 @@
return false;
}
+ /**
+ * Returns the greatest or least closure of [type], which replaces `?`
+ * ([UnknownInferredType]) with `dynamic` or `Null` as appropriate.
+ *
+ * If [lowerBound] is true, this will return the "least closure", otherwise
+ * it returns the "greatest closure".
+ */
DartType _substituteForUnknownType(DartType type, {bool lowerBound: false}) {
- if (identical(type, UnknownInferredType.instance)) {
- if (lowerBound) {
- // TODO(jmesserly): this should be the bottom type, once it can be
- // reified.
- return typeProvider.nullType;
+ return _substituteType(type, lowerBound, (type, lowerBound) {
+ if (identical(type, UnknownInferredType.instance)) {
+ return lowerBound ? typeProvider.nullType : typeProvider.dynamicType;
}
- return typeProvider.dynamicType;
+ return type;
+ });
+ }
+
+ /**
+ * Apply the [visitType] substitution to [type], using the result value if
+ * different, otherwise recursively apply the substitution.
+ *
+ * This method is used for substituting `?` ([UnknownInferredType]) with its
+ * greatest/least closure, and for eliminating type parameters for inference
+ * of `const` objects.
+ *
+ * See also [_eliminateTypeVariables] and [_substituteForUnknownType].
+ */
+ DartType _substituteType(DartType type, bool lowerBound,
+ DartType Function(DartType, bool) visitType) {
+ // Apply the substitution to this type, and return the result if different.
+ var newType = visitType(type, lowerBound);
+ if (!identical(newType, type)) {
+ return newType;
}
if (type is InterfaceTypeImpl) {
// Generic types are covariant, so keep the constraint direction.
- var newTypeArgs = _transformList(type.typeArguments,
- (t) => _substituteForUnknownType(t, lowerBound: lowerBound));
+ var newTypeArgs = _transformList(
+ type.typeArguments, (t) => _substituteType(t, lowerBound, visitType));
if (identical(type.typeArguments, newTypeArgs)) return type;
return new InterfaceTypeImpl(
- type.element, type.prunedTypedefs, type.nullability)
+ type.element, type.prunedTypedefs, type.nullabilitySuffix)
..typeArguments = newTypeArgs;
}
if (type is FunctionType) {
@@ -914,8 +979,7 @@
var returnType = type.returnType;
var newParameters = _transformList(parameters, (ParameterElement p) {
// Parameters are contravariant, so flip the constraint direction.
- var newType =
- _substituteForUnknownType(p.type, lowerBound: !lowerBound);
+ var newType = _substituteType(p.type, !lowerBound, visitType);
return new ParameterElementImpl.synthetic(
p.name,
newType,
@@ -923,8 +987,7 @@
p.parameterKind);
});
// Return type is covariant.
- var newReturnType =
- _substituteForUnknownType(returnType, lowerBound: lowerBound);
+ var newReturnType = _substituteType(returnType, lowerBound, visitType);
if (identical(parameters, newParameters) &&
identical(returnType, newReturnType)) {
return type;
@@ -932,7 +995,7 @@
return new FunctionTypeImpl.synthetic(
newReturnType, type.typeFormals, newParameters,
- nullability: (type as TypeImpl).nullability);
+ nullabilitySuffix: (type as TypeImpl).nullabilitySuffix);
}
return type;
}
@@ -1872,6 +1935,27 @@
*/
bool isMoreSpecificThan(DartType leftType, DartType rightType);
+ @override
+ bool isNonNullable(DartType type) {
+ if (type.isDynamic || type.isVoid || type.isDartCoreNull) {
+ return false;
+ } else if (type.isDartAsyncFutureOr) {
+ isNonNullable((type as InterfaceType).typeArguments[0]);
+ }
+ return (type as TypeImpl).nullabilitySuffix != NullabilitySuffix.question &&
+ (type is TypeParameterType ? isNonNullable(type.bound) : true);
+ }
+
+ @override
+ bool isNullable(DartType type) {
+ if (type.isDynamic || type.isVoid || type.isDartCoreNull) {
+ return true;
+ } else if (type.isDartAsyncFutureOr) {
+ isNullable((type as InterfaceType).typeArguments[0]);
+ }
+ return (type as TypeImpl).nullabilitySuffix != NullabilitySuffix.none;
+ }
+
/// Check that [f1] is a subtype of [f2] for a member override.
///
/// This is different from the normal function subtyping in two ways:
@@ -1879,6 +1963,12 @@
/// - it allows opt-in covariant parameters.
bool isOverrideSubtypeOf(FunctionType f1, FunctionType f2);
+ @override
+ bool isPotentiallyNonNullable(DartType type) => !isNullable(type);
+
+ @override
+ bool isPotentiallyNullable(DartType type) => !isNonNullable(type);
+
/**
* Return `true` if the [leftType] is a subtype of the [rightType] (that is,
* if leftType <: rightType).
@@ -1918,41 +2008,25 @@
* Searches the superinterfaces of [type] for implementations of [genericType]
* and returns the most specific type argument used for that generic type.
*
+ * For a more general/robust solution, use [InterfaceTypeImpl.asInstanceOf].
+ *
* For example, given [type] `List<int>` and [genericType] `Iterable<T>`,
* returns [int].
*
* Returns `null` if [type] does not implement [genericType].
*/
- // TODO(jmesserly): this is very similar to code used for flattening futures.
- // The only difference is, because of a lack of TypeProvider, the other method
- // has to match the Future type by its name and library. Here was are passed
- // in the correct type.
DartType mostSpecificTypeArgument(DartType type, DartType genericType) {
if (type is! InterfaceType) return null;
+ if (genericType is! InterfaceType) return null;
- // Walk the superinterface hierarchy looking for [genericType].
- List<DartType> candidates = <DartType>[];
- HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
- void recurse(InterfaceType interface) {
- if (interface.element == genericType.element &&
- interface.typeArguments.isNotEmpty) {
- candidates.add(interface.typeArguments[0]);
- }
- if (visitedClasses.add(interface.element)) {
- if (interface.superclass != null) {
- recurse(interface.superclass);
- }
- interface.mixins.forEach(recurse);
- interface.interfaces.forEach(recurse);
- visitedClasses.remove(interface.element);
- }
+ var asInstanceOf = (type as InterfaceTypeImpl)
+ .asInstanceOf((genericType as InterfaceType).element);
+
+ if (asInstanceOf != null) {
+ return asInstanceOf.typeArguments[0];
}
- recurse(type);
-
- // Since the interface may be implemented multiple times with different
- // type arguments, choose the best one.
- return InterfaceTypeImpl.findMostSpecificType(candidates, this);
+ return null;
}
/**
@@ -2105,6 +2179,8 @@
ParameterKind.POSITIONAL));
}
+ // TODO(brianwilkerson) Handle the fact that named parameters can now be
+ // required.
Map<String, DartType> fNamed = f.namedParameterTypes;
Map<String, DartType> gNamed = g.namedParameterTypes;
for (String name in fNamed.keys.toSet()..retainAll(gNamed.keys)) {
@@ -2197,7 +2273,7 @@
bool get isDynamic => true;
@override
- Nullability get nullability => Nullability.indeterminate;
+ NullabilitySuffix get nullabilitySuffix => NullabilitySuffix.star;
@override
bool operator ==(Object object) => identical(object, this);
@@ -2259,7 +2335,7 @@
}
@override
- TypeImpl withNullability(Nullability nullability) => this;
+ TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) => this;
/// Given a [type] T, return true if it does not have an unknown type `?`.
static bool isKnown(DartType type) => !isUnknown(type);
diff --git a/analyzer/lib/src/generated/utilities_dart.dart b/analyzer/lib/src/generated/utilities_dart.dart
index d1904a0..160c47a 100644
--- a/analyzer/lib/src/generated/utilities_dart.dart
+++ b/analyzer/lib/src/generated/utilities_dart.dart
@@ -50,20 +50,32 @@
}
/**
- * The kinds of a parameter. There are two basic kinds of parameters: required
- * and optional. Optional parameters are further divided into two kinds:
- * positional optional and named optional.
+ * The kind of a parameter. A parameter can be either positional or named, and
+ * can be either required or optional.
*/
class ParameterKind implements Comparable<ParameterKind> {
+ /// A positional required parameter.
static const ParameterKind REQUIRED =
- const ParameterKind('REQUIRED', 0, false);
+ const ParameterKind('REQUIRED', 0, false, false);
+ /// A positional optional parameter.
static const ParameterKind POSITIONAL =
- const ParameterKind('POSITIONAL', 1, true);
+ const ParameterKind('POSITIONAL', 1, false, true);
- static const ParameterKind NAMED = const ParameterKind('NAMED', 2, true);
+ /// A named required parameter.
+ static const ParameterKind NAMED_REQUIRED =
+ const ParameterKind('NAMED_REQUIRED', 2, true, false);
- static const List<ParameterKind> values = const [REQUIRED, POSITIONAL, NAMED];
+ /// A named optional parameter.
+ static const ParameterKind NAMED =
+ const ParameterKind('NAMED', 2, true, true);
+
+ static const List<ParameterKind> values = const [
+ REQUIRED,
+ POSITIONAL,
+ NAMED_REQUIRED,
+ NAMED
+ ];
/**
* The name of this parameter.
@@ -76,14 +88,19 @@
final int ordinal;
/**
- * A flag indicating whether this is an optional parameter.
+ * A flag indicating whether this is a named or positional parameter.
+ */
+ final bool isNamed;
+
+ /**
+ * A flag indicating whether this is an optional or required parameter.
*/
final bool isOptional;
/**
* Initialize a newly created kind with the given state.
*/
- const ParameterKind(this.name, this.ordinal, this.isOptional);
+ const ParameterKind(this.name, this.ordinal, this.isNamed, this.isOptional);
@override
int get hashCode => ordinal;
diff --git a/analyzer/lib/src/generated/utilities_general.dart b/analyzer/lib/src/generated/utilities_general.dart
index 9722bc8..fab29a6 100644
--- a/analyzer/lib/src/generated/utilities_general.dart
+++ b/analyzer/lib/src/generated/utilities_general.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/generated/visitors.dart b/analyzer/lib/src/generated/visitors.dart
index 457d7f8..62cb61a 100644
--- a/analyzer/lib/src/generated/visitors.dart
+++ b/analyzer/lib/src/generated/visitors.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/hint/sdk_constraint_verifier.dart b/analyzer/lib/src/hint/sdk_constraint_verifier.dart
index cc2231a..938d454 100644
--- a/analyzer/lib/src/hint/sdk_constraint_verifier.dart
+++ b/analyzer/lib/src/hint/sdk_constraint_verifier.dart
@@ -3,9 +3,12 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/resolver.dart';
@@ -26,10 +29,32 @@
/// The version constraint for the SDK.
final VersionConstraint _versionConstraint;
+ /// A cached flag indicating whether references to the constant-update-2018
+ /// features need to be checked. Use [checkConstantUpdate2018] to access this
+ /// field.
+ bool _checkConstantUpdate2018;
+
/// A cached flag indicating whether references to Future and Stream need to
- /// be checked. Use [] to access this field.
+ /// be checked. Use [checkFutureAndStream] to access this field.
bool _checkFutureAndStream;
+ /// A cached flag indicating whether references to set literals need to
+ /// be checked. Use [checkSetLiterals] to access this field.
+ bool _checkSetLiterals;
+
+ /// A flag indicating whether we are visiting code inside a set literal. Used
+ /// to prevent over-reporting uses of set literals.
+ bool _inSetLiteral = false;
+
+ /// A cached flag indicating whether references to the ui-as-code features
+ /// need to be checked. Use [checkUiAsCode] to access this field.
+ bool _checkUiAsCode;
+
+ /// A flag indicating whether we are visiting code inside one of the
+ /// ui-as-code features. Used to prevent over-reporting uses of these
+ /// features.
+ bool _inUiAsCode = false;
+
/// Initialize a newly created verifier to use the given [_errorReporter] to
/// report errors.
SdkConstraintVerifier(this._errorReporter, this._containingLibrary,
@@ -39,16 +64,138 @@
VersionRange get before_2_1_0 =>
new VersionRange(max: Version.parse('2.1.0'), includeMax: false);
+ /// Return a range covering every version up to, but not including, 2.2.0.
+ VersionRange get before_2_2_0 =>
+ new VersionRange(max: Version.parse('2.2.0'), includeMax: false);
+
+ /// Return a range covering every version up to, but not including, 2.2.2.
+ VersionRange get before_2_2_2 =>
+ new VersionRange(max: Version.parse('2.2.2'), includeMax: false);
+
+ /// Return `true` if references to the constant-update-2018 features need to
+ /// be checked.
+ bool get checkConstantUpdate2018 => _checkConstantUpdate2018 ??=
+ !before_2_2_2.intersect(_versionConstraint).isEmpty;
+
/// Return `true` if references to Future and Stream need to be checked.
bool get checkFutureAndStream => _checkFutureAndStream ??=
!before_2_1_0.intersect(_versionConstraint).isEmpty;
+ /// Return `true` if references to the non-nullable features need to be
+ /// checked.
+ // TODO(brianwilkerson) Implement this as a version check when a version has
+ // been selected.
+ bool get checkNnbd => true;
+
+ /// Return `true` if references to set literals need to be checked.
+ bool get checkSetLiterals =>
+ _checkSetLiterals ??= !before_2_2_0.intersect(_versionConstraint).isEmpty;
+
+ /// Return `true` if references to the ui-as-code features (control flow and
+ /// spread collections) need to be checked.
+ bool get checkUiAsCode =>
+ _checkUiAsCode ??= !before_2_2_2.intersect(_versionConstraint).isEmpty;
+
+ @override
+ void visitAsExpression(AsExpression node) {
+ if (checkConstantUpdate2018 &&
+ (node as AsExpressionImpl).inConstantContext) {
+ _errorReporter.reportErrorForNode(
+ HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT, node);
+ }
+ super.visitAsExpression(node);
+ }
+
+ @override
+ void visitBinaryExpression(BinaryExpression node) {
+ if (checkConstantUpdate2018) {
+ TokenType operatorType = node.operator.type;
+ if (operatorType == TokenType.GT_GT_GT) {
+ _errorReporter.reportErrorForToken(
+ HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, node.operator);
+ } else if ((operatorType == TokenType.AMPERSAND ||
+ operatorType == TokenType.BAR ||
+ operatorType == TokenType.CARET) &&
+ (node as BinaryExpressionImpl).inConstantContext) {
+ if (node.leftOperand.staticType.isDartCoreBool) {
+ _errorReporter.reportErrorForToken(HintCode.SDK_VERSION_BOOL_OPERATOR,
+ node.operator, [node.operator.lexeme]);
+ }
+ } else if (operatorType == TokenType.EQ_EQ &&
+ (node as BinaryExpressionImpl).inConstantContext) {
+ bool primitive(Expression node) {
+ DartType type = node.staticType;
+ return type.isDartCoreBool ||
+ type.isDartCoreDouble ||
+ type.isDartCoreInt ||
+ type.isDartCoreNull ||
+ type.isDartCoreString;
+ }
+
+ if (!primitive(node.leftOperand) || !primitive(node.rightOperand)) {
+ _errorReporter.reportErrorForToken(
+ HintCode.SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT,
+ node.operator);
+ }
+ }
+ }
+ super.visitBinaryExpression(node);
+ }
+
+ @override
+ void visitForElement(ForElement node) {
+ _validateUiAsCode(node);
+ bool wasInUiAsCode = _inUiAsCode;
+ _inUiAsCode = true;
+ super.visitForElement(node);
+ _inUiAsCode = wasInUiAsCode;
+ }
+
@override
void visitHideCombinator(HideCombinator node) {
// Don't flag references to either `Future` or `Stream` within a combinator.
}
@override
+ void visitIfElement(IfElement node) {
+ _validateUiAsCode(node);
+ bool wasInUiAsCode = _inUiAsCode;
+ _inUiAsCode = true;
+ super.visitIfElement(node);
+ _inUiAsCode = wasInUiAsCode;
+ }
+
+ @override
+ void visitIsExpression(IsExpression node) {
+ if (checkConstantUpdate2018 &&
+ (node as IsExpressionImpl).inConstantContext) {
+ _errorReporter.reportErrorForNode(
+ HintCode.SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT, node);
+ }
+ super.visitIsExpression(node);
+ }
+
+ @override
+ void visitMethodDeclaration(MethodDeclaration node) {
+ if (checkConstantUpdate2018 && node.isOperator && node.name.name == '>>>') {
+ _errorReporter.reportErrorForNode(
+ HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, node.name);
+ }
+ super.visitMethodDeclaration(node);
+ }
+
+ @override
+ void visitSetOrMapLiteral(SetOrMapLiteral node) {
+ if (node.isSet && checkSetLiterals && !_inSetLiteral) {
+ _errorReporter.reportErrorForNode(HintCode.SDK_VERSION_SET_LITERAL, node);
+ }
+ bool wasInSetLiteral = _inSetLiteral;
+ _inSetLiteral = true;
+ super.visitSetOrMapLiteral(node);
+ _inSetLiteral = wasInSetLiteral;
+ }
+
+ @override
void visitShowCombinator(ShowCombinator node) {
// Don't flag references to either `Future` or `Stream` within a combinator.
}
@@ -73,6 +220,26 @@
}
_errorReporter.reportErrorForNode(
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE, node, [element.name]);
+ } else if (checkNnbd && element == _typeProvider.neverType.element) {
+ _errorReporter.reportErrorForNode(HintCode.SDK_VERSION_NEVER, node);
+ }
+ }
+
+ @override
+ void visitSpreadElement(SpreadElement node) {
+ _validateUiAsCode(node);
+ bool wasInUiAsCode = _inUiAsCode;
+ _inUiAsCode = true;
+ super.visitSpreadElement(node);
+ _inUiAsCode = wasInUiAsCode;
+ }
+
+ /// Given that the [node] is only valid when the ui-as-code feature is
+ /// enabled, check that the code will not be executed with a version of the
+ /// SDK that does not support the feature.
+ void _validateUiAsCode(AstNode node) {
+ if (checkUiAsCode && !_inUiAsCode) {
+ _errorReporter.reportErrorForNode(HintCode.SDK_VERSION_UI_AS_CODE, node);
}
}
}
diff --git a/analyzer/lib/src/html/error/html_codes.dart b/analyzer/lib/src/html/error/html_codes.dart
deleted file mode 100644
index 59a67b4..0000000
--- a/analyzer/lib/src/html/error/html_codes.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/error/error.dart';
-
-/**
- * The error codes used for errors in HTML files. The convention for this
- * class is for the name of the error code to indicate the problem that caused
- * the error to be generated and for the error message to explain what is wrong
- * and, when appropriate, how the problem can be corrected.
- */
-class HtmlErrorCode extends ErrorCode {
- /**
- * An error code indicating that there is a syntactic error in the file.
- *
- * Parameters:
- * 0: the error message from the parse error
- */
- static const HtmlErrorCode PARSE_ERROR =
- const HtmlErrorCode('PARSE_ERROR', '{0}');
-
- /**
- * Initialize a newly created error code to have the given [name]. The message
- * associated with the error will be created from the given [message]
- * template. The correction associated with the error will be created from the
- * given [correction] template.
- */
- const HtmlErrorCode(String name, String message, {String correction})
- : super.temporary(name, message, correction: correction);
-
- @override
- ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
-
- @override
- ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
-}
-
-/**
- * The error codes used for warnings in HTML files. The convention for this
- * class is for the name of the error code to indicate the problem that caused
- * the error to be generated and for the error message to explain what is wrong
- * and, when appropriate, how the problem can be corrected.
- */
-class HtmlWarningCode extends ErrorCode {
- /**
- * An error code indicating that the value of the 'src' attribute of a Dart
- * script tag is not a valid URI.
- *
- * Parameters:
- * 0: the URI that is invalid
- */
- static const HtmlWarningCode INVALID_URI =
- const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'.");
-
- /**
- * An error code indicating that the value of the 'src' attribute of a Dart
- * script tag references a file that does not exist.
- *
- * Parameters:
- * 0: the URI pointing to a non-existent file
- */
- static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode(
- 'URI_DOES_NOT_EXIST', "Target of URI doesn't exist: '{0}'.");
-
- /**
- * Initialize a newly created error code to have the given [name]. The message
- * associated with the error will be created from the given [message]
- * template. The correction associated with the error will be created from the
- * given [correction] template.
- */
- const HtmlWarningCode(String name, String message, {String correction})
- : super.temporary(name, message, correction: correction);
-
- @override
- ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
-
- @override
- ErrorType get type => ErrorType.STATIC_WARNING;
-}
diff --git a/analyzer/lib/src/lint/analysis.dart b/analyzer/lib/src/lint/analysis.dart
index d62aaa0..e3dae80 100644
--- a/analyzer/lib/src/lint/analysis.dart
+++ b/analyzer/lib/src/lint/analysis.dart
@@ -10,7 +10,7 @@
import 'package:analyzer/file_system/file_system.dart'
show File, Folder, ResourceProvider, ResourceUriResolver;
import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/source/analysis_options_provider.dart';
+import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
diff --git a/analyzer/lib/src/lint/config.dart b/analyzer/lib/src/lint/config.dart
index 6f5268d..1645b5a 100644
--- a/analyzer/lib/src/lint/config.dart
+++ b/analyzer/lib/src/lint/config.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/lint/io.dart b/analyzer/lib/src/lint/io.dart
index 3e84c4d..bd3e4a0 100644
--- a/analyzer/lib/src/lint/io.dart
+++ b/analyzer/lib/src/lint/io.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/lint/linter.dart b/analyzer/lib/src/lint/linter.dart
index c60b97d..331d7a6 100644
--- a/analyzer/lib/src/lint/linter.dart
+++ b/analyzer/lib/src/lint/linter.dart
@@ -14,6 +14,7 @@
import 'package:analyzer/file_system/file_system.dart' as file_system;
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/token.dart';
+import 'package:analyzer/src/dart/constant/potentially_constant.dart';
import 'package:analyzer/src/dart/error/lint_codes.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisErrorInfo, AnalysisErrorInfoImpl, AnalysisOptions, Logger;
@@ -43,6 +44,7 @@
static final _camelCaseTester = new RegExp(r'^([_$]*)([A-Z?$]+[a-z0-9]*)+$');
final String value;
+
CamelCaseString(this.value) {
if (!isCamelCase(value)) {
throw new ArgumentError('$value is not CamelCase');
@@ -189,8 +191,11 @@
final String label;
final String href;
final bool bold;
+
const Hyperlink(this.label, this.href, {this.bold: false});
+
String get html => '<a href="$href">${_emph(label)}</a>';
+
String _emph(msg) => bold ? '<strong>$msg</strong>' : msg;
}
@@ -218,6 +223,16 @@
/// Note that this method can cause constant evaluation to occur, which can be
/// computationally expensive.
bool canBeConst(InstanceCreationExpression expression);
+
+ /// Return `true` if it would be valid for the given constructor declaration
+ /// [node] to have a keyword of `const`.
+ ///
+ /// The [node] is expected to be a node within one of the compilation
+ /// units in [allUnits].
+ ///
+ /// Note that this method can cause constant evaluation to occur, which can be
+ /// computationally expensive.
+ bool canBeConstConstructor(ConstructorDeclaration node);
}
/// Implementation of [LinterContext]
@@ -257,18 +272,50 @@
// exception.
//
Token oldKeyword = expression.keyword;
- ConstantAnalysisErrorListener listener =
- new ConstantAnalysisErrorListener();
try {
expression.keyword = new KeywordToken(Keyword.CONST, expression.offset);
- LibraryElement library = element.library;
- ErrorReporter errorReporter = new ErrorReporter(listener, element.source);
- expression.accept(new ConstantVerifier(
- errorReporter, library, typeProvider, declaredVariables));
+ return !_hasConstantVerifierError(expression);
} finally {
expression.keyword = oldKeyword;
}
- return !listener.hasConstError;
+ }
+
+ @override
+ bool canBeConstConstructor(ConstructorDeclaration node) {
+ ConstructorElement element = node.declaredElement;
+
+ ClassElement classElement = element.enclosingElement;
+ if (classElement.hasNonFinalField) return false;
+
+ var oldKeyword = node.constKeyword;
+ try {
+ temporaryConstConstructorElements[element] = true;
+ node.constKeyword = KeywordToken(Keyword.CONST, node.offset);
+ return !_hasConstantVerifierError(node);
+ } finally {
+ temporaryConstConstructorElements[element] = null;
+ node.constKeyword = oldKeyword;
+ }
+ }
+
+ /// Return `true` if [ConstantVerifier] reports an error for the [node].
+ bool _hasConstantVerifierError(AstNode node) {
+ var unitElement = currentUnit.unit.declaredElement;
+ var libraryElement = unitElement.library;
+
+ var listener = ConstantAnalysisErrorListener();
+ var errorReporter = ErrorReporter(listener, unitElement.source);
+
+ node.accept(
+ ConstantVerifier(
+ errorReporter,
+ libraryElement,
+ typeProvider,
+ declaredVariables,
+ featureSet: currentUnit.unit.featureSet,
+ ),
+ );
+ return listener.hasConstError;
}
}
@@ -299,10 +346,12 @@
String analysisOptions;
LintFilter filter;
file_system.ResourceProvider resourceProvider;
+
// todo (pq): consider migrating to named params (but note Linter dep).
LinterOptions([this.enabledLints, this.analysisOptions]) {
enabledLints ??= Registry.ruleRegistry;
}
+
void configure(LintConfig config) {
enabledLints = Registry.ruleRegistry.where((LintRule rule) =>
!config.ruleConfigs.any((rc) => rc.disables(rule.name)));
@@ -478,6 +527,7 @@
abstract class Reporter {
void exception(LinterException exception);
+
void warn(String message);
}
diff --git a/analyzer/lib/src/lint/linter_visitor.dart b/analyzer/lib/src/lint/linter_visitor.dart
index 6663be8..79fff64 100644
--- a/analyzer/lib/src/lint/linter_visitor.dart
+++ b/analyzer/lib/src/lint/linter_visitor.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -265,13 +265,6 @@
}
@override
- @deprecated
- void visitForEachStatement(ForEachStatement node) {
- _runSubscriptions(node, registry._forForEachStatement);
- super.visitForEachStatement(node);
- }
-
- @override
void visitForElement(ForElement node) {
_runSubscriptions(node, registry._forForElement);
super.visitForElement(node);
@@ -296,19 +289,12 @@
}
@override
- @deprecated
void visitForStatement(ForStatement node) {
_runSubscriptions(node, registry._forForStatement);
super.visitForStatement(node);
}
@override
- void visitForStatement2(ForStatement2 node) {
- _runSubscriptions(node, registry._forForStatement2);
- super.visitForStatement2(node);
- }
-
- @override
void visitFunctionDeclaration(FunctionDeclaration node) {
_runSubscriptions(node, registry._forFunctionDeclaration);
super.visitFunctionDeclaration(node);
@@ -453,13 +439,6 @@
}
@override
- @deprecated
- void visitMapLiteral(MapLiteral node) {
- _runSubscriptions(node, registry._forMapLiteral);
- super.visitMapLiteral(node);
- }
-
- @override
void visitMapLiteralEntry(MapLiteralEntry node) {
_runSubscriptions(node, registry._forMapLiteralEntry);
super.visitMapLiteralEntry(node);
@@ -792,17 +771,13 @@
_forForEachPartsWithDeclaration = [];
final List<_Subscription<ForEachPartsWithIdentifier>>
_forForEachPartsWithIdentifier = [];
- @Deprecated('Use _forForStatement2')
- final List<_Subscription<ForEachStatement>> _forForEachStatement = [];
final List<_Subscription<ForElement>> _forForElement = [];
final List<_Subscription<FormalParameterList>> _forFormalParameterList = [];
final List<_Subscription<ForPartsWithDeclarations>>
_forForPartsWithDeclarations = [];
final List<_Subscription<ForPartsWithExpression>> _forForPartsWithExpression =
[];
- @Deprecated('Use _forForStatement2')
final List<_Subscription<ForStatement>> _forForStatement = [];
- final List<_Subscription<ForStatement2>> _forForStatement2 = [];
final List<_Subscription<FunctionDeclaration>> _forFunctionDeclaration = [];
final List<_Subscription<FunctionDeclarationStatement>>
_forFunctionDeclarationStatement = [];
@@ -832,8 +807,6 @@
final List<_Subscription<LibraryDirective>> _forLibraryDirective = [];
final List<_Subscription<LibraryIdentifier>> _forLibraryIdentifier = [];
final List<_Subscription<ListLiteral>> _forListLiteral = [];
- @Deprecated('Use _forSetOrMapLiteral')
- final List<_Subscription<MapLiteral>> _forMapLiteral = [];
final List<_Subscription<MapLiteralEntry>> _forMapLiteralEntry = [];
final List<_Subscription<MethodDeclaration>> _forMethodDeclaration = [];
final List<_Subscription<MethodInvocation>> _forMethodInvocation = [];
@@ -1086,12 +1059,6 @@
.add(new _Subscription(linter, visitor, _getTimer(linter)));
}
- @Deprecated('Use addForStatement2')
- void addForEachStatement(LintRule linter, AstVisitor visitor) {
- _forForEachStatement
- .add(new _Subscription(linter, visitor, _getTimer(linter)));
- }
-
void addForElement(LintRule linter, AstVisitor visitor) {
_forForElement.add(new _Subscription(linter, visitor, _getTimer(linter)));
}
@@ -1111,14 +1078,13 @@
.add(new _Subscription(linter, visitor, _getTimer(linter)));
}
- @Deprecated('Use addForStatement2')
void addForStatement(LintRule linter, AstVisitor visitor) {
_forForStatement.add(new _Subscription(linter, visitor, _getTimer(linter)));
}
+ @Deprecated('Replaced by addForStatement')
void addForStatement2(LintRule linter, AstVisitor visitor) {
- _forForStatement2
- .add(new _Subscription(linter, visitor, _getTimer(linter)));
+ addForStatement(linter, visitor);
}
void addFunctionDeclaration(LintRule linter, AstVisitor visitor) {
@@ -1236,11 +1202,6 @@
_forListLiteral.add(new _Subscription(linter, visitor, _getTimer(linter)));
}
- @Deprecated('Use addSetOrMapLiteral')
- void addMapLiteral(LintRule linter, AstVisitor visitor) {
- _forMapLiteral.add(new _Subscription(linter, visitor, _getTimer(linter)));
- }
-
void addMapLiteralEntry(LintRule linter, AstVisitor visitor) {
_forMapLiteralEntry
.add(new _Subscription(linter, visitor, _getTimer(linter)));
diff --git a/analyzer/lib/src/lint/options_rule_validator.dart b/analyzer/lib/src/lint/options_rule_validator.dart
index 9b28b1a..593dee4 100644
--- a/analyzer/lib/src/lint/options_rule_validator.dart
+++ b/analyzer/lib/src/lint/options_rule_validator.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/lint/project.dart b/analyzer/lib/src/lint/project.dart
index 7243747..f76a03e 100644
--- a/analyzer/lib/src/lint/project.dart
+++ b/analyzer/lib/src/lint/project.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/lint/util.dart b/analyzer/lib/src/lint/util.dart
index 2e12794..57e33be 100644
--- a/analyzer/lib/src/lint/util.dart
+++ b/analyzer/lib/src/lint/util.dart
@@ -4,6 +4,7 @@
import 'dart:io';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
@@ -89,6 +90,7 @@
class Spelunker {
final String path;
final IOSink sink;
+
Spelunker(this.path, {IOSink sink}) : this.sink = sink ?? stdout;
void spelunk() {
@@ -98,12 +100,16 @@
var reader = new CharSequenceReader(contents);
var stringSource = new StringSource(contents, path);
- var scanner = new Scanner(stringSource, reader, errorListener);
+ // TODO(paulberry): figure out the appropriate featureSet to use here
+ var featureSet = FeatureSet.fromEnableFlags([]);
+ var scanner = new Scanner(stringSource, reader, errorListener)
+ ..configureFeatures(featureSet);
var startToken = scanner.tokenize();
errorListener.throwIfErrors();
- var parser = new Parser(stringSource, errorListener);
+ var parser =
+ new Parser(stringSource, errorListener, featureSet: featureSet);
var node = parser.parseCompilationUnit(startToken);
errorListener.throwIfErrors();
@@ -132,6 +138,7 @@
int indent = 0;
final IOSink sink;
+
_SourceVisitor(this.sink);
String asString(AstNode node) =>
diff --git a/analyzer/lib/src/manifest/manifest_validator.dart b/analyzer/lib/src/manifest/manifest_validator.dart
new file mode 100644
index 0000000..c3f7c29
--- /dev/null
+++ b/analyzer/lib/src/manifest/manifest_validator.dart
@@ -0,0 +1,171 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:html/dom.dart';
+import 'package:html/parser.dart' show parseFragment;
+import 'package:source_span/source_span.dart';
+
+import 'manifest_values.dart';
+import 'manifest_warning_code.dart';
+
+class ManifestValidator {
+ /**
+ * The source representing the file being validated.
+ */
+ final Source source;
+
+ /**
+ * Initialize a newly create validator to validate the content of the given
+ * [source].
+ */
+ ManifestValidator(this.source);
+
+ /*
+ * Validate the [contents] of the Android Manifest file.
+ */
+ List<AnalysisError> validate(String contents, bool checkManifest) {
+ RecordingErrorListener recorder = new RecordingErrorListener();
+ ErrorReporter reporter = new ErrorReporter(recorder, source);
+
+ if (checkManifest) {
+ var document =
+ parseFragment(contents, container: MANIFEST_TAG, generateSpans: true);
+ var manifest = document.children.firstWhere(
+ (element) => element.localName == MANIFEST_TAG,
+ orElse: () => null);
+ var features = manifest?.getElementsByTagName(USES_FEATURE_TAG) ?? [];
+ var permissions =
+ manifest?.getElementsByTagName(USES_PERMISSION_TAG) ?? [];
+ var activities = _findActivityElements(manifest);
+
+ _validateTouchScreenFeature(features, manifest, reporter);
+ _validateFeatures(features, reporter);
+ _validatePermissions(permissions, features, reporter);
+ _validateActivities(activities, reporter);
+ }
+ return recorder.errors;
+ }
+
+ /*
+ * Validate the presence/absence of the touchscreen feature tag.
+ */
+ _validateTouchScreenFeature(
+ List<Element> features, Element manifest, ErrorReporter reporter) {
+ var feature = features.firstWhere(
+ (element) =>
+ element.attributes[ANDROID_NAME] == HARDWARE_FEATURE_TOUCHSCREEN,
+ orElse: () => null);
+ if (feature != null) {
+ if (!feature.attributes.containsKey(ANDROID_REQUIRED)) {
+ _reportErrorForNode(reporter, feature, ANDROID_NAME,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_HARDWARE);
+ } else if (feature.attributes[ANDROID_REQUIRED] == 'true') {
+ _reportErrorForNode(reporter, feature, ANDROID_NAME,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_FEATURE);
+ }
+ } else {
+ _reportErrorForNode(
+ reporter, manifest, null, ManifestWarningCode.NO_TOUCHSCREEN_FEATURE);
+ }
+ }
+
+ /*
+ * Validate the `uses-feature` tags.
+ */
+ _validateFeatures(List<Element> features, ErrorReporter reporter) {
+ var unsupported = features
+ .where((element) => UNSUPPORTED_HARDWARE_FEATURES
+ .contains(element.attributes[ANDROID_NAME]))
+ .toList();
+ unsupported.forEach((element) {
+ if (!element.attributes.containsKey(ANDROID_REQUIRED)) {
+ _reportErrorForNode(reporter, element, ANDROID_NAME,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_HARDWARE);
+ } else if (element.attributes[ANDROID_REQUIRED] == 'true') {
+ _reportErrorForNode(reporter, element, ANDROID_NAME,
+ ManifestWarningCode.UNSUPPORTED_CHROME_OS_FEATURE);
+ }
+ });
+ }
+
+ /*
+ * Validate the `uses-permission` tags.
+ */
+ _validatePermissions(List<Element> permissions, List<Element> features,
+ ErrorReporter reporter) {
+ permissions.forEach((permission) {
+ if (permission.attributes[ANDROID_NAME] == ANDROID_PERMISSION_CAMERA) {
+ if (!_hasFeatureCamera(features) ||
+ !_hasFeatureCameraAutoFocus(features)) {
+ _reportErrorForNode(reporter, permission, ANDROID_NAME,
+ ManifestWarningCode.CAMERA_PERMISSIONS_INCOMPATIBLE);
+ }
+ } else {
+ var featureName =
+ getImpliedUnsupportedHardware(permission.attributes[ANDROID_NAME]);
+ if (featureName != null) {
+ _reportErrorForNode(
+ reporter,
+ permission,
+ ANDROID_NAME,
+ ManifestWarningCode.PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE,
+ [featureName]);
+ }
+ }
+ });
+ }
+
+ /*
+ * Validate the 'activity' tags.
+ */
+ _validateActivities(List<Element> activites, ErrorReporter reporter) {
+ activites.forEach((activity) {
+ var attributes = activity.attributes;
+ if (attributes.containsKey(ATTRIBUTE_SCREEN_ORIENTATION)) {
+ if (UNSUPPORTED_ORIENTATIONS
+ .contains(attributes[ATTRIBUTE_SCREEN_ORIENTATION])) {
+ _reportErrorForNode(reporter, activity, ATTRIBUTE_SCREEN_ORIENTATION,
+ ManifestWarningCode.SETTING_ORIENTATION_ON_ACTIVITY);
+ }
+ }
+ if (attributes.containsKey(ATTRIBUTE_RESIZEABLE_ACTIVITY)) {
+ if (attributes[ATTRIBUTE_RESIZEABLE_ACTIVITY] == 'false') {
+ _reportErrorForNode(reporter, activity, ATTRIBUTE_RESIZEABLE_ACTIVITY,
+ ManifestWarningCode.NON_RESIZABLE_ACTIVITY);
+ }
+ }
+ });
+ }
+
+ List<Element> _findActivityElements(Element manifest) {
+ var applications = manifest?.getElementsByTagName(APPLICATION_TAG);
+ var applicationElement = (applications != null && applications.isNotEmpty)
+ ? applications.first
+ : null;
+ var activities =
+ applicationElement?.getElementsByTagName(ACTIVITY_TAG) ?? [];
+ return activities;
+ }
+
+ bool _hasFeatureCamera(List<Element> features) =>
+ features.any((f) => f.localName == HARDWARE_FEATURE_CAMERA);
+
+ bool _hasFeatureCameraAutoFocus(List<Element> features) =>
+ features.any((f) => f.localName == HARDWARE_FEATURE_CAMERA_AUTOFOCUS);
+
+ /**
+ * Report an error for the given node.
+ */
+ void _reportErrorForNode(
+ ErrorReporter reporter, Node node, dynamic key, ErrorCode errorCode,
+ [List<Object> arguments]) {
+ FileSpan span =
+ key == null ? node.sourceSpan : node.attributeValueSpans[key];
+ reporter.reportErrorForOffset(
+ errorCode, span.start.offset, span.length, arguments);
+ }
+}
diff --git a/analyzer/lib/src/manifest/manifest_values.dart b/analyzer/lib/src/manifest/manifest_values.dart
new file mode 100644
index 0000000..f44a4ba
--- /dev/null
+++ b/analyzer/lib/src/manifest/manifest_values.dart
@@ -0,0 +1,124 @@
+// Copyright (c) 2019, 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.
+
+/*
+* The attribute values to check for compatibility with Chrome OS.
+*
+*/
+
+const String MANIFEST_TAG = 'manifest';
+
+const String USES_PERMISSION_TAG = 'uses-permission';
+
+const String USES_FEATURE_TAG = 'uses-feature';
+
+const String APPLICATION_TAG = 'application';
+
+const String ACTIVITY_TAG = 'activity';
+
+const String ANDROID_NAME = 'android:name';
+
+const String ANDROID_REQUIRED = 'android:required';
+
+// The parser does not maintain camelcase for attributes
+// Use 'resizeableactivity' instead of 'resizeableActivity'
+const String ATTRIBUTE_RESIZEABLE_ACTIVITY = 'android:resizeableactivity';
+
+// Use 'screenorientation' instead of 'screenOrientation'
+const String ATTRIBUTE_SCREEN_ORIENTATION = 'android:screenorientation';
+
+const String HARDWARE_FEATURE_CAMERA = 'android.hardware.camera';
+
+const String HARDWARE_FEATURE_TOUCHSCREEN = 'android.hardware.touchscreen';
+
+const String HARDWARE_FEATURE_CAMERA_AUTOFOCUS =
+ 'android.hardware.camera.autofocus';
+
+const String HARDWARE_FEATURE_TELEPHONY = 'android.hardware.telephony';
+
+const String ANDROID_PERMISSION_CAMERA = 'android.permission.CAMERA';
+
+const UNSUPPORTED_HARDWARE_FEATURES = <String>[
+ HARDWARE_FEATURE_CAMERA,
+ HARDWARE_FEATURE_CAMERA_AUTOFOCUS,
+ 'android.hardware.camera.capability.manual_post_processing',
+ 'android.hardware.camera.capability.manual_sensor',
+ 'android.hardware.camera.capability.raw',
+ 'android.hardware.camera.flash',
+ 'android.hardware.camera.level.full',
+ 'android.hardware.consumerir',
+ 'android.hardware.location.gps',
+ 'android.hardware.nfc',
+ 'android.hardware.nfc.hce',
+ 'android.hardware.sensor.barometer',
+ HARDWARE_FEATURE_TELEPHONY,
+ 'android.hardware.telephony.cdma',
+ 'android.hardware.telephony.gsm',
+ 'android.hardware.type.automotive',
+ 'android.hardware.type.television',
+ 'android.hardware.usb.accessory',
+ 'android.hardware.usb.host',
+ // Partially-supported, only on some Chrome OS devices.
+ 'android.hardware.sensor.accelerometer',
+ 'android.hardware.sensor.compass',
+ 'android.hardware.sensor.gyroscope',
+ 'android.hardware.sensor.light',
+ 'android.hardware.sensor.proximity',
+ 'android.hardware.sensor.stepcounter',
+ 'android.hardware.sensor.stepdetector',
+ // Software features that are not supported
+ 'android.software.app_widgets',
+ 'android.software.device_admin',
+ 'android.software.home_screen',
+ 'android.software.input_methods',
+ 'android.software.leanback',
+ 'android.software.live_wallpaper',
+ 'android.software.live_tv',
+ 'android.software.managed_users',
+ 'android.software.midi',
+ 'android.software.sip',
+ 'android.software.sip.voip',
+];
+
+String getImpliedUnsupportedHardware(String permission) {
+ switch (permission) {
+ case ANDROID_PERMISSION_CAMERA:
+ return HARDWARE_FEATURE_CAMERA;
+ case 'android.permission.CALL_PHONE':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.CALL_PRIVILEGED':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.MODIFY_PHONE_STATE':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.PROCESS_OUTGOING_CALLS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.READ_SMS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.RECEIVE_SMS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.RECEIVE_MMS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.RECEIVE_WAP_PUSH':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.SEND_SMS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.WRITE_APN_SETTINGS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ case 'android.permission.WRITE_SMS':
+ return HARDWARE_FEATURE_TELEPHONY;
+ default:
+ return null;
+ }
+}
+
+const UNSUPPORTED_ORIENTATIONS = <String>[
+ 'landscape',
+ 'portrait',
+ 'reverseLandscape',
+ 'reversePortrait',
+ 'sensorLandscape',
+ 'sensorPortrait',
+ 'userLandscape',
+ 'userPortrait'
+];
diff --git a/analyzer/lib/src/manifest/manifest_warning_code.dart b/analyzer/lib/src/manifest/manifest_warning_code.dart
new file mode 100644
index 0000000..cd9761d
--- /dev/null
+++ b/analyzer/lib/src/manifest/manifest_warning_code.dart
@@ -0,0 +1,99 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/error/error.dart';
+
+/**
+ * The error codes used for warnings in analysis options files. The convention
+ * for this class is for the name of the error code to indicate the problem that
+ * caused the error to be generated and for the error message to explain what is
+ * wrong and, when appropriate, how the problem can be corrected.
+ */
+class ManifestWarningCode extends ErrorCode {
+ /**
+ * A code indicating that a specified hardware feature is not supported on Chrome OS.
+ */
+ static const ManifestWarningCode UNSUPPORTED_CHROME_OS_HARDWARE =
+ const ManifestWarningCode('UNSUPPORTED_CHROME_OS_HARDWARE',
+ "This feature is not supported on Chrome OS, consider making it optional.",
+ correction:
+ "Try adding `android:required=\"false\"` for this " + "feature.");
+
+ /**
+ * A code indicating that a specified feature is not supported on Chrome OS.
+ */
+ static const ManifestWarningCode UNSUPPORTED_CHROME_OS_FEATURE =
+ const ManifestWarningCode('UNSUPPORTED_CHROME_OS_FEATURE',
+ "This feature is not supported on Chrome OS, consider making it optional.",
+ correction: "Try changing to `android:required=\"false\"` for this " +
+ "feature.");
+
+ /**
+ * A code indicating that the touchscreen feature is not specified in the
+ * manifest.
+ */
+ static const ManifestWarningCode NO_TOUCHSCREEN_FEATURE = const ManifestWarningCode(
+ 'NO_TOUCHSCREEN_FEATURE',
+ "The default \"android.hardware.touchscreen\" needs to be optional for Chrome OS. ",
+ correction: "Consider adding " +
+ "<uses-feature android:name=\"android.hardware.touchscreen\" android:required=\"false\" />" +
+ " to the manifest.");
+
+ /**
+ * A code indicating that a specified permission is not supported on Chrome OS.
+ */
+ static const ManifestWarningCode PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE =
+ const ManifestWarningCode('PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE',
+ "Permission makes app incompatible for Chrome OS, consider adding optional {0} feature tag, ",
+ correction: " Try adding `<uses-feature " +
+ "android:name=\"{0}\" android:required=\"false\">`.");
+
+ /**
+ * A code indicating that the camera permissions is not supported on Chrome OS.
+ */
+ static const ManifestWarningCode CAMERA_PERMISSIONS_INCOMPATIBLE = const ManifestWarningCode(
+ 'CAMERA_PERMISSIONS_INCOMPATIBLE',
+ "Camera permissions make app incompatible for Chrome OS, consider adding " +
+ "optional features \"android.hardware.camera\" and \"android.hardware.camera.autofocus\".",
+ correction: "Try adding `<uses-feature " +
+ "android:name=\"android.hardware.camera\" android:required=\"false\">` " +
+ "`<uses-feature " +
+ "android:name=\"android.hardware.camera.autofocus\" android:required=\"false\">`.");
+
+ /**
+ * A code indicating that the activity is set to be non resizable.
+ */
+ static const ManifestWarningCode NON_RESIZABLE_ACTIVITY =
+ const ManifestWarningCode(
+ 'NON_RESIZABLE_ACTIVITY',
+ "The `<activity>` element should be allowed to be resized to allow " +
+ "users to take advantage of the multi-window environment on Chrome OS",
+ correction: "Consider declaring the corresponding " +
+ "activity element with `resizableActivity=\"true\"` attribute.");
+
+ /**
+ * A code indicating that the activity is locked to an orientation.
+ */
+ static const ManifestWarningCode SETTING_ORIENTATION_ON_ACTIVITY =
+ const ManifestWarningCode(
+ 'SETTING_ORIENTATION_ON_ACTIVITY',
+ "The `<activity>` element should not be locked to any orientation so " +
+ "that users can take advantage of the multi-window environments " +
+ "and larger screens on Chrome OS",
+ correction: "Consider declaring the corresponding activity element with" +
+ " `screenOrientation=\"unspecified\"` or `\"fullSensor\"` attribute.");
+
+ /**
+ * Initialize a newly created warning code to have the given [name], [message]
+ * and [correction].
+ */
+ const ManifestWarningCode(String name, String message, {String correction})
+ : super.temporary(name, message, correction: correction);
+
+ @override
+ ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
+
+ @override
+ ErrorType get type => ErrorType.STATIC_WARNING;
+}
diff --git a/analyzer/lib/src/plugin/options.dart b/analyzer/lib/src/plugin/options.dart
index e259428..ebfa648 100644
--- a/analyzer/lib/src/plugin/options.dart
+++ b/analyzer/lib/src/plugin/options.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/plugin/resolver_provider.dart b/analyzer/lib/src/plugin/resolver_provider.dart
index abbb3a8..9ef7a7b 100644
--- a/analyzer/lib/src/plugin/resolver_provider.dart
+++ b/analyzer/lib/src/plugin/resolver_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/plugin/task.dart b/analyzer/lib/src/plugin/task.dart
index fec6844..54ec75e 100644
--- a/analyzer/lib/src/plugin/task.dart
+++ b/analyzer/lib/src/plugin/task.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/services/available_declarations.dart b/analyzer/lib/src/services/available_declarations.dart
index 4ec0123..1f18466 100644
--- a/analyzer/lib/src/services/available_declarations.dart
+++ b/analyzer/lib/src/services/available_declarations.dart
@@ -6,13 +6,18 @@
import 'dart:collection';
import 'package:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
+import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/string_source.dart';
@@ -28,6 +33,7 @@
/// A top-level public declaration.
class Declaration {
+ final List<Declaration> children;
final String defaultArgumentListString;
final List<int> defaultArgumentListTextRanges;
final String docComplete;
@@ -41,18 +47,11 @@
final String locationPath;
final int locationStartColumn;
final int locationStartLine;
-
- /// The name of the declaration.
- /// For enum constants, the name of the constant.
final String name;
-
- /// Usually `null`.
- /// For enum constants, the name of the enum.
- final String name2;
-
final String parameters;
final List<String> parameterNames;
final List<String> parameterTypes;
+ final Declaration parent;
final int requiredParameterCount;
final String returnType;
final String typeParameters;
@@ -60,6 +59,7 @@
List<String> _relevanceTags;
Declaration({
+ @required this.children,
@required this.defaultArgumentListString,
@required this.defaultArgumentListTextRanges,
@required this.docComplete,
@@ -74,10 +74,10 @@
@required this.locationStartColumn,
@required this.locationStartLine,
@required this.name,
- @required this.name2,
@required this.parameters,
@required this.parameterNames,
@required this.parameterTypes,
+ @required this.parent,
@required List<String> relevanceTags,
@required this.requiredParameterCount,
@required this.returnType,
@@ -88,11 +88,7 @@
@override
String toString() {
- if (name2 == null) {
- return '($kind, $name)';
- } else {
- return '($kind, $name, $name2)';
- }
+ return '($kind, $name)';
}
}
@@ -100,6 +96,7 @@
enum DeclarationKind {
CLASS,
CLASS_TYPE_ALIAS,
+ CONSTRUCTOR,
ENUM,
ENUM_CONSTANT,
FUNCTION,
@@ -129,6 +126,10 @@
/// The list of paths of all SDK libraries.
final List<String> _sdkLibraryPathList = [];
+ /// The combined information about all of the dartdoc directives in this
+ /// context.
+ final DartdocDirectiveInfo _dartdocDirectiveInfo = new DartdocDirectiveInfo();
+
/// Map of path prefixes to lists of paths of files from dependencies
/// (both libraries and parts, we don't know at the time when we fill this
/// map) that libraries with paths starting with these prefixes can access.
@@ -138,6 +139,10 @@
DeclarationsContext(this._tracker, this._analysisContext);
+ /// Return the combined information about all of the dartdoc directives in
+ /// this context.
+ DartdocDirectiveInfo get dartdocDirectiveInfo => _dartdocDirectiveInfo;
+
/// Return libraries that are available to the file with the given [path].
///
/// With `Pub`, files below the `pubspec.yaml` file can access libraries
@@ -622,18 +627,35 @@
var file = _getFileByPath(containingContext, path);
if (file == null) return;
- var isLibrary = file.isLibrary;
- var library = isLibrary ? file : file.library;
+ var wasLibrary = file.isLibrary;
+ var oldLibrary = wasLibrary ? file : file.library;
- if (isLibrary) {
- file.refresh(containingContext);
- } else {
- file.refresh(containingContext);
- library.refresh(containingContext);
- }
+ file.refresh(containingContext);
+ var isLibrary = file.isLibrary;
+ var newLibrary = isLibrary ? file : file.library;
var invalidatedLibraries = Set<_File>();
- _invalidateExportedDeclarations(invalidatedLibraries, library);
+ var notLibraries = <_File>[];
+ if (wasLibrary) {
+ if (isLibrary) {
+ _invalidateExportedDeclarations(invalidatedLibraries, file);
+ } else {
+ notLibraries.add(file);
+ if (newLibrary != null) {
+ newLibrary.refresh(containingContext);
+ _invalidateExportedDeclarations(invalidatedLibraries, newLibrary);
+ }
+ }
+ } else {
+ if (oldLibrary != null) {
+ oldLibrary.refresh(containingContext);
+ _invalidateExportedDeclarations(invalidatedLibraries, oldLibrary);
+ }
+ if (newLibrary != null && newLibrary != oldLibrary) {
+ newLibrary.refresh(containingContext);
+ _invalidateExportedDeclarations(invalidatedLibraries, newLibrary);
+ }
+ }
_computeExportedDeclarations(invalidatedLibraries);
var changedLibraries = <Library>[];
@@ -654,6 +676,10 @@
removedLibraries.add(libraryFile.id);
}
}
+ for (var file in notLibraries) {
+ _idToLibrary.remove(file.id);
+ removedLibraries.add(file.id);
+ }
_changesController.add(
LibraryChange._(changedLibraries, removedLibraries),
);
@@ -721,8 +747,8 @@
var name = declaration.name;
return <String>['$uriStr::$name'];
case DeclarationKind.ENUM_CONSTANT:
- var name2 = declaration.name2;
- return <String>['$uriStr::$name2'];
+ var enumName = declaration.parent.name;
+ return <String>['$uriStr::$enumName'];
default:
return null;
}
@@ -753,15 +779,14 @@
class _DeclarationStorage {
static const fieldDocMask = 1 << 0;
- static const fieldName2Mask = 1 << 1;
- static const fieldParametersMask = 1 << 2;
- static const fieldReturnTypeMask = 1 << 3;
- static const fieldTypeParametersMask = 1 << 4;
+ static const fieldParametersMask = 1 << 1;
+ static const fieldReturnTypeMask = 1 << 2;
+ static const fieldTypeParametersMask = 1 << 3;
- static Declaration fromIdl(String path, idl.AvailableDeclaration d) {
+ static Declaration fromIdl(
+ String path, Declaration parent, idl.AvailableDeclaration d) {
var fieldMask = d.fieldMask;
var hasDoc = fieldMask & fieldDocMask != 0;
- var hasName2 = fieldMask & fieldName2Mask != 0;
var hasParameters = fieldMask & fieldParametersMask != 0;
var hasReturnType = fieldMask & fieldReturnTypeMask != 0;
var hasTypeParameters = fieldMask & fieldTypeParametersMask != 0;
@@ -773,7 +798,9 @@
relevanceTags = null;
}
- return Declaration(
+ var children = <Declaration>[];
+ var declaration = Declaration(
+ children: children,
defaultArgumentListString: d.defaultArgumentListString.isNotEmpty
? d.defaultArgumentListString
: null,
@@ -792,15 +819,22 @@
locationStartColumn: d.locationStartColumn,
locationStartLine: d.locationStartLine,
name: d.name,
- name2: hasName2 ? d.name2 : null,
parameters: hasParameters ? d.parameters : null,
parameterNames: hasParameters ? d.parameterNames : null,
parameterTypes: hasParameters ? d.parameterTypes.toList() : null,
+ parent: parent,
relevanceTags: relevanceTags,
requiredParameterCount: hasParameters ? d.requiredParameterCount : null,
returnType: hasReturnType ? d.returnType : null,
typeParameters: hasTypeParameters ? d.typeParameters : null,
);
+
+ for (var childIdl in d.children) {
+ var child = fromIdl(path, declaration, childIdl);
+ children.add(child);
+ }
+
+ return declaration;
}
static DeclarationKind kindFromIdl(idl.AvailableDeclarationKind kind) {
@@ -809,6 +843,8 @@
return DeclarationKind.CLASS;
case idl.AvailableDeclarationKind.CLASS_TYPE_ALIAS:
return DeclarationKind.CLASS_TYPE_ALIAS;
+ case idl.AvailableDeclarationKind.CONSTRUCTOR:
+ return DeclarationKind.CONSTRUCTOR;
case idl.AvailableDeclarationKind.ENUM:
return DeclarationKind.ENUM;
case idl.AvailableDeclarationKind.ENUM_CONSTANT:
@@ -836,6 +872,8 @@
return idl.AvailableDeclarationKind.CLASS;
case DeclarationKind.CLASS_TYPE_ALIAS:
return idl.AvailableDeclarationKind.CLASS_TYPE_ALIAS;
+ case DeclarationKind.CONSTRUCTOR:
+ return idl.AvailableDeclarationKind.CONSTRUCTOR;
case DeclarationKind.ENUM:
return idl.AvailableDeclarationKind.ENUM;
case DeclarationKind.ENUM_CONSTANT:
@@ -862,9 +900,6 @@
if (d.docComplete != null) {
fieldMask |= fieldDocMask;
}
- if (d.name2 != null) {
- fieldMask |= fieldName2Mask;
- }
if (d.parameters != null) {
fieldMask |= fieldParametersMask;
}
@@ -877,6 +912,7 @@
var idlKind = kindToIdl(d.kind);
return idl.AvailableDeclarationBuilder(
+ children: d.children.map(toIdl).toList(),
defaultArgumentListString: d.defaultArgumentListString,
defaultArgumentListTextRanges: d.defaultArgumentListTextRanges,
docComplete: d.docComplete,
@@ -891,7 +927,6 @@
locationStartColumn: d.locationStartColumn,
locationStartLine: d.locationStartLine,
name: d.name,
- name2: d.name2,
parameters: d.parameters,
parameterNames: d.parameterNames,
parameterTypes: d.parameterTypes,
@@ -920,7 +955,7 @@
Iterable<Declaration> filter(List<Declaration> declarations) {
return declarations.where((d) {
- var name = d.name2 ?? d.name;
+ var name = d.name;
for (var combinator in combinators) {
if (combinator.shows.isNotEmpty) {
if (!combinator.shows.contains(name)) return false;
@@ -943,7 +978,7 @@
class _File {
/// The version of data format, should be incremented on every format change.
- static const int DATA_VERSION = 8;
+ static const int DATA_VERSION = 11;
/// The next value for [id].
static int _nextId = 0;
@@ -970,6 +1005,9 @@
List<Declaration> libraryDeclarations = [];
List<Declaration> exportedDeclarations;
+ List<String> templateNames = [];
+ List<String> templateValues = [];
+
/// If `true`, then this library has already been sent to the client.
bool isSent = false;
@@ -1026,9 +1064,14 @@
CompilationUnit unit = _parse(content);
_buildFileDeclarations(unit);
+ _extractDartdocInfoFromUnit(unit);
_putFileDeclarationsToByteStore(contentKey);
+ context.dartdocDirectiveInfo
+ .addTemplateNamesAndValues(templateNames, templateValues);
} else {
_readFileDeclarationsFromBytes(bytes);
+ context.dartdocDirectiveInfo
+ .addTemplateNamesAndValues(templateNames, templateValues);
}
// Resolve exports and parts.
@@ -1043,7 +1086,10 @@
// Set back pointers.
for (var export in exports) {
- export.file.directExporters.add(this);
+ var directExporters = export.file.directExporters;
+ if (!directExporters.contains(this)) {
+ directExporters.add(this);
+ }
}
for (var part in parts) {
part.file.library = this;
@@ -1057,7 +1103,7 @@
for (var part in parts) {
libraryDeclarations.addAll(part.file.fileDeclarations);
}
- _computeRelevanceTagsForLibraryDeclarations();
+ _computeRelevanceTags(libraryDeclarations);
}
}
@@ -1067,6 +1113,8 @@
fileDeclarations = [];
libraryDeclarations = null;
exportedDeclarations = null;
+ templateNames = [];
+ templateValues = [];
for (var astDirective in unit.directives) {
if (astDirective is ExportDirective) {
@@ -1117,7 +1165,7 @@
}
}
- void addDeclaration({
+ Declaration addDeclaration({
String defaultArgumentListString,
List<int> defaultArgumentListTextRanges,
bool isAbstract = false,
@@ -1126,23 +1174,23 @@
bool isFinal = false,
@required DeclarationKind kind,
@required Identifier name,
- Identifier name2,
String parameters,
List<String> parameterNames,
List<String> parameterTypes,
+ Declaration parent,
List<String> relevanceTags,
int requiredParameterCount,
String returnType,
String typeParameters,
}) {
- if (Identifier.isPrivateName(name.name) ||
- name2 != null && Identifier.isPrivateName(name2.name)) {
- return;
+ if (Identifier.isPrivateName(name.name)) {
+ return null;
}
var locationOffset = name.offset;
var lineLocation = lineInfo.getLocation(locationOffset);
- fileDeclarations.add(Declaration(
+ var declaration = Declaration(
+ children: <Declaration>[],
defaultArgumentListString: defaultArgumentListString,
defaultArgumentListTextRanges: defaultArgumentListTextRanges,
docComplete: docComplete,
@@ -1155,17 +1203,24 @@
locationOffset: locationOffset,
locationPath: path,
name: name.name,
- name2: name2?.name,
locationStartColumn: lineLocation.columnNumber,
locationStartLine: lineLocation.lineNumber,
parameters: parameters,
parameterNames: parameterNames,
parameterTypes: parameterTypes,
+ parent: parent,
relevanceTags: relevanceTags,
requiredParameterCount: requiredParameterCount,
returnType: returnType,
typeParameters: typeParameters,
- ));
+ );
+
+ if (parent != null) {
+ parent.children.add(declaration);
+ } else {
+ fileDeclarations.add(declaration);
+ }
+ return declaration;
}
for (var node in unit.declarations) {
@@ -1173,12 +1228,77 @@
var isDeprecated = _hasDeprecatedAnnotation(node);
if (node is ClassDeclaration) {
- addDeclaration(
+ var classDeclaration = addDeclaration(
isAbstract: node.isAbstract,
isDeprecated: isDeprecated,
kind: DeclarationKind.CLASS,
name: node.name,
);
+ if (classDeclaration == null) continue;
+
+ var hasConstructor = false;
+ for (var classMember in node.members) {
+ if (classMember is ConstructorDeclaration) {
+ setDartDoc(classMember);
+ isDeprecated = _hasDeprecatedAnnotation(classMember);
+
+ var parameters = classMember.parameters;
+ var defaultArguments = _computeDefaultArguments(parameters);
+
+ var constructorName = classMember.name;
+ constructorName ??= SimpleIdentifierImpl(
+ StringToken(
+ TokenType.IDENTIFIER,
+ '',
+ classMember.returnType.offset,
+ ),
+ );
+
+ addDeclaration(
+ defaultArgumentListString: defaultArguments?.text,
+ defaultArgumentListTextRanges: defaultArguments?.ranges,
+ isDeprecated: isDeprecated,
+ kind: DeclarationKind.CONSTRUCTOR,
+ name: constructorName,
+ parameters: parameters.toSource(),
+ parameterNames: _getFormalParameterNames(parameters),
+ parameterTypes: _getFormalParameterTypes(parameters),
+ parent: classDeclaration,
+ requiredParameterCount:
+ _getFormalParameterRequiredCount(parameters),
+ returnType: node.name.name,
+ );
+ hasConstructor = true;
+ }
+ }
+
+ if (!hasConstructor) {
+ classDeclaration.children.add(Declaration(
+ children: [],
+ defaultArgumentListString: null,
+ defaultArgumentListTextRanges: null,
+ docComplete: null,
+ docSummary: null,
+ isAbstract: false,
+ isConst: false,
+ isDeprecated: false,
+ isFinal: false,
+ kind: DeclarationKind.CONSTRUCTOR,
+ locationOffset: -1,
+ locationPath: path,
+ name: '',
+ locationStartColumn: 0,
+ locationStartLine: 0,
+ parameters: '()',
+ parameterNames: [],
+ parameterTypes: [],
+ parent: classDeclaration,
+ relevanceTags: null,
+ requiredParameterCount: 0,
+ returnType: node.name.name,
+ typeParameters: null,
+ ));
+ }
} else if (node is ClassTypeAlias) {
addDeclaration(
isDeprecated: isDeprecated,
@@ -1186,11 +1306,13 @@
name: node.name,
);
} else if (node is EnumDeclaration) {
- addDeclaration(
+ var enumDeclaration = addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.ENUM,
name: node.name,
);
+ if (enumDeclaration == null) continue;
+
for (var constant in node.constants) {
setDartDoc(constant);
var isDeprecated = _hasDeprecatedAnnotation(constant);
@@ -1198,7 +1320,7 @@
isDeprecated: isDeprecated,
kind: DeclarationKind.ENUM_CONSTANT,
name: constant.name,
- name2: node.name,
+ parent: enumDeclaration,
);
}
} else if (node is FunctionDeclaration) {
@@ -1241,6 +1363,8 @@
}
} else if (node is GenericTypeAlias) {
var functionType = node.functionType;
+ if (functionType == null) continue;
+
var parameters = functionType.parameters;
addDeclaration(
isDeprecated: isDeprecated,
@@ -1277,10 +1401,47 @@
}
}
- void _computeRelevanceTagsForLibraryDeclarations() {
- for (var declaration in libraryDeclarations) {
+ void _computeRelevanceTags(List<Declaration> declarations) {
+ for (var declaration in declarations) {
declaration._relevanceTags ??=
RelevanceTags._forDeclaration(uriStr, declaration);
+ _computeRelevanceTags(declaration.children);
+ }
+ }
+
+ void _extractDartdocInfoFromUnit(CompilationUnit unit) {
+ DartdocDirectiveInfo info = new DartdocDirectiveInfo();
+ for (Directive directive in unit.directives) {
+ Comment comment = directive.documentationComment;
+ if (comment != null) {
+ info.extractTemplate(getCommentNodeRawText(comment));
+ }
+ }
+ for (CompilationUnitMember declaration in unit.declarations) {
+ Comment comment = declaration.documentationComment;
+ if (comment != null) {
+ info.extractTemplate(getCommentNodeRawText(comment));
+ }
+ if (declaration is ClassOrMixinDeclaration) {
+ for (ClassMember member in declaration.members) {
+ Comment comment = member.documentationComment;
+ if (comment != null) {
+ info.extractTemplate(getCommentNodeRawText(comment));
+ }
+ }
+ } else if (declaration is EnumDeclaration) {
+ for (EnumConstantDeclaration constant in declaration.constants) {
+ Comment comment = constant.documentationComment;
+ if (comment != null) {
+ info.extractTemplate(getCommentNodeRawText(comment));
+ }
+ }
+ }
+ }
+ Map<String, String> templateMap = info.templateMap;
+ for (String name in templateMap.keys) {
+ templateNames.add(name);
+ templateValues.add(templateMap[name]);
}
}
@@ -1307,6 +1468,8 @@
declarations: fileDeclarations.map((d) {
return _DeclarationStorage.toIdl(d);
}).toList(),
+ directiveInfo: idl.DirectiveInfoBuilder(
+ templateNames: templateNames, templateValues: templateValues),
);
var bytes = builder.toBuffer();
tracker._byteStore.put(contentKey, bytes);
@@ -1333,8 +1496,11 @@
}).toList();
fileDeclarations = idlFile.declarations.map((e) {
- return _DeclarationStorage.fromIdl(path, e);
+ return _DeclarationStorage.fromIdl(path, null, e);
}).toList();
+
+ templateNames = idlFile.directiveInfo.templateNames.toList();
+ templateValues = idlFile.directiveInfo.templateValues.toList();
}
static _DefaultArguments _computeDefaultArguments(
@@ -1346,6 +1512,10 @@
if (buffer.isNotEmpty) {
buffer.write(', ');
}
+ if (parameter.isNamed) {
+ buffer.write(parameter.identifier.name);
+ buffer.write(': ');
+ }
var valueOffset = buffer.length;
buffer.write(parameter.identifier.name);
var valueLength = buffer.length - valueOffset;
@@ -1385,7 +1555,7 @@
if (parameters == null) return null;
return parameters.parameters
- .takeWhile((parameter) => parameter.isRequired)
+ .takeWhile((parameter) => parameter.isRequiredPositional)
.length;
}
@@ -1446,10 +1616,14 @@
var source = StringSource(content, '');
var reader = new CharSequenceReader(content);
- var scanner = new Scanner(null, reader, errorListener);
+ // TODO(paulberry): figure out the appropriate FeatureSet to use here
+ var featureSet = FeatureSet.fromEnableFlags([]);
+ var scanner = new Scanner(null, reader, errorListener)
+ ..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = new Parser(source, errorListener, useFasta: true);
+ var parser = new Parser(source, errorListener,
+ featureSet: featureSet, useFasta: true);
var unit = parser.parseCompilationUnit(token);
unit.lineInfo = LineInfo(scanner.lineStarts);
@@ -1487,7 +1661,11 @@
@override
List<_LibraryNode> computeDependencies() {
- return file.exports.map((e) => e.file).map(walker.getNode).toList();
+ return file.exports
+ .map((export) => export.file)
+ .where((file) => file.isLibrary)
+ .map(walker.getNode)
+ .toList();
}
}
@@ -1501,8 +1679,11 @@
resultSet.addAll(file.libraryDeclarations);
for (var export in file.exports) {
- var exportedDeclarations = export.file.exportedDeclarations;
- resultSet.addAll(export.filter(exportedDeclarations));
+ var file = export.file;
+ if (file.isLibrary) {
+ var exportedDeclarations = file.exportedDeclarations;
+ resultSet.addAll(export.filter(exportedDeclarations));
+ }
}
file.exportedDeclarations = resultSet.toList();
@@ -1550,7 +1731,7 @@
static Set<Declaration> _newDeclarationSet() {
return HashSet<Declaration>(
hashCode: (e) => e.name.hashCode,
- equals: (a, b) => a.name == b.name && a.name2 == b.name2,
+ equals: (a, b) => a.name == b.name,
);
}
}
diff --git a/analyzer/lib/src/source/custom_resolver.dart b/analyzer/lib/src/source/custom_resolver.dart
index 4e2c79a..0ce922e 100644
--- a/analyzer/lib/src/source/custom_resolver.dart
+++ b/analyzer/lib/src/source/custom_resolver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/source/package_map_provider.dart b/analyzer/lib/src/source/package_map_provider.dart
index dff066c..69053ba 100644
--- a/analyzer/lib/src/source/package_map_provider.dart
+++ b/analyzer/lib/src/source/package_map_provider.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/source/package_map_resolver.dart b/analyzer/lib/src/source/package_map_resolver.dart
index b325201..7d9fbf5 100644
--- a/analyzer/lib/src/source/package_map_resolver.dart
+++ b/analyzer/lib/src/source/package_map_resolver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/source/path_filter.dart b/analyzer/lib/src/source/path_filter.dart
index c43cae1..57aa87e 100644
--- a/analyzer/lib/src/source/path_filter.dart
+++ b/analyzer/lib/src/source/path_filter.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/source/sdk_ext.dart b/analyzer/lib/src/source/sdk_ext.dart
index 30be82a..32a1e5b 100644
--- a/analyzer/lib/src/source/sdk_ext.dart
+++ b/analyzer/lib/src/source/sdk_ext.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/summary/api_signature.dart b/analyzer/lib/src/summary/api_signature.dart
index 80937d6..c86d8b8 100644
--- a/analyzer/lib/src/summary/api_signature.dart
+++ b/analyzer/lib/src/summary/api_signature.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/summary/base.dart b/analyzer/lib/src/summary/base.dart
index 6793692..93215cf 100644
--- a/analyzer/lib/src/summary/base.dart
+++ b/analyzer/lib/src/summary/base.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/summary/expr_builder.dart b/analyzer/lib/src/summary/expr_builder.dart
index 960e342..7f07f7e 100644
--- a/analyzer/lib/src/summary/expr_builder.dart
+++ b/analyzer/lib/src/summary/expr_builder.dart
@@ -42,11 +42,11 @@
// The stack of values. Note that they are usually [Expression]s, but may be
// any [CollectionElement] to support map/set/list literals.
- final List<CollectionElement> stack = <CollectionElement>[];
+ final List<AstNode> stack = <AstNode>[];
final List<UnlinkedExecutable> localFunctions;
- final Map<String, ParameterElement> parametersInScope;
+ final _VariablesInScope variablesInScope;
ExprBuilder(
this.resynthesizer,
@@ -54,10 +54,9 @@
this._uc, {
this.requireValidConst: true,
this.localFunctions,
- Map<String, ParameterElement> parametersInScope,
+ _VariablesInScope variablesInScope,
this.becomeSetOrMap: true,
- }) : this.parametersInScope =
- parametersInScope ?? _parametersInScope(context),
+ }) : this.variablesInScope = variablesInScope ?? _parametersInScope(context),
this.isSpreadOrControlFlowEnabled = _isSpreadOrControlFlowEnabled(
(resynthesizer.library.context.analysisOptions
as AnalysisOptionsImpl)
@@ -69,6 +68,7 @@
if (requireValidConst && !_uc.isValidConst) {
return null;
}
+ int startingVariableCount = variablesInScope.count;
for (UnlinkedExprOperation operation in _uc.operations) {
switch (operation) {
case UnlinkedExprOperation.pushNull:
@@ -146,6 +146,9 @@
case UnlinkedExprOperation.bitShiftRight:
_pushBinary(TokenType.GT_GT);
break;
+ case UnlinkedExprOperation.bitShiftRightLogical:
+ _pushBinary(TokenType.GT_GT_GT);
+ break;
case UnlinkedExprOperation.add:
_pushBinary(TokenType.PLUS);
break;
@@ -260,7 +263,7 @@
case UnlinkedExprOperation.pushParameter:
String name = _uc.strings[stringPtr++];
SimpleIdentifier identifier = AstTestFactory.identifier3(name);
- identifier.staticElement = parametersInScope[name];
+ identifier.staticElement = variablesInScope[name];
_push(identifier);
break;
case UnlinkedExprOperation.ifNull:
@@ -329,6 +332,45 @@
case UnlinkedExprOperation.ifElseElement:
_pushIfElement(true);
break;
+ case UnlinkedExprOperation.forParts:
+ _pushForParts();
+ break;
+ case UnlinkedExprOperation.forElement:
+ _pushForElement(false);
+ break;
+ case UnlinkedExprOperation.forElementWithAwait:
+ _pushForElement(true);
+ break;
+ case UnlinkedExprOperation.pushEmptyExpression:
+ _push(null);
+ break;
+ case UnlinkedExprOperation.variableDeclarationStart:
+ _variableDeclarationStart();
+ break;
+ case UnlinkedExprOperation.variableDeclaration:
+ _variableDeclaration();
+ break;
+ case UnlinkedExprOperation.forInitializerDeclarationsUntyped:
+ _forInitializerDeclarations(false);
+ break;
+ case UnlinkedExprOperation.forInitializerDeclarationsTyped:
+ _forInitializerDeclarations(true);
+ break;
+ case UnlinkedExprOperation.assignToParameter:
+ String name = _uc.strings[stringPtr++];
+ SimpleIdentifier identifier = AstTestFactory.identifier3(name);
+ identifier.staticElement = variablesInScope[name];
+ _push(_createAssignment(identifier));
+ break;
+ case UnlinkedExprOperation.forEachPartsWithIdentifier:
+ _forEachPartsWithIdentifier();
+ break;
+ case UnlinkedExprOperation.forEachPartsWithUntypedDeclaration:
+ _forEachPartsWithDeclaration(false);
+ break;
+ case UnlinkedExprOperation.forEachPartsWithTypedDeclaration:
+ _forEachPartsWithDeclaration(true);
+ break;
case UnlinkedExprOperation.cascadeSectionBegin:
case UnlinkedExprOperation.cascadeSectionEnd:
case UnlinkedExprOperation.pushLocalFunctionReference:
@@ -339,6 +381,7 @@
'Unexpected $operation in a constant expression.');
}
}
+ assert(startingVariableCount == variablesInScope.count);
return stack.single;
}
@@ -588,6 +631,39 @@
return _buildIdentifierSequence(info);
}
+ void _forEachPartsWithDeclaration(bool hasType) {
+ var iterable = _pop();
+ var name = _uc.strings[stringPtr++];
+ var element = LocalVariableElementImpl(name, -1);
+ var keyword = hasType ? null : Keyword.VAR;
+ var type = hasType ? _newTypeName() : null;
+ var loopVariable = AstTestFactory.declaredIdentifier2(keyword, type, name);
+ loopVariable.identifier.staticElement = element;
+ if (hasType) {
+ element.type = type.type;
+ }
+ _pushNode(
+ AstTestFactory.forEachPartsWithDeclaration(loopVariable, iterable));
+ variablesInScope.push(element);
+ }
+
+ void _forEachPartsWithIdentifier() {
+ var iterable = _pop();
+ SimpleIdentifier identifier = _pop();
+ _pushNode(AstTestFactory.forEachPartsWithIdentifier(identifier, iterable));
+ }
+
+ void _forInitializerDeclarations(bool hasType) {
+ var count = _uc.ints[intPtr++];
+ var variables = List<VariableDeclaration>.filled(count, null);
+ for (int i = 0; i < count; i++) {
+ variables[count - 1 - i] = _popNode();
+ }
+ var type = hasType ? _newTypeName() : null;
+ var keyword = hasType ? null : Keyword.VAR;
+ _pushNode(AstTestFactory.variableDeclarationList(keyword, type, variables));
+ }
+
PropertyAccessorElement _getStringLengthElement() =>
resynthesizer.typeProvider.stringType.getGetter('length');
@@ -597,9 +673,10 @@
simpleParam.identifier.staticElement = param;
simpleParam.declaredElement = param;
var unlinkedParam = (param as ParameterElementImpl).unlinkedParam;
- if (unlinkedParam.kind == UnlinkedParamKind.positional) {
+ if (unlinkedParam.kind == UnlinkedParamKind.optionalPositional) {
return AstTestFactory.positionalFormalParameter(simpleParam, null);
- } else if (unlinkedParam.kind == UnlinkedParamKind.named) {
+ } else if (unlinkedParam.kind == UnlinkedParamKind.requiredNamed ||
+ unlinkedParam.kind == UnlinkedParamKind.optionalNamed) {
return AstTestFactory.namedFormalParameter(simpleParam, null);
} else {
return simpleParam;
@@ -629,9 +706,12 @@
Expression _pop() => stack.removeLast() as Expression;
- CollectionElement _popCollectionElement() => stack.removeLast();
+ CollectionElement _popCollectionElement() =>
+ stack.removeLast() as CollectionElement;
- void _push(CollectionElement expr) {
+ AstNode _popNode() => stack.removeLast();
+
+ void _push(Expression expr) {
stack.add(expr);
}
@@ -656,11 +736,43 @@
_push(AstTestFactory.propertyAccess(target, propertyNode));
}
+ void _pushForElement(bool hasAwait) {
+ var body = _popCollectionElement();
+ var forLoopParts = _popNode() as ForLoopParts;
+ if (forLoopParts is ForPartsWithDeclarations) {
+ variablesInScope.pop(forLoopParts.variables.variables.length);
+ } else if (forLoopParts is ForEachPartsWithDeclaration) {
+ variablesInScope.pop(1);
+ }
+ _pushCollectionElement(
+ AstTestFactory.forElement(forLoopParts, body, hasAwait: hasAwait));
+ }
+
+ void _pushForParts() {
+ var updaterCount = _uc.ints[intPtr++];
+ var updaters = <Expression>[];
+ for (int i = 0; i < updaterCount; i++) {
+ updaters.insert(0, _pop());
+ }
+ Expression condition = _pop();
+ AstNode initialization = _popNode();
+ if (initialization is Expression || initialization == null) {
+ _pushNode(AstTestFactory.forPartsWithExpression(
+ initialization, condition, updaters));
+ } else if (initialization is VariableDeclarationList) {
+ _pushNode(AstTestFactory.forPartsWithDeclarations(
+ initialization, condition, updaters));
+ } else {
+ throw StateError('Unrecognized for parts');
+ }
+ }
+
void _pushIfElement(bool hasElse) {
CollectionElement elseElement = hasElse ? _popCollectionElement() : null;
CollectionElement thenElement = _popCollectionElement();
Expression condition = _pop();
- _push(AstTestFactory.ifElement(condition, thenElement, elseElement));
+ _pushCollectionElement(
+ AstTestFactory.ifElement(condition, thenElement, elseElement));
}
void _pushInstanceCreation() {
@@ -794,12 +906,10 @@
assert(popCount == 0);
int functionIndex = _uc.ints[intPtr++];
var localFunction = localFunctions[functionIndex];
- var parametersInScope =
- new Map<String, ParameterElement>.from(this.parametersInScope);
var functionElement =
new FunctionElementImpl.forSerialized(localFunction, context);
for (ParameterElementImpl parameter in functionElement.parameters) {
- parametersInScope[parameter.name] = parameter;
+ variablesInScope.push(parameter);
if (parameter.unlinkedParam.type == null) {
// Store a type of `dynamic` for the parameter; this prevents
// resynthesis from trying to read a type out of the summary (which
@@ -823,12 +933,13 @@
var bodyExpr = new ExprBuilder(
resynthesizer, functionElement, localFunction.bodyExpr,
requireValidConst: requireValidConst,
- parametersInScope: parametersInScope,
+ variablesInScope: variablesInScope,
localFunctions: localFunction.localFunctions)
.build();
functionBody = astFactory.expressionFunctionBody(asyncKeyword,
TokenFactory.tokenFromType(TokenType.FUNCTION), bodyExpr, null);
}
+ variablesInScope.pop(functionElement.parameters.length);
FunctionExpressionImpl functionExpression = astFactory.functionExpression(
null, AstTestFactory.formalParameterList(parameters), functionBody);
functionExpression.declaredElement = functionElement;
@@ -851,15 +962,11 @@
: typeArguments.arguments[1].type;
var staticType =
resynthesizer.typeProvider.mapType.instantiate([keyType, valueType]);
- if (isSpreadOrControlFlowEnabled) {
- _push(
- AstTestFactory.setOrMapLiteral(Keyword.CONST, typeArguments, entries)
- ..staticType = staticType);
- } else {
- // ignore: deprecated_member_use_from_same_package
- _push(AstTestFactory.mapLiteral(Keyword.CONST, typeArguments, entries)
- ..staticType = staticType);
- }
+ SetOrMapLiteralImpl literal =
+ AstTestFactory.setOrMapLiteral(Keyword.CONST, typeArguments, entries);
+ literal.becomeMap();
+ literal.staticType = staticType;
+ _push(literal);
}
void _pushMapLiteralEntry() {
@@ -868,6 +975,10 @@
_pushCollectionElement(AstTestFactory.mapLiteralEntry2(key, value));
}
+ void _pushNode(AstNode node) {
+ stack.add(node);
+ }
+
void _pushPrefix(TokenType operator) {
Expression operand = _pop();
_push(AstTestFactory.prefixExpression(operator, operand));
@@ -883,8 +994,10 @@
for (int i = 0; i < count; i++) {
elements.insert(0, _pop());
}
- // ignore: deprecated_member_use_from_same_package
- _push(AstTestFactory.setLiteral(Keyword.CONST, typeArguments, elements));
+ SetOrMapLiteralImpl literal =
+ AstTestFactory.setOrMapLiteral(Keyword.CONST, typeArguments, elements);
+ literal.becomeSet();
+ _push(literal);
}
void _pushSetOrMap(TypeArgumentList typeArguments) {
@@ -938,7 +1051,7 @@
void _pushSpread(TokenType operator) {
Expression operand = _pop();
- _push(AstTestFactory.spreadElement(operator, operand));
+ _pushCollectionElement(AstTestFactory.spreadElement(operator, operand));
}
List<Expression> _removeTopExpressions(int count) {
@@ -949,16 +1062,31 @@
return items;
}
+ void _variableDeclaration() {
+ var index = _uc.ints[intPtr++];
+ var element = variablesInScope.recent(index);
+ var initializer = _pop();
+ var variableDeclaration =
+ AstTestFactory.variableDeclaration2(element.name, initializer);
+ variableDeclaration.name.staticElement = element;
+ _pushNode(variableDeclaration);
+ }
+
+ void _variableDeclarationStart() {
+ var name = _uc.strings[stringPtr++];
+ variablesInScope.push(LocalVariableElementImpl(name, -1));
+ }
+
/// Figures out the default value of [parametersInScope] based on [context].
///
/// If [context] is (or contains) a constructor, then its parameters are used.
/// Otherwise, no parameters are considered to be in scope.
- static Map<String, ParameterElement> _parametersInScope(Element context) {
- var result = <String, ParameterElement>{};
+ static _VariablesInScope _parametersInScope(Element context) {
+ var result = _VariablesInScope();
for (Element e = context; e != null; e = e.enclosingElement) {
if (e is ConstructorElement) {
for (var parameter in e.parameters) {
- result[parameter.name] = parameter;
+ result.push(parameter);
}
return result;
}
@@ -966,3 +1094,37 @@
return result;
}
}
+
+/// Tracks the set of variables that are in scope while resynthesizing an
+/// expression from a summary.
+class _VariablesInScope {
+ final _variableElements = <VariableElement>[];
+
+ /// Returns the number of variables that have been pushed but not popped.
+ int get count => _variableElements.length;
+
+ /// Looks up the variable with the given [name]. Returns `null` if no
+ /// variable is found.
+ VariableElement operator [](String name) {
+ for (int i = _variableElements.length - 1; i >= 0; i--) {
+ if (_variableElements[i].name == name) return _variableElements[i];
+ }
+ return null;
+ }
+
+ /// Un-does the effect of the last [count] calls to `push`.
+ void pop(int count) {
+ _variableElements.length -= count;
+ }
+
+ /// Stores a new declaration based on the given [variableElement]. The
+ /// declaration shadows any previous declaration with the same name.
+ void push(VariableElement variableElement) {
+ _variableElements.add(variableElement);
+ }
+
+ /// Retrieves the [index]th most recently pushed element (that hasn't been
+ /// popped). [index] counts from zero.
+ VariableElement recent(int index) =>
+ _variableElements[_variableElements.length - 1 - index];
+}
diff --git a/analyzer/lib/src/summary/format.dart b/analyzer/lib/src/summary/format.dart
index ca27841..c0551e8 100644
--- a/analyzer/lib/src/summary/format.dart
+++ b/analyzer/lib/src/summary/format.dart
@@ -1,9 +1,11 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
//
// This file has been automatically generated. Please do not edit it manually.
-// To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
+// To regenerate the file, use the SDK script
+// "pkg/analyzer/tool/summary/generate.dart $IDL_FILE_PATH",
+// or "pkg/analyzer/tool/generate_files" for the analyzer package IDL/sources.
library analyzer.src.summary.format;
@@ -45,6 +47,22 @@
}
}
+class _EntityRefNullabilitySuffixReader
+ extends fb.Reader<idl.EntityRefNullabilitySuffix> {
+ const _EntityRefNullabilitySuffixReader() : super();
+
+ @override
+ int get size => 1;
+
+ @override
+ idl.EntityRefNullabilitySuffix read(fb.BufferContext bc, int offset) {
+ int index = const fb.Uint8Reader().read(bc, offset);
+ return index < idl.EntityRefNullabilitySuffix.values.length
+ ? idl.EntityRefNullabilitySuffix.values[index]
+ : idl.EntityRefNullabilitySuffix.starOrIrrelevant;
+ }
+}
+
class _IndexNameKindReader extends fb.Reader<idl.IndexNameKind> {
const _IndexNameKindReader() : super();
@@ -119,7 +137,7 @@
int index = const fb.Uint8Reader().read(bc, offset);
return index < idl.LinkedNodeFormalParameterKind.values.length
? idl.LinkedNodeFormalParameterKind.values[index]
- : idl.LinkedNodeFormalParameterKind.required;
+ : idl.LinkedNodeFormalParameterKind.requiredPositional;
}
}
@@ -274,7 +292,7 @@
int index = const fb.Uint8Reader().read(bc, offset);
return index < idl.UnlinkedParamKind.values.length
? idl.UnlinkedParamKind.values[index]
- : idl.UnlinkedParamKind.required;
+ : idl.UnlinkedParamKind.requiredPositional;
}
}
@@ -320,7 +338,7 @@
String get exception => _exception ??= '';
/// The exception string.
- void set exception(String value) {
+ set exception(String value) {
this._exception = value;
}
@@ -329,7 +347,7 @@
_files ??= <AnalysisDriverExceptionFileBuilder>[];
/// The state of files when the exception happened.
- void set files(List<AnalysisDriverExceptionFileBuilder> value) {
+ set files(List<AnalysisDriverExceptionFileBuilder> value) {
this._files = value;
}
@@ -337,7 +355,7 @@
String get path => _path ??= '';
/// The path of the file being analyzed when the exception happened.
- void set path(String value) {
+ set path(String value) {
this._path = value;
}
@@ -345,7 +363,7 @@
String get stackTrace => _stackTrace ??= '';
/// The exception stack trace string.
- void set stackTrace(String value) {
+ set stackTrace(String value) {
this._stackTrace = value;
}
@@ -359,16 +377,12 @@
_path = path,
_stackTrace = stackTrace;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_files?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._path ?? '');
signature.addString(this._exception ?? '');
@@ -515,7 +529,7 @@
String get content => _content ??= '';
/// The content of the file.
- void set content(String value) {
+ set content(String value) {
this._content = value;
}
@@ -523,7 +537,7 @@
String get path => _path ??= '';
/// The path of the file.
- void set path(String value) {
+ set path(String value) {
this._path = value;
}
@@ -531,14 +545,10 @@
: _content = content,
_path = path;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._path ?? '');
signature.addString(this._content ?? '');
@@ -629,7 +639,7 @@
_errors ??= <AnalysisDriverUnitErrorBuilder>[];
/// The full list of analysis errors, both syntactic and semantic.
- void set errors(List<AnalysisDriverUnitErrorBuilder> value) {
+ set errors(List<AnalysisDriverUnitErrorBuilder> value) {
this._errors = value;
}
@@ -637,7 +647,7 @@
AnalysisDriverUnitIndexBuilder get index => _index;
/// The index of the unit.
- void set index(AnalysisDriverUnitIndexBuilder value) {
+ set index(AnalysisDriverUnitIndexBuilder value) {
this._index = value;
}
@@ -647,17 +657,13 @@
: _errors = errors,
_index = index;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_errors?.forEach((b) => b.flushInformative());
_index?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._errors == null) {
signature.addInt(0);
@@ -773,7 +779,7 @@
/// The names of defined instance members.
/// They are indexes into [AnalysisDriverUnitError.strings] list.
/// The list is sorted in ascending order.
- void set members(List<int> value) {
+ set members(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._members = value;
}
@@ -783,7 +789,7 @@
/// The name of the class.
/// It is an index into [AnalysisDriverUnitError.strings] list.
- void set name(int value) {
+ set name(int value) {
assert(value == null || value >= 0);
this._name = value;
}
@@ -792,14 +798,10 @@
: _members = members,
_name = name;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._name ?? 0);
if (this._members == null) {
@@ -895,7 +897,7 @@
String get correction => _correction ??= '';
/// The optional correction hint for the error.
- void set correction(String value) {
+ set correction(String value) {
this._correction = value;
}
@@ -903,7 +905,7 @@
int get length => _length ??= 0;
/// The length of the error in the file.
- void set length(int value) {
+ set length(int value) {
assert(value == null || value >= 0);
this._length = value;
}
@@ -912,7 +914,7 @@
String get message => _message ??= '';
/// The message of the error.
- void set message(String value) {
+ set message(String value) {
this._message = value;
}
@@ -920,7 +922,7 @@
int get offset => _offset ??= 0;
/// The offset from the beginning of the file.
- void set offset(int value) {
+ set offset(int value) {
assert(value == null || value >= 0);
this._offset = value;
}
@@ -929,7 +931,7 @@
String get uniqueName => _uniqueName ??= '';
/// The unique name of the error code.
- void set uniqueName(String value) {
+ set uniqueName(String value) {
this._uniqueName = value;
}
@@ -945,14 +947,10 @@
_offset = offset,
_uniqueName = uniqueName;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._offset ?? 0);
signature.addInt(this._length ?? 0);
@@ -1104,7 +1102,7 @@
/// Each item of this list corresponds to a unique referenced element. It is
/// the kind of the synthetic element.
- void set elementKinds(List<idl.IndexSyntheticElementKind> value) {
+ set elementKinds(List<idl.IndexSyntheticElementKind> value) {
this._elementKinds = value;
}
@@ -1117,7 +1115,7 @@
/// is a top-level element. The list is sorted in ascending order, so that
/// the client can quickly check whether an element is referenced in this
/// index.
- void set elementNameClassMemberIds(List<int> value) {
+ set elementNameClassMemberIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameClassMemberIds = value;
}
@@ -1129,7 +1127,7 @@
/// the identifier of the named parameter name, or `null` if the element is
/// not a named parameter. The list is sorted in ascending order, so that the
/// client can quickly check whether an element is referenced in this index.
- void set elementNameParameterIds(List<int> value) {
+ set elementNameParameterIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameParameterIds = value;
}
@@ -1142,7 +1140,7 @@
/// the identifier of the top-level element name, or `null` if the element is
/// the unit. The list is sorted in ascending order, so that the client can
/// quickly check whether an element is referenced in this index.
- void set elementNameUnitMemberIds(List<int> value) {
+ set elementNameUnitMemberIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameUnitMemberIds = value;
}
@@ -1153,7 +1151,7 @@
/// Each item of this list corresponds to a unique referenced element. It is
/// the index into [unitLibraryUris] and [unitUnitUris] for the library
/// specific unit where the element is declared.
- void set elementUnits(List<int> value) {
+ set elementUnits(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementUnits = value;
}
@@ -1162,7 +1160,7 @@
int get nullStringId => _nullStringId ??= 0;
/// Identifier of the null string in [strings].
- void set nullStringId(int value) {
+ set nullStringId(int value) {
assert(value == null || value >= 0);
this._nullStringId = value;
}
@@ -1173,7 +1171,7 @@
/// List of unique element strings used in this index. The list is sorted in
/// ascending order, so that the client can quickly check the presence of a
/// string in this index.
- void set strings(List<String> value) {
+ set strings(List<String> value) {
this._strings = value;
}
@@ -1182,7 +1180,7 @@
_subtypes ??= <AnalysisDriverSubtypeBuilder>[];
/// The list of classes declared in the unit.
- void set subtypes(List<AnalysisDriverSubtypeBuilder> value) {
+ set subtypes(List<AnalysisDriverSubtypeBuilder> value) {
this._subtypes = value;
}
@@ -1193,7 +1191,7 @@
/// in [subtypes]. They are indexes into [strings] list. The list is sorted
/// in ascending order. There might be more than one element with the same
/// value if there is more than one subtype of this supertype.
- void set supertypes(List<int> value) {
+ set supertypes(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._supertypes = value;
}
@@ -1204,7 +1202,7 @@
/// Each item of this list corresponds to the library URI of a unique library
/// specific unit referenced in the index. It is an index into [strings]
/// list.
- void set unitLibraryUris(List<int> value) {
+ set unitLibraryUris(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._unitLibraryUris = value;
}
@@ -1215,7 +1213,7 @@
/// Each item of this list corresponds to the unit URI of a unique library
/// specific unit referenced in the index. It is an index into [strings]
/// list.
- void set unitUnitUris(List<int> value) {
+ set unitUnitUris(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._unitUnitUris = value;
}
@@ -1226,7 +1224,7 @@
/// Each item of this list is the `true` if the corresponding element usage
/// is qualified with some prefix.
- void set usedElementIsQualifiedFlags(List<bool> value) {
+ set usedElementIsQualifiedFlags(List<bool> value) {
this._usedElementIsQualifiedFlags = value;
}
@@ -1235,7 +1233,7 @@
_usedElementKinds ??= <idl.IndexRelationKind>[];
/// Each item of this list is the kind of the element usage.
- void set usedElementKinds(List<idl.IndexRelationKind> value) {
+ set usedElementKinds(List<idl.IndexRelationKind> value) {
this._usedElementKinds = value;
}
@@ -1243,7 +1241,7 @@
List<int> get usedElementLengths => _usedElementLengths ??= <int>[];
/// Each item of this list is the length of the element usage.
- void set usedElementLengths(List<int> value) {
+ set usedElementLengths(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElementLengths = value;
}
@@ -1253,7 +1251,7 @@
/// Each item of this list is the offset of the element usage relative to the
/// beginning of the file.
- void set usedElementOffsets(List<int> value) {
+ set usedElementOffsets(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElementOffsets = value;
}
@@ -1265,7 +1263,7 @@
/// [elementNameUnitMemberIds], [elementNameClassMemberIds] and
/// [elementNameParameterIds]. The list is sorted in ascending order, so
/// that the client can quickly find element references in this index.
- void set usedElements(List<int> value) {
+ set usedElements(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElements = value;
}
@@ -1276,7 +1274,7 @@
/// Each item of this list is the `true` if the corresponding name usage
/// is qualified with some prefix.
- void set usedNameIsQualifiedFlags(List<bool> value) {
+ set usedNameIsQualifiedFlags(List<bool> value) {
this._usedNameIsQualifiedFlags = value;
}
@@ -1285,7 +1283,7 @@
_usedNameKinds ??= <idl.IndexRelationKind>[];
/// Each item of this list is the kind of the name usage.
- void set usedNameKinds(List<idl.IndexRelationKind> value) {
+ set usedNameKinds(List<idl.IndexRelationKind> value) {
this._usedNameKinds = value;
}
@@ -1294,7 +1292,7 @@
/// Each item of this list is the offset of the name usage relative to the
/// beginning of the file.
- void set usedNameOffsets(List<int> value) {
+ set usedNameOffsets(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedNameOffsets = value;
}
@@ -1305,7 +1303,7 @@
/// Each item of this list is the index into [strings] for a used name. The
/// list is sorted in ascending order, so that the client can quickly find
/// whether a name is used in this index.
- void set usedNames(List<int> value) {
+ set usedNames(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedNames = value;
}
@@ -1352,16 +1350,12 @@
_usedNameOffsets = usedNameOffsets,
_usedNames = usedNames;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_subtypes?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._strings == null) {
signature.addInt(0);
@@ -1952,13 +1946,14 @@
List<String> _referencedNames;
List<String> _subtypedNames;
UnlinkedUnitBuilder _unit;
+ UnlinkedUnit2Builder _unit2;
@override
List<String> get definedClassMemberNames =>
_definedClassMemberNames ??= <String>[];
/// List of class member names defined by the unit.
- void set definedClassMemberNames(List<String> value) {
+ set definedClassMemberNames(List<String> value) {
this._definedClassMemberNames = value;
}
@@ -1966,7 +1961,7 @@
List<String> get definedTopLevelNames => _definedTopLevelNames ??= <String>[];
/// List of top-level names defined by the unit.
- void set definedTopLevelNames(List<String> value) {
+ set definedTopLevelNames(List<String> value) {
this._definedTopLevelNames = value;
}
@@ -1974,7 +1969,7 @@
List<String> get referencedNames => _referencedNames ??= <String>[];
/// List of external names referenced by the unit.
- void set referencedNames(List<String> value) {
+ set referencedNames(List<String> value) {
this._referencedNames = value;
}
@@ -1983,7 +1978,7 @@
/// List of names which are used in `extends`, `with` or `implements` clauses
/// in the file. Import prefixes and type arguments are not included.
- void set subtypedNames(List<String> value) {
+ set subtypedNames(List<String> value) {
this._subtypedNames = value;
}
@@ -1991,32 +1986,39 @@
UnlinkedUnitBuilder get unit => _unit;
/// Unlinked information for the unit.
- void set unit(UnlinkedUnitBuilder value) {
+ set unit(UnlinkedUnitBuilder value) {
this._unit = value;
}
+ @override
+ UnlinkedUnit2Builder get unit2 => _unit2;
+
+ /// Unlinked information for the unit.
+ set unit2(UnlinkedUnit2Builder value) {
+ this._unit2 = value;
+ }
+
AnalysisDriverUnlinkedUnitBuilder(
{List<String> definedClassMemberNames,
List<String> definedTopLevelNames,
List<String> referencedNames,
List<String> subtypedNames,
- UnlinkedUnitBuilder unit})
+ UnlinkedUnitBuilder unit,
+ UnlinkedUnit2Builder unit2})
: _definedClassMemberNames = definedClassMemberNames,
_definedTopLevelNames = definedTopLevelNames,
_referencedNames = referencedNames,
_subtypedNames = subtypedNames,
- _unit = unit;
+ _unit = unit,
+ _unit2 = unit2;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_unit?.flushInformative();
+ _unit2?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._referencedNames == null) {
signature.addInt(0);
@@ -2052,6 +2054,8 @@
signature.addString(x);
}
}
+ signature.addBool(this._unit2 != null);
+ this._unit2?.collectApiSignature(signature);
}
List<int> toBuffer() {
@@ -2065,6 +2069,7 @@
fb.Offset offset_referencedNames;
fb.Offset offset_subtypedNames;
fb.Offset offset_unit;
+ fb.Offset offset_unit2;
if (!(_definedClassMemberNames == null ||
_definedClassMemberNames.isEmpty)) {
offset_definedClassMemberNames = fbBuilder.writeList(
@@ -2087,6 +2092,9 @@
if (_unit != null) {
offset_unit = _unit.finish(fbBuilder);
}
+ if (_unit2 != null) {
+ offset_unit2 = _unit2.finish(fbBuilder);
+ }
fbBuilder.startTable();
if (offset_definedClassMemberNames != null) {
fbBuilder.addOffset(3, offset_definedClassMemberNames);
@@ -2103,6 +2111,9 @@
if (offset_unit != null) {
fbBuilder.addOffset(1, offset_unit);
}
+ if (offset_unit2 != null) {
+ fbBuilder.addOffset(5, offset_unit2);
+ }
return fbBuilder.endTable();
}
}
@@ -2136,6 +2147,7 @@
List<String> _referencedNames;
List<String> _subtypedNames;
idl.UnlinkedUnit _unit;
+ idl.UnlinkedUnit2 _unit2;
@override
List<String> get definedClassMemberNames {
@@ -2172,6 +2184,12 @@
_unit ??= const _UnlinkedUnitReader().vTableGet(_bc, _bcOffset, 1, null);
return _unit;
}
+
+ @override
+ idl.UnlinkedUnit2 get unit2 {
+ _unit2 ??= const _UnlinkedUnit2Reader().vTableGet(_bc, _bcOffset, 5, null);
+ return _unit2;
+ }
}
abstract class _AnalysisDriverUnlinkedUnitMixin
@@ -2187,6 +2205,7 @@
_result["referencedNames"] = referencedNames;
if (subtypedNames.isNotEmpty) _result["subtypedNames"] = subtypedNames;
if (unit != null) _result["unit"] = unit.toJson();
+ if (unit2 != null) _result["unit2"] = unit2.toJson();
return _result;
}
@@ -2197,6 +2216,7 @@
"referencedNames": referencedNames,
"subtypedNames": subtypedNames,
"unit": unit,
+ "unit2": unit2,
};
@override
@@ -2206,6 +2226,7 @@
class AvailableDeclarationBuilder extends Object
with _AvailableDeclarationMixin
implements idl.AvailableDeclaration {
+ List<AvailableDeclarationBuilder> _children;
String _defaultArgumentListString;
List<int> _defaultArgumentListTextRanges;
String _docComplete;
@@ -2220,7 +2241,6 @@
int _locationStartColumn;
int _locationStartLine;
String _name;
- String _name2;
List<String> _parameterNames;
String _parameters;
List<String> _parameterTypes;
@@ -2230,9 +2250,17 @@
String _typeParameters;
@override
+ List<AvailableDeclarationBuilder> get children =>
+ _children ??= <AvailableDeclarationBuilder>[];
+
+ set children(List<AvailableDeclarationBuilder> value) {
+ this._children = value;
+ }
+
+ @override
String get defaultArgumentListString => _defaultArgumentListString ??= '';
- void set defaultArgumentListString(String value) {
+ set defaultArgumentListString(String value) {
this._defaultArgumentListString = value;
}
@@ -2240,7 +2268,7 @@
List<int> get defaultArgumentListTextRanges =>
_defaultArgumentListTextRanges ??= <int>[];
- void set defaultArgumentListTextRanges(List<int> value) {
+ set defaultArgumentListTextRanges(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._defaultArgumentListTextRanges = value;
}
@@ -2248,21 +2276,21 @@
@override
String get docComplete => _docComplete ??= '';
- void set docComplete(String value) {
+ set docComplete(String value) {
this._docComplete = value;
}
@override
String get docSummary => _docSummary ??= '';
- void set docSummary(String value) {
+ set docSummary(String value) {
this._docSummary = value;
}
@override
int get fieldMask => _fieldMask ??= 0;
- void set fieldMask(int value) {
+ set fieldMask(int value) {
assert(value == null || value >= 0);
this._fieldMask = value;
}
@@ -2270,28 +2298,28 @@
@override
bool get isAbstract => _isAbstract ??= false;
- void set isAbstract(bool value) {
+ set isAbstract(bool value) {
this._isAbstract = value;
}
@override
bool get isConst => _isConst ??= false;
- void set isConst(bool value) {
+ set isConst(bool value) {
this._isConst = value;
}
@override
bool get isDeprecated => _isDeprecated ??= false;
- void set isDeprecated(bool value) {
+ set isDeprecated(bool value) {
this._isDeprecated = value;
}
@override
bool get isFinal => _isFinal ??= false;
- void set isFinal(bool value) {
+ set isFinal(bool value) {
this._isFinal = value;
}
@@ -2300,14 +2328,14 @@
_kind ??= idl.AvailableDeclarationKind.CLASS;
/// The kind of the declaration.
- void set kind(idl.AvailableDeclarationKind value) {
+ set kind(idl.AvailableDeclarationKind value) {
this._kind = value;
}
@override
int get locationOffset => _locationOffset ??= 0;
- void set locationOffset(int value) {
+ set locationOffset(int value) {
assert(value == null || value >= 0);
this._locationOffset = value;
}
@@ -2315,7 +2343,7 @@
@override
int get locationStartColumn => _locationStartColumn ??= 0;
- void set locationStartColumn(int value) {
+ set locationStartColumn(int value) {
assert(value == null || value >= 0);
this._locationStartColumn = value;
}
@@ -2323,7 +2351,7 @@
@override
int get locationStartLine => _locationStartLine ??= 0;
- void set locationStartLine(int value) {
+ set locationStartLine(int value) {
assert(value == null || value >= 0);
this._locationStartLine = value;
}
@@ -2333,37 +2361,28 @@
/// The first part of the declaration name, usually the only one, for example
/// the name of a class like `MyClass`, or a function like `myFunction`.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@override
- String get name2 => _name2 ??= '';
-
- /// The second, optional, part of the declaration name. For example enum
- /// constants all have the same [name], but their own [name2].
- void set name2(String value) {
- this._name2 = value;
- }
-
- @override
List<String> get parameterNames => _parameterNames ??= <String>[];
- void set parameterNames(List<String> value) {
+ set parameterNames(List<String> value) {
this._parameterNames = value;
}
@override
String get parameters => _parameters ??= '';
- void set parameters(String value) {
+ set parameters(String value) {
this._parameters = value;
}
@override
List<String> get parameterTypes => _parameterTypes ??= <String>[];
- void set parameterTypes(List<String> value) {
+ set parameterTypes(List<String> value) {
this._parameterTypes = value;
}
@@ -2374,14 +2393,14 @@
/// example, function do not currently), and not every declaration has to
/// store one (for classes it can be computed when we know the library that
/// includes this file).
- void set relevanceTags(List<String> value) {
+ set relevanceTags(List<String> value) {
this._relevanceTags = value;
}
@override
int get requiredParameterCount => _requiredParameterCount ??= 0;
- void set requiredParameterCount(int value) {
+ set requiredParameterCount(int value) {
assert(value == null || value >= 0);
this._requiredParameterCount = value;
}
@@ -2389,19 +2408,20 @@
@override
String get returnType => _returnType ??= '';
- void set returnType(String value) {
+ set returnType(String value) {
this._returnType = value;
}
@override
String get typeParameters => _typeParameters ??= '';
- void set typeParameters(String value) {
+ set typeParameters(String value) {
this._typeParameters = value;
}
AvailableDeclarationBuilder(
- {String defaultArgumentListString,
+ {List<AvailableDeclarationBuilder> children,
+ String defaultArgumentListString,
List<int> defaultArgumentListTextRanges,
String docComplete,
String docSummary,
@@ -2415,7 +2435,6 @@
int locationStartColumn,
int locationStartLine,
String name,
- String name2,
List<String> parameterNames,
String parameters,
List<String> parameterTypes,
@@ -2423,7 +2442,8 @@
int requiredParameterCount,
String returnType,
String typeParameters})
- : _defaultArgumentListString = defaultArgumentListString,
+ : _children = children,
+ _defaultArgumentListString = defaultArgumentListString,
_defaultArgumentListTextRanges = defaultArgumentListTextRanges,
_docComplete = docComplete,
_docSummary = docSummary,
@@ -2437,7 +2457,6 @@
_locationStartColumn = locationStartColumn,
_locationStartLine = locationStartLine,
_name = name,
- _name2 = name2,
_parameterNames = parameterNames,
_parameters = parameters,
_parameterTypes = parameterTypes,
@@ -2446,15 +2465,21 @@
_returnType = returnType,
_typeParameters = typeParameters;
- /**
- * Flush [informative] data recursively.
- */
- void flushInformative() {}
+ /// Flush [informative] data recursively.
+ void flushInformative() {
+ _children?.forEach((b) => b.flushInformative());
+ }
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
+ if (this._children == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._children.length);
+ for (var x in this._children) {
+ x?.collectApiSignature(signature);
+ }
+ }
signature.addString(this._defaultArgumentListString ?? '');
if (this._defaultArgumentListTextRanges == null) {
signature.addInt(0);
@@ -2476,7 +2501,6 @@
signature.addInt(this._locationStartColumn ?? 0);
signature.addInt(this._locationStartLine ?? 0);
signature.addString(this._name ?? '');
- signature.addString(this._name2 ?? '');
if (this._parameterNames == null) {
signature.addInt(0);
} else {
@@ -2508,18 +2532,22 @@
}
fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_children;
fb.Offset offset_defaultArgumentListString;
fb.Offset offset_defaultArgumentListTextRanges;
fb.Offset offset_docComplete;
fb.Offset offset_docSummary;
fb.Offset offset_name;
- fb.Offset offset_name2;
fb.Offset offset_parameterNames;
fb.Offset offset_parameters;
fb.Offset offset_parameterTypes;
fb.Offset offset_relevanceTags;
fb.Offset offset_returnType;
fb.Offset offset_typeParameters;
+ if (!(_children == null || _children.isEmpty)) {
+ offset_children = fbBuilder
+ .writeList(_children.map((b) => b.finish(fbBuilder)).toList());
+ }
if (_defaultArgumentListString != null) {
offset_defaultArgumentListString =
fbBuilder.writeString(_defaultArgumentListString);
@@ -2538,9 +2566,6 @@
if (_name != null) {
offset_name = fbBuilder.writeString(_name);
}
- if (_name2 != null) {
- offset_name2 = fbBuilder.writeString(_name2);
- }
if (!(_parameterNames == null || _parameterNames.isEmpty)) {
offset_parameterNames = fbBuilder.writeList(
_parameterNames.map((b) => fbBuilder.writeString(b)).toList());
@@ -2563,50 +2588,50 @@
offset_typeParameters = fbBuilder.writeString(_typeParameters);
}
fbBuilder.startTable();
+ if (offset_children != null) {
+ fbBuilder.addOffset(0, offset_children);
+ }
if (offset_defaultArgumentListString != null) {
- fbBuilder.addOffset(0, offset_defaultArgumentListString);
+ fbBuilder.addOffset(1, offset_defaultArgumentListString);
}
if (offset_defaultArgumentListTextRanges != null) {
- fbBuilder.addOffset(1, offset_defaultArgumentListTextRanges);
+ fbBuilder.addOffset(2, offset_defaultArgumentListTextRanges);
}
if (offset_docComplete != null) {
- fbBuilder.addOffset(2, offset_docComplete);
+ fbBuilder.addOffset(3, offset_docComplete);
}
if (offset_docSummary != null) {
- fbBuilder.addOffset(3, offset_docSummary);
+ fbBuilder.addOffset(4, offset_docSummary);
}
if (_fieldMask != null && _fieldMask != 0) {
- fbBuilder.addUint32(4, _fieldMask);
+ fbBuilder.addUint32(5, _fieldMask);
}
if (_isAbstract == true) {
- fbBuilder.addBool(5, true);
- }
- if (_isConst == true) {
fbBuilder.addBool(6, true);
}
- if (_isDeprecated == true) {
+ if (_isConst == true) {
fbBuilder.addBool(7, true);
}
- if (_isFinal == true) {
+ if (_isDeprecated == true) {
fbBuilder.addBool(8, true);
}
+ if (_isFinal == true) {
+ fbBuilder.addBool(9, true);
+ }
if (_kind != null && _kind != idl.AvailableDeclarationKind.CLASS) {
- fbBuilder.addUint8(9, _kind.index);
+ fbBuilder.addUint8(10, _kind.index);
}
if (_locationOffset != null && _locationOffset != 0) {
- fbBuilder.addUint32(10, _locationOffset);
+ fbBuilder.addUint32(11, _locationOffset);
}
if (_locationStartColumn != null && _locationStartColumn != 0) {
- fbBuilder.addUint32(11, _locationStartColumn);
+ fbBuilder.addUint32(12, _locationStartColumn);
}
if (_locationStartLine != null && _locationStartLine != 0) {
- fbBuilder.addUint32(12, _locationStartLine);
+ fbBuilder.addUint32(13, _locationStartLine);
}
if (offset_name != null) {
- fbBuilder.addOffset(13, offset_name);
- }
- if (offset_name2 != null) {
- fbBuilder.addOffset(14, offset_name2);
+ fbBuilder.addOffset(14, offset_name);
}
if (offset_parameterNames != null) {
fbBuilder.addOffset(15, offset_parameterNames);
@@ -2650,6 +2675,7 @@
_AvailableDeclarationImpl(this._bc, this._bcOffset);
+ List<idl.AvailableDeclaration> _children;
String _defaultArgumentListString;
List<int> _defaultArgumentListTextRanges;
String _docComplete;
@@ -2664,7 +2690,6 @@
int _locationStartColumn;
int _locationStartLine;
String _name;
- String _name2;
List<String> _parameterNames;
String _parameters;
List<String> _parameterTypes;
@@ -2674,102 +2699,104 @@
String _typeParameters;
@override
+ List<idl.AvailableDeclaration> get children {
+ _children ??= const fb.ListReader<idl.AvailableDeclaration>(
+ const _AvailableDeclarationReader())
+ .vTableGet(_bc, _bcOffset, 0, const <idl.AvailableDeclaration>[]);
+ return _children;
+ }
+
+ @override
String get defaultArgumentListString {
_defaultArgumentListString ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
+ const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
return _defaultArgumentListString;
}
@override
List<int> get defaultArgumentListTextRanges {
_defaultArgumentListTextRanges ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 1, const <int>[]);
+ const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 2, const <int>[]);
return _defaultArgumentListTextRanges;
}
@override
String get docComplete {
- _docComplete ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 2, '');
+ _docComplete ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 3, '');
return _docComplete;
}
@override
String get docSummary {
- _docSummary ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 3, '');
+ _docSummary ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 4, '');
return _docSummary;
}
@override
int get fieldMask {
- _fieldMask ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 4, 0);
+ _fieldMask ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 5, 0);
return _fieldMask;
}
@override
bool get isAbstract {
- _isAbstract ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 5, false);
+ _isAbstract ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 6, false);
return _isAbstract;
}
@override
bool get isConst {
- _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 6, false);
+ _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 7, false);
return _isConst;
}
@override
bool get isDeprecated {
- _isDeprecated ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 7, false);
+ _isDeprecated ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 8, false);
return _isDeprecated;
}
@override
bool get isFinal {
- _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 8, false);
+ _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 9, false);
return _isFinal;
}
@override
idl.AvailableDeclarationKind get kind {
_kind ??= const _AvailableDeclarationKindReader()
- .vTableGet(_bc, _bcOffset, 9, idl.AvailableDeclarationKind.CLASS);
+ .vTableGet(_bc, _bcOffset, 10, idl.AvailableDeclarationKind.CLASS);
return _kind;
}
@override
int get locationOffset {
_locationOffset ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 10, 0);
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 11, 0);
return _locationOffset;
}
@override
int get locationStartColumn {
_locationStartColumn ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 11, 0);
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 12, 0);
return _locationStartColumn;
}
@override
int get locationStartLine {
_locationStartLine ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 12, 0);
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 13, 0);
return _locationStartLine;
}
@override
String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 13, '');
+ _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 14, '');
return _name;
}
@override
- String get name2 {
- _name2 ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 14, '');
- return _name2;
- }
-
- @override
List<String> get parameterNames {
_parameterNames ??= const fb.ListReader<String>(const fb.StringReader())
.vTableGet(_bc, _bcOffset, 15, const <String>[]);
@@ -2821,6 +2848,8 @@
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
+ if (children.isNotEmpty)
+ _result["children"] = children.map((_value) => _value.toJson()).toList();
if (defaultArgumentListString != '')
_result["defaultArgumentListString"] = defaultArgumentListString;
if (defaultArgumentListTextRanges.isNotEmpty)
@@ -2840,7 +2869,6 @@
if (locationStartLine != 0)
_result["locationStartLine"] = locationStartLine;
if (name != '') _result["name"] = name;
- if (name2 != '') _result["name2"] = name2;
if (parameterNames.isNotEmpty) _result["parameterNames"] = parameterNames;
if (parameters != '') _result["parameters"] = parameters;
if (parameterTypes.isNotEmpty) _result["parameterTypes"] = parameterTypes;
@@ -2854,6 +2882,7 @@
@override
Map<String, Object> toMap() => {
+ "children": children,
"defaultArgumentListString": defaultArgumentListString,
"defaultArgumentListTextRanges": defaultArgumentListTextRanges,
"docComplete": docComplete,
@@ -2868,7 +2897,6 @@
"locationStartColumn": locationStartColumn,
"locationStartLine": locationStartLine,
"name": name,
- "name2": name2,
"parameterNames": parameterNames,
"parameters": parameters,
"parameterTypes": parameterTypes,
@@ -2886,6 +2914,7 @@
with _AvailableFileMixin
implements idl.AvailableFile {
List<AvailableDeclarationBuilder> _declarations;
+ DirectiveInfoBuilder _directiveInfo;
List<AvailableFileExportBuilder> _exports;
bool _isLibrary;
bool _isLibraryDeprecated;
@@ -2896,16 +2925,24 @@
_declarations ??= <AvailableDeclarationBuilder>[];
/// Declarations of the file.
- void set declarations(List<AvailableDeclarationBuilder> value) {
+ set declarations(List<AvailableDeclarationBuilder> value) {
this._declarations = value;
}
@override
+ DirectiveInfoBuilder get directiveInfo => _directiveInfo;
+
+ /// The Dartdoc directives in the file.
+ set directiveInfo(DirectiveInfoBuilder value) {
+ this._directiveInfo = value;
+ }
+
+ @override
List<AvailableFileExportBuilder> get exports =>
_exports ??= <AvailableFileExportBuilder>[];
/// Exports directives of the file.
- void set exports(List<AvailableFileExportBuilder> value) {
+ set exports(List<AvailableFileExportBuilder> value) {
this._exports = value;
}
@@ -2913,7 +2950,7 @@
bool get isLibrary => _isLibrary ??= false;
/// Is `true` if this file is a library.
- void set isLibrary(bool value) {
+ set isLibrary(bool value) {
this._isLibrary = value;
}
@@ -2921,7 +2958,7 @@
bool get isLibraryDeprecated => _isLibraryDeprecated ??= false;
/// Is `true` if this file is a library, and it is deprecated.
- void set isLibraryDeprecated(bool value) {
+ set isLibraryDeprecated(bool value) {
this._isLibraryDeprecated = value;
}
@@ -2929,33 +2966,32 @@
List<String> get parts => _parts ??= <String>[];
/// URIs of `part` directives.
- void set parts(List<String> value) {
+ set parts(List<String> value) {
this._parts = value;
}
AvailableFileBuilder(
{List<AvailableDeclarationBuilder> declarations,
+ DirectiveInfoBuilder directiveInfo,
List<AvailableFileExportBuilder> exports,
bool isLibrary,
bool isLibraryDeprecated,
List<String> parts})
: _declarations = declarations,
+ _directiveInfo = directiveInfo,
_exports = exports,
_isLibrary = isLibrary,
_isLibraryDeprecated = isLibraryDeprecated,
_parts = parts;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_declarations?.forEach((b) => b.flushInformative());
+ _directiveInfo?.flushInformative();
_exports?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._declarations == null) {
signature.addInt(0);
@@ -2983,6 +3019,8 @@
signature.addString(x);
}
}
+ signature.addBool(this._directiveInfo != null);
+ this._directiveInfo?.collectApiSignature(signature);
}
List<int> toBuffer() {
@@ -2992,12 +3030,16 @@
fb.Offset finish(fb.Builder fbBuilder) {
fb.Offset offset_declarations;
+ fb.Offset offset_directiveInfo;
fb.Offset offset_exports;
fb.Offset offset_parts;
if (!(_declarations == null || _declarations.isEmpty)) {
offset_declarations = fbBuilder
.writeList(_declarations.map((b) => b.finish(fbBuilder)).toList());
}
+ if (_directiveInfo != null) {
+ offset_directiveInfo = _directiveInfo.finish(fbBuilder);
+ }
if (!(_exports == null || _exports.isEmpty)) {
offset_exports = fbBuilder
.writeList(_exports.map((b) => b.finish(fbBuilder)).toList());
@@ -3010,6 +3052,9 @@
if (offset_declarations != null) {
fbBuilder.addOffset(0, offset_declarations);
}
+ if (offset_directiveInfo != null) {
+ fbBuilder.addOffset(5, offset_directiveInfo);
+ }
if (offset_exports != null) {
fbBuilder.addOffset(1, offset_exports);
}
@@ -3048,6 +3093,7 @@
_AvailableFileImpl(this._bc, this._bcOffset);
List<idl.AvailableDeclaration> _declarations;
+ idl.DirectiveInfo _directiveInfo;
List<idl.AvailableFileExport> _exports;
bool _isLibrary;
bool _isLibraryDeprecated;
@@ -3062,6 +3108,13 @@
}
@override
+ idl.DirectiveInfo get directiveInfo {
+ _directiveInfo ??=
+ const _DirectiveInfoReader().vTableGet(_bc, _bcOffset, 5, null);
+ return _directiveInfo;
+ }
+
+ @override
List<idl.AvailableFileExport> get exports {
_exports ??= const fb.ListReader<idl.AvailableFileExport>(
const _AvailableFileExportReader())
@@ -3097,6 +3150,8 @@
if (declarations.isNotEmpty)
_result["declarations"] =
declarations.map((_value) => _value.toJson()).toList();
+ if (directiveInfo != null)
+ _result["directiveInfo"] = directiveInfo.toJson();
if (exports.isNotEmpty)
_result["exports"] = exports.map((_value) => _value.toJson()).toList();
if (isLibrary != false) _result["isLibrary"] = isLibrary;
@@ -3109,6 +3164,7 @@
@override
Map<String, Object> toMap() => {
"declarations": declarations,
+ "directiveInfo": directiveInfo,
"exports": exports,
"isLibrary": isLibrary,
"isLibraryDeprecated": isLibraryDeprecated,
@@ -3130,7 +3186,7 @@
_combinators ??= <AvailableFileExportCombinatorBuilder>[];
/// Combinators contained in this export directive.
- void set combinators(List<AvailableFileExportCombinatorBuilder> value) {
+ set combinators(List<AvailableFileExportCombinatorBuilder> value) {
this._combinators = value;
}
@@ -3138,7 +3194,7 @@
String get uri => _uri ??= '';
/// URI of the exported library.
- void set uri(String value) {
+ set uri(String value) {
this._uri = value;
}
@@ -3147,16 +3203,12 @@
: _combinators = combinators,
_uri = uri;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_combinators?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uri ?? '');
if (this._combinators == null) {
@@ -3257,7 +3309,7 @@
List<String> get hides => _hides ??= <String>[];
/// List of names which are hidden. Empty if this is a `show` combinator.
- void set hides(List<String> value) {
+ set hides(List<String> value) {
this._hides = value;
}
@@ -3265,7 +3317,7 @@
List<String> get shows => _shows ??= <String>[];
/// List of names which are shown. Empty if this is a `hide` combinator.
- void set shows(List<String> value) {
+ set shows(List<String> value) {
this._shows = value;
}
@@ -3273,14 +3325,10 @@
: _hides = hides,
_shows = shows;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._shows == null) {
signature.addInt(0);
@@ -3388,7 +3436,7 @@
int get length => _length ??= 0;
/// Length of the element code.
- void set length(int value) {
+ set length(int value) {
assert(value == null || value >= 0);
this._length = value;
}
@@ -3397,7 +3445,7 @@
int get offset => _offset ??= 0;
/// Offset of the element code relative to the beginning of the file.
- void set offset(int value) {
+ set offset(int value) {
assert(value == null || value >= 0);
this._offset = value;
}
@@ -3406,14 +3454,10 @@
: _length = length,
_offset = offset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._offset ?? 0);
signature.addInt(this._length ?? 0);
@@ -3482,11 +3526,137 @@
String toString() => convert.json.encode(toJson());
}
+class DirectiveInfoBuilder extends Object
+ with _DirectiveInfoMixin
+ implements idl.DirectiveInfo {
+ List<String> _templateNames;
+ List<String> _templateValues;
+
+ @override
+ List<String> get templateNames => _templateNames ??= <String>[];
+
+ /// The names of the defined templates.
+ set templateNames(List<String> value) {
+ this._templateNames = value;
+ }
+
+ @override
+ List<String> get templateValues => _templateValues ??= <String>[];
+
+ /// The values of the defined templates.
+ set templateValues(List<String> value) {
+ this._templateValues = value;
+ }
+
+ DirectiveInfoBuilder(
+ {List<String> templateNames, List<String> templateValues})
+ : _templateNames = templateNames,
+ _templateValues = templateValues;
+
+ /// Flush [informative] data recursively.
+ void flushInformative() {}
+
+ /// Accumulate non-[informative] data into [signature].
+ void collectApiSignature(api_sig.ApiSignature signature) {
+ if (this._templateNames == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._templateNames.length);
+ for (var x in this._templateNames) {
+ signature.addString(x);
+ }
+ }
+ if (this._templateValues == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._templateValues.length);
+ for (var x in this._templateValues) {
+ signature.addString(x);
+ }
+ }
+ }
+
+ fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_templateNames;
+ fb.Offset offset_templateValues;
+ if (!(_templateNames == null || _templateNames.isEmpty)) {
+ offset_templateNames = fbBuilder.writeList(
+ _templateNames.map((b) => fbBuilder.writeString(b)).toList());
+ }
+ if (!(_templateValues == null || _templateValues.isEmpty)) {
+ offset_templateValues = fbBuilder.writeList(
+ _templateValues.map((b) => fbBuilder.writeString(b)).toList());
+ }
+ fbBuilder.startTable();
+ if (offset_templateNames != null) {
+ fbBuilder.addOffset(0, offset_templateNames);
+ }
+ if (offset_templateValues != null) {
+ fbBuilder.addOffset(1, offset_templateValues);
+ }
+ return fbBuilder.endTable();
+ }
+}
+
+class _DirectiveInfoReader extends fb.TableReader<_DirectiveInfoImpl> {
+ const _DirectiveInfoReader();
+
+ @override
+ _DirectiveInfoImpl createObject(fb.BufferContext bc, int offset) =>
+ new _DirectiveInfoImpl(bc, offset);
+}
+
+class _DirectiveInfoImpl extends Object
+ with _DirectiveInfoMixin
+ implements idl.DirectiveInfo {
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ _DirectiveInfoImpl(this._bc, this._bcOffset);
+
+ List<String> _templateNames;
+ List<String> _templateValues;
+
+ @override
+ List<String> get templateNames {
+ _templateNames ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 0, const <String>[]);
+ return _templateNames;
+ }
+
+ @override
+ List<String> get templateValues {
+ _templateValues ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 1, const <String>[]);
+ return _templateValues;
+ }
+}
+
+abstract class _DirectiveInfoMixin implements idl.DirectiveInfo {
+ @override
+ Map<String, Object> toJson() {
+ Map<String, Object> _result = <String, Object>{};
+ if (templateNames.isNotEmpty) _result["templateNames"] = templateNames;
+ if (templateValues.isNotEmpty) _result["templateValues"] = templateValues;
+ return _result;
+ }
+
+ @override
+ Map<String, Object> toMap() => {
+ "templateNames": templateNames,
+ "templateValues": templateValues,
+ };
+
+ @override
+ String toString() => convert.json.encode(toJson());
+}
+
class EntityRefBuilder extends Object
with _EntityRefMixin
implements idl.EntityRef {
idl.EntityRefKind _entityKind;
List<int> _implicitFunctionTypeIndices;
+ idl.EntityRefNullabilitySuffix _nullabilitySuffix;
int _paramReference;
int _reference;
int _refinedSlot;
@@ -3500,7 +3670,7 @@
idl.EntityRefKind get entityKind => _entityKind ??= idl.EntityRefKind.named;
/// The kind of entity being represented.
- void set entityKind(idl.EntityRefKind value) {
+ set entityKind(idl.EntityRefKind value) {
this._entityKind = value;
}
@@ -3534,12 +3704,21 @@
/// Note that if the entity being referred to is a generic method inside a
/// generic class, then the type arguments in [typeArguments] are applied
/// first to the class and then to the method.
- void set implicitFunctionTypeIndices(List<int> value) {
+ set implicitFunctionTypeIndices(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._implicitFunctionTypeIndices = value;
}
@override
+ idl.EntityRefNullabilitySuffix get nullabilitySuffix =>
+ _nullabilitySuffix ??= idl.EntityRefNullabilitySuffix.starOrIrrelevant;
+
+ /// If the reference represents a type, the nullability of the type.
+ set nullabilitySuffix(idl.EntityRefNullabilitySuffix value) {
+ this._nullabilitySuffix = value;
+ }
+
+ @override
int get paramReference => _paramReference ??= 0;
/// If this is a reference to a type parameter, one-based index into the list
@@ -3559,7 +3738,7 @@
///
/// If the type being referred to is not a type parameter, [paramReference] is
/// zero.
- void set paramReference(int value) {
+ set paramReference(int value) {
assert(value == null || value >= 0);
this._paramReference = value;
}
@@ -3569,7 +3748,7 @@
/// Index into [UnlinkedUnit.references] for the entity being referred to, or
/// zero if this is a reference to a type parameter.
- void set reference(int value) {
+ set reference(int value) {
assert(value == null || value >= 0);
this._reference = value;
}
@@ -3587,7 +3766,7 @@
/// This is called `refinedSlot` to clarify that if it points to an inferred
/// type, it points to a type that is a "refinement" of this one (one in which
/// some type arguments have been inferred).
- void set refinedSlot(int value) {
+ set refinedSlot(int value) {
assert(value == null || value >= 0);
this._refinedSlot = value;
}
@@ -3600,7 +3779,7 @@
/// propagation or type inference with which this [EntityRef] is associated.
///
/// Otherwise zero.
- void set slot(int value) {
+ set slot(int value) {
assert(value == null || value >= 0);
this._slot = value;
}
@@ -3613,7 +3792,7 @@
/// [FunctionElement] is not in any library (e.g. a function type that was
/// synthesized by a LUB computation), the function parameters. Otherwise
/// empty.
- void set syntheticParams(List<UnlinkedParamBuilder> value) {
+ set syntheticParams(List<UnlinkedParamBuilder> value) {
this._syntheticParams = value;
}
@@ -3624,7 +3803,7 @@
/// [FunctionElement] is not in any library (e.g. a function type that was
/// synthesized by a LUB computation), the return type of the function.
/// Otherwise `null`.
- void set syntheticReturnType(EntityRefBuilder value) {
+ set syntheticReturnType(EntityRefBuilder value) {
this._syntheticReturnType = value;
}
@@ -3634,7 +3813,7 @@
/// If this is an instantiation of a generic type or generic executable, the
/// type arguments used to instantiate it (if any).
- void set typeArguments(List<EntityRefBuilder> value) {
+ set typeArguments(List<EntityRefBuilder> value) {
this._typeArguments = value;
}
@@ -3644,13 +3823,14 @@
/// If this is a function type, the type parameters defined for the function
/// type (if any).
- void set typeParameters(List<UnlinkedTypeParamBuilder> value) {
+ set typeParameters(List<UnlinkedTypeParamBuilder> value) {
this._typeParameters = value;
}
EntityRefBuilder(
{idl.EntityRefKind entityKind,
List<int> implicitFunctionTypeIndices,
+ idl.EntityRefNullabilitySuffix nullabilitySuffix,
int paramReference,
int reference,
int refinedSlot,
@@ -3661,6 +3841,7 @@
List<UnlinkedTypeParamBuilder> typeParameters})
: _entityKind = entityKind,
_implicitFunctionTypeIndices = implicitFunctionTypeIndices,
+ _nullabilitySuffix = nullabilitySuffix,
_paramReference = paramReference,
_reference = reference,
_refinedSlot = refinedSlot,
@@ -3670,9 +3851,7 @@
_typeArguments = typeArguments,
_typeParameters = typeParameters;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_syntheticParams?.forEach((b) => b.flushInformative());
_syntheticReturnType?.flushInformative();
@@ -3680,9 +3859,7 @@
_typeParameters?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._reference ?? 0);
if (this._typeArguments == null) {
@@ -3723,6 +3900,8 @@
}
signature.addInt(this._entityKind == null ? 0 : this._entityKind.index);
signature.addInt(this._refinedSlot ?? 0);
+ signature.addInt(
+ this._nullabilitySuffix == null ? 0 : this._nullabilitySuffix.index);
}
fb.Offset finish(fb.Builder fbBuilder) {
@@ -3758,6 +3937,10 @@
if (offset_implicitFunctionTypeIndices != null) {
fbBuilder.addOffset(4, offset_implicitFunctionTypeIndices);
}
+ if (_nullabilitySuffix != null &&
+ _nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant) {
+ fbBuilder.addUint8(10, _nullabilitySuffix.index);
+ }
if (_paramReference != null && _paramReference != 0) {
fbBuilder.addUint32(3, _paramReference);
}
@@ -3804,6 +3987,7 @@
idl.EntityRefKind _entityKind;
List<int> _implicitFunctionTypeIndices;
+ idl.EntityRefNullabilitySuffix _nullabilitySuffix;
int _paramReference;
int _reference;
int _refinedSlot;
@@ -3828,6 +4012,13 @@
}
@override
+ idl.EntityRefNullabilitySuffix get nullabilitySuffix {
+ _nullabilitySuffix ??= const _EntityRefNullabilitySuffixReader().vTableGet(
+ _bc, _bcOffset, 10, idl.EntityRefNullabilitySuffix.starOrIrrelevant);
+ return _nullabilitySuffix;
+ }
+
+ @override
int get paramReference {
_paramReference ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
return _paramReference;
@@ -3891,6 +4082,8 @@
_result["entityKind"] = entityKind.toString().split('.')[1];
if (implicitFunctionTypeIndices.isNotEmpty)
_result["implicitFunctionTypeIndices"] = implicitFunctionTypeIndices;
+ if (nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant)
+ _result["nullabilitySuffix"] = nullabilitySuffix.toString().split('.')[1];
if (paramReference != 0) _result["paramReference"] = paramReference;
if (reference != 0) _result["reference"] = reference;
if (refinedSlot != 0) _result["refinedSlot"] = refinedSlot;
@@ -3913,6 +4106,7 @@
Map<String, Object> toMap() => {
"entityKind": entityKind,
"implicitFunctionTypeIndices": implicitFunctionTypeIndices,
+ "nullabilitySuffix": nullabilitySuffix,
"paramReference": paramReference,
"reference": reference,
"refinedSlot": refinedSlot,
@@ -3938,7 +4132,7 @@
/// Absolute URI for the compilation units listed in the library's `part`
/// declarations, empty string for invalid URI.
- void set parts(List<String> value) {
+ set parts(List<String> value) {
this._parts = value;
}
@@ -3946,7 +4140,7 @@
String get uri => _uri ??= '';
/// The absolute URI of the dependent library, e.g. `package:foo/bar.dart`.
- void set uri(String value) {
+ set uri(String value) {
this._uri = value;
}
@@ -3954,14 +4148,10 @@
: _parts = parts,
_uri = uri;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uri ?? '');
if (this._parts == null) {
@@ -4060,7 +4250,7 @@
/// Index into [LinkedLibrary.dependencies] for the library in which the
/// entity is defined.
- void set dependency(int value) {
+ set dependency(int value) {
assert(value == null || value >= 0);
this._dependency = value;
}
@@ -4069,7 +4259,7 @@
idl.ReferenceKind get kind => _kind ??= idl.ReferenceKind.classOrEnum;
/// The kind of the entity being referred to.
- void set kind(idl.ReferenceKind value) {
+ set kind(idl.ReferenceKind value) {
this._kind = value;
}
@@ -4078,7 +4268,7 @@
/// Name of the exported entity. For an exported setter, this name includes
/// the trailing '='.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -4089,7 +4279,7 @@
/// definition of the entity. As with indices into [LinkedLibrary.units],
/// zero represents the defining compilation unit, and nonzero values
/// represent parts in the order of the corresponding `part` declarations.
- void set unit(int value) {
+ set unit(int value) {
assert(value == null || value >= 0);
this._unit = value;
}
@@ -4101,14 +4291,10 @@
_name = name,
_unit = unit;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._dependency ?? 0);
signature.addString(this._name ?? '');
@@ -4237,7 +4423,7 @@
/// implicitly refers to an element declared in the library) or
/// anti-dependency (e.g. the result of type propagation or type inference
/// depends on the lack of a certain declaration in the library).
- void set dependencies(List<LinkedDependencyBuilder> value) {
+ set dependencies(List<LinkedDependencyBuilder> value) {
this._dependencies = value;
}
@@ -4246,7 +4432,7 @@
/// For each export in [UnlinkedUnit.exports], an index into [dependencies]
/// of the library being exported.
- void set exportDependencies(List<int> value) {
+ set exportDependencies(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._exportDependencies = value;
}
@@ -4260,7 +4446,7 @@
/// brought into the namespace via `export` directives).
///
/// Sorted by name.
- void set exportNames(List<LinkedExportNameBuilder> value) {
+ set exportNames(List<LinkedExportNameBuilder> value) {
this._exportNames = value;
}
@@ -4273,7 +4459,7 @@
/// For each import in [UnlinkedUnit.imports], an index into [dependencies]
/// of the library being imported.
- void set importDependencies(List<int> value) {
+ set importDependencies(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._importDependencies = value;
}
@@ -4284,7 +4470,7 @@
/// The number of elements in [dependencies] which are not "linked"
/// dependencies (that is, the number of libraries in the direct imports plus
/// the transitive closure of exports, plus the library itself).
- void set numPrelinkedDependencies(int value) {
+ set numPrelinkedDependencies(int value) {
assert(value == null || value >= 0);
this._numPrelinkedDependencies = value;
}
@@ -4296,7 +4482,7 @@
/// library. The summary of the defining compilation unit is listed first,
/// followed by the summary of each part, in the order of the `part`
/// declarations in the defining compilation unit.
- void set units(List<LinkedUnitBuilder> value) {
+ set units(List<LinkedUnitBuilder> value) {
this._units = value;
}
@@ -4314,18 +4500,14 @@
_numPrelinkedDependencies = numPrelinkedDependencies,
_units = units;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_dependencies?.forEach((b) => b.flushInformative());
_exportNames?.forEach((b) => b.flushInformative());
_units?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._dependencies == null) {
signature.addInt(0);
@@ -4539,41 +4721,106 @@
class LinkedNodeBuilder extends Object
with _LinkedNodeMixin
implements idl.LinkedNode {
+ LinkedNodeTypeBuilder _variantField_24;
List<LinkedNodeBuilder> _variantField_2;
LinkedNodeBuilder _variantField_11;
List<LinkedNodeBuilder> _variantField_4;
LinkedNodeBuilder _variantField_6;
int _variantField_15;
LinkedNodeBuilder _variantField_7;
+ int _variantField_17;
+ LinkedNodeTypeBuilder _variantField_23;
LinkedNodeBuilder _variantField_8;
int _variantField_16;
- int _variantField_17;
int _variantField_18;
int _variantField_19;
- LinkedNodeTypeBuilder _variantField_24;
bool _variantField_27;
LinkedNodeBuilder _variantField_9;
LinkedNodeBuilder _variantField_12;
List<LinkedNodeBuilder> _variantField_5;
LinkedNodeBuilder _variantField_13;
+ int _variantField_34;
+ int _variantField_33;
List<int> _variantField_28;
idl.LinkedNodeCommentType _variantField_29;
List<LinkedNodeBuilder> _variantField_3;
LinkedNodeBuilder _variantField_10;
+ idl.LinkedNodeFormalParameterKind _variantField_26;
double _variantField_21;
LinkedNodeTypeBuilder _variantField_25;
- idl.LinkedNodeFormalParameterKind _variantField_26;
String _variantField_30;
LinkedNodeBuilder _variantField_14;
bool _isSynthetic;
idl.LinkedNodeKind _kind;
- String _variantField_23;
- bool _variantField_31;
+ List<String> _variantField_36;
String _variantField_20;
+ bool _variantField_31;
+ TopLevelInferenceErrorBuilder _variantField_35;
String _variantField_22;
LinkedNodeVariablesDeclarationBuilder _variantField_32;
@override
+ LinkedNodeTypeBuilder get actualReturnType {
+ assert(kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionExpression ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericFunctionType ||
+ kind == idl.LinkedNodeKind.methodDeclaration);
+ return _variantField_24;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get actualType {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ return _variantField_24;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get binaryExpression_invokeType {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ return _variantField_24;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get invocationExpression_invokeType {
+ assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
+ kind == idl.LinkedNodeKind.methodInvocation);
+ return _variantField_24;
+ }
+
+ /// The explicit or inferred return type of a function typed node.
+ set actualReturnType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionExpression ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericFunctionType ||
+ kind == idl.LinkedNodeKind.methodDeclaration);
+ _variantField_24 = value;
+ }
+
+ set actualType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_24 = value;
+ }
+
+ set binaryExpression_invokeType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ _variantField_24 = value;
+ }
+
+ set invocationExpression_invokeType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
+ kind == idl.LinkedNodeKind.methodInvocation);
+ _variantField_24 = value;
+ }
+
+ @override
List<LinkedNodeBuilder> get adjacentStrings_strings {
assert(kind == idl.LinkedNodeKind.adjacentStrings);
return _variantField_2 ??= <LinkedNodeBuilder>[];
@@ -4598,6 +4845,12 @@
}
@override
+ List<LinkedNodeBuilder> get comment_references {
+ assert(kind == idl.LinkedNodeKind.comment);
+ return _variantField_2 ??= <LinkedNodeBuilder>[];
+ }
+
+ @override
List<LinkedNodeBuilder> get compilationUnit_declarations {
assert(kind == idl.LinkedNodeKind.compilationUnit);
return _variantField_2 ??= <LinkedNodeBuilder>[];
@@ -4724,128 +4977,133 @@
return _variantField_2 ??= <LinkedNodeBuilder>[];
}
- void set adjacentStrings_strings(List<LinkedNodeBuilder> value) {
+ set adjacentStrings_strings(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.adjacentStrings);
_variantField_2 = value;
}
- void set argumentList_arguments(List<LinkedNodeBuilder> value) {
+ set argumentList_arguments(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.argumentList);
_variantField_2 = value;
}
- void set block_statements(List<LinkedNodeBuilder> value) {
+ set block_statements(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.block);
_variantField_2 = value;
}
- void set cascadeExpression_sections(List<LinkedNodeBuilder> value) {
+ set cascadeExpression_sections(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.cascadeExpression);
_variantField_2 = value;
}
- void set compilationUnit_declarations(List<LinkedNodeBuilder> value) {
+ set comment_references(List<LinkedNodeBuilder> value) {
+ assert(kind == idl.LinkedNodeKind.comment);
+ _variantField_2 = value;
+ }
+
+ set compilationUnit_declarations(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_2 = value;
}
- void set constructorDeclaration_initializers(List<LinkedNodeBuilder> value) {
+ set constructorDeclaration_initializers(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_2 = value;
}
- void set dottedName_components(List<LinkedNodeBuilder> value) {
+ set dottedName_components(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.dottedName);
_variantField_2 = value;
}
- void set enumDeclaration_constants(List<LinkedNodeBuilder> value) {
+ set enumDeclaration_constants(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.enumDeclaration);
_variantField_2 = value;
}
- void set formalParameterList_parameters(List<LinkedNodeBuilder> value) {
+ set formalParameterList_parameters(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.formalParameterList);
_variantField_2 = value;
}
- void set hideCombinator_hiddenNames(List<LinkedNodeBuilder> value) {
+ set hideCombinator_hiddenNames(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.hideCombinator);
_variantField_2 = value;
}
- void set implementsClause_interfaces(List<LinkedNodeBuilder> value) {
+ set implementsClause_interfaces(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.implementsClause);
_variantField_2 = value;
}
- void set labeledStatement_labels(List<LinkedNodeBuilder> value) {
+ set labeledStatement_labels(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.labeledStatement);
_variantField_2 = value;
}
- void set libraryIdentifier_components(List<LinkedNodeBuilder> value) {
+ set libraryIdentifier_components(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.libraryIdentifier);
_variantField_2 = value;
}
- void set listLiteral_elements(List<LinkedNodeBuilder> value) {
+ set listLiteral_elements(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.listLiteral);
_variantField_2 = value;
}
- void set namespaceDirective_combinators(List<LinkedNodeBuilder> value) {
+ set namespaceDirective_combinators(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective);
_variantField_2 = value;
}
- void set onClause_superclassConstraints(List<LinkedNodeBuilder> value) {
+ set onClause_superclassConstraints(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.onClause);
_variantField_2 = value;
}
- void set setOrMapLiteral_elements(List<LinkedNodeBuilder> value) {
+ set setOrMapLiteral_elements(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
_variantField_2 = value;
}
- void set showCombinator_shownNames(List<LinkedNodeBuilder> value) {
+ set showCombinator_shownNames(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.showCombinator);
_variantField_2 = value;
}
- void set stringInterpolation_elements(List<LinkedNodeBuilder> value) {
+ set stringInterpolation_elements(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.stringInterpolation);
_variantField_2 = value;
}
- void set switchStatement_members(List<LinkedNodeBuilder> value) {
+ set switchStatement_members(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
_variantField_2 = value;
}
- void set tryStatement_catchClauses(List<LinkedNodeBuilder> value) {
+ set tryStatement_catchClauses(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.tryStatement);
_variantField_2 = value;
}
- void set typeArgumentList_arguments(List<LinkedNodeBuilder> value) {
+ set typeArgumentList_arguments(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.typeArgumentList);
_variantField_2 = value;
}
- void set typeParameterList_typeParameters(List<LinkedNodeBuilder> value) {
+ set typeParameterList_typeParameters(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.typeParameterList);
_variantField_2 = value;
}
- void set variableDeclarationList_variables(List<LinkedNodeBuilder> value) {
+ set variableDeclarationList_variables(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.variableDeclarationList);
_variantField_2 = value;
}
- void set withClause_mixinTypes(List<LinkedNodeBuilder> value) {
+ set withClause_mixinTypes(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.withClause);
_variantField_2 = value;
}
@@ -4876,7 +5134,7 @@
return _variantField_11;
}
- void set annotatedNode_comment(LinkedNodeBuilder value) {
+ set annotatedNode_comment(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.classTypeAlias ||
kind == idl.LinkedNodeKind.constructorDeclaration ||
@@ -4942,7 +5200,7 @@
return _variantField_4 ??= <LinkedNodeBuilder>[];
}
- void set annotatedNode_metadata(List<LinkedNodeBuilder> value) {
+ set annotatedNode_metadata(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.classTypeAlias ||
kind == idl.LinkedNodeKind.constructorDeclaration ||
@@ -4967,14 +5225,14 @@
_variantField_4 = value;
}
- void set normalFormalParameter_metadata(List<LinkedNodeBuilder> value) {
+ set normalFormalParameter_metadata(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
kind == idl.LinkedNodeKind.simpleFormalParameter);
_variantField_4 = value;
}
- void set switchMember_statements(List<LinkedNodeBuilder> value) {
+ set switchMember_statements(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.switchCase ||
kind == idl.LinkedNodeKind.switchDefault);
_variantField_4 = value;
@@ -5059,6 +5317,12 @@
}
@override
+ LinkedNodeBuilder get commentReference_identifier {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ return _variantField_6;
+ }
+
+ @override
LinkedNodeBuilder get compilationUnit_scriptTag {
assert(kind == idl.LinkedNodeKind.compilationUnit);
return _variantField_6;
@@ -5309,6 +5573,18 @@
}
@override
+ LinkedNodeBuilder get nativeClause_name {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ return _variantField_6;
+ }
+
+ @override
+ LinkedNodeBuilder get nativeFunctionBody_stringLiteral {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ return _variantField_6;
+ }
+
+ @override
LinkedNodeBuilder get parenthesizedExpression_expression {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
return _variantField_6;
@@ -5440,388 +5716,402 @@
return _variantField_6;
}
- void set annotation_arguments(LinkedNodeBuilder value) {
+ set annotation_arguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.annotation);
_variantField_6 = value;
}
- void set asExpression_expression(LinkedNodeBuilder value) {
+ set asExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.asExpression);
_variantField_6 = value;
}
- void set assertInitializer_condition(LinkedNodeBuilder value) {
+ set assertInitializer_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assertInitializer);
_variantField_6 = value;
}
- void set assertStatement_condition(LinkedNodeBuilder value) {
+ set assertStatement_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
_variantField_6 = value;
}
- void set assignmentExpression_leftHandSide(LinkedNodeBuilder value) {
+ set assignmentExpression_leftHandSide(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assignmentExpression);
_variantField_6 = value;
}
- void set awaitExpression_expression(LinkedNodeBuilder value) {
+ set awaitExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.awaitExpression);
_variantField_6 = value;
}
- void set binaryExpression_leftOperand(LinkedNodeBuilder value) {
+ set binaryExpression_leftOperand(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.binaryExpression);
_variantField_6 = value;
}
- void set blockFunctionBody_block(LinkedNodeBuilder value) {
+ set blockFunctionBody_block(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.blockFunctionBody);
_variantField_6 = value;
}
- void set breakStatement_label(LinkedNodeBuilder value) {
+ set breakStatement_label(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.breakStatement);
_variantField_6 = value;
}
- void set cascadeExpression_target(LinkedNodeBuilder value) {
+ set cascadeExpression_target(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.cascadeExpression);
_variantField_6 = value;
}
- void set catchClause_body(LinkedNodeBuilder value) {
+ set catchClause_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.catchClause);
_variantField_6 = value;
}
- void set classDeclaration_extendsClause(LinkedNodeBuilder value) {
+ set classDeclaration_extendsClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration);
_variantField_6 = value;
}
- void set classTypeAlias_typeParameters(LinkedNodeBuilder value) {
+ set classTypeAlias_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
_variantField_6 = value;
}
- void set compilationUnit_scriptTag(LinkedNodeBuilder value) {
+ set commentReference_identifier(LinkedNodeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ _variantField_6 = value;
+ }
+
+ set compilationUnit_scriptTag(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_6 = value;
}
- void set conditionalExpression_condition(LinkedNodeBuilder value) {
+ set conditionalExpression_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.conditionalExpression);
_variantField_6 = value;
}
- void set configuration_name(LinkedNodeBuilder value) {
+ set configuration_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.configuration);
_variantField_6 = value;
}
- void set constructorDeclaration_body(LinkedNodeBuilder value) {
+ set constructorDeclaration_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_6 = value;
}
- void set constructorFieldInitializer_expression(LinkedNodeBuilder value) {
+ set constructorFieldInitializer_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
_variantField_6 = value;
}
- void set constructorName_name(LinkedNodeBuilder value) {
+ set constructorName_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorName);
_variantField_6 = value;
}
- void set continueStatement_label(LinkedNodeBuilder value) {
+ set continueStatement_label(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.continueStatement);
_variantField_6 = value;
}
- void set declaredIdentifier_identifier(LinkedNodeBuilder value) {
+ set declaredIdentifier_identifier(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.declaredIdentifier);
_variantField_6 = value;
}
- void set defaultFormalParameter_defaultValue(LinkedNodeBuilder value) {
+ set defaultFormalParameter_defaultValue(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
_variantField_6 = value;
}
- void set doStatement_body(LinkedNodeBuilder value) {
+ set doStatement_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.doStatement);
_variantField_6 = value;
}
- void set enumConstantDeclaration_name(LinkedNodeBuilder value) {
+ set enumConstantDeclaration_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.enumConstantDeclaration);
_variantField_6 = value;
}
- void set expressionFunctionBody_expression(LinkedNodeBuilder value) {
+ set expressionFunctionBody_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
_variantField_6 = value;
}
- void set expressionStatement_expression(LinkedNodeBuilder value) {
+ set expressionStatement_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.expressionStatement);
_variantField_6 = value;
}
- void set extendsClause_superclass(LinkedNodeBuilder value) {
+ set extendsClause_superclass(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.extendsClause);
_variantField_6 = value;
}
- void set fieldDeclaration_fields(LinkedNodeBuilder value) {
+ set fieldDeclaration_fields(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldDeclaration);
_variantField_6 = value;
}
- void set fieldFormalParameter_type(LinkedNodeBuilder value) {
+ set fieldFormalParameter_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
_variantField_6 = value;
}
- void set forEachParts_iterable(LinkedNodeBuilder value) {
+ set forEachParts_iterable(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forEachPartsWithDeclaration ||
kind == idl.LinkedNodeKind.forEachPartsWithIdentifier);
_variantField_6 = value;
}
- void set forMixin_forLoopParts(LinkedNodeBuilder value) {
+ set forMixin_forLoopParts(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forElement ||
kind == idl.LinkedNodeKind.forStatement);
_variantField_6 = value;
}
- void set forParts_condition(LinkedNodeBuilder value) {
+ set forParts_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forPartsWithDeclarations ||
kind == idl.LinkedNodeKind.forPartsWithExpression);
_variantField_6 = value;
}
- void set functionDeclaration_functionExpression(LinkedNodeBuilder value) {
+ set functionDeclaration_functionExpression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionDeclaration);
_variantField_6 = value;
}
- void set functionDeclarationStatement_functionDeclaration(
+ set functionDeclarationStatement_functionDeclaration(
LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionDeclarationStatement);
_variantField_6 = value;
}
- void set functionExpression_body(LinkedNodeBuilder value) {
+ set functionExpression_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpression);
_variantField_6 = value;
}
- void set functionExpressionInvocation_function(LinkedNodeBuilder value) {
+ set functionExpressionInvocation_function(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpressionInvocation);
_variantField_6 = value;
}
- void set functionTypeAlias_formalParameters(LinkedNodeBuilder value) {
+ set functionTypeAlias_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypeAlias);
_variantField_6 = value;
}
- void set functionTypedFormalParameter_formalParameters(
- LinkedNodeBuilder value) {
+ set functionTypedFormalParameter_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypedFormalParameter);
_variantField_6 = value;
}
- void set genericFunctionType_typeParameters(LinkedNodeBuilder value) {
+ set genericFunctionType_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.genericFunctionType);
_variantField_6 = value;
}
- void set genericTypeAlias_typeParameters(LinkedNodeBuilder value) {
+ set genericTypeAlias_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.genericTypeAlias);
_variantField_6 = value;
}
- void set ifMixin_condition(LinkedNodeBuilder value) {
+ set ifMixin_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.ifElement ||
kind == idl.LinkedNodeKind.ifStatement);
_variantField_6 = value;
}
- void set importDirective_prefix(LinkedNodeBuilder value) {
+ set importDirective_prefix(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.importDirective);
_variantField_6 = value;
}
- void set indexExpression_index(LinkedNodeBuilder value) {
+ set indexExpression_index(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.indexExpression);
_variantField_6 = value;
}
- void set instanceCreationExpression_arguments(LinkedNodeBuilder value) {
+ set instanceCreationExpression_arguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.instanceCreationExpression);
_variantField_6 = value;
}
- void set interpolationExpression_expression(LinkedNodeBuilder value) {
+ set interpolationExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.interpolationExpression);
_variantField_6 = value;
}
- void set isExpression_expression(LinkedNodeBuilder value) {
+ set isExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.isExpression);
_variantField_6 = value;
}
- void set label_label(LinkedNodeBuilder value) {
+ set label_label(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.label);
_variantField_6 = value;
}
- void set labeledStatement_statement(LinkedNodeBuilder value) {
+ set labeledStatement_statement(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.labeledStatement);
_variantField_6 = value;
}
- void set libraryDirective_name(LinkedNodeBuilder value) {
+ set libraryDirective_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.libraryDirective);
_variantField_6 = value;
}
- void set mapLiteralEntry_key(LinkedNodeBuilder value) {
+ set mapLiteralEntry_key(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.mapLiteralEntry);
_variantField_6 = value;
}
- void set methodDeclaration_body(LinkedNodeBuilder value) {
+ set methodDeclaration_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_6 = value;
}
- void set methodInvocation_methodName(LinkedNodeBuilder value) {
+ set methodInvocation_methodName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodInvocation);
_variantField_6 = value;
}
- void set mixinDeclaration_onClause(LinkedNodeBuilder value) {
+ set mixinDeclaration_onClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.mixinDeclaration);
_variantField_6 = value;
}
- void set namedExpression_expression(LinkedNodeBuilder value) {
+ set namedExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.namedExpression);
_variantField_6 = value;
}
- void set parenthesizedExpression_expression(LinkedNodeBuilder value) {
+ set nativeClause_name(LinkedNodeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ _variantField_6 = value;
+ }
+
+ set nativeFunctionBody_stringLiteral(LinkedNodeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ _variantField_6 = value;
+ }
+
+ set parenthesizedExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
_variantField_6 = value;
}
- void set partOfDirective_libraryName(LinkedNodeBuilder value) {
+ set partOfDirective_libraryName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.partOfDirective);
_variantField_6 = value;
}
- void set postfixExpression_operand(LinkedNodeBuilder value) {
+ set postfixExpression_operand(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.postfixExpression);
_variantField_6 = value;
}
- void set prefixedIdentifier_identifier(LinkedNodeBuilder value) {
+ set prefixedIdentifier_identifier(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.prefixedIdentifier);
_variantField_6 = value;
}
- void set prefixExpression_operand(LinkedNodeBuilder value) {
+ set prefixExpression_operand(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.prefixExpression);
_variantField_6 = value;
}
- void set propertyAccess_propertyName(LinkedNodeBuilder value) {
+ set propertyAccess_propertyName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.propertyAccess);
_variantField_6 = value;
}
- void set redirectingConstructorInvocation_arguments(LinkedNodeBuilder value) {
+ set redirectingConstructorInvocation_arguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
_variantField_6 = value;
}
- void set returnStatement_expression(LinkedNodeBuilder value) {
+ set returnStatement_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.returnStatement);
_variantField_6 = value;
}
- void set simpleFormalParameter_type(LinkedNodeBuilder value) {
+ set simpleFormalParameter_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.simpleFormalParameter);
_variantField_6 = value;
}
- void set spreadElement_expression(LinkedNodeBuilder value) {
+ set spreadElement_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.spreadElement);
_variantField_6 = value;
}
- void set superConstructorInvocation_arguments(LinkedNodeBuilder value) {
+ set superConstructorInvocation_arguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
_variantField_6 = value;
}
- void set switchCase_expression(LinkedNodeBuilder value) {
+ set switchCase_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.switchCase);
_variantField_6 = value;
}
- void set throwExpression_expression(LinkedNodeBuilder value) {
+ set throwExpression_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.throwExpression);
_variantField_6 = value;
}
- void set topLevelVariableDeclaration_variableList(LinkedNodeBuilder value) {
+ set topLevelVariableDeclaration_variableList(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.topLevelVariableDeclaration);
_variantField_6 = value;
}
- void set tryStatement_body(LinkedNodeBuilder value) {
+ set tryStatement_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.tryStatement);
_variantField_6 = value;
}
- void set typeName_name(LinkedNodeBuilder value) {
+ set typeName_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.typeName);
_variantField_6 = value;
}
- void set typeParameter_bound(LinkedNodeBuilder value) {
+ set typeParameter_bound(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.typeParameter);
_variantField_6 = value;
}
- void set variableDeclaration_initializer(LinkedNodeBuilder value) {
+ set variableDeclaration_initializer(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.variableDeclaration);
_variantField_6 = value;
}
- void set variableDeclarationList_type(LinkedNodeBuilder value) {
+ set variableDeclarationList_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.variableDeclarationList);
_variantField_6 = value;
}
- void set variableDeclarationStatement_variables(LinkedNodeBuilder value) {
+ set variableDeclarationStatement_variables(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.variableDeclarationStatement);
_variantField_6 = value;
}
- void set whileStatement_body(LinkedNodeBuilder value) {
+ set whileStatement_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.whileStatement);
_variantField_6 = value;
}
- void set yieldStatement_expression(LinkedNodeBuilder value) {
+ set yieldStatement_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.yieldStatement);
_variantField_6 = value;
}
@@ -5917,6 +6207,12 @@
}
@override
+ int get commentReference_newKeyword {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ return _variantField_15 ??= 0;
+ }
+
+ @override
int get compilationUnit_beginToken {
assert(kind == idl.LinkedNodeKind.compilationUnit);
return _variantField_15 ??= 0;
@@ -6161,6 +6457,18 @@
}
@override
+ int get nativeClause_nativeKeyword {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ return _variantField_15 ??= 0;
+ }
+
+ @override
+ int get nativeFunctionBody_nativeKeyword {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ return _variantField_15 ??= 0;
+ }
+
+ @override
int get nullLiteral_literal {
assert(kind == idl.LinkedNodeKind.nullLiteral);
return _variantField_15 ??= 0;
@@ -6179,12 +6487,6 @@
}
@override
- int get partOfDirective_semicolon {
- assert(kind == idl.LinkedNodeKind.partOfDirective);
- return _variantField_15 ??= 0;
- }
-
- @override
int get postfixExpression_element {
assert(kind == idl.LinkedNodeKind.postfixExpression);
return _variantField_15 ??= 0;
@@ -6377,552 +6679,564 @@
return _variantField_15 ??= 0;
}
- void set annotation_atSign(int value) {
+ set annotation_atSign(int value) {
assert(kind == idl.LinkedNodeKind.annotation);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set argumentList_leftParenthesis(int value) {
+ set argumentList_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.argumentList);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set asExpression_asOperator(int value) {
+ set asExpression_asOperator(int value) {
assert(kind == idl.LinkedNodeKind.asExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set assertInitializer_assertKeyword(int value) {
+ set assertInitializer_assertKeyword(int value) {
assert(kind == idl.LinkedNodeKind.assertInitializer);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set assertStatement_assertKeyword(int value) {
+ set assertStatement_assertKeyword(int value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set assignmentExpression_element(int value) {
+ set assignmentExpression_element(int value) {
assert(kind == idl.LinkedNodeKind.assignmentExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set awaitExpression_awaitKeyword(int value) {
+ set awaitExpression_awaitKeyword(int value) {
assert(kind == idl.LinkedNodeKind.awaitExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set binaryExpression_element(int value) {
+ set binaryExpression_element(int value) {
assert(kind == idl.LinkedNodeKind.binaryExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set block_leftBracket(int value) {
+ set block_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.block);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set blockFunctionBody_keyword(int value) {
+ set blockFunctionBody_keyword(int value) {
assert(kind == idl.LinkedNodeKind.blockFunctionBody);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set booleanLiteral_literal(int value) {
+ set booleanLiteral_literal(int value) {
assert(kind == idl.LinkedNodeKind.booleanLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set breakStatement_breakKeyword(int value) {
+ set breakStatement_breakKeyword(int value) {
assert(kind == idl.LinkedNodeKind.breakStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set catchClause_catchKeyword(int value) {
+ set catchClause_catchKeyword(int value) {
assert(kind == idl.LinkedNodeKind.catchClause);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set classDeclaration_abstractKeyword(int value) {
+ set classDeclaration_abstractKeyword(int value) {
assert(kind == idl.LinkedNodeKind.classDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set classTypeAlias_abstractKeyword(int value) {
+ set classTypeAlias_abstractKeyword(int value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set compilationUnit_beginToken(int value) {
+ set commentReference_newKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ assert(value == null || value >= 0);
+ _variantField_15 = value;
+ }
+
+ set compilationUnit_beginToken(int value) {
assert(kind == idl.LinkedNodeKind.compilationUnit);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set conditionalExpression_colon(int value) {
+ set conditionalExpression_colon(int value) {
assert(kind == idl.LinkedNodeKind.conditionalExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set configuration_ifKeyword(int value) {
+ set configuration_ifKeyword(int value) {
assert(kind == idl.LinkedNodeKind.configuration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set constructorDeclaration_constKeyword(int value) {
+ set constructorDeclaration_constKeyword(int value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set constructorFieldInitializer_equals(int value) {
+ set constructorFieldInitializer_equals(int value) {
assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set constructorName_element(int value) {
+ set constructorName_element(int value) {
assert(kind == idl.LinkedNodeKind.constructorName);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set continueStatement_continueKeyword(int value) {
+ set continueStatement_continueKeyword(int value) {
assert(kind == idl.LinkedNodeKind.continueStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set declaredIdentifier_keyword(int value) {
+ set declaredIdentifier_keyword(int value) {
assert(kind == idl.LinkedNodeKind.declaredIdentifier);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set defaultFormalParameter_separator(int value) {
+ set defaultFormalParameter_separator(int value) {
assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set doStatement_leftParenthesis(int value) {
+ set doStatement_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.doStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set doubleLiteral_literal(int value) {
+ set doubleLiteral_literal(int value) {
assert(kind == idl.LinkedNodeKind.doubleLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set emptyFunctionBody_semicolon(int value) {
+ set emptyFunctionBody_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.emptyFunctionBody);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set emptyStatement_semicolon(int value) {
+ set emptyStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.emptyStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set enumDeclaration_enumKeyword(int value) {
+ set enumDeclaration_enumKeyword(int value) {
assert(kind == idl.LinkedNodeKind.enumDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set expressionFunctionBody_arrow(int value) {
+ set expressionFunctionBody_arrow(int value) {
assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set expressionStatement_semicolon(int value) {
+ set expressionStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.expressionStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set extendsClause_extendsKeyword(int value) {
+ set extendsClause_extendsKeyword(int value) {
assert(kind == idl.LinkedNodeKind.extendsClause);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set fieldDeclaration_covariantKeyword(int value) {
+ set fieldDeclaration_covariantKeyword(int value) {
assert(kind == idl.LinkedNodeKind.fieldDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set fieldFormalParameter_keyword(int value) {
+ set fieldFormalParameter_keyword(int value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set forEachParts_inKeyword(int value) {
+ set forEachParts_inKeyword(int value) {
assert(kind == idl.LinkedNodeKind.forEachPartsWithDeclaration ||
kind == idl.LinkedNodeKind.forEachPartsWithIdentifier);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set formalParameterList_leftDelimiter(int value) {
+ set formalParameterList_leftDelimiter(int value) {
assert(kind == idl.LinkedNodeKind.formalParameterList);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set forMixin_awaitKeyword(int value) {
+ set forMixin_awaitKeyword(int value) {
assert(kind == idl.LinkedNodeKind.forElement ||
kind == idl.LinkedNodeKind.forStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set forParts_leftSeparator(int value) {
+ set forParts_leftSeparator(int value) {
assert(kind == idl.LinkedNodeKind.forPartsWithDeclarations ||
kind == idl.LinkedNodeKind.forPartsWithExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set functionDeclaration_externalKeyword(int value) {
+ set functionDeclaration_externalKeyword(int value) {
assert(kind == idl.LinkedNodeKind.functionDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set genericFunctionType_functionKeyword(int value) {
+ set genericFunctionType_functionKeyword(int value) {
assert(kind == idl.LinkedNodeKind.genericFunctionType);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set ifMixin_elseKeyword(int value) {
+ set ifMixin_elseKeyword(int value) {
assert(kind == idl.LinkedNodeKind.ifElement ||
kind == idl.LinkedNodeKind.ifStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set implementsClause_implementsKeyword(int value) {
+ set implementsClause_implementsKeyword(int value) {
assert(kind == idl.LinkedNodeKind.implementsClause);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set importDirective_asKeyword(int value) {
+ set importDirective_asKeyword(int value) {
assert(kind == idl.LinkedNodeKind.importDirective);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set indexExpression_element(int value) {
+ set indexExpression_element(int value) {
assert(kind == idl.LinkedNodeKind.indexExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set instanceCreationExpression_keyword(int value) {
+ set instanceCreationExpression_keyword(int value) {
assert(kind == idl.LinkedNodeKind.instanceCreationExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set integerLiteral_literal(int value) {
+ set integerLiteral_literal(int value) {
assert(kind == idl.LinkedNodeKind.integerLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set interpolationExpression_leftBracket(int value) {
+ set interpolationExpression_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.interpolationExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set interpolationString_token(int value) {
+ set interpolationString_token(int value) {
assert(kind == idl.LinkedNodeKind.interpolationString);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set isExpression_isOperator(int value) {
+ set isExpression_isOperator(int value) {
assert(kind == idl.LinkedNodeKind.isExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set label_colon(int value) {
+ set label_colon(int value) {
assert(kind == idl.LinkedNodeKind.label);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set listLiteral_leftBracket(int value) {
+ set listLiteral_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.listLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set mapLiteralEntry_separator(int value) {
+ set mapLiteralEntry_separator(int value) {
assert(kind == idl.LinkedNodeKind.mapLiteralEntry);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set methodDeclaration_externalKeyword(int value) {
+ set methodDeclaration_externalKeyword(int value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set methodInvocation_operator(int value) {
+ set methodInvocation_operator(int value) {
assert(kind == idl.LinkedNodeKind.methodInvocation);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set mixinDeclaration_mixinKeyword(int value) {
+ set mixinDeclaration_mixinKeyword(int value) {
assert(kind == idl.LinkedNodeKind.mixinDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set nullLiteral_literal(int value) {
+ set nativeClause_nativeKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ assert(value == null || value >= 0);
+ _variantField_15 = value;
+ }
+
+ set nativeFunctionBody_nativeKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ assert(value == null || value >= 0);
+ _variantField_15 = value;
+ }
+
+ set nullLiteral_literal(int value) {
assert(kind == idl.LinkedNodeKind.nullLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set onClause_onKeyword(int value) {
+ set onClause_onKeyword(int value) {
assert(kind == idl.LinkedNodeKind.onClause);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set parenthesizedExpression_leftParenthesis(int value) {
+ set parenthesizedExpression_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set partOfDirective_semicolon(int value) {
- assert(kind == idl.LinkedNodeKind.partOfDirective);
- assert(value == null || value >= 0);
- _variantField_15 = value;
- }
-
- void set postfixExpression_element(int value) {
+ set postfixExpression_element(int value) {
assert(kind == idl.LinkedNodeKind.postfixExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set prefixedIdentifier_period(int value) {
+ set prefixedIdentifier_period(int value) {
assert(kind == idl.LinkedNodeKind.prefixedIdentifier);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set prefixExpression_element(int value) {
+ set prefixExpression_element(int value) {
assert(kind == idl.LinkedNodeKind.prefixExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set propertyAccess_operator(int value) {
+ set propertyAccess_operator(int value) {
assert(kind == idl.LinkedNodeKind.propertyAccess);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set redirectingConstructorInvocation_element(int value) {
+ set redirectingConstructorInvocation_element(int value) {
assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set rethrowExpression_rethrowKeyword(int value) {
+ set rethrowExpression_rethrowKeyword(int value) {
assert(kind == idl.LinkedNodeKind.rethrowExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set returnStatement_returnKeyword(int value) {
+ set returnStatement_returnKeyword(int value) {
assert(kind == idl.LinkedNodeKind.returnStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set scriptTag_scriptTag(int value) {
+ set scriptTag_scriptTag(int value) {
assert(kind == idl.LinkedNodeKind.scriptTag);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set setOrMapLiteral_leftBracket(int value) {
+ set setOrMapLiteral_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set simpleFormalParameter_keyword(int value) {
+ set simpleFormalParameter_keyword(int value) {
assert(kind == idl.LinkedNodeKind.simpleFormalParameter);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set simpleIdentifier_element(int value) {
+ set simpleIdentifier_element(int value) {
assert(kind == idl.LinkedNodeKind.simpleIdentifier);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set simpleStringLiteral_token(int value) {
+ set simpleStringLiteral_token(int value) {
assert(kind == idl.LinkedNodeKind.simpleStringLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set spreadElement_spreadOperator(int value) {
+ set spreadElement_spreadOperator(int value) {
assert(kind == idl.LinkedNodeKind.spreadElement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set superConstructorInvocation_element(int value) {
+ set superConstructorInvocation_element(int value) {
assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set superExpression_superKeyword(int value) {
+ set superExpression_superKeyword(int value) {
assert(kind == idl.LinkedNodeKind.superExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set switchMember_keyword(int value) {
+ set switchMember_keyword(int value) {
assert(kind == idl.LinkedNodeKind.switchCase ||
kind == idl.LinkedNodeKind.switchDefault);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set switchStatement_leftParenthesis(int value) {
+ set switchStatement_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set symbolLiteral_poundSign(int value) {
+ set symbolLiteral_poundSign(int value) {
assert(kind == idl.LinkedNodeKind.symbolLiteral);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set thisExpression_thisKeyword(int value) {
+ set thisExpression_thisKeyword(int value) {
assert(kind == idl.LinkedNodeKind.thisExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set throwExpression_throwKeyword(int value) {
+ set throwExpression_throwKeyword(int value) {
assert(kind == idl.LinkedNodeKind.throwExpression);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set topLevelVariableDeclaration_semicolon(int value) {
+ set topLevelVariableDeclaration_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.topLevelVariableDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set tryStatement_finallyKeyword(int value) {
+ set tryStatement_finallyKeyword(int value) {
assert(kind == idl.LinkedNodeKind.tryStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set typeArgumentList_leftBracket(int value) {
+ set typeArgumentList_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.typeArgumentList);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set typeName_question(int value) {
+ set typeName_question(int value) {
assert(kind == idl.LinkedNodeKind.typeName);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set typeParameter_extendsKeyword(int value) {
+ set typeParameter_extendsKeyword(int value) {
assert(kind == idl.LinkedNodeKind.typeParameter);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set typeParameterList_leftBracket(int value) {
+ set typeParameterList_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.typeParameterList);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set variableDeclaration_equals(int value) {
+ set variableDeclaration_equals(int value) {
assert(kind == idl.LinkedNodeKind.variableDeclaration);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set variableDeclarationList_keyword(int value) {
+ set variableDeclarationList_keyword(int value) {
assert(kind == idl.LinkedNodeKind.variableDeclarationList);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set variableDeclarationStatement_semicolon(int value) {
+ set variableDeclarationStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.variableDeclarationStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set whileStatement_leftParenthesis(int value) {
+ set whileStatement_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.whileStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set withClause_withKeyword(int value) {
+ set withClause_withKeyword(int value) {
assert(kind == idl.LinkedNodeKind.withClause);
assert(value == null || value >= 0);
_variantField_15 = value;
}
- void set yieldStatement_yieldKeyword(int value) {
+ set yieldStatement_yieldKeyword(int value) {
assert(kind == idl.LinkedNodeKind.yieldStatement);
assert(value == null || value >= 0);
_variantField_15 = value;
@@ -7222,253 +7536,666 @@
return _variantField_7;
}
- void set annotation_constructorName(LinkedNodeBuilder value) {
+ set annotation_constructorName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.annotation);
_variantField_7 = value;
}
- void set asExpression_type(LinkedNodeBuilder value) {
+ set asExpression_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.asExpression);
_variantField_7 = value;
}
- void set assertInitializer_message(LinkedNodeBuilder value) {
+ set assertInitializer_message(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assertInitializer);
_variantField_7 = value;
}
- void set assertStatement_message(LinkedNodeBuilder value) {
+ set assertStatement_message(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
_variantField_7 = value;
}
- void set assignmentExpression_rightHandSide(LinkedNodeBuilder value) {
+ set assignmentExpression_rightHandSide(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.assignmentExpression);
_variantField_7 = value;
}
- void set binaryExpression_rightOperand(LinkedNodeBuilder value) {
+ set binaryExpression_rightOperand(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.binaryExpression);
_variantField_7 = value;
}
- void set catchClause_exceptionParameter(LinkedNodeBuilder value) {
+ set catchClause_exceptionParameter(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.catchClause);
_variantField_7 = value;
}
- void set classDeclaration_withClause(LinkedNodeBuilder value) {
+ set classDeclaration_withClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration);
_variantField_7 = value;
}
- void set classTypeAlias_superclass(LinkedNodeBuilder value) {
+ set classTypeAlias_superclass(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
_variantField_7 = value;
}
- void set conditionalExpression_elseExpression(LinkedNodeBuilder value) {
+ set conditionalExpression_elseExpression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.conditionalExpression);
_variantField_7 = value;
}
- void set configuration_value(LinkedNodeBuilder value) {
+ set configuration_value(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.configuration);
_variantField_7 = value;
}
- void set constructorDeclaration_name(LinkedNodeBuilder value) {
+ set constructorDeclaration_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_7 = value;
}
- void set constructorFieldInitializer_fieldName(LinkedNodeBuilder value) {
+ set constructorFieldInitializer_fieldName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
_variantField_7 = value;
}
- void set constructorName_type(LinkedNodeBuilder value) {
+ set constructorName_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorName);
_variantField_7 = value;
}
- void set declaredIdentifier_type(LinkedNodeBuilder value) {
+ set declaredIdentifier_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.declaredIdentifier);
_variantField_7 = value;
}
- void set defaultFormalParameter_parameter(LinkedNodeBuilder value) {
+ set defaultFormalParameter_parameter(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
_variantField_7 = value;
}
- void set doStatement_condition(LinkedNodeBuilder value) {
+ set doStatement_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.doStatement);
_variantField_7 = value;
}
- void set fieldFormalParameter_typeParameters(LinkedNodeBuilder value) {
+ set fieldFormalParameter_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
_variantField_7 = value;
}
- void set forEachPartsWithDeclaration_loopVariable(LinkedNodeBuilder value) {
+ set forEachPartsWithDeclaration_loopVariable(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forEachPartsWithDeclaration);
_variantField_7 = value;
}
- void set forEachPartsWithIdentifier_identifier(LinkedNodeBuilder value) {
+ set forEachPartsWithIdentifier_identifier(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forEachPartsWithIdentifier);
_variantField_7 = value;
}
- void set forElement_body(LinkedNodeBuilder value) {
+ set forElement_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forElement);
_variantField_7 = value;
}
- void set forPartsWithDeclarations_variables(LinkedNodeBuilder value) {
+ set forPartsWithDeclarations_variables(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forPartsWithDeclarations);
_variantField_7 = value;
}
- void set forPartsWithExpression_initialization(LinkedNodeBuilder value) {
+ set forPartsWithExpression_initialization(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forPartsWithExpression);
_variantField_7 = value;
}
- void set forStatement_body(LinkedNodeBuilder value) {
+ set forStatement_body(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.forStatement);
_variantField_7 = value;
}
- void set functionDeclaration_returnType(LinkedNodeBuilder value) {
+ set functionDeclaration_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionDeclaration);
_variantField_7 = value;
}
- void set functionExpression_formalParameters(LinkedNodeBuilder value) {
+ set functionExpression_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpression);
_variantField_7 = value;
}
- void set functionTypeAlias_returnType(LinkedNodeBuilder value) {
+ set functionTypeAlias_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypeAlias);
_variantField_7 = value;
}
- void set functionTypedFormalParameter_returnType(LinkedNodeBuilder value) {
+ set functionTypedFormalParameter_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypedFormalParameter);
_variantField_7 = value;
}
- void set genericFunctionType_returnType(LinkedNodeBuilder value) {
+ set genericFunctionType_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.genericFunctionType);
_variantField_7 = value;
}
- void set genericTypeAlias_functionType(LinkedNodeBuilder value) {
+ set genericTypeAlias_functionType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.genericTypeAlias);
_variantField_7 = value;
}
- void set ifStatement_elseStatement(LinkedNodeBuilder value) {
+ set ifStatement_elseStatement(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.ifStatement);
_variantField_7 = value;
}
- void set indexExpression_target(LinkedNodeBuilder value) {
+ set indexExpression_target(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.indexExpression);
_variantField_7 = value;
}
- void set instanceCreationExpression_constructorName(LinkedNodeBuilder value) {
+ set instanceCreationExpression_constructorName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.instanceCreationExpression);
_variantField_7 = value;
}
- void set isExpression_type(LinkedNodeBuilder value) {
+ set isExpression_type(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.isExpression);
_variantField_7 = value;
}
- void set mapLiteralEntry_value(LinkedNodeBuilder value) {
+ set mapLiteralEntry_value(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.mapLiteralEntry);
_variantField_7 = value;
}
- void set methodDeclaration_formalParameters(LinkedNodeBuilder value) {
+ set methodDeclaration_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_7 = value;
}
- void set methodInvocation_target(LinkedNodeBuilder value) {
+ set methodInvocation_target(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodInvocation);
_variantField_7 = value;
}
- void set namedExpression_name(LinkedNodeBuilder value) {
+ set namedExpression_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.namedExpression);
_variantField_7 = value;
}
- void set partOfDirective_uri(LinkedNodeBuilder value) {
+ set partOfDirective_uri(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.partOfDirective);
_variantField_7 = value;
}
- void set prefixedIdentifier_prefix(LinkedNodeBuilder value) {
+ set prefixedIdentifier_prefix(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.prefixedIdentifier);
_variantField_7 = value;
}
- void set propertyAccess_target(LinkedNodeBuilder value) {
+ set propertyAccess_target(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.propertyAccess);
_variantField_7 = value;
}
- void set redirectingConstructorInvocation_constructorName(
+ set redirectingConstructorInvocation_constructorName(
LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
_variantField_7 = value;
}
- void set superConstructorInvocation_constructorName(LinkedNodeBuilder value) {
+ set superConstructorInvocation_constructorName(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
_variantField_7 = value;
}
- void set switchStatement_expression(LinkedNodeBuilder value) {
+ set switchStatement_expression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
_variantField_7 = value;
}
- void set tryStatement_finallyBlock(LinkedNodeBuilder value) {
+ set tryStatement_finallyBlock(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.tryStatement);
_variantField_7 = value;
}
- void set typeName_typeArguments(LinkedNodeBuilder value) {
+ set typeName_typeArguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.typeName);
_variantField_7 = value;
}
- void set typeParameter_name(LinkedNodeBuilder value) {
+ set typeParameter_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.typeParameter);
_variantField_7 = value;
}
- void set variableDeclaration_name(LinkedNodeBuilder value) {
+ set variableDeclaration_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.variableDeclaration);
_variantField_7 = value;
}
- void set whileStatement_condition(LinkedNodeBuilder value) {
+ set whileStatement_condition(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.whileStatement);
_variantField_7 = value;
}
@override
+ int get annotation_element {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get assertInitializer_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.assertInitializer);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get assertStatement_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.assertStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get catchClause_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.catchClause);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get configuration_rightParenthesis {
+ assert(kind == idl.LinkedNodeKind.configuration);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get constructorDeclaration_factoryKeyword {
+ assert(kind == idl.LinkedNodeKind.constructorDeclaration);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get constructorFieldInitializer_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get doStatement_doKeyword {
+ assert(kind == idl.LinkedNodeKind.doStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get enumDeclaration_rightBracket {
+ assert(kind == idl.LinkedNodeKind.enumDeclaration);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get expressionFunctionBody_semicolon {
+ assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get fieldDeclaration_staticKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldDeclaration);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get fieldFormalParameter_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get formalParameterList_rightDelimiter {
+ assert(kind == idl.LinkedNodeKind.formalParameterList);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get forMixin_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.forElement ||
+ kind == idl.LinkedNodeKind.forStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get genericFunctionType_id {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get ifMixin_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.ifElement ||
+ kind == idl.LinkedNodeKind.ifStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get indexExpression_leftBracket {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get methodDeclaration_operatorKeyword {
+ assert(kind == idl.LinkedNodeKind.methodDeclaration);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get redirectingConstructorInvocation_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get superConstructorInvocation_superKeyword {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get switchStatement_switchKeyword {
+ assert(kind == idl.LinkedNodeKind.switchStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get whileStatement_whileKeyword {
+ assert(kind == idl.LinkedNodeKind.whileStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ @override
+ int get yieldStatement_semicolon {
+ assert(kind == idl.LinkedNodeKind.yieldStatement);
+ return _variantField_17 ??= 0;
+ }
+
+ set annotation_element(int value) {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set assertInitializer_leftParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.assertInitializer);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set assertStatement_leftParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.assertStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set catchClause_leftParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.catchClause);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set configuration_rightParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.configuration);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set constructorDeclaration_factoryKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.constructorDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set constructorFieldInitializer_thisKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set doStatement_doKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.doStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set enumDeclaration_rightBracket(int value) {
+ assert(kind == idl.LinkedNodeKind.enumDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set expressionFunctionBody_semicolon(int value) {
+ assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set fieldDeclaration_staticKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.fieldDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set fieldFormalParameter_thisKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set formalParameterList_rightDelimiter(int value) {
+ assert(kind == idl.LinkedNodeKind.formalParameterList);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set forMixin_leftParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.forElement ||
+ kind == idl.LinkedNodeKind.forStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set genericFunctionType_id(int value) {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set ifMixin_leftParenthesis(int value) {
+ assert(kind == idl.LinkedNodeKind.ifElement ||
+ kind == idl.LinkedNodeKind.ifStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set indexExpression_leftBracket(int value) {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set methodDeclaration_operatorKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.methodDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set redirectingConstructorInvocation_thisKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set superConstructorInvocation_superKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set switchStatement_switchKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.switchStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set whileStatement_whileKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.whileStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ set yieldStatement_semicolon(int value) {
+ assert(kind == idl.LinkedNodeKind.yieldStatement);
+ assert(value == null || value >= 0);
+ _variantField_17 = value;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get annotation_elementType {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get assignmentExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.assignmentExpression);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get binaryExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get constructorName_elementType {
+ assert(kind == idl.LinkedNodeKind.constructorName);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get indexExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get postfixExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.postfixExpression);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get prefixExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.prefixExpression);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get redirectingConstructorInvocation_elementType {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get simpleIdentifier_elementType {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get superConstructorInvocation_elementType {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get typeName_type {
+ assert(kind == idl.LinkedNodeKind.typeName);
+ return _variantField_23;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get typeParameter_defaultType {
+ assert(kind == idl.LinkedNodeKind.typeParameter);
+ return _variantField_23;
+ }
+
+ set annotation_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ _variantField_23 = value;
+ }
+
+ set assignmentExpression_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.assignmentExpression);
+ _variantField_23 = value;
+ }
+
+ set binaryExpression_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ _variantField_23 = value;
+ }
+
+ set constructorName_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.constructorName);
+ _variantField_23 = value;
+ }
+
+ set indexExpression_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ _variantField_23 = value;
+ }
+
+ set postfixExpression_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.postfixExpression);
+ _variantField_23 = value;
+ }
+
+ set prefixExpression_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.prefixExpression);
+ _variantField_23 = value;
+ }
+
+ set redirectingConstructorInvocation_elementType(
+ LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ _variantField_23 = value;
+ }
+
+ set simpleIdentifier_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ _variantField_23 = value;
+ }
+
+ set superConstructorInvocation_elementType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ _variantField_23 = value;
+ }
+
+ set typeName_type(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.typeName);
+ _variantField_23 = value;
+ }
+
+ set typeParameter_defaultType(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.typeParameter);
+ _variantField_23 = value;
+ }
+
+ @override
LinkedNodeBuilder get annotation_name {
assert(kind == idl.LinkedNodeKind.annotation);
return _variantField_8;
@@ -7481,6 +8208,12 @@
}
@override
+ LinkedNodeBuilder get classDeclaration_nativeClause {
+ assert(kind == idl.LinkedNodeKind.classDeclaration);
+ return _variantField_8;
+ }
+
+ @override
LinkedNodeBuilder get classTypeAlias_withClause {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
return _variantField_8;
@@ -7558,78 +8291,82 @@
return _variantField_8;
}
- void set annotation_name(LinkedNodeBuilder value) {
+ set annotation_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.annotation);
_variantField_8 = value;
}
- void set catchClause_exceptionType(LinkedNodeBuilder value) {
+ set catchClause_exceptionType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.catchClause);
_variantField_8 = value;
}
- void set classTypeAlias_withClause(LinkedNodeBuilder value) {
+ set classDeclaration_nativeClause(LinkedNodeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.classDeclaration);
+ _variantField_8 = value;
+ }
+
+ set classTypeAlias_withClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
_variantField_8 = value;
}
- void set conditionalExpression_thenExpression(LinkedNodeBuilder value) {
+ set conditionalExpression_thenExpression(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.conditionalExpression);
_variantField_8 = value;
}
- void set configuration_uri(LinkedNodeBuilder value) {
+ set configuration_uri(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.configuration);
_variantField_8 = value;
}
- void set constructorDeclaration_parameters(LinkedNodeBuilder value) {
+ set constructorDeclaration_parameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_8 = value;
}
- void set fieldFormalParameter_formalParameters(LinkedNodeBuilder value) {
+ set fieldFormalParameter_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
_variantField_8 = value;
}
- void set functionExpression_typeParameters(LinkedNodeBuilder value) {
+ set functionExpression_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpression);
_variantField_8 = value;
}
- void set functionTypeAlias_typeParameters(LinkedNodeBuilder value) {
+ set functionTypeAlias_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypeAlias);
_variantField_8 = value;
}
- void set functionTypedFormalParameter_typeParameters(
- LinkedNodeBuilder value) {
+ set functionTypedFormalParameter_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionTypedFormalParameter);
_variantField_8 = value;
}
- void set genericFunctionType_formalParameters(LinkedNodeBuilder value) {
+ set genericFunctionType_formalParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.genericFunctionType);
_variantField_8 = value;
}
- void set ifElement_thenElement(LinkedNodeBuilder value) {
+ set ifElement_thenElement(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.ifElement);
_variantField_8 = value;
}
- void set ifStatement_thenStatement(LinkedNodeBuilder value) {
+ set ifStatement_thenStatement(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.ifStatement);
_variantField_8 = value;
}
- void set instanceCreationExpression_typeArguments(LinkedNodeBuilder value) {
+ set instanceCreationExpression_typeArguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.instanceCreationExpression);
_variantField_8 = value;
}
- void set methodDeclaration_returnType(LinkedNodeBuilder value) {
+ set methodDeclaration_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_8 = value;
}
@@ -7830,7 +8567,7 @@
}
@override
- int get indexExpression_leftBracket {
+ int get indexExpression_period {
assert(kind == idl.LinkedNodeKind.indexExpression);
return _variantField_16 ??= 0;
}
@@ -7866,6 +8603,12 @@
}
@override
+ int get nativeFunctionBody_semicolon {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ return _variantField_16 ??= 0;
+ }
+
+ @override
int get parenthesizedExpression_rightParenthesis {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
return _variantField_16 ??= 0;
@@ -7951,6 +8694,12 @@
}
@override
+ int get variableDeclarationList_lateKeyword {
+ assert(kind == idl.LinkedNodeKind.variableDeclarationList);
+ return _variantField_16 ??= 0;
+ }
+
+ @override
int get whileStatement_rightParenthesis {
assert(kind == idl.LinkedNodeKind.whileStatement);
return _variantField_16 ??= 0;
@@ -7962,611 +8711,347 @@
return _variantField_16 ??= 0;
}
- void set annotation_period(int value) {
+ set annotation_period(int value) {
assert(kind == idl.LinkedNodeKind.annotation);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set argumentList_rightParenthesis(int value) {
+ set argumentList_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.argumentList);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set assertInitializer_comma(int value) {
+ set assertInitializer_comma(int value) {
assert(kind == idl.LinkedNodeKind.assertInitializer);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set assertStatement_comma(int value) {
+ set assertStatement_comma(int value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set assignmentExpression_operator(int value) {
+ set assignmentExpression_operator(int value) {
assert(kind == idl.LinkedNodeKind.assignmentExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set binaryExpression_operator(int value) {
+ set binaryExpression_operator(int value) {
assert(kind == idl.LinkedNodeKind.binaryExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set block_rightBracket(int value) {
+ set block_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.block);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set blockFunctionBody_star(int value) {
+ set blockFunctionBody_star(int value) {
assert(kind == idl.LinkedNodeKind.blockFunctionBody);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set breakStatement_semicolon(int value) {
+ set breakStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.breakStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set catchClause_comma(int value) {
+ set catchClause_comma(int value) {
assert(kind == idl.LinkedNodeKind.catchClause);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set classDeclaration_classKeyword(int value) {
+ set classDeclaration_classKeyword(int value) {
assert(kind == idl.LinkedNodeKind.classDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set classTypeAlias_equals(int value) {
+ set classTypeAlias_equals(int value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set compilationUnit_endToken(int value) {
+ set compilationUnit_endToken(int value) {
assert(kind == idl.LinkedNodeKind.compilationUnit);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set conditionalExpression_question(int value) {
+ set conditionalExpression_question(int value) {
assert(kind == idl.LinkedNodeKind.conditionalExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set configuration_leftParenthesis(int value) {
+ set configuration_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.configuration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set constructorDeclaration_externalKeyword(int value) {
+ set constructorDeclaration_externalKeyword(int value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set constructorFieldInitializer_period(int value) {
+ set constructorFieldInitializer_period(int value) {
assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set constructorName_period(int value) {
+ set constructorName_period(int value) {
assert(kind == idl.LinkedNodeKind.constructorName);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set continueStatement_semicolon(int value) {
+ set continueStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.continueStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set doStatement_rightParenthesis(int value) {
+ set doStatement_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.doStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set enumDeclaration_leftBracket(int value) {
+ set enumDeclaration_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.enumDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set expressionFunctionBody_keyword(int value) {
+ set expressionFunctionBody_keyword(int value) {
assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set fieldDeclaration_semicolon(int value) {
+ set fieldDeclaration_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.fieldDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set fieldFormalParameter_period(int value) {
+ set fieldFormalParameter_period(int value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set formalParameterList_leftParenthesis(int value) {
+ set formalParameterList_leftParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.formalParameterList);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set forMixin_forKeyword(int value) {
+ set forMixin_forKeyword(int value) {
assert(kind == idl.LinkedNodeKind.forElement ||
kind == idl.LinkedNodeKind.forStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set forParts_rightSeparator(int value) {
+ set forParts_rightSeparator(int value) {
assert(kind == idl.LinkedNodeKind.forPartsWithDeclarations ||
kind == idl.LinkedNodeKind.forPartsWithExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set functionDeclaration_propertyKeyword(int value) {
+ set functionDeclaration_propertyKeyword(int value) {
assert(kind == idl.LinkedNodeKind.functionDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set genericFunctionType_question(int value) {
+ set genericFunctionType_question(int value) {
assert(kind == idl.LinkedNodeKind.genericFunctionType);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set genericTypeAlias_equals(int value) {
+ set genericTypeAlias_equals(int value) {
assert(kind == idl.LinkedNodeKind.genericTypeAlias);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set ifMixin_ifKeyword(int value) {
+ set ifMixin_ifKeyword(int value) {
assert(kind == idl.LinkedNodeKind.ifElement ||
kind == idl.LinkedNodeKind.ifStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set importDirective_deferredKeyword(int value) {
+ set importDirective_deferredKeyword(int value) {
assert(kind == idl.LinkedNodeKind.importDirective);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set indexExpression_leftBracket(int value) {
+ set indexExpression_period(int value) {
assert(kind == idl.LinkedNodeKind.indexExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set integerLiteral_value(int value) {
+ set integerLiteral_value(int value) {
assert(kind == idl.LinkedNodeKind.integerLiteral);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set interpolationExpression_rightBracket(int value) {
+ set interpolationExpression_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.interpolationExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set isExpression_notOperator(int value) {
+ set isExpression_notOperator(int value) {
assert(kind == idl.LinkedNodeKind.isExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set listLiteral_rightBracket(int value) {
+ set listLiteral_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.listLiteral);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set methodDeclaration_modifierKeyword(int value) {
+ set methodDeclaration_modifierKeyword(int value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set parenthesizedExpression_rightParenthesis(int value) {
+ set nativeFunctionBody_semicolon(int value) {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ assert(value == null || value >= 0);
+ _variantField_16 = value;
+ }
+
+ set parenthesizedExpression_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set partOfDirective_ofKeyword(int value) {
+ set partOfDirective_ofKeyword(int value) {
assert(kind == idl.LinkedNodeKind.partOfDirective);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set postfixExpression_operator(int value) {
+ set postfixExpression_operator(int value) {
assert(kind == idl.LinkedNodeKind.postfixExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set prefixExpression_operator(int value) {
+ set prefixExpression_operator(int value) {
assert(kind == idl.LinkedNodeKind.prefixExpression);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set redirectingConstructorInvocation_period(int value) {
+ set redirectingConstructorInvocation_period(int value) {
assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set returnStatement_semicolon(int value) {
+ set returnStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.returnStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set setOrMapLiteral_rightBracket(int value) {
+ set setOrMapLiteral_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set simpleIdentifier_token(int value) {
+ set simpleIdentifier_token(int value) {
assert(kind == idl.LinkedNodeKind.simpleIdentifier);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set superConstructorInvocation_period(int value) {
+ set superConstructorInvocation_period(int value) {
assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set switchMember_colon(int value) {
+ set switchMember_colon(int value) {
assert(kind == idl.LinkedNodeKind.switchCase ||
kind == idl.LinkedNodeKind.switchDefault);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set switchStatement_rightParenthesis(int value) {
+ set switchStatement_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set tryStatement_tryKeyword(int value) {
+ set tryStatement_tryKeyword(int value) {
assert(kind == idl.LinkedNodeKind.tryStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set typeArgumentList_rightBracket(int value) {
+ set typeArgumentList_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.typeArgumentList);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set typeParameterList_rightBracket(int value) {
+ set typeParameterList_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.typeParameterList);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set whileStatement_rightParenthesis(int value) {
+ set variableDeclarationList_lateKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.variableDeclarationList);
+ assert(value == null || value >= 0);
+ _variantField_16 = value;
+ }
+
+ set whileStatement_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.whileStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
- void set yieldStatement_star(int value) {
+ set yieldStatement_star(int value) {
assert(kind == idl.LinkedNodeKind.yieldStatement);
assert(value == null || value >= 0);
_variantField_16 = value;
}
@override
- int get assertInitializer_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.assertInitializer);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get assertStatement_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.assertStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get catchClause_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.catchClause);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get configuration_rightParenthesis {
- assert(kind == idl.LinkedNodeKind.configuration);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get constructorDeclaration_factoryKeyword {
- assert(kind == idl.LinkedNodeKind.constructorDeclaration);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get constructorFieldInitializer_thisKeyword {
- assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get directive_keyword {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get doStatement_doKeyword {
- assert(kind == idl.LinkedNodeKind.doStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get enumDeclaration_rightBracket {
- assert(kind == idl.LinkedNodeKind.enumDeclaration);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get expressionFunctionBody_semicolon {
- assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get fieldDeclaration_staticKeyword {
- assert(kind == idl.LinkedNodeKind.fieldDeclaration);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get fieldFormalParameter_thisKeyword {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get formalParameterList_rightDelimiter {
- assert(kind == idl.LinkedNodeKind.formalParameterList);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get forMixin_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.forElement ||
- kind == idl.LinkedNodeKind.forStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get ifMixin_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.ifElement ||
- kind == idl.LinkedNodeKind.ifStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get indexExpression_rightBracket {
- assert(kind == idl.LinkedNodeKind.indexExpression);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get methodDeclaration_operatorKeyword {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get redirectingConstructorInvocation_thisKeyword {
- assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get superConstructorInvocation_superKeyword {
- assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get switchStatement_switchKeyword {
- assert(kind == idl.LinkedNodeKind.switchStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get whileStatement_whileKeyword {
- assert(kind == idl.LinkedNodeKind.whileStatement);
- return _variantField_17 ??= 0;
- }
-
- @override
- int get yieldStatement_semicolon {
- assert(kind == idl.LinkedNodeKind.yieldStatement);
- return _variantField_17 ??= 0;
- }
-
- void set assertInitializer_leftParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.assertInitializer);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set assertStatement_leftParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.assertStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set catchClause_leftParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.catchClause);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set configuration_rightParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.configuration);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set constructorDeclaration_factoryKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.constructorDeclaration);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set constructorFieldInitializer_thisKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set directive_keyword(int value) {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set doStatement_doKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.doStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set enumDeclaration_rightBracket(int value) {
- assert(kind == idl.LinkedNodeKind.enumDeclaration);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set expressionFunctionBody_semicolon(int value) {
- assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set fieldDeclaration_staticKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.fieldDeclaration);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set fieldFormalParameter_thisKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set formalParameterList_rightDelimiter(int value) {
- assert(kind == idl.LinkedNodeKind.formalParameterList);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set forMixin_leftParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.forElement ||
- kind == idl.LinkedNodeKind.forStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set ifMixin_leftParenthesis(int value) {
- assert(kind == idl.LinkedNodeKind.ifElement ||
- kind == idl.LinkedNodeKind.ifStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set indexExpression_rightBracket(int value) {
- assert(kind == idl.LinkedNodeKind.indexExpression);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set methodDeclaration_operatorKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set redirectingConstructorInvocation_thisKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set superConstructorInvocation_superKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set switchStatement_switchKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.switchStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set whileStatement_whileKeyword(int value) {
- assert(kind == idl.LinkedNodeKind.whileStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- void set yieldStatement_semicolon(int value) {
- assert(kind == idl.LinkedNodeKind.yieldStatement);
- assert(value == null || value >= 0);
- _variantField_17 = value;
- }
-
- @override
int get assertInitializer_rightParenthesis {
assert(kind == idl.LinkedNodeKind.assertInitializer);
return _variantField_18 ??= 0;
@@ -8604,6 +9089,16 @@
}
@override
+ int get directive_keyword {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ return _variantField_18 ??= 0;
+ }
+
+ @override
int get doStatement_semicolon {
assert(kind == idl.LinkedNodeKind.doStatement);
return _variantField_18 ??= 0;
@@ -8623,17 +9118,22 @@
}
@override
+ int get indexExpression_rightBracket {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ return _variantField_18 ??= 0;
+ }
+
+ @override
int get methodDeclaration_propertyKeyword {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
return _variantField_18 ??= 0;
}
@override
- int get namespaceDirective_semicolon {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective);
+ int get normalFormalParameter_requiredKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter);
return _variantField_18 ??= 0;
}
@@ -8651,84 +9151,99 @@
return _variantField_18 ??= 0;
}
- void set assertInitializer_rightParenthesis(int value) {
+ set assertInitializer_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.assertInitializer);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set assertStatement_rightParenthesis(int value) {
+ set assertStatement_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set catchClause_onKeyword(int value) {
+ set catchClause_onKeyword(int value) {
assert(kind == idl.LinkedNodeKind.catchClause);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set classOrMixinDeclaration_rightBracket(int value) {
+ set classOrMixinDeclaration_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.mixinDeclaration);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set configuration_equalToken(int value) {
+ set configuration_equalToken(int value) {
assert(kind == idl.LinkedNodeKind.configuration);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set constructorDeclaration_period(int value) {
+ set constructorDeclaration_period(int value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set doStatement_semicolon(int value) {
+ set directive_keyword(int value) {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ assert(value == null || value >= 0);
+ _variantField_18 = value;
+ }
+
+ set doStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.doStatement);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set formalParameterList_rightParenthesis(int value) {
+ set formalParameterList_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.formalParameterList);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set ifMixin_rightParenthesis(int value) {
+ set ifMixin_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.ifElement ||
kind == idl.LinkedNodeKind.ifStatement);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set methodDeclaration_propertyKeyword(int value) {
+ set indexExpression_rightBracket(int value) {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ assert(value == null || value >= 0);
+ _variantField_18 = value;
+ }
+
+ set methodDeclaration_propertyKeyword(int value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set namespaceDirective_semicolon(int value) {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective);
+ set normalFormalParameter_requiredKeyword(int value) {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set switchStatement_leftBracket(int value) {
+ set switchStatement_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
assert(value == null || value >= 0);
_variantField_18 = value;
}
- void set typeAlias_typedefKeyword(int value) {
+ set typeAlias_typedefKeyword(int value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias ||
kind == idl.LinkedNodeKind.functionTypeAlias ||
kind == idl.LinkedNodeKind.genericTypeAlias);
@@ -8824,58 +9339,58 @@
return _variantField_19 ??= 0;
}
- void set assertStatement_semicolon(int value) {
+ set assertStatement_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.assertStatement);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set catchClause_rightParenthesis(int value) {
+ set catchClause_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.catchClause);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set classOrMixinDeclaration_leftBracket(int value) {
+ set classOrMixinDeclaration_leftBracket(int value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.mixinDeclaration);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set combinator_keyword(int value) {
+ set combinator_keyword(int value) {
assert(kind == idl.LinkedNodeKind.hideCombinator ||
kind == idl.LinkedNodeKind.showCombinator);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set constructorDeclaration_separator(int value) {
+ set constructorDeclaration_separator(int value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set doStatement_whileKeyword(int value) {
+ set doStatement_whileKeyword(int value) {
assert(kind == idl.LinkedNodeKind.doStatement);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set forMixin_rightParenthesis(int value) {
+ set forMixin_rightParenthesis(int value) {
assert(kind == idl.LinkedNodeKind.forElement ||
kind == idl.LinkedNodeKind.forStatement);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set methodDeclaration_actualProperty(int value) {
+ set methodDeclaration_actualProperty(int value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set normalFormalParameter_covariantKeyword(int value) {
+ set normalFormalParameter_covariantKeyword(int value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
kind == idl.LinkedNodeKind.simpleFormalParameter);
@@ -8883,13 +9398,13 @@
_variantField_19 = value;
}
- void set switchStatement_rightBracket(int value) {
+ set switchStatement_rightBracket(int value) {
assert(kind == idl.LinkedNodeKind.switchStatement);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set typeAlias_semicolon(int value) {
+ set typeAlias_semicolon(int value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias ||
kind == idl.LinkedNodeKind.functionTypeAlias ||
kind == idl.LinkedNodeKind.genericTypeAlias);
@@ -8897,14 +9412,14 @@
_variantField_19 = value;
}
- void set typedLiteral_constKeyword(int value) {
+ set typedLiteral_constKeyword(int value) {
assert(kind == idl.LinkedNodeKind.listLiteral ||
kind == idl.LinkedNodeKind.setOrMapLiteral);
assert(value == null || value >= 0);
_variantField_19 = value;
}
- void set uriBasedDirective_uriElement(int value) {
+ set uriBasedDirective_uriElement(int value) {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective ||
kind == idl.LinkedNodeKind.partDirective);
@@ -8913,118 +9428,6 @@
}
@override
- LinkedNodeTypeBuilder get binaryExpression_invokeType {
- assert(kind == idl.LinkedNodeKind.binaryExpression);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get fieldFormalParameter_type2 {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get functionDeclaration_returnType2 {
- assert(kind == idl.LinkedNodeKind.functionDeclaration);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get functionTypeAlias_returnType2 {
- assert(kind == idl.LinkedNodeKind.functionTypeAlias);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get genericFunctionType_returnType2 {
- assert(kind == idl.LinkedNodeKind.genericFunctionType);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get invocationExpression_invokeType {
- assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
- kind == idl.LinkedNodeKind.methodInvocation);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get methodDeclaration_returnType2 {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get simpleFormalParameter_type2 {
- assert(kind == idl.LinkedNodeKind.simpleFormalParameter);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get typeName_type {
- assert(kind == idl.LinkedNodeKind.typeName);
- return _variantField_24;
- }
-
- @override
- LinkedNodeTypeBuilder get variableDeclaration_type2 {
- assert(kind == idl.LinkedNodeKind.variableDeclaration);
- return _variantField_24;
- }
-
- void set binaryExpression_invokeType(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.binaryExpression);
- _variantField_24 = value;
- }
-
- void set fieldFormalParameter_type2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- _variantField_24 = value;
- }
-
- void set functionDeclaration_returnType2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.functionDeclaration);
- _variantField_24 = value;
- }
-
- void set functionTypeAlias_returnType2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.functionTypeAlias);
- _variantField_24 = value;
- }
-
- void set genericFunctionType_returnType2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.genericFunctionType);
- _variantField_24 = value;
- }
-
- void set invocationExpression_invokeType(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
- kind == idl.LinkedNodeKind.methodInvocation);
- _variantField_24 = value;
- }
-
- void set methodDeclaration_returnType2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- _variantField_24 = value;
- }
-
- void set simpleFormalParameter_type2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.simpleFormalParameter);
- _variantField_24 = value;
- }
-
- void set typeName_type(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.typeName);
- _variantField_24 = value;
- }
-
- void set variableDeclaration_type2(LinkedNodeTypeBuilder value) {
- assert(kind == idl.LinkedNodeKind.variableDeclaration);
- _variantField_24 = value;
- }
-
- @override
bool get booleanLiteral_value {
assert(kind == idl.LinkedNodeKind.booleanLiteral);
return _variantField_27 ??= false;
@@ -9037,16 +9440,11 @@
}
@override
- bool get defaultFormalParameter_isNamed {
- assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
- return _variantField_27 ??= false;
- }
-
- @override
- bool get normalFormalParameter_isCovariant {
+ bool get inheritsCovariant {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
return _variantField_27 ??= false;
}
@@ -9056,33 +9454,53 @@
return _variantField_27 ??= false;
}
- void set booleanLiteral_value(bool value) {
+ @override
+ bool get simpleIdentifier_isDeclaration {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ return _variantField_27 ??= false;
+ }
+
+ @override
+ bool get typeAlias_hasSelfReference {
+ assert(kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias);
+ return _variantField_27 ??= false;
+ }
+
+ set booleanLiteral_value(bool value) {
assert(kind == idl.LinkedNodeKind.booleanLiteral);
_variantField_27 = value;
}
- void set classDeclaration_isDartObject(bool value) {
+ set classDeclaration_isDartObject(bool value) {
assert(kind == idl.LinkedNodeKind.classDeclaration);
_variantField_27 = value;
}
- void set defaultFormalParameter_isNamed(bool value) {
- assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
- _variantField_27 = value;
- }
-
- void set normalFormalParameter_isCovariant(bool value) {
+ set inheritsCovariant(bool value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
_variantField_27 = value;
}
- void set setOrMapLiteral_isMap(bool value) {
+ set setOrMapLiteral_isMap(bool value) {
assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
_variantField_27 = value;
}
+ set simpleIdentifier_isDeclaration(bool value) {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ _variantField_27 = value;
+ }
+
+ set typeAlias_hasSelfReference(bool value) {
+ assert(kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias);
+ _variantField_27 = value;
+ }
+
@override
LinkedNodeBuilder get catchClause_stackTraceParameter {
assert(kind == idl.LinkedNodeKind.catchClause);
@@ -9113,28 +9531,27 @@
return _variantField_9;
}
- void set catchClause_stackTraceParameter(LinkedNodeBuilder value) {
+ set catchClause_stackTraceParameter(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.catchClause);
_variantField_9 = value;
}
- void set classTypeAlias_implementsClause(LinkedNodeBuilder value) {
+ set classTypeAlias_implementsClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
_variantField_9 = value;
}
- void set constructorDeclaration_redirectedConstructor(
- LinkedNodeBuilder value) {
+ set constructorDeclaration_redirectedConstructor(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_9 = value;
}
- void set ifElement_elseElement(LinkedNodeBuilder value) {
+ set ifElement_elseElement(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.ifElement);
_variantField_9 = value;
}
- void set methodDeclaration_typeParameters(LinkedNodeBuilder value) {
+ set methodDeclaration_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_9 = value;
}
@@ -9161,19 +9578,19 @@
return _variantField_12;
}
- void set classOrMixinDeclaration_implementsClause(LinkedNodeBuilder value) {
+ set classOrMixinDeclaration_implementsClause(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.mixinDeclaration);
_variantField_12 = value;
}
- void set invocationExpression_typeArguments(LinkedNodeBuilder value) {
+ set invocationExpression_typeArguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
kind == idl.LinkedNodeKind.methodInvocation);
_variantField_12 = value;
}
- void set normalFormalParameter_identifier(LinkedNodeBuilder value) {
+ set normalFormalParameter_identifier(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
kind == idl.LinkedNodeKind.simpleFormalParameter);
@@ -9194,13 +9611,13 @@
return _variantField_5 ??= <LinkedNodeBuilder>[];
}
- void set classOrMixinDeclaration_members(List<LinkedNodeBuilder> value) {
+ set classOrMixinDeclaration_members(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.mixinDeclaration);
_variantField_5 = value;
}
- void set forParts_updaters(List<LinkedNodeBuilder> value) {
+ set forParts_updaters(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.forPartsWithDeclarations ||
kind == idl.LinkedNodeKind.forPartsWithExpression);
_variantField_5 = value;
@@ -9213,13 +9630,117 @@
return _variantField_13;
}
- void set classOrMixinDeclaration_typeParameters(LinkedNodeBuilder value) {
+ set classOrMixinDeclaration_typeParameters(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.mixinDeclaration);
_variantField_13 = value;
}
@override
+ int get codeLength {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ return _variantField_34 ??= 0;
+ }
+
+ set codeLength(int value) {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_34 = value;
+ }
+
+ @override
+ int get codeOffset {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ return _variantField_33 ??= 0;
+ }
+
+ @override
+ int get directive_semicolon {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ return _variantField_33 ??= 0;
+ }
+
+ set codeOffset(int value) {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ assert(value == null || value >= 0);
+ _variantField_33 = value;
+ }
+
+ set directive_semicolon(int value) {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ assert(value == null || value >= 0);
+ _variantField_33 = value;
+ }
+
+ @override
List<int> get comment_tokens {
assert(kind == idl.LinkedNodeKind.comment);
return _variantField_28 ??= <int>[];
@@ -9231,13 +9752,13 @@
return _variantField_28 ??= <int>[];
}
- void set comment_tokens(List<int> value) {
+ set comment_tokens(List<int> value) {
assert(kind == idl.LinkedNodeKind.comment);
assert(value == null || value.every((e) => e >= 0));
_variantField_28 = value;
}
- void set symbolLiteral_components(List<int> value) {
+ set symbolLiteral_components(List<int> value) {
assert(kind == idl.LinkedNodeKind.symbolLiteral);
assert(value == null || value.every((e) => e >= 0));
_variantField_28 = value;
@@ -9249,7 +9770,7 @@
return _variantField_29 ??= idl.LinkedNodeCommentType.block;
}
- void set comment_type(idl.LinkedNodeCommentType value) {
+ set comment_type(idl.LinkedNodeCommentType value) {
assert(kind == idl.LinkedNodeKind.comment);
_variantField_29 = value;
}
@@ -9274,18 +9795,18 @@
return _variantField_3 ??= <LinkedNodeBuilder>[];
}
- void set compilationUnit_directives(List<LinkedNodeBuilder> value) {
+ set compilationUnit_directives(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_3 = value;
}
- void set namespaceDirective_configurations(List<LinkedNodeBuilder> value) {
+ set namespaceDirective_configurations(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective);
_variantField_3 = value;
}
- void set switchMember_labels(List<LinkedNodeBuilder> value) {
+ set switchMember_labels(List<LinkedNodeBuilder> value) {
assert(kind == idl.LinkedNodeKind.switchCase ||
kind == idl.LinkedNodeKind.switchDefault);
_variantField_3 = value;
@@ -9303,23 +9824,35 @@
return _variantField_10;
}
- void set constructorDeclaration_returnType(LinkedNodeBuilder value) {
+ set constructorDeclaration_returnType(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.constructorDeclaration);
_variantField_10 = value;
}
- void set methodDeclaration_name(LinkedNodeBuilder value) {
+ set methodDeclaration_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_10 = value;
}
@override
+ idl.LinkedNodeFormalParameterKind get defaultFormalParameter_kind {
+ assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
+ return _variantField_26 ??=
+ idl.LinkedNodeFormalParameterKind.requiredPositional;
+ }
+
+ set defaultFormalParameter_kind(idl.LinkedNodeFormalParameterKind value) {
+ assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
+ _variantField_26 = value;
+ }
+
+ @override
double get doubleLiteral_value {
assert(kind == idl.LinkedNodeKind.doubleLiteral);
return _variantField_21 ??= 0.0;
}
- void set doubleLiteral_value(double value) {
+ set doubleLiteral_value(double value) {
assert(kind == idl.LinkedNodeKind.doubleLiteral);
_variantField_21 = value;
}
@@ -9361,7 +9894,13 @@
return _variantField_25;
}
- void set expression_type(LinkedNodeTypeBuilder value) {
+ @override
+ LinkedNodeTypeBuilder get genericFunctionType_type {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ return _variantField_25;
+ }
+
+ set expression_type(LinkedNodeTypeBuilder value) {
assert(kind == idl.LinkedNodeKind.adjacentStrings ||
kind == idl.LinkedNodeKind.assignmentExpression ||
kind == idl.LinkedNodeKind.asExpression ||
@@ -9397,19 +9936,9 @@
_variantField_25 = value;
}
- @override
- idl.LinkedNodeFormalParameterKind get formalParameter_kind {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
- kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
- return _variantField_26 ??= idl.LinkedNodeFormalParameterKind.required;
- }
-
- void set formalParameter_kind(idl.LinkedNodeFormalParameterKind value) {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
- kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
- _variantField_26 = value;
+ set genericFunctionType_type(LinkedNodeTypeBuilder value) {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ _variantField_25 = value;
}
@override
@@ -9418,7 +9947,7 @@
return _variantField_30 ??= '';
}
- void set interpolationString_value(String value) {
+ set interpolationString_value(String value) {
assert(kind == idl.LinkedNodeKind.interpolationString);
_variantField_30 = value;
}
@@ -9465,13 +9994,13 @@
return _variantField_14;
}
- void set invocationExpression_arguments(LinkedNodeBuilder value) {
+ set invocationExpression_arguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
kind == idl.LinkedNodeKind.methodInvocation);
_variantField_14 = value;
}
- void set namedCompilationUnitMember_name(LinkedNodeBuilder value) {
+ set namedCompilationUnitMember_name(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.classDeclaration ||
kind == idl.LinkedNodeKind.classTypeAlias ||
kind == idl.LinkedNodeKind.enumDeclaration ||
@@ -9482,20 +10011,20 @@
_variantField_14 = value;
}
- void set normalFormalParameter_comment(LinkedNodeBuilder value) {
+ set normalFormalParameter_comment(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
kind == idl.LinkedNodeKind.simpleFormalParameter);
_variantField_14 = value;
}
- void set typedLiteral_typeArguments(LinkedNodeBuilder value) {
+ set typedLiteral_typeArguments(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.listLiteral ||
kind == idl.LinkedNodeKind.setOrMapLiteral);
_variantField_14 = value;
}
- void set uriBasedDirective_uri(LinkedNodeBuilder value) {
+ set uriBasedDirective_uri(LinkedNodeBuilder value) {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective ||
kind == idl.LinkedNodeKind.partDirective);
@@ -9505,43 +10034,33 @@
@override
bool get isSynthetic => _isSynthetic ??= false;
- void set isSynthetic(bool value) {
+ set isSynthetic(bool value) {
this._isSynthetic = value;
}
@override
idl.LinkedNodeKind get kind => _kind ??= idl.LinkedNodeKind.adjacentStrings;
- void set kind(idl.LinkedNodeKind value) {
+ set kind(idl.LinkedNodeKind value) {
this._kind = value;
}
@override
- String get namespaceDirective_selectedUriContent {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- return _variantField_23 ??= '';
+ List<String> get mixinDeclaration_superInvokedNames {
+ assert(kind == idl.LinkedNodeKind.mixinDeclaration);
+ return _variantField_36 ??= <String>[];
}
- void set namespaceDirective_selectedUriContent(String value) {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- _variantField_23 = value;
+ set mixinDeclaration_superInvokedNames(List<String> value) {
+ assert(kind == idl.LinkedNodeKind.mixinDeclaration);
+ _variantField_36 = value;
}
@override
- bool get setOrMapLiteral_isSet {
- assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
- return _variantField_31 ??= false;
- }
-
- void set setOrMapLiteral_isSet(bool value) {
- assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
- _variantField_31 = value;
+ String get namespaceDirective_selectedUri {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective);
+ return _variantField_20 ??= '';
}
@override
@@ -9550,12 +10069,61 @@
return _variantField_20 ??= '';
}
- void set simpleStringLiteral_value(String value) {
+ set namespaceDirective_selectedUri(String value) {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective);
+ _variantField_20 = value;
+ }
+
+ set simpleStringLiteral_value(String value) {
assert(kind == idl.LinkedNodeKind.simpleStringLiteral);
_variantField_20 = value;
}
@override
+ bool get setOrMapLiteral_isSet {
+ assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
+ return _variantField_31 ??= false;
+ }
+
+ @override
+ bool get simplyBoundable_isSimplyBounded {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.mixinDeclaration);
+ return _variantField_31 ??= false;
+ }
+
+ set setOrMapLiteral_isSet(bool value) {
+ assert(kind == idl.LinkedNodeKind.setOrMapLiteral);
+ _variantField_31 = value;
+ }
+
+ set simplyBoundable_isSimplyBounded(bool value) {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.mixinDeclaration);
+ _variantField_31 = value;
+ }
+
+ @override
+ TopLevelInferenceErrorBuilder get topLevelTypeInferenceError {
+ assert(kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ return _variantField_35;
+ }
+
+ set topLevelTypeInferenceError(TopLevelInferenceErrorBuilder value) {
+ assert(kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_35 = value;
+ }
+
+ @override
String get uriBasedDirective_uriContent {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective ||
@@ -9563,7 +10131,7 @@
return _variantField_22 ??= '';
}
- void set uriBasedDirective_uriContent(String value) {
+ set uriBasedDirective_uriContent(String value) {
assert(kind == idl.LinkedNodeKind.exportDirective ||
kind == idl.LinkedNodeKind.importDirective ||
kind == idl.LinkedNodeKind.partDirective);
@@ -9576,12 +10144,286 @@
return _variantField_32;
}
- void set variableDeclaration_declaration(
+ set variableDeclaration_declaration(
LinkedNodeVariablesDeclarationBuilder value) {
assert(kind == idl.LinkedNodeKind.variableDeclaration);
_variantField_32 = value;
}
+ LinkedNodeBuilder.functionDeclaration({
+ LinkedNodeTypeBuilder actualReturnType,
+ LinkedNodeBuilder annotatedNode_comment,
+ List<LinkedNodeBuilder> annotatedNode_metadata,
+ LinkedNodeBuilder functionDeclaration_functionExpression,
+ int functionDeclaration_externalKeyword,
+ LinkedNodeBuilder functionDeclaration_returnType,
+ int functionDeclaration_propertyKeyword,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder namedCompilationUnitMember_name,
+ }) : _kind = idl.LinkedNodeKind.functionDeclaration,
+ _variantField_24 = actualReturnType,
+ _variantField_11 = annotatedNode_comment,
+ _variantField_4 = annotatedNode_metadata,
+ _variantField_6 = functionDeclaration_functionExpression,
+ _variantField_15 = functionDeclaration_externalKeyword,
+ _variantField_7 = functionDeclaration_returnType,
+ _variantField_16 = functionDeclaration_propertyKeyword,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name;
+
+ LinkedNodeBuilder.functionExpression({
+ LinkedNodeTypeBuilder actualReturnType,
+ LinkedNodeBuilder functionExpression_body,
+ LinkedNodeBuilder functionExpression_formalParameters,
+ LinkedNodeBuilder functionExpression_typeParameters,
+ }) : _kind = idl.LinkedNodeKind.functionExpression,
+ _variantField_24 = actualReturnType,
+ _variantField_6 = functionExpression_body,
+ _variantField_7 = functionExpression_formalParameters,
+ _variantField_8 = functionExpression_typeParameters;
+
+ LinkedNodeBuilder.functionTypeAlias({
+ LinkedNodeTypeBuilder actualReturnType,
+ LinkedNodeBuilder annotatedNode_comment,
+ List<LinkedNodeBuilder> annotatedNode_metadata,
+ LinkedNodeBuilder functionTypeAlias_formalParameters,
+ LinkedNodeBuilder functionTypeAlias_returnType,
+ LinkedNodeBuilder functionTypeAlias_typeParameters,
+ int typeAlias_typedefKeyword,
+ int typeAlias_semicolon,
+ bool typeAlias_hasSelfReference,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder namedCompilationUnitMember_name,
+ bool simplyBoundable_isSimplyBounded,
+ }) : _kind = idl.LinkedNodeKind.functionTypeAlias,
+ _variantField_24 = actualReturnType,
+ _variantField_11 = annotatedNode_comment,
+ _variantField_4 = annotatedNode_metadata,
+ _variantField_6 = functionTypeAlias_formalParameters,
+ _variantField_7 = functionTypeAlias_returnType,
+ _variantField_8 = functionTypeAlias_typeParameters,
+ _variantField_18 = typeAlias_typedefKeyword,
+ _variantField_19 = typeAlias_semicolon,
+ _variantField_27 = typeAlias_hasSelfReference,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name,
+ _variantField_31 = simplyBoundable_isSimplyBounded;
+
+ LinkedNodeBuilder.genericFunctionType({
+ LinkedNodeTypeBuilder actualReturnType,
+ LinkedNodeBuilder genericFunctionType_typeParameters,
+ int genericFunctionType_functionKeyword,
+ LinkedNodeBuilder genericFunctionType_returnType,
+ int genericFunctionType_id,
+ LinkedNodeBuilder genericFunctionType_formalParameters,
+ int genericFunctionType_question,
+ LinkedNodeTypeBuilder genericFunctionType_type,
+ }) : _kind = idl.LinkedNodeKind.genericFunctionType,
+ _variantField_24 = actualReturnType,
+ _variantField_6 = genericFunctionType_typeParameters,
+ _variantField_15 = genericFunctionType_functionKeyword,
+ _variantField_7 = genericFunctionType_returnType,
+ _variantField_17 = genericFunctionType_id,
+ _variantField_8 = genericFunctionType_formalParameters,
+ _variantField_16 = genericFunctionType_question,
+ _variantField_25 = genericFunctionType_type;
+
+ LinkedNodeBuilder.methodDeclaration({
+ LinkedNodeTypeBuilder actualReturnType,
+ LinkedNodeBuilder annotatedNode_comment,
+ List<LinkedNodeBuilder> annotatedNode_metadata,
+ LinkedNodeBuilder methodDeclaration_body,
+ int methodDeclaration_externalKeyword,
+ LinkedNodeBuilder methodDeclaration_formalParameters,
+ int methodDeclaration_operatorKeyword,
+ LinkedNodeBuilder methodDeclaration_returnType,
+ int methodDeclaration_modifierKeyword,
+ int methodDeclaration_propertyKeyword,
+ int methodDeclaration_actualProperty,
+ LinkedNodeBuilder methodDeclaration_typeParameters,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder methodDeclaration_name,
+ }) : _kind = idl.LinkedNodeKind.methodDeclaration,
+ _variantField_24 = actualReturnType,
+ _variantField_11 = annotatedNode_comment,
+ _variantField_4 = annotatedNode_metadata,
+ _variantField_6 = methodDeclaration_body,
+ _variantField_15 = methodDeclaration_externalKeyword,
+ _variantField_7 = methodDeclaration_formalParameters,
+ _variantField_17 = methodDeclaration_operatorKeyword,
+ _variantField_8 = methodDeclaration_returnType,
+ _variantField_16 = methodDeclaration_modifierKeyword,
+ _variantField_18 = methodDeclaration_propertyKeyword,
+ _variantField_19 = methodDeclaration_actualProperty,
+ _variantField_9 = methodDeclaration_typeParameters,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_10 = methodDeclaration_name;
+
+ LinkedNodeBuilder.fieldFormalParameter({
+ LinkedNodeTypeBuilder actualType,
+ List<LinkedNodeBuilder> normalFormalParameter_metadata,
+ LinkedNodeBuilder fieldFormalParameter_type,
+ int fieldFormalParameter_keyword,
+ LinkedNodeBuilder fieldFormalParameter_typeParameters,
+ int fieldFormalParameter_thisKeyword,
+ LinkedNodeBuilder fieldFormalParameter_formalParameters,
+ int fieldFormalParameter_period,
+ int normalFormalParameter_requiredKeyword,
+ int normalFormalParameter_covariantKeyword,
+ bool inheritsCovariant,
+ LinkedNodeBuilder normalFormalParameter_identifier,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder normalFormalParameter_comment,
+ }) : _kind = idl.LinkedNodeKind.fieldFormalParameter,
+ _variantField_24 = actualType,
+ _variantField_4 = normalFormalParameter_metadata,
+ _variantField_6 = fieldFormalParameter_type,
+ _variantField_15 = fieldFormalParameter_keyword,
+ _variantField_7 = fieldFormalParameter_typeParameters,
+ _variantField_17 = fieldFormalParameter_thisKeyword,
+ _variantField_8 = fieldFormalParameter_formalParameters,
+ _variantField_16 = fieldFormalParameter_period,
+ _variantField_18 = normalFormalParameter_requiredKeyword,
+ _variantField_19 = normalFormalParameter_covariantKeyword,
+ _variantField_27 = inheritsCovariant,
+ _variantField_12 = normalFormalParameter_identifier,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = normalFormalParameter_comment;
+
+ LinkedNodeBuilder.functionTypedFormalParameter({
+ LinkedNodeTypeBuilder actualType,
+ List<LinkedNodeBuilder> normalFormalParameter_metadata,
+ LinkedNodeBuilder functionTypedFormalParameter_formalParameters,
+ LinkedNodeBuilder functionTypedFormalParameter_returnType,
+ LinkedNodeBuilder functionTypedFormalParameter_typeParameters,
+ int normalFormalParameter_requiredKeyword,
+ int normalFormalParameter_covariantKeyword,
+ bool inheritsCovariant,
+ LinkedNodeBuilder normalFormalParameter_identifier,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder normalFormalParameter_comment,
+ }) : _kind = idl.LinkedNodeKind.functionTypedFormalParameter,
+ _variantField_24 = actualType,
+ _variantField_4 = normalFormalParameter_metadata,
+ _variantField_6 = functionTypedFormalParameter_formalParameters,
+ _variantField_7 = functionTypedFormalParameter_returnType,
+ _variantField_8 = functionTypedFormalParameter_typeParameters,
+ _variantField_18 = normalFormalParameter_requiredKeyword,
+ _variantField_19 = normalFormalParameter_covariantKeyword,
+ _variantField_27 = inheritsCovariant,
+ _variantField_12 = normalFormalParameter_identifier,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = normalFormalParameter_comment;
+
+ LinkedNodeBuilder.simpleFormalParameter({
+ LinkedNodeTypeBuilder actualType,
+ List<LinkedNodeBuilder> normalFormalParameter_metadata,
+ LinkedNodeBuilder simpleFormalParameter_type,
+ int simpleFormalParameter_keyword,
+ int normalFormalParameter_requiredKeyword,
+ int normalFormalParameter_covariantKeyword,
+ bool inheritsCovariant,
+ LinkedNodeBuilder normalFormalParameter_identifier,
+ int codeLength,
+ int codeOffset,
+ LinkedNodeBuilder normalFormalParameter_comment,
+ TopLevelInferenceErrorBuilder topLevelTypeInferenceError,
+ }) : _kind = idl.LinkedNodeKind.simpleFormalParameter,
+ _variantField_24 = actualType,
+ _variantField_4 = normalFormalParameter_metadata,
+ _variantField_6 = simpleFormalParameter_type,
+ _variantField_15 = simpleFormalParameter_keyword,
+ _variantField_18 = normalFormalParameter_requiredKeyword,
+ _variantField_19 = normalFormalParameter_covariantKeyword,
+ _variantField_27 = inheritsCovariant,
+ _variantField_12 = normalFormalParameter_identifier,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = normalFormalParameter_comment,
+ _variantField_35 = topLevelTypeInferenceError;
+
+ LinkedNodeBuilder.variableDeclaration({
+ LinkedNodeTypeBuilder actualType,
+ LinkedNodeBuilder annotatedNode_comment,
+ List<LinkedNodeBuilder> annotatedNode_metadata,
+ LinkedNodeBuilder variableDeclaration_initializer,
+ int variableDeclaration_equals,
+ LinkedNodeBuilder variableDeclaration_name,
+ bool inheritsCovariant,
+ int codeLength,
+ int codeOffset,
+ TopLevelInferenceErrorBuilder topLevelTypeInferenceError,
+ LinkedNodeVariablesDeclarationBuilder variableDeclaration_declaration,
+ }) : _kind = idl.LinkedNodeKind.variableDeclaration,
+ _variantField_24 = actualType,
+ _variantField_11 = annotatedNode_comment,
+ _variantField_4 = annotatedNode_metadata,
+ _variantField_6 = variableDeclaration_initializer,
+ _variantField_15 = variableDeclaration_equals,
+ _variantField_7 = variableDeclaration_name,
+ _variantField_27 = inheritsCovariant,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_35 = topLevelTypeInferenceError,
+ _variantField_32 = variableDeclaration_declaration;
+
+ LinkedNodeBuilder.binaryExpression({
+ LinkedNodeTypeBuilder binaryExpression_invokeType,
+ LinkedNodeBuilder binaryExpression_leftOperand,
+ int binaryExpression_element,
+ LinkedNodeBuilder binaryExpression_rightOperand,
+ LinkedNodeTypeBuilder binaryExpression_elementType,
+ int binaryExpression_operator,
+ LinkedNodeTypeBuilder expression_type,
+ }) : _kind = idl.LinkedNodeKind.binaryExpression,
+ _variantField_24 = binaryExpression_invokeType,
+ _variantField_6 = binaryExpression_leftOperand,
+ _variantField_15 = binaryExpression_element,
+ _variantField_7 = binaryExpression_rightOperand,
+ _variantField_23 = binaryExpression_elementType,
+ _variantField_16 = binaryExpression_operator,
+ _variantField_25 = expression_type;
+
+ LinkedNodeBuilder.functionExpressionInvocation({
+ LinkedNodeTypeBuilder invocationExpression_invokeType,
+ LinkedNodeBuilder functionExpressionInvocation_function,
+ LinkedNodeBuilder invocationExpression_typeArguments,
+ LinkedNodeTypeBuilder expression_type,
+ LinkedNodeBuilder invocationExpression_arguments,
+ }) : _kind = idl.LinkedNodeKind.functionExpressionInvocation,
+ _variantField_24 = invocationExpression_invokeType,
+ _variantField_6 = functionExpressionInvocation_function,
+ _variantField_12 = invocationExpression_typeArguments,
+ _variantField_25 = expression_type,
+ _variantField_14 = invocationExpression_arguments;
+
+ LinkedNodeBuilder.methodInvocation({
+ LinkedNodeTypeBuilder invocationExpression_invokeType,
+ LinkedNodeBuilder methodInvocation_methodName,
+ int methodInvocation_operator,
+ LinkedNodeBuilder methodInvocation_target,
+ LinkedNodeBuilder invocationExpression_typeArguments,
+ LinkedNodeTypeBuilder expression_type,
+ LinkedNodeBuilder invocationExpression_arguments,
+ }) : _kind = idl.LinkedNodeKind.methodInvocation,
+ _variantField_24 = invocationExpression_invokeType,
+ _variantField_6 = methodInvocation_methodName,
+ _variantField_15 = methodInvocation_operator,
+ _variantField_7 = methodInvocation_target,
+ _variantField_12 = invocationExpression_typeArguments,
+ _variantField_25 = expression_type,
+ _variantField_14 = invocationExpression_arguments;
+
LinkedNodeBuilder.adjacentStrings({
List<LinkedNodeBuilder> adjacentStrings_strings,
LinkedNodeTypeBuilder expression_type,
@@ -9616,17 +10458,30 @@
_variantField_6 = cascadeExpression_target,
_variantField_25 = expression_type;
+ LinkedNodeBuilder.comment({
+ List<LinkedNodeBuilder> comment_references,
+ List<int> comment_tokens,
+ idl.LinkedNodeCommentType comment_type,
+ }) : _kind = idl.LinkedNodeKind.comment,
+ _variantField_2 = comment_references,
+ _variantField_28 = comment_tokens,
+ _variantField_29 = comment_type;
+
LinkedNodeBuilder.compilationUnit({
List<LinkedNodeBuilder> compilationUnit_declarations,
LinkedNodeBuilder compilationUnit_scriptTag,
int compilationUnit_beginToken,
int compilationUnit_endToken,
+ int codeLength,
+ int codeOffset,
List<LinkedNodeBuilder> compilationUnit_directives,
}) : _kind = idl.LinkedNodeKind.compilationUnit,
_variantField_2 = compilationUnit_declarations,
_variantField_6 = compilationUnit_scriptTag,
_variantField_15 = compilationUnit_beginToken,
_variantField_16 = compilationUnit_endToken,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
_variantField_3 = compilationUnit_directives;
LinkedNodeBuilder.constructorDeclaration({
@@ -9636,12 +10491,14 @@
LinkedNodeBuilder constructorDeclaration_body,
int constructorDeclaration_constKeyword,
LinkedNodeBuilder constructorDeclaration_name,
+ int constructorDeclaration_factoryKeyword,
LinkedNodeBuilder constructorDeclaration_parameters,
int constructorDeclaration_externalKeyword,
- int constructorDeclaration_factoryKeyword,
int constructorDeclaration_period,
int constructorDeclaration_separator,
LinkedNodeBuilder constructorDeclaration_redirectedConstructor,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder constructorDeclaration_returnType,
}) : _kind = idl.LinkedNodeKind.constructorDeclaration,
_variantField_2 = constructorDeclaration_initializers,
@@ -9650,12 +10507,14 @@
_variantField_6 = constructorDeclaration_body,
_variantField_15 = constructorDeclaration_constKeyword,
_variantField_7 = constructorDeclaration_name,
+ _variantField_17 = constructorDeclaration_factoryKeyword,
_variantField_8 = constructorDeclaration_parameters,
_variantField_16 = constructorDeclaration_externalKeyword,
- _variantField_17 = constructorDeclaration_factoryKeyword,
_variantField_18 = constructorDeclaration_period,
_variantField_19 = constructorDeclaration_separator,
_variantField_9 = constructorDeclaration_redirectedConstructor,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
_variantField_10 = constructorDeclaration_returnType;
LinkedNodeBuilder.dottedName({
@@ -9668,29 +10527,33 @@
LinkedNodeBuilder annotatedNode_comment,
List<LinkedNodeBuilder> annotatedNode_metadata,
int enumDeclaration_enumKeyword,
- int enumDeclaration_leftBracket,
int enumDeclaration_rightBracket,
+ int enumDeclaration_leftBracket,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder namedCompilationUnitMember_name,
}) : _kind = idl.LinkedNodeKind.enumDeclaration,
_variantField_2 = enumDeclaration_constants,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_15 = enumDeclaration_enumKeyword,
- _variantField_16 = enumDeclaration_leftBracket,
_variantField_17 = enumDeclaration_rightBracket,
+ _variantField_16 = enumDeclaration_leftBracket,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
_variantField_14 = namedCompilationUnitMember_name;
LinkedNodeBuilder.formalParameterList({
List<LinkedNodeBuilder> formalParameterList_parameters,
int formalParameterList_leftDelimiter,
- int formalParameterList_leftParenthesis,
int formalParameterList_rightDelimiter,
+ int formalParameterList_leftParenthesis,
int formalParameterList_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.formalParameterList,
_variantField_2 = formalParameterList_parameters,
_variantField_15 = formalParameterList_leftDelimiter,
- _variantField_16 = formalParameterList_leftParenthesis,
_variantField_17 = formalParameterList_rightDelimiter,
+ _variantField_16 = formalParameterList_leftParenthesis,
_variantField_18 = formalParameterList_rightParenthesis;
LinkedNodeBuilder.hideCombinator({
@@ -9739,22 +10602,22 @@
LinkedNodeBuilder annotatedNode_comment,
List<LinkedNodeBuilder> annotatedNode_metadata,
int directive_keyword,
- int namespaceDirective_semicolon,
int uriBasedDirective_uriElement,
+ int directive_semicolon,
List<LinkedNodeBuilder> namespaceDirective_configurations,
LinkedNodeBuilder uriBasedDirective_uri,
- String namespaceDirective_selectedUriContent,
+ String namespaceDirective_selectedUri,
String uriBasedDirective_uriContent,
}) : _kind = idl.LinkedNodeKind.exportDirective,
_variantField_2 = namespaceDirective_combinators,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
- _variantField_17 = directive_keyword,
- _variantField_18 = namespaceDirective_semicolon,
+ _variantField_18 = directive_keyword,
_variantField_19 = uriBasedDirective_uriElement,
+ _variantField_33 = directive_semicolon,
_variantField_3 = namespaceDirective_configurations,
_variantField_14 = uriBasedDirective_uri,
- _variantField_23 = namespaceDirective_selectedUriContent,
+ _variantField_20 = namespaceDirective_selectedUri,
_variantField_22 = uriBasedDirective_uriContent;
LinkedNodeBuilder.importDirective({
@@ -9765,11 +10628,11 @@
int importDirective_asKeyword,
int importDirective_deferredKeyword,
int directive_keyword,
- int namespaceDirective_semicolon,
int uriBasedDirective_uriElement,
+ int directive_semicolon,
List<LinkedNodeBuilder> namespaceDirective_configurations,
LinkedNodeBuilder uriBasedDirective_uri,
- String namespaceDirective_selectedUriContent,
+ String namespaceDirective_selectedUri,
String uriBasedDirective_uriContent,
}) : _kind = idl.LinkedNodeKind.importDirective,
_variantField_2 = namespaceDirective_combinators,
@@ -9778,12 +10641,12 @@
_variantField_6 = importDirective_prefix,
_variantField_15 = importDirective_asKeyword,
_variantField_16 = importDirective_deferredKeyword,
- _variantField_17 = directive_keyword,
- _variantField_18 = namespaceDirective_semicolon,
+ _variantField_18 = directive_keyword,
_variantField_19 = uriBasedDirective_uriElement,
+ _variantField_33 = directive_semicolon,
_variantField_3 = namespaceDirective_configurations,
_variantField_14 = uriBasedDirective_uri,
- _variantField_23 = namespaceDirective_selectedUriContent,
+ _variantField_20 = namespaceDirective_selectedUri,
_variantField_22 = uriBasedDirective_uriContent;
LinkedNodeBuilder.onClause({
@@ -9830,16 +10693,16 @@
List<LinkedNodeBuilder> switchStatement_members,
int switchStatement_leftParenthesis,
LinkedNodeBuilder switchStatement_expression,
- int switchStatement_rightParenthesis,
int switchStatement_switchKeyword,
+ int switchStatement_rightParenthesis,
int switchStatement_leftBracket,
int switchStatement_rightBracket,
}) : _kind = idl.LinkedNodeKind.switchStatement,
_variantField_2 = switchStatement_members,
_variantField_15 = switchStatement_leftParenthesis,
_variantField_7 = switchStatement_expression,
- _variantField_16 = switchStatement_rightParenthesis,
_variantField_17 = switchStatement_switchKeyword,
+ _variantField_16 = switchStatement_rightParenthesis,
_variantField_18 = switchStatement_leftBracket,
_variantField_19 = switchStatement_rightBracket;
@@ -9880,12 +10743,14 @@
List<LinkedNodeBuilder> annotatedNode_metadata,
LinkedNodeBuilder variableDeclarationList_type,
int variableDeclarationList_keyword,
+ int variableDeclarationList_lateKeyword,
}) : _kind = idl.LinkedNodeKind.variableDeclarationList,
_variantField_2 = variableDeclarationList_variables,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = variableDeclarationList_type,
- _variantField_15 = variableDeclarationList_keyword;
+ _variantField_15 = variableDeclarationList_keyword,
+ _variantField_16 = variableDeclarationList_lateKeyword;
LinkedNodeBuilder.withClause({
List<LinkedNodeBuilder> withClause_mixinTypes,
@@ -9900,6 +10765,7 @@
LinkedNodeBuilder classDeclaration_extendsClause,
int classDeclaration_abstractKeyword,
LinkedNodeBuilder classDeclaration_withClause,
+ LinkedNodeBuilder classDeclaration_nativeClause,
int classDeclaration_classKeyword,
int classOrMixinDeclaration_rightBracket,
int classOrMixinDeclaration_leftBracket,
@@ -9907,13 +10773,17 @@
LinkedNodeBuilder classOrMixinDeclaration_implementsClause,
List<LinkedNodeBuilder> classOrMixinDeclaration_members,
LinkedNodeBuilder classOrMixinDeclaration_typeParameters,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder namedCompilationUnitMember_name,
+ bool simplyBoundable_isSimplyBounded,
}) : _kind = idl.LinkedNodeKind.classDeclaration,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = classDeclaration_extendsClause,
_variantField_15 = classDeclaration_abstractKeyword,
_variantField_7 = classDeclaration_withClause,
+ _variantField_8 = classDeclaration_nativeClause,
_variantField_16 = classDeclaration_classKeyword,
_variantField_18 = classOrMixinDeclaration_rightBracket,
_variantField_19 = classOrMixinDeclaration_leftBracket,
@@ -9921,7 +10791,10 @@
_variantField_12 = classOrMixinDeclaration_implementsClause,
_variantField_5 = classOrMixinDeclaration_members,
_variantField_13 = classOrMixinDeclaration_typeParameters,
- _variantField_14 = namedCompilationUnitMember_name;
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name,
+ _variantField_31 = simplyBoundable_isSimplyBounded;
LinkedNodeBuilder.classTypeAlias({
LinkedNodeBuilder annotatedNode_comment,
@@ -9934,7 +10807,10 @@
int typeAlias_typedefKeyword,
int typeAlias_semicolon,
LinkedNodeBuilder classTypeAlias_implementsClause,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder namedCompilationUnitMember_name,
+ bool simplyBoundable_isSimplyBounded,
}) : _kind = idl.LinkedNodeKind.classTypeAlias,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
@@ -9946,7 +10822,10 @@
_variantField_18 = typeAlias_typedefKeyword,
_variantField_19 = typeAlias_semicolon,
_variantField_9 = classTypeAlias_implementsClause,
- _variantField_14 = namedCompilationUnitMember_name;
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name,
+ _variantField_31 = simplyBoundable_isSimplyBounded;
LinkedNodeBuilder.declaredIdentifier({
LinkedNodeBuilder annotatedNode_comment,
@@ -9975,55 +10854,15 @@
List<LinkedNodeBuilder> annotatedNode_metadata,
LinkedNodeBuilder fieldDeclaration_fields,
int fieldDeclaration_covariantKeyword,
- int fieldDeclaration_semicolon,
int fieldDeclaration_staticKeyword,
+ int fieldDeclaration_semicolon,
}) : _kind = idl.LinkedNodeKind.fieldDeclaration,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = fieldDeclaration_fields,
_variantField_15 = fieldDeclaration_covariantKeyword,
- _variantField_16 = fieldDeclaration_semicolon,
- _variantField_17 = fieldDeclaration_staticKeyword;
-
- LinkedNodeBuilder.functionDeclaration({
- LinkedNodeBuilder annotatedNode_comment,
- List<LinkedNodeBuilder> annotatedNode_metadata,
- LinkedNodeBuilder functionDeclaration_functionExpression,
- int functionDeclaration_externalKeyword,
- LinkedNodeBuilder functionDeclaration_returnType,
- int functionDeclaration_propertyKeyword,
- LinkedNodeTypeBuilder functionDeclaration_returnType2,
- LinkedNodeBuilder namedCompilationUnitMember_name,
- }) : _kind = idl.LinkedNodeKind.functionDeclaration,
- _variantField_11 = annotatedNode_comment,
- _variantField_4 = annotatedNode_metadata,
- _variantField_6 = functionDeclaration_functionExpression,
- _variantField_15 = functionDeclaration_externalKeyword,
- _variantField_7 = functionDeclaration_returnType,
- _variantField_16 = functionDeclaration_propertyKeyword,
- _variantField_24 = functionDeclaration_returnType2,
- _variantField_14 = namedCompilationUnitMember_name;
-
- LinkedNodeBuilder.functionTypeAlias({
- LinkedNodeBuilder annotatedNode_comment,
- List<LinkedNodeBuilder> annotatedNode_metadata,
- LinkedNodeBuilder functionTypeAlias_formalParameters,
- LinkedNodeBuilder functionTypeAlias_returnType,
- LinkedNodeBuilder functionTypeAlias_typeParameters,
- int typeAlias_typedefKeyword,
- int typeAlias_semicolon,
- LinkedNodeTypeBuilder functionTypeAlias_returnType2,
- LinkedNodeBuilder namedCompilationUnitMember_name,
- }) : _kind = idl.LinkedNodeKind.functionTypeAlias,
- _variantField_11 = annotatedNode_comment,
- _variantField_4 = annotatedNode_metadata,
- _variantField_6 = functionTypeAlias_formalParameters,
- _variantField_7 = functionTypeAlias_returnType,
- _variantField_8 = functionTypeAlias_typeParameters,
- _variantField_18 = typeAlias_typedefKeyword,
- _variantField_19 = typeAlias_semicolon,
- _variantField_24 = functionTypeAlias_returnType2,
- _variantField_14 = namedCompilationUnitMember_name;
+ _variantField_17 = fieldDeclaration_staticKeyword,
+ _variantField_16 = fieldDeclaration_semicolon;
LinkedNodeBuilder.genericTypeAlias({
LinkedNodeBuilder annotatedNode_comment,
@@ -10033,7 +10872,11 @@
int genericTypeAlias_equals,
int typeAlias_typedefKeyword,
int typeAlias_semicolon,
+ bool typeAlias_hasSelfReference,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder namedCompilationUnitMember_name,
+ bool simplyBoundable_isSimplyBounded,
}) : _kind = idl.LinkedNodeKind.genericTypeAlias,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
@@ -10042,49 +10885,24 @@
_variantField_16 = genericTypeAlias_equals,
_variantField_18 = typeAlias_typedefKeyword,
_variantField_19 = typeAlias_semicolon,
- _variantField_14 = namedCompilationUnitMember_name;
+ _variantField_27 = typeAlias_hasSelfReference,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name,
+ _variantField_31 = simplyBoundable_isSimplyBounded;
LinkedNodeBuilder.libraryDirective({
LinkedNodeBuilder annotatedNode_comment,
List<LinkedNodeBuilder> annotatedNode_metadata,
LinkedNodeBuilder libraryDirective_name,
int directive_keyword,
- int namespaceDirective_semicolon,
+ int directive_semicolon,
}) : _kind = idl.LinkedNodeKind.libraryDirective,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = libraryDirective_name,
- _variantField_17 = directive_keyword,
- _variantField_18 = namespaceDirective_semicolon;
-
- LinkedNodeBuilder.methodDeclaration({
- LinkedNodeBuilder annotatedNode_comment,
- List<LinkedNodeBuilder> annotatedNode_metadata,
- LinkedNodeBuilder methodDeclaration_body,
- int methodDeclaration_externalKeyword,
- LinkedNodeBuilder methodDeclaration_formalParameters,
- LinkedNodeBuilder methodDeclaration_returnType,
- int methodDeclaration_modifierKeyword,
- int methodDeclaration_operatorKeyword,
- int methodDeclaration_propertyKeyword,
- int methodDeclaration_actualProperty,
- LinkedNodeTypeBuilder methodDeclaration_returnType2,
- LinkedNodeBuilder methodDeclaration_typeParameters,
- LinkedNodeBuilder methodDeclaration_name,
- }) : _kind = idl.LinkedNodeKind.methodDeclaration,
- _variantField_11 = annotatedNode_comment,
- _variantField_4 = annotatedNode_metadata,
- _variantField_6 = methodDeclaration_body,
- _variantField_15 = methodDeclaration_externalKeyword,
- _variantField_7 = methodDeclaration_formalParameters,
- _variantField_8 = methodDeclaration_returnType,
- _variantField_16 = methodDeclaration_modifierKeyword,
- _variantField_17 = methodDeclaration_operatorKeyword,
- _variantField_18 = methodDeclaration_propertyKeyword,
- _variantField_19 = methodDeclaration_actualProperty,
- _variantField_24 = methodDeclaration_returnType2,
- _variantField_9 = methodDeclaration_typeParameters,
- _variantField_10 = methodDeclaration_name;
+ _variantField_18 = directive_keyword,
+ _variantField_33 = directive_semicolon;
LinkedNodeBuilder.mixinDeclaration({
LinkedNodeBuilder annotatedNode_comment,
@@ -10096,7 +10914,11 @@
LinkedNodeBuilder classOrMixinDeclaration_implementsClause,
List<LinkedNodeBuilder> classOrMixinDeclaration_members,
LinkedNodeBuilder classOrMixinDeclaration_typeParameters,
+ int codeLength,
+ int codeOffset,
LinkedNodeBuilder namedCompilationUnitMember_name,
+ List<String> mixinDeclaration_superInvokedNames,
+ bool simplyBoundable_isSimplyBounded,
}) : _kind = idl.LinkedNodeKind.mixinDeclaration,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
@@ -10107,45 +10929,45 @@
_variantField_12 = classOrMixinDeclaration_implementsClause,
_variantField_5 = classOrMixinDeclaration_members,
_variantField_13 = classOrMixinDeclaration_typeParameters,
- _variantField_14 = namedCompilationUnitMember_name;
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_14 = namedCompilationUnitMember_name,
+ _variantField_36 = mixinDeclaration_superInvokedNames,
+ _variantField_31 = simplyBoundable_isSimplyBounded;
LinkedNodeBuilder.partDirective({
LinkedNodeBuilder annotatedNode_comment,
List<LinkedNodeBuilder> annotatedNode_metadata,
int directive_keyword,
- int namespaceDirective_semicolon,
int uriBasedDirective_uriElement,
+ int directive_semicolon,
LinkedNodeBuilder uriBasedDirective_uri,
- String namespaceDirective_selectedUriContent,
String uriBasedDirective_uriContent,
}) : _kind = idl.LinkedNodeKind.partDirective,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
- _variantField_17 = directive_keyword,
- _variantField_18 = namespaceDirective_semicolon,
+ _variantField_18 = directive_keyword,
_variantField_19 = uriBasedDirective_uriElement,
+ _variantField_33 = directive_semicolon,
_variantField_14 = uriBasedDirective_uri,
- _variantField_23 = namespaceDirective_selectedUriContent,
_variantField_22 = uriBasedDirective_uriContent;
LinkedNodeBuilder.partOfDirective({
LinkedNodeBuilder annotatedNode_comment,
List<LinkedNodeBuilder> annotatedNode_metadata,
LinkedNodeBuilder partOfDirective_libraryName,
- int partOfDirective_semicolon,
LinkedNodeBuilder partOfDirective_uri,
int partOfDirective_ofKeyword,
int directive_keyword,
- String namespaceDirective_selectedUriContent,
+ int directive_semicolon,
}) : _kind = idl.LinkedNodeKind.partOfDirective,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = partOfDirective_libraryName,
- _variantField_15 = partOfDirective_semicolon,
_variantField_7 = partOfDirective_uri,
_variantField_16 = partOfDirective_ofKeyword,
- _variantField_17 = directive_keyword,
- _variantField_23 = namespaceDirective_selectedUriContent;
+ _variantField_18 = directive_keyword,
+ _variantField_33 = directive_semicolon;
LinkedNodeBuilder.topLevelVariableDeclaration({
LinkedNodeBuilder annotatedNode_comment,
@@ -10164,100 +10986,18 @@
LinkedNodeBuilder typeParameter_bound,
int typeParameter_extendsKeyword,
LinkedNodeBuilder typeParameter_name,
+ LinkedNodeTypeBuilder typeParameter_defaultType,
+ int codeLength,
+ int codeOffset,
}) : _kind = idl.LinkedNodeKind.typeParameter,
_variantField_11 = annotatedNode_comment,
_variantField_4 = annotatedNode_metadata,
_variantField_6 = typeParameter_bound,
_variantField_15 = typeParameter_extendsKeyword,
- _variantField_7 = typeParameter_name;
-
- LinkedNodeBuilder.variableDeclaration({
- LinkedNodeBuilder annotatedNode_comment,
- List<LinkedNodeBuilder> annotatedNode_metadata,
- LinkedNodeBuilder variableDeclaration_initializer,
- int variableDeclaration_equals,
- LinkedNodeBuilder variableDeclaration_name,
- LinkedNodeTypeBuilder variableDeclaration_type2,
- LinkedNodeVariablesDeclarationBuilder variableDeclaration_declaration,
- }) : _kind = idl.LinkedNodeKind.variableDeclaration,
- _variantField_11 = annotatedNode_comment,
- _variantField_4 = annotatedNode_metadata,
- _variantField_6 = variableDeclaration_initializer,
- _variantField_15 = variableDeclaration_equals,
- _variantField_7 = variableDeclaration_name,
- _variantField_24 = variableDeclaration_type2,
- _variantField_32 = variableDeclaration_declaration;
-
- LinkedNodeBuilder.fieldFormalParameter({
- List<LinkedNodeBuilder> normalFormalParameter_metadata,
- LinkedNodeBuilder fieldFormalParameter_type,
- int fieldFormalParameter_keyword,
- LinkedNodeBuilder fieldFormalParameter_typeParameters,
- LinkedNodeBuilder fieldFormalParameter_formalParameters,
- int fieldFormalParameter_period,
- int fieldFormalParameter_thisKeyword,
- int normalFormalParameter_covariantKeyword,
- LinkedNodeTypeBuilder fieldFormalParameter_type2,
- bool normalFormalParameter_isCovariant,
- LinkedNodeBuilder normalFormalParameter_identifier,
- idl.LinkedNodeFormalParameterKind formalParameter_kind,
- LinkedNodeBuilder normalFormalParameter_comment,
- }) : _kind = idl.LinkedNodeKind.fieldFormalParameter,
- _variantField_4 = normalFormalParameter_metadata,
- _variantField_6 = fieldFormalParameter_type,
- _variantField_15 = fieldFormalParameter_keyword,
- _variantField_7 = fieldFormalParameter_typeParameters,
- _variantField_8 = fieldFormalParameter_formalParameters,
- _variantField_16 = fieldFormalParameter_period,
- _variantField_17 = fieldFormalParameter_thisKeyword,
- _variantField_19 = normalFormalParameter_covariantKeyword,
- _variantField_24 = fieldFormalParameter_type2,
- _variantField_27 = normalFormalParameter_isCovariant,
- _variantField_12 = normalFormalParameter_identifier,
- _variantField_26 = formalParameter_kind,
- _variantField_14 = normalFormalParameter_comment;
-
- LinkedNodeBuilder.functionTypedFormalParameter({
- List<LinkedNodeBuilder> normalFormalParameter_metadata,
- LinkedNodeBuilder functionTypedFormalParameter_formalParameters,
- LinkedNodeBuilder functionTypedFormalParameter_returnType,
- LinkedNodeBuilder functionTypedFormalParameter_typeParameters,
- int normalFormalParameter_covariantKeyword,
- bool normalFormalParameter_isCovariant,
- LinkedNodeBuilder normalFormalParameter_identifier,
- idl.LinkedNodeFormalParameterKind formalParameter_kind,
- LinkedNodeBuilder normalFormalParameter_comment,
- }) : _kind = idl.LinkedNodeKind.functionTypedFormalParameter,
- _variantField_4 = normalFormalParameter_metadata,
- _variantField_6 = functionTypedFormalParameter_formalParameters,
- _variantField_7 = functionTypedFormalParameter_returnType,
- _variantField_8 = functionTypedFormalParameter_typeParameters,
- _variantField_19 = normalFormalParameter_covariantKeyword,
- _variantField_27 = normalFormalParameter_isCovariant,
- _variantField_12 = normalFormalParameter_identifier,
- _variantField_26 = formalParameter_kind,
- _variantField_14 = normalFormalParameter_comment;
-
- LinkedNodeBuilder.simpleFormalParameter({
- List<LinkedNodeBuilder> normalFormalParameter_metadata,
- LinkedNodeBuilder simpleFormalParameter_type,
- int simpleFormalParameter_keyword,
- int normalFormalParameter_covariantKeyword,
- LinkedNodeTypeBuilder simpleFormalParameter_type2,
- bool normalFormalParameter_isCovariant,
- LinkedNodeBuilder normalFormalParameter_identifier,
- idl.LinkedNodeFormalParameterKind formalParameter_kind,
- LinkedNodeBuilder normalFormalParameter_comment,
- }) : _kind = idl.LinkedNodeKind.simpleFormalParameter,
- _variantField_4 = normalFormalParameter_metadata,
- _variantField_6 = simpleFormalParameter_type,
- _variantField_15 = simpleFormalParameter_keyword,
- _variantField_19 = normalFormalParameter_covariantKeyword,
- _variantField_24 = simpleFormalParameter_type2,
- _variantField_27 = normalFormalParameter_isCovariant,
- _variantField_12 = normalFormalParameter_identifier,
- _variantField_26 = formalParameter_kind,
- _variantField_14 = normalFormalParameter_comment;
+ _variantField_7 = typeParameter_name,
+ _variantField_23 = typeParameter_defaultType,
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset;
LinkedNodeBuilder.switchCase({
List<LinkedNodeBuilder> switchMember_statements,
@@ -10287,12 +11027,16 @@
LinkedNodeBuilder annotation_arguments,
int annotation_atSign,
LinkedNodeBuilder annotation_constructorName,
+ int annotation_element,
+ LinkedNodeTypeBuilder annotation_elementType,
LinkedNodeBuilder annotation_name,
int annotation_period,
}) : _kind = idl.LinkedNodeKind.annotation,
_variantField_6 = annotation_arguments,
_variantField_15 = annotation_atSign,
_variantField_7 = annotation_constructorName,
+ _variantField_17 = annotation_element,
+ _variantField_23 = annotation_elementType,
_variantField_8 = annotation_name,
_variantField_16 = annotation_period;
@@ -10311,31 +11055,31 @@
LinkedNodeBuilder assertInitializer_condition,
int assertInitializer_assertKeyword,
LinkedNodeBuilder assertInitializer_message,
- int assertInitializer_comma,
int assertInitializer_leftParenthesis,
+ int assertInitializer_comma,
int assertInitializer_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.assertInitializer,
_variantField_6 = assertInitializer_condition,
_variantField_15 = assertInitializer_assertKeyword,
_variantField_7 = assertInitializer_message,
- _variantField_16 = assertInitializer_comma,
_variantField_17 = assertInitializer_leftParenthesis,
+ _variantField_16 = assertInitializer_comma,
_variantField_18 = assertInitializer_rightParenthesis;
LinkedNodeBuilder.assertStatement({
LinkedNodeBuilder assertStatement_condition,
int assertStatement_assertKeyword,
LinkedNodeBuilder assertStatement_message,
- int assertStatement_comma,
int assertStatement_leftParenthesis,
+ int assertStatement_comma,
int assertStatement_rightParenthesis,
int assertStatement_semicolon,
}) : _kind = idl.LinkedNodeKind.assertStatement,
_variantField_6 = assertStatement_condition,
_variantField_15 = assertStatement_assertKeyword,
_variantField_7 = assertStatement_message,
- _variantField_16 = assertStatement_comma,
_variantField_17 = assertStatement_leftParenthesis,
+ _variantField_16 = assertStatement_comma,
_variantField_18 = assertStatement_rightParenthesis,
_variantField_19 = assertStatement_semicolon;
@@ -10343,12 +11087,14 @@
LinkedNodeBuilder assignmentExpression_leftHandSide,
int assignmentExpression_element,
LinkedNodeBuilder assignmentExpression_rightHandSide,
+ LinkedNodeTypeBuilder assignmentExpression_elementType,
int assignmentExpression_operator,
LinkedNodeTypeBuilder expression_type,
}) : _kind = idl.LinkedNodeKind.assignmentExpression,
_variantField_6 = assignmentExpression_leftHandSide,
_variantField_15 = assignmentExpression_element,
_variantField_7 = assignmentExpression_rightHandSide,
+ _variantField_23 = assignmentExpression_elementType,
_variantField_16 = assignmentExpression_operator,
_variantField_25 = expression_type;
@@ -10361,21 +11107,6 @@
_variantField_15 = awaitExpression_awaitKeyword,
_variantField_25 = expression_type;
- LinkedNodeBuilder.binaryExpression({
- LinkedNodeBuilder binaryExpression_leftOperand,
- int binaryExpression_element,
- LinkedNodeBuilder binaryExpression_rightOperand,
- int binaryExpression_operator,
- LinkedNodeTypeBuilder binaryExpression_invokeType,
- LinkedNodeTypeBuilder expression_type,
- }) : _kind = idl.LinkedNodeKind.binaryExpression,
- _variantField_6 = binaryExpression_leftOperand,
- _variantField_15 = binaryExpression_element,
- _variantField_7 = binaryExpression_rightOperand,
- _variantField_16 = binaryExpression_operator,
- _variantField_24 = binaryExpression_invokeType,
- _variantField_25 = expression_type;
-
LinkedNodeBuilder.blockFunctionBody({
LinkedNodeBuilder blockFunctionBody_block,
int blockFunctionBody_keyword,
@@ -10398,9 +11129,9 @@
LinkedNodeBuilder catchClause_body,
int catchClause_catchKeyword,
LinkedNodeBuilder catchClause_exceptionParameter,
+ int catchClause_leftParenthesis,
LinkedNodeBuilder catchClause_exceptionType,
int catchClause_comma,
- int catchClause_leftParenthesis,
int catchClause_onKeyword,
int catchClause_rightParenthesis,
LinkedNodeBuilder catchClause_stackTraceParameter,
@@ -10408,13 +11139,20 @@
_variantField_6 = catchClause_body,
_variantField_15 = catchClause_catchKeyword,
_variantField_7 = catchClause_exceptionParameter,
+ _variantField_17 = catchClause_leftParenthesis,
_variantField_8 = catchClause_exceptionType,
_variantField_16 = catchClause_comma,
- _variantField_17 = catchClause_leftParenthesis,
_variantField_18 = catchClause_onKeyword,
_variantField_19 = catchClause_rightParenthesis,
_variantField_9 = catchClause_stackTraceParameter;
+ LinkedNodeBuilder.commentReference({
+ LinkedNodeBuilder commentReference_identifier,
+ int commentReference_newKeyword,
+ }) : _kind = idl.LinkedNodeKind.commentReference,
+ _variantField_6 = commentReference_identifier,
+ _variantField_15 = commentReference_newKeyword;
+
LinkedNodeBuilder.conditionalExpression({
LinkedNodeBuilder conditionalExpression_condition,
int conditionalExpression_colon,
@@ -10434,41 +11172,43 @@
LinkedNodeBuilder configuration_name,
int configuration_ifKeyword,
LinkedNodeBuilder configuration_value,
+ int configuration_rightParenthesis,
LinkedNodeBuilder configuration_uri,
int configuration_leftParenthesis,
- int configuration_rightParenthesis,
int configuration_equalToken,
}) : _kind = idl.LinkedNodeKind.configuration,
_variantField_6 = configuration_name,
_variantField_15 = configuration_ifKeyword,
_variantField_7 = configuration_value,
+ _variantField_17 = configuration_rightParenthesis,
_variantField_8 = configuration_uri,
_variantField_16 = configuration_leftParenthesis,
- _variantField_17 = configuration_rightParenthesis,
_variantField_18 = configuration_equalToken;
LinkedNodeBuilder.constructorFieldInitializer({
LinkedNodeBuilder constructorFieldInitializer_expression,
int constructorFieldInitializer_equals,
LinkedNodeBuilder constructorFieldInitializer_fieldName,
- int constructorFieldInitializer_period,
int constructorFieldInitializer_thisKeyword,
+ int constructorFieldInitializer_period,
}) : _kind = idl.LinkedNodeKind.constructorFieldInitializer,
_variantField_6 = constructorFieldInitializer_expression,
_variantField_15 = constructorFieldInitializer_equals,
_variantField_7 = constructorFieldInitializer_fieldName,
- _variantField_16 = constructorFieldInitializer_period,
- _variantField_17 = constructorFieldInitializer_thisKeyword;
+ _variantField_17 = constructorFieldInitializer_thisKeyword,
+ _variantField_16 = constructorFieldInitializer_period;
LinkedNodeBuilder.constructorName({
LinkedNodeBuilder constructorName_name,
int constructorName_element,
LinkedNodeBuilder constructorName_type,
+ LinkedNodeTypeBuilder constructorName_elementType,
int constructorName_period,
}) : _kind = idl.LinkedNodeKind.constructorName,
_variantField_6 = constructorName_name,
_variantField_15 = constructorName_element,
_variantField_7 = constructorName_type,
+ _variantField_23 = constructorName_elementType,
_variantField_16 = constructorName_period;
LinkedNodeBuilder.continueStatement({
@@ -10484,40 +11224,44 @@
LinkedNodeBuilder defaultFormalParameter_defaultValue,
int defaultFormalParameter_separator,
LinkedNodeBuilder defaultFormalParameter_parameter,
- bool defaultFormalParameter_isNamed,
+ int codeLength,
+ int codeOffset,
+ idl.LinkedNodeFormalParameterKind defaultFormalParameter_kind,
}) : _kind = idl.LinkedNodeKind.defaultFormalParameter,
_variantField_6 = defaultFormalParameter_defaultValue,
_variantField_15 = defaultFormalParameter_separator,
_variantField_7 = defaultFormalParameter_parameter,
- _variantField_27 = defaultFormalParameter_isNamed;
+ _variantField_34 = codeLength,
+ _variantField_33 = codeOffset,
+ _variantField_26 = defaultFormalParameter_kind;
LinkedNodeBuilder.doStatement({
LinkedNodeBuilder doStatement_body,
int doStatement_leftParenthesis,
LinkedNodeBuilder doStatement_condition,
- int doStatement_rightParenthesis,
int doStatement_doKeyword,
+ int doStatement_rightParenthesis,
int doStatement_semicolon,
int doStatement_whileKeyword,
}) : _kind = idl.LinkedNodeKind.doStatement,
_variantField_6 = doStatement_body,
_variantField_15 = doStatement_leftParenthesis,
_variantField_7 = doStatement_condition,
- _variantField_16 = doStatement_rightParenthesis,
_variantField_17 = doStatement_doKeyword,
+ _variantField_16 = doStatement_rightParenthesis,
_variantField_18 = doStatement_semicolon,
_variantField_19 = doStatement_whileKeyword;
LinkedNodeBuilder.expressionFunctionBody({
LinkedNodeBuilder expressionFunctionBody_expression,
int expressionFunctionBody_arrow,
- int expressionFunctionBody_keyword,
int expressionFunctionBody_semicolon,
+ int expressionFunctionBody_keyword,
}) : _kind = idl.LinkedNodeKind.expressionFunctionBody,
_variantField_6 = expressionFunctionBody_expression,
_variantField_15 = expressionFunctionBody_arrow,
- _variantField_16 = expressionFunctionBody_keyword,
- _variantField_17 = expressionFunctionBody_semicolon;
+ _variantField_17 = expressionFunctionBody_semicolon,
+ _variantField_16 = expressionFunctionBody_keyword;
LinkedNodeBuilder.expressionStatement({
LinkedNodeBuilder expressionStatement_expression,
@@ -10555,30 +11299,30 @@
LinkedNodeBuilder forMixin_forLoopParts,
int forMixin_awaitKeyword,
LinkedNodeBuilder forElement_body,
- int forMixin_forKeyword,
int forMixin_leftParenthesis,
+ int forMixin_forKeyword,
int forMixin_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.forElement,
_variantField_6 = forMixin_forLoopParts,
_variantField_15 = forMixin_awaitKeyword,
_variantField_7 = forElement_body,
- _variantField_16 = forMixin_forKeyword,
_variantField_17 = forMixin_leftParenthesis,
+ _variantField_16 = forMixin_forKeyword,
_variantField_19 = forMixin_rightParenthesis;
LinkedNodeBuilder.forStatement({
LinkedNodeBuilder forMixin_forLoopParts,
int forMixin_awaitKeyword,
LinkedNodeBuilder forStatement_body,
- int forMixin_forKeyword,
int forMixin_leftParenthesis,
+ int forMixin_forKeyword,
int forMixin_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.forStatement,
_variantField_6 = forMixin_forLoopParts,
_variantField_15 = forMixin_awaitKeyword,
_variantField_7 = forStatement_body,
- _variantField_16 = forMixin_forKeyword,
_variantField_17 = forMixin_leftParenthesis,
+ _variantField_16 = forMixin_forKeyword,
_variantField_19 = forMixin_rightParenthesis;
LinkedNodeBuilder.forPartsWithDeclarations({
@@ -10612,57 +11356,20 @@
}) : _kind = idl.LinkedNodeKind.functionDeclarationStatement,
_variantField_6 = functionDeclarationStatement_functionDeclaration;
- LinkedNodeBuilder.functionExpression({
- LinkedNodeBuilder functionExpression_body,
- LinkedNodeBuilder functionExpression_formalParameters,
- LinkedNodeBuilder functionExpression_typeParameters,
- }) : _kind = idl.LinkedNodeKind.functionExpression,
- _variantField_6 = functionExpression_body,
- _variantField_7 = functionExpression_formalParameters,
- _variantField_8 = functionExpression_typeParameters;
-
- LinkedNodeBuilder.functionExpressionInvocation({
- LinkedNodeBuilder functionExpressionInvocation_function,
- LinkedNodeTypeBuilder invocationExpression_invokeType,
- LinkedNodeBuilder invocationExpression_typeArguments,
- LinkedNodeTypeBuilder expression_type,
- LinkedNodeBuilder invocationExpression_arguments,
- }) : _kind = idl.LinkedNodeKind.functionExpressionInvocation,
- _variantField_6 = functionExpressionInvocation_function,
- _variantField_24 = invocationExpression_invokeType,
- _variantField_12 = invocationExpression_typeArguments,
- _variantField_25 = expression_type,
- _variantField_14 = invocationExpression_arguments;
-
- LinkedNodeBuilder.genericFunctionType({
- LinkedNodeBuilder genericFunctionType_typeParameters,
- int genericFunctionType_functionKeyword,
- LinkedNodeBuilder genericFunctionType_returnType,
- LinkedNodeBuilder genericFunctionType_formalParameters,
- int genericFunctionType_question,
- LinkedNodeTypeBuilder genericFunctionType_returnType2,
- }) : _kind = idl.LinkedNodeKind.genericFunctionType,
- _variantField_6 = genericFunctionType_typeParameters,
- _variantField_15 = genericFunctionType_functionKeyword,
- _variantField_7 = genericFunctionType_returnType,
- _variantField_8 = genericFunctionType_formalParameters,
- _variantField_16 = genericFunctionType_question,
- _variantField_24 = genericFunctionType_returnType2;
-
LinkedNodeBuilder.ifElement({
LinkedNodeBuilder ifMixin_condition,
int ifMixin_elseKeyword,
+ int ifMixin_leftParenthesis,
LinkedNodeBuilder ifElement_thenElement,
int ifMixin_ifKeyword,
- int ifMixin_leftParenthesis,
int ifMixin_rightParenthesis,
LinkedNodeBuilder ifElement_elseElement,
}) : _kind = idl.LinkedNodeKind.ifElement,
_variantField_6 = ifMixin_condition,
_variantField_15 = ifMixin_elseKeyword,
+ _variantField_17 = ifMixin_leftParenthesis,
_variantField_8 = ifElement_thenElement,
_variantField_16 = ifMixin_ifKeyword,
- _variantField_17 = ifMixin_leftParenthesis,
_variantField_18 = ifMixin_rightParenthesis,
_variantField_9 = ifElement_elseElement;
@@ -10670,17 +11377,17 @@
LinkedNodeBuilder ifMixin_condition,
int ifMixin_elseKeyword,
LinkedNodeBuilder ifStatement_elseStatement,
+ int ifMixin_leftParenthesis,
LinkedNodeBuilder ifStatement_thenStatement,
int ifMixin_ifKeyword,
- int ifMixin_leftParenthesis,
int ifMixin_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.ifStatement,
_variantField_6 = ifMixin_condition,
_variantField_15 = ifMixin_elseKeyword,
_variantField_7 = ifStatement_elseStatement,
+ _variantField_17 = ifMixin_leftParenthesis,
_variantField_8 = ifStatement_thenStatement,
_variantField_16 = ifMixin_ifKeyword,
- _variantField_17 = ifMixin_leftParenthesis,
_variantField_18 = ifMixin_rightParenthesis;
LinkedNodeBuilder.indexExpression({
@@ -10688,14 +11395,18 @@
int indexExpression_element,
LinkedNodeBuilder indexExpression_target,
int indexExpression_leftBracket,
+ LinkedNodeTypeBuilder indexExpression_elementType,
+ int indexExpression_period,
int indexExpression_rightBracket,
LinkedNodeTypeBuilder expression_type,
}) : _kind = idl.LinkedNodeKind.indexExpression,
_variantField_6 = indexExpression_index,
_variantField_15 = indexExpression_element,
_variantField_7 = indexExpression_target,
- _variantField_16 = indexExpression_leftBracket,
- _variantField_17 = indexExpression_rightBracket,
+ _variantField_17 = indexExpression_leftBracket,
+ _variantField_23 = indexExpression_elementType,
+ _variantField_16 = indexExpression_period,
+ _variantField_18 = indexExpression_rightBracket,
_variantField_25 = expression_type;
LinkedNodeBuilder.instanceCreationExpression({
@@ -10749,23 +11460,6 @@
_variantField_15 = mapLiteralEntry_separator,
_variantField_7 = mapLiteralEntry_value;
- LinkedNodeBuilder.methodInvocation({
- LinkedNodeBuilder methodInvocation_methodName,
- int methodInvocation_operator,
- LinkedNodeBuilder methodInvocation_target,
- LinkedNodeTypeBuilder invocationExpression_invokeType,
- LinkedNodeBuilder invocationExpression_typeArguments,
- LinkedNodeTypeBuilder expression_type,
- LinkedNodeBuilder invocationExpression_arguments,
- }) : _kind = idl.LinkedNodeKind.methodInvocation,
- _variantField_6 = methodInvocation_methodName,
- _variantField_15 = methodInvocation_operator,
- _variantField_7 = methodInvocation_target,
- _variantField_24 = invocationExpression_invokeType,
- _variantField_12 = invocationExpression_typeArguments,
- _variantField_25 = expression_type,
- _variantField_14 = invocationExpression_arguments;
-
LinkedNodeBuilder.namedExpression({
LinkedNodeBuilder namedExpression_expression,
LinkedNodeBuilder namedExpression_name,
@@ -10775,6 +11469,22 @@
_variantField_7 = namedExpression_name,
_variantField_25 = expression_type;
+ LinkedNodeBuilder.nativeClause({
+ LinkedNodeBuilder nativeClause_name,
+ int nativeClause_nativeKeyword,
+ }) : _kind = idl.LinkedNodeKind.nativeClause,
+ _variantField_6 = nativeClause_name,
+ _variantField_15 = nativeClause_nativeKeyword;
+
+ LinkedNodeBuilder.nativeFunctionBody({
+ LinkedNodeBuilder nativeFunctionBody_stringLiteral,
+ int nativeFunctionBody_nativeKeyword,
+ int nativeFunctionBody_semicolon,
+ }) : _kind = idl.LinkedNodeKind.nativeFunctionBody,
+ _variantField_6 = nativeFunctionBody_stringLiteral,
+ _variantField_15 = nativeFunctionBody_nativeKeyword,
+ _variantField_16 = nativeFunctionBody_semicolon;
+
LinkedNodeBuilder.parenthesizedExpression({
LinkedNodeBuilder parenthesizedExpression_expression,
int parenthesizedExpression_leftParenthesis,
@@ -10789,11 +11499,13 @@
LinkedNodeBuilder.postfixExpression({
LinkedNodeBuilder postfixExpression_operand,
int postfixExpression_element,
+ LinkedNodeTypeBuilder postfixExpression_elementType,
int postfixExpression_operator,
LinkedNodeTypeBuilder expression_type,
}) : _kind = idl.LinkedNodeKind.postfixExpression,
_variantField_6 = postfixExpression_operand,
_variantField_15 = postfixExpression_element,
+ _variantField_23 = postfixExpression_elementType,
_variantField_16 = postfixExpression_operator,
_variantField_25 = expression_type;
@@ -10811,11 +11523,13 @@
LinkedNodeBuilder.prefixExpression({
LinkedNodeBuilder prefixExpression_operand,
int prefixExpression_element,
+ LinkedNodeTypeBuilder prefixExpression_elementType,
int prefixExpression_operator,
LinkedNodeTypeBuilder expression_type,
}) : _kind = idl.LinkedNodeKind.prefixExpression,
_variantField_6 = prefixExpression_operand,
_variantField_15 = prefixExpression_element,
+ _variantField_23 = prefixExpression_elementType,
_variantField_16 = prefixExpression_operator,
_variantField_25 = expression_type;
@@ -10834,14 +11548,16 @@
LinkedNodeBuilder redirectingConstructorInvocation_arguments,
int redirectingConstructorInvocation_element,
LinkedNodeBuilder redirectingConstructorInvocation_constructorName,
- int redirectingConstructorInvocation_period,
int redirectingConstructorInvocation_thisKeyword,
+ LinkedNodeTypeBuilder redirectingConstructorInvocation_elementType,
+ int redirectingConstructorInvocation_period,
}) : _kind = idl.LinkedNodeKind.redirectingConstructorInvocation,
_variantField_6 = redirectingConstructorInvocation_arguments,
_variantField_15 = redirectingConstructorInvocation_element,
_variantField_7 = redirectingConstructorInvocation_constructorName,
- _variantField_16 = redirectingConstructorInvocation_period,
- _variantField_17 = redirectingConstructorInvocation_thisKeyword;
+ _variantField_17 = redirectingConstructorInvocation_thisKeyword,
+ _variantField_23 = redirectingConstructorInvocation_elementType,
+ _variantField_16 = redirectingConstructorInvocation_period;
LinkedNodeBuilder.returnStatement({
LinkedNodeBuilder returnStatement_expression,
@@ -10863,14 +11579,16 @@
LinkedNodeBuilder superConstructorInvocation_arguments,
int superConstructorInvocation_element,
LinkedNodeBuilder superConstructorInvocation_constructorName,
- int superConstructorInvocation_period,
int superConstructorInvocation_superKeyword,
+ LinkedNodeTypeBuilder superConstructorInvocation_elementType,
+ int superConstructorInvocation_period,
}) : _kind = idl.LinkedNodeKind.superConstructorInvocation,
_variantField_6 = superConstructorInvocation_arguments,
_variantField_15 = superConstructorInvocation_element,
_variantField_7 = superConstructorInvocation_constructorName,
- _variantField_16 = superConstructorInvocation_period,
- _variantField_17 = superConstructorInvocation_superKeyword;
+ _variantField_17 = superConstructorInvocation_superKeyword,
+ _variantField_23 = superConstructorInvocation_elementType,
+ _variantField_16 = superConstructorInvocation_period;
LinkedNodeBuilder.throwExpression({
LinkedNodeBuilder throwExpression_expression,
@@ -10890,7 +11608,7 @@
_variantField_6 = typeName_name,
_variantField_15 = typeName_question,
_variantField_7 = typeName_typeArguments,
- _variantField_24 = typeName_type;
+ _variantField_23 = typeName_type;
LinkedNodeBuilder.variableDeclarationStatement({
LinkedNodeBuilder variableDeclarationStatement_variables,
@@ -10903,25 +11621,25 @@
LinkedNodeBuilder whileStatement_body,
int whileStatement_leftParenthesis,
LinkedNodeBuilder whileStatement_condition,
- int whileStatement_rightParenthesis,
int whileStatement_whileKeyword,
+ int whileStatement_rightParenthesis,
}) : _kind = idl.LinkedNodeKind.whileStatement,
_variantField_6 = whileStatement_body,
_variantField_15 = whileStatement_leftParenthesis,
_variantField_7 = whileStatement_condition,
- _variantField_16 = whileStatement_rightParenthesis,
- _variantField_17 = whileStatement_whileKeyword;
+ _variantField_17 = whileStatement_whileKeyword,
+ _variantField_16 = whileStatement_rightParenthesis;
LinkedNodeBuilder.yieldStatement({
LinkedNodeBuilder yieldStatement_expression,
int yieldStatement_yieldKeyword,
- int yieldStatement_star,
int yieldStatement_semicolon,
+ int yieldStatement_star,
}) : _kind = idl.LinkedNodeKind.yieldStatement,
_variantField_6 = yieldStatement_expression,
_variantField_15 = yieldStatement_yieldKeyword,
- _variantField_16 = yieldStatement_star,
- _variantField_17 = yieldStatement_semicolon;
+ _variantField_17 = yieldStatement_semicolon,
+ _variantField_16 = yieldStatement_star;
LinkedNodeBuilder.booleanLiteral({
int booleanLiteral_literal,
@@ -10988,11 +11706,15 @@
LinkedNodeBuilder.simpleIdentifier({
int simpleIdentifier_element,
+ LinkedNodeTypeBuilder simpleIdentifier_elementType,
int simpleIdentifier_token,
+ bool simpleIdentifier_isDeclaration,
LinkedNodeTypeBuilder expression_type,
}) : _kind = idl.LinkedNodeKind.simpleIdentifier,
_variantField_15 = simpleIdentifier_element,
+ _variantField_23 = simpleIdentifier_elementType,
_variantField_16 = simpleIdentifier_token,
+ _variantField_27 = simpleIdentifier_isDeclaration,
_variantField_25 = expression_type;
LinkedNodeBuilder.simpleStringLiteral({
@@ -11027,24 +11749,16 @@
_variantField_15 = thisExpression_thisKeyword,
_variantField_25 = expression_type;
- LinkedNodeBuilder.comment({
- List<int> comment_tokens,
- idl.LinkedNodeCommentType comment_type,
- }) : _kind = idl.LinkedNodeKind.comment,
- _variantField_28 = comment_tokens,
- _variantField_29 = comment_type;
-
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
+ _variantField_24?.flushInformative();
_variantField_2?.forEach((b) => b.flushInformative());
_variantField_11?.flushInformative();
_variantField_4?.forEach((b) => b.flushInformative());
_variantField_6?.flushInformative();
_variantField_7?.flushInformative();
+ _variantField_23?.flushInformative();
_variantField_8?.flushInformative();
- _variantField_24?.flushInformative();
_variantField_9?.flushInformative();
_variantField_12?.flushInformative();
_variantField_5?.forEach((b) => b.flushInformative());
@@ -11053,12 +11767,11 @@
_variantField_10?.flushInformative();
_variantField_25?.flushInformative();
_variantField_14?.flushInformative();
+ _variantField_35?.flushInformative();
_variantField_32?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._kind == null ? 0 : this._kind.index);
signature.addBool(this._isSynthetic == true);
@@ -11120,7 +11833,8 @@
signature.addString(this._variantField_20 ?? '');
signature.addDouble(this._variantField_21 ?? 0.0);
signature.addString(this._variantField_22 ?? '');
- signature.addString(this._variantField_23 ?? '');
+ signature.addBool(this._variantField_23 != null);
+ this._variantField_23?.collectApiSignature(signature);
signature.addBool(this._variantField_24 != null);
this._variantField_24?.collectApiSignature(signature);
signature.addBool(this._variantField_25 != null);
@@ -11142,16 +11856,29 @@
signature.addBool(this._variantField_31 == true);
signature.addBool(this._variantField_32 != null);
this._variantField_32?.collectApiSignature(signature);
+ signature.addInt(this._variantField_33 ?? 0);
+ signature.addInt(this._variantField_34 ?? 0);
+ signature.addBool(this._variantField_35 != null);
+ this._variantField_35?.collectApiSignature(signature);
+ if (this._variantField_36 == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._variantField_36.length);
+ for (var x in this._variantField_36) {
+ signature.addString(x);
+ }
+ }
}
fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_variantField_24;
fb.Offset offset_variantField_2;
fb.Offset offset_variantField_11;
fb.Offset offset_variantField_4;
fb.Offset offset_variantField_6;
fb.Offset offset_variantField_7;
+ fb.Offset offset_variantField_23;
fb.Offset offset_variantField_8;
- fb.Offset offset_variantField_24;
fb.Offset offset_variantField_9;
fb.Offset offset_variantField_12;
fb.Offset offset_variantField_5;
@@ -11162,10 +11889,14 @@
fb.Offset offset_variantField_25;
fb.Offset offset_variantField_30;
fb.Offset offset_variantField_14;
- fb.Offset offset_variantField_23;
+ fb.Offset offset_variantField_36;
fb.Offset offset_variantField_20;
+ fb.Offset offset_variantField_35;
fb.Offset offset_variantField_22;
fb.Offset offset_variantField_32;
+ if (_variantField_24 != null) {
+ offset_variantField_24 = _variantField_24.finish(fbBuilder);
+ }
if (!(_variantField_2 == null || _variantField_2.isEmpty)) {
offset_variantField_2 = fbBuilder
.writeList(_variantField_2.map((b) => b.finish(fbBuilder)).toList());
@@ -11183,12 +11914,12 @@
if (_variantField_7 != null) {
offset_variantField_7 = _variantField_7.finish(fbBuilder);
}
+ if (_variantField_23 != null) {
+ offset_variantField_23 = _variantField_23.finish(fbBuilder);
+ }
if (_variantField_8 != null) {
offset_variantField_8 = _variantField_8.finish(fbBuilder);
}
- if (_variantField_24 != null) {
- offset_variantField_24 = _variantField_24.finish(fbBuilder);
- }
if (_variantField_9 != null) {
offset_variantField_9 = _variantField_9.finish(fbBuilder);
}
@@ -11221,12 +11952,16 @@
if (_variantField_14 != null) {
offset_variantField_14 = _variantField_14.finish(fbBuilder);
}
- if (_variantField_23 != null) {
- offset_variantField_23 = fbBuilder.writeString(_variantField_23);
+ if (!(_variantField_36 == null || _variantField_36.isEmpty)) {
+ offset_variantField_36 = fbBuilder.writeList(
+ _variantField_36.map((b) => fbBuilder.writeString(b)).toList());
}
if (_variantField_20 != null) {
offset_variantField_20 = fbBuilder.writeString(_variantField_20);
}
+ if (_variantField_35 != null) {
+ offset_variantField_35 = _variantField_35.finish(fbBuilder);
+ }
if (_variantField_22 != null) {
offset_variantField_22 = fbBuilder.writeString(_variantField_22);
}
@@ -11234,6 +11969,9 @@
offset_variantField_32 = _variantField_32.finish(fbBuilder);
}
fbBuilder.startTable();
+ if (offset_variantField_24 != null) {
+ fbBuilder.addOffset(24, offset_variantField_24);
+ }
if (offset_variantField_2 != null) {
fbBuilder.addOffset(2, offset_variantField_2);
}
@@ -11252,24 +11990,24 @@
if (offset_variantField_7 != null) {
fbBuilder.addOffset(7, offset_variantField_7);
}
+ if (_variantField_17 != null && _variantField_17 != 0) {
+ fbBuilder.addUint32(17, _variantField_17);
+ }
+ if (offset_variantField_23 != null) {
+ fbBuilder.addOffset(23, offset_variantField_23);
+ }
if (offset_variantField_8 != null) {
fbBuilder.addOffset(8, offset_variantField_8);
}
if (_variantField_16 != null && _variantField_16 != 0) {
fbBuilder.addUint32(16, _variantField_16);
}
- if (_variantField_17 != null && _variantField_17 != 0) {
- fbBuilder.addUint32(17, _variantField_17);
- }
if (_variantField_18 != null && _variantField_18 != 0) {
fbBuilder.addUint32(18, _variantField_18);
}
if (_variantField_19 != null && _variantField_19 != 0) {
fbBuilder.addUint32(19, _variantField_19);
}
- if (offset_variantField_24 != null) {
- fbBuilder.addOffset(24, offset_variantField_24);
- }
if (_variantField_27 == true) {
fbBuilder.addBool(27, true);
}
@@ -11285,6 +12023,12 @@
if (offset_variantField_13 != null) {
fbBuilder.addOffset(13, offset_variantField_13);
}
+ if (_variantField_34 != null && _variantField_34 != 0) {
+ fbBuilder.addUint32(34, _variantField_34);
+ }
+ if (_variantField_33 != null && _variantField_33 != 0) {
+ fbBuilder.addUint32(33, _variantField_33);
+ }
if (offset_variantField_28 != null) {
fbBuilder.addOffset(28, offset_variantField_28);
}
@@ -11298,16 +12042,17 @@
if (offset_variantField_10 != null) {
fbBuilder.addOffset(10, offset_variantField_10);
}
+ if (_variantField_26 != null &&
+ _variantField_26 !=
+ idl.LinkedNodeFormalParameterKind.requiredPositional) {
+ fbBuilder.addUint8(26, _variantField_26.index);
+ }
if (_variantField_21 != null && _variantField_21 != 0.0) {
fbBuilder.addFloat64(21, _variantField_21);
}
if (offset_variantField_25 != null) {
fbBuilder.addOffset(25, offset_variantField_25);
}
- if (_variantField_26 != null &&
- _variantField_26 != idl.LinkedNodeFormalParameterKind.required) {
- fbBuilder.addUint8(26, _variantField_26.index);
- }
if (offset_variantField_30 != null) {
fbBuilder.addOffset(30, offset_variantField_30);
}
@@ -11320,14 +12065,17 @@
if (_kind != null && _kind != idl.LinkedNodeKind.adjacentStrings) {
fbBuilder.addUint8(0, _kind.index);
}
- if (offset_variantField_23 != null) {
- fbBuilder.addOffset(23, offset_variantField_23);
+ if (offset_variantField_36 != null) {
+ fbBuilder.addOffset(36, offset_variantField_36);
+ }
+ if (offset_variantField_20 != null) {
+ fbBuilder.addOffset(20, offset_variantField_20);
}
if (_variantField_31 == true) {
fbBuilder.addBool(31, true);
}
- if (offset_variantField_20 != null) {
- fbBuilder.addOffset(20, offset_variantField_20);
+ if (offset_variantField_35 != null) {
+ fbBuilder.addOffset(35, offset_variantField_35);
}
if (offset_variantField_22 != null) {
fbBuilder.addOffset(22, offset_variantField_22);
@@ -11355,41 +12103,85 @@
_LinkedNodeImpl(this._bc, this._bcOffset);
+ idl.LinkedNodeType _variantField_24;
List<idl.LinkedNode> _variantField_2;
idl.LinkedNode _variantField_11;
List<idl.LinkedNode> _variantField_4;
idl.LinkedNode _variantField_6;
int _variantField_15;
idl.LinkedNode _variantField_7;
+ int _variantField_17;
+ idl.LinkedNodeType _variantField_23;
idl.LinkedNode _variantField_8;
int _variantField_16;
- int _variantField_17;
int _variantField_18;
int _variantField_19;
- idl.LinkedNodeType _variantField_24;
bool _variantField_27;
idl.LinkedNode _variantField_9;
idl.LinkedNode _variantField_12;
List<idl.LinkedNode> _variantField_5;
idl.LinkedNode _variantField_13;
+ int _variantField_34;
+ int _variantField_33;
List<int> _variantField_28;
idl.LinkedNodeCommentType _variantField_29;
List<idl.LinkedNode> _variantField_3;
idl.LinkedNode _variantField_10;
+ idl.LinkedNodeFormalParameterKind _variantField_26;
double _variantField_21;
idl.LinkedNodeType _variantField_25;
- idl.LinkedNodeFormalParameterKind _variantField_26;
String _variantField_30;
idl.LinkedNode _variantField_14;
bool _isSynthetic;
idl.LinkedNodeKind _kind;
- String _variantField_23;
- bool _variantField_31;
+ List<String> _variantField_36;
String _variantField_20;
+ bool _variantField_31;
+ idl.TopLevelInferenceError _variantField_35;
String _variantField_22;
idl.LinkedNodeVariablesDeclaration _variantField_32;
@override
+ idl.LinkedNodeType get actualReturnType {
+ assert(kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionExpression ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericFunctionType ||
+ kind == idl.LinkedNodeKind.methodDeclaration);
+ _variantField_24 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
+ return _variantField_24;
+ }
+
+ @override
+ idl.LinkedNodeType get actualType {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_24 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
+ return _variantField_24;
+ }
+
+ @override
+ idl.LinkedNodeType get binaryExpression_invokeType {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ _variantField_24 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
+ return _variantField_24;
+ }
+
+ @override
+ idl.LinkedNodeType get invocationExpression_invokeType {
+ assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
+ kind == idl.LinkedNodeKind.methodInvocation);
+ _variantField_24 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
+ return _variantField_24;
+ }
+
+ @override
List<idl.LinkedNode> get adjacentStrings_strings {
assert(kind == idl.LinkedNodeKind.adjacentStrings);
_variantField_2 ??=
@@ -11426,6 +12218,15 @@
}
@override
+ List<idl.LinkedNode> get comment_references {
+ assert(kind == idl.LinkedNodeKind.comment);
+ _variantField_2 ??=
+ const fb.ListReader<idl.LinkedNode>(const _LinkedNodeReader())
+ .vTableGet(_bc, _bcOffset, 2, const <idl.LinkedNode>[]);
+ return _variantField_2;
+ }
+
+ @override
List<idl.LinkedNode> get compilationUnit_declarations {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_2 ??=
@@ -11798,6 +12599,14 @@
}
@override
+ idl.LinkedNode get commentReference_identifier {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ _variantField_6 ??=
+ const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 6, null);
+ return _variantField_6;
+ }
+
+ @override
idl.LinkedNode get compilationUnit_scriptTag {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_6 ??=
@@ -12130,6 +12939,22 @@
}
@override
+ idl.LinkedNode get nativeClause_name {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ _variantField_6 ??=
+ const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 6, null);
+ return _variantField_6;
+ }
+
+ @override
+ idl.LinkedNode get nativeFunctionBody_stringLiteral {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ _variantField_6 ??=
+ const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 6, null);
+ return _variantField_6;
+ }
+
+ @override
idl.LinkedNode get parenthesizedExpression_expression {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
_variantField_6 ??=
@@ -12426,6 +13251,14 @@
}
@override
+ int get commentReference_newKeyword {
+ assert(kind == idl.LinkedNodeKind.commentReference);
+ _variantField_15 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 15, 0);
+ return _variantField_15;
+ }
+
+ @override
int get compilationUnit_beginToken {
assert(kind == idl.LinkedNodeKind.compilationUnit);
_variantField_15 ??=
@@ -12750,6 +13583,22 @@
}
@override
+ int get nativeClause_nativeKeyword {
+ assert(kind == idl.LinkedNodeKind.nativeClause);
+ _variantField_15 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 15, 0);
+ return _variantField_15;
+ }
+
+ @override
+ int get nativeFunctionBody_nativeKeyword {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ _variantField_15 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 15, 0);
+ return _variantField_15;
+ }
+
+ @override
int get nullLiteral_literal {
assert(kind == idl.LinkedNodeKind.nullLiteral);
_variantField_15 ??=
@@ -12774,14 +13623,6 @@
}
@override
- int get partOfDirective_semicolon {
- assert(kind == idl.LinkedNodeKind.partOfDirective);
- _variantField_15 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 15, 0);
- return _variantField_15;
- }
-
- @override
int get postfixExpression_element {
assert(kind == idl.LinkedNodeKind.postfixExpression);
_variantField_15 ??=
@@ -13431,6 +14272,288 @@
}
@override
+ int get annotation_element {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get assertInitializer_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.assertInitializer);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get assertStatement_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.assertStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get catchClause_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.catchClause);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get configuration_rightParenthesis {
+ assert(kind == idl.LinkedNodeKind.configuration);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get constructorDeclaration_factoryKeyword {
+ assert(kind == idl.LinkedNodeKind.constructorDeclaration);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get constructorFieldInitializer_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get doStatement_doKeyword {
+ assert(kind == idl.LinkedNodeKind.doStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get enumDeclaration_rightBracket {
+ assert(kind == idl.LinkedNodeKind.enumDeclaration);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get expressionFunctionBody_semicolon {
+ assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get fieldDeclaration_staticKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldDeclaration);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get fieldFormalParameter_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get formalParameterList_rightDelimiter {
+ assert(kind == idl.LinkedNodeKind.formalParameterList);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get forMixin_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.forElement ||
+ kind == idl.LinkedNodeKind.forStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get genericFunctionType_id {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get ifMixin_leftParenthesis {
+ assert(kind == idl.LinkedNodeKind.ifElement ||
+ kind == idl.LinkedNodeKind.ifStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get indexExpression_leftBracket {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get methodDeclaration_operatorKeyword {
+ assert(kind == idl.LinkedNodeKind.methodDeclaration);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get redirectingConstructorInvocation_thisKeyword {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get superConstructorInvocation_superKeyword {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get switchStatement_switchKeyword {
+ assert(kind == idl.LinkedNodeKind.switchStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get whileStatement_whileKeyword {
+ assert(kind == idl.LinkedNodeKind.whileStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ int get yieldStatement_semicolon {
+ assert(kind == idl.LinkedNodeKind.yieldStatement);
+ _variantField_17 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
+ return _variantField_17;
+ }
+
+ @override
+ idl.LinkedNodeType get annotation_elementType {
+ assert(kind == idl.LinkedNodeKind.annotation);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get assignmentExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.assignmentExpression);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get binaryExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.binaryExpression);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get constructorName_elementType {
+ assert(kind == idl.LinkedNodeKind.constructorName);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get indexExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get postfixExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.postfixExpression);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get prefixExpression_elementType {
+ assert(kind == idl.LinkedNodeKind.prefixExpression);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get redirectingConstructorInvocation_elementType {
+ assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get simpleIdentifier_elementType {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get superConstructorInvocation_elementType {
+ assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get typeName_type {
+ assert(kind == idl.LinkedNodeKind.typeName);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
+ idl.LinkedNodeType get typeParameter_defaultType {
+ assert(kind == idl.LinkedNodeKind.typeParameter);
+ _variantField_23 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 23, null);
+ return _variantField_23;
+ }
+
+ @override
idl.LinkedNode get annotation_name {
assert(kind == idl.LinkedNodeKind.annotation);
_variantField_8 ??=
@@ -13447,6 +14570,14 @@
}
@override
+ idl.LinkedNode get classDeclaration_nativeClause {
+ assert(kind == idl.LinkedNodeKind.classDeclaration);
+ _variantField_8 ??=
+ const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 8, null);
+ return _variantField_8;
+ }
+
+ @override
idl.LinkedNode get classTypeAlias_withClause {
assert(kind == idl.LinkedNodeKind.classTypeAlias);
_variantField_8 ??=
@@ -13810,7 +14941,7 @@
}
@override
- int get indexExpression_leftBracket {
+ int get indexExpression_period {
assert(kind == idl.LinkedNodeKind.indexExpression);
_variantField_16 ??=
const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 16, 0);
@@ -13858,6 +14989,14 @@
}
@override
+ int get nativeFunctionBody_semicolon {
+ assert(kind == idl.LinkedNodeKind.nativeFunctionBody);
+ _variantField_16 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 16, 0);
+ return _variantField_16;
+ }
+
+ @override
int get parenthesizedExpression_rightParenthesis {
assert(kind == idl.LinkedNodeKind.parenthesizedExpression);
_variantField_16 ??=
@@ -13971,6 +15110,14 @@
}
@override
+ int get variableDeclarationList_lateKeyword {
+ assert(kind == idl.LinkedNodeKind.variableDeclarationList);
+ _variantField_16 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 16, 0);
+ return _variantField_16;
+ }
+
+ @override
int get whileStatement_rightParenthesis {
assert(kind == idl.LinkedNodeKind.whileStatement);
_variantField_16 ??=
@@ -13987,188 +15134,6 @@
}
@override
- int get assertInitializer_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.assertInitializer);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get assertStatement_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.assertStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get catchClause_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.catchClause);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get configuration_rightParenthesis {
- assert(kind == idl.LinkedNodeKind.configuration);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get constructorDeclaration_factoryKeyword {
- assert(kind == idl.LinkedNodeKind.constructorDeclaration);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get constructorFieldInitializer_thisKeyword {
- assert(kind == idl.LinkedNodeKind.constructorFieldInitializer);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get directive_keyword {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get doStatement_doKeyword {
- assert(kind == idl.LinkedNodeKind.doStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get enumDeclaration_rightBracket {
- assert(kind == idl.LinkedNodeKind.enumDeclaration);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get expressionFunctionBody_semicolon {
- assert(kind == idl.LinkedNodeKind.expressionFunctionBody);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get fieldDeclaration_staticKeyword {
- assert(kind == idl.LinkedNodeKind.fieldDeclaration);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get fieldFormalParameter_thisKeyword {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get formalParameterList_rightDelimiter {
- assert(kind == idl.LinkedNodeKind.formalParameterList);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get forMixin_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.forElement ||
- kind == idl.LinkedNodeKind.forStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get ifMixin_leftParenthesis {
- assert(kind == idl.LinkedNodeKind.ifElement ||
- kind == idl.LinkedNodeKind.ifStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get indexExpression_rightBracket {
- assert(kind == idl.LinkedNodeKind.indexExpression);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get methodDeclaration_operatorKeyword {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get redirectingConstructorInvocation_thisKeyword {
- assert(kind == idl.LinkedNodeKind.redirectingConstructorInvocation);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get superConstructorInvocation_superKeyword {
- assert(kind == idl.LinkedNodeKind.superConstructorInvocation);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get switchStatement_switchKeyword {
- assert(kind == idl.LinkedNodeKind.switchStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get whileStatement_whileKeyword {
- assert(kind == idl.LinkedNodeKind.whileStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
- int get yieldStatement_semicolon {
- assert(kind == idl.LinkedNodeKind.yieldStatement);
- _variantField_17 ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 17, 0);
- return _variantField_17;
- }
-
- @override
int get assertInitializer_rightParenthesis {
assert(kind == idl.LinkedNodeKind.assertInitializer);
_variantField_18 ??=
@@ -14218,6 +15183,18 @@
}
@override
+ int get directive_keyword {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ _variantField_18 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 18, 0);
+ return _variantField_18;
+ }
+
+ @override
int get doStatement_semicolon {
assert(kind == idl.LinkedNodeKind.doStatement);
_variantField_18 ??=
@@ -14243,6 +15220,14 @@
}
@override
+ int get indexExpression_rightBracket {
+ assert(kind == idl.LinkedNodeKind.indexExpression);
+ _variantField_18 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 18, 0);
+ return _variantField_18;
+ }
+
+ @override
int get methodDeclaration_propertyKeyword {
assert(kind == idl.LinkedNodeKind.methodDeclaration);
_variantField_18 ??=
@@ -14251,11 +15236,10 @@
}
@override
- int get namespaceDirective_semicolon {
- assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.libraryDirective ||
- kind == idl.LinkedNodeKind.partDirective);
+ int get normalFormalParameter_requiredKeyword {
+ assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter);
_variantField_18 ??=
const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 18, 0);
return _variantField_18;
@@ -14394,87 +15378,6 @@
}
@override
- idl.LinkedNodeType get binaryExpression_invokeType {
- assert(kind == idl.LinkedNodeKind.binaryExpression);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get fieldFormalParameter_type2 {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get functionDeclaration_returnType2 {
- assert(kind == idl.LinkedNodeKind.functionDeclaration);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get functionTypeAlias_returnType2 {
- assert(kind == idl.LinkedNodeKind.functionTypeAlias);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get genericFunctionType_returnType2 {
- assert(kind == idl.LinkedNodeKind.genericFunctionType);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get invocationExpression_invokeType {
- assert(kind == idl.LinkedNodeKind.functionExpressionInvocation ||
- kind == idl.LinkedNodeKind.methodInvocation);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get methodDeclaration_returnType2 {
- assert(kind == idl.LinkedNodeKind.methodDeclaration);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get simpleFormalParameter_type2 {
- assert(kind == idl.LinkedNodeKind.simpleFormalParameter);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get typeName_type {
- assert(kind == idl.LinkedNodeKind.typeName);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
- idl.LinkedNodeType get variableDeclaration_type2 {
- assert(kind == idl.LinkedNodeKind.variableDeclaration);
- _variantField_24 ??=
- const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 24, null);
- return _variantField_24;
- }
-
- @override
bool get booleanLiteral_value {
assert(kind == idl.LinkedNodeKind.booleanLiteral);
_variantField_27 ??=
@@ -14491,18 +15394,11 @@
}
@override
- bool get defaultFormalParameter_isNamed {
- assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
- _variantField_27 ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 27, false);
- return _variantField_27;
- }
-
- @override
- bool get normalFormalParameter_isCovariant {
+ bool get inheritsCovariant {
assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
_variantField_27 ??=
const fb.BoolReader().vTableGet(_bc, _bcOffset, 27, false);
return _variantField_27;
@@ -14517,6 +15413,23 @@
}
@override
+ bool get simpleIdentifier_isDeclaration {
+ assert(kind == idl.LinkedNodeKind.simpleIdentifier);
+ _variantField_27 ??=
+ const fb.BoolReader().vTableGet(_bc, _bcOffset, 27, false);
+ return _variantField_27;
+ }
+
+ @override
+ bool get typeAlias_hasSelfReference {
+ assert(kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias);
+ _variantField_27 ??=
+ const fb.BoolReader().vTableGet(_bc, _bcOffset, 27, false);
+ return _variantField_27;
+ }
+
+ @override
idl.LinkedNode get catchClause_stackTraceParameter {
assert(kind == idl.LinkedNodeKind.catchClause);
_variantField_9 ??=
@@ -14614,6 +15527,64 @@
}
@override
+ int get codeLength {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_34 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 34, 0);
+ return _variantField_34;
+ }
+
+ @override
+ int get codeOffset {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.compilationUnit ||
+ kind == idl.LinkedNodeKind.constructorDeclaration ||
+ kind == idl.LinkedNodeKind.defaultFormalParameter ||
+ kind == idl.LinkedNodeKind.enumDeclaration ||
+ kind == idl.LinkedNodeKind.fieldFormalParameter ||
+ kind == idl.LinkedNodeKind.functionDeclaration ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.methodDeclaration ||
+ kind == idl.LinkedNodeKind.mixinDeclaration ||
+ kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.typeParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_33 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 33, 0);
+ return _variantField_33;
+ }
+
+ @override
+ int get directive_semicolon {
+ assert(kind == idl.LinkedNodeKind.exportDirective ||
+ kind == idl.LinkedNodeKind.importDirective ||
+ kind == idl.LinkedNodeKind.libraryDirective ||
+ kind == idl.LinkedNodeKind.partDirective ||
+ kind == idl.LinkedNodeKind.partOfDirective);
+ _variantField_33 ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 33, 0);
+ return _variantField_33;
+ }
+
+ @override
List<int> get comment_tokens {
assert(kind == idl.LinkedNodeKind.comment);
_variantField_28 ??= const fb.Uint32ListReader()
@@ -14683,6 +15654,17 @@
}
@override
+ idl.LinkedNodeFormalParameterKind get defaultFormalParameter_kind {
+ assert(kind == idl.LinkedNodeKind.defaultFormalParameter);
+ _variantField_26 ??= const _LinkedNodeFormalParameterKindReader().vTableGet(
+ _bc,
+ _bcOffset,
+ 26,
+ idl.LinkedNodeFormalParameterKind.requiredPositional);
+ return _variantField_26;
+ }
+
+ @override
double get doubleLiteral_value {
assert(kind == idl.LinkedNodeKind.doubleLiteral);
_variantField_21 ??=
@@ -14730,13 +15712,11 @@
}
@override
- idl.LinkedNodeFormalParameterKind get formalParameter_kind {
- assert(kind == idl.LinkedNodeKind.fieldFormalParameter ||
- kind == idl.LinkedNodeKind.functionTypedFormalParameter ||
- kind == idl.LinkedNodeKind.simpleFormalParameter);
- _variantField_26 ??= const _LinkedNodeFormalParameterKindReader().vTableGet(
- _bc, _bcOffset, 26, idl.LinkedNodeFormalParameterKind.required);
- return _variantField_26;
+ idl.LinkedNodeType get genericFunctionType_type {
+ assert(kind == idl.LinkedNodeKind.genericFunctionType);
+ _variantField_25 ??=
+ const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 25, null);
+ return _variantField_25;
}
@override
@@ -14813,14 +15793,28 @@
}
@override
- String get namespaceDirective_selectedUriContent {
+ List<String> get mixinDeclaration_superInvokedNames {
+ assert(kind == idl.LinkedNodeKind.mixinDeclaration);
+ _variantField_36 ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 36, const <String>[]);
+ return _variantField_36;
+ }
+
+ @override
+ String get namespaceDirective_selectedUri {
assert(kind == idl.LinkedNodeKind.exportDirective ||
- kind == idl.LinkedNodeKind.importDirective ||
- kind == idl.LinkedNodeKind.partDirective ||
- kind == idl.LinkedNodeKind.partOfDirective);
- _variantField_23 ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 23, '');
- return _variantField_23;
+ kind == idl.LinkedNodeKind.importDirective);
+ _variantField_20 ??=
+ const fb.StringReader().vTableGet(_bc, _bcOffset, 20, '');
+ return _variantField_20;
+ }
+
+ @override
+ String get simpleStringLiteral_value {
+ assert(kind == idl.LinkedNodeKind.simpleStringLiteral);
+ _variantField_20 ??=
+ const fb.StringReader().vTableGet(_bc, _bcOffset, 20, '');
+ return _variantField_20;
}
@override
@@ -14832,11 +15826,24 @@
}
@override
- String get simpleStringLiteral_value {
- assert(kind == idl.LinkedNodeKind.simpleStringLiteral);
- _variantField_20 ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 20, '');
- return _variantField_20;
+ bool get simplyBoundable_isSimplyBounded {
+ assert(kind == idl.LinkedNodeKind.classDeclaration ||
+ kind == idl.LinkedNodeKind.classTypeAlias ||
+ kind == idl.LinkedNodeKind.functionTypeAlias ||
+ kind == idl.LinkedNodeKind.genericTypeAlias ||
+ kind == idl.LinkedNodeKind.mixinDeclaration);
+ _variantField_31 ??=
+ const fb.BoolReader().vTableGet(_bc, _bcOffset, 31, false);
+ return _variantField_31;
+ }
+
+ @override
+ idl.TopLevelInferenceError get topLevelTypeInferenceError {
+ assert(kind == idl.LinkedNodeKind.simpleFormalParameter ||
+ kind == idl.LinkedNodeKind.variableDeclaration);
+ _variantField_35 ??= const _TopLevelInferenceErrorReader()
+ .vTableGet(_bc, _bcOffset, 35, null);
+ return _variantField_35;
}
@override
@@ -14865,6 +15872,324 @@
if (isSynthetic != false) _result["isSynthetic"] = isSynthetic;
if (kind != idl.LinkedNodeKind.adjacentStrings)
_result["kind"] = kind.toString().split('.')[1];
+ if (kind == idl.LinkedNodeKind.functionDeclaration) {
+ if (actualReturnType != null)
+ _result["actualReturnType"] = actualReturnType.toJson();
+ if (annotatedNode_comment != null)
+ _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
+ if (annotatedNode_metadata.isNotEmpty)
+ _result["annotatedNode_metadata"] =
+ annotatedNode_metadata.map((_value) => _value.toJson()).toList();
+ if (functionDeclaration_functionExpression != null)
+ _result["functionDeclaration_functionExpression"] =
+ functionDeclaration_functionExpression.toJson();
+ if (functionDeclaration_externalKeyword != 0)
+ _result["functionDeclaration_externalKeyword"] =
+ functionDeclaration_externalKeyword;
+ if (functionDeclaration_returnType != null)
+ _result["functionDeclaration_returnType"] =
+ functionDeclaration_returnType.toJson();
+ if (functionDeclaration_propertyKeyword != 0)
+ _result["functionDeclaration_propertyKeyword"] =
+ functionDeclaration_propertyKeyword;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (namedCompilationUnitMember_name != null)
+ _result["namedCompilationUnitMember_name"] =
+ namedCompilationUnitMember_name.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.functionExpression) {
+ if (actualReturnType != null)
+ _result["actualReturnType"] = actualReturnType.toJson();
+ if (functionExpression_body != null)
+ _result["functionExpression_body"] = functionExpression_body.toJson();
+ if (functionExpression_formalParameters != null)
+ _result["functionExpression_formalParameters"] =
+ functionExpression_formalParameters.toJson();
+ if (functionExpression_typeParameters != null)
+ _result["functionExpression_typeParameters"] =
+ functionExpression_typeParameters.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.functionTypeAlias) {
+ if (actualReturnType != null)
+ _result["actualReturnType"] = actualReturnType.toJson();
+ if (annotatedNode_comment != null)
+ _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
+ if (annotatedNode_metadata.isNotEmpty)
+ _result["annotatedNode_metadata"] =
+ annotatedNode_metadata.map((_value) => _value.toJson()).toList();
+ if (functionTypeAlias_formalParameters != null)
+ _result["functionTypeAlias_formalParameters"] =
+ functionTypeAlias_formalParameters.toJson();
+ if (functionTypeAlias_returnType != null)
+ _result["functionTypeAlias_returnType"] =
+ functionTypeAlias_returnType.toJson();
+ if (functionTypeAlias_typeParameters != null)
+ _result["functionTypeAlias_typeParameters"] =
+ functionTypeAlias_typeParameters.toJson();
+ if (typeAlias_typedefKeyword != 0)
+ _result["typeAlias_typedefKeyword"] = typeAlias_typedefKeyword;
+ if (typeAlias_semicolon != 0)
+ _result["typeAlias_semicolon"] = typeAlias_semicolon;
+ if (typeAlias_hasSelfReference != false)
+ _result["typeAlias_hasSelfReference"] = typeAlias_hasSelfReference;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (namedCompilationUnitMember_name != null)
+ _result["namedCompilationUnitMember_name"] =
+ namedCompilationUnitMember_name.toJson();
+ if (simplyBoundable_isSimplyBounded != false)
+ _result["simplyBoundable_isSimplyBounded"] =
+ simplyBoundable_isSimplyBounded;
+ }
+ if (kind == idl.LinkedNodeKind.genericFunctionType) {
+ if (actualReturnType != null)
+ _result["actualReturnType"] = actualReturnType.toJson();
+ if (genericFunctionType_typeParameters != null)
+ _result["genericFunctionType_typeParameters"] =
+ genericFunctionType_typeParameters.toJson();
+ if (genericFunctionType_functionKeyword != 0)
+ _result["genericFunctionType_functionKeyword"] =
+ genericFunctionType_functionKeyword;
+ if (genericFunctionType_returnType != null)
+ _result["genericFunctionType_returnType"] =
+ genericFunctionType_returnType.toJson();
+ if (genericFunctionType_id != 0)
+ _result["genericFunctionType_id"] = genericFunctionType_id;
+ if (genericFunctionType_formalParameters != null)
+ _result["genericFunctionType_formalParameters"] =
+ genericFunctionType_formalParameters.toJson();
+ if (genericFunctionType_question != 0)
+ _result["genericFunctionType_question"] = genericFunctionType_question;
+ if (genericFunctionType_type != null)
+ _result["genericFunctionType_type"] = genericFunctionType_type.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.methodDeclaration) {
+ if (actualReturnType != null)
+ _result["actualReturnType"] = actualReturnType.toJson();
+ if (annotatedNode_comment != null)
+ _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
+ if (annotatedNode_metadata.isNotEmpty)
+ _result["annotatedNode_metadata"] =
+ annotatedNode_metadata.map((_value) => _value.toJson()).toList();
+ if (methodDeclaration_body != null)
+ _result["methodDeclaration_body"] = methodDeclaration_body.toJson();
+ if (methodDeclaration_externalKeyword != 0)
+ _result["methodDeclaration_externalKeyword"] =
+ methodDeclaration_externalKeyword;
+ if (methodDeclaration_formalParameters != null)
+ _result["methodDeclaration_formalParameters"] =
+ methodDeclaration_formalParameters.toJson();
+ if (methodDeclaration_operatorKeyword != 0)
+ _result["methodDeclaration_operatorKeyword"] =
+ methodDeclaration_operatorKeyword;
+ if (methodDeclaration_returnType != null)
+ _result["methodDeclaration_returnType"] =
+ methodDeclaration_returnType.toJson();
+ if (methodDeclaration_modifierKeyword != 0)
+ _result["methodDeclaration_modifierKeyword"] =
+ methodDeclaration_modifierKeyword;
+ if (methodDeclaration_propertyKeyword != 0)
+ _result["methodDeclaration_propertyKeyword"] =
+ methodDeclaration_propertyKeyword;
+ if (methodDeclaration_actualProperty != 0)
+ _result["methodDeclaration_actualProperty"] =
+ methodDeclaration_actualProperty;
+ if (methodDeclaration_typeParameters != null)
+ _result["methodDeclaration_typeParameters"] =
+ methodDeclaration_typeParameters.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (methodDeclaration_name != null)
+ _result["methodDeclaration_name"] = methodDeclaration_name.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.fieldFormalParameter) {
+ if (actualType != null) _result["actualType"] = actualType.toJson();
+ if (normalFormalParameter_metadata.isNotEmpty)
+ _result["normalFormalParameter_metadata"] =
+ normalFormalParameter_metadata
+ .map((_value) => _value.toJson())
+ .toList();
+ if (fieldFormalParameter_type != null)
+ _result["fieldFormalParameter_type"] =
+ fieldFormalParameter_type.toJson();
+ if (fieldFormalParameter_keyword != 0)
+ _result["fieldFormalParameter_keyword"] = fieldFormalParameter_keyword;
+ if (fieldFormalParameter_typeParameters != null)
+ _result["fieldFormalParameter_typeParameters"] =
+ fieldFormalParameter_typeParameters.toJson();
+ if (fieldFormalParameter_thisKeyword != 0)
+ _result["fieldFormalParameter_thisKeyword"] =
+ fieldFormalParameter_thisKeyword;
+ if (fieldFormalParameter_formalParameters != null)
+ _result["fieldFormalParameter_formalParameters"] =
+ fieldFormalParameter_formalParameters.toJson();
+ if (fieldFormalParameter_period != 0)
+ _result["fieldFormalParameter_period"] = fieldFormalParameter_period;
+ if (normalFormalParameter_requiredKeyword != 0)
+ _result["normalFormalParameter_requiredKeyword"] =
+ normalFormalParameter_requiredKeyword;
+ if (normalFormalParameter_covariantKeyword != 0)
+ _result["normalFormalParameter_covariantKeyword"] =
+ normalFormalParameter_covariantKeyword;
+ if (inheritsCovariant != false)
+ _result["inheritsCovariant"] = inheritsCovariant;
+ if (normalFormalParameter_identifier != null)
+ _result["normalFormalParameter_identifier"] =
+ normalFormalParameter_identifier.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (normalFormalParameter_comment != null)
+ _result["normalFormalParameter_comment"] =
+ normalFormalParameter_comment.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.functionTypedFormalParameter) {
+ if (actualType != null) _result["actualType"] = actualType.toJson();
+ if (normalFormalParameter_metadata.isNotEmpty)
+ _result["normalFormalParameter_metadata"] =
+ normalFormalParameter_metadata
+ .map((_value) => _value.toJson())
+ .toList();
+ if (functionTypedFormalParameter_formalParameters != null)
+ _result["functionTypedFormalParameter_formalParameters"] =
+ functionTypedFormalParameter_formalParameters.toJson();
+ if (functionTypedFormalParameter_returnType != null)
+ _result["functionTypedFormalParameter_returnType"] =
+ functionTypedFormalParameter_returnType.toJson();
+ if (functionTypedFormalParameter_typeParameters != null)
+ _result["functionTypedFormalParameter_typeParameters"] =
+ functionTypedFormalParameter_typeParameters.toJson();
+ if (normalFormalParameter_requiredKeyword != 0)
+ _result["normalFormalParameter_requiredKeyword"] =
+ normalFormalParameter_requiredKeyword;
+ if (normalFormalParameter_covariantKeyword != 0)
+ _result["normalFormalParameter_covariantKeyword"] =
+ normalFormalParameter_covariantKeyword;
+ if (inheritsCovariant != false)
+ _result["inheritsCovariant"] = inheritsCovariant;
+ if (normalFormalParameter_identifier != null)
+ _result["normalFormalParameter_identifier"] =
+ normalFormalParameter_identifier.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (normalFormalParameter_comment != null)
+ _result["normalFormalParameter_comment"] =
+ normalFormalParameter_comment.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.simpleFormalParameter) {
+ if (actualType != null) _result["actualType"] = actualType.toJson();
+ if (normalFormalParameter_metadata.isNotEmpty)
+ _result["normalFormalParameter_metadata"] =
+ normalFormalParameter_metadata
+ .map((_value) => _value.toJson())
+ .toList();
+ if (simpleFormalParameter_type != null)
+ _result["simpleFormalParameter_type"] =
+ simpleFormalParameter_type.toJson();
+ if (simpleFormalParameter_keyword != 0)
+ _result["simpleFormalParameter_keyword"] =
+ simpleFormalParameter_keyword;
+ if (normalFormalParameter_requiredKeyword != 0)
+ _result["normalFormalParameter_requiredKeyword"] =
+ normalFormalParameter_requiredKeyword;
+ if (normalFormalParameter_covariantKeyword != 0)
+ _result["normalFormalParameter_covariantKeyword"] =
+ normalFormalParameter_covariantKeyword;
+ if (inheritsCovariant != false)
+ _result["inheritsCovariant"] = inheritsCovariant;
+ if (normalFormalParameter_identifier != null)
+ _result["normalFormalParameter_identifier"] =
+ normalFormalParameter_identifier.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (normalFormalParameter_comment != null)
+ _result["normalFormalParameter_comment"] =
+ normalFormalParameter_comment.toJson();
+ if (topLevelTypeInferenceError != null)
+ _result["topLevelTypeInferenceError"] =
+ topLevelTypeInferenceError.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.variableDeclaration) {
+ if (actualType != null) _result["actualType"] = actualType.toJson();
+ if (annotatedNode_comment != null)
+ _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
+ if (annotatedNode_metadata.isNotEmpty)
+ _result["annotatedNode_metadata"] =
+ annotatedNode_metadata.map((_value) => _value.toJson()).toList();
+ if (variableDeclaration_initializer != null)
+ _result["variableDeclaration_initializer"] =
+ variableDeclaration_initializer.toJson();
+ if (variableDeclaration_equals != 0)
+ _result["variableDeclaration_equals"] = variableDeclaration_equals;
+ if (variableDeclaration_name != null)
+ _result["variableDeclaration_name"] = variableDeclaration_name.toJson();
+ if (inheritsCovariant != false)
+ _result["inheritsCovariant"] = inheritsCovariant;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (topLevelTypeInferenceError != null)
+ _result["topLevelTypeInferenceError"] =
+ topLevelTypeInferenceError.toJson();
+ if (variableDeclaration_declaration != null)
+ _result["variableDeclaration_declaration"] =
+ variableDeclaration_declaration.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.binaryExpression) {
+ if (binaryExpression_invokeType != null)
+ _result["binaryExpression_invokeType"] =
+ binaryExpression_invokeType.toJson();
+ if (binaryExpression_leftOperand != null)
+ _result["binaryExpression_leftOperand"] =
+ binaryExpression_leftOperand.toJson();
+ if (binaryExpression_element != 0)
+ _result["binaryExpression_element"] = binaryExpression_element;
+ if (binaryExpression_rightOperand != null)
+ _result["binaryExpression_rightOperand"] =
+ binaryExpression_rightOperand.toJson();
+ if (binaryExpression_elementType != null)
+ _result["binaryExpression_elementType"] =
+ binaryExpression_elementType.toJson();
+ if (binaryExpression_operator != 0)
+ _result["binaryExpression_operator"] = binaryExpression_operator;
+ if (expression_type != null)
+ _result["expression_type"] = expression_type.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.functionExpressionInvocation) {
+ if (invocationExpression_invokeType != null)
+ _result["invocationExpression_invokeType"] =
+ invocationExpression_invokeType.toJson();
+ if (functionExpressionInvocation_function != null)
+ _result["functionExpressionInvocation_function"] =
+ functionExpressionInvocation_function.toJson();
+ if (invocationExpression_typeArguments != null)
+ _result["invocationExpression_typeArguments"] =
+ invocationExpression_typeArguments.toJson();
+ if (expression_type != null)
+ _result["expression_type"] = expression_type.toJson();
+ if (invocationExpression_arguments != null)
+ _result["invocationExpression_arguments"] =
+ invocationExpression_arguments.toJson();
+ }
+ if (kind == idl.LinkedNodeKind.methodInvocation) {
+ if (invocationExpression_invokeType != null)
+ _result["invocationExpression_invokeType"] =
+ invocationExpression_invokeType.toJson();
+ if (methodInvocation_methodName != null)
+ _result["methodInvocation_methodName"] =
+ methodInvocation_methodName.toJson();
+ if (methodInvocation_operator != 0)
+ _result["methodInvocation_operator"] = methodInvocation_operator;
+ if (methodInvocation_target != null)
+ _result["methodInvocation_target"] = methodInvocation_target.toJson();
+ if (invocationExpression_typeArguments != null)
+ _result["invocationExpression_typeArguments"] =
+ invocationExpression_typeArguments.toJson();
+ if (expression_type != null)
+ _result["expression_type"] = expression_type.toJson();
+ if (invocationExpression_arguments != null)
+ _result["invocationExpression_arguments"] =
+ invocationExpression_arguments.toJson();
+ }
if (kind == idl.LinkedNodeKind.adjacentStrings) {
if (adjacentStrings_strings.isNotEmpty)
_result["adjacentStrings_strings"] =
@@ -14901,6 +16226,14 @@
if (expression_type != null)
_result["expression_type"] = expression_type.toJson();
}
+ if (kind == idl.LinkedNodeKind.comment) {
+ if (comment_references.isNotEmpty)
+ _result["comment_references"] =
+ comment_references.map((_value) => _value.toJson()).toList();
+ if (comment_tokens.isNotEmpty) _result["comment_tokens"] = comment_tokens;
+ if (comment_type != idl.LinkedNodeCommentType.block)
+ _result["comment_type"] = comment_type.toString().split('.')[1];
+ }
if (kind == idl.LinkedNodeKind.compilationUnit) {
if (compilationUnit_declarations.isNotEmpty)
_result["compilationUnit_declarations"] = compilationUnit_declarations
@@ -14913,6 +16246,8 @@
_result["compilationUnit_beginToken"] = compilationUnit_beginToken;
if (compilationUnit_endToken != 0)
_result["compilationUnit_endToken"] = compilationUnit_endToken;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (compilationUnit_directives.isNotEmpty)
_result["compilationUnit_directives"] = compilationUnit_directives
.map((_value) => _value.toJson())
@@ -14938,15 +16273,15 @@
if (constructorDeclaration_name != null)
_result["constructorDeclaration_name"] =
constructorDeclaration_name.toJson();
+ if (constructorDeclaration_factoryKeyword != 0)
+ _result["constructorDeclaration_factoryKeyword"] =
+ constructorDeclaration_factoryKeyword;
if (constructorDeclaration_parameters != null)
_result["constructorDeclaration_parameters"] =
constructorDeclaration_parameters.toJson();
if (constructorDeclaration_externalKeyword != 0)
_result["constructorDeclaration_externalKeyword"] =
constructorDeclaration_externalKeyword;
- if (constructorDeclaration_factoryKeyword != 0)
- _result["constructorDeclaration_factoryKeyword"] =
- constructorDeclaration_factoryKeyword;
if (constructorDeclaration_period != 0)
_result["constructorDeclaration_period"] =
constructorDeclaration_period;
@@ -14956,6 +16291,8 @@
if (constructorDeclaration_redirectedConstructor != null)
_result["constructorDeclaration_redirectedConstructor"] =
constructorDeclaration_redirectedConstructor.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (constructorDeclaration_returnType != null)
_result["constructorDeclaration_returnType"] =
constructorDeclaration_returnType.toJson();
@@ -14976,10 +16313,12 @@
annotatedNode_metadata.map((_value) => _value.toJson()).toList();
if (enumDeclaration_enumKeyword != 0)
_result["enumDeclaration_enumKeyword"] = enumDeclaration_enumKeyword;
- if (enumDeclaration_leftBracket != 0)
- _result["enumDeclaration_leftBracket"] = enumDeclaration_leftBracket;
if (enumDeclaration_rightBracket != 0)
_result["enumDeclaration_rightBracket"] = enumDeclaration_rightBracket;
+ if (enumDeclaration_leftBracket != 0)
+ _result["enumDeclaration_leftBracket"] = enumDeclaration_leftBracket;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (namedCompilationUnitMember_name != null)
_result["namedCompilationUnitMember_name"] =
namedCompilationUnitMember_name.toJson();
@@ -14993,12 +16332,12 @@
if (formalParameterList_leftDelimiter != 0)
_result["formalParameterList_leftDelimiter"] =
formalParameterList_leftDelimiter;
- if (formalParameterList_leftParenthesis != 0)
- _result["formalParameterList_leftParenthesis"] =
- formalParameterList_leftParenthesis;
if (formalParameterList_rightDelimiter != 0)
_result["formalParameterList_rightDelimiter"] =
formalParameterList_rightDelimiter;
+ if (formalParameterList_leftParenthesis != 0)
+ _result["formalParameterList_leftParenthesis"] =
+ formalParameterList_leftParenthesis;
if (formalParameterList_rightParenthesis != 0)
_result["formalParameterList_rightParenthesis"] =
formalParameterList_rightParenthesis;
@@ -15063,10 +16402,10 @@
annotatedNode_metadata.map((_value) => _value.toJson()).toList();
if (directive_keyword != 0)
_result["directive_keyword"] = directive_keyword;
- if (namespaceDirective_semicolon != 0)
- _result["namespaceDirective_semicolon"] = namespaceDirective_semicolon;
if (uriBasedDirective_uriElement != 0)
_result["uriBasedDirective_uriElement"] = uriBasedDirective_uriElement;
+ if (directive_semicolon != 0)
+ _result["directive_semicolon"] = directive_semicolon;
if (namespaceDirective_configurations.isNotEmpty)
_result["namespaceDirective_configurations"] =
namespaceDirective_configurations
@@ -15074,9 +16413,9 @@
.toList();
if (uriBasedDirective_uri != null)
_result["uriBasedDirective_uri"] = uriBasedDirective_uri.toJson();
- if (namespaceDirective_selectedUriContent != '')
- _result["namespaceDirective_selectedUriContent"] =
- namespaceDirective_selectedUriContent;
+ if (namespaceDirective_selectedUri != '')
+ _result["namespaceDirective_selectedUri"] =
+ namespaceDirective_selectedUri;
if (uriBasedDirective_uriContent != '')
_result["uriBasedDirective_uriContent"] = uriBasedDirective_uriContent;
}
@@ -15100,10 +16439,10 @@
importDirective_deferredKeyword;
if (directive_keyword != 0)
_result["directive_keyword"] = directive_keyword;
- if (namespaceDirective_semicolon != 0)
- _result["namespaceDirective_semicolon"] = namespaceDirective_semicolon;
if (uriBasedDirective_uriElement != 0)
_result["uriBasedDirective_uriElement"] = uriBasedDirective_uriElement;
+ if (directive_semicolon != 0)
+ _result["directive_semicolon"] = directive_semicolon;
if (namespaceDirective_configurations.isNotEmpty)
_result["namespaceDirective_configurations"] =
namespaceDirective_configurations
@@ -15111,9 +16450,9 @@
.toList();
if (uriBasedDirective_uri != null)
_result["uriBasedDirective_uri"] = uriBasedDirective_uri.toJson();
- if (namespaceDirective_selectedUriContent != '')
- _result["namespaceDirective_selectedUriContent"] =
- namespaceDirective_selectedUriContent;
+ if (namespaceDirective_selectedUri != '')
+ _result["namespaceDirective_selectedUri"] =
+ namespaceDirective_selectedUri;
if (uriBasedDirective_uriContent != '')
_result["uriBasedDirective_uriContent"] = uriBasedDirective_uriContent;
}
@@ -15171,12 +16510,12 @@
if (switchStatement_expression != null)
_result["switchStatement_expression"] =
switchStatement_expression.toJson();
- if (switchStatement_rightParenthesis != 0)
- _result["switchStatement_rightParenthesis"] =
- switchStatement_rightParenthesis;
if (switchStatement_switchKeyword != 0)
_result["switchStatement_switchKeyword"] =
switchStatement_switchKeyword;
+ if (switchStatement_rightParenthesis != 0)
+ _result["switchStatement_rightParenthesis"] =
+ switchStatement_rightParenthesis;
if (switchStatement_leftBracket != 0)
_result["switchStatement_leftBracket"] = switchStatement_leftBracket;
if (switchStatement_rightBracket != 0)
@@ -15237,6 +16576,9 @@
if (variableDeclarationList_keyword != 0)
_result["variableDeclarationList_keyword"] =
variableDeclarationList_keyword;
+ if (variableDeclarationList_lateKeyword != 0)
+ _result["variableDeclarationList_lateKeyword"] =
+ variableDeclarationList_lateKeyword;
}
if (kind == idl.LinkedNodeKind.withClause) {
if (withClause_mixinTypes.isNotEmpty)
@@ -15260,6 +16602,9 @@
if (classDeclaration_withClause != null)
_result["classDeclaration_withClause"] =
classDeclaration_withClause.toJson();
+ if (classDeclaration_nativeClause != null)
+ _result["classDeclaration_nativeClause"] =
+ classDeclaration_nativeClause.toJson();
if (classDeclaration_classKeyword != 0)
_result["classDeclaration_classKeyword"] =
classDeclaration_classKeyword;
@@ -15283,9 +16628,14 @@
if (classOrMixinDeclaration_typeParameters != null)
_result["classOrMixinDeclaration_typeParameters"] =
classOrMixinDeclaration_typeParameters.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (namedCompilationUnitMember_name != null)
_result["namedCompilationUnitMember_name"] =
namedCompilationUnitMember_name.toJson();
+ if (simplyBoundable_isSimplyBounded != false)
+ _result["simplyBoundable_isSimplyBounded"] =
+ simplyBoundable_isSimplyBounded;
}
if (kind == idl.LinkedNodeKind.classTypeAlias) {
if (annotatedNode_comment != null)
@@ -15314,9 +16664,14 @@
if (classTypeAlias_implementsClause != null)
_result["classTypeAlias_implementsClause"] =
classTypeAlias_implementsClause.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (namedCompilationUnitMember_name != null)
_result["namedCompilationUnitMember_name"] =
namedCompilationUnitMember_name.toJson();
+ if (simplyBoundable_isSimplyBounded != false)
+ _result["simplyBoundable_isSimplyBounded"] =
+ simplyBoundable_isSimplyBounded;
}
if (kind == idl.LinkedNodeKind.declaredIdentifier) {
if (annotatedNode_comment != null)
@@ -15353,62 +16708,11 @@
if (fieldDeclaration_covariantKeyword != 0)
_result["fieldDeclaration_covariantKeyword"] =
fieldDeclaration_covariantKeyword;
- if (fieldDeclaration_semicolon != 0)
- _result["fieldDeclaration_semicolon"] = fieldDeclaration_semicolon;
if (fieldDeclaration_staticKeyword != 0)
_result["fieldDeclaration_staticKeyword"] =
fieldDeclaration_staticKeyword;
- }
- if (kind == idl.LinkedNodeKind.functionDeclaration) {
- if (annotatedNode_comment != null)
- _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
- if (annotatedNode_metadata.isNotEmpty)
- _result["annotatedNode_metadata"] =
- annotatedNode_metadata.map((_value) => _value.toJson()).toList();
- if (functionDeclaration_functionExpression != null)
- _result["functionDeclaration_functionExpression"] =
- functionDeclaration_functionExpression.toJson();
- if (functionDeclaration_externalKeyword != 0)
- _result["functionDeclaration_externalKeyword"] =
- functionDeclaration_externalKeyword;
- if (functionDeclaration_returnType != null)
- _result["functionDeclaration_returnType"] =
- functionDeclaration_returnType.toJson();
- if (functionDeclaration_propertyKeyword != 0)
- _result["functionDeclaration_propertyKeyword"] =
- functionDeclaration_propertyKeyword;
- if (functionDeclaration_returnType2 != null)
- _result["functionDeclaration_returnType2"] =
- functionDeclaration_returnType2.toJson();
- if (namedCompilationUnitMember_name != null)
- _result["namedCompilationUnitMember_name"] =
- namedCompilationUnitMember_name.toJson();
- }
- if (kind == idl.LinkedNodeKind.functionTypeAlias) {
- if (annotatedNode_comment != null)
- _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
- if (annotatedNode_metadata.isNotEmpty)
- _result["annotatedNode_metadata"] =
- annotatedNode_metadata.map((_value) => _value.toJson()).toList();
- if (functionTypeAlias_formalParameters != null)
- _result["functionTypeAlias_formalParameters"] =
- functionTypeAlias_formalParameters.toJson();
- if (functionTypeAlias_returnType != null)
- _result["functionTypeAlias_returnType"] =
- functionTypeAlias_returnType.toJson();
- if (functionTypeAlias_typeParameters != null)
- _result["functionTypeAlias_typeParameters"] =
- functionTypeAlias_typeParameters.toJson();
- if (typeAlias_typedefKeyword != 0)
- _result["typeAlias_typedefKeyword"] = typeAlias_typedefKeyword;
- if (typeAlias_semicolon != 0)
- _result["typeAlias_semicolon"] = typeAlias_semicolon;
- if (functionTypeAlias_returnType2 != null)
- _result["functionTypeAlias_returnType2"] =
- functionTypeAlias_returnType2.toJson();
- if (namedCompilationUnitMember_name != null)
- _result["namedCompilationUnitMember_name"] =
- namedCompilationUnitMember_name.toJson();
+ if (fieldDeclaration_semicolon != 0)
+ _result["fieldDeclaration_semicolon"] = fieldDeclaration_semicolon;
}
if (kind == idl.LinkedNodeKind.genericTypeAlias) {
if (annotatedNode_comment != null)
@@ -15428,9 +16732,16 @@
_result["typeAlias_typedefKeyword"] = typeAlias_typedefKeyword;
if (typeAlias_semicolon != 0)
_result["typeAlias_semicolon"] = typeAlias_semicolon;
+ if (typeAlias_hasSelfReference != false)
+ _result["typeAlias_hasSelfReference"] = typeAlias_hasSelfReference;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (namedCompilationUnitMember_name != null)
_result["namedCompilationUnitMember_name"] =
namedCompilationUnitMember_name.toJson();
+ if (simplyBoundable_isSimplyBounded != false)
+ _result["simplyBoundable_isSimplyBounded"] =
+ simplyBoundable_isSimplyBounded;
}
if (kind == idl.LinkedNodeKind.libraryDirective) {
if (annotatedNode_comment != null)
@@ -15442,46 +16753,8 @@
_result["libraryDirective_name"] = libraryDirective_name.toJson();
if (directive_keyword != 0)
_result["directive_keyword"] = directive_keyword;
- if (namespaceDirective_semicolon != 0)
- _result["namespaceDirective_semicolon"] = namespaceDirective_semicolon;
- }
- if (kind == idl.LinkedNodeKind.methodDeclaration) {
- if (annotatedNode_comment != null)
- _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
- if (annotatedNode_metadata.isNotEmpty)
- _result["annotatedNode_metadata"] =
- annotatedNode_metadata.map((_value) => _value.toJson()).toList();
- if (methodDeclaration_body != null)
- _result["methodDeclaration_body"] = methodDeclaration_body.toJson();
- if (methodDeclaration_externalKeyword != 0)
- _result["methodDeclaration_externalKeyword"] =
- methodDeclaration_externalKeyword;
- if (methodDeclaration_formalParameters != null)
- _result["methodDeclaration_formalParameters"] =
- methodDeclaration_formalParameters.toJson();
- if (methodDeclaration_returnType != null)
- _result["methodDeclaration_returnType"] =
- methodDeclaration_returnType.toJson();
- if (methodDeclaration_modifierKeyword != 0)
- _result["methodDeclaration_modifierKeyword"] =
- methodDeclaration_modifierKeyword;
- if (methodDeclaration_operatorKeyword != 0)
- _result["methodDeclaration_operatorKeyword"] =
- methodDeclaration_operatorKeyword;
- if (methodDeclaration_propertyKeyword != 0)
- _result["methodDeclaration_propertyKeyword"] =
- methodDeclaration_propertyKeyword;
- if (methodDeclaration_actualProperty != 0)
- _result["methodDeclaration_actualProperty"] =
- methodDeclaration_actualProperty;
- if (methodDeclaration_returnType2 != null)
- _result["methodDeclaration_returnType2"] =
- methodDeclaration_returnType2.toJson();
- if (methodDeclaration_typeParameters != null)
- _result["methodDeclaration_typeParameters"] =
- methodDeclaration_typeParameters.toJson();
- if (methodDeclaration_name != null)
- _result["methodDeclaration_name"] = methodDeclaration_name.toJson();
+ if (directive_semicolon != 0)
+ _result["directive_semicolon"] = directive_semicolon;
}
if (kind == idl.LinkedNodeKind.mixinDeclaration) {
if (annotatedNode_comment != null)
@@ -15512,9 +16785,17 @@
if (classOrMixinDeclaration_typeParameters != null)
_result["classOrMixinDeclaration_typeParameters"] =
classOrMixinDeclaration_typeParameters.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
if (namedCompilationUnitMember_name != null)
_result["namedCompilationUnitMember_name"] =
namedCompilationUnitMember_name.toJson();
+ if (mixinDeclaration_superInvokedNames.isNotEmpty)
+ _result["mixinDeclaration_superInvokedNames"] =
+ mixinDeclaration_superInvokedNames;
+ if (simplyBoundable_isSimplyBounded != false)
+ _result["simplyBoundable_isSimplyBounded"] =
+ simplyBoundable_isSimplyBounded;
}
if (kind == idl.LinkedNodeKind.partDirective) {
if (annotatedNode_comment != null)
@@ -15524,15 +16805,12 @@
annotatedNode_metadata.map((_value) => _value.toJson()).toList();
if (directive_keyword != 0)
_result["directive_keyword"] = directive_keyword;
- if (namespaceDirective_semicolon != 0)
- _result["namespaceDirective_semicolon"] = namespaceDirective_semicolon;
if (uriBasedDirective_uriElement != 0)
_result["uriBasedDirective_uriElement"] = uriBasedDirective_uriElement;
+ if (directive_semicolon != 0)
+ _result["directive_semicolon"] = directive_semicolon;
if (uriBasedDirective_uri != null)
_result["uriBasedDirective_uri"] = uriBasedDirective_uri.toJson();
- if (namespaceDirective_selectedUriContent != '')
- _result["namespaceDirective_selectedUriContent"] =
- namespaceDirective_selectedUriContent;
if (uriBasedDirective_uriContent != '')
_result["uriBasedDirective_uriContent"] = uriBasedDirective_uriContent;
}
@@ -15545,17 +16823,14 @@
if (partOfDirective_libraryName != null)
_result["partOfDirective_libraryName"] =
partOfDirective_libraryName.toJson();
- if (partOfDirective_semicolon != 0)
- _result["partOfDirective_semicolon"] = partOfDirective_semicolon;
if (partOfDirective_uri != null)
_result["partOfDirective_uri"] = partOfDirective_uri.toJson();
if (partOfDirective_ofKeyword != 0)
_result["partOfDirective_ofKeyword"] = partOfDirective_ofKeyword;
if (directive_keyword != 0)
_result["directive_keyword"] = directive_keyword;
- if (namespaceDirective_selectedUriContent != '')
- _result["namespaceDirective_selectedUriContent"] =
- namespaceDirective_selectedUriContent;
+ if (directive_semicolon != 0)
+ _result["directive_semicolon"] = directive_semicolon;
}
if (kind == idl.LinkedNodeKind.topLevelVariableDeclaration) {
if (annotatedNode_comment != null)
@@ -15582,129 +16857,11 @@
_result["typeParameter_extendsKeyword"] = typeParameter_extendsKeyword;
if (typeParameter_name != null)
_result["typeParameter_name"] = typeParameter_name.toJson();
- }
- if (kind == idl.LinkedNodeKind.variableDeclaration) {
- if (annotatedNode_comment != null)
- _result["annotatedNode_comment"] = annotatedNode_comment.toJson();
- if (annotatedNode_metadata.isNotEmpty)
- _result["annotatedNode_metadata"] =
- annotatedNode_metadata.map((_value) => _value.toJson()).toList();
- if (variableDeclaration_initializer != null)
- _result["variableDeclaration_initializer"] =
- variableDeclaration_initializer.toJson();
- if (variableDeclaration_equals != 0)
- _result["variableDeclaration_equals"] = variableDeclaration_equals;
- if (variableDeclaration_name != null)
- _result["variableDeclaration_name"] = variableDeclaration_name.toJson();
- if (variableDeclaration_type2 != null)
- _result["variableDeclaration_type2"] =
- variableDeclaration_type2.toJson();
- if (variableDeclaration_declaration != null)
- _result["variableDeclaration_declaration"] =
- variableDeclaration_declaration.toJson();
- }
- if (kind == idl.LinkedNodeKind.fieldFormalParameter) {
- if (normalFormalParameter_metadata.isNotEmpty)
- _result["normalFormalParameter_metadata"] =
- normalFormalParameter_metadata
- .map((_value) => _value.toJson())
- .toList();
- if (fieldFormalParameter_type != null)
- _result["fieldFormalParameter_type"] =
- fieldFormalParameter_type.toJson();
- if (fieldFormalParameter_keyword != 0)
- _result["fieldFormalParameter_keyword"] = fieldFormalParameter_keyword;
- if (fieldFormalParameter_typeParameters != null)
- _result["fieldFormalParameter_typeParameters"] =
- fieldFormalParameter_typeParameters.toJson();
- if (fieldFormalParameter_formalParameters != null)
- _result["fieldFormalParameter_formalParameters"] =
- fieldFormalParameter_formalParameters.toJson();
- if (fieldFormalParameter_period != 0)
- _result["fieldFormalParameter_period"] = fieldFormalParameter_period;
- if (fieldFormalParameter_thisKeyword != 0)
- _result["fieldFormalParameter_thisKeyword"] =
- fieldFormalParameter_thisKeyword;
- if (normalFormalParameter_covariantKeyword != 0)
- _result["normalFormalParameter_covariantKeyword"] =
- normalFormalParameter_covariantKeyword;
- if (fieldFormalParameter_type2 != null)
- _result["fieldFormalParameter_type2"] =
- fieldFormalParameter_type2.toJson();
- if (normalFormalParameter_isCovariant != false)
- _result["normalFormalParameter_isCovariant"] =
- normalFormalParameter_isCovariant;
- if (normalFormalParameter_identifier != null)
- _result["normalFormalParameter_identifier"] =
- normalFormalParameter_identifier.toJson();
- if (formalParameter_kind != idl.LinkedNodeFormalParameterKind.required)
- _result["formalParameter_kind"] =
- formalParameter_kind.toString().split('.')[1];
- if (normalFormalParameter_comment != null)
- _result["normalFormalParameter_comment"] =
- normalFormalParameter_comment.toJson();
- }
- if (kind == idl.LinkedNodeKind.functionTypedFormalParameter) {
- if (normalFormalParameter_metadata.isNotEmpty)
- _result["normalFormalParameter_metadata"] =
- normalFormalParameter_metadata
- .map((_value) => _value.toJson())
- .toList();
- if (functionTypedFormalParameter_formalParameters != null)
- _result["functionTypedFormalParameter_formalParameters"] =
- functionTypedFormalParameter_formalParameters.toJson();
- if (functionTypedFormalParameter_returnType != null)
- _result["functionTypedFormalParameter_returnType"] =
- functionTypedFormalParameter_returnType.toJson();
- if (functionTypedFormalParameter_typeParameters != null)
- _result["functionTypedFormalParameter_typeParameters"] =
- functionTypedFormalParameter_typeParameters.toJson();
- if (normalFormalParameter_covariantKeyword != 0)
- _result["normalFormalParameter_covariantKeyword"] =
- normalFormalParameter_covariantKeyword;
- if (normalFormalParameter_isCovariant != false)
- _result["normalFormalParameter_isCovariant"] =
- normalFormalParameter_isCovariant;
- if (normalFormalParameter_identifier != null)
- _result["normalFormalParameter_identifier"] =
- normalFormalParameter_identifier.toJson();
- if (formalParameter_kind != idl.LinkedNodeFormalParameterKind.required)
- _result["formalParameter_kind"] =
- formalParameter_kind.toString().split('.')[1];
- if (normalFormalParameter_comment != null)
- _result["normalFormalParameter_comment"] =
- normalFormalParameter_comment.toJson();
- }
- if (kind == idl.LinkedNodeKind.simpleFormalParameter) {
- if (normalFormalParameter_metadata.isNotEmpty)
- _result["normalFormalParameter_metadata"] =
- normalFormalParameter_metadata
- .map((_value) => _value.toJson())
- .toList();
- if (simpleFormalParameter_type != null)
- _result["simpleFormalParameter_type"] =
- simpleFormalParameter_type.toJson();
- if (simpleFormalParameter_keyword != 0)
- _result["simpleFormalParameter_keyword"] =
- simpleFormalParameter_keyword;
- if (normalFormalParameter_covariantKeyword != 0)
- _result["normalFormalParameter_covariantKeyword"] =
- normalFormalParameter_covariantKeyword;
- if (simpleFormalParameter_type2 != null)
- _result["simpleFormalParameter_type2"] =
- simpleFormalParameter_type2.toJson();
- if (normalFormalParameter_isCovariant != false)
- _result["normalFormalParameter_isCovariant"] =
- normalFormalParameter_isCovariant;
- if (normalFormalParameter_identifier != null)
- _result["normalFormalParameter_identifier"] =
- normalFormalParameter_identifier.toJson();
- if (formalParameter_kind != idl.LinkedNodeFormalParameterKind.required)
- _result["formalParameter_kind"] =
- formalParameter_kind.toString().split('.')[1];
- if (normalFormalParameter_comment != null)
- _result["normalFormalParameter_comment"] =
- normalFormalParameter_comment.toJson();
+ if (typeParameter_defaultType != null)
+ _result["typeParameter_defaultType"] =
+ typeParameter_defaultType.toJson();
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
}
if (kind == idl.LinkedNodeKind.switchCase) {
if (switchMember_statements.isNotEmpty)
@@ -15740,6 +16897,10 @@
if (annotation_constructorName != null)
_result["annotation_constructorName"] =
annotation_constructorName.toJson();
+ if (annotation_element != 0)
+ _result["annotation_element"] = annotation_element;
+ if (annotation_elementType != null)
+ _result["annotation_elementType"] = annotation_elementType.toJson();
if (annotation_name != null)
_result["annotation_name"] = annotation_name.toJson();
if (annotation_period != 0)
@@ -15765,11 +16926,11 @@
if (assertInitializer_message != null)
_result["assertInitializer_message"] =
assertInitializer_message.toJson();
- if (assertInitializer_comma != 0)
- _result["assertInitializer_comma"] = assertInitializer_comma;
if (assertInitializer_leftParenthesis != 0)
_result["assertInitializer_leftParenthesis"] =
assertInitializer_leftParenthesis;
+ if (assertInitializer_comma != 0)
+ _result["assertInitializer_comma"] = assertInitializer_comma;
if (assertInitializer_rightParenthesis != 0)
_result["assertInitializer_rightParenthesis"] =
assertInitializer_rightParenthesis;
@@ -15783,11 +16944,11 @@
assertStatement_assertKeyword;
if (assertStatement_message != null)
_result["assertStatement_message"] = assertStatement_message.toJson();
- if (assertStatement_comma != 0)
- _result["assertStatement_comma"] = assertStatement_comma;
if (assertStatement_leftParenthesis != 0)
_result["assertStatement_leftParenthesis"] =
assertStatement_leftParenthesis;
+ if (assertStatement_comma != 0)
+ _result["assertStatement_comma"] = assertStatement_comma;
if (assertStatement_rightParenthesis != 0)
_result["assertStatement_rightParenthesis"] =
assertStatement_rightParenthesis;
@@ -15803,6 +16964,9 @@
if (assignmentExpression_rightHandSide != null)
_result["assignmentExpression_rightHandSide"] =
assignmentExpression_rightHandSide.toJson();
+ if (assignmentExpression_elementType != null)
+ _result["assignmentExpression_elementType"] =
+ assignmentExpression_elementType.toJson();
if (assignmentExpression_operator != 0)
_result["assignmentExpression_operator"] =
assignmentExpression_operator;
@@ -15818,23 +16982,6 @@
if (expression_type != null)
_result["expression_type"] = expression_type.toJson();
}
- if (kind == idl.LinkedNodeKind.binaryExpression) {
- if (binaryExpression_leftOperand != null)
- _result["binaryExpression_leftOperand"] =
- binaryExpression_leftOperand.toJson();
- if (binaryExpression_element != 0)
- _result["binaryExpression_element"] = binaryExpression_element;
- if (binaryExpression_rightOperand != null)
- _result["binaryExpression_rightOperand"] =
- binaryExpression_rightOperand.toJson();
- if (binaryExpression_operator != 0)
- _result["binaryExpression_operator"] = binaryExpression_operator;
- if (binaryExpression_invokeType != null)
- _result["binaryExpression_invokeType"] =
- binaryExpression_invokeType.toJson();
- if (expression_type != null)
- _result["expression_type"] = expression_type.toJson();
- }
if (kind == idl.LinkedNodeKind.blockFunctionBody) {
if (blockFunctionBody_block != null)
_result["blockFunctionBody_block"] = blockFunctionBody_block.toJson();
@@ -15859,13 +17006,13 @@
if (catchClause_exceptionParameter != null)
_result["catchClause_exceptionParameter"] =
catchClause_exceptionParameter.toJson();
+ if (catchClause_leftParenthesis != 0)
+ _result["catchClause_leftParenthesis"] = catchClause_leftParenthesis;
if (catchClause_exceptionType != null)
_result["catchClause_exceptionType"] =
catchClause_exceptionType.toJson();
if (catchClause_comma != 0)
_result["catchClause_comma"] = catchClause_comma;
- if (catchClause_leftParenthesis != 0)
- _result["catchClause_leftParenthesis"] = catchClause_leftParenthesis;
if (catchClause_onKeyword != 0)
_result["catchClause_onKeyword"] = catchClause_onKeyword;
if (catchClause_rightParenthesis != 0)
@@ -15874,6 +17021,13 @@
_result["catchClause_stackTraceParameter"] =
catchClause_stackTraceParameter.toJson();
}
+ if (kind == idl.LinkedNodeKind.commentReference) {
+ if (commentReference_identifier != null)
+ _result["commentReference_identifier"] =
+ commentReference_identifier.toJson();
+ if (commentReference_newKeyword != 0)
+ _result["commentReference_newKeyword"] = commentReference_newKeyword;
+ }
if (kind == idl.LinkedNodeKind.conditionalExpression) {
if (conditionalExpression_condition != null)
_result["conditionalExpression_condition"] =
@@ -15899,14 +17053,14 @@
_result["configuration_ifKeyword"] = configuration_ifKeyword;
if (configuration_value != null)
_result["configuration_value"] = configuration_value.toJson();
+ if (configuration_rightParenthesis != 0)
+ _result["configuration_rightParenthesis"] =
+ configuration_rightParenthesis;
if (configuration_uri != null)
_result["configuration_uri"] = configuration_uri.toJson();
if (configuration_leftParenthesis != 0)
_result["configuration_leftParenthesis"] =
configuration_leftParenthesis;
- if (configuration_rightParenthesis != 0)
- _result["configuration_rightParenthesis"] =
- configuration_rightParenthesis;
if (configuration_equalToken != 0)
_result["configuration_equalToken"] = configuration_equalToken;
}
@@ -15920,12 +17074,12 @@
if (constructorFieldInitializer_fieldName != null)
_result["constructorFieldInitializer_fieldName"] =
constructorFieldInitializer_fieldName.toJson();
- if (constructorFieldInitializer_period != 0)
- _result["constructorFieldInitializer_period"] =
- constructorFieldInitializer_period;
if (constructorFieldInitializer_thisKeyword != 0)
_result["constructorFieldInitializer_thisKeyword"] =
constructorFieldInitializer_thisKeyword;
+ if (constructorFieldInitializer_period != 0)
+ _result["constructorFieldInitializer_period"] =
+ constructorFieldInitializer_period;
}
if (kind == idl.LinkedNodeKind.constructorName) {
if (constructorName_name != null)
@@ -15934,6 +17088,9 @@
_result["constructorName_element"] = constructorName_element;
if (constructorName_type != null)
_result["constructorName_type"] = constructorName_type.toJson();
+ if (constructorName_elementType != null)
+ _result["constructorName_elementType"] =
+ constructorName_elementType.toJson();
if (constructorName_period != 0)
_result["constructorName_period"] = constructorName_period;
}
@@ -15956,9 +17113,12 @@
if (defaultFormalParameter_parameter != null)
_result["defaultFormalParameter_parameter"] =
defaultFormalParameter_parameter.toJson();
- if (defaultFormalParameter_isNamed != false)
- _result["defaultFormalParameter_isNamed"] =
- defaultFormalParameter_isNamed;
+ if (codeLength != 0) _result["codeLength"] = codeLength;
+ if (codeOffset != 0) _result["codeOffset"] = codeOffset;
+ if (defaultFormalParameter_kind !=
+ idl.LinkedNodeFormalParameterKind.requiredPositional)
+ _result["defaultFormalParameter_kind"] =
+ defaultFormalParameter_kind.toString().split('.')[1];
}
if (kind == idl.LinkedNodeKind.doStatement) {
if (doStatement_body != null)
@@ -15967,10 +17127,10 @@
_result["doStatement_leftParenthesis"] = doStatement_leftParenthesis;
if (doStatement_condition != null)
_result["doStatement_condition"] = doStatement_condition.toJson();
- if (doStatement_rightParenthesis != 0)
- _result["doStatement_rightParenthesis"] = doStatement_rightParenthesis;
if (doStatement_doKeyword != 0)
_result["doStatement_doKeyword"] = doStatement_doKeyword;
+ if (doStatement_rightParenthesis != 0)
+ _result["doStatement_rightParenthesis"] = doStatement_rightParenthesis;
if (doStatement_semicolon != 0)
_result["doStatement_semicolon"] = doStatement_semicolon;
if (doStatement_whileKeyword != 0)
@@ -15982,12 +17142,12 @@
expressionFunctionBody_expression.toJson();
if (expressionFunctionBody_arrow != 0)
_result["expressionFunctionBody_arrow"] = expressionFunctionBody_arrow;
- if (expressionFunctionBody_keyword != 0)
- _result["expressionFunctionBody_keyword"] =
- expressionFunctionBody_keyword;
if (expressionFunctionBody_semicolon != 0)
_result["expressionFunctionBody_semicolon"] =
expressionFunctionBody_semicolon;
+ if (expressionFunctionBody_keyword != 0)
+ _result["expressionFunctionBody_keyword"] =
+ expressionFunctionBody_keyword;
}
if (kind == idl.LinkedNodeKind.expressionStatement) {
if (expressionStatement_expression != null)
@@ -16028,10 +17188,10 @@
_result["forMixin_awaitKeyword"] = forMixin_awaitKeyword;
if (forElement_body != null)
_result["forElement_body"] = forElement_body.toJson();
- if (forMixin_forKeyword != 0)
- _result["forMixin_forKeyword"] = forMixin_forKeyword;
if (forMixin_leftParenthesis != 0)
_result["forMixin_leftParenthesis"] = forMixin_leftParenthesis;
+ if (forMixin_forKeyword != 0)
+ _result["forMixin_forKeyword"] = forMixin_forKeyword;
if (forMixin_rightParenthesis != 0)
_result["forMixin_rightParenthesis"] = forMixin_rightParenthesis;
}
@@ -16042,10 +17202,10 @@
_result["forMixin_awaitKeyword"] = forMixin_awaitKeyword;
if (forStatement_body != null)
_result["forStatement_body"] = forStatement_body.toJson();
- if (forMixin_forKeyword != 0)
- _result["forMixin_forKeyword"] = forMixin_forKeyword;
if (forMixin_leftParenthesis != 0)
_result["forMixin_leftParenthesis"] = forMixin_leftParenthesis;
+ if (forMixin_forKeyword != 0)
+ _result["forMixin_forKeyword"] = forMixin_forKeyword;
if (forMixin_rightParenthesis != 0)
_result["forMixin_rightParenthesis"] = forMixin_rightParenthesis;
}
@@ -16082,62 +17242,17 @@
_result["functionDeclarationStatement_functionDeclaration"] =
functionDeclarationStatement_functionDeclaration.toJson();
}
- if (kind == idl.LinkedNodeKind.functionExpression) {
- if (functionExpression_body != null)
- _result["functionExpression_body"] = functionExpression_body.toJson();
- if (functionExpression_formalParameters != null)
- _result["functionExpression_formalParameters"] =
- functionExpression_formalParameters.toJson();
- if (functionExpression_typeParameters != null)
- _result["functionExpression_typeParameters"] =
- functionExpression_typeParameters.toJson();
- }
- if (kind == idl.LinkedNodeKind.functionExpressionInvocation) {
- if (functionExpressionInvocation_function != null)
- _result["functionExpressionInvocation_function"] =
- functionExpressionInvocation_function.toJson();
- if (invocationExpression_invokeType != null)
- _result["invocationExpression_invokeType"] =
- invocationExpression_invokeType.toJson();
- if (invocationExpression_typeArguments != null)
- _result["invocationExpression_typeArguments"] =
- invocationExpression_typeArguments.toJson();
- if (expression_type != null)
- _result["expression_type"] = expression_type.toJson();
- if (invocationExpression_arguments != null)
- _result["invocationExpression_arguments"] =
- invocationExpression_arguments.toJson();
- }
- if (kind == idl.LinkedNodeKind.genericFunctionType) {
- if (genericFunctionType_typeParameters != null)
- _result["genericFunctionType_typeParameters"] =
- genericFunctionType_typeParameters.toJson();
- if (genericFunctionType_functionKeyword != 0)
- _result["genericFunctionType_functionKeyword"] =
- genericFunctionType_functionKeyword;
- if (genericFunctionType_returnType != null)
- _result["genericFunctionType_returnType"] =
- genericFunctionType_returnType.toJson();
- if (genericFunctionType_formalParameters != null)
- _result["genericFunctionType_formalParameters"] =
- genericFunctionType_formalParameters.toJson();
- if (genericFunctionType_question != 0)
- _result["genericFunctionType_question"] = genericFunctionType_question;
- if (genericFunctionType_returnType2 != null)
- _result["genericFunctionType_returnType2"] =
- genericFunctionType_returnType2.toJson();
- }
if (kind == idl.LinkedNodeKind.ifElement) {
if (ifMixin_condition != null)
_result["ifMixin_condition"] = ifMixin_condition.toJson();
if (ifMixin_elseKeyword != 0)
_result["ifMixin_elseKeyword"] = ifMixin_elseKeyword;
+ if (ifMixin_leftParenthesis != 0)
+ _result["ifMixin_leftParenthesis"] = ifMixin_leftParenthesis;
if (ifElement_thenElement != null)
_result["ifElement_thenElement"] = ifElement_thenElement.toJson();
if (ifMixin_ifKeyword != 0)
_result["ifMixin_ifKeyword"] = ifMixin_ifKeyword;
- if (ifMixin_leftParenthesis != 0)
- _result["ifMixin_leftParenthesis"] = ifMixin_leftParenthesis;
if (ifMixin_rightParenthesis != 0)
_result["ifMixin_rightParenthesis"] = ifMixin_rightParenthesis;
if (ifElement_elseElement != null)
@@ -16151,13 +17266,13 @@
if (ifStatement_elseStatement != null)
_result["ifStatement_elseStatement"] =
ifStatement_elseStatement.toJson();
+ if (ifMixin_leftParenthesis != 0)
+ _result["ifMixin_leftParenthesis"] = ifMixin_leftParenthesis;
if (ifStatement_thenStatement != null)
_result["ifStatement_thenStatement"] =
ifStatement_thenStatement.toJson();
if (ifMixin_ifKeyword != 0)
_result["ifMixin_ifKeyword"] = ifMixin_ifKeyword;
- if (ifMixin_leftParenthesis != 0)
- _result["ifMixin_leftParenthesis"] = ifMixin_leftParenthesis;
if (ifMixin_rightParenthesis != 0)
_result["ifMixin_rightParenthesis"] = ifMixin_rightParenthesis;
}
@@ -16170,6 +17285,11 @@
_result["indexExpression_target"] = indexExpression_target.toJson();
if (indexExpression_leftBracket != 0)
_result["indexExpression_leftBracket"] = indexExpression_leftBracket;
+ if (indexExpression_elementType != null)
+ _result["indexExpression_elementType"] =
+ indexExpression_elementType.toJson();
+ if (indexExpression_period != 0)
+ _result["indexExpression_period"] = indexExpression_period;
if (indexExpression_rightBracket != 0)
_result["indexExpression_rightBracket"] = indexExpression_rightBracket;
if (expression_type != null)
@@ -16226,26 +17346,6 @@
if (mapLiteralEntry_value != null)
_result["mapLiteralEntry_value"] = mapLiteralEntry_value.toJson();
}
- if (kind == idl.LinkedNodeKind.methodInvocation) {
- if (methodInvocation_methodName != null)
- _result["methodInvocation_methodName"] =
- methodInvocation_methodName.toJson();
- if (methodInvocation_operator != 0)
- _result["methodInvocation_operator"] = methodInvocation_operator;
- if (methodInvocation_target != null)
- _result["methodInvocation_target"] = methodInvocation_target.toJson();
- if (invocationExpression_invokeType != null)
- _result["invocationExpression_invokeType"] =
- invocationExpression_invokeType.toJson();
- if (invocationExpression_typeArguments != null)
- _result["invocationExpression_typeArguments"] =
- invocationExpression_typeArguments.toJson();
- if (expression_type != null)
- _result["expression_type"] = expression_type.toJson();
- if (invocationExpression_arguments != null)
- _result["invocationExpression_arguments"] =
- invocationExpression_arguments.toJson();
- }
if (kind == idl.LinkedNodeKind.namedExpression) {
if (namedExpression_expression != null)
_result["namedExpression_expression"] =
@@ -16255,6 +17355,22 @@
if (expression_type != null)
_result["expression_type"] = expression_type.toJson();
}
+ if (kind == idl.LinkedNodeKind.nativeClause) {
+ if (nativeClause_name != null)
+ _result["nativeClause_name"] = nativeClause_name.toJson();
+ if (nativeClause_nativeKeyword != 0)
+ _result["nativeClause_nativeKeyword"] = nativeClause_nativeKeyword;
+ }
+ if (kind == idl.LinkedNodeKind.nativeFunctionBody) {
+ if (nativeFunctionBody_stringLiteral != null)
+ _result["nativeFunctionBody_stringLiteral"] =
+ nativeFunctionBody_stringLiteral.toJson();
+ if (nativeFunctionBody_nativeKeyword != 0)
+ _result["nativeFunctionBody_nativeKeyword"] =
+ nativeFunctionBody_nativeKeyword;
+ if (nativeFunctionBody_semicolon != 0)
+ _result["nativeFunctionBody_semicolon"] = nativeFunctionBody_semicolon;
+ }
if (kind == idl.LinkedNodeKind.parenthesizedExpression) {
if (parenthesizedExpression_expression != null)
_result["parenthesizedExpression_expression"] =
@@ -16274,6 +17390,9 @@
postfixExpression_operand.toJson();
if (postfixExpression_element != 0)
_result["postfixExpression_element"] = postfixExpression_element;
+ if (postfixExpression_elementType != null)
+ _result["postfixExpression_elementType"] =
+ postfixExpression_elementType.toJson();
if (postfixExpression_operator != 0)
_result["postfixExpression_operator"] = postfixExpression_operator;
if (expression_type != null)
@@ -16296,6 +17415,9 @@
_result["prefixExpression_operand"] = prefixExpression_operand.toJson();
if (prefixExpression_element != 0)
_result["prefixExpression_element"] = prefixExpression_element;
+ if (prefixExpression_elementType != null)
+ _result["prefixExpression_elementType"] =
+ prefixExpression_elementType.toJson();
if (prefixExpression_operator != 0)
_result["prefixExpression_operator"] = prefixExpression_operator;
if (expression_type != null)
@@ -16322,12 +17444,15 @@
if (redirectingConstructorInvocation_constructorName != null)
_result["redirectingConstructorInvocation_constructorName"] =
redirectingConstructorInvocation_constructorName.toJson();
- if (redirectingConstructorInvocation_period != 0)
- _result["redirectingConstructorInvocation_period"] =
- redirectingConstructorInvocation_period;
if (redirectingConstructorInvocation_thisKeyword != 0)
_result["redirectingConstructorInvocation_thisKeyword"] =
redirectingConstructorInvocation_thisKeyword;
+ if (redirectingConstructorInvocation_elementType != null)
+ _result["redirectingConstructorInvocation_elementType"] =
+ redirectingConstructorInvocation_elementType.toJson();
+ if (redirectingConstructorInvocation_period != 0)
+ _result["redirectingConstructorInvocation_period"] =
+ redirectingConstructorInvocation_period;
}
if (kind == idl.LinkedNodeKind.returnStatement) {
if (returnStatement_expression != null)
@@ -16355,12 +17480,15 @@
if (superConstructorInvocation_constructorName != null)
_result["superConstructorInvocation_constructorName"] =
superConstructorInvocation_constructorName.toJson();
- if (superConstructorInvocation_period != 0)
- _result["superConstructorInvocation_period"] =
- superConstructorInvocation_period;
if (superConstructorInvocation_superKeyword != 0)
_result["superConstructorInvocation_superKeyword"] =
superConstructorInvocation_superKeyword;
+ if (superConstructorInvocation_elementType != null)
+ _result["superConstructorInvocation_elementType"] =
+ superConstructorInvocation_elementType.toJson();
+ if (superConstructorInvocation_period != 0)
+ _result["superConstructorInvocation_period"] =
+ superConstructorInvocation_period;
}
if (kind == idl.LinkedNodeKind.throwExpression) {
if (throwExpression_expression != null)
@@ -16397,11 +17525,11 @@
whileStatement_leftParenthesis;
if (whileStatement_condition != null)
_result["whileStatement_condition"] = whileStatement_condition.toJson();
+ if (whileStatement_whileKeyword != 0)
+ _result["whileStatement_whileKeyword"] = whileStatement_whileKeyword;
if (whileStatement_rightParenthesis != 0)
_result["whileStatement_rightParenthesis"] =
whileStatement_rightParenthesis;
- if (whileStatement_whileKeyword != 0)
- _result["whileStatement_whileKeyword"] = whileStatement_whileKeyword;
}
if (kind == idl.LinkedNodeKind.yieldStatement) {
if (yieldStatement_expression != null)
@@ -16409,10 +17537,10 @@
yieldStatement_expression.toJson();
if (yieldStatement_yieldKeyword != 0)
_result["yieldStatement_yieldKeyword"] = yieldStatement_yieldKeyword;
- if (yieldStatement_star != 0)
- _result["yieldStatement_star"] = yieldStatement_star;
if (yieldStatement_semicolon != 0)
_result["yieldStatement_semicolon"] = yieldStatement_semicolon;
+ if (yieldStatement_star != 0)
+ _result["yieldStatement_star"] = yieldStatement_star;
}
if (kind == idl.LinkedNodeKind.booleanLiteral) {
if (booleanLiteral_literal != 0)
@@ -16474,8 +17602,14 @@
if (kind == idl.LinkedNodeKind.simpleIdentifier) {
if (simpleIdentifier_element != 0)
_result["simpleIdentifier_element"] = simpleIdentifier_element;
+ if (simpleIdentifier_elementType != null)
+ _result["simpleIdentifier_elementType"] =
+ simpleIdentifier_elementType.toJson();
if (simpleIdentifier_token != 0)
_result["simpleIdentifier_token"] = simpleIdentifier_token;
+ if (simpleIdentifier_isDeclaration != false)
+ _result["simpleIdentifier_isDeclaration"] =
+ simpleIdentifier_isDeclaration;
if (expression_type != null)
_result["expression_type"] = expression_type.toJson();
}
@@ -16507,16 +17641,225 @@
if (expression_type != null)
_result["expression_type"] = expression_type.toJson();
}
- if (kind == idl.LinkedNodeKind.comment) {
- if (comment_tokens.isNotEmpty) _result["comment_tokens"] = comment_tokens;
- if (comment_type != idl.LinkedNodeCommentType.block)
- _result["comment_type"] = comment_type.toString().split('.')[1];
- }
return _result;
}
@override
Map<String, Object> toMap() {
+ if (kind == idl.LinkedNodeKind.functionDeclaration) {
+ return {
+ "actualReturnType": actualReturnType,
+ "annotatedNode_comment": annotatedNode_comment,
+ "annotatedNode_metadata": annotatedNode_metadata,
+ "functionDeclaration_functionExpression":
+ functionDeclaration_functionExpression,
+ "functionDeclaration_externalKeyword":
+ functionDeclaration_externalKeyword,
+ "functionDeclaration_returnType": functionDeclaration_returnType,
+ "functionDeclaration_propertyKeyword":
+ functionDeclaration_propertyKeyword,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "namedCompilationUnitMember_name": namedCompilationUnitMember_name,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.functionExpression) {
+ return {
+ "actualReturnType": actualReturnType,
+ "functionExpression_body": functionExpression_body,
+ "functionExpression_formalParameters":
+ functionExpression_formalParameters,
+ "functionExpression_typeParameters": functionExpression_typeParameters,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.functionTypeAlias) {
+ return {
+ "actualReturnType": actualReturnType,
+ "annotatedNode_comment": annotatedNode_comment,
+ "annotatedNode_metadata": annotatedNode_metadata,
+ "functionTypeAlias_formalParameters":
+ functionTypeAlias_formalParameters,
+ "functionTypeAlias_returnType": functionTypeAlias_returnType,
+ "functionTypeAlias_typeParameters": functionTypeAlias_typeParameters,
+ "typeAlias_typedefKeyword": typeAlias_typedefKeyword,
+ "typeAlias_semicolon": typeAlias_semicolon,
+ "typeAlias_hasSelfReference": typeAlias_hasSelfReference,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "namedCompilationUnitMember_name": namedCompilationUnitMember_name,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ "simplyBoundable_isSimplyBounded": simplyBoundable_isSimplyBounded,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.genericFunctionType) {
+ return {
+ "actualReturnType": actualReturnType,
+ "genericFunctionType_typeParameters":
+ genericFunctionType_typeParameters,
+ "genericFunctionType_functionKeyword":
+ genericFunctionType_functionKeyword,
+ "genericFunctionType_returnType": genericFunctionType_returnType,
+ "genericFunctionType_id": genericFunctionType_id,
+ "genericFunctionType_formalParameters":
+ genericFunctionType_formalParameters,
+ "genericFunctionType_question": genericFunctionType_question,
+ "genericFunctionType_type": genericFunctionType_type,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.methodDeclaration) {
+ return {
+ "actualReturnType": actualReturnType,
+ "annotatedNode_comment": annotatedNode_comment,
+ "annotatedNode_metadata": annotatedNode_metadata,
+ "methodDeclaration_body": methodDeclaration_body,
+ "methodDeclaration_externalKeyword": methodDeclaration_externalKeyword,
+ "methodDeclaration_formalParameters":
+ methodDeclaration_formalParameters,
+ "methodDeclaration_operatorKeyword": methodDeclaration_operatorKeyword,
+ "methodDeclaration_returnType": methodDeclaration_returnType,
+ "methodDeclaration_modifierKeyword": methodDeclaration_modifierKeyword,
+ "methodDeclaration_propertyKeyword": methodDeclaration_propertyKeyword,
+ "methodDeclaration_actualProperty": methodDeclaration_actualProperty,
+ "methodDeclaration_typeParameters": methodDeclaration_typeParameters,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "methodDeclaration_name": methodDeclaration_name,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.fieldFormalParameter) {
+ return {
+ "actualType": actualType,
+ "normalFormalParameter_metadata": normalFormalParameter_metadata,
+ "fieldFormalParameter_type": fieldFormalParameter_type,
+ "fieldFormalParameter_keyword": fieldFormalParameter_keyword,
+ "fieldFormalParameter_typeParameters":
+ fieldFormalParameter_typeParameters,
+ "fieldFormalParameter_thisKeyword": fieldFormalParameter_thisKeyword,
+ "fieldFormalParameter_formalParameters":
+ fieldFormalParameter_formalParameters,
+ "fieldFormalParameter_period": fieldFormalParameter_period,
+ "normalFormalParameter_requiredKeyword":
+ normalFormalParameter_requiredKeyword,
+ "normalFormalParameter_covariantKeyword":
+ normalFormalParameter_covariantKeyword,
+ "inheritsCovariant": inheritsCovariant,
+ "normalFormalParameter_identifier": normalFormalParameter_identifier,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "normalFormalParameter_comment": normalFormalParameter_comment,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.functionTypedFormalParameter) {
+ return {
+ "actualType": actualType,
+ "normalFormalParameter_metadata": normalFormalParameter_metadata,
+ "functionTypedFormalParameter_formalParameters":
+ functionTypedFormalParameter_formalParameters,
+ "functionTypedFormalParameter_returnType":
+ functionTypedFormalParameter_returnType,
+ "functionTypedFormalParameter_typeParameters":
+ functionTypedFormalParameter_typeParameters,
+ "normalFormalParameter_requiredKeyword":
+ normalFormalParameter_requiredKeyword,
+ "normalFormalParameter_covariantKeyword":
+ normalFormalParameter_covariantKeyword,
+ "inheritsCovariant": inheritsCovariant,
+ "normalFormalParameter_identifier": normalFormalParameter_identifier,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "normalFormalParameter_comment": normalFormalParameter_comment,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.simpleFormalParameter) {
+ return {
+ "actualType": actualType,
+ "normalFormalParameter_metadata": normalFormalParameter_metadata,
+ "simpleFormalParameter_type": simpleFormalParameter_type,
+ "simpleFormalParameter_keyword": simpleFormalParameter_keyword,
+ "normalFormalParameter_requiredKeyword":
+ normalFormalParameter_requiredKeyword,
+ "normalFormalParameter_covariantKeyword":
+ normalFormalParameter_covariantKeyword,
+ "inheritsCovariant": inheritsCovariant,
+ "normalFormalParameter_identifier": normalFormalParameter_identifier,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "normalFormalParameter_comment": normalFormalParameter_comment,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ "topLevelTypeInferenceError": topLevelTypeInferenceError,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.variableDeclaration) {
+ return {
+ "actualType": actualType,
+ "annotatedNode_comment": annotatedNode_comment,
+ "annotatedNode_metadata": annotatedNode_metadata,
+ "variableDeclaration_initializer": variableDeclaration_initializer,
+ "variableDeclaration_equals": variableDeclaration_equals,
+ "variableDeclaration_name": variableDeclaration_name,
+ "inheritsCovariant": inheritsCovariant,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ "topLevelTypeInferenceError": topLevelTypeInferenceError,
+ "variableDeclaration_declaration": variableDeclaration_declaration,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.binaryExpression) {
+ return {
+ "binaryExpression_invokeType": binaryExpression_invokeType,
+ "binaryExpression_leftOperand": binaryExpression_leftOperand,
+ "binaryExpression_element": binaryExpression_element,
+ "binaryExpression_rightOperand": binaryExpression_rightOperand,
+ "binaryExpression_elementType": binaryExpression_elementType,
+ "binaryExpression_operator": binaryExpression_operator,
+ "expression_type": expression_type,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.functionExpressionInvocation) {
+ return {
+ "invocationExpression_invokeType": invocationExpression_invokeType,
+ "functionExpressionInvocation_function":
+ functionExpressionInvocation_function,
+ "invocationExpression_typeArguments":
+ invocationExpression_typeArguments,
+ "expression_type": expression_type,
+ "invocationExpression_arguments": invocationExpression_arguments,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.methodInvocation) {
+ return {
+ "invocationExpression_invokeType": invocationExpression_invokeType,
+ "methodInvocation_methodName": methodInvocation_methodName,
+ "methodInvocation_operator": methodInvocation_operator,
+ "methodInvocation_target": methodInvocation_target,
+ "invocationExpression_typeArguments":
+ invocationExpression_typeArguments,
+ "expression_type": expression_type,
+ "invocationExpression_arguments": invocationExpression_arguments,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
if (kind == idl.LinkedNodeKind.adjacentStrings) {
return {
"adjacentStrings_strings": adjacentStrings_strings,
@@ -16552,12 +17895,23 @@
"kind": kind,
};
}
+ if (kind == idl.LinkedNodeKind.comment) {
+ return {
+ "comment_references": comment_references,
+ "comment_tokens": comment_tokens,
+ "comment_type": comment_type,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
if (kind == idl.LinkedNodeKind.compilationUnit) {
return {
"compilationUnit_declarations": compilationUnit_declarations,
"compilationUnit_scriptTag": compilationUnit_scriptTag,
"compilationUnit_beginToken": compilationUnit_beginToken,
"compilationUnit_endToken": compilationUnit_endToken,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"compilationUnit_directives": compilationUnit_directives,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -16573,15 +17927,17 @@
"constructorDeclaration_constKeyword":
constructorDeclaration_constKeyword,
"constructorDeclaration_name": constructorDeclaration_name,
+ "constructorDeclaration_factoryKeyword":
+ constructorDeclaration_factoryKeyword,
"constructorDeclaration_parameters": constructorDeclaration_parameters,
"constructorDeclaration_externalKeyword":
constructorDeclaration_externalKeyword,
- "constructorDeclaration_factoryKeyword":
- constructorDeclaration_factoryKeyword,
"constructorDeclaration_period": constructorDeclaration_period,
"constructorDeclaration_separator": constructorDeclaration_separator,
"constructorDeclaration_redirectedConstructor":
constructorDeclaration_redirectedConstructor,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"constructorDeclaration_returnType": constructorDeclaration_returnType,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -16600,8 +17956,10 @@
"annotatedNode_comment": annotatedNode_comment,
"annotatedNode_metadata": annotatedNode_metadata,
"enumDeclaration_enumKeyword": enumDeclaration_enumKeyword,
- "enumDeclaration_leftBracket": enumDeclaration_leftBracket,
"enumDeclaration_rightBracket": enumDeclaration_rightBracket,
+ "enumDeclaration_leftBracket": enumDeclaration_leftBracket,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"namedCompilationUnitMember_name": namedCompilationUnitMember_name,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -16611,10 +17969,10 @@
return {
"formalParameterList_parameters": formalParameterList_parameters,
"formalParameterList_leftDelimiter": formalParameterList_leftDelimiter,
- "formalParameterList_leftParenthesis":
- formalParameterList_leftParenthesis,
"formalParameterList_rightDelimiter":
formalParameterList_rightDelimiter,
+ "formalParameterList_leftParenthesis":
+ formalParameterList_leftParenthesis,
"formalParameterList_rightParenthesis":
formalParameterList_rightParenthesis,
"isSynthetic": isSynthetic,
@@ -16671,14 +18029,13 @@
"annotatedNode_comment": annotatedNode_comment,
"annotatedNode_metadata": annotatedNode_metadata,
"directive_keyword": directive_keyword,
- "namespaceDirective_semicolon": namespaceDirective_semicolon,
"uriBasedDirective_uriElement": uriBasedDirective_uriElement,
+ "directive_semicolon": directive_semicolon,
"namespaceDirective_configurations": namespaceDirective_configurations,
"uriBasedDirective_uri": uriBasedDirective_uri,
"isSynthetic": isSynthetic,
"kind": kind,
- "namespaceDirective_selectedUriContent":
- namespaceDirective_selectedUriContent,
+ "namespaceDirective_selectedUri": namespaceDirective_selectedUri,
"uriBasedDirective_uriContent": uriBasedDirective_uriContent,
};
}
@@ -16691,14 +18048,13 @@
"importDirective_asKeyword": importDirective_asKeyword,
"importDirective_deferredKeyword": importDirective_deferredKeyword,
"directive_keyword": directive_keyword,
- "namespaceDirective_semicolon": namespaceDirective_semicolon,
"uriBasedDirective_uriElement": uriBasedDirective_uriElement,
+ "directive_semicolon": directive_semicolon,
"namespaceDirective_configurations": namespaceDirective_configurations,
"uriBasedDirective_uri": uriBasedDirective_uri,
"isSynthetic": isSynthetic,
"kind": kind,
- "namespaceDirective_selectedUriContent":
- namespaceDirective_selectedUriContent,
+ "namespaceDirective_selectedUri": namespaceDirective_selectedUri,
"uriBasedDirective_uriContent": uriBasedDirective_uriContent,
};
}
@@ -16745,8 +18101,8 @@
"switchStatement_members": switchStatement_members,
"switchStatement_leftParenthesis": switchStatement_leftParenthesis,
"switchStatement_expression": switchStatement_expression,
- "switchStatement_rightParenthesis": switchStatement_rightParenthesis,
"switchStatement_switchKeyword": switchStatement_switchKeyword,
+ "switchStatement_rightParenthesis": switchStatement_rightParenthesis,
"switchStatement_leftBracket": switchStatement_leftBracket,
"switchStatement_rightBracket": switchStatement_rightBracket,
"isSynthetic": isSynthetic,
@@ -16789,6 +18145,8 @@
"annotatedNode_metadata": annotatedNode_metadata,
"variableDeclarationList_type": variableDeclarationList_type,
"variableDeclarationList_keyword": variableDeclarationList_keyword,
+ "variableDeclarationList_lateKeyword":
+ variableDeclarationList_lateKeyword,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -16808,6 +18166,7 @@
"classDeclaration_extendsClause": classDeclaration_extendsClause,
"classDeclaration_abstractKeyword": classDeclaration_abstractKeyword,
"classDeclaration_withClause": classDeclaration_withClause,
+ "classDeclaration_nativeClause": classDeclaration_nativeClause,
"classDeclaration_classKeyword": classDeclaration_classKeyword,
"classOrMixinDeclaration_rightBracket":
classOrMixinDeclaration_rightBracket,
@@ -16819,9 +18178,12 @@
"classOrMixinDeclaration_members": classOrMixinDeclaration_members,
"classOrMixinDeclaration_typeParameters":
classOrMixinDeclaration_typeParameters,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"namedCompilationUnitMember_name": namedCompilationUnitMember_name,
"isSynthetic": isSynthetic,
"kind": kind,
+ "simplyBoundable_isSimplyBounded": simplyBoundable_isSimplyBounded,
};
}
if (kind == idl.LinkedNodeKind.classTypeAlias) {
@@ -16836,9 +18198,12 @@
"typeAlias_typedefKeyword": typeAlias_typedefKeyword,
"typeAlias_semicolon": typeAlias_semicolon,
"classTypeAlias_implementsClause": classTypeAlias_implementsClause,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"namedCompilationUnitMember_name": namedCompilationUnitMember_name,
"isSynthetic": isSynthetic,
"kind": kind,
+ "simplyBoundable_isSimplyBounded": simplyBoundable_isSimplyBounded,
};
}
if (kind == idl.LinkedNodeKind.declaredIdentifier) {
@@ -16867,41 +18232,8 @@
"annotatedNode_metadata": annotatedNode_metadata,
"fieldDeclaration_fields": fieldDeclaration_fields,
"fieldDeclaration_covariantKeyword": fieldDeclaration_covariantKeyword,
- "fieldDeclaration_semicolon": fieldDeclaration_semicolon,
"fieldDeclaration_staticKeyword": fieldDeclaration_staticKeyword,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.functionDeclaration) {
- return {
- "annotatedNode_comment": annotatedNode_comment,
- "annotatedNode_metadata": annotatedNode_metadata,
- "functionDeclaration_functionExpression":
- functionDeclaration_functionExpression,
- "functionDeclaration_externalKeyword":
- functionDeclaration_externalKeyword,
- "functionDeclaration_returnType": functionDeclaration_returnType,
- "functionDeclaration_propertyKeyword":
- functionDeclaration_propertyKeyword,
- "functionDeclaration_returnType2": functionDeclaration_returnType2,
- "namedCompilationUnitMember_name": namedCompilationUnitMember_name,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.functionTypeAlias) {
- return {
- "annotatedNode_comment": annotatedNode_comment,
- "annotatedNode_metadata": annotatedNode_metadata,
- "functionTypeAlias_formalParameters":
- functionTypeAlias_formalParameters,
- "functionTypeAlias_returnType": functionTypeAlias_returnType,
- "functionTypeAlias_typeParameters": functionTypeAlias_typeParameters,
- "typeAlias_typedefKeyword": typeAlias_typedefKeyword,
- "typeAlias_semicolon": typeAlias_semicolon,
- "functionTypeAlias_returnType2": functionTypeAlias_returnType2,
- "namedCompilationUnitMember_name": namedCompilationUnitMember_name,
+ "fieldDeclaration_semicolon": fieldDeclaration_semicolon,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -16915,9 +18247,13 @@
"genericTypeAlias_equals": genericTypeAlias_equals,
"typeAlias_typedefKeyword": typeAlias_typedefKeyword,
"typeAlias_semicolon": typeAlias_semicolon,
+ "typeAlias_hasSelfReference": typeAlias_hasSelfReference,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"namedCompilationUnitMember_name": namedCompilationUnitMember_name,
"isSynthetic": isSynthetic,
"kind": kind,
+ "simplyBoundable_isSimplyBounded": simplyBoundable_isSimplyBounded,
};
}
if (kind == idl.LinkedNodeKind.libraryDirective) {
@@ -16926,27 +18262,7 @@
"annotatedNode_metadata": annotatedNode_metadata,
"libraryDirective_name": libraryDirective_name,
"directive_keyword": directive_keyword,
- "namespaceDirective_semicolon": namespaceDirective_semicolon,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.methodDeclaration) {
- return {
- "annotatedNode_comment": annotatedNode_comment,
- "annotatedNode_metadata": annotatedNode_metadata,
- "methodDeclaration_body": methodDeclaration_body,
- "methodDeclaration_externalKeyword": methodDeclaration_externalKeyword,
- "methodDeclaration_formalParameters":
- methodDeclaration_formalParameters,
- "methodDeclaration_returnType": methodDeclaration_returnType,
- "methodDeclaration_modifierKeyword": methodDeclaration_modifierKeyword,
- "methodDeclaration_operatorKeyword": methodDeclaration_operatorKeyword,
- "methodDeclaration_propertyKeyword": methodDeclaration_propertyKeyword,
- "methodDeclaration_actualProperty": methodDeclaration_actualProperty,
- "methodDeclaration_returnType2": methodDeclaration_returnType2,
- "methodDeclaration_typeParameters": methodDeclaration_typeParameters,
- "methodDeclaration_name": methodDeclaration_name,
+ "directive_semicolon": directive_semicolon,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -16966,9 +18282,14 @@
"classOrMixinDeclaration_members": classOrMixinDeclaration_members,
"classOrMixinDeclaration_typeParameters":
classOrMixinDeclaration_typeParameters,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"namedCompilationUnitMember_name": namedCompilationUnitMember_name,
"isSynthetic": isSynthetic,
"kind": kind,
+ "mixinDeclaration_superInvokedNames":
+ mixinDeclaration_superInvokedNames,
+ "simplyBoundable_isSimplyBounded": simplyBoundable_isSimplyBounded,
};
}
if (kind == idl.LinkedNodeKind.partDirective) {
@@ -16976,13 +18297,11 @@
"annotatedNode_comment": annotatedNode_comment,
"annotatedNode_metadata": annotatedNode_metadata,
"directive_keyword": directive_keyword,
- "namespaceDirective_semicolon": namespaceDirective_semicolon,
"uriBasedDirective_uriElement": uriBasedDirective_uriElement,
+ "directive_semicolon": directive_semicolon,
"uriBasedDirective_uri": uriBasedDirective_uri,
"isSynthetic": isSynthetic,
"kind": kind,
- "namespaceDirective_selectedUriContent":
- namespaceDirective_selectedUriContent,
"uriBasedDirective_uriContent": uriBasedDirective_uriContent,
};
}
@@ -16991,14 +18310,12 @@
"annotatedNode_comment": annotatedNode_comment,
"annotatedNode_metadata": annotatedNode_metadata,
"partOfDirective_libraryName": partOfDirective_libraryName,
- "partOfDirective_semicolon": partOfDirective_semicolon,
"partOfDirective_uri": partOfDirective_uri,
"partOfDirective_ofKeyword": partOfDirective_ofKeyword,
"directive_keyword": directive_keyword,
+ "directive_semicolon": directive_semicolon,
"isSynthetic": isSynthetic,
"kind": kind,
- "namespaceDirective_selectedUriContent":
- namespaceDirective_selectedUriContent,
};
}
if (kind == idl.LinkedNodeKind.topLevelVariableDeclaration) {
@@ -17020,76 +18337,9 @@
"typeParameter_bound": typeParameter_bound,
"typeParameter_extendsKeyword": typeParameter_extendsKeyword,
"typeParameter_name": typeParameter_name,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.variableDeclaration) {
- return {
- "annotatedNode_comment": annotatedNode_comment,
- "annotatedNode_metadata": annotatedNode_metadata,
- "variableDeclaration_initializer": variableDeclaration_initializer,
- "variableDeclaration_equals": variableDeclaration_equals,
- "variableDeclaration_name": variableDeclaration_name,
- "variableDeclaration_type2": variableDeclaration_type2,
- "isSynthetic": isSynthetic,
- "kind": kind,
- "variableDeclaration_declaration": variableDeclaration_declaration,
- };
- }
- if (kind == idl.LinkedNodeKind.fieldFormalParameter) {
- return {
- "normalFormalParameter_metadata": normalFormalParameter_metadata,
- "fieldFormalParameter_type": fieldFormalParameter_type,
- "fieldFormalParameter_keyword": fieldFormalParameter_keyword,
- "fieldFormalParameter_typeParameters":
- fieldFormalParameter_typeParameters,
- "fieldFormalParameter_formalParameters":
- fieldFormalParameter_formalParameters,
- "fieldFormalParameter_period": fieldFormalParameter_period,
- "fieldFormalParameter_thisKeyword": fieldFormalParameter_thisKeyword,
- "normalFormalParameter_covariantKeyword":
- normalFormalParameter_covariantKeyword,
- "fieldFormalParameter_type2": fieldFormalParameter_type2,
- "normalFormalParameter_isCovariant": normalFormalParameter_isCovariant,
- "normalFormalParameter_identifier": normalFormalParameter_identifier,
- "formalParameter_kind": formalParameter_kind,
- "normalFormalParameter_comment": normalFormalParameter_comment,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.functionTypedFormalParameter) {
- return {
- "normalFormalParameter_metadata": normalFormalParameter_metadata,
- "functionTypedFormalParameter_formalParameters":
- functionTypedFormalParameter_formalParameters,
- "functionTypedFormalParameter_returnType":
- functionTypedFormalParameter_returnType,
- "functionTypedFormalParameter_typeParameters":
- functionTypedFormalParameter_typeParameters,
- "normalFormalParameter_covariantKeyword":
- normalFormalParameter_covariantKeyword,
- "normalFormalParameter_isCovariant": normalFormalParameter_isCovariant,
- "normalFormalParameter_identifier": normalFormalParameter_identifier,
- "formalParameter_kind": formalParameter_kind,
- "normalFormalParameter_comment": normalFormalParameter_comment,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.simpleFormalParameter) {
- return {
- "normalFormalParameter_metadata": normalFormalParameter_metadata,
- "simpleFormalParameter_type": simpleFormalParameter_type,
- "simpleFormalParameter_keyword": simpleFormalParameter_keyword,
- "normalFormalParameter_covariantKeyword":
- normalFormalParameter_covariantKeyword,
- "simpleFormalParameter_type2": simpleFormalParameter_type2,
- "normalFormalParameter_isCovariant": normalFormalParameter_isCovariant,
- "normalFormalParameter_identifier": normalFormalParameter_identifier,
- "formalParameter_kind": formalParameter_kind,
- "normalFormalParameter_comment": normalFormalParameter_comment,
+ "typeParameter_defaultType": typeParameter_defaultType,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17120,6 +18370,8 @@
"annotation_arguments": annotation_arguments,
"annotation_atSign": annotation_atSign,
"annotation_constructorName": annotation_constructorName,
+ "annotation_element": annotation_element,
+ "annotation_elementType": annotation_elementType,
"annotation_name": annotation_name,
"annotation_period": annotation_period,
"isSynthetic": isSynthetic,
@@ -17141,8 +18393,8 @@
"assertInitializer_condition": assertInitializer_condition,
"assertInitializer_assertKeyword": assertInitializer_assertKeyword,
"assertInitializer_message": assertInitializer_message,
- "assertInitializer_comma": assertInitializer_comma,
"assertInitializer_leftParenthesis": assertInitializer_leftParenthesis,
+ "assertInitializer_comma": assertInitializer_comma,
"assertInitializer_rightParenthesis":
assertInitializer_rightParenthesis,
"isSynthetic": isSynthetic,
@@ -17154,8 +18406,8 @@
"assertStatement_condition": assertStatement_condition,
"assertStatement_assertKeyword": assertStatement_assertKeyword,
"assertStatement_message": assertStatement_message,
- "assertStatement_comma": assertStatement_comma,
"assertStatement_leftParenthesis": assertStatement_leftParenthesis,
+ "assertStatement_comma": assertStatement_comma,
"assertStatement_rightParenthesis": assertStatement_rightParenthesis,
"assertStatement_semicolon": assertStatement_semicolon,
"isSynthetic": isSynthetic,
@@ -17168,6 +18420,7 @@
"assignmentExpression_element": assignmentExpression_element,
"assignmentExpression_rightHandSide":
assignmentExpression_rightHandSide,
+ "assignmentExpression_elementType": assignmentExpression_elementType,
"assignmentExpression_operator": assignmentExpression_operator,
"expression_type": expression_type,
"isSynthetic": isSynthetic,
@@ -17183,18 +18436,6 @@
"kind": kind,
};
}
- if (kind == idl.LinkedNodeKind.binaryExpression) {
- return {
- "binaryExpression_leftOperand": binaryExpression_leftOperand,
- "binaryExpression_element": binaryExpression_element,
- "binaryExpression_rightOperand": binaryExpression_rightOperand,
- "binaryExpression_operator": binaryExpression_operator,
- "binaryExpression_invokeType": binaryExpression_invokeType,
- "expression_type": expression_type,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
if (kind == idl.LinkedNodeKind.blockFunctionBody) {
return {
"blockFunctionBody_block": blockFunctionBody_block,
@@ -17218,9 +18459,9 @@
"catchClause_body": catchClause_body,
"catchClause_catchKeyword": catchClause_catchKeyword,
"catchClause_exceptionParameter": catchClause_exceptionParameter,
+ "catchClause_leftParenthesis": catchClause_leftParenthesis,
"catchClause_exceptionType": catchClause_exceptionType,
"catchClause_comma": catchClause_comma,
- "catchClause_leftParenthesis": catchClause_leftParenthesis,
"catchClause_onKeyword": catchClause_onKeyword,
"catchClause_rightParenthesis": catchClause_rightParenthesis,
"catchClause_stackTraceParameter": catchClause_stackTraceParameter,
@@ -17228,6 +18469,14 @@
"kind": kind,
};
}
+ if (kind == idl.LinkedNodeKind.commentReference) {
+ return {
+ "commentReference_identifier": commentReference_identifier,
+ "commentReference_newKeyword": commentReference_newKeyword,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
if (kind == idl.LinkedNodeKind.conditionalExpression) {
return {
"conditionalExpression_condition": conditionalExpression_condition,
@@ -17247,9 +18496,9 @@
"configuration_name": configuration_name,
"configuration_ifKeyword": configuration_ifKeyword,
"configuration_value": configuration_value,
+ "configuration_rightParenthesis": configuration_rightParenthesis,
"configuration_uri": configuration_uri,
"configuration_leftParenthesis": configuration_leftParenthesis,
- "configuration_rightParenthesis": configuration_rightParenthesis,
"configuration_equalToken": configuration_equalToken,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17263,10 +18512,10 @@
constructorFieldInitializer_equals,
"constructorFieldInitializer_fieldName":
constructorFieldInitializer_fieldName,
- "constructorFieldInitializer_period":
- constructorFieldInitializer_period,
"constructorFieldInitializer_thisKeyword":
constructorFieldInitializer_thisKeyword,
+ "constructorFieldInitializer_period":
+ constructorFieldInitializer_period,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17276,6 +18525,7 @@
"constructorName_name": constructorName_name,
"constructorName_element": constructorName_element,
"constructorName_type": constructorName_type,
+ "constructorName_elementType": constructorName_elementType,
"constructorName_period": constructorName_period,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17296,7 +18546,9 @@
defaultFormalParameter_defaultValue,
"defaultFormalParameter_separator": defaultFormalParameter_separator,
"defaultFormalParameter_parameter": defaultFormalParameter_parameter,
- "defaultFormalParameter_isNamed": defaultFormalParameter_isNamed,
+ "codeLength": codeLength,
+ "codeOffset": codeOffset,
+ "defaultFormalParameter_kind": defaultFormalParameter_kind,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17306,8 +18558,8 @@
"doStatement_body": doStatement_body,
"doStatement_leftParenthesis": doStatement_leftParenthesis,
"doStatement_condition": doStatement_condition,
- "doStatement_rightParenthesis": doStatement_rightParenthesis,
"doStatement_doKeyword": doStatement_doKeyword,
+ "doStatement_rightParenthesis": doStatement_rightParenthesis,
"doStatement_semicolon": doStatement_semicolon,
"doStatement_whileKeyword": doStatement_whileKeyword,
"isSynthetic": isSynthetic,
@@ -17318,8 +18570,8 @@
return {
"expressionFunctionBody_expression": expressionFunctionBody_expression,
"expressionFunctionBody_arrow": expressionFunctionBody_arrow,
- "expressionFunctionBody_keyword": expressionFunctionBody_keyword,
"expressionFunctionBody_semicolon": expressionFunctionBody_semicolon,
+ "expressionFunctionBody_keyword": expressionFunctionBody_keyword,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17365,8 +18617,8 @@
"forMixin_forLoopParts": forMixin_forLoopParts,
"forMixin_awaitKeyword": forMixin_awaitKeyword,
"forElement_body": forElement_body,
- "forMixin_forKeyword": forMixin_forKeyword,
"forMixin_leftParenthesis": forMixin_leftParenthesis,
+ "forMixin_forKeyword": forMixin_forKeyword,
"forMixin_rightParenthesis": forMixin_rightParenthesis,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17377,8 +18629,8 @@
"forMixin_forLoopParts": forMixin_forLoopParts,
"forMixin_awaitKeyword": forMixin_awaitKeyword,
"forStatement_body": forStatement_body,
- "forMixin_forKeyword": forMixin_forKeyword,
"forMixin_leftParenthesis": forMixin_leftParenthesis,
+ "forMixin_forKeyword": forMixin_forKeyword,
"forMixin_rightParenthesis": forMixin_rightParenthesis,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17416,51 +18668,13 @@
"kind": kind,
};
}
- if (kind == idl.LinkedNodeKind.functionExpression) {
- return {
- "functionExpression_body": functionExpression_body,
- "functionExpression_formalParameters":
- functionExpression_formalParameters,
- "functionExpression_typeParameters": functionExpression_typeParameters,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.functionExpressionInvocation) {
- return {
- "functionExpressionInvocation_function":
- functionExpressionInvocation_function,
- "invocationExpression_invokeType": invocationExpression_invokeType,
- "invocationExpression_typeArguments":
- invocationExpression_typeArguments,
- "expression_type": expression_type,
- "invocationExpression_arguments": invocationExpression_arguments,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
- if (kind == idl.LinkedNodeKind.genericFunctionType) {
- return {
- "genericFunctionType_typeParameters":
- genericFunctionType_typeParameters,
- "genericFunctionType_functionKeyword":
- genericFunctionType_functionKeyword,
- "genericFunctionType_returnType": genericFunctionType_returnType,
- "genericFunctionType_formalParameters":
- genericFunctionType_formalParameters,
- "genericFunctionType_question": genericFunctionType_question,
- "genericFunctionType_returnType2": genericFunctionType_returnType2,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
if (kind == idl.LinkedNodeKind.ifElement) {
return {
"ifMixin_condition": ifMixin_condition,
"ifMixin_elseKeyword": ifMixin_elseKeyword,
+ "ifMixin_leftParenthesis": ifMixin_leftParenthesis,
"ifElement_thenElement": ifElement_thenElement,
"ifMixin_ifKeyword": ifMixin_ifKeyword,
- "ifMixin_leftParenthesis": ifMixin_leftParenthesis,
"ifMixin_rightParenthesis": ifMixin_rightParenthesis,
"ifElement_elseElement": ifElement_elseElement,
"isSynthetic": isSynthetic,
@@ -17472,9 +18686,9 @@
"ifMixin_condition": ifMixin_condition,
"ifMixin_elseKeyword": ifMixin_elseKeyword,
"ifStatement_elseStatement": ifStatement_elseStatement,
+ "ifMixin_leftParenthesis": ifMixin_leftParenthesis,
"ifStatement_thenStatement": ifStatement_thenStatement,
"ifMixin_ifKeyword": ifMixin_ifKeyword,
- "ifMixin_leftParenthesis": ifMixin_leftParenthesis,
"ifMixin_rightParenthesis": ifMixin_rightParenthesis,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17486,6 +18700,8 @@
"indexExpression_element": indexExpression_element,
"indexExpression_target": indexExpression_target,
"indexExpression_leftBracket": indexExpression_leftBracket,
+ "indexExpression_elementType": indexExpression_elementType,
+ "indexExpression_period": indexExpression_period,
"indexExpression_rightBracket": indexExpression_rightBracket,
"expression_type": expression_type,
"isSynthetic": isSynthetic,
@@ -17547,20 +18763,6 @@
"kind": kind,
};
}
- if (kind == idl.LinkedNodeKind.methodInvocation) {
- return {
- "methodInvocation_methodName": methodInvocation_methodName,
- "methodInvocation_operator": methodInvocation_operator,
- "methodInvocation_target": methodInvocation_target,
- "invocationExpression_invokeType": invocationExpression_invokeType,
- "invocationExpression_typeArguments":
- invocationExpression_typeArguments,
- "expression_type": expression_type,
- "invocationExpression_arguments": invocationExpression_arguments,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
if (kind == idl.LinkedNodeKind.namedExpression) {
return {
"namedExpression_expression": namedExpression_expression,
@@ -17570,6 +18772,23 @@
"kind": kind,
};
}
+ if (kind == idl.LinkedNodeKind.nativeClause) {
+ return {
+ "nativeClause_name": nativeClause_name,
+ "nativeClause_nativeKeyword": nativeClause_nativeKeyword,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
+ if (kind == idl.LinkedNodeKind.nativeFunctionBody) {
+ return {
+ "nativeFunctionBody_stringLiteral": nativeFunctionBody_stringLiteral,
+ "nativeFunctionBody_nativeKeyword": nativeFunctionBody_nativeKeyword,
+ "nativeFunctionBody_semicolon": nativeFunctionBody_semicolon,
+ "isSynthetic": isSynthetic,
+ "kind": kind,
+ };
+ }
if (kind == idl.LinkedNodeKind.parenthesizedExpression) {
return {
"parenthesizedExpression_expression":
@@ -17587,6 +18806,7 @@
return {
"postfixExpression_operand": postfixExpression_operand,
"postfixExpression_element": postfixExpression_element,
+ "postfixExpression_elementType": postfixExpression_elementType,
"postfixExpression_operator": postfixExpression_operator,
"expression_type": expression_type,
"isSynthetic": isSynthetic,
@@ -17607,6 +18827,7 @@
return {
"prefixExpression_operand": prefixExpression_operand,
"prefixExpression_element": prefixExpression_element,
+ "prefixExpression_elementType": prefixExpression_elementType,
"prefixExpression_operator": prefixExpression_operator,
"expression_type": expression_type,
"isSynthetic": isSynthetic,
@@ -17631,10 +18852,12 @@
redirectingConstructorInvocation_element,
"redirectingConstructorInvocation_constructorName":
redirectingConstructorInvocation_constructorName,
- "redirectingConstructorInvocation_period":
- redirectingConstructorInvocation_period,
"redirectingConstructorInvocation_thisKeyword":
redirectingConstructorInvocation_thisKeyword,
+ "redirectingConstructorInvocation_elementType":
+ redirectingConstructorInvocation_elementType,
+ "redirectingConstructorInvocation_period":
+ redirectingConstructorInvocation_period,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17664,9 +18887,11 @@
superConstructorInvocation_element,
"superConstructorInvocation_constructorName":
superConstructorInvocation_constructorName,
- "superConstructorInvocation_period": superConstructorInvocation_period,
"superConstructorInvocation_superKeyword":
superConstructorInvocation_superKeyword,
+ "superConstructorInvocation_elementType":
+ superConstructorInvocation_elementType,
+ "superConstructorInvocation_period": superConstructorInvocation_period,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17705,8 +18930,8 @@
"whileStatement_body": whileStatement_body,
"whileStatement_leftParenthesis": whileStatement_leftParenthesis,
"whileStatement_condition": whileStatement_condition,
- "whileStatement_rightParenthesis": whileStatement_rightParenthesis,
"whileStatement_whileKeyword": whileStatement_whileKeyword,
+ "whileStatement_rightParenthesis": whileStatement_rightParenthesis,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17715,8 +18940,8 @@
return {
"yieldStatement_expression": yieldStatement_expression,
"yieldStatement_yieldKeyword": yieldStatement_yieldKeyword,
- "yieldStatement_star": yieldStatement_star,
"yieldStatement_semicolon": yieldStatement_semicolon,
+ "yieldStatement_star": yieldStatement_star,
"isSynthetic": isSynthetic,
"kind": kind,
};
@@ -17796,7 +19021,9 @@
if (kind == idl.LinkedNodeKind.simpleIdentifier) {
return {
"simpleIdentifier_element": simpleIdentifier_element,
+ "simpleIdentifier_elementType": simpleIdentifier_elementType,
"simpleIdentifier_token": simpleIdentifier_token,
+ "simpleIdentifier_isDeclaration": simpleIdentifier_isDeclaration,
"expression_type": expression_type,
"isSynthetic": isSynthetic,
"kind": kind,
@@ -17836,14 +19063,6 @@
"kind": kind,
};
}
- if (kind == idl.LinkedNodeKind.comment) {
- return {
- "comment_tokens": comment_tokens,
- "comment_type": comment_type,
- "isSynthetic": isSynthetic,
- "kind": kind,
- };
- }
throw StateError("Unexpected $kind");
}
@@ -17861,7 +19080,7 @@
List<LinkedNodeLibraryBuilder> get libraries =>
_libraries ??= <LinkedNodeLibraryBuilder>[];
- void set libraries(List<LinkedNodeLibraryBuilder> value) {
+ set libraries(List<LinkedNodeLibraryBuilder> value) {
this._libraries = value;
}
@@ -17869,7 +19088,7 @@
LinkedNodeReferencesBuilder get references => _references;
/// The shared list of references used in the [libraries].
- void set references(LinkedNodeReferencesBuilder value) {
+ set references(LinkedNodeReferencesBuilder value) {
this._references = value;
}
@@ -17879,17 +19098,13 @@
: _libraries = libraries,
_references = references;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_libraries?.forEach((b) => b.flushInformative());
_references?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addBool(this._references != null);
this._references?.collectApiSignature(signature);
@@ -18003,7 +19218,7 @@
@override
List<int> get exports => _exports ??= <int>[];
- void set exports(List<int> value) {
+ set exports(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._exports = value;
}
@@ -18011,14 +19226,14 @@
@override
String get name => _name ??= '';
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@override
int get nameLength => _nameLength ??= 0;
- void set nameLength(int value) {
+ set nameLength(int value) {
assert(value == null || value >= 0);
this._nameLength = value;
}
@@ -18026,7 +19241,7 @@
@override
int get nameOffset => _nameOffset ??= 0;
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -18034,14 +19249,14 @@
@override
List<LinkedNodeUnitBuilder> get units => _units ??= <LinkedNodeUnitBuilder>[];
- void set units(List<LinkedNodeUnitBuilder> value) {
+ set units(List<LinkedNodeUnitBuilder> value) {
this._units = value;
}
@override
String get uriStr => _uriStr ??= '';
- void set uriStr(String value) {
+ set uriStr(String value) {
this._uriStr = value;
}
@@ -18059,16 +19274,12 @@
_units = units,
_uriStr = uriStr;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_units?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uriStr ?? '');
if (this._units == null) {
@@ -18233,14 +19444,14 @@
@override
List<String> get name => _name ??= <String>[];
- void set name(List<String> value) {
+ set name(List<String> value) {
this._name = value;
}
@override
List<int> get parent => _parent ??= <int>[];
- void set parent(List<int> value) {
+ set parent(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._parent = value;
}
@@ -18249,14 +19460,10 @@
: _name = name,
_parent = parent;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._parent == null) {
signature.addInt(0);
@@ -18354,45 +19561,63 @@
class LinkedNodeTypeBuilder extends Object
with _LinkedNodeTypeMixin
implements idl.LinkedNodeType {
- List<int> _functionFormalParameters;
+ List<LinkedNodeTypeFormalParameterBuilder> _functionFormalParameters;
LinkedNodeTypeBuilder _functionReturnType;
- List<int> _functionTypeParameters;
+ List<LinkedNodeTypeTypeParameterBuilder> _functionTypeParameters;
+ int _genericTypeAliasReference;
+ List<LinkedNodeTypeBuilder> _genericTypeAliasTypeArguments;
int _interfaceClass;
List<LinkedNodeTypeBuilder> _interfaceTypeArguments;
idl.LinkedNodeTypeKind _kind;
- int _typeParameterParameter;
+ idl.EntityRefNullabilitySuffix _nullabilitySuffix;
+ int _typeParameterElement;
+ int _typeParameterId;
@override
- List<int> get functionFormalParameters =>
- _functionFormalParameters ??= <int>[];
+ List<LinkedNodeTypeFormalParameterBuilder> get functionFormalParameters =>
+ _functionFormalParameters ??= <LinkedNodeTypeFormalParameterBuilder>[];
- /// References to [LinkedNodeReferences].
- void set functionFormalParameters(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
+ set functionFormalParameters(
+ List<LinkedNodeTypeFormalParameterBuilder> value) {
this._functionFormalParameters = value;
}
@override
LinkedNodeTypeBuilder get functionReturnType => _functionReturnType;
- void set functionReturnType(LinkedNodeTypeBuilder value) {
+ set functionReturnType(LinkedNodeTypeBuilder value) {
this._functionReturnType = value;
}
@override
- List<int> get functionTypeParameters => _functionTypeParameters ??= <int>[];
+ List<LinkedNodeTypeTypeParameterBuilder> get functionTypeParameters =>
+ _functionTypeParameters ??= <LinkedNodeTypeTypeParameterBuilder>[];
- /// References to [LinkedNodeReferences].
- void set functionTypeParameters(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
+ set functionTypeParameters(List<LinkedNodeTypeTypeParameterBuilder> value) {
this._functionTypeParameters = value;
}
@override
+ int get genericTypeAliasReference => _genericTypeAliasReference ??= 0;
+
+ set genericTypeAliasReference(int value) {
+ assert(value == null || value >= 0);
+ this._genericTypeAliasReference = value;
+ }
+
+ @override
+ List<LinkedNodeTypeBuilder> get genericTypeAliasTypeArguments =>
+ _genericTypeAliasTypeArguments ??= <LinkedNodeTypeBuilder>[];
+
+ set genericTypeAliasTypeArguments(List<LinkedNodeTypeBuilder> value) {
+ this._genericTypeAliasTypeArguments = value;
+ }
+
+ @override
int get interfaceClass => _interfaceClass ??= 0;
/// Reference to a [LinkedNodeReferences].
- void set interfaceClass(int value) {
+ set interfaceClass(int value) {
assert(value == null || value >= 0);
this._interfaceClass = value;
}
@@ -18401,60 +19626,82 @@
List<LinkedNodeTypeBuilder> get interfaceTypeArguments =>
_interfaceTypeArguments ??= <LinkedNodeTypeBuilder>[];
- void set interfaceTypeArguments(List<LinkedNodeTypeBuilder> value) {
+ set interfaceTypeArguments(List<LinkedNodeTypeBuilder> value) {
this._interfaceTypeArguments = value;
}
@override
idl.LinkedNodeTypeKind get kind => _kind ??= idl.LinkedNodeTypeKind.bottom;
- void set kind(idl.LinkedNodeTypeKind value) {
+ set kind(idl.LinkedNodeTypeKind value) {
this._kind = value;
}
@override
- int get typeParameterParameter => _typeParameterParameter ??= 0;
+ idl.EntityRefNullabilitySuffix get nullabilitySuffix =>
+ _nullabilitySuffix ??= idl.EntityRefNullabilitySuffix.starOrIrrelevant;
- /// Reference to a [LinkedNodeReferences].
- void set typeParameterParameter(int value) {
+ set nullabilitySuffix(idl.EntityRefNullabilitySuffix value) {
+ this._nullabilitySuffix = value;
+ }
+
+ @override
+ int get typeParameterElement => _typeParameterElement ??= 0;
+
+ set typeParameterElement(int value) {
assert(value == null || value >= 0);
- this._typeParameterParameter = value;
+ this._typeParameterElement = value;
+ }
+
+ @override
+ int get typeParameterId => _typeParameterId ??= 0;
+
+ set typeParameterId(int value) {
+ assert(value == null || value >= 0);
+ this._typeParameterId = value;
}
LinkedNodeTypeBuilder(
- {List<int> functionFormalParameters,
+ {List<LinkedNodeTypeFormalParameterBuilder> functionFormalParameters,
LinkedNodeTypeBuilder functionReturnType,
- List<int> functionTypeParameters,
+ List<LinkedNodeTypeTypeParameterBuilder> functionTypeParameters,
+ int genericTypeAliasReference,
+ List<LinkedNodeTypeBuilder> genericTypeAliasTypeArguments,
int interfaceClass,
List<LinkedNodeTypeBuilder> interfaceTypeArguments,
idl.LinkedNodeTypeKind kind,
- int typeParameterParameter})
+ idl.EntityRefNullabilitySuffix nullabilitySuffix,
+ int typeParameterElement,
+ int typeParameterId})
: _functionFormalParameters = functionFormalParameters,
_functionReturnType = functionReturnType,
_functionTypeParameters = functionTypeParameters,
+ _genericTypeAliasReference = genericTypeAliasReference,
+ _genericTypeAliasTypeArguments = genericTypeAliasTypeArguments,
_interfaceClass = interfaceClass,
_interfaceTypeArguments = interfaceTypeArguments,
_kind = kind,
- _typeParameterParameter = typeParameterParameter;
+ _nullabilitySuffix = nullabilitySuffix,
+ _typeParameterElement = typeParameterElement,
+ _typeParameterId = typeParameterId;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
+ _functionFormalParameters?.forEach((b) => b.flushInformative());
_functionReturnType?.flushInformative();
+ _functionTypeParameters?.forEach((b) => b.flushInformative());
+ _genericTypeAliasTypeArguments?.forEach((b) => b.flushInformative());
_interfaceTypeArguments?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._functionFormalParameters == null) {
signature.addInt(0);
} else {
signature.addInt(this._functionFormalParameters.length);
for (var x in this._functionFormalParameters) {
- signature.addInt(x);
+ x?.collectApiSignature(signature);
}
}
signature.addBool(this._functionReturnType != null);
@@ -18464,7 +19711,7 @@
} else {
signature.addInt(this._functionTypeParameters.length);
for (var x in this._functionTypeParameters) {
- signature.addInt(x);
+ x?.collectApiSignature(signature);
}
}
signature.addInt(this._interfaceClass ?? 0);
@@ -18477,25 +19724,45 @@
}
}
signature.addInt(this._kind == null ? 0 : this._kind.index);
- signature.addInt(this._typeParameterParameter ?? 0);
+ signature.addInt(this._typeParameterElement ?? 0);
+ signature.addInt(this._typeParameterId ?? 0);
+ signature.addInt(this._genericTypeAliasReference ?? 0);
+ if (this._genericTypeAliasTypeArguments == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._genericTypeAliasTypeArguments.length);
+ for (var x in this._genericTypeAliasTypeArguments) {
+ x?.collectApiSignature(signature);
+ }
+ }
+ signature.addInt(
+ this._nullabilitySuffix == null ? 0 : this._nullabilitySuffix.index);
}
fb.Offset finish(fb.Builder fbBuilder) {
fb.Offset offset_functionFormalParameters;
fb.Offset offset_functionReturnType;
fb.Offset offset_functionTypeParameters;
+ fb.Offset offset_genericTypeAliasTypeArguments;
fb.Offset offset_interfaceTypeArguments;
if (!(_functionFormalParameters == null ||
_functionFormalParameters.isEmpty)) {
- offset_functionFormalParameters =
- fbBuilder.writeListUint32(_functionFormalParameters);
+ offset_functionFormalParameters = fbBuilder.writeList(
+ _functionFormalParameters.map((b) => b.finish(fbBuilder)).toList());
}
if (_functionReturnType != null) {
offset_functionReturnType = _functionReturnType.finish(fbBuilder);
}
if (!(_functionTypeParameters == null || _functionTypeParameters.isEmpty)) {
- offset_functionTypeParameters =
- fbBuilder.writeListUint32(_functionTypeParameters);
+ offset_functionTypeParameters = fbBuilder.writeList(
+ _functionTypeParameters.map((b) => b.finish(fbBuilder)).toList());
+ }
+ if (!(_genericTypeAliasTypeArguments == null ||
+ _genericTypeAliasTypeArguments.isEmpty)) {
+ offset_genericTypeAliasTypeArguments = fbBuilder.writeList(
+ _genericTypeAliasTypeArguments
+ .map((b) => b.finish(fbBuilder))
+ .toList());
}
if (!(_interfaceTypeArguments == null || _interfaceTypeArguments.isEmpty)) {
offset_interfaceTypeArguments = fbBuilder.writeList(
@@ -18511,6 +19778,12 @@
if (offset_functionTypeParameters != null) {
fbBuilder.addOffset(2, offset_functionTypeParameters);
}
+ if (_genericTypeAliasReference != null && _genericTypeAliasReference != 0) {
+ fbBuilder.addUint32(8, _genericTypeAliasReference);
+ }
+ if (offset_genericTypeAliasTypeArguments != null) {
+ fbBuilder.addOffset(9, offset_genericTypeAliasTypeArguments);
+ }
if (_interfaceClass != null && _interfaceClass != 0) {
fbBuilder.addUint32(3, _interfaceClass);
}
@@ -18520,8 +19793,15 @@
if (_kind != null && _kind != idl.LinkedNodeTypeKind.bottom) {
fbBuilder.addUint8(5, _kind.index);
}
- if (_typeParameterParameter != null && _typeParameterParameter != 0) {
- fbBuilder.addUint32(6, _typeParameterParameter);
+ if (_nullabilitySuffix != null &&
+ _nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant) {
+ fbBuilder.addUint8(10, _nullabilitySuffix.index);
+ }
+ if (_typeParameterElement != null && _typeParameterElement != 0) {
+ fbBuilder.addUint32(6, _typeParameterElement);
+ }
+ if (_typeParameterId != null && _typeParameterId != 0) {
+ fbBuilder.addUint32(7, _typeParameterId);
}
return fbBuilder.endTable();
}
@@ -18543,18 +19823,25 @@
_LinkedNodeTypeImpl(this._bc, this._bcOffset);
- List<int> _functionFormalParameters;
+ List<idl.LinkedNodeTypeFormalParameter> _functionFormalParameters;
idl.LinkedNodeType _functionReturnType;
- List<int> _functionTypeParameters;
+ List<idl.LinkedNodeTypeTypeParameter> _functionTypeParameters;
+ int _genericTypeAliasReference;
+ List<idl.LinkedNodeType> _genericTypeAliasTypeArguments;
int _interfaceClass;
List<idl.LinkedNodeType> _interfaceTypeArguments;
idl.LinkedNodeTypeKind _kind;
- int _typeParameterParameter;
+ idl.EntityRefNullabilitySuffix _nullabilitySuffix;
+ int _typeParameterElement;
+ int _typeParameterId;
@override
- List<int> get functionFormalParameters {
+ List<idl.LinkedNodeTypeFormalParameter> get functionFormalParameters {
_functionFormalParameters ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 0, const <int>[]);
+ const fb.ListReader<idl.LinkedNodeTypeFormalParameter>(
+ const _LinkedNodeTypeFormalParameterReader())
+ .vTableGet(
+ _bc, _bcOffset, 0, const <idl.LinkedNodeTypeFormalParameter>[]);
return _functionFormalParameters;
}
@@ -18566,13 +19853,31 @@
}
@override
- List<int> get functionTypeParameters {
+ List<idl.LinkedNodeTypeTypeParameter> get functionTypeParameters {
_functionTypeParameters ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 2, const <int>[]);
+ const fb.ListReader<idl.LinkedNodeTypeTypeParameter>(
+ const _LinkedNodeTypeTypeParameterReader())
+ .vTableGet(
+ _bc, _bcOffset, 2, const <idl.LinkedNodeTypeTypeParameter>[]);
return _functionTypeParameters;
}
@override
+ int get genericTypeAliasReference {
+ _genericTypeAliasReference ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 8, 0);
+ return _genericTypeAliasReference;
+ }
+
+ @override
+ List<idl.LinkedNodeType> get genericTypeAliasTypeArguments {
+ _genericTypeAliasTypeArguments ??=
+ const fb.ListReader<idl.LinkedNodeType>(const _LinkedNodeTypeReader())
+ .vTableGet(_bc, _bcOffset, 9, const <idl.LinkedNodeType>[]);
+ return _genericTypeAliasTypeArguments;
+ }
+
+ @override
int get interfaceClass {
_interfaceClass ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
return _interfaceClass;
@@ -18594,10 +19899,24 @@
}
@override
- int get typeParameterParameter {
- _typeParameterParameter ??=
+ idl.EntityRefNullabilitySuffix get nullabilitySuffix {
+ _nullabilitySuffix ??= const _EntityRefNullabilitySuffixReader().vTableGet(
+ _bc, _bcOffset, 10, idl.EntityRefNullabilitySuffix.starOrIrrelevant);
+ return _nullabilitySuffix;
+ }
+
+ @override
+ int get typeParameterElement {
+ _typeParameterElement ??=
const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 6, 0);
- return _typeParameterParameter;
+ return _typeParameterElement;
+ }
+
+ @override
+ int get typeParameterId {
+ _typeParameterId ??=
+ const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 7, 0);
+ return _typeParameterId;
}
}
@@ -18606,19 +19925,30 @@
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
if (functionFormalParameters.isNotEmpty)
- _result["functionFormalParameters"] = functionFormalParameters;
+ _result["functionFormalParameters"] =
+ functionFormalParameters.map((_value) => _value.toJson()).toList();
if (functionReturnType != null)
_result["functionReturnType"] = functionReturnType.toJson();
if (functionTypeParameters.isNotEmpty)
- _result["functionTypeParameters"] = functionTypeParameters;
+ _result["functionTypeParameters"] =
+ functionTypeParameters.map((_value) => _value.toJson()).toList();
+ if (genericTypeAliasReference != 0)
+ _result["genericTypeAliasReference"] = genericTypeAliasReference;
+ if (genericTypeAliasTypeArguments.isNotEmpty)
+ _result["genericTypeAliasTypeArguments"] = genericTypeAliasTypeArguments
+ .map((_value) => _value.toJson())
+ .toList();
if (interfaceClass != 0) _result["interfaceClass"] = interfaceClass;
if (interfaceTypeArguments.isNotEmpty)
_result["interfaceTypeArguments"] =
interfaceTypeArguments.map((_value) => _value.toJson()).toList();
if (kind != idl.LinkedNodeTypeKind.bottom)
_result["kind"] = kind.toString().split('.')[1];
- if (typeParameterParameter != 0)
- _result["typeParameterParameter"] = typeParameterParameter;
+ if (nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant)
+ _result["nullabilitySuffix"] = nullabilitySuffix.toString().split('.')[1];
+ if (typeParameterElement != 0)
+ _result["typeParameterElement"] = typeParameterElement;
+ if (typeParameterId != 0) _result["typeParameterId"] = typeParameterId;
return _result;
}
@@ -18627,10 +19957,263 @@
"functionFormalParameters": functionFormalParameters,
"functionReturnType": functionReturnType,
"functionTypeParameters": functionTypeParameters,
+ "genericTypeAliasReference": genericTypeAliasReference,
+ "genericTypeAliasTypeArguments": genericTypeAliasTypeArguments,
"interfaceClass": interfaceClass,
"interfaceTypeArguments": interfaceTypeArguments,
"kind": kind,
- "typeParameterParameter": typeParameterParameter,
+ "nullabilitySuffix": nullabilitySuffix,
+ "typeParameterElement": typeParameterElement,
+ "typeParameterId": typeParameterId,
+ };
+
+ @override
+ String toString() => convert.json.encode(toJson());
+}
+
+class LinkedNodeTypeFormalParameterBuilder extends Object
+ with _LinkedNodeTypeFormalParameterMixin
+ implements idl.LinkedNodeTypeFormalParameter {
+ idl.LinkedNodeFormalParameterKind _kind;
+ String _name;
+ LinkedNodeTypeBuilder _type;
+
+ @override
+ idl.LinkedNodeFormalParameterKind get kind =>
+ _kind ??= idl.LinkedNodeFormalParameterKind.requiredPositional;
+
+ set kind(idl.LinkedNodeFormalParameterKind value) {
+ this._kind = value;
+ }
+
+ @override
+ String get name => _name ??= '';
+
+ set name(String value) {
+ this._name = value;
+ }
+
+ @override
+ LinkedNodeTypeBuilder get type => _type;
+
+ set type(LinkedNodeTypeBuilder value) {
+ this._type = value;
+ }
+
+ LinkedNodeTypeFormalParameterBuilder(
+ {idl.LinkedNodeFormalParameterKind kind,
+ String name,
+ LinkedNodeTypeBuilder type})
+ : _kind = kind,
+ _name = name,
+ _type = type;
+
+ /// Flush [informative] data recursively.
+ void flushInformative() {
+ _type?.flushInformative();
+ }
+
+ /// Accumulate non-[informative] data into [signature].
+ void collectApiSignature(api_sig.ApiSignature signature) {
+ signature.addInt(this._kind == null ? 0 : this._kind.index);
+ signature.addString(this._name ?? '');
+ signature.addBool(this._type != null);
+ this._type?.collectApiSignature(signature);
+ }
+
+ fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_name;
+ fb.Offset offset_type;
+ if (_name != null) {
+ offset_name = fbBuilder.writeString(_name);
+ }
+ if (_type != null) {
+ offset_type = _type.finish(fbBuilder);
+ }
+ fbBuilder.startTable();
+ if (_kind != null &&
+ _kind != idl.LinkedNodeFormalParameterKind.requiredPositional) {
+ fbBuilder.addUint8(0, _kind.index);
+ }
+ if (offset_name != null) {
+ fbBuilder.addOffset(1, offset_name);
+ }
+ if (offset_type != null) {
+ fbBuilder.addOffset(2, offset_type);
+ }
+ return fbBuilder.endTable();
+ }
+}
+
+class _LinkedNodeTypeFormalParameterReader
+ extends fb.TableReader<_LinkedNodeTypeFormalParameterImpl> {
+ const _LinkedNodeTypeFormalParameterReader();
+
+ @override
+ _LinkedNodeTypeFormalParameterImpl createObject(
+ fb.BufferContext bc, int offset) =>
+ new _LinkedNodeTypeFormalParameterImpl(bc, offset);
+}
+
+class _LinkedNodeTypeFormalParameterImpl extends Object
+ with _LinkedNodeTypeFormalParameterMixin
+ implements idl.LinkedNodeTypeFormalParameter {
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ _LinkedNodeTypeFormalParameterImpl(this._bc, this._bcOffset);
+
+ idl.LinkedNodeFormalParameterKind _kind;
+ String _name;
+ idl.LinkedNodeType _type;
+
+ @override
+ idl.LinkedNodeFormalParameterKind get kind {
+ _kind ??= const _LinkedNodeFormalParameterKindReader().vTableGet(_bc,
+ _bcOffset, 0, idl.LinkedNodeFormalParameterKind.requiredPositional);
+ return _kind;
+ }
+
+ @override
+ String get name {
+ _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
+ return _name;
+ }
+
+ @override
+ idl.LinkedNodeType get type {
+ _type ??= const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 2, null);
+ return _type;
+ }
+}
+
+abstract class _LinkedNodeTypeFormalParameterMixin
+ implements idl.LinkedNodeTypeFormalParameter {
+ @override
+ Map<String, Object> toJson() {
+ Map<String, Object> _result = <String, Object>{};
+ if (kind != idl.LinkedNodeFormalParameterKind.requiredPositional)
+ _result["kind"] = kind.toString().split('.')[1];
+ if (name != '') _result["name"] = name;
+ if (type != null) _result["type"] = type.toJson();
+ return _result;
+ }
+
+ @override
+ Map<String, Object> toMap() => {
+ "kind": kind,
+ "name": name,
+ "type": type,
+ };
+
+ @override
+ String toString() => convert.json.encode(toJson());
+}
+
+class LinkedNodeTypeTypeParameterBuilder extends Object
+ with _LinkedNodeTypeTypeParameterMixin
+ implements idl.LinkedNodeTypeTypeParameter {
+ LinkedNodeTypeBuilder _bound;
+ String _name;
+
+ @override
+ LinkedNodeTypeBuilder get bound => _bound;
+
+ set bound(LinkedNodeTypeBuilder value) {
+ this._bound = value;
+ }
+
+ @override
+ String get name => _name ??= '';
+
+ set name(String value) {
+ this._name = value;
+ }
+
+ LinkedNodeTypeTypeParameterBuilder({LinkedNodeTypeBuilder bound, String name})
+ : _bound = bound,
+ _name = name;
+
+ /// Flush [informative] data recursively.
+ void flushInformative() {
+ _bound?.flushInformative();
+ }
+
+ /// Accumulate non-[informative] data into [signature].
+ void collectApiSignature(api_sig.ApiSignature signature) {
+ signature.addString(this._name ?? '');
+ signature.addBool(this._bound != null);
+ this._bound?.collectApiSignature(signature);
+ }
+
+ fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_bound;
+ fb.Offset offset_name;
+ if (_bound != null) {
+ offset_bound = _bound.finish(fbBuilder);
+ }
+ if (_name != null) {
+ offset_name = fbBuilder.writeString(_name);
+ }
+ fbBuilder.startTable();
+ if (offset_bound != null) {
+ fbBuilder.addOffset(1, offset_bound);
+ }
+ if (offset_name != null) {
+ fbBuilder.addOffset(0, offset_name);
+ }
+ return fbBuilder.endTable();
+ }
+}
+
+class _LinkedNodeTypeTypeParameterReader
+ extends fb.TableReader<_LinkedNodeTypeTypeParameterImpl> {
+ const _LinkedNodeTypeTypeParameterReader();
+
+ @override
+ _LinkedNodeTypeTypeParameterImpl createObject(
+ fb.BufferContext bc, int offset) =>
+ new _LinkedNodeTypeTypeParameterImpl(bc, offset);
+}
+
+class _LinkedNodeTypeTypeParameterImpl extends Object
+ with _LinkedNodeTypeTypeParameterMixin
+ implements idl.LinkedNodeTypeTypeParameter {
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ _LinkedNodeTypeTypeParameterImpl(this._bc, this._bcOffset);
+
+ idl.LinkedNodeType _bound;
+ String _name;
+
+ @override
+ idl.LinkedNodeType get bound {
+ _bound ??= const _LinkedNodeTypeReader().vTableGet(_bc, _bcOffset, 1, null);
+ return _bound;
+ }
+
+ @override
+ String get name {
+ _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
+ return _name;
+ }
+}
+
+abstract class _LinkedNodeTypeTypeParameterMixin
+ implements idl.LinkedNodeTypeTypeParameter {
+ @override
+ Map<String, Object> toJson() {
+ Map<String, Object> _result = <String, Object>{};
+ if (bound != null) _result["bound"] = bound.toJson();
+ if (name != '') _result["name"] = name;
+ return _result;
+ }
+
+ @override
+ Map<String, Object> toMap() => {
+ "bound": bound,
+ "name": name,
};
@override
@@ -18640,60 +20223,86 @@
class LinkedNodeUnitBuilder extends Object
with _LinkedNodeUnitMixin
implements idl.LinkedNodeUnit {
+ bool _isSynthetic;
+ List<int> _lineStarts;
LinkedNodeBuilder _node;
UnlinkedTokensBuilder _tokens;
String _uriStr;
@override
+ bool get isSynthetic => _isSynthetic ??= false;
+
+ set isSynthetic(bool value) {
+ this._isSynthetic = value;
+ }
+
+ @override
+ List<int> get lineStarts => _lineStarts ??= <int>[];
+
+ /// Offsets of the first character of each line in the source code.
+ set lineStarts(List<int> value) {
+ assert(value == null || value.every((e) => e >= 0));
+ this._lineStarts = value;
+ }
+
+ @override
LinkedNodeBuilder get node => _node;
- void set node(LinkedNodeBuilder value) {
+ set node(LinkedNodeBuilder value) {
this._node = value;
}
@override
UnlinkedTokensBuilder get tokens => _tokens;
- void set tokens(UnlinkedTokensBuilder value) {
+ set tokens(UnlinkedTokensBuilder value) {
this._tokens = value;
}
@override
String get uriStr => _uriStr ??= '';
- void set uriStr(String value) {
+ set uriStr(String value) {
this._uriStr = value;
}
LinkedNodeUnitBuilder(
- {LinkedNodeBuilder node, UnlinkedTokensBuilder tokens, String uriStr})
- : _node = node,
+ {bool isSynthetic,
+ List<int> lineStarts,
+ LinkedNodeBuilder node,
+ UnlinkedTokensBuilder tokens,
+ String uriStr})
+ : _isSynthetic = isSynthetic,
+ _lineStarts = lineStarts,
+ _node = node,
_tokens = tokens,
_uriStr = uriStr;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
+ _lineStarts = null;
_node?.flushInformative();
_tokens?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uriStr ?? '');
signature.addBool(this._tokens != null);
this._tokens?.collectApiSignature(signature);
signature.addBool(this._node != null);
this._node?.collectApiSignature(signature);
+ signature.addBool(this._isSynthetic == true);
}
fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_lineStarts;
fb.Offset offset_node;
fb.Offset offset_tokens;
fb.Offset offset_uriStr;
+ if (!(_lineStarts == null || _lineStarts.isEmpty)) {
+ offset_lineStarts = fbBuilder.writeListUint32(_lineStarts);
+ }
if (_node != null) {
offset_node = _node.finish(fbBuilder);
}
@@ -18704,6 +20313,12 @@
offset_uriStr = fbBuilder.writeString(_uriStr);
}
fbBuilder.startTable();
+ if (_isSynthetic == true) {
+ fbBuilder.addBool(3, true);
+ }
+ if (offset_lineStarts != null) {
+ fbBuilder.addOffset(4, offset_lineStarts);
+ }
if (offset_node != null) {
fbBuilder.addOffset(2, offset_node);
}
@@ -18733,11 +20348,26 @@
_LinkedNodeUnitImpl(this._bc, this._bcOffset);
+ bool _isSynthetic;
+ List<int> _lineStarts;
idl.LinkedNode _node;
idl.UnlinkedTokens _tokens;
String _uriStr;
@override
+ bool get isSynthetic {
+ _isSynthetic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 3, false);
+ return _isSynthetic;
+ }
+
+ @override
+ List<int> get lineStarts {
+ _lineStarts ??=
+ const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 4, const <int>[]);
+ return _lineStarts;
+ }
+
+ @override
idl.LinkedNode get node {
_node ??= const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 2, null);
return _node;
@@ -18761,6 +20391,8 @@
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
+ if (isSynthetic != false) _result["isSynthetic"] = isSynthetic;
+ if (lineStarts.isNotEmpty) _result["lineStarts"] = lineStarts;
if (node != null) _result["node"] = node.toJson();
if (tokens != null) _result["tokens"] = tokens.toJson();
if (uriStr != '') _result["uriStr"] = uriStr;
@@ -18769,6 +20401,8 @@
@override
Map<String, Object> toMap() => {
+ "isSynthetic": isSynthetic,
+ "lineStarts": lineStarts,
"node": node,
"tokens": tokens,
"uriStr": uriStr,
@@ -18783,60 +20417,70 @@
implements idl.LinkedNodeVariablesDeclaration {
LinkedNodeBuilder _comment;
bool _isConst;
+ bool _isCovariant;
bool _isFinal;
bool _isStatic;
@override
LinkedNodeBuilder get comment => _comment;
- void set comment(LinkedNodeBuilder value) {
+ set comment(LinkedNodeBuilder value) {
this._comment = value;
}
@override
bool get isConst => _isConst ??= false;
- void set isConst(bool value) {
+ set isConst(bool value) {
this._isConst = value;
}
@override
+ bool get isCovariant => _isCovariant ??= false;
+
+ set isCovariant(bool value) {
+ this._isCovariant = value;
+ }
+
+ @override
bool get isFinal => _isFinal ??= false;
- void set isFinal(bool value) {
+ set isFinal(bool value) {
this._isFinal = value;
}
@override
bool get isStatic => _isStatic ??= false;
- void set isStatic(bool value) {
+ set isStatic(bool value) {
this._isStatic = value;
}
LinkedNodeVariablesDeclarationBuilder(
- {LinkedNodeBuilder comment, bool isConst, bool isFinal, bool isStatic})
+ {LinkedNodeBuilder comment,
+ bool isConst,
+ bool isCovariant,
+ bool isFinal,
+ bool isStatic})
: _comment = comment,
_isConst = isConst,
+ _isCovariant = isCovariant,
_isFinal = isFinal,
_isStatic = isStatic;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_comment?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addBool(this._isConst == true);
- signature.addBool(this._isFinal == true);
- signature.addBool(this._isStatic == true);
signature.addBool(this._comment != null);
this._comment?.collectApiSignature(signature);
+ signature.addBool(this._isConst == true);
+ signature.addBool(this._isCovariant == true);
+ signature.addBool(this._isFinal == true);
+ signature.addBool(this._isStatic == true);
}
fb.Offset finish(fb.Builder fbBuilder) {
@@ -18846,17 +20490,20 @@
}
fbBuilder.startTable();
if (offset_comment != null) {
- fbBuilder.addOffset(3, offset_comment);
+ fbBuilder.addOffset(0, offset_comment);
}
if (_isConst == true) {
- fbBuilder.addBool(0, true);
- }
- if (_isFinal == true) {
fbBuilder.addBool(1, true);
}
- if (_isStatic == true) {
+ if (_isCovariant == true) {
fbBuilder.addBool(2, true);
}
+ if (_isFinal == true) {
+ fbBuilder.addBool(3, true);
+ }
+ if (_isStatic == true) {
+ fbBuilder.addBool(4, true);
+ }
return fbBuilder.endTable();
}
}
@@ -18881,30 +20528,37 @@
idl.LinkedNode _comment;
bool _isConst;
+ bool _isCovariant;
bool _isFinal;
bool _isStatic;
@override
idl.LinkedNode get comment {
- _comment ??= const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 3, null);
+ _comment ??= const _LinkedNodeReader().vTableGet(_bc, _bcOffset, 0, null);
return _comment;
}
@override
bool get isConst {
- _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 0, false);
+ _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 1, false);
return _isConst;
}
@override
+ bool get isCovariant {
+ _isCovariant ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 2, false);
+ return _isCovariant;
+ }
+
+ @override
bool get isFinal {
- _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 1, false);
+ _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 3, false);
return _isFinal;
}
@override
bool get isStatic {
- _isStatic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 2, false);
+ _isStatic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 4, false);
return _isStatic;
}
}
@@ -18916,6 +20570,7 @@
Map<String, Object> _result = <String, Object>{};
if (comment != null) _result["comment"] = comment.toJson();
if (isConst != false) _result["isConst"] = isConst;
+ if (isCovariant != false) _result["isCovariant"] = isCovariant;
if (isFinal != false) _result["isFinal"] = isFinal;
if (isStatic != false) _result["isStatic"] = isStatic;
return _result;
@@ -18925,6 +20580,7 @@
Map<String, Object> toMap() => {
"comment": comment,
"isConst": isConst,
+ "isCovariant": isCovariant,
"isFinal": isFinal,
"isStatic": isStatic,
};
@@ -18955,7 +20611,7 @@
/// Containing references must always point backward; that is, for all i, if
/// LinkedUnit.references[i].containingReference != 0, then
/// LinkedUnit.references[i].containingReference < i.
- void set containingReference(int value) {
+ set containingReference(int value) {
assert(value == null || value >= 0);
this._containingReference = value;
}
@@ -18968,7 +20624,7 @@
///
/// Zero if this entity is contained within another entity (e.g. a class
/// member), or if [kind] is [ReferenceKind.prefix].
- void set dependency(int value) {
+ set dependency(int value) {
assert(value == null || value >= 0);
this._dependency = value;
}
@@ -18978,7 +20634,7 @@
/// The kind of the entity being referred to. For the pseudo-types `dynamic`
/// and `void`, the kind is [ReferenceKind.classOrEnum].
- void set kind(idl.ReferenceKind value) {
+ set kind(idl.ReferenceKind value) {
this._kind = value;
}
@@ -18992,7 +20648,7 @@
/// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
/// name of the entity being referred to. For the pseudo-type `dynamic`, the
/// string is "dynamic". For the pseudo-type `void`, the string is "void".
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -19002,7 +20658,7 @@
/// If the entity being referred to is generic, the number of type parameters
/// it declares (does not include type parameters of enclosing entities).
/// Otherwise zero.
- void set numTypeParameters(int value) {
+ set numTypeParameters(int value) {
assert(value == null || value >= 0);
this._numTypeParameters = value;
}
@@ -19017,7 +20673,7 @@
///
/// Zero if this entity is contained within another entity (e.g. a class
/// member).
- void set unit(int value) {
+ set unit(int value) {
assert(value == null || value >= 0);
this._unit = value;
}
@@ -19036,14 +20692,10 @@
_numTypeParameters = numTypeParameters,
_unit = unit;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._unit ?? 0);
signature.addInt(this._dependency ?? 0);
@@ -19193,7 +20845,7 @@
/// List of slot ids (referring to [UnlinkedExecutable.constCycleSlot])
/// corresponding to const constructors that are part of cycles.
- void set constCycles(List<int> value) {
+ set constCycles(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._constCycles = value;
}
@@ -19204,7 +20856,7 @@
/// List of slot ids (referring to [UnlinkedClass.notSimplyBoundedSlot] or
/// [UnlinkedTypedef.notSimplyBoundedSlot]) corresponding to classes and
/// typedefs that are not simply bounded.
- void set notSimplyBounded(List<int> value) {
+ set notSimplyBounded(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._notSimplyBounded = value;
}
@@ -19216,7 +20868,7 @@
/// List of slot ids (referring to [UnlinkedParam.inheritsCovariantSlot] or
/// [UnlinkedVariable.inheritsCovariantSlot]) corresponding to parameters
/// that inherit `@covariant` behavior from a base class.
- void set parametersInheritingCovariant(List<int> value) {
+ set parametersInheritingCovariant(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._parametersInheritingCovariant = value;
}
@@ -19231,7 +20883,7 @@
/// elements beyond the number of elements in [UnlinkedUnit.references], those
/// additional elements are references that are only referred to implicitly
/// (e.g. elements involved in inferred or propagated types).
- void set references(List<LinkedReferenceBuilder> value) {
+ set references(List<LinkedReferenceBuilder> value) {
this._references = value;
}
@@ -19240,7 +20892,7 @@
_topLevelInferenceErrors ??= <TopLevelInferenceErrorBuilder>[];
/// The list of type inference errors.
- void set topLevelInferenceErrors(List<TopLevelInferenceErrorBuilder> value) {
+ set topLevelInferenceErrors(List<TopLevelInferenceErrorBuilder> value) {
this._topLevelInferenceErrors = value;
}
@@ -19249,7 +20901,7 @@
/// List associating slot ids found inside the unlinked summary for the
/// compilation unit with propagated and inferred types.
- void set types(List<EntityRefBuilder> value) {
+ set types(List<EntityRefBuilder> value) {
this._types = value;
}
@@ -19267,18 +20919,14 @@
_topLevelInferenceErrors = topLevelInferenceErrors,
_types = types;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_references?.forEach((b) => b.flushInformative());
_topLevelInferenceErrors?.forEach((b) => b.flushInformative());
_types?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._references == null) {
signature.addInt(0);
@@ -19510,7 +21158,7 @@
_linkedLibraries ??= <LinkedLibraryBuilder>[];
/// Linked libraries.
- void set linkedLibraries(List<LinkedLibraryBuilder> value) {
+ set linkedLibraries(List<LinkedLibraryBuilder> value) {
this._linkedLibraries = value;
}
@@ -19519,7 +21167,7 @@
/// The list of URIs of items in [linkedLibraries], e.g. `dart:core` or
/// `package:foo/bar.dart`.
- void set linkedLibraryUris(List<String> value) {
+ set linkedLibraryUris(List<String> value) {
this._linkedLibraryUris = value;
}
@@ -19528,7 +21176,7 @@
/// Major version of the summary format. See
/// [PackageBundleAssembler.currentMajorVersion].
- void set majorVersion(int value) {
+ set majorVersion(int value) {
assert(value == null || value >= 0);
this._majorVersion = value;
}
@@ -19538,7 +21186,7 @@
/// Minor version of the summary format. See
/// [PackageBundleAssembler.currentMinorVersion].
- void set minorVersion(int value) {
+ set minorVersion(int value) {
assert(value == null || value >= 0);
this._minorVersion = value;
}
@@ -19552,7 +21200,7 @@
_unlinkedUnits ??= <UnlinkedUnitBuilder>[];
/// Unlinked information for the compilation units constituting the package.
- void set unlinkedUnits(List<UnlinkedUnitBuilder> value) {
+ set unlinkedUnits(List<UnlinkedUnitBuilder> value) {
this._unlinkedUnits = value;
}
@@ -19560,7 +21208,7 @@
List<String> get unlinkedUnitUris => _unlinkedUnitUris ??= <String>[];
/// The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
- void set unlinkedUnitUris(List<String> value) {
+ set unlinkedUnitUris(List<String> value) {
this._unlinkedUnitUris = value;
}
@@ -19578,17 +21226,13 @@
_unlinkedUnits = unlinkedUnits,
_unlinkedUnitUris = unlinkedUnitUris;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_linkedLibraries?.forEach((b) => b.flushInformative());
_unlinkedUnits?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._linkedLibraries == null) {
signature.addInt(0);
@@ -19810,7 +21454,7 @@
/// Each item of this list corresponds to a unique referenced element. It is
/// the kind of the synthetic element.
- void set elementKinds(List<idl.IndexSyntheticElementKind> value) {
+ set elementKinds(List<idl.IndexSyntheticElementKind> value) {
this._elementKinds = value;
}
@@ -19823,7 +21467,7 @@
/// is a top-level element. The list is sorted in ascending order, so that
/// the client can quickly check whether an element is referenced in this
/// [PackageIndex].
- void set elementNameClassMemberIds(List<int> value) {
+ set elementNameClassMemberIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameClassMemberIds = value;
}
@@ -19836,7 +21480,7 @@
/// not a named parameter. The list is sorted in ascending order, so that the
/// client can quickly check whether an element is referenced in this
/// [PackageIndex].
- void set elementNameParameterIds(List<int> value) {
+ set elementNameParameterIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameParameterIds = value;
}
@@ -19849,7 +21493,7 @@
/// the identifier of the top-level element name, or `null` if the element is
/// the unit. The list is sorted in ascending order, so that the client can
/// quickly check whether an element is referenced in this [PackageIndex].
- void set elementNameUnitMemberIds(List<int> value) {
+ set elementNameUnitMemberIds(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementNameUnitMemberIds = value;
}
@@ -19860,7 +21504,7 @@
/// Each item of this list corresponds to a unique referenced element. It is
/// the index into [unitLibraryUris] and [unitUnitUris] for the library
/// specific unit where the element is declared.
- void set elementUnits(List<int> value) {
+ set elementUnits(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._elementUnits = value;
}
@@ -19871,7 +21515,7 @@
/// List of unique element strings used in this [PackageIndex]. The list is
/// sorted in ascending order, so that the client can quickly check the
/// presence of a string in this [PackageIndex].
- void set strings(List<String> value) {
+ set strings(List<String> value) {
this._strings = value;
}
@@ -19881,7 +21525,7 @@
/// Each item of this list corresponds to the library URI of a unique library
/// specific unit referenced in the [PackageIndex]. It is an index into
/// [strings] list.
- void set unitLibraryUris(List<int> value) {
+ set unitLibraryUris(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._unitLibraryUris = value;
}
@@ -19890,7 +21534,7 @@
List<UnitIndexBuilder> get units => _units ??= <UnitIndexBuilder>[];
/// List of indexes of each unit in this [PackageIndex].
- void set units(List<UnitIndexBuilder> value) {
+ set units(List<UnitIndexBuilder> value) {
this._units = value;
}
@@ -19900,7 +21544,7 @@
/// Each item of this list corresponds to the unit URI of a unique library
/// specific unit referenced in the [PackageIndex]. It is an index into
/// [strings] list.
- void set unitUnitUris(List<int> value) {
+ set unitUnitUris(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._unitUnitUris = value;
}
@@ -19925,16 +21569,12 @@
_units = units,
_unitUnitUris = unitUnitUris;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_units?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._elementUnits == null) {
signature.addInt(0);
@@ -20241,7 +21881,7 @@
List<String> get arguments => _arguments ??= <String>[];
/// The [kind] specific arguments.
- void set arguments(List<String> value) {
+ set arguments(List<String> value) {
this._arguments = value;
}
@@ -20250,7 +21890,7 @@
_kind ??= idl.TopLevelInferenceErrorKind.assignment;
/// The kind of the error.
- void set kind(idl.TopLevelInferenceErrorKind value) {
+ set kind(idl.TopLevelInferenceErrorKind value) {
this._kind = value;
}
@@ -20260,7 +21900,7 @@
/// The slot id (which is unique within the compilation unit) identifying the
/// target of type inference with which this [TopLevelInferenceError] is
/// associated.
- void set slot(int value) {
+ set slot(int value) {
assert(value == null || value >= 0);
this._slot = value;
}
@@ -20271,14 +21911,10 @@
_kind = kind,
_slot = slot;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._slot ?? 0);
signature.addInt(this._kind == null ? 0 : this._kind.index);
@@ -20399,7 +22035,7 @@
_definedNameKinds ??= <idl.IndexNameKind>[];
/// Each item of this list is the kind of an element defined in this unit.
- void set definedNameKinds(List<idl.IndexNameKind> value) {
+ set definedNameKinds(List<idl.IndexNameKind> value) {
this._definedNameKinds = value;
}
@@ -20408,7 +22044,7 @@
/// Each item of this list is the name offset of an element defined in this
/// unit relative to the beginning of the file.
- void set definedNameOffsets(List<int> value) {
+ set definedNameOffsets(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._definedNameOffsets = value;
}
@@ -20420,7 +22056,7 @@
/// is an index into [PackageIndex.strings] list. The list is sorted in
/// ascending order, so that the client can quickly find name definitions in
/// this [UnitIndex].
- void set definedNames(List<int> value) {
+ set definedNames(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._definedNames = value;
}
@@ -20430,7 +22066,7 @@
/// Index into [PackageIndex.unitLibraryUris] and [PackageIndex.unitUnitUris]
/// for the library specific unit that corresponds to this [UnitIndex].
- void set unit(int value) {
+ set unit(int value) {
assert(value == null || value >= 0);
this._unit = value;
}
@@ -20441,7 +22077,7 @@
/// Each item of this list is the `true` if the corresponding element usage
/// is qualified with some prefix.
- void set usedElementIsQualifiedFlags(List<bool> value) {
+ set usedElementIsQualifiedFlags(List<bool> value) {
this._usedElementIsQualifiedFlags = value;
}
@@ -20450,7 +22086,7 @@
_usedElementKinds ??= <idl.IndexRelationKind>[];
/// Each item of this list is the kind of the element usage.
- void set usedElementKinds(List<idl.IndexRelationKind> value) {
+ set usedElementKinds(List<idl.IndexRelationKind> value) {
this._usedElementKinds = value;
}
@@ -20458,7 +22094,7 @@
List<int> get usedElementLengths => _usedElementLengths ??= <int>[];
/// Each item of this list is the length of the element usage.
- void set usedElementLengths(List<int> value) {
+ set usedElementLengths(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElementLengths = value;
}
@@ -20468,7 +22104,7 @@
/// Each item of this list is the offset of the element usage relative to the
/// beginning of the file.
- void set usedElementOffsets(List<int> value) {
+ set usedElementOffsets(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElementOffsets = value;
}
@@ -20479,7 +22115,7 @@
/// Each item of this list is the index into [PackageIndex.elementUnits] and
/// [PackageIndex.elementOffsets]. The list is sorted in ascending order, so
/// that the client can quickly find element references in this [UnitIndex].
- void set usedElements(List<int> value) {
+ set usedElements(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedElements = value;
}
@@ -20490,7 +22126,7 @@
/// Each item of this list is the `true` if the corresponding name usage
/// is qualified with some prefix.
- void set usedNameIsQualifiedFlags(List<bool> value) {
+ set usedNameIsQualifiedFlags(List<bool> value) {
this._usedNameIsQualifiedFlags = value;
}
@@ -20499,7 +22135,7 @@
_usedNameKinds ??= <idl.IndexRelationKind>[];
/// Each item of this list is the kind of the name usage.
- void set usedNameKinds(List<idl.IndexRelationKind> value) {
+ set usedNameKinds(List<idl.IndexRelationKind> value) {
this._usedNameKinds = value;
}
@@ -20508,7 +22144,7 @@
/// Each item of this list is the offset of the name usage relative to the
/// beginning of the file.
- void set usedNameOffsets(List<int> value) {
+ set usedNameOffsets(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedNameOffsets = value;
}
@@ -20519,7 +22155,7 @@
/// Each item of this list is the index into [PackageIndex.strings] for a
/// used name. The list is sorted in ascending order, so that the client can
/// quickly find name uses in this [UnitIndex].
- void set usedNames(List<int> value) {
+ set usedNames(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._usedNames = value;
}
@@ -20552,14 +22188,10 @@
_usedNameOffsets = usedNameOffsets,
_usedNames = usedNames;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addInt(this._unit ?? 0);
if (this._usedElementLengths == null) {
@@ -20969,7 +22601,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this class.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -20977,7 +22609,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the class.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -20987,7 +22619,7 @@
/// Documentation comment for the class, or `null` if there is no
/// documentation comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -20996,7 +22628,7 @@
_executables ??= <UnlinkedExecutableBuilder>[];
/// Executable objects (methods, getters, and setters) contained in the class.
- void set executables(List<UnlinkedExecutableBuilder> value) {
+ set executables(List<UnlinkedExecutableBuilder> value) {
this._executables = value;
}
@@ -21005,7 +22637,7 @@
_fields ??= <UnlinkedVariableBuilder>[];
/// Field declarations contained in the class.
- void set fields(List<UnlinkedVariableBuilder> value) {
+ set fields(List<UnlinkedVariableBuilder> value) {
this._fields = value;
}
@@ -21014,7 +22646,7 @@
/// Indicates whether this class is the core "Object" class (and hence has no
/// supertype)
- void set hasNoSupertype(bool value) {
+ set hasNoSupertype(bool value) {
this._hasNoSupertype = value;
}
@@ -21022,7 +22654,7 @@
List<EntityRefBuilder> get interfaces => _interfaces ??= <EntityRefBuilder>[];
/// Interfaces appearing in an `implements` clause, if any.
- void set interfaces(List<EntityRefBuilder> value) {
+ set interfaces(List<EntityRefBuilder> value) {
this._interfaces = value;
}
@@ -21030,7 +22662,7 @@
bool get isAbstract => _isAbstract ??= false;
/// Indicates whether the class is declared with the `abstract` keyword.
- void set isAbstract(bool value) {
+ set isAbstract(bool value) {
this._isAbstract = value;
}
@@ -21038,7 +22670,7 @@
bool get isMixinApplication => _isMixinApplication ??= false;
/// Indicates whether the class is declared using mixin application syntax.
- void set isMixinApplication(bool value) {
+ set isMixinApplication(bool value) {
this._isMixinApplication = value;
}
@@ -21046,7 +22678,7 @@
List<EntityRefBuilder> get mixins => _mixins ??= <EntityRefBuilder>[];
/// Mixins appearing in a `with` clause, if any.
- void set mixins(List<EntityRefBuilder> value) {
+ set mixins(List<EntityRefBuilder> value) {
this._mixins = value;
}
@@ -21054,7 +22686,7 @@
String get name => _name ??= '';
/// Name of the class.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -21062,7 +22694,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the class name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -21077,7 +22709,7 @@
/// type when specifying the bound of a type parameter.
///
/// Otherwise, zero.
- void set notSimplyBoundedSlot(int value) {
+ set notSimplyBoundedSlot(int value) {
assert(value == null || value >= 0);
this._notSimplyBoundedSlot = value;
}
@@ -21089,7 +22721,7 @@
/// Superclass constraints for this mixin declaration. The list will be empty
/// if this class is not a mixin declaration, or if the declaration does not
/// have an `on` clause (in which case the type `Object` is implied).
- void set superclassConstraints(List<EntityRefBuilder> value) {
+ set superclassConstraints(List<EntityRefBuilder> value) {
this._superclassConstraints = value;
}
@@ -21099,7 +22731,7 @@
/// Names of methods, getters, setters, and operators that this mixin
/// declaration super-invokes. For setters this includes the trailing "=".
/// The list will be empty if this class is not a mixin declaration.
- void set superInvokedNames(List<String> value) {
+ set superInvokedNames(List<String> value) {
this._superInvokedNames = value;
}
@@ -21109,7 +22741,7 @@
/// Supertype of the class, or `null` if either (a) the class doesn't
/// explicitly declare a supertype (and hence has supertype `Object`), or (b)
/// the class *is* `Object` (and hence has no supertype).
- void set supertype(EntityRefBuilder value) {
+ set supertype(EntityRefBuilder value) {
this._supertype = value;
}
@@ -21118,7 +22750,7 @@
_typeParameters ??= <UnlinkedTypeParamBuilder>[];
/// Type parameters of the class, if any.
- void set typeParameters(List<UnlinkedTypeParamBuilder> value) {
+ set typeParameters(List<UnlinkedTypeParamBuilder> value) {
this._typeParameters = value;
}
@@ -21158,9 +22790,7 @@
_supertype = supertype,
_typeParameters = typeParameters;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -21175,9 +22805,7 @@
_typeParameters?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
if (this._executables == null) {
@@ -21597,7 +23225,7 @@
/// If this is a `show` combinator, offset of the end of the list of shown
/// names. Otherwise zero.
- void set end(int value) {
+ set end(int value) {
assert(value == null || value >= 0);
this._end = value;
}
@@ -21606,7 +23234,7 @@
List<String> get hides => _hides ??= <String>[];
/// List of names which are hidden. Empty if this is a `show` combinator.
- void set hides(List<String> value) {
+ set hides(List<String> value) {
this._hides = value;
}
@@ -21615,7 +23243,7 @@
/// If this is a `show` combinator, offset of the `show` keyword. Otherwise
/// zero.
- void set offset(int value) {
+ set offset(int value) {
assert(value == null || value >= 0);
this._offset = value;
}
@@ -21624,7 +23252,7 @@
List<String> get shows => _shows ??= <String>[];
/// List of names which are shown. Empty if this is a `hide` combinator.
- void set shows(List<String> value) {
+ set shows(List<String> value) {
this._shows = value;
}
@@ -21635,17 +23263,13 @@
_offset = offset,
_shows = shows;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_end = null;
_offset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._shows == null) {
signature.addInt(0);
@@ -21777,7 +23401,7 @@
/// The name of the declared variable whose value is being used in the
/// condition.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -21785,7 +23409,7 @@
String get uri => _uri ??= '';
/// The URI of the implementation library to be used if the condition is true.
- void set uri(String value) {
+ set uri(String value) {
this._uri = value;
}
@@ -21794,7 +23418,7 @@
/// The value to which the value of the declared variable will be compared,
/// or `true` if the condition does not include an equality test.
- void set value(String value) {
+ set value(String value) {
this._value = value;
}
@@ -21803,14 +23427,10 @@
_uri = uri,
_value = value;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addString(this._value ?? '');
@@ -21921,7 +23541,7 @@
/// If there are `m` [arguments] and `n` [argumentNames], then each argument
/// from [arguments] with index `i` such that `n + i - m >= 0`, should be used
/// with the name at `n + i - m`.
- void set argumentNames(List<String> value) {
+ set argumentNames(List<String> value) {
this._argumentNames = value;
}
@@ -21931,7 +23551,7 @@
/// If [kind] is `thisInvocation` or `superInvocation`, the arguments of the
/// invocation. Otherwise empty.
- void set arguments(List<UnlinkedExprBuilder> value) {
+ set arguments(List<UnlinkedExprBuilder> value) {
this._arguments = value;
}
@@ -21940,7 +23560,7 @@
/// If [kind] is `field`, the expression of the field initializer.
/// Otherwise `null`.
- void set expression(UnlinkedExprBuilder value) {
+ set expression(UnlinkedExprBuilder value) {
this._expression = value;
}
@@ -21949,7 +23569,7 @@
_kind ??= idl.UnlinkedConstructorInitializerKind.field;
/// The kind of the constructor initializer (field, redirect, super).
- void set kind(idl.UnlinkedConstructorInitializerKind value) {
+ set kind(idl.UnlinkedConstructorInitializerKind value) {
this._kind = value;
}
@@ -21960,7 +23580,7 @@
/// [kind] is `thisInvocation`, the name of the constructor, declared in this
/// class, to redirect to. If [kind] is `superInvocation`, the name of the
/// constructor, declared in the superclass, to invoke.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -21976,17 +23596,13 @@
_kind = kind,
_name = name;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_arguments?.forEach((b) => b.flushInformative());
_expression?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addBool(this._expression != null);
@@ -22159,20 +23775,16 @@
///
/// References appearing within the doc comment in square brackets are not
/// specially encoded.
- void set text(String value) {
+ set text(String value) {
this._text = value;
}
UnlinkedDocumentationCommentBuilder({String text}) : _text = text;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._text ?? '');
}
@@ -22258,7 +23870,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this enum.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -22266,7 +23878,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the enum.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -22276,7 +23888,7 @@
/// Documentation comment for the enum, or `null` if there is no documentation
/// comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -22284,7 +23896,7 @@
String get name => _name ??= '';
/// Name of the enum type.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -22292,7 +23904,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the enum name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -22302,7 +23914,7 @@
_values ??= <UnlinkedEnumValueBuilder>[];
/// Values listed in the enum declaration, in declaration order.
- void set values(List<UnlinkedEnumValueBuilder> value) {
+ set values(List<UnlinkedEnumValueBuilder> value) {
this._values = value;
}
@@ -22320,9 +23932,7 @@
_nameOffset = nameOffset,
_values = values;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -22331,9 +23941,7 @@
_values?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
if (this._values == null) {
@@ -22509,7 +24117,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this value.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -22519,7 +24127,7 @@
/// Documentation comment for the enum value, or `null` if there is no
/// documentation comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -22527,7 +24135,7 @@
String get name => _name ??= '';
/// Name of the enumerated value.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -22535,7 +24143,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the enum value name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -22550,18 +24158,14 @@
_name = name,
_nameOffset = nameOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_documentationComment = null;
_nameOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
if (this._annotations == null) {
@@ -22717,7 +24321,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this executable.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -22727,7 +24331,7 @@
/// If this executable's function body is declared using `=>`, the expression
/// to the right of the `=>`. May be omitted if neither type inference nor
/// constant evaluation depends on the function body.
- void set bodyExpr(UnlinkedExprBuilder value) {
+ set bodyExpr(UnlinkedExprBuilder value) {
this._bodyExpr = value;
}
@@ -22735,7 +24339,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the executable.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -22745,8 +24349,7 @@
/// If a constant [UnlinkedExecutableKind.constructor], the constructor
/// initializers. Otherwise empty.
- void set constantInitializers(
- List<UnlinkedConstructorInitializerBuilder> value) {
+ set constantInitializers(List<UnlinkedConstructorInitializerBuilder> value) {
this._constantInitializers = value;
}
@@ -22759,7 +24362,7 @@
/// a cycle.
///
/// Otherwise, zero.
- void set constCycleSlot(int value) {
+ set constCycleSlot(int value) {
assert(value == null || value >= 0);
this._constCycleSlot = value;
}
@@ -22770,7 +24373,7 @@
/// Documentation comment for the executable, or `null` if there is no
/// documentation comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -22782,7 +24385,7 @@
/// return type. If there is no matching entry in [LinkedUnit.types], then
/// no return type was inferred for this variable, so its static type is
/// `dynamic`.
- void set inferredReturnTypeSlot(int value) {
+ set inferredReturnTypeSlot(int value) {
assert(value == null || value >= 0);
this._inferredReturnTypeSlot = value;
}
@@ -22791,7 +24394,7 @@
bool get isAbstract => _isAbstract ??= false;
/// Indicates whether the executable is declared using the `abstract` keyword.
- void set isAbstract(bool value) {
+ set isAbstract(bool value) {
this._isAbstract = value;
}
@@ -22799,7 +24402,7 @@
bool get isAsynchronous => _isAsynchronous ??= false;
/// Indicates whether the executable has body marked as being asynchronous.
- void set isAsynchronous(bool value) {
+ set isAsynchronous(bool value) {
this._isAsynchronous = value;
}
@@ -22807,7 +24410,7 @@
bool get isConst => _isConst ??= false;
/// Indicates whether the executable is declared using the `const` keyword.
- void set isConst(bool value) {
+ set isConst(bool value) {
this._isConst = value;
}
@@ -22815,7 +24418,7 @@
bool get isExternal => _isExternal ??= false;
/// Indicates whether the executable is declared using the `external` keyword.
- void set isExternal(bool value) {
+ set isExternal(bool value) {
this._isExternal = value;
}
@@ -22823,7 +24426,7 @@
bool get isFactory => _isFactory ??= false;
/// Indicates whether the executable is declared using the `factory` keyword.
- void set isFactory(bool value) {
+ set isFactory(bool value) {
this._isFactory = value;
}
@@ -22831,7 +24434,7 @@
bool get isGenerator => _isGenerator ??= false;
/// Indicates whether the executable has body marked as being a generator.
- void set isGenerator(bool value) {
+ set isGenerator(bool value) {
this._isGenerator = value;
}
@@ -22839,7 +24442,7 @@
bool get isRedirectedConstructor => _isRedirectedConstructor ??= false;
/// Indicates whether the executable is a redirected constructor.
- void set isRedirectedConstructor(bool value) {
+ set isRedirectedConstructor(bool value) {
this._isRedirectedConstructor = value;
}
@@ -22851,7 +24454,7 @@
/// Note that for top level executables, this flag is false, since they are
/// not declared using the `static` keyword (even though they are considered
/// static for semantic purposes).
- void set isStatic(bool value) {
+ set isStatic(bool value) {
this._isStatic = value;
}
@@ -22861,7 +24464,7 @@
/// The kind of the executable (function/method, getter, setter, or
/// constructor).
- void set kind(idl.UnlinkedExecutableKind value) {
+ set kind(idl.UnlinkedExecutableKind value) {
this._kind = value;
}
@@ -22870,7 +24473,7 @@
_localFunctions ??= <UnlinkedExecutableBuilder>[];
/// The list of local functions.
- void set localFunctions(List<UnlinkedExecutableBuilder> value) {
+ set localFunctions(List<UnlinkedExecutableBuilder> value) {
this._localFunctions = value;
}
@@ -22888,7 +24491,7 @@
/// Name of the executable. For setters, this includes the trailing "=". For
/// named constructors, this excludes the class name and excludes the ".".
/// For unnamed constructors, this is the empty string.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -22897,7 +24500,7 @@
/// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
/// the offset of the end of the constructor name. Otherwise zero.
- void set nameEnd(int value) {
+ set nameEnd(int value) {
assert(value == null || value >= 0);
this._nameEnd = value;
}
@@ -22909,7 +24512,7 @@
/// named constructors, this excludes the class name and excludes the ".".
/// For unnamed constructors, this is the offset of the class name (i.e. the
/// offset of the second "C" in "class C { C(); }").
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -22921,7 +24524,7 @@
/// Parameters of the executable, if any. Note that getters have no
/// parameters (hence this will be the empty list), and setters have a single
/// parameter.
- void set parameters(List<UnlinkedParamBuilder> value) {
+ set parameters(List<UnlinkedParamBuilder> value) {
this._parameters = value;
}
@@ -22930,7 +24533,7 @@
/// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
/// the offset of the period before the constructor name. Otherwise zero.
- void set periodOffset(int value) {
+ set periodOffset(int value) {
assert(value == null || value >= 0);
this._periodOffset = value;
}
@@ -22940,7 +24543,7 @@
/// If [isRedirectedConstructor] and [isFactory] are both `true`, the
/// constructor to which this constructor redirects; otherwise empty.
- void set redirectedConstructor(EntityRefBuilder value) {
+ set redirectedConstructor(EntityRefBuilder value) {
this._redirectedConstructor = value;
}
@@ -22950,7 +24553,7 @@
/// If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the
/// name of the constructor that this constructor redirects to; otherwise
/// empty.
- void set redirectedConstructorName(String value) {
+ set redirectedConstructorName(String value) {
this._redirectedConstructorName = value;
}
@@ -22962,7 +24565,7 @@
/// associated with variable initializers and closures, since these
/// executables may have return types that are not accessible via direct
/// imports.
- void set returnType(EntityRefBuilder value) {
+ set returnType(EntityRefBuilder value) {
this._returnType = value;
}
@@ -22972,7 +24575,7 @@
/// Type parameters of the executable, if any. Empty if support for generic
/// method syntax is disabled.
- void set typeParameters(List<UnlinkedTypeParamBuilder> value) {
+ set typeParameters(List<UnlinkedTypeParamBuilder> value) {
this._typeParameters = value;
}
@@ -22980,7 +24583,7 @@
int get visibleLength => _visibleLength ??= 0;
/// If a local function, the length of the visible range; zero otherwise.
- void set visibleLength(int value) {
+ set visibleLength(int value) {
assert(value == null || value >= 0);
this._visibleLength = value;
}
@@ -22989,7 +24592,7 @@
int get visibleOffset => _visibleOffset ??= 0;
/// If a local function, the beginning of the visible range; zero otherwise.
- void set visibleOffset(int value) {
+ set visibleOffset(int value) {
assert(value == null || value >= 0);
this._visibleOffset = value;
}
@@ -23052,9 +24655,7 @@
_visibleLength = visibleLength,
_visibleOffset = visibleOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_bodyExpr?.flushInformative();
@@ -23075,9 +24676,7 @@
_visibleOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
if (this._parameters == null) {
@@ -23626,7 +25225,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this export directive.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -23634,7 +25233,7 @@
int get offset => _offset ??= 0;
/// Offset of the "export" keyword.
- void set offset(int value) {
+ set offset(int value) {
assert(value == null || value >= 0);
this._offset = value;
}
@@ -23644,7 +25243,7 @@
/// End of the URI string (including quotes) relative to the beginning of the
/// file.
- void set uriEnd(int value) {
+ set uriEnd(int value) {
assert(value == null || value >= 0);
this._uriEnd = value;
}
@@ -23654,7 +25253,7 @@
/// Offset of the URI string (including quotes) relative to the beginning of
/// the file.
- void set uriOffset(int value) {
+ set uriOffset(int value) {
assert(value == null || value >= 0);
this._uriOffset = value;
}
@@ -23669,9 +25268,7 @@
_uriEnd = uriEnd,
_uriOffset = uriOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_offset = null;
@@ -23679,9 +25276,7 @@
_uriOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._annotations == null) {
signature.addInt(0);
@@ -23803,7 +25398,7 @@
_combinators ??= <UnlinkedCombinatorBuilder>[];
/// Combinators contained in this export declaration.
- void set combinators(List<UnlinkedCombinatorBuilder> value) {
+ set combinators(List<UnlinkedCombinatorBuilder> value) {
this._combinators = value;
}
@@ -23813,7 +25408,7 @@
/// Configurations used to control which library will actually be loaded at
/// run-time.
- void set configurations(List<UnlinkedConfigurationBuilder> value) {
+ set configurations(List<UnlinkedConfigurationBuilder> value) {
this._configurations = value;
}
@@ -23821,7 +25416,7 @@
String get uri => _uri ??= '';
/// URI used in the source code to reference the exported library.
- void set uri(String value) {
+ set uri(String value) {
this._uri = value;
}
@@ -23833,17 +25428,13 @@
_configurations = configurations,
_uri = uri;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_combinators?.forEach((b) => b.flushInformative());
_configurations?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uri ?? '');
if (this._combinators == null) {
@@ -23979,7 +25570,7 @@
_assignmentOperators ??= <idl.UnlinkedExprAssignOperator>[];
/// Sequence of operators used by assignment operations.
- void set assignmentOperators(List<idl.UnlinkedExprAssignOperator> value) {
+ set assignmentOperators(List<idl.UnlinkedExprAssignOperator> value) {
this._assignmentOperators = value;
}
@@ -23987,7 +25578,7 @@
List<double> get doubles => _doubles ??= <double>[];
/// Sequence of 64-bit doubles consumed by the operation `pushDouble`.
- void set doubles(List<double> value) {
+ set doubles(List<double> value) {
this._doubles = value;
}
@@ -23997,7 +25588,7 @@
/// Sequence of unsigned 32-bit integers consumed by the operations
/// `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
/// `makeList`, and `makeMap`.
- void set ints(List<int> value) {
+ set ints(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._ints = value;
}
@@ -24007,7 +25598,7 @@
/// Indicates whether the expression is a valid potentially constant
/// expression.
- void set isValidConst(bool value) {
+ set isValidConst(bool value) {
this._isValidConst = value;
}
@@ -24017,7 +25608,7 @@
/// Sequence of operations to execute (starting with an empty stack) to form
/// the constant value.
- void set operations(List<idl.UnlinkedExprOperation> value) {
+ set operations(List<idl.UnlinkedExprOperation> value) {
this._operations = value;
}
@@ -24028,7 +25619,7 @@
/// `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
/// that in the case of `pushReference` (and sometimes `invokeConstructor` the
/// actual entity being referred to may be something other than a type.
- void set references(List<EntityRefBuilder> value) {
+ set references(List<EntityRefBuilder> value) {
this._references = value;
}
@@ -24037,7 +25628,7 @@
/// String representation of the expression in a form suitable to be tokenized
/// and parsed.
- void set sourceRepresentation(String value) {
+ set sourceRepresentation(String value) {
this._sourceRepresentation = value;
}
@@ -24046,7 +25637,7 @@
/// Sequence of strings consumed by the operations `pushString` and
/// `invokeConstructor`.
- void set strings(List<String> value) {
+ set strings(List<String> value) {
this._strings = value;
}
@@ -24068,16 +25659,12 @@
_sourceRepresentation = sourceRepresentation,
_strings = strings;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_references?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._operations == null) {
signature.addInt(0);
@@ -24341,7 +25928,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this import declaration.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -24350,7 +25937,7 @@
_combinators ??= <UnlinkedCombinatorBuilder>[];
/// Combinators contained in this import declaration.
- void set combinators(List<UnlinkedCombinatorBuilder> value) {
+ set combinators(List<UnlinkedCombinatorBuilder> value) {
this._combinators = value;
}
@@ -24360,7 +25947,7 @@
/// Configurations used to control which library will actually be loaded at
/// run-time.
- void set configurations(List<UnlinkedConfigurationBuilder> value) {
+ set configurations(List<UnlinkedConfigurationBuilder> value) {
this._configurations = value;
}
@@ -24368,7 +25955,7 @@
bool get isDeferred => _isDeferred ??= false;
/// Indicates whether the import declaration uses the `deferred` keyword.
- void set isDeferred(bool value) {
+ set isDeferred(bool value) {
this._isDeferred = value;
}
@@ -24376,7 +25963,7 @@
bool get isImplicit => _isImplicit ??= false;
/// Indicates whether the import declaration is implicit.
- void set isImplicit(bool value) {
+ set isImplicit(bool value) {
this._isImplicit = value;
}
@@ -24385,7 +25972,7 @@
/// If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
/// is true, zero.
- void set offset(int value) {
+ set offset(int value) {
assert(value == null || value >= 0);
this._offset = value;
}
@@ -24395,7 +25982,7 @@
/// Offset of the prefix name relative to the beginning of the file, or zero
/// if there is no prefix.
- void set prefixOffset(int value) {
+ set prefixOffset(int value) {
assert(value == null || value >= 0);
this._prefixOffset = value;
}
@@ -24407,7 +25994,7 @@
/// import declaration, or zero if this import declaration declares no prefix.
///
/// Note that multiple imports can declare the same prefix.
- void set prefixReference(int value) {
+ set prefixReference(int value) {
assert(value == null || value >= 0);
this._prefixReference = value;
}
@@ -24416,7 +26003,7 @@
String get uri => _uri ??= '';
/// URI used in the source code to reference the imported library.
- void set uri(String value) {
+ set uri(String value) {
this._uri = value;
}
@@ -24425,7 +26012,7 @@
/// End of the URI string (including quotes) relative to the beginning of the
/// file. If [isImplicit] is true, zero.
- void set uriEnd(int value) {
+ set uriEnd(int value) {
assert(value == null || value >= 0);
this._uriEnd = value;
}
@@ -24435,7 +26022,7 @@
/// Offset of the URI string (including quotes) relative to the beginning of
/// the file. If [isImplicit] is true, zero.
- void set uriOffset(int value) {
+ set uriOffset(int value) {
assert(value == null || value >= 0);
this._uriOffset = value;
}
@@ -24464,9 +26051,7 @@
_uriEnd = uriEnd,
_uriOffset = uriOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_combinators?.forEach((b) => b.flushInformative());
@@ -24477,9 +26062,7 @@
_uriOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._uri ?? '');
if (this._combinators == null) {
@@ -24740,7 +26323,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this parameter.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -24748,7 +26331,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the parameter.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -24757,7 +26340,7 @@
/// If the parameter has a default value, the source text of the constant
/// expression in the default value. Otherwise the empty string.
- void set defaultValueCode(String value) {
+ set defaultValueCode(String value) {
this._defaultValueCode = value;
}
@@ -24773,7 +26356,7 @@
/// inferable, they are not marked as such in the summary; if their type is
/// not specified, they always inherit the static type of the corresponding
/// field.
- void set inferredTypeSlot(int value) {
+ set inferredTypeSlot(int value) {
assert(value == null || value >= 0);
this._inferredTypeSlot = value;
}
@@ -24787,7 +26370,7 @@
/// `@covariant` behavior from a base class.
///
/// Otherwise, zero.
- void set inheritsCovariantSlot(int value) {
+ set inheritsCovariantSlot(int value) {
assert(value == null || value >= 0);
this._inheritsCovariantSlot = value;
}
@@ -24797,7 +26380,7 @@
/// The synthetic initializer function of the parameter. Absent if the
/// variable does not have an initializer.
- void set initializer(UnlinkedExecutableBuilder value) {
+ set initializer(UnlinkedExecutableBuilder value) {
this._initializer = value;
}
@@ -24805,7 +26388,7 @@
bool get isExplicitlyCovariant => _isExplicitlyCovariant ??= false;
/// Indicates whether this parameter is explicitly marked as being covariant.
- void set isExplicitlyCovariant(bool value) {
+ set isExplicitlyCovariant(bool value) {
this._isExplicitlyCovariant = value;
}
@@ -24813,7 +26396,7 @@
bool get isFinal => _isFinal ??= false;
/// Indicates whether the parameter is declared using the `final` keyword.
- void set isFinal(bool value) {
+ set isFinal(bool value) {
this._isFinal = value;
}
@@ -24828,7 +26411,7 @@
/// ```
/// but is not function-typed if it does not, even if the type of the
/// parameter is a function type.
- void set isFunctionTyped(bool value) {
+ set isFunctionTyped(bool value) {
this._isFunctionTyped = value;
}
@@ -24837,15 +26420,16 @@
/// Indicates whether this is an initializing formal parameter (i.e. it is
/// declared using `this.` syntax).
- void set isInitializingFormal(bool value) {
+ set isInitializingFormal(bool value) {
this._isInitializingFormal = value;
}
@override
- idl.UnlinkedParamKind get kind => _kind ??= idl.UnlinkedParamKind.required;
+ idl.UnlinkedParamKind get kind =>
+ _kind ??= idl.UnlinkedParamKind.requiredPositional;
/// Kind of the parameter.
- void set kind(idl.UnlinkedParamKind value) {
+ set kind(idl.UnlinkedParamKind value) {
this._kind = value;
}
@@ -24853,7 +26437,7 @@
String get name => _name ??= '';
/// Name of the parameter.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -24861,7 +26445,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the parameter name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -24871,7 +26455,7 @@
_parameters ??= <UnlinkedParamBuilder>[];
/// If [isFunctionTyped] is `true`, the parameters of the function type.
- void set parameters(List<UnlinkedParamBuilder> value) {
+ set parameters(List<UnlinkedParamBuilder> value) {
this._parameters = value;
}
@@ -24881,7 +26465,7 @@
/// If [isFunctionTyped] is `true`, the declared return type. If
/// [isFunctionTyped] is `false`, the declared type. Absent if the type is
/// implicit.
- void set type(EntityRefBuilder value) {
+ set type(EntityRefBuilder value) {
this._type = value;
}
@@ -24889,7 +26473,7 @@
int get visibleLength => _visibleLength ??= 0;
/// The length of the visible range.
- void set visibleLength(int value) {
+ set visibleLength(int value) {
assert(value == null || value >= 0);
this._visibleLength = value;
}
@@ -24898,7 +26482,7 @@
int get visibleOffset => _visibleOffset ??= 0;
/// The beginning of the visible range.
- void set visibleOffset(int value) {
+ set visibleOffset(int value) {
assert(value == null || value >= 0);
this._visibleOffset = value;
}
@@ -24939,9 +26523,7 @@
_visibleLength = visibleLength,
_visibleOffset = visibleOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -24954,9 +26536,7 @@
_visibleOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addInt(this._inferredTypeSlot ?? 0);
@@ -25050,7 +26630,7 @@
if (_isInitializingFormal == true) {
fbBuilder.addBool(6, true);
}
- if (_kind != null && _kind != idl.UnlinkedParamKind.required) {
+ if (_kind != null && _kind != idl.UnlinkedParamKind.requiredPositional) {
fbBuilder.addUint8(4, _kind.index);
}
if (offset_name != null) {
@@ -25181,7 +26761,7 @@
@override
idl.UnlinkedParamKind get kind {
_kind ??= const _UnlinkedParamKindReader()
- .vTableGet(_bc, _bcOffset, 4, idl.UnlinkedParamKind.required);
+ .vTableGet(_bc, _bcOffset, 4, idl.UnlinkedParamKind.requiredPositional);
return _kind;
}
@@ -25243,7 +26823,7 @@
if (isFunctionTyped != false) _result["isFunctionTyped"] = isFunctionTyped;
if (isInitializingFormal != false)
_result["isInitializingFormal"] = isInitializingFormal;
- if (kind != idl.UnlinkedParamKind.required)
+ if (kind != idl.UnlinkedParamKind.requiredPositional)
_result["kind"] = kind.toString().split('.')[1];
if (name != '') _result["name"] = name;
if (nameOffset != 0) _result["nameOffset"] = nameOffset;
@@ -25293,7 +26873,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this part declaration.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -25302,7 +26882,7 @@
/// End of the URI string (including quotes) relative to the beginning of the
/// file.
- void set uriEnd(int value) {
+ set uriEnd(int value) {
assert(value == null || value >= 0);
this._uriEnd = value;
}
@@ -25312,7 +26892,7 @@
/// Offset of the URI string (including quotes) relative to the beginning of
/// the file.
- void set uriOffset(int value) {
+ set uriOffset(int value) {
assert(value == null || value >= 0);
this._uriOffset = value;
}
@@ -25323,18 +26903,14 @@
_uriEnd = uriEnd,
_uriOffset = uriOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_uriEnd = null;
_uriOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._annotations == null) {
signature.addInt(0);
@@ -25442,7 +27018,7 @@
idl.ReferenceKind get kind => _kind ??= idl.ReferenceKind.classOrEnum;
/// The kind of object referred to by the name.
- void set kind(idl.ReferenceKind value) {
+ set kind(idl.ReferenceKind value) {
this._kind = value;
}
@@ -25456,7 +27032,7 @@
///
/// Unnamed constructors are not included since they do not constitute a
/// separate name added to any namespace.
- void set members(List<UnlinkedPublicNameBuilder> value) {
+ set members(List<UnlinkedPublicNameBuilder> value) {
this._members = value;
}
@@ -25464,7 +27040,7 @@
String get name => _name ??= '';
/// The name itself.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -25473,7 +27049,7 @@
/// If the entity being referred to is generic, the number of type parameters
/// it accepts. Otherwise zero.
- void set numTypeParameters(int value) {
+ set numTypeParameters(int value) {
assert(value == null || value >= 0);
this._numTypeParameters = value;
}
@@ -25488,16 +27064,12 @@
_name = name,
_numTypeParameters = numTypeParameters;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_members?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addInt(this._kind == null ? 0 : this._kind.index);
@@ -25628,7 +27200,7 @@
_exports ??= <UnlinkedExportPublicBuilder>[];
/// Export declarations in the compilation unit.
- void set exports(List<UnlinkedExportPublicBuilder> value) {
+ set exports(List<UnlinkedExportPublicBuilder> value) {
this._exports = value;
}
@@ -25640,7 +27212,7 @@
///
/// TODO(paulberry): consider sorting these names to reduce unnecessary
/// relinking.
- void set names(List<UnlinkedPublicNameBuilder> value) {
+ set names(List<UnlinkedPublicNameBuilder> value) {
this._names = value;
}
@@ -25648,7 +27220,7 @@
List<String> get parts => _parts ??= <String>[];
/// URIs referenced by part declarations in the compilation unit.
- void set parts(List<String> value) {
+ set parts(List<String> value) {
this._parts = value;
}
@@ -25660,17 +27232,13 @@
_names = names,
_parts = parts;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_exports?.forEach((b) => b.flushInformative());
_names?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._names == null) {
signature.addInt(0);
@@ -25819,7 +27387,7 @@
/// Name of the entity being referred to. For the pseudo-type `dynamic`, the
/// string is "dynamic". For the pseudo-type `void`, the string is "void".
/// For the pseudo-type `bottom`, the string is "*bottom*".
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -25832,7 +27400,7 @@
/// Prefix references must always point backward; that is, for all i, if
/// UnlinkedUnit.references[i].prefixReference != 0, then
/// UnlinkedUnit.references[i].prefixReference < i.
- void set prefixReference(int value) {
+ set prefixReference(int value) {
assert(value == null || value >= 0);
this._prefixReference = value;
}
@@ -25841,14 +27409,10 @@
: _name = name,
_prefixReference = prefixReference;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addInt(this._prefixReference ?? 0);
@@ -25940,7 +27504,7 @@
/// The token that corresponds to this token, or `0` if this token is not
/// the first of a pair of matching tokens (such as parentheses).
- void set endGroup(List<int> value) {
+ set endGroup(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._endGroup = value;
}
@@ -25951,21 +27515,21 @@
/// Return `true` if this token is a synthetic token. A synthetic token is a
/// token that was introduced by the parser in order to recover from an error
/// in the code.
- void set isSynthetic(List<bool> value) {
+ set isSynthetic(List<bool> value) {
this._isSynthetic = value;
}
@override
List<idl.UnlinkedTokenKind> get kind => _kind ??= <idl.UnlinkedTokenKind>[];
- void set kind(List<idl.UnlinkedTokenKind> value) {
+ set kind(List<idl.UnlinkedTokenKind> value) {
this._kind = value;
}
@override
List<int> get length => _length ??= <int>[];
- void set length(List<int> value) {
+ set length(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._length = value;
}
@@ -25973,7 +27537,7 @@
@override
List<String> get lexeme => _lexeme ??= <String>[];
- void set lexeme(List<String> value) {
+ set lexeme(List<String> value) {
this._lexeme = value;
}
@@ -25982,7 +27546,7 @@
/// The next token in the token stream, `0` for [UnlinkedTokenType.EOF] or
/// the last comment token.
- void set next(List<int> value) {
+ set next(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._next = value;
}
@@ -25990,7 +27554,7 @@
@override
List<int> get offset => _offset ??= <int>[];
- void set offset(List<int> value) {
+ set offset(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._offset = value;
}
@@ -26002,7 +27566,7 @@
/// or `0` if there are no comments preceding this token. Additional comments
/// can be reached by following the token stream using [next] until `0` is
/// reached.
- void set precedingComment(List<int> value) {
+ set precedingComment(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._precedingComment = value;
}
@@ -26010,7 +27574,7 @@
@override
List<idl.UnlinkedTokenType> get type => _type ??= <idl.UnlinkedTokenType>[];
- void set type(List<idl.UnlinkedTokenType> value) {
+ set type(List<idl.UnlinkedTokenType> value) {
this._type = value;
}
@@ -26034,14 +27598,10 @@
_precedingComment = precedingComment,
_type = type;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
if (this._endGroup == null) {
signature.addInt(0);
@@ -26338,7 +27898,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this typedef.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -26346,7 +27906,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the typedef.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -26356,7 +27916,7 @@
/// Documentation comment for the typedef, or `null` if there is no
/// documentation comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -26364,7 +27924,7 @@
String get name => _name ??= '';
/// Name of the typedef.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -26372,7 +27932,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the typedef name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -26387,7 +27947,7 @@
/// raw type when specifying the bound of a type parameter.
///
/// Otherwise, zero.
- void set notSimplyBoundedSlot(int value) {
+ set notSimplyBoundedSlot(int value) {
assert(value == null || value >= 0);
this._notSimplyBoundedSlot = value;
}
@@ -26397,7 +27957,7 @@
_parameters ??= <UnlinkedParamBuilder>[];
/// Parameters of the executable, if any.
- void set parameters(List<UnlinkedParamBuilder> value) {
+ set parameters(List<UnlinkedParamBuilder> value) {
this._parameters = value;
}
@@ -26407,7 +27967,7 @@
/// If [style] is [TypedefStyle.functionType], the return type of the typedef.
/// If [style] is [TypedefStyle.genericFunctionType], the function type being
/// defined.
- void set returnType(EntityRefBuilder value) {
+ set returnType(EntityRefBuilder value) {
this._returnType = value;
}
@@ -26415,7 +27975,7 @@
idl.TypedefStyle get style => _style ??= idl.TypedefStyle.functionType;
/// The style of the typedef.
- void set style(idl.TypedefStyle value) {
+ set style(idl.TypedefStyle value) {
this._style = value;
}
@@ -26424,7 +27984,7 @@
_typeParameters ??= <UnlinkedTypeParamBuilder>[];
/// Type parameters of the typedef, if any.
- void set typeParameters(List<UnlinkedTypeParamBuilder> value) {
+ set typeParameters(List<UnlinkedTypeParamBuilder> value) {
this._typeParameters = value;
}
@@ -26450,9 +28010,7 @@
_style = style,
_typeParameters = typeParameters;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -26463,9 +28021,7 @@
_typeParameters?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addBool(this._returnType != null);
@@ -26720,7 +28276,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this type parameter.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -26729,7 +28285,7 @@
/// Bound of the type parameter, if a bound is explicitly declared. Otherwise
/// null.
- void set bound(EntityRefBuilder value) {
+ set bound(EntityRefBuilder value) {
this._bound = value;
}
@@ -26737,7 +28293,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the type parameter.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -26745,7 +28301,7 @@
String get name => _name ??= '';
/// Name of the type parameter.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -26753,7 +28309,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the type parameter name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -26770,9 +28326,7 @@
_name = name,
_nameOffset = nameOffset;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_bound?.flushInformative();
@@ -26780,9 +28334,7 @@
_nameOffset = null;
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addBool(this._bound != null);
@@ -26947,7 +28499,7 @@
/// MD5 hash of the non-informative fields of the [UnlinkedUnit] (not
/// including this one) as 16 unsigned 8-bit integer values. This can be used
/// to identify when the API of a unit may have changed.
- void set apiSignature(List<int> value) {
+ set apiSignature(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._apiSignature = value;
}
@@ -26957,7 +28509,7 @@
_classes ??= <UnlinkedClassBuilder>[];
/// Classes declared in the compilation unit.
- void set classes(List<UnlinkedClassBuilder> value) {
+ set classes(List<UnlinkedClassBuilder> value) {
this._classes = value;
}
@@ -26965,7 +28517,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the unit.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -26973,7 +28525,7 @@
List<UnlinkedEnumBuilder> get enums => _enums ??= <UnlinkedEnumBuilder>[];
/// Enums declared in the compilation unit.
- void set enums(List<UnlinkedEnumBuilder> value) {
+ set enums(List<UnlinkedEnumBuilder> value) {
this._enums = value;
}
@@ -26983,7 +28535,7 @@
/// Top level executable objects (functions, getters, and setters) declared in
/// the compilation unit.
- void set executables(List<UnlinkedExecutableBuilder> value) {
+ set executables(List<UnlinkedExecutableBuilder> value) {
this._executables = value;
}
@@ -26992,7 +28544,7 @@
_exports ??= <UnlinkedExportNonPublicBuilder>[];
/// Export declarations in the compilation unit.
- void set exports(List<UnlinkedExportNonPublicBuilder> value) {
+ set exports(List<UnlinkedExportNonPublicBuilder> value) {
this._exports = value;
}
@@ -27005,7 +28557,7 @@
_imports ??= <UnlinkedImportBuilder>[];
/// Import declarations in the compilation unit.
- void set imports(List<UnlinkedImportBuilder> value) {
+ set imports(List<UnlinkedImportBuilder> value) {
this._imports = value;
}
@@ -27013,7 +28565,7 @@
bool get isPartOf => _isPartOf ??= false;
/// Indicates whether the unit contains a "part of" declaration.
- void set isPartOf(bool value) {
+ set isPartOf(bool value) {
this._isPartOf = value;
}
@@ -27023,7 +28575,7 @@
/// Annotations for the library declaration, or the empty list if there is no
/// library declaration.
- void set libraryAnnotations(List<UnlinkedExprBuilder> value) {
+ set libraryAnnotations(List<UnlinkedExprBuilder> value) {
this._libraryAnnotations = value;
}
@@ -27033,8 +28585,7 @@
/// Documentation comment for the library, or `null` if there is no
/// documentation comment.
- void set libraryDocumentationComment(
- UnlinkedDocumentationCommentBuilder value) {
+ set libraryDocumentationComment(UnlinkedDocumentationCommentBuilder value) {
this._libraryDocumentationComment = value;
}
@@ -27042,7 +28593,7 @@
String get libraryName => _libraryName ??= '';
/// Name of the library (from a "library" declaration, if present).
- void set libraryName(String value) {
+ set libraryName(String value) {
this._libraryName = value;
}
@@ -27051,7 +28602,7 @@
/// Length of the library name as it appears in the source code (or 0 if the
/// library has no name).
- void set libraryNameLength(int value) {
+ set libraryNameLength(int value) {
assert(value == null || value >= 0);
this._libraryNameLength = value;
}
@@ -27061,7 +28612,7 @@
/// Offset of the library name relative to the beginning of the file (or 0 if
/// the library has no name).
- void set libraryNameOffset(int value) {
+ set libraryNameOffset(int value) {
assert(value == null || value >= 0);
this._libraryNameOffset = value;
}
@@ -27070,7 +28621,7 @@
List<int> get lineStarts => _lineStarts ??= <int>[];
/// Offsets of the first character of each line in the source code.
- void set lineStarts(List<int> value) {
+ set lineStarts(List<int> value) {
assert(value == null || value.every((e) => e >= 0));
this._lineStarts = value;
}
@@ -27079,7 +28630,7 @@
List<UnlinkedClassBuilder> get mixins => _mixins ??= <UnlinkedClassBuilder>[];
/// Mixins declared in the compilation unit.
- void set mixins(List<UnlinkedClassBuilder> value) {
+ set mixins(List<UnlinkedClassBuilder> value) {
this._mixins = value;
}
@@ -27087,7 +28638,7 @@
List<UnlinkedPartBuilder> get parts => _parts ??= <UnlinkedPartBuilder>[];
/// Part declarations in the compilation unit.
- void set parts(List<UnlinkedPartBuilder> value) {
+ set parts(List<UnlinkedPartBuilder> value) {
this._parts = value;
}
@@ -27095,7 +28646,7 @@
UnlinkedPublicNamespaceBuilder get publicNamespace => _publicNamespace;
/// Unlinked public namespace of this compilation unit.
- void set publicNamespace(UnlinkedPublicNamespaceBuilder value) {
+ set publicNamespace(UnlinkedPublicNamespaceBuilder value) {
this._publicNamespace = value;
}
@@ -27108,7 +28659,7 @@
/// the absence of a reference in places where a reference is optional (for
/// example [UnlinkedReference.prefixReference or
/// UnlinkedImport.prefixReference]).
- void set references(List<UnlinkedReferenceBuilder> value) {
+ set references(List<UnlinkedReferenceBuilder> value) {
this._references = value;
}
@@ -27117,7 +28668,7 @@
_typedefs ??= <UnlinkedTypedefBuilder>[];
/// Typedefs declared in the compilation unit.
- void set typedefs(List<UnlinkedTypedefBuilder> value) {
+ set typedefs(List<UnlinkedTypedefBuilder> value) {
this._typedefs = value;
}
@@ -27126,7 +28677,7 @@
_variables ??= <UnlinkedVariableBuilder>[];
/// Top level variables declared in the compilation unit.
- void set variables(List<UnlinkedVariableBuilder> value) {
+ set variables(List<UnlinkedVariableBuilder> value) {
this._variables = value;
}
@@ -27172,9 +28723,7 @@
_typedefs = typedefs,
_variables = variables;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_classes?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -27195,9 +28744,7 @@
_variables?.forEach((b) => b.flushInformative());
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addBool(this._publicNamespace != null);
this._publicNamespace?.collectApiSignature(signature);
@@ -27722,6 +29269,272 @@
String toString() => convert.json.encode(toJson());
}
+class UnlinkedUnit2Builder extends Object
+ with _UnlinkedUnit2Mixin
+ implements idl.UnlinkedUnit2 {
+ List<int> _apiSignature;
+ List<String> _exports;
+ List<String> _imports;
+ bool _isPartOf;
+ List<int> _lineStarts;
+ List<String> _parts;
+
+ @override
+ List<int> get apiSignature => _apiSignature ??= <int>[];
+
+ /// The MD5 hash signature of the API portion of this unit. It depends on all
+ /// tokens that might affect APIs of declarations in the unit.
+ set apiSignature(List<int> value) {
+ assert(value == null || value.every((e) => e >= 0));
+ this._apiSignature = value;
+ }
+
+ @override
+ List<String> get exports => _exports ??= <String>[];
+
+ /// URIs of `export` directives.
+ set exports(List<String> value) {
+ this._exports = value;
+ }
+
+ @override
+ List<String> get imports => _imports ??= <String>[];
+
+ /// URIs of `import` directives.
+ set imports(List<String> value) {
+ this._imports = value;
+ }
+
+ @override
+ bool get isPartOf => _isPartOf ??= false;
+
+ /// Is `true` if the unit contains a `part of` directive.
+ set isPartOf(bool value) {
+ this._isPartOf = value;
+ }
+
+ @override
+ List<int> get lineStarts => _lineStarts ??= <int>[];
+
+ /// Offsets of the first character of each line in the source code.
+ set lineStarts(List<int> value) {
+ assert(value == null || value.every((e) => e >= 0));
+ this._lineStarts = value;
+ }
+
+ @override
+ List<String> get parts => _parts ??= <String>[];
+
+ /// URIs of `part` directives.
+ set parts(List<String> value) {
+ this._parts = value;
+ }
+
+ UnlinkedUnit2Builder(
+ {List<int> apiSignature,
+ List<String> exports,
+ List<String> imports,
+ bool isPartOf,
+ List<int> lineStarts,
+ List<String> parts})
+ : _apiSignature = apiSignature,
+ _exports = exports,
+ _imports = imports,
+ _isPartOf = isPartOf,
+ _lineStarts = lineStarts,
+ _parts = parts;
+
+ /// Flush [informative] data recursively.
+ void flushInformative() {
+ _lineStarts = null;
+ }
+
+ /// Accumulate non-[informative] data into [signature].
+ void collectApiSignature(api_sig.ApiSignature signature) {
+ if (this._apiSignature == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._apiSignature.length);
+ for (var x in this._apiSignature) {
+ signature.addInt(x);
+ }
+ }
+ if (this._exports == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._exports.length);
+ for (var x in this._exports) {
+ signature.addString(x);
+ }
+ }
+ if (this._imports == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._imports.length);
+ for (var x in this._imports) {
+ signature.addString(x);
+ }
+ }
+ signature.addBool(this._isPartOf == true);
+ if (this._parts == null) {
+ signature.addInt(0);
+ } else {
+ signature.addInt(this._parts.length);
+ for (var x in this._parts) {
+ signature.addString(x);
+ }
+ }
+ }
+
+ List<int> toBuffer() {
+ fb.Builder fbBuilder = new fb.Builder();
+ return fbBuilder.finish(finish(fbBuilder), "UUN2");
+ }
+
+ fb.Offset finish(fb.Builder fbBuilder) {
+ fb.Offset offset_apiSignature;
+ fb.Offset offset_exports;
+ fb.Offset offset_imports;
+ fb.Offset offset_lineStarts;
+ fb.Offset offset_parts;
+ if (!(_apiSignature == null || _apiSignature.isEmpty)) {
+ offset_apiSignature = fbBuilder.writeListUint32(_apiSignature);
+ }
+ if (!(_exports == null || _exports.isEmpty)) {
+ offset_exports = fbBuilder
+ .writeList(_exports.map((b) => fbBuilder.writeString(b)).toList());
+ }
+ if (!(_imports == null || _imports.isEmpty)) {
+ offset_imports = fbBuilder
+ .writeList(_imports.map((b) => fbBuilder.writeString(b)).toList());
+ }
+ if (!(_lineStarts == null || _lineStarts.isEmpty)) {
+ offset_lineStarts = fbBuilder.writeListUint32(_lineStarts);
+ }
+ if (!(_parts == null || _parts.isEmpty)) {
+ offset_parts = fbBuilder
+ .writeList(_parts.map((b) => fbBuilder.writeString(b)).toList());
+ }
+ fbBuilder.startTable();
+ if (offset_apiSignature != null) {
+ fbBuilder.addOffset(0, offset_apiSignature);
+ }
+ if (offset_exports != null) {
+ fbBuilder.addOffset(1, offset_exports);
+ }
+ if (offset_imports != null) {
+ fbBuilder.addOffset(2, offset_imports);
+ }
+ if (_isPartOf == true) {
+ fbBuilder.addBool(3, true);
+ }
+ if (offset_lineStarts != null) {
+ fbBuilder.addOffset(5, offset_lineStarts);
+ }
+ if (offset_parts != null) {
+ fbBuilder.addOffset(4, offset_parts);
+ }
+ return fbBuilder.endTable();
+ }
+}
+
+idl.UnlinkedUnit2 readUnlinkedUnit2(List<int> buffer) {
+ fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
+ return const _UnlinkedUnit2Reader().read(rootRef, 0);
+}
+
+class _UnlinkedUnit2Reader extends fb.TableReader<_UnlinkedUnit2Impl> {
+ const _UnlinkedUnit2Reader();
+
+ @override
+ _UnlinkedUnit2Impl createObject(fb.BufferContext bc, int offset) =>
+ new _UnlinkedUnit2Impl(bc, offset);
+}
+
+class _UnlinkedUnit2Impl extends Object
+ with _UnlinkedUnit2Mixin
+ implements idl.UnlinkedUnit2 {
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ _UnlinkedUnit2Impl(this._bc, this._bcOffset);
+
+ List<int> _apiSignature;
+ List<String> _exports;
+ List<String> _imports;
+ bool _isPartOf;
+ List<int> _lineStarts;
+ List<String> _parts;
+
+ @override
+ List<int> get apiSignature {
+ _apiSignature ??=
+ const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 0, const <int>[]);
+ return _apiSignature;
+ }
+
+ @override
+ List<String> get exports {
+ _exports ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 1, const <String>[]);
+ return _exports;
+ }
+
+ @override
+ List<String> get imports {
+ _imports ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 2, const <String>[]);
+ return _imports;
+ }
+
+ @override
+ bool get isPartOf {
+ _isPartOf ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 3, false);
+ return _isPartOf;
+ }
+
+ @override
+ List<int> get lineStarts {
+ _lineStarts ??=
+ const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 5, const <int>[]);
+ return _lineStarts;
+ }
+
+ @override
+ List<String> get parts {
+ _parts ??= const fb.ListReader<String>(const fb.StringReader())
+ .vTableGet(_bc, _bcOffset, 4, const <String>[]);
+ return _parts;
+ }
+}
+
+abstract class _UnlinkedUnit2Mixin implements idl.UnlinkedUnit2 {
+ @override
+ Map<String, Object> toJson() {
+ Map<String, Object> _result = <String, Object>{};
+ if (apiSignature.isNotEmpty) _result["apiSignature"] = apiSignature;
+ if (exports.isNotEmpty) _result["exports"] = exports;
+ if (imports.isNotEmpty) _result["imports"] = imports;
+ if (isPartOf != false) _result["isPartOf"] = isPartOf;
+ if (lineStarts.isNotEmpty) _result["lineStarts"] = lineStarts;
+ if (parts.isNotEmpty) _result["parts"] = parts;
+ return _result;
+ }
+
+ @override
+ Map<String, Object> toMap() => {
+ "apiSignature": apiSignature,
+ "exports": exports,
+ "imports": imports,
+ "isPartOf": isPartOf,
+ "lineStarts": lineStarts,
+ "parts": parts,
+ };
+
+ @override
+ String toString() => convert.json.encode(toJson());
+}
+
class UnlinkedVariableBuilder extends Object
with _UnlinkedVariableMixin
implements idl.UnlinkedVariable {
@@ -27734,6 +29547,7 @@
bool _isConst;
bool _isCovariant;
bool _isFinal;
+ bool _isLate;
bool _isStatic;
String _name;
int _nameOffset;
@@ -27745,7 +29559,7 @@
_annotations ??= <UnlinkedExprBuilder>[];
/// Annotations for this variable.
- void set annotations(List<UnlinkedExprBuilder> value) {
+ set annotations(List<UnlinkedExprBuilder> value) {
this._annotations = value;
}
@@ -27753,7 +29567,7 @@
CodeRangeBuilder get codeRange => _codeRange;
/// Code range of the variable.
- void set codeRange(CodeRangeBuilder value) {
+ set codeRange(CodeRangeBuilder value) {
this._codeRange = value;
}
@@ -27763,7 +29577,7 @@
/// Documentation comment for the variable, or `null` if there is no
/// documentation comment.
- void set documentationComment(UnlinkedDocumentationCommentBuilder value) {
+ set documentationComment(UnlinkedDocumentationCommentBuilder value) {
this._documentationComment = value;
}
@@ -27774,7 +29588,7 @@
/// [LinkedLibrary.types] contains the inferred type for this variable. If
/// there is no matching entry in [LinkedLibrary.types], then no type was
/// inferred for this variable, so its static type is `dynamic`.
- void set inferredTypeSlot(int value) {
+ set inferredTypeSlot(int value) {
assert(value == null || value >= 0);
this._inferredTypeSlot = value;
}
@@ -27788,7 +29602,7 @@
/// synthetic setter inherits `@covariant` behavior from a base class.
///
/// Otherwise, zero.
- void set inheritsCovariantSlot(int value) {
+ set inheritsCovariantSlot(int value) {
assert(value == null || value >= 0);
this._inheritsCovariantSlot = value;
}
@@ -27798,7 +29612,7 @@
/// The synthetic initializer function of the variable. Absent if the
/// variable does not have an initializer.
- void set initializer(UnlinkedExecutableBuilder value) {
+ set initializer(UnlinkedExecutableBuilder value) {
this._initializer = value;
}
@@ -27806,7 +29620,7 @@
bool get isConst => _isConst ??= false;
/// Indicates whether the variable is declared using the `const` keyword.
- void set isConst(bool value) {
+ set isConst(bool value) {
this._isConst = value;
}
@@ -27815,7 +29629,7 @@
/// Indicates whether this variable is declared using the `covariant` keyword.
/// This should be false for everything except instance fields.
- void set isCovariant(bool value) {
+ set isCovariant(bool value) {
this._isCovariant = value;
}
@@ -27823,11 +29637,19 @@
bool get isFinal => _isFinal ??= false;
/// Indicates whether the variable is declared using the `final` keyword.
- void set isFinal(bool value) {
+ set isFinal(bool value) {
this._isFinal = value;
}
@override
+ bool get isLate => _isLate ??= false;
+
+ /// Indicates whether the variable is declared using the `late` keyword.
+ set isLate(bool value) {
+ this._isLate = value;
+ }
+
+ @override
bool get isStatic => _isStatic ??= false;
/// Indicates whether the variable is declared using the `static` keyword.
@@ -27835,7 +29657,7 @@
/// Note that for top level variables, this flag is false, since they are not
/// declared using the `static` keyword (even though they are considered
/// static for semantic purposes).
- void set isStatic(bool value) {
+ set isStatic(bool value) {
this._isStatic = value;
}
@@ -27843,7 +29665,7 @@
String get name => _name ??= '';
/// Name of the variable.
- void set name(String value) {
+ set name(String value) {
this._name = value;
}
@@ -27851,7 +29673,7 @@
int get nameOffset => _nameOffset ??= 0;
/// Offset of the variable name relative to the beginning of the file.
- void set nameOffset(int value) {
+ set nameOffset(int value) {
assert(value == null || value >= 0);
this._nameOffset = value;
}
@@ -27865,7 +29687,7 @@
/// propagated type is the same as its declared type.
///
/// Non-propagable variables have a [propagatedTypeSlot] of zero.
- void set propagatedTypeSlot(int value) {
+ set propagatedTypeSlot(int value) {
assert(value == null || value >= 0);
this._propagatedTypeSlot = value;
}
@@ -27874,7 +29696,7 @@
EntityRefBuilder get type => _type;
/// Declared type of the variable. Absent if the type is implicit.
- void set type(EntityRefBuilder value) {
+ set type(EntityRefBuilder value) {
this._type = value;
}
@@ -27896,6 +29718,7 @@
bool isConst,
bool isCovariant,
bool isFinal,
+ bool isLate,
bool isStatic,
String name,
int nameOffset,
@@ -27910,15 +29733,14 @@
_isConst = isConst,
_isCovariant = isCovariant,
_isFinal = isFinal,
+ _isLate = isLate,
_isStatic = isStatic,
_name = name,
_nameOffset = nameOffset,
_propagatedTypeSlot = propagatedTypeSlot,
_type = type;
- /**
- * Flush [informative] data recursively.
- */
+ /// Flush [informative] data recursively.
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
@@ -27928,9 +29750,7 @@
_type?.flushInformative();
}
- /**
- * Accumulate non-[informative] data into [signature].
- */
+ /// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
signature.addString(this._name ?? '');
signature.addInt(this._propagatedTypeSlot ?? 0);
@@ -27952,6 +29772,7 @@
this._initializer?.collectApiSignature(signature);
signature.addBool(this._isCovariant == true);
signature.addInt(this._inheritsCovariantSlot ?? 0);
+ signature.addBool(this._isLate == true);
}
fb.Offset finish(fb.Builder fbBuilder) {
@@ -28008,6 +29829,9 @@
if (_isFinal == true) {
fbBuilder.addBool(7, true);
}
+ if (_isLate == true) {
+ fbBuilder.addBool(16, true);
+ }
if (_isStatic == true) {
fbBuilder.addBool(4, true);
}
@@ -28052,6 +29876,7 @@
bool _isConst;
bool _isCovariant;
bool _isFinal;
+ bool _isLate;
bool _isStatic;
String _name;
int _nameOffset;
@@ -28119,6 +29944,12 @@
}
@override
+ bool get isLate {
+ _isLate ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 16, false);
+ return _isLate;
+ }
+
+ @override
bool get isStatic {
_isStatic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 4, false);
return _isStatic;
@@ -28175,6 +30006,7 @@
if (isConst != false) _result["isConst"] = isConst;
if (isCovariant != false) _result["isCovariant"] = isCovariant;
if (isFinal != false) _result["isFinal"] = isFinal;
+ if (isLate != false) _result["isLate"] = isLate;
if (isStatic != false) _result["isStatic"] = isStatic;
if (name != '') _result["name"] = name;
if (nameOffset != 0) _result["nameOffset"] = nameOffset;
@@ -28195,6 +30027,7 @@
"isConst": isConst,
"isCovariant": isCovariant,
"isFinal": isFinal,
+ "isLate": isLate,
"isStatic": isStatic,
"name": name,
"nameOffset": nameOffset,
diff --git a/analyzer/lib/src/summary/format.fbs b/analyzer/lib/src/summary/format.fbs
index 6cd172f..e724a26 100644
--- a/analyzer/lib/src/summary/format.fbs
+++ b/analyzer/lib/src/summary/format.fbs
@@ -1,9 +1,11 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
//
// This file has been automatically generated. Please do not edit it manually.
-// To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
+// To regenerate the file, use the SDK script
+// "pkg/analyzer/tool/summary/generate.dart $IDL_FILE_PATH",
+// or "pkg/analyzer/tool/generate_files" for the analyzer package IDL/sources.
/// Enum of declaration kinds in available files.
@@ -12,6 +14,8 @@
CLASS_TYPE_ALIAS,
+ CONSTRUCTOR,
+
ENUM,
ENUM_CONSTANT,
@@ -42,6 +46,30 @@
syntheticFunction
}
+/// Enum representing nullability suffixes in summaries.
+///
+/// This enum is similar to [NullabilitySuffix], but the order is different so
+/// that [EntityRefNullabilitySuffix.starOrIrrelevant] can be the default.
+enum EntityRefNullabilitySuffix : byte {
+ /// An indication that the canonical representation of the type under
+ /// consideration ends with `*`. Types having this nullability suffix are
+ /// called "legacy types"; it has not yet been determined whether they should
+ /// be unioned with the Null type.
+ ///
+ /// Also used in circumstances where no nullability suffix information is
+ /// needed.
+ starOrIrrelevant,
+
+ /// An indication that the canonical representation of the type under
+ /// consideration ends with `?`. Types having this nullability suffix should
+ /// be interpreted as being unioned with the Null type.
+ question,
+
+ /// An indication that the canonical representation of the type under
+ /// consideration does not end with either `?` or `*`.
+ none
+}
+
/// Enum used to indicate the kind of a name in index.
enum IndexNameKind : byte {
/// A top-level element.
@@ -148,11 +176,13 @@
/// Kinds of formal parameters.
enum LinkedNodeFormalParameterKind : byte {
- required,
+ requiredPositional,
optionalPositional,
- optionalNamed
+ optionalNamed,
+
+ requiredNamed
}
/// Kinds of [LinkedNode].
@@ -193,6 +223,8 @@
comment,
+ commentReference,
+
compilationUnit,
conditionalExpression,
@@ -309,6 +341,10 @@
namedExpression,
+ nativeClause,
+
+ nativeFunctionBody,
+
nullLiteral,
onClause,
@@ -398,8 +434,6 @@
function,
- genericTypeAlias,
-
interface,
typeParameter,
@@ -991,19 +1025,91 @@
/// other two are collection elements. Push an "if" element having the given
/// condition, with the two collection elements as its "then" and "else"
/// clauses, respectively.
- ifElseElement
+ ifElseElement,
+
+ /// Pop the top n+2 values from the stack, where n is obtained from
+ /// [UnlinkedExpr.ints]. The first two are the initialization and condition
+ /// of the for-loop; the remainder are the updaters.
+ forParts,
+
+ /// Pop the top 2 values from the stack. The first is the for loop parts.
+ /// The second is the body.
+ forElement,
+
+ /// Push the empty expression (used for missing initializers and conditions in
+ /// `for` loops)
+ pushEmptyExpression,
+
+ /// Add a variable to the current scope whose name is obtained from
+ /// [UnlinkedExpr.strings]. This is separate from [variableDeclaration]
+ /// because the scope of the variable includes its own initializer.
+ variableDeclarationStart,
+
+ /// Pop the top value from the stack, and use it as the initializer for a
+ /// variable declaration; the variable being declared is obtained by looking
+ /// at the nth variable most recently added to the scope (where n counts from
+ /// zero and is obtained from [UnlinkedExpr.ints]).
+ variableDeclaration,
+
+ /// Pop the top n values from the stack, which should all be variable
+ /// declarations, and use them to create an untyped for-initializer
+ /// declaration. The value of n is obtained from [UnlinkedExpr.ints].
+ forInitializerDeclarationsUntyped,
+
+ /// Pop the top n values from the stack, which should all be variable
+ /// declarations, and use them to create a typed for-initializer
+ /// declaration. The value of n is obtained from [UnlinkedExpr.ints]. The
+ /// type is obtained from [UnlinkedExpr.references].
+ forInitializerDeclarationsTyped,
+
+ /// Pop from the stack `value` and get a string from [UnlinkedExpr.strings].
+ /// Use this string to look up a parameter. Perform `parameter op= value`,
+ /// where `op` is the next assignment operator from
+ /// [UnlinkedExpr.assignmentOperators]. Push `value` back onto the stack.
+ ///
+ /// If the assignment operator is a prefix/postfix increment/decrement, then
+ /// `value` is not present in the stack, so it should not be popped and the
+ /// corresponding value of the parameter after/before update is pushed onto
+ /// the stack instead.
+ assignToParameter,
+
+ /// Pop from the stack an identifier and an expression, and create for-each
+ /// parts of the form `identifier in expression`.
+ forEachPartsWithIdentifier,
+
+ /// Pop the top 2 values from the stack. The first is the for loop parts.
+ /// The second is the body.
+ forElementWithAwait,
+
+ /// Pop an expression from the stack, and create for-each parts of the form
+ /// `var name in expression`, where `name` is obtained from
+ /// [UnlinkedExpr.strings].
+ forEachPartsWithUntypedDeclaration,
+
+ /// Pop an expression from the stack, and create for-each parts of the form
+ /// `Type name in expression`, where `name` is obtained from
+ /// [UnlinkedExpr.strings], and `Type` is obtained from
+ /// [UnlinkedExpr.references].
+ forEachPartsWithTypedDeclaration,
+
+ /// Pop the top 2 values from the stack, compute `v1 >>> v2`, and push the
+ /// result back onto the stack.
+ bitShiftRightLogical
}
/// Enum used to indicate the kind of a parameter.
enum UnlinkedParamKind : byte {
- /// Parameter is required.
- required,
+ /// Parameter is required and positional.
+ requiredPositional,
- /// Parameter is positional optional (enclosed in `[]`)
- positional,
+ /// Parameter is optional and positional (enclosed in `[]`)
+ optionalPositional,
- /// Parameter is named optional (enclosed in `{}`)
- named
+ /// Parameter is optional and named (enclosed in `{}`)
+ optionalNamed,
+
+ /// Parameter is required and named (enclosed in `{}`).
+ requiredNamed
}
/// TODO(scheglov) document
@@ -1049,6 +1155,8 @@
BANG_EQ,
+ BANG_EQ_EQ,
+
BAR,
BAR_BAR,
@@ -1103,6 +1211,8 @@
EQ_EQ,
+ EQ_EQ_EQ,
+
EXPORT,
EXTENDS,
@@ -1133,6 +1243,10 @@
GT_GT_EQ,
+ GT_GT_GT,
+
+ GT_GT_GT_EQ,
+
HASH,
HEXADECIMAL,
@@ -1159,6 +1273,8 @@
IS,
+ LATE,
+
LIBRARY,
LT,
@@ -1227,6 +1343,8 @@
QUESTION_QUESTION_EQ,
+ REQUIRED,
+
RETHROW,
RETURN,
@@ -1466,44 +1584,45 @@
/// Unlinked information for the unit.
unit:UnlinkedUnit (id: 1);
+
+ /// Unlinked information for the unit.
+ unit2:UnlinkedUnit2 (id: 5);
}
/// Information about a single declaration.
table AvailableDeclaration {
- defaultArgumentListString:string (id: 0);
+ children:[AvailableDeclaration] (id: 0);
- defaultArgumentListTextRanges:[uint] (id: 1);
+ defaultArgumentListString:string (id: 1);
- docComplete:string (id: 2);
+ defaultArgumentListTextRanges:[uint] (id: 2);
- docSummary:string (id: 3);
+ docComplete:string (id: 3);
- fieldMask:uint (id: 4);
+ docSummary:string (id: 4);
- isAbstract:bool (id: 5);
+ fieldMask:uint (id: 5);
- isConst:bool (id: 6);
+ isAbstract:bool (id: 6);
- isDeprecated:bool (id: 7);
+ isConst:bool (id: 7);
- isFinal:bool (id: 8);
+ isDeprecated:bool (id: 8);
+
+ isFinal:bool (id: 9);
/// The kind of the declaration.
- kind:AvailableDeclarationKind (id: 9);
+ kind:AvailableDeclarationKind (id: 10);
- locationOffset:uint (id: 10);
+ locationOffset:uint (id: 11);
- locationStartColumn:uint (id: 11);
+ locationStartColumn:uint (id: 12);
- locationStartLine:uint (id: 12);
+ locationStartLine:uint (id: 13);
/// The first part of the declaration name, usually the only one, for example
/// the name of a class like `MyClass`, or a function like `myFunction`.
- name:string (id: 13);
-
- /// The second, optional, part of the declaration name. For example enum
- /// constants all have the same [name], but their own [name2].
- name2:string (id: 14);
+ name:string (id: 14);
parameterNames:[string] (id: 15);
@@ -1529,6 +1648,9 @@
/// Declarations of the file.
declarations:[AvailableDeclaration] (id: 0);
+ /// The Dartdoc directives in the file.
+ directiveInfo:DirectiveInfo (id: 5);
+
/// Exports directives of the file.
exports:[AvailableFileExport] (id: 1);
@@ -1569,6 +1691,15 @@
offset:uint (id: 0);
}
+/// Information about the Dartdoc directives in an [AvailableFile].
+table DirectiveInfo {
+ /// The names of the defined templates.
+ templateNames:[string] (id: 0);
+
+ /// The values of the defined templates.
+ templateValues:[string] (id: 1);
+}
+
/// Summary information about a reference to an entity such as a type, top level
/// executable, or executable within a class.
table EntityRef {
@@ -1603,6 +1734,9 @@
/// first to the class and then to the method.
implicitFunctionTypeIndices:[uint] (id: 4);
+ /// If the reference represents a type, the nullability of the type.
+ nullabilitySuffix:EntityRefNullabilitySuffix (id: 10);
+
/// If this is a reference to a type parameter, one-based index into the list
/// of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
/// Bruijn index conventions; that is, innermost parameters come first, and
@@ -1749,6 +1883,9 @@
/// Information about a linked AST node.
table LinkedNode {
+ /// The explicit or inferred return type of a function typed node.
+ variantField_24:LinkedNodeType (id: 24);
+
variantField_2:[LinkedNode] (id: 2);
variantField_11:LinkedNode (id: 11);
@@ -1761,18 +1898,18 @@
variantField_7:LinkedNode (id: 7);
+ variantField_17:uint (id: 17);
+
+ variantField_23:LinkedNodeType (id: 23);
+
variantField_8:LinkedNode (id: 8);
variantField_16:uint (id: 16);
- variantField_17:uint (id: 17);
-
variantField_18:uint (id: 18);
variantField_19:uint (id: 19);
- variantField_24:LinkedNodeType (id: 24);
-
variantField_27:bool (id: 27);
variantField_9:LinkedNode (id: 9);
@@ -1783,6 +1920,10 @@
variantField_13:LinkedNode (id: 13);
+ variantField_34:uint (id: 34);
+
+ variantField_33:uint (id: 33);
+
variantField_28:[uint] (id: 28);
variantField_29:LinkedNodeCommentType (id: 29);
@@ -1791,12 +1932,12 @@
variantField_10:LinkedNode (id: 10);
+ variantField_26:LinkedNodeFormalParameterKind (id: 26);
+
variantField_21:double (id: 21);
variantField_25:LinkedNodeType (id: 25);
- variantField_26:LinkedNodeFormalParameterKind (id: 26);
-
variantField_30:string (id: 30);
variantField_14:LinkedNode (id: 14);
@@ -1805,11 +1946,13 @@
kind:LinkedNodeKind (id: 0);
- variantField_23:string (id: 23);
+ variantField_36:[string] (id: 36);
+
+ variantField_20:string (id: 20);
variantField_31:bool (id: 31);
- variantField_20:string (id: 20);
+ variantField_35:TopLevelInferenceError (id: 35);
variantField_22:string (id: 22);
@@ -1849,13 +1992,15 @@
/// Information about a Dart type.
table LinkedNodeType {
- /// References to [LinkedNodeReferences].
- functionFormalParameters:[uint] (id: 0);
+ functionFormalParameters:[LinkedNodeTypeFormalParameter] (id: 0);
functionReturnType:LinkedNodeType (id: 1);
- /// References to [LinkedNodeReferences].
- functionTypeParameters:[uint] (id: 2);
+ functionTypeParameters:[LinkedNodeTypeTypeParameter] (id: 2);
+
+ genericTypeAliasReference:uint (id: 8);
+
+ genericTypeAliasTypeArguments:[LinkedNodeType] (id: 9);
/// Reference to a [LinkedNodeReferences].
interfaceClass:uint (id: 3);
@@ -1864,12 +2009,36 @@
kind:LinkedNodeTypeKind (id: 5);
- /// Reference to a [LinkedNodeReferences].
- typeParameterParameter:uint (id: 6);
+ nullabilitySuffix:EntityRefNullabilitySuffix (id: 10);
+
+ typeParameterElement:uint (id: 6);
+
+ typeParameterId:uint (id: 7);
+}
+
+/// Information about a formal parameter in a function type.
+table LinkedNodeTypeFormalParameter {
+ kind:LinkedNodeFormalParameterKind (id: 0);
+
+ name:string (id: 1);
+
+ type:LinkedNodeType (id: 2);
+}
+
+/// Information about a type parameter in a function type.
+table LinkedNodeTypeTypeParameter {
+ bound:LinkedNodeType (id: 1);
+
+ name:string (id: 0);
}
/// Information about a single library in a [LinkedNodeLibrary].
table LinkedNodeUnit {
+ isSynthetic:bool (id: 3);
+
+ /// Offsets of the first character of each line in the source code.
+ lineStarts:[uint] (id: 4);
+
node:LinkedNode (id: 2);
tokens:UnlinkedTokens (id: 1);
@@ -1880,13 +2049,15 @@
/// Information about a top-level declaration, or a field declaration that
/// contributes information to [LinkedNodeKind.variableDeclaration].
table LinkedNodeVariablesDeclaration {
- comment:LinkedNode (id: 3);
+ comment:LinkedNode (id: 0);
- isConst:bool (id: 0);
+ isConst:bool (id: 1);
- isFinal:bool (id: 1);
+ isCovariant:bool (id: 2);
- isStatic:bool (id: 2);
+ isFinal:bool (id: 3);
+
+ isStatic:bool (id: 4);
}
/// Information about the resolution of an [UnlinkedReference].
@@ -2908,6 +3079,28 @@
variables:[UnlinkedVariable] (id: 3);
}
+/// Unlinked summary information about a compilation unit.
+table UnlinkedUnit2 {
+ /// The MD5 hash signature of the API portion of this unit. It depends on all
+ /// tokens that might affect APIs of declarations in the unit.
+ apiSignature:[uint] (id: 0);
+
+ /// URIs of `export` directives.
+ exports:[string] (id: 1);
+
+ /// URIs of `import` directives.
+ imports:[string] (id: 2);
+
+ /// Is `true` if the unit contains a `part of` directive.
+ isPartOf:bool (id: 3);
+
+ /// Offsets of the first character of each line in the source code.
+ lineStarts:[uint] (id: 5);
+
+ /// URIs of `part` directives.
+ parts:[string] (id: 4);
+}
+
/// Unlinked summary information about a top level variable, local variable, or
/// a field.
table UnlinkedVariable {
@@ -2949,6 +3142,9 @@
/// Indicates whether the variable is declared using the `final` keyword.
isFinal:bool (id: 7);
+ /// Indicates whether the variable is declared using the `late` keyword.
+ isLate:bool (id: 16);
+
/// Indicates whether the variable is declared using the `static` keyword.
///
/// Note that for top level variables, this flag is false, since they are not
diff --git a/analyzer/lib/src/summary/idl.dart b/analyzer/lib/src/summary/idl.dart
index c9e84f8..e89bba2 100644
--- a/analyzer/lib/src/summary/idl.dart
+++ b/analyzer/lib/src/summary/idl.dart
@@ -283,59 +283,61 @@
/// Unlinked information for the unit.
@Id(1)
UnlinkedUnit get unit;
+
+ /// Unlinked information for the unit.
+ @Id(5)
+ UnlinkedUnit2 get unit2;
}
/// Information about a single declaration.
abstract class AvailableDeclaration extends base.SummaryClass {
@Id(0)
- String get defaultArgumentListString;
+ List<AvailableDeclaration> get children;
@Id(1)
- List<int> get defaultArgumentListTextRanges;
+ String get defaultArgumentListString;
@Id(2)
- String get docComplete;
+ List<int> get defaultArgumentListTextRanges;
@Id(3)
- String get docSummary;
+ String get docComplete;
@Id(4)
- int get fieldMask;
+ String get docSummary;
@Id(5)
- bool get isAbstract;
+ int get fieldMask;
@Id(6)
- bool get isConst;
+ bool get isAbstract;
@Id(7)
- bool get isDeprecated;
+ bool get isConst;
@Id(8)
+ bool get isDeprecated;
+
+ @Id(9)
bool get isFinal;
/// The kind of the declaration.
- @Id(9)
+ @Id(10)
AvailableDeclarationKind get kind;
- @Id(10)
+ @Id(11)
int get locationOffset;
- @Id(11)
+ @Id(12)
int get locationStartColumn;
- @Id(12)
+ @Id(13)
int get locationStartLine;
/// The first part of the declaration name, usually the only one, for example
/// the name of a class like `MyClass`, or a function like `myFunction`.
- @Id(13)
- String get name;
-
- /// The second, optional, part of the declaration name. For example enum
- /// constants all have the same [name], but their own [name2].
@Id(14)
- String get name2;
+ String get name;
@Id(15)
List<String> get parameterNames;
@@ -367,6 +369,7 @@
enum AvailableDeclarationKind {
CLASS,
CLASS_TYPE_ALIAS,
+ CONSTRUCTOR,
ENUM,
ENUM_CONSTANT,
FUNCTION,
@@ -387,6 +390,10 @@
@Id(0)
List<AvailableDeclaration> get declarations;
+ /// The Dartdoc directives in the file.
+ @Id(5)
+ DirectiveInfo get directiveInfo;
+
/// Exports directives of the file.
@Id(1)
List<AvailableFileExport> get exports;
@@ -437,6 +444,17 @@
int get offset;
}
+/// Information about the Dartdoc directives in an [AvailableFile].
+abstract class DirectiveInfo extends base.SummaryClass {
+ /// The names of the defined templates.
+ @Id(0)
+ List<String> get templateNames;
+
+ /// The values of the defined templates.
+ @Id(1)
+ List<String> get templateValues;
+}
+
/// Summary information about a reference to an entity such as a type, top level
/// executable, or executable within a class.
abstract class EntityRef extends base.SummaryClass {
@@ -473,6 +491,10 @@
@Id(4)
List<int> get implicitFunctionTypeIndices;
+ /// If the reference represents a type, the nullability of the type.
+ @Id(10)
+ EntityRefNullabilitySuffix get nullabilitySuffix;
+
/// If this is a reference to a type parameter, one-based index into the list
/// of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
/// Bruijn index conventions; that is, innermost parameters come first, and
@@ -557,6 +579,30 @@
syntheticFunction
}
+/// Enum representing nullability suffixes in summaries.
+///
+/// This enum is similar to [NullabilitySuffix], but the order is different so
+/// that [EntityRefNullabilitySuffix.starOrIrrelevant] can be the default.
+enum EntityRefNullabilitySuffix {
+ /// An indication that the canonical representation of the type under
+ /// consideration ends with `*`. Types having this nullability suffix are
+ /// called "legacy types"; it has not yet been determined whether they should
+ /// be unioned with the Null type.
+ ///
+ /// Also used in circumstances where no nullability suffix information is
+ /// needed.
+ starOrIrrelevant,
+
+ /// An indication that the canonical representation of the type under
+ /// consideration ends with `?`. Types having this nullability suffix should
+ /// be interpreted as being unioned with the Null type.
+ question,
+
+ /// An indication that the canonical representation of the type under
+ /// consideration does not end with either `?` or `*`.
+ none,
+}
+
/// Enum used to indicate the kind of a name in index.
enum IndexNameKind {
/// A top-level element.
@@ -754,6 +800,25 @@
/// Information about a linked AST node.
@Variant('kind')
abstract class LinkedNode extends base.SummaryClass {
+ /// The explicit or inferred return type of a function typed node.
+ @VariantId(24, variantList: [
+ LinkedNodeKind.functionDeclaration,
+ LinkedNodeKind.functionExpression,
+ LinkedNodeKind.functionTypeAlias,
+ LinkedNodeKind.genericFunctionType,
+ LinkedNodeKind.methodDeclaration,
+ ])
+ LinkedNodeType get actualReturnType;
+
+ /// The explicit or inferred type of a variable.
+ @VariantId(24, variantList: [
+ LinkedNodeKind.fieldFormalParameter,
+ LinkedNodeKind.functionTypedFormalParameter,
+ LinkedNodeKind.simpleFormalParameter,
+ LinkedNodeKind.variableDeclaration,
+ ])
+ LinkedNodeType get actualType;
+
@VariantId(2, variant: LinkedNodeKind.adjacentStrings)
List<LinkedNode> get adjacentStrings_strings;
@@ -816,6 +881,12 @@
@VariantId(7, variant: LinkedNodeKind.annotation)
LinkedNode get annotation_constructorName;
+ @VariantId(17, variant: LinkedNodeKind.annotation)
+ int get annotation_element;
+
+ @VariantId(23, variant: LinkedNodeKind.annotation)
+ LinkedNodeType get annotation_elementType;
+
@VariantId(8, variant: LinkedNodeKind.annotation)
LinkedNode get annotation_name;
@@ -882,6 +953,9 @@
@VariantId(15, variant: LinkedNodeKind.assignmentExpression)
int get assignmentExpression_element;
+ @VariantId(23, variant: LinkedNodeKind.assignmentExpression)
+ LinkedNodeType get assignmentExpression_elementType;
+
@VariantId(6, variant: LinkedNodeKind.assignmentExpression)
LinkedNode get assignmentExpression_leftHandSide;
@@ -900,6 +974,9 @@
@VariantId(15, variant: LinkedNodeKind.binaryExpression)
int get binaryExpression_element;
+ @VariantId(23, variant: LinkedNodeKind.binaryExpression)
+ LinkedNodeType get binaryExpression_elementType;
+
@VariantId(24, variant: LinkedNodeKind.binaryExpression)
LinkedNodeType get binaryExpression_invokeType;
@@ -990,6 +1067,9 @@
@VariantId(27, variant: LinkedNodeKind.classDeclaration)
bool get classDeclaration_isDartObject;
+ @VariantId(8, variant: LinkedNodeKind.classDeclaration)
+ LinkedNode get classDeclaration_nativeClause;
+
@VariantId(7, variant: LinkedNodeKind.classDeclaration)
LinkedNode get classDeclaration_withClause;
@@ -1041,18 +1121,67 @@
@VariantId(8, variant: LinkedNodeKind.classTypeAlias)
LinkedNode get classTypeAlias_withClause;
+ @VariantId(34, variantList: [
+ LinkedNodeKind.classDeclaration,
+ LinkedNodeKind.classTypeAlias,
+ LinkedNodeKind.compilationUnit,
+ LinkedNodeKind.constructorDeclaration,
+ LinkedNodeKind.defaultFormalParameter,
+ LinkedNodeKind.enumDeclaration,
+ LinkedNodeKind.fieldFormalParameter,
+ LinkedNodeKind.functionDeclaration,
+ LinkedNodeKind.functionTypeAlias,
+ LinkedNodeKind.functionTypedFormalParameter,
+ LinkedNodeKind.genericTypeAlias,
+ LinkedNodeKind.methodDeclaration,
+ LinkedNodeKind.mixinDeclaration,
+ LinkedNodeKind.simpleFormalParameter,
+ LinkedNodeKind.typeParameter,
+ LinkedNodeKind.variableDeclaration,
+ ])
+ int get codeLength;
+
+ @VariantId(33, variantList: [
+ LinkedNodeKind.classDeclaration,
+ LinkedNodeKind.classTypeAlias,
+ LinkedNodeKind.compilationUnit,
+ LinkedNodeKind.constructorDeclaration,
+ LinkedNodeKind.defaultFormalParameter,
+ LinkedNodeKind.enumDeclaration,
+ LinkedNodeKind.fieldFormalParameter,
+ LinkedNodeKind.functionDeclaration,
+ LinkedNodeKind.functionTypeAlias,
+ LinkedNodeKind.functionTypedFormalParameter,
+ LinkedNodeKind.genericTypeAlias,
+ LinkedNodeKind.methodDeclaration,
+ LinkedNodeKind.mixinDeclaration,
+ LinkedNodeKind.simpleFormalParameter,
+ LinkedNodeKind.typeParameter,
+ LinkedNodeKind.variableDeclaration,
+ ])
+ int get codeOffset;
+
@VariantId(19, variantList: [
LinkedNodeKind.hideCombinator,
LinkedNodeKind.showCombinator,
])
int get combinator_keyword;
+ @VariantId(2, variant: LinkedNodeKind.comment)
+ List<LinkedNode> get comment_references;
+
@VariantId(28, variant: LinkedNodeKind.comment)
List<int> get comment_tokens;
@VariantId(29, variant: LinkedNodeKind.comment)
LinkedNodeCommentType get comment_type;
+ @VariantId(6, variant: LinkedNodeKind.commentReference)
+ LinkedNode get commentReference_identifier;
+
+ @VariantId(15, variant: LinkedNodeKind.commentReference)
+ int get commentReference_newKeyword;
+
@VariantId(15, variant: LinkedNodeKind.compilationUnit)
int get compilationUnit_beginToken;
@@ -1155,6 +1284,9 @@
@VariantId(15, variant: LinkedNodeKind.constructorName)
int get constructorName_element;
+ @VariantId(23, variant: LinkedNodeKind.constructorName)
+ LinkedNodeType get constructorName_elementType;
+
@VariantId(6, variant: LinkedNodeKind.constructorName)
LinkedNode get constructorName_name;
@@ -1185,8 +1317,8 @@
@VariantId(6, variant: LinkedNodeKind.defaultFormalParameter)
LinkedNode get defaultFormalParameter_defaultValue;
- @VariantId(27, variant: LinkedNodeKind.defaultFormalParameter)
- bool get defaultFormalParameter_isNamed;
+ @VariantId(26, variant: LinkedNodeKind.defaultFormalParameter)
+ LinkedNodeFormalParameterKind get defaultFormalParameter_kind;
@VariantId(7, variant: LinkedNodeKind.defaultFormalParameter)
LinkedNode get defaultFormalParameter_parameter;
@@ -1194,7 +1326,7 @@
@VariantId(15, variant: LinkedNodeKind.defaultFormalParameter)
int get defaultFormalParameter_separator;
- @VariantId(17, variantList: [
+ @VariantId(18, variantList: [
LinkedNodeKind.exportDirective,
LinkedNodeKind.importDirective,
LinkedNodeKind.libraryDirective,
@@ -1203,6 +1335,15 @@
])
int get directive_keyword;
+ @VariantId(33, variantList: [
+ LinkedNodeKind.exportDirective,
+ LinkedNodeKind.importDirective,
+ LinkedNodeKind.libraryDirective,
+ LinkedNodeKind.partDirective,
+ LinkedNodeKind.partOfDirective,
+ ])
+ int get directive_semicolon;
+
@VariantId(6, variant: LinkedNodeKind.doStatement)
LinkedNode get doStatement_body;
@@ -1341,9 +1482,6 @@
@VariantId(6, variant: LinkedNodeKind.fieldFormalParameter)
LinkedNode get fieldFormalParameter_type;
- @VariantId(24, variant: LinkedNodeKind.fieldFormalParameter)
- LinkedNodeType get fieldFormalParameter_type2;
-
@VariantId(7, variant: LinkedNodeKind.fieldFormalParameter)
LinkedNode get fieldFormalParameter_typeParameters;
@@ -1368,13 +1506,6 @@
@VariantId(7, variant: LinkedNodeKind.forElement)
LinkedNode get forElement_body;
- @VariantId(26, variantList: [
- LinkedNodeKind.fieldFormalParameter,
- LinkedNodeKind.functionTypedFormalParameter,
- LinkedNodeKind.simpleFormalParameter,
- ])
- LinkedNodeFormalParameterKind get formalParameter_kind;
-
@VariantId(15, variant: LinkedNodeKind.formalParameterList)
int get formalParameterList_leftDelimiter;
@@ -1465,9 +1596,6 @@
@VariantId(7, variant: LinkedNodeKind.functionDeclaration)
LinkedNode get functionDeclaration_returnType;
- @VariantId(24, variant: LinkedNodeKind.functionDeclaration)
- LinkedNodeType get functionDeclaration_returnType2;
-
@VariantId(6, variant: LinkedNodeKind.functionDeclarationStatement)
LinkedNode get functionDeclarationStatement_functionDeclaration;
@@ -1489,9 +1617,6 @@
@VariantId(7, variant: LinkedNodeKind.functionTypeAlias)
LinkedNode get functionTypeAlias_returnType;
- @VariantId(24, variant: LinkedNodeKind.functionTypeAlias)
- LinkedNodeType get functionTypeAlias_returnType2;
-
@VariantId(8, variant: LinkedNodeKind.functionTypeAlias)
LinkedNode get functionTypeAlias_typeParameters;
@@ -1510,14 +1635,17 @@
@VariantId(15, variant: LinkedNodeKind.genericFunctionType)
int get genericFunctionType_functionKeyword;
+ @VariantId(17, variant: LinkedNodeKind.genericFunctionType)
+ int get genericFunctionType_id;
+
@VariantId(16, variant: LinkedNodeKind.genericFunctionType)
int get genericFunctionType_question;
@VariantId(7, variant: LinkedNodeKind.genericFunctionType)
LinkedNode get genericFunctionType_returnType;
- @VariantId(24, variant: LinkedNodeKind.genericFunctionType)
- LinkedNodeType get genericFunctionType_returnType2;
+ @VariantId(25, variant: LinkedNodeKind.genericFunctionType)
+ LinkedNodeType get genericFunctionType_type;
@VariantId(6, variant: LinkedNodeKind.genericFunctionType)
LinkedNode get genericFunctionType_typeParameters;
@@ -1594,18 +1722,32 @@
@VariantId(15, variant: LinkedNodeKind.indexExpression)
int get indexExpression_element;
+ @VariantId(23, variant: LinkedNodeKind.indexExpression)
+ LinkedNodeType get indexExpression_elementType;
+
@VariantId(6, variant: LinkedNodeKind.indexExpression)
LinkedNode get indexExpression_index;
- @VariantId(16, variant: LinkedNodeKind.indexExpression)
+ @VariantId(17, variant: LinkedNodeKind.indexExpression)
int get indexExpression_leftBracket;
- @VariantId(17, variant: LinkedNodeKind.indexExpression)
+ @VariantId(16, variant: LinkedNodeKind.indexExpression)
+ int get indexExpression_period;
+
+ @VariantId(18, variant: LinkedNodeKind.indexExpression)
int get indexExpression_rightBracket;
@VariantId(7, variant: LinkedNodeKind.indexExpression)
LinkedNode get indexExpression_target;
+ @VariantId(27, variantList: [
+ LinkedNodeKind.fieldFormalParameter,
+ LinkedNodeKind.functionTypedFormalParameter,
+ LinkedNodeKind.simpleFormalParameter,
+ LinkedNodeKind.variableDeclaration,
+ ])
+ bool get inheritsCovariant;
+
@VariantId(6, variant: LinkedNodeKind.instanceCreationExpression)
LinkedNode get instanceCreationExpression_arguments;
@@ -1738,9 +1880,6 @@
@VariantId(8, variant: LinkedNodeKind.methodDeclaration)
LinkedNode get methodDeclaration_returnType;
- @VariantId(24, variant: LinkedNodeKind.methodDeclaration)
- LinkedNodeType get methodDeclaration_returnType2;
-
@VariantId(9, variant: LinkedNodeKind.methodDeclaration)
LinkedNode get methodDeclaration_typeParameters;
@@ -1759,6 +1898,9 @@
@VariantId(6, variant: LinkedNodeKind.mixinDeclaration)
LinkedNode get mixinDeclaration_onClause;
+ @VariantId(36, variant: LinkedNodeKind.mixinDeclaration)
+ List<String> get mixinDeclaration_superInvokedNames;
+
@VariantId(14, variantList: [
LinkedNodeKind.classDeclaration,
LinkedNodeKind.classTypeAlias,
@@ -1788,21 +1930,26 @@
])
List<LinkedNode> get namespaceDirective_configurations;
- @VariantId(23, variantList: [
+ @VariantId(20, variantList: [
LinkedNodeKind.exportDirective,
LinkedNodeKind.importDirective,
- LinkedNodeKind.partDirective,
- LinkedNodeKind.partOfDirective,
])
- String get namespaceDirective_selectedUriContent;
+ String get namespaceDirective_selectedUri;
- @VariantId(18, variantList: [
- LinkedNodeKind.exportDirective,
- LinkedNodeKind.importDirective,
- LinkedNodeKind.libraryDirective,
- LinkedNodeKind.partDirective,
- ])
- int get namespaceDirective_semicolon;
+ @VariantId(6, variant: LinkedNodeKind.nativeClause)
+ LinkedNode get nativeClause_name;
+
+ @VariantId(15, variant: LinkedNodeKind.nativeClause)
+ int get nativeClause_nativeKeyword;
+
+ @VariantId(15, variant: LinkedNodeKind.nativeFunctionBody)
+ int get nativeFunctionBody_nativeKeyword;
+
+ @VariantId(16, variant: LinkedNodeKind.nativeFunctionBody)
+ int get nativeFunctionBody_semicolon;
+
+ @VariantId(6, variant: LinkedNodeKind.nativeFunctionBody)
+ LinkedNode get nativeFunctionBody_stringLiteral;
@VariantId(14, variantList: [
LinkedNodeKind.fieldFormalParameter,
@@ -1825,13 +1972,6 @@
])
LinkedNode get normalFormalParameter_identifier;
- @VariantId(27, variantList: [
- LinkedNodeKind.fieldFormalParameter,
- LinkedNodeKind.functionTypedFormalParameter,
- LinkedNodeKind.simpleFormalParameter,
- ])
- bool get normalFormalParameter_isCovariant;
-
@VariantId(4, variantList: [
LinkedNodeKind.fieldFormalParameter,
LinkedNodeKind.functionTypedFormalParameter,
@@ -1839,6 +1979,13 @@
])
List<LinkedNode> get normalFormalParameter_metadata;
+ @VariantId(18, variantList: [
+ LinkedNodeKind.fieldFormalParameter,
+ LinkedNodeKind.functionTypedFormalParameter,
+ LinkedNodeKind.simpleFormalParameter,
+ ])
+ int get normalFormalParameter_requiredKeyword;
+
@VariantId(15, variant: LinkedNodeKind.nullLiteral)
int get nullLiteral_literal;
@@ -1863,15 +2010,15 @@
@VariantId(16, variant: LinkedNodeKind.partOfDirective)
int get partOfDirective_ofKeyword;
- @VariantId(15, variant: LinkedNodeKind.partOfDirective)
- int get partOfDirective_semicolon;
-
@VariantId(7, variant: LinkedNodeKind.partOfDirective)
LinkedNode get partOfDirective_uri;
@VariantId(15, variant: LinkedNodeKind.postfixExpression)
int get postfixExpression_element;
+ @VariantId(23, variant: LinkedNodeKind.postfixExpression)
+ LinkedNodeType get postfixExpression_elementType;
+
@VariantId(6, variant: LinkedNodeKind.postfixExpression)
LinkedNode get postfixExpression_operand;
@@ -1890,6 +2037,9 @@
@VariantId(15, variant: LinkedNodeKind.prefixExpression)
int get prefixExpression_element;
+ @VariantId(23, variant: LinkedNodeKind.prefixExpression)
+ LinkedNodeType get prefixExpression_elementType;
+
@VariantId(6, variant: LinkedNodeKind.prefixExpression)
LinkedNode get prefixExpression_operand;
@@ -1914,6 +2064,9 @@
@VariantId(15, variant: LinkedNodeKind.redirectingConstructorInvocation)
int get redirectingConstructorInvocation_element;
+ @VariantId(23, variant: LinkedNodeKind.redirectingConstructorInvocation)
+ LinkedNodeType get redirectingConstructorInvocation_elementType;
+
@VariantId(16, variant: LinkedNodeKind.redirectingConstructorInvocation)
int get redirectingConstructorInvocation_period;
@@ -1959,12 +2112,15 @@
@VariantId(6, variant: LinkedNodeKind.simpleFormalParameter)
LinkedNode get simpleFormalParameter_type;
- @VariantId(24, variant: LinkedNodeKind.simpleFormalParameter)
- LinkedNodeType get simpleFormalParameter_type2;
-
@VariantId(15, variant: LinkedNodeKind.simpleIdentifier)
int get simpleIdentifier_element;
+ @VariantId(23, variant: LinkedNodeKind.simpleIdentifier)
+ LinkedNodeType get simpleIdentifier_elementType;
+
+ @VariantId(27, variant: LinkedNodeKind.simpleIdentifier)
+ bool get simpleIdentifier_isDeclaration;
+
@VariantId(16, variant: LinkedNodeKind.simpleIdentifier)
int get simpleIdentifier_token;
@@ -1974,6 +2130,15 @@
@VariantId(20, variant: LinkedNodeKind.simpleStringLiteral)
String get simpleStringLiteral_value;
+ @VariantId(31, variantList: [
+ LinkedNodeKind.classDeclaration,
+ LinkedNodeKind.classTypeAlias,
+ LinkedNodeKind.functionTypeAlias,
+ LinkedNodeKind.genericTypeAlias,
+ LinkedNodeKind.mixinDeclaration,
+ ])
+ bool get simplyBoundable_isSimplyBounded;
+
@VariantId(6, variant: LinkedNodeKind.spreadElement)
LinkedNode get spreadElement_expression;
@@ -1992,6 +2157,9 @@
@VariantId(15, variant: LinkedNodeKind.superConstructorInvocation)
int get superConstructorInvocation_element;
+ @VariantId(23, variant: LinkedNodeKind.superConstructorInvocation)
+ LinkedNodeType get superConstructorInvocation_elementType;
+
@VariantId(16, variant: LinkedNodeKind.superConstructorInvocation)
int get superConstructorInvocation_period;
@@ -2064,6 +2232,12 @@
@VariantId(15, variant: LinkedNodeKind.throwExpression)
int get throwExpression_throwKeyword;
+ @VariantId(35, variantList: [
+ LinkedNodeKind.simpleFormalParameter,
+ LinkedNodeKind.variableDeclaration,
+ ])
+ TopLevelInferenceError get topLevelTypeInferenceError;
+
@VariantId(15, variant: LinkedNodeKind.topLevelVariableDeclaration)
int get topLevelVariableDeclaration_semicolon;
@@ -2085,6 +2259,12 @@
@VariantId(16, variant: LinkedNodeKind.tryStatement)
int get tryStatement_tryKeyword;
+ @VariantId(27, variantList: [
+ LinkedNodeKind.functionTypeAlias,
+ LinkedNodeKind.genericTypeAlias,
+ ])
+ bool get typeAlias_hasSelfReference;
+
@VariantId(19, variantList: [
LinkedNodeKind.classTypeAlias,
LinkedNodeKind.functionTypeAlias,
@@ -2126,7 +2306,7 @@
@VariantId(15, variant: LinkedNodeKind.typeName)
int get typeName_question;
- @VariantId(24, variant: LinkedNodeKind.typeName)
+ @VariantId(23, variant: LinkedNodeKind.typeName)
LinkedNodeType get typeName_type;
@VariantId(7, variant: LinkedNodeKind.typeName)
@@ -2135,6 +2315,9 @@
@VariantId(6, variant: LinkedNodeKind.typeParameter)
LinkedNode get typeParameter_bound;
+ @VariantId(23, variant: LinkedNodeKind.typeParameter)
+ LinkedNodeType get typeParameter_defaultType;
+
@VariantId(15, variant: LinkedNodeKind.typeParameter)
int get typeParameter_extendsKeyword;
@@ -2183,12 +2366,12 @@
@VariantId(7, variant: LinkedNodeKind.variableDeclaration)
LinkedNode get variableDeclaration_name;
- @VariantId(24, variant: LinkedNodeKind.variableDeclaration)
- LinkedNodeType get variableDeclaration_type2;
-
@VariantId(15, variant: LinkedNodeKind.variableDeclarationList)
int get variableDeclarationList_keyword;
+ @VariantId(16, variant: LinkedNodeKind.variableDeclarationList)
+ int get variableDeclarationList_lateKeyword;
+
@VariantId(6, variant: LinkedNodeKind.variableDeclarationList)
LinkedNode get variableDeclarationList_type;
@@ -2255,9 +2438,10 @@
/// Kinds of formal parameters.
enum LinkedNodeFormalParameterKind {
- required,
+ requiredPositional,
optionalPositional,
- optionalNamed
+ optionalNamed,
+ requiredNamed
}
/// Kinds of [LinkedNode].
@@ -2280,6 +2464,7 @@
classDeclaration,
classTypeAlias,
comment,
+ commentReference,
compilationUnit,
conditionalExpression,
configuration,
@@ -2338,6 +2523,8 @@
methodInvocation,
mixinDeclaration,
namedExpression,
+ nativeClause,
+ nativeFunctionBody,
nullLiteral,
onClause,
parenthesizedExpression,
@@ -2412,16 +2599,20 @@
/// Information about a Dart type.
abstract class LinkedNodeType extends base.SummaryClass {
- /// References to [LinkedNodeReferences].
@Id(0)
- List<int> get functionFormalParameters;
+ List<LinkedNodeTypeFormalParameter> get functionFormalParameters;
@Id(1)
LinkedNodeType get functionReturnType;
- /// References to [LinkedNodeReferences].
@Id(2)
- List<int> get functionTypeParameters;
+ List<LinkedNodeTypeTypeParameter> get functionTypeParameters;
+
+ @Id(8)
+ int get genericTypeAliasReference;
+
+ @Id(9)
+ List<LinkedNodeType> get genericTypeAliasTypeArguments;
/// Reference to a [LinkedNodeReferences].
@Id(3)
@@ -2433,9 +2624,26 @@
@Id(5)
LinkedNodeTypeKind get kind;
- /// Reference to a [LinkedNodeReferences].
+ @Id(10)
+ EntityRefNullabilitySuffix get nullabilitySuffix;
+
@Id(6)
- int get typeParameterParameter;
+ int get typeParameterElement;
+
+ @Id(7)
+ int get typeParameterId;
+}
+
+/// Information about a formal parameter in a function type.
+abstract class LinkedNodeTypeFormalParameter extends base.SummaryClass {
+ @Id(0)
+ LinkedNodeFormalParameterKind get kind;
+
+ @Id(1)
+ String get name;
+
+ @Id(2)
+ LinkedNodeType get type;
}
/// Kinds of [LinkedNodeType]s.
@@ -2443,14 +2651,30 @@
bottom,
dynamic_,
function,
- genericTypeAlias,
interface,
typeParameter,
void_
}
+/// Information about a type parameter in a function type.
+abstract class LinkedNodeTypeTypeParameter extends base.SummaryClass {
+ @Id(1)
+ LinkedNodeType get bound;
+
+ @Id(0)
+ String get name;
+}
+
/// Information about a single library in a [LinkedNodeLibrary].
abstract class LinkedNodeUnit extends base.SummaryClass {
+ @Id(3)
+ bool get isSynthetic;
+
+ /// Offsets of the first character of each line in the source code.
+ @informative
+ @Id(4)
+ List<int> get lineStarts;
+
@Id(2)
LinkedNode get node;
@@ -2464,16 +2688,19 @@
/// Information about a top-level declaration, or a field declaration that
/// contributes information to [LinkedNodeKind.variableDeclaration].
abstract class LinkedNodeVariablesDeclaration extends base.SummaryClass {
- @Id(3)
+ @Id(0)
LinkedNode get comment;
- @Id(0)
+ @Id(1)
bool get isConst;
- @Id(1)
+ @Id(2)
+ bool get isCovariant;
+
+ @Id(3)
bool get isFinal;
- @Id(2)
+ @Id(4)
bool get isStatic;
}
@@ -3887,6 +4114,75 @@
/// condition, with the two collection elements as its "then" and "else"
/// clauses, respectively.
ifElseElement,
+
+ /// Pop the top n+2 values from the stack, where n is obtained from
+ /// [UnlinkedExpr.ints]. The first two are the initialization and condition
+ /// of the for-loop; the remainder are the updaters.
+ forParts,
+
+ /// Pop the top 2 values from the stack. The first is the for loop parts.
+ /// The second is the body.
+ forElement,
+
+ /// Push the empty expression (used for missing initializers and conditions in
+ /// `for` loops)
+ pushEmptyExpression,
+
+ /// Add a variable to the current scope whose name is obtained from
+ /// [UnlinkedExpr.strings]. This is separate from [variableDeclaration]
+ /// because the scope of the variable includes its own initializer.
+ variableDeclarationStart,
+
+ /// Pop the top value from the stack, and use it as the initializer for a
+ /// variable declaration; the variable being declared is obtained by looking
+ /// at the nth variable most recently added to the scope (where n counts from
+ /// zero and is obtained from [UnlinkedExpr.ints]).
+ variableDeclaration,
+
+ /// Pop the top n values from the stack, which should all be variable
+ /// declarations, and use them to create an untyped for-initializer
+ /// declaration. The value of n is obtained from [UnlinkedExpr.ints].
+ forInitializerDeclarationsUntyped,
+
+ /// Pop the top n values from the stack, which should all be variable
+ /// declarations, and use them to create a typed for-initializer
+ /// declaration. The value of n is obtained from [UnlinkedExpr.ints]. The
+ /// type is obtained from [UnlinkedExpr.references].
+ forInitializerDeclarationsTyped,
+
+ /// Pop from the stack `value` and get a string from [UnlinkedExpr.strings].
+ /// Use this string to look up a parameter. Perform `parameter op= value`,
+ /// where `op` is the next assignment operator from
+ /// [UnlinkedExpr.assignmentOperators]. Push `value` back onto the stack.
+ ///
+ /// If the assignment operator is a prefix/postfix increment/decrement, then
+ /// `value` is not present in the stack, so it should not be popped and the
+ /// corresponding value of the parameter after/before update is pushed onto
+ /// the stack instead.
+ assignToParameter,
+
+ /// Pop from the stack an identifier and an expression, and create for-each
+ /// parts of the form `identifier in expression`.
+ forEachPartsWithIdentifier,
+
+ /// Pop the top 2 values from the stack. The first is the for loop parts.
+ /// The second is the body.
+ forElementWithAwait,
+
+ /// Pop an expression from the stack, and create for-each parts of the form
+ /// `var name in expression`, where `name` is obtained from
+ /// [UnlinkedExpr.strings].
+ forEachPartsWithUntypedDeclaration,
+
+ /// Pop an expression from the stack, and create for-each parts of the form
+ /// `Type name in expression`, where `name` is obtained from
+ /// [UnlinkedExpr.strings], and `Type` is obtained from
+ /// [UnlinkedExpr.references].
+ forEachPartsWithTypedDeclaration,
+
+ /// Pop the top 2 values from the stack, compute `v1 >>> v2`, and push the
+ /// result back onto the stack.
+ bitShiftRightLogical,
}
/// Unlinked summary information about an import declaration.
@@ -4051,14 +4347,17 @@
/// Enum used to indicate the kind of a parameter.
enum UnlinkedParamKind {
- /// Parameter is required.
- required,
+ /// Parameter is required and positional.
+ requiredPositional,
- /// Parameter is positional optional (enclosed in `[]`)
- positional,
+ /// Parameter is optional and positional (enclosed in `[]`)
+ optionalPositional,
- /// Parameter is named optional (enclosed in `{}`)
- named
+ /// Parameter is optional and named (enclosed in `{}`)
+ optionalNamed,
+
+ /// Parameter is required and named (enclosed in `{}`).
+ requiredNamed
}
/// Unlinked summary information about a part declaration.
@@ -4213,6 +4512,7 @@
BACKSLASH,
BANG,
BANG_EQ,
+ BANG_EQ_EQ,
BAR,
BAR_BAR,
BAR_EQ,
@@ -4240,6 +4540,7 @@
EOF,
EQ,
EQ_EQ,
+ EQ_EQ_EQ,
EXPORT,
EXTENDS,
EXTERNAL,
@@ -4255,6 +4556,8 @@
GT_EQ,
GT_GT,
GT_GT_EQ,
+ GT_GT_GT,
+ GT_GT_GT_EQ,
HASH,
HEXADECIMAL,
HIDE,
@@ -4268,6 +4571,7 @@
INT,
INTERFACE,
IS,
+ LATE,
LIBRARY,
LT,
LT_EQ,
@@ -4302,6 +4606,7 @@
QUESTION_PERIOD,
QUESTION_QUESTION,
QUESTION_QUESTION_EQ,
+ REQUIRED,
RETHROW,
RETURN,
SCRIPT_TAG,
@@ -4529,6 +4834,39 @@
List<UnlinkedVariable> get variables;
}
+/// Unlinked summary information about a compilation unit.
+@TopLevel('UUN2')
+abstract class UnlinkedUnit2 extends base.SummaryClass {
+ factory UnlinkedUnit2.fromBuffer(List<int> buffer) =>
+ generated.readUnlinkedUnit2(buffer);
+
+ /// The MD5 hash signature of the API portion of this unit. It depends on all
+ /// tokens that might affect APIs of declarations in the unit.
+ @Id(0)
+ List<int> get apiSignature;
+
+ /// URIs of `export` directives.
+ @Id(1)
+ List<String> get exports;
+
+ /// URIs of `import` directives.
+ @Id(2)
+ List<String> get imports;
+
+ /// Is `true` if the unit contains a `part of` directive.
+ @Id(3)
+ bool get isPartOf;
+
+ /// Offsets of the first character of each line in the source code.
+ @informative
+ @Id(5)
+ List<int> get lineStarts;
+
+ /// URIs of `part` directives.
+ @Id(4)
+ List<String> get parts;
+}
+
/// Unlinked summary information about a top level variable, local variable, or
/// a field.
abstract class UnlinkedVariable extends base.SummaryClass {
@@ -4581,6 +4919,10 @@
@Id(7)
bool get isFinal;
+ /// Indicates whether the variable is declared using the `late` keyword.
+ @Id(16)
+ bool get isLate;
+
/// Indicates whether the variable is declared using the `static` keyword.
///
/// Note that for top level variables, this flag is false, since they are not
diff --git a/analyzer/lib/src/summary/link.dart b/analyzer/lib/src/summary/link.dart
index d38b602..8b77137 100644
--- a/analyzer/lib/src/summary/link.dart
+++ b/analyzer/lib/src/summary/link.dart
@@ -56,12 +56,14 @@
/// - Where possible, we favor method dispatch instead of "is" and "as"
/// checks. E.g. see [ReferenceableElementForLink.asConstructor].
import 'package:analyzer/dart/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/builder.dart';
@@ -316,12 +318,14 @@
TypeParameterSerializationContext typeParameterContext) {
UnlinkedParamBuilder b = new UnlinkedParamBuilder();
b.name = parameter.name;
- if (parameter.isNotOptional) {
- b.kind = UnlinkedParamKind.required;
+ if (parameter.isRequiredPositional) {
+ b.kind = UnlinkedParamKind.requiredPositional;
+ } else if (parameter.isRequiredNamed) {
+ b.kind = UnlinkedParamKind.requiredNamed;
} else if (parameter.isOptionalPositional) {
- b.kind = UnlinkedParamKind.positional;
- } else if (parameter.isNamed) {
- b.kind = UnlinkedParamKind.named;
+ b.kind = UnlinkedParamKind.optionalPositional;
+ } else if (parameter.isOptionalNamed) {
+ b.kind = UnlinkedParamKind.optionalNamed;
}
DartType type = parameter.type;
if (!parameter.hasImplicitType) {
@@ -1906,9 +1910,13 @@
case UnlinkedExprOperation.makeUntypedMap:
case UnlinkedExprOperation.makeUntypedSet:
case UnlinkedExprOperation.makeUntypedSetOrMap:
+ case UnlinkedExprOperation.forParts:
+ case UnlinkedExprOperation.variableDeclaration:
+ case UnlinkedExprOperation.forInitializerDeclarationsUntyped:
intPtr++;
break;
case UnlinkedExprOperation.assignToRef:
+ case UnlinkedExprOperation.forEachPartsWithTypedDeclaration:
refPtr++;
break;
case UnlinkedExprOperation.invokeMethodRef:
@@ -1929,6 +1937,7 @@
break;
case UnlinkedExprOperation.makeTypedList:
case UnlinkedExprOperation.makeTypedSet:
+ case UnlinkedExprOperation.forInitializerDeclarationsTyped:
refPtr++;
intPtr++;
break;
@@ -2449,8 +2458,14 @@
new TypeParameterScope(nameScope, enclosingClass), enclosingClass);
}
var inheritance = new InheritanceManager2(linker.typeSystem);
+ // Note: this is a bit of a hack; we ought to use the feature set for the
+ // compilation unit being analyzed, but that's not feasible because sumaries
+ // don't record the feature set. This should be resolved when we switch to
+ // the "summary2" mechanism.
+ var featureSet = FeatureSet.fromEnableFlags([]);
var resolverVisitor = new ResolverVisitor(
inheritance, library, source, typeProvider, errorListener,
+ featureSet: featureSet,
nameScope: nameScope,
propagateTypes: false,
reportConstEvaluationErrors: false);
@@ -2459,9 +2474,9 @@
nameScope: nameScope);
var variableResolverVisitor = new VariableResolverVisitor(
library, source, typeProvider, errorListener,
- nameScope: nameScope);
+ nameScope: nameScope, localVariableInfo: LocalVariableInfo());
var partialResolverVisitor = new PartialResolverVisitor(
- inheritance, library, source, typeProvider, errorListener,
+ inheritance, library, source, typeProvider, errorListener, featureSet,
nameScope: nameScope);
return new ExprTypeComputer._(
unit._unitResynthesizer,
@@ -2562,6 +2577,9 @@
initializerForInference);
@override
+ bool get isLate => unlinkedVariable.isLate;
+
+ @override
bool get isStatic => unlinkedVariable.isStatic;
@override
@@ -4284,10 +4302,14 @@
bool get isInitializingFormal => unlinkedParam.isInitializingFormal;
@override
- bool get isNamed => parameterKind == ParameterKind.NAMED;
+ bool get isNamed =>
+ parameterKind == ParameterKind.NAMED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
- bool get isNotOptional => parameterKind == ParameterKind.REQUIRED;
+ bool get isNotOptional =>
+ parameterKind == ParameterKind.REQUIRED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
bool get isOptional =>
@@ -4295,6 +4317,9 @@
parameterKind == ParameterKind.POSITIONAL;
@override
+ bool get isOptionalNamed => parameterKind == ParameterKind.NAMED;
+
+ @override
bool get isOptionalPositional => parameterKind == ParameterKind.POSITIONAL;
@override
@@ -4303,16 +4328,27 @@
parameterKind == ParameterKind.REQUIRED;
@override
+ bool get isRequiredNamed => parameterKind == ParameterKind.NAMED_REQUIRED;
+
+ @override
+ bool get isRequiredPositional => parameterKind == ParameterKind.REQUIRED;
+
+ @override
+ get linkedNode => null;
+
+ @override
String get name => unlinkedParam.name;
@override
ParameterKind get parameterKind {
switch (unlinkedParam.kind) {
- case UnlinkedParamKind.required:
+ case UnlinkedParamKind.requiredPositional:
return ParameterKind.REQUIRED;
- case UnlinkedParamKind.positional:
+ case UnlinkedParamKind.requiredNamed:
+ return ParameterKind.NAMED_REQUIRED;
+ case UnlinkedParamKind.optionalPositional:
return ParameterKind.POSITIONAL;
- case UnlinkedParamKind.named:
+ case UnlinkedParamKind.optionalNamed:
return ParameterKind.NAMED;
}
return null;
@@ -4396,10 +4432,14 @@
bool get isInitializingFormal => unlinkedParam.isInitializingFormal;
@override
- bool get isNamed => parameterKind == ParameterKind.NAMED;
+ bool get isNamed =>
+ parameterKind == ParameterKind.NAMED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
- bool get isNotOptional => parameterKind == ParameterKind.REQUIRED;
+ bool get isNotOptional =>
+ parameterKind == ParameterKind.REQUIRED ||
+ parameterKind == ParameterKind.NAMED_REQUIRED;
@override
bool get isOptional =>
@@ -4407,6 +4447,9 @@
parameterKind == ParameterKind.POSITIONAL;
@override
+ bool get isOptionalNamed => parameterKind == ParameterKind.NAMED;
+
+ @override
bool get isOptionalPositional => parameterKind == ParameterKind.POSITIONAL;
@override
@@ -4415,6 +4458,12 @@
parameterKind == ParameterKind.REQUIRED;
@override
+ bool get isRequiredNamed => parameterKind == ParameterKind.NAMED_REQUIRED;
+
+ @override
+ bool get isRequiredPositional => parameterKind == ParameterKind.REQUIRED;
+
+ @override
bool get isSynthetic => true;
@override
@@ -5206,10 +5255,14 @@
case UnlinkedExprOperation.makeUntypedMap:
case UnlinkedExprOperation.makeUntypedSet:
case UnlinkedExprOperation.makeUntypedSetOrMap:
+ case UnlinkedExprOperation.forParts:
+ case UnlinkedExprOperation.variableDeclaration:
+ case UnlinkedExprOperation.forInitializerDeclarationsUntyped:
intPtr++;
break;
case UnlinkedExprOperation.makeTypedList:
case UnlinkedExprOperation.makeTypedSet:
+ case UnlinkedExprOperation.forInitializerDeclarationsTyped:
refPtr++;
intPtr++;
break;
@@ -5246,6 +5299,7 @@
break;
case UnlinkedExprOperation.typeCast:
case UnlinkedExprOperation.typeCheck:
+ case UnlinkedExprOperation.forEachPartsWithTypedDeclaration:
refPtr++;
break;
case UnlinkedExprOperation.pushLocalFunctionReference:
@@ -5420,6 +5474,9 @@
_mapType ??= _buildInterfaceType(_linker.coreLibrary, 'Map');
@override
+ DartType get neverType => BottomTypeImpl.instance;
+
+ @override
DartObjectImpl get nullObject {
// TODO(paulberry): implement if needed
throw new UnimplementedError();
@@ -5465,9 +5522,6 @@
InterfaceType get typeType =>
_typeType ??= _buildInterfaceType(_linker.coreLibrary, 'Type');
- @override
- DartType get undefinedType => UndefinedTypeImpl.instance;
-
InterfaceType _buildInterfaceType(
LibraryElementForLink library, String name) {
return library.getContainedName(name).buildType((int i) {
diff --git a/analyzer/lib/src/summary/name_filter.dart b/analyzer/lib/src/summary/name_filter.dart
index c71ff18..62633ef 100644
--- a/analyzer/lib/src/summary/name_filter.dart
+++ b/analyzer/lib/src/summary/name_filter.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/summary/package_bundle_reader.dart b/analyzer/lib/src/summary/package_bundle_reader.dart
index 55a4f9e..d015e2a 100644
--- a/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -6,23 +6,13 @@
import 'dart:math' show min;
import 'package:analyzer/dart/analysis/session.dart';
-import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/dart/constant/evaluation.dart';
-import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/resynthesize.dart';
-import 'package:analyzer/src/task/api/dart.dart';
-import 'package:analyzer/src/task/api/general.dart';
-import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/dart.dart' hide ConstantEvaluationTarget;
/**
* A [ConflictingSummaryException] indicates that two different summaries
@@ -75,26 +65,6 @@
}
/**
- * The [ResultProvider] that provides results from input package summaries.
- */
-class InputPackagesResultProvider extends ResynthesizerResultProvider {
- InputPackagesResultProvider(
- InternalAnalysisContext context, SummaryDataStore dataStore,
- {AnalysisSession session})
- : super(context, session, dataStore) {
- createResynthesizer();
- context.typeProvider = resynthesizer.typeProvider;
- resynthesizer.finishCoreAsyncLibraries();
- }
-
- @override
- bool hasResultsForSource(Source source) {
- String uriString = source.uri.toString();
- return resynthesizer.hasLibrarySummary(uriString);
- }
-}
-
-/**
* The [UriResolver] that knows about sources that are served from their
* summaries.
*/
@@ -170,173 +140,6 @@
}
/**
- * The [ResultProvider] that provides results using summary resynthesizer.
- */
-abstract class ResynthesizerResultProvider extends ResultProvider {
- final InternalAnalysisContext context;
- final AnalysisSession session;
- final SummaryDataStore _dataStore;
-
- StoreBasedSummaryResynthesizer _resynthesizer;
-
- ResynthesizerResultProvider(this.context, this.session, this._dataStore);
-
- SummaryResynthesizer get resynthesizer => _resynthesizer;
-
- /**
- * Add a new [bundle] to the resynthesizer.
- */
- void addBundle(String path, PackageBundle bundle) {
- _dataStore.addBundle(path, bundle);
- }
-
- @override
- bool compute(CacheEntry entry, ResultDescriptor result) {
- AnalysisTarget target = entry.target;
-
- if (result == TYPE_PROVIDER) {
- entry.setValue(result as ResultDescriptor<TypeProvider>,
- _resynthesizer.typeProvider, const <TargetedResult>[]);
- return true;
- }
-
- // LINE_INFO can be provided using just the UnlinkedUnit.
- if (target is Source && result == LINE_INFO) {
- String uriString = target.uri.toString();
- UnlinkedUnit unlinkedUnit = _dataStore.unlinkedMap[uriString];
- if (unlinkedUnit != null) {
- List<int> lineStarts = unlinkedUnit.lineStarts;
- if (lineStarts.isNotEmpty) {
- LineInfo lineInfo = new LineInfo(lineStarts);
- entry.setValue(result as ResultDescriptor<LineInfo>, lineInfo,
- const <TargetedResult>[]);
- return true;
- }
- }
- return false;
- }
-
- // Check whether there are results for the source.
- if (!hasResultsForSource(target.librarySource ?? target.source)) {
- return false;
- }
- // Constant expressions are always resolved in summaries.
- if (result == CONSTANT_EXPRESSION_RESOLVED &&
- target is ConstantEvaluationTarget) {
- entry.setValue(
- result as ResultDescriptor<bool>, true, const <TargetedResult>[]);
- return true;
- }
- // Provide results for Source.
- if (target is Source) {
- String uriString = target.uri.toString();
- // Provide known results.
- if (result == LIBRARY_ELEMENT1 ||
- result == LIBRARY_ELEMENT2 ||
- result == LIBRARY_ELEMENT3 ||
- result == LIBRARY_ELEMENT4 ||
- result == LIBRARY_ELEMENT5 ||
- result == LIBRARY_ELEMENT6 ||
- result == LIBRARY_ELEMENT7 ||
- result == LIBRARY_ELEMENT8 ||
- result == LIBRARY_ELEMENT9 ||
- result == LIBRARY_ELEMENT) {
- LibraryElement libraryElement =
- resynthesizer.getLibraryElement(uriString);
- entry.setValue(result as ResultDescriptor<LibraryElement>,
- libraryElement, const <TargetedResult>[]);
- return true;
- } else if (result == READY_LIBRARY_ELEMENT2 ||
- result == READY_LIBRARY_ELEMENT6 ||
- result == READY_LIBRARY_ELEMENT7) {
- entry.setValue(
- result as ResultDescriptor<bool>, true, const <TargetedResult>[]);
- return true;
- } else if (result == MODIFICATION_TIME) {
- entry.setValue(
- result as ResultDescriptor<int>, 0, const <TargetedResult>[]);
- return true;
- } else if (result == SOURCE_KIND) {
- UnlinkedUnit unlinked = _dataStore.unlinkedMap[uriString];
- if (unlinked != null) {
- entry.setValue(
- result as ResultDescriptor<SourceKind>,
- unlinked.isPartOf ? SourceKind.PART : SourceKind.LIBRARY,
- const <TargetedResult>[]);
- return true;
- }
- return false;
- } else if (result == CONTAINING_LIBRARIES) {
- List<String> libraryUriStrings =
- _dataStore.getContainingLibraryUris(uriString);
- if (libraryUriStrings != null) {
- List<Source> librarySources = libraryUriStrings
- .map((libraryUriString) =>
- context.sourceFactory.resolveUri(target, libraryUriString))
- .toList(growable: false);
- entry.setValue(result as ResultDescriptor<List<Source>>,
- librarySources, const <TargetedResult>[]);
- return true;
- }
- return false;
- }
- } else if (target is LibrarySpecificUnit) {
- if (result == CREATED_RESOLVED_UNIT1 ||
- result == CREATED_RESOLVED_UNIT2 ||
- result == CREATED_RESOLVED_UNIT3 ||
- result == CREATED_RESOLVED_UNIT4 ||
- result == CREATED_RESOLVED_UNIT5 ||
- result == CREATED_RESOLVED_UNIT6 ||
- result == CREATED_RESOLVED_UNIT7 ||
- result == CREATED_RESOLVED_UNIT8 ||
- result == CREATED_RESOLVED_UNIT9 ||
- result == CREATED_RESOLVED_UNIT10 ||
- result == CREATED_RESOLVED_UNIT11) {
- entry.setValue(
- result as ResultDescriptor<bool>, true, const <TargetedResult>[]);
- return true;
- }
- if (result == COMPILATION_UNIT_ELEMENT) {
- String libraryUri = target.library.uri.toString();
- String unitUri = target.unit.uri.toString();
- CompilationUnitElement unit = resynthesizer.getElement(
- new ElementLocationImpl.con3(<String>[libraryUri, unitUri]));
- if (unit != null) {
- entry.setValue(result as ResultDescriptor<CompilationUnitElement>,
- unit, const <TargetedResult>[]);
- return true;
- }
- }
- } else if (target is VariableElement) {
- if (result == INFERRED_STATIC_VARIABLE) {
- entry.setValue(result as ResultDescriptor<VariableElement>, target,
- const <TargetedResult>[]);
- return true;
- }
- }
- // Unknown target.
- return false;
- }
-
- /**
- * Create the [resynthesizer] instance.
- *
- * Subclasses must call this method in their constructors.
- */
- void createResynthesizer() {
- _resynthesizer = new StoreBasedSummaryResynthesizer(
- context, session, context.sourceFactory, true, _dataStore);
- }
-
- /**
- * Return `true` if this result provider can provide a result for the
- * given [source]. The provider must ensure that [addBundle] is invoked for
- * every bundle that would be required to provide results for the [source].
- */
- bool hasResultsForSource(Source source);
-}
-
-/**
* A concrete resynthesizer that serves summaries from [SummaryDataStore].
*/
class StoreBasedSummaryResynthesizer extends SummaryResynthesizer {
diff --git a/analyzer/lib/src/summary/prelink.dart b/analyzer/lib/src/summary/prelink.dart
index 1785442..b0116e6 100644
--- a/analyzer/lib/src/summary/prelink.dart
+++ b/analyzer/lib/src/summary/prelink.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/summary/resynthesize.dart b/analyzer/lib/src/summary/resynthesize.dart
index 3c6b194..6f8720e 100644
--- a/analyzer/lib/src/summary/resynthesize.dart
+++ b/analyzer/lib/src/summary/resynthesize.dart
@@ -1491,7 +1491,7 @@
bool isDeclarableType = false;
int numTypeParameters = linkedReference.numTypeParameters;
if (linkedReference.kind == ReferenceKind.unresolved) {
- type = UndefinedTypeImpl.instance;
+ type = DynamicTypeImpl.instance;
element = null;
isDeclarableType = true;
} else if (name == 'dynamic') {
diff --git a/analyzer/lib/src/summary/summarize_ast.dart b/analyzer/lib/src/summary/summarize_ast.dart
index 1f05586..b50d8cd 100644
--- a/analyzer/lib/src/summary/summarize_ast.dart
+++ b/analyzer/lib/src/summary/summarize_ast.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:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
@@ -18,7 +19,8 @@
/// bodies should be serialized to facilitate type inference.
UnlinkedUnitBuilder serializeAstUnlinked(CompilationUnit compilationUnit,
{bool serializeInferrableFields: true}) {
- return new _SummarizeAstVisitor(serializeInferrableFields)
+ return new _SummarizeAstVisitor(serializeInferrableFields,
+ compilationUnit.featureSet.isEnabled(Feature.non_nullable))
.serializeCompilationUnit(compilationUnit);
}
@@ -33,17 +35,40 @@
/// siblings.
final Map<int, int> localClosureIndexMap;
- /// If the expression being serialized appears inside a function body, the
- /// names of parameters that are in scope. Otherwise `null`.
- final Set<String> parameterNames;
+ /// The names of local variables and parameters that are in scope.
+ /// This is a list so that we can handle nesting by pushing and popping values
+ /// at the end of it.
+ final List<String> variableNames;
_ConstExprSerializer(bool forConst, this.visitor, this.localClosureIndexMap,
- this.parameterNames)
- : super(forConst);
+ List<String> variableNames)
+ : variableNames = variableNames ?? [],
+ super(forConst);
+
+ @override
+ EntityRefNullabilitySuffix computeNullabilitySuffix(Token question) =>
+ visitor.computeNullabilitySuffix(question);
@override
bool isParameterName(String name) {
- return parameterNames?.contains(name) ?? false;
+ return variableNames?.contains(name) ?? false;
+ }
+
+ @override
+ void popVariableNames(int count) {
+ variableNames.length -= count;
+ }
+
+ @override
+ void pushVariableName(String name) {
+ variableNames.add(name);
+ }
+
+ @override
+ void serialize(Expression expr) {
+ int startingVariableCount = variableNames.length;
+ super.serialize(expr);
+ assert(startingVariableCount == variableNames.length);
}
@override
@@ -67,7 +92,8 @@
@override
EntityRefBuilder serializeConstructorRef(Identifier typeName,
TypeArgumentList typeArguments, SimpleIdentifier name) {
- EntityRefBuilder typeBuilder = serializeTypeName(typeName, typeArguments);
+ EntityRefBuilder typeBuilder = serializeTypeName(
+ typeName, typeArguments, EntityRefNullabilitySuffix.starOrIrrelevant);
if (name == null) {
return typeBuilder;
} else {
@@ -95,7 +121,8 @@
visitor.serializeGenericFunctionType(node);
EntityRefBuilder serializeIdentifier(Identifier identifier) {
- EntityRefBuilder b = new EntityRefBuilder();
+ EntityRefBuilder b =
+ new EntityRefBuilder(nullabilitySuffix: computeNullabilitySuffix(null));
if (identifier is SimpleIdentifier) {
int index = visitor.serializeSimpleReference(identifier.name);
if (index < 0) {
@@ -141,8 +168,10 @@
@override
EntityRefBuilder serializeTypeName(
- Identifier name, TypeArgumentList arguments) {
- return visitor.serializeTypeName(name, arguments);
+ Identifier name,
+ TypeArgumentList arguments,
+ EntityRefNullabilitySuffix nullabilitySuffix) {
+ return visitor.serializeTypeName(name, arguments, nullabilitySuffix);
}
}
@@ -197,6 +226,8 @@
/// performed using the AST representation.
final bool _serializeInferrableFields;
+ final bool _nnbd;
+
/// List of objects which should be written to [UnlinkedUnit.classes].
final List<UnlinkedClassBuilder> classes = <UnlinkedClassBuilder>[];
@@ -298,15 +329,14 @@
/// needed by type inference.
bool _serializeClosureBodyExprs = false;
- /// If a closure function body is being serialized, the set of closure
- /// parameter names which are currently in scope. Otherwise `null`.
- Set<String> _parameterNames;
+ /// The set of variable names which are currently in scope.
+ List<String> _variableNames = [];
/// Indicates whether parameters found during visitors might inherit
/// covariance.
bool _parametersMayInheritCovariance = false;
- _SummarizeAstVisitor(this._serializeInferrableFields);
+ _SummarizeAstVisitor(this._serializeInferrableFields, this._nnbd);
/// Create a slot id for storing a propagated or inferred type or const cycle
/// info.
@@ -337,6 +367,12 @@
return scope;
}
+ EntityRefNullabilitySuffix computeNullabilitySuffix(Token question) {
+ if (!_nnbd) return EntityRefNullabilitySuffix.starOrIrrelevant;
+ if (question != null) return EntityRefNullabilitySuffix.question;
+ return EntityRefNullabilitySuffix.none;
+ }
+
/// Serialize the given list of [annotations]. If there are no annotations,
/// the empty list is returned.
List<UnlinkedExprBuilder> serializeAnnotations(
@@ -482,9 +518,9 @@
/// Serialize the given [expression], creating an [UnlinkedExprBuilder].
UnlinkedExprBuilder serializeConstExpr(
bool forConst, Map<int, int> localClosureIndexMap, Expression expression,
- [Set<String> parameterNames]) {
+ [List<String> variableNames]) {
_ConstExprSerializer serializer = new _ConstExprSerializer(
- forConst, this, localClosureIndexMap, parameterNames);
+ forConst, this, localClosureIndexMap, variableNames);
serializer.serialize(expression);
return serializer.toBuilder(expression.beginToken, expression.endToken);
}
@@ -591,11 +627,9 @@
}
b.visibleOffset = enclosingBlock?.offset;
b.visibleLength = enclosingBlock?.length;
- Set<String> oldParameterNames = _parameterNames;
+ int oldVariableNamesLength = _variableNames.length;
if (formalParameters != null && formalParameters.parameters.isNotEmpty) {
- _parameterNames =
- _parameterNames == null ? new Set<String>() : _parameterNames.toSet();
- _parameterNames.addAll(formalParameters.parameters
+ _variableNames.addAll(formalParameters.parameters
.map((FormalParameter p) => p.identifier.name));
}
serializeFunctionBody(
@@ -605,7 +639,7 @@
body?.accept(new MixinSuperInvokedNamesCollector(mixinSuperInvokedNames));
}
- _parameterNames = oldParameterNames;
+ _variableNames.length = oldVariableNamesLength;
scopes.removeLast();
assert(scopes.length == oldScopesLength);
return b;
@@ -659,10 +693,10 @@
if (serializeBodyExpr) {
if (body is Expression) {
b.bodyExpr = serializeConstExpr(
- forConst, _localClosureIndexMap, body, _parameterNames);
+ forConst, _localClosureIndexMap, body, _variableNames);
} else if (body is ExpressionFunctionBody) {
b.bodyExpr = serializeConstExpr(
- forConst, _localClosureIndexMap, body.expression, _parameterNames);
+ forConst, _localClosureIndexMap, body.expression, _variableNames);
} else {
// TODO(paulberry): serialize other types of function bodies.
}
@@ -695,7 +729,8 @@
EntityRefBuilder serializeGenericFunctionType(GenericFunctionType node) {
_TypeParameterScope typeParameterScope = new _TypeParameterScope();
scopes.add(typeParameterScope);
- EntityRefBuilder b = new EntityRefBuilder();
+ EntityRefBuilder b = new EntityRefBuilder(
+ nullabilitySuffix: computeNullabilitySuffix(node?.question));
b.entityKind = EntityRefKind.genericFunctionType;
b.typeParameters =
serializeTypeParameters(node.typeParameters, typeParameterScope);
@@ -810,12 +845,14 @@
if (_parametersMayInheritCovariance) {
b.inheritsCovariantSlot = assignSlot();
}
- if (node.isRequired) {
- b.kind = UnlinkedParamKind.required;
+ if (node.isRequiredPositional) {
+ b.kind = UnlinkedParamKind.requiredPositional;
+ } else if (node.isRequiredNamed) {
+ b.kind = UnlinkedParamKind.requiredNamed;
} else if (node.isOptionalPositional) {
- b.kind = UnlinkedParamKind.positional;
- } else if (node.isNamed) {
- b.kind = UnlinkedParamKind.named;
+ b.kind = UnlinkedParamKind.optionalPositional;
+ } else if (node.isOptionalNamed) {
+ b.kind = UnlinkedParamKind.optionalNamed;
} else {
// ignore: deprecated_member_use_from_same_package
throw new StateError('Unexpected parameter kind: ${node.kind}');
@@ -866,8 +903,10 @@
/// a [EntityRef]. Note that this method does the right thing if the
/// name doesn't refer to an entity other than a type (e.g. a class member).
EntityRefBuilder serializeType(TypeAnnotation node) {
+ var nullabilitySuffix = computeNullabilitySuffix(node?.question);
if (node is TypeName) {
- return serializeTypeName(node?.name, node?.typeArguments);
+ return serializeTypeName(
+ node?.name, node?.typeArguments, nullabilitySuffix);
} else if (node is GenericFunctionType) {
return serializeGenericFunctionType(node);
} else if (node != null) {
@@ -881,11 +920,14 @@
/// a [EntityRef]. Note that this method does the right thing if the
/// name doesn't refer to an entity other than a type (e.g. a class member).
EntityRefBuilder serializeTypeName(
- Identifier identifier, TypeArgumentList typeArguments) {
+ Identifier identifier,
+ TypeArgumentList typeArguments,
+ EntityRefNullabilitySuffix nullabilitySuffix) {
if (identifier == null) {
return null;
} else {
- EntityRefBuilder b = new EntityRefBuilder();
+ EntityRefBuilder b =
+ new EntityRefBuilder(nullabilitySuffix: nullabilitySuffix);
if (identifier is SimpleIdentifier) {
String name = identifier.name;
int indexOffset = 0;
@@ -964,6 +1006,7 @@
b.isConst = variables.isConst;
b.isCovariant = isCovariant;
b.isFinal = variables.isFinal;
+ b.isLate = variable.isLate;
b.isStatic = isDeclaredStatic;
b.name = variable.name.name;
b.nameOffset = variable.name.offset;
@@ -1093,8 +1136,8 @@
Map<int, int> localClosureIndexMap = serializeFunctionBody(b,
node.initializers, node.body, node.constKeyword != null, false, false);
if (node.constKeyword != null) {
- Set<String> constructorParameterNames =
- node.parameters.parameters.map((p) => p.identifier.name).toSet();
+ List<String> constructorParameterNames =
+ node.parameters.parameters.map((p) => p.identifier.name).toList();
b.constantInitializers = node.initializers
.map((ConstructorInitializer initializer) =>
serializeConstructorInitializer(initializer, (Expression expr) {
diff --git a/analyzer/lib/src/summary/summarize_const_expr.dart b/analyzer/lib/src/summary/summarize_const_expr.dart
index f367937..6a931fa 100644
--- a/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -127,6 +127,13 @@
/// Return `true` if the given [name] is a parameter reference.
bool isParameterName(String name);
+ /// Removes the [count] variables that were most recently added to the scope
+ /// by [pushVariableName].
+ void popVariableNames(int count);
+
+ /// Pushes a variable with the given [name] onto the current scope.
+ void pushVariableName(String name);
+
/// Serialize the given [expr] expression into this serializer state.
void serialize(Expression expr) {
try {
@@ -187,7 +194,8 @@
/// Return [EntityRefBuilder] that corresponds to the given [type].
EntityRefBuilder serializeType(TypeAnnotation type) {
if (type is TypeName) {
- return serializeTypeName(type?.name, type?.typeArguments);
+ return serializeTypeName(type?.name, type?.typeArguments,
+ computeNullabilitySuffix(type.question));
}
if (type is GenericFunctionType) {
return serializeGenericFunctionType(type);
@@ -198,8 +206,8 @@
/// Return [EntityRefBuilder] that corresponds to the type with the given
/// [name] and [arguments].
- EntityRefBuilder serializeTypeName(
- Identifier name, TypeArgumentList arguments);
+ EntityRefBuilder serializeTypeName(Identifier name,
+ TypeArgumentList arguments, EntityRefNullabilitySuffix nullabilitySuffix);
/// Return the [UnlinkedExprBuilder] that corresponds to the state of this
/// serializer.
@@ -247,6 +255,9 @@
EntityRefBuilder ref = serializeIdentifierSequence(expr);
references.add(ref);
operations.add(UnlinkedExprOperation.assignToRef);
+ } else if (expr is SimpleIdentifier && isParameterName(expr.name)) {
+ strings.add(expr.name);
+ operations.add(UnlinkedExprOperation.assignToParameter);
} else if (expr is PropertyAccess) {
if (!expr.isCascaded) {
_serialize(expr.target);
@@ -293,8 +304,10 @@
}
/// Serialize the given [expr] expression into this serializer state.
- void _serialize(Expression expr) {
- if (expr is IntegerLiteral) {
+ void _serialize(Expression expr, {bool emptyExpressionPermitted: false}) {
+ if (emptyExpressionPermitted && expr == null) {
+ operations.add(UnlinkedExprOperation.pushEmptyExpression);
+ } else if (expr is IntegerLiteral) {
int value = expr.value ?? 0;
if (value >= 0) {
_pushInt(value);
@@ -505,6 +518,8 @@
operations.add(UnlinkedExprOperation.bitOr);
} else if (operator == TokenType.GT_GT) {
operations.add(UnlinkedExprOperation.bitShiftRight);
+ } else if (operator == TokenType.GT_GT_GT) {
+ operations.add(UnlinkedExprOperation.bitShiftRightLogical);
} else if (operator == TokenType.LT_LT) {
operations.add(UnlinkedExprOperation.bitShiftLeft);
} else if (operator == TokenType.PLUS) {
@@ -558,16 +573,82 @@
_serializeCollectionElement(elseElement);
operations.add(UnlinkedExprOperation.ifElseElement);
}
+ } else if (element is ForElement) {
+ isValidConst = false;
+ var parts = element.forLoopParts;
+ int numVariablesToPop = 0;
+ if (parts is ForParts) {
+ if (parts is ForPartsWithExpression) {
+ _serialize(parts.initialization, emptyExpressionPermitted: true);
+ } else if (parts is ForPartsWithDeclarations) {
+ for (var variable in parts.variables.variables) {
+ operations.add(UnlinkedExprOperation.variableDeclarationStart);
+ var name = variable.name.name;
+ strings.add(name);
+ pushVariableName(name);
+ ++numVariablesToPop;
+ _serialize(variable.initializer, emptyExpressionPermitted: true);
+ operations.add(UnlinkedExprOperation.variableDeclaration);
+ ints.add(0);
+ }
+ var type = parts.variables.type;
+ if (type == null) {
+ operations
+ .add(UnlinkedExprOperation.forInitializerDeclarationsUntyped);
+ } else {
+ references.add(serializeType(type));
+ operations
+ .add(UnlinkedExprOperation.forInitializerDeclarationsTyped);
+ }
+ ints.add(parts.variables.variables.length);
+ } else {
+ throw StateError('Unrecognized for parts');
+ }
+ _serialize(parts.condition, emptyExpressionPermitted: true);
+ for (var updater in parts.updaters) {
+ _serialize(updater);
+ }
+ operations.add(UnlinkedExprOperation.forParts);
+ ints.add(parts.updaters.length);
+ } else if (parts is ForEachParts) {
+ if (parts is ForEachPartsWithIdentifier) {
+ _serialize(parts.identifier);
+ _serialize(parts.iterable);
+ operations.add(UnlinkedExprOperation.forEachPartsWithIdentifier);
+ } else if (parts is ForEachPartsWithDeclaration) {
+ _serialize(parts.iterable);
+ var type = parts.loopVariable.type;
+ if (type == null) {
+ operations
+ .add(UnlinkedExprOperation.forEachPartsWithUntypedDeclaration);
+ } else {
+ references.add(serializeType(type));
+ operations
+ .add(UnlinkedExprOperation.forEachPartsWithTypedDeclaration);
+ }
+ var name = parts.loopVariable.identifier.name;
+ strings.add(name);
+ pushVariableName(name);
+ ++numVariablesToPop;
+ } else {
+ throw StateError('Unrecognized for parts');
+ }
+ } else {
+ throw StateError('Unrecognized for parts');
+ }
+ _serializeCollectionElement(element.body);
+ popVariableNames(numVariablesToPop);
+ operations.add(element.awaitKeyword == null
+ ? UnlinkedExprOperation.forElement
+ : UnlinkedExprOperation.forElementWithAwait);
} else {
- // TODO(paulberry): Implement serialization for spread and control flow
- // elements.
throw new StateError('Unsupported CollectionElement: $element');
}
}
void _serializeListLiteral(ListLiteral expr) {
if (forConst || expr.typeArguments == null) {
- List<CollectionElement> elements = expr.elements2;
+ List<CollectionElement> elements = expr.elements;
elements.forEach(_serializeCollectionElement);
ints.add(elements.length);
} else {
@@ -663,10 +744,10 @@
void _serializeSetOrMapLiteral(SetOrMapLiteral expr) {
if (forConst || expr.typeArguments == null) {
- for (CollectionElement element in expr.elements2) {
+ for (CollectionElement element in expr.elements) {
_serializeCollectionElement(element);
}
- ints.add(expr.elements2.length);
+ ints.add(expr.elements.length);
} else {
ints.add(0);
}
@@ -722,4 +803,6 @@
}
}
}
+
+ EntityRefNullabilitySuffix computeNullabilitySuffix(Token question);
}
diff --git a/analyzer/lib/src/summary/summary_file_builder.dart b/analyzer/lib/src/summary/summary_file_builder.dart
index f774d2a..c558609 100644
--- a/analyzer/lib/src/summary/summary_file_builder.dart
+++ b/analyzer/lib/src/summary/summary_file_builder.dart
@@ -5,6 +5,7 @@
import 'dart:collection';
import 'package:analyzer/dart/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/listener.dart';
@@ -129,10 +130,14 @@
AnalysisErrorListener errorListener = AnalysisErrorListener.NULL_LISTENER;
String code = source.contents.data;
CharSequenceReader reader = new CharSequenceReader(code);
- Scanner scanner = new Scanner(source, reader, errorListener);
+ // TODO(paulberry): figure out the appropriate featureSet to use here
+ var featureSet = FeatureSet.fromEnableFlags([]);
+ Scanner scanner = new Scanner(source, reader, errorListener)
+ ..configureFeatures(featureSet);
Token token = scanner.tokenize();
LineInfo lineInfo = new LineInfo(scanner.lineStarts);
Parser parser = new Parser(source, errorListener,
+ featureSet: featureSet,
useFasta: context.analysisOptions.useFastaParser);
parser.enableOptionalNewAndConst = true;
CompilationUnit unit = parser.parseCompilationUnit(token);
diff --git a/analyzer/lib/src/summary/summary_sdk.dart b/analyzer/lib/src/summary/summary_sdk.dart
index b3389a0..516ca6b 100644
--- a/analyzer/lib/src/summary/summary_sdk.dart
+++ b/analyzer/lib/src/summary/summary_sdk.dart
@@ -61,11 +61,6 @@
SourceFactory factory = new SourceFactory(
[new DartUriResolver(this)], null, resourceProvider);
_analysisContext.sourceFactory = factory;
- SummaryDataStore dataStore =
- new SummaryDataStore([], resourceProvider: resourceProvider);
- dataStore.addBundle(null, _bundle);
- _analysisContext.resultProvider =
- new InputPackagesResultProvider(_analysisContext, dataStore);
}
return _analysisContext;
}
@@ -271,6 +266,9 @@
}
@override
+ DartType get neverType => BottomTypeImpl.instance;
+
+ @override
DartObjectImpl get nullObject {
if (_nullObject == null) {
_nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE);
@@ -347,9 +345,6 @@
return _typeType;
}
- @override
- DartType get undefinedType => UndefinedTypeImpl.instance;
-
/**
* Initialize the `dart:async` types provided by this type provider.
*/
diff --git a/analyzer/lib/src/summary2/ast_binary_reader.dart b/analyzer/lib/src/summary2/ast_binary_reader.dart
index 33f51e3..4927499 100644
--- a/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, 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.
@@ -8,19 +8,1301 @@
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/src/dart/element/element.dart';
-import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/linked_unit_context.dart';
/// Deserializer of fully resolved ASTs from flat buffers.
class AstBinaryReader {
final LinkedUnitContext _unitContext;
+ /// Set to `true` when this reader is used to lazily read its unit.
+ bool isLazy = false;
+
AstBinaryReader(this._unitContext);
AstNode readNode(LinkedNode data) {
+ var node = _readNode(data);
+ if (node == null) return null;
+
+ if (!isLazy) {
+ _unitContext.tokensContext.linkTokens(node.beginToken, node.endToken);
+ }
+
+ return node;
+ }
+
+ DartType readType(LinkedNodeType data) {
+ return _readType(data);
+ }
+
+ Element _elementOfComponents(
+ int rawElementIndex,
+ LinkedNodeType definingTypeNode,
+ ) {
+ var element = _getElement(rawElementIndex);
+ if (definingTypeNode == null) return element;
+
+ var definingType = _readType(definingTypeNode);
+ if (element is ConstructorElement) {
+ return ConstructorMember.from(element, definingType);
+ } else if (element is MethodElement) {
+ return MethodMember.from(element, definingType);
+ } else if (element is PropertyAccessorElement) {
+ return PropertyAccessorMember.from(element, definingType);
+ } else {
+ throw UnimplementedError('(${element.runtimeType}) $element');
+ }
+ }
+
+ T _getElement<T extends Element>(int index) {
+ var bundleContext = _unitContext.bundleContext;
+ return bundleContext.elementOfIndex(index);
+ }
+
+ Token _getToken(int index) {
+ return _unitContext.tokensContext.tokenOfIndex(index);
+ }
+
+ List<Token> _getTokens(List<int> indexList) {
+ var result = List<Token>(indexList.length);
+ for (var i = 0; i < indexList.length; ++i) {
+ var index = indexList[i];
+ result[i] = _getToken(index);
+ }
+ return result;
+ }
+
+ AdjacentStrings _read_adjacentStrings(LinkedNode data) {
+ return astFactory.adjacentStrings(
+ _readNodeList(data.adjacentStrings_strings),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ Annotation _read_annotation(LinkedNode data) {
+ return astFactory.annotation(
+ _getToken(data.annotation_atSign),
+ _readNode(data.annotation_name),
+ _getToken(data.annotation_period),
+ _readNode(data.annotation_constructorName),
+ _readNode(data.annotation_arguments),
+ )..element = _elementOfComponents(
+ data.annotation_element,
+ data.annotation_elementType,
+ );
+ }
+
+ ArgumentList _read_argumentList(LinkedNode data) {
+ return astFactory.argumentList(
+ _getToken(data.argumentList_leftParenthesis),
+ _readNodeList(data.argumentList_arguments),
+ _getToken(data.argumentList_rightParenthesis),
+ );
+ }
+
+ AsExpression _read_asExpression(LinkedNode data) {
+ return astFactory.asExpression(
+ _readNode(data.asExpression_expression),
+ _getToken(data.asExpression_asOperator),
+ _readNode(data.asExpression_type),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ AssertInitializer _read_assertInitializer(LinkedNode data) {
+ return astFactory.assertInitializer(
+ _getToken(data.assertInitializer_assertKeyword),
+ _getToken(data.assertInitializer_leftParenthesis),
+ _readNode(data.assertInitializer_condition),
+ _getToken(data.assertInitializer_comma),
+ _readNode(data.assertInitializer_message),
+ _getToken(data.assertInitializer_rightParenthesis),
+ );
+ }
+
+ AssertStatement _read_assertStatement(LinkedNode data) {
+ return astFactory.assertStatement(
+ _getToken(data.assertStatement_assertKeyword),
+ _getToken(data.assertStatement_leftParenthesis),
+ _readNode(data.assertStatement_condition),
+ _getToken(data.assertStatement_comma),
+ _readNode(data.assertStatement_message),
+ _getToken(data.assertStatement_rightParenthesis),
+ _getToken(data.assertStatement_semicolon),
+ );
+ }
+
+ AssignmentExpression _read_assignmentExpression(LinkedNode data) {
+ return astFactory.assignmentExpression(
+ _readNode(data.assignmentExpression_leftHandSide),
+ _getToken(data.assignmentExpression_operator),
+ _readNode(data.assignmentExpression_rightHandSide),
+ )
+ ..staticElement = _elementOfComponents(
+ data.assignmentExpression_element,
+ data.assignmentExpression_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ AwaitExpression _read_awaitExpression(LinkedNode data) {
+ return astFactory.awaitExpression(
+ _getToken(data.awaitExpression_awaitKeyword),
+ _readNode(data.awaitExpression_expression),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ BinaryExpression _read_binaryExpression(LinkedNode data) {
+ return astFactory.binaryExpression(
+ _readNode(data.binaryExpression_leftOperand),
+ _getToken(data.binaryExpression_operator),
+ _readNode(data.binaryExpression_rightOperand),
+ )
+ ..staticElement = _elementOfComponents(
+ data.binaryExpression_element,
+ data.binaryExpression_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ Block _read_block(LinkedNode data) {
+ return astFactory.block(
+ _getToken(data.block_leftBracket),
+ _readNodeList(data.block_statements),
+ _getToken(data.block_rightBracket),
+ );
+ }
+
+ BlockFunctionBody _read_blockFunctionBody(LinkedNode data) {
+ return astFactory.blockFunctionBody(
+ _getToken(data.blockFunctionBody_keyword),
+ _getToken(data.blockFunctionBody_star),
+ _readNode(data.blockFunctionBody_block),
+ );
+ }
+
+ BooleanLiteral _read_booleanLiteral(LinkedNode data) {
+ return astFactory.booleanLiteral(
+ _getToken(data.booleanLiteral_literal),
+ data.booleanLiteral_value,
+ )..staticType = _readType(data.expression_type);
+ }
+
+ BreakStatement _read_breakStatement(LinkedNode data) {
+ return astFactory.breakStatement(
+ _getToken(data.breakStatement_breakKeyword),
+ _readNode(data.breakStatement_label),
+ _getToken(data.breakStatement_semicolon),
+ );
+ }
+
+ CascadeExpression _read_cascadeExpression(LinkedNode data) {
+ return astFactory.cascadeExpression(
+ _readNode(data.cascadeExpression_target),
+ _readNodeList(data.cascadeExpression_sections),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ CatchClause _read_catchClause(LinkedNode data) {
+ return astFactory.catchClause(
+ _getToken(data.catchClause_onKeyword),
+ _readNode(data.catchClause_exceptionType),
+ _getToken(data.catchClause_catchKeyword),
+ _getToken(data.catchClause_leftParenthesis),
+ _readNode(data.catchClause_exceptionParameter),
+ _getToken(data.catchClause_comma),
+ _readNode(data.catchClause_stackTraceParameter),
+ _getToken(data.catchClause_rightParenthesis),
+ _readNode(data.catchClause_body),
+ );
+ }
+
+ ClassDeclaration _read_classDeclaration(LinkedNode data) {
+ var node = astFactory.classDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.classDeclaration_abstractKeyword),
+ _getToken(data.classDeclaration_classKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNode(data.classOrMixinDeclaration_typeParameters),
+ _readNodeLazy(data.classDeclaration_extendsClause),
+ _readNodeLazy(data.classDeclaration_withClause),
+ _readNodeLazy(data.classOrMixinDeclaration_implementsClause),
+ _getToken(data.classOrMixinDeclaration_leftBracket),
+ _readNodeListLazy(data.classOrMixinDeclaration_members),
+ _getToken(data.classOrMixinDeclaration_rightBracket),
+ );
+ node.nativeClause = _readNodeLazy(data.classDeclaration_nativeClause);
+ LazyClassDeclaration.setData(node, data);
+ return node;
+ }
+
+ ClassTypeAlias _read_classTypeAlias(LinkedNode data) {
+ var node = astFactory.classTypeAlias(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.typeAlias_typedefKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNode(data.classTypeAlias_typeParameters),
+ _getToken(data.classTypeAlias_equals),
+ _getToken(data.classTypeAlias_abstractKeyword),
+ _readNodeLazy(data.classTypeAlias_superclass),
+ _readNodeLazy(data.classTypeAlias_withClause),
+ _readNodeLazy(data.classTypeAlias_implementsClause),
+ _getToken(data.typeAlias_semicolon),
+ );
+ LazyClassTypeAlias.setData(node, data);
+ return node;
+ }
+
+ Comment _read_comment(LinkedNode data) {
+ var tokens = _getTokens(data.comment_tokens);
+ switch (data.comment_type) {
+ case LinkedNodeCommentType.block:
+ return astFactory.endOfLineComment(
+ tokens,
+ );
+ case LinkedNodeCommentType.documentation:
+ return astFactory.documentationComment(
+ tokens,
+ _readNodeList(data.comment_references),
+ );
+ case LinkedNodeCommentType.endOfLine:
+ return astFactory.endOfLineComment(
+ tokens,
+ );
+ default:
+ throw StateError('${data.comment_type}');
+ }
+ }
+
+ CommentReference _read_commentReference(LinkedNode data) {
+ return astFactory.commentReference(
+ _getToken(data.commentReference_newKeyword),
+ _readNode(data.commentReference_identifier),
+ );
+ }
+
+ CompilationUnit _read_compilationUnit(LinkedNode data) {
+ return astFactory.compilationUnit2(
+ beginToken: _getToken(data.compilationUnit_beginToken),
+ scriptTag: _readNode(data.compilationUnit_scriptTag),
+ directives: _readNodeList(data.compilationUnit_directives),
+ declarations: _readNodeList(data.compilationUnit_declarations),
+ endToken: _getToken(data.compilationUnit_endToken),
+ featureSet: null);
+ }
+
+ ConditionalExpression _read_conditionalExpression(LinkedNode data) {
+ return astFactory.conditionalExpression(
+ _readNode(data.conditionalExpression_condition),
+ _getToken(data.conditionalExpression_question),
+ _readNode(data.conditionalExpression_thenExpression),
+ _getToken(data.conditionalExpression_colon),
+ _readNode(data.conditionalExpression_elseExpression),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ Configuration _read_configuration(LinkedNode data) {
+ return astFactory.configuration(
+ _getToken(data.configuration_ifKeyword),
+ _getToken(data.configuration_leftParenthesis),
+ _readNode(data.configuration_name),
+ _getToken(data.configuration_equalToken),
+ _readNode(data.configuration_value),
+ _getToken(data.configuration_rightParenthesis),
+ _readNode(data.configuration_uri),
+ );
+ }
+
+ ConstructorDeclaration _read_constructorDeclaration(LinkedNode data) {
+ var node = astFactory.constructorDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.constructorDeclaration_externalKeyword),
+ _getToken(data.constructorDeclaration_constKeyword),
+ _getToken(data.constructorDeclaration_factoryKeyword),
+ _readNode(data.constructorDeclaration_returnType),
+ _getToken(data.constructorDeclaration_period),
+ _readNode(data.constructorDeclaration_name),
+ _readNodeLazy(data.constructorDeclaration_parameters),
+ _getToken(data.constructorDeclaration_separator),
+ _readNodeListLazy(data.constructorDeclaration_initializers),
+ _readNodeLazy(data.constructorDeclaration_redirectedConstructor),
+ _readNodeLazy(data.constructorDeclaration_body),
+ );
+ LazyConstructorDeclaration.setData(node, data);
+ return node;
+ }
+
+ ConstructorFieldInitializer _read_constructorFieldInitializer(
+ LinkedNode data) {
+ return astFactory.constructorFieldInitializer(
+ _getToken(data.constructorFieldInitializer_thisKeyword),
+ _getToken(data.constructorFieldInitializer_period),
+ _readNode(data.constructorFieldInitializer_fieldName),
+ _getToken(data.constructorFieldInitializer_equals),
+ _readNode(data.constructorFieldInitializer_expression),
+ );
+ }
+
+ ConstructorName _read_constructorName(LinkedNode data) {
+ return astFactory.constructorName(
+ _readNode(data.constructorName_type),
+ _getToken(data.constructorName_period),
+ _readNode(data.constructorName_name),
+ )..staticElement = _elementOfComponents(
+ data.constructorName_element,
+ data.constructorName_elementType,
+ );
+ }
+
+ ContinueStatement _read_continueStatement(LinkedNode data) {
+ return astFactory.continueStatement(
+ _getToken(data.continueStatement_continueKeyword),
+ _readNode(data.continueStatement_label),
+ _getToken(data.continueStatement_semicolon),
+ );
+ }
+
+ DeclaredIdentifier _read_declaredIdentifier(LinkedNode data) {
+ return astFactory.declaredIdentifier(
+ _readNode(data.annotatedNode_comment),
+ _readNodeList(data.annotatedNode_metadata),
+ _getToken(data.declaredIdentifier_keyword),
+ _readNode(data.declaredIdentifier_type),
+ _readNode(data.declaredIdentifier_identifier),
+ );
+ }
+
+ DefaultFormalParameter _read_defaultFormalParameter(LinkedNode data) {
+ var node = astFactory.defaultFormalParameter(
+ _readNode(data.defaultFormalParameter_parameter),
+ _toParameterKind(data.defaultFormalParameter_kind),
+ _getToken(data.defaultFormalParameter_separator),
+ _readNodeLazy(data.defaultFormalParameter_defaultValue),
+ );
+ LazyFormalParameter.setData(node, data);
+ return node;
+ }
+
+ DoStatement _read_doStatement(LinkedNode data) {
+ return astFactory.doStatement(
+ _getToken(data.doStatement_doKeyword),
+ _readNode(data.doStatement_body),
+ _getToken(data.doStatement_whileKeyword),
+ _getToken(data.doStatement_leftParenthesis),
+ _readNode(data.doStatement_condition),
+ _getToken(data.doStatement_rightParenthesis),
+ _getToken(data.doStatement_semicolon),
+ );
+ }
+
+ DottedName _read_dottedName(LinkedNode data) {
+ return astFactory.dottedName(
+ _readNodeList(data.dottedName_components),
+ );
+ }
+
+ DoubleLiteral _read_doubleLiteral(LinkedNode data) {
+ return astFactory.doubleLiteral(
+ _getToken(data.doubleLiteral_literal),
+ data.doubleLiteral_value,
+ )..staticType = _readType(data.expression_type);
+ }
+
+ EmptyFunctionBody _read_emptyFunctionBody(LinkedNode data) {
+ return astFactory.emptyFunctionBody(
+ _getToken(data.emptyFunctionBody_semicolon),
+ );
+ }
+
+ EmptyStatement _read_emptyStatement(LinkedNode data) {
+ return astFactory.emptyStatement(
+ _getToken(data.emptyStatement_semicolon),
+ );
+ }
+
+ EnumConstantDeclaration _read_enumConstantDeclaration(LinkedNode data) {
+ var node = astFactory.enumConstantDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _readNode(data.enumConstantDeclaration_name),
+ );
+ LazyEnumConstantDeclaration.setData(node, data);
+ return node;
+ }
+
+ EnumDeclaration _read_enumDeclaration(LinkedNode data) {
+ var node = astFactory.enumDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.enumDeclaration_enumKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _getToken(data.enumDeclaration_leftBracket),
+ _readNodeListLazy(data.enumDeclaration_constants),
+ _getToken(data.enumDeclaration_rightBracket),
+ );
+ LazyEnumDeclaration.setData(node, data);
+ return node;
+ }
+
+ ExportDirective _read_exportDirective(LinkedNode data) {
+ var node = astFactory.exportDirective(
+ _readNode(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.directive_keyword),
+ _readNode(data.uriBasedDirective_uri),
+ _readNodeList(data.namespaceDirective_configurations),
+ _readNodeList(data.namespaceDirective_combinators),
+ _getToken(data.directive_semicolon),
+ );
+ LazyDirective.setData(node, data);
+ return node;
+ }
+
+ ExpressionFunctionBody _read_expressionFunctionBody(LinkedNode data) {
+ return astFactory.expressionFunctionBody(
+ _getToken(data.expressionFunctionBody_keyword),
+ _getToken(data.expressionFunctionBody_arrow),
+ _readNode(data.expressionFunctionBody_expression),
+ _getToken(data.expressionFunctionBody_semicolon),
+ );
+ }
+
+ ExpressionStatement _read_expressionStatement(LinkedNode data) {
+ return astFactory.expressionStatement(
+ _readNode(data.expressionStatement_expression),
+ _getToken(data.expressionStatement_semicolon),
+ );
+ }
+
+ ExtendsClause _read_extendsClause(LinkedNode data) {
+ return astFactory.extendsClause(
+ _getToken(data.extendsClause_extendsKeyword),
+ _readNode(data.extendsClause_superclass),
+ );
+ }
+
+ FieldDeclaration _read_fieldDeclaration(LinkedNode data) {
+ var node = astFactory.fieldDeclaration2(
+ comment: _readNodeLazy(data.annotatedNode_comment),
+ covariantKeyword: _getToken(data.fieldDeclaration_covariantKeyword),
+ fieldList: _readNode(data.fieldDeclaration_fields),
+ metadata: _readNodeListLazy(data.annotatedNode_metadata),
+ semicolon: _getToken(data.fieldDeclaration_semicolon),
+ staticKeyword: _getToken(data.fieldDeclaration_staticKeyword),
+ );
+ LazyFieldDeclaration.setData(node, data);
+ return node;
+ }
+
+ FieldFormalParameter _read_fieldFormalParameter(LinkedNode data) {
+ var node = astFactory.fieldFormalParameter2(
+ identifier: _readNode(data.normalFormalParameter_identifier),
+ period: _getToken(data.fieldFormalParameter_period),
+ thisKeyword: _getToken(data.fieldFormalParameter_thisKeyword),
+ covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
+ typeParameters: _readNode(data.fieldFormalParameter_typeParameters),
+ keyword: _getToken(data.fieldFormalParameter_keyword),
+ metadata: _readNodeList(data.normalFormalParameter_metadata),
+ comment: _readNode(data.normalFormalParameter_comment),
+ type: _readNode(data.fieldFormalParameter_type),
+ parameters: _readNode(data.fieldFormalParameter_formalParameters),
+ requiredKeyword: _getToken(data.normalFormalParameter_requiredKeyword),
+ );
+ LazyFormalParameter.setData(node, data);
+ return node;
+ }
+
+ ForEachPartsWithDeclaration _read_forEachPartsWithDeclaration(
+ LinkedNode data) {
+ return astFactory.forEachPartsWithDeclaration(
+ inKeyword: _getToken(data.forEachParts_inKeyword),
+ iterable: _readNode(data.forEachParts_iterable),
+ loopVariable: _readNode(data.forEachPartsWithDeclaration_loopVariable),
+ );
+ }
+
+ ForEachPartsWithIdentifier _read_forEachPartsWithIdentifier(LinkedNode data) {
+ return astFactory.forEachPartsWithIdentifier(
+ inKeyword: _getToken(data.forEachParts_inKeyword),
+ iterable: _readNode(data.forEachParts_iterable),
+ identifier: _readNode(data.forEachPartsWithIdentifier_identifier),
+ );
+ }
+
+ ForElement _read_forElement(LinkedNode data) {
+ return astFactory.forElement(
+ awaitKeyword: _getToken(data.forMixin_awaitKeyword),
+ body: _readNode(data.forElement_body),
+ forKeyword: _getToken(data.forMixin_forKeyword),
+ forLoopParts: _readNode(data.forMixin_forLoopParts),
+ leftParenthesis: _getToken(data.forMixin_leftParenthesis),
+ rightParenthesis: _getToken(data.forMixin_rightParenthesis),
+ );
+ }
+
+ FormalParameterList _read_formalParameterList(LinkedNode data) {
+ return astFactory.formalParameterList(
+ _getToken(data.formalParameterList_leftParenthesis),
+ _readNodeList(data.formalParameterList_parameters),
+ _getToken(data.formalParameterList_leftDelimiter),
+ _getToken(data.formalParameterList_rightDelimiter),
+ _getToken(data.formalParameterList_rightParenthesis),
+ );
+ }
+
+ ForPartsWithDeclarations _read_forPartsWithDeclarations(LinkedNode data) {
+ return astFactory.forPartsWithDeclarations(
+ condition: _readNode(data.forParts_condition),
+ leftSeparator: _getToken(data.forParts_leftSeparator),
+ rightSeparator: _getToken(data.forParts_rightSeparator),
+ updaters: _readNodeList(data.forParts_updaters),
+ variables: _readNode(data.forPartsWithDeclarations_variables),
+ );
+ }
+
+ ForPartsWithExpression _read_forPartsWithExpression(LinkedNode data) {
+ return astFactory.forPartsWithExpression(
+ condition: _readNode(data.forParts_condition),
+ initialization: _readNode(data.forPartsWithExpression_initialization),
+ leftSeparator: _getToken(data.forParts_leftSeparator),
+ rightSeparator: _getToken(data.forParts_rightSeparator),
+ updaters: _readNodeList(data.forParts_updaters),
+ );
+ }
+
+ ForStatement _read_forStatement(LinkedNode data) {
+ return astFactory.forStatement(
+ awaitKeyword: _getToken(data.forMixin_awaitKeyword),
+ forKeyword: _getToken(data.forMixin_forKeyword),
+ leftParenthesis: _getToken(data.forMixin_leftParenthesis),
+ forLoopParts: _readNode(data.forMixin_forLoopParts),
+ rightParenthesis: _getToken(data.forMixin_rightParenthesis),
+ body: _readNode(data.forStatement_body),
+ );
+ }
+
+ FunctionDeclaration _read_functionDeclaration(LinkedNode data) {
+ var node = astFactory.functionDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.functionDeclaration_externalKeyword),
+ _readNodeLazy(data.functionDeclaration_returnType),
+ _getToken(data.functionDeclaration_propertyKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNodeLazy(data.functionDeclaration_functionExpression),
+ );
+ LazyFunctionDeclaration.setData(node, data);
+ return node;
+ }
+
+ FunctionDeclarationStatement _read_functionDeclarationStatement(
+ LinkedNode data) {
+ return astFactory.functionDeclarationStatement(
+ _readNode(data.functionDeclarationStatement_functionDeclaration),
+ );
+ }
+
+ FunctionExpression _read_functionExpression(LinkedNode data) {
+ var node = astFactory.functionExpression(
+ _readNode(data.functionExpression_typeParameters),
+ _readNodeLazy(data.functionExpression_formalParameters),
+ _readNodeLazy(data.functionExpression_body),
+ );
+ LazyFunctionExpression.setData(node, data);
+ return node;
+ }
+
+ FunctionExpressionInvocation _read_functionExpressionInvocation(
+ LinkedNode data) {
+ return astFactory.functionExpressionInvocation(
+ _readNode(data.functionExpressionInvocation_function),
+ _readNode(data.invocationExpression_typeArguments),
+ _readNode(data.invocationExpression_arguments),
+ )..staticInvokeType = _readType(data.invocationExpression_invokeType);
+ }
+
+ FunctionTypeAlias _read_functionTypeAlias(LinkedNode data) {
+ var node = astFactory.functionTypeAlias(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.typeAlias_typedefKeyword),
+ _readNodeLazy(data.functionTypeAlias_returnType),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNode(data.functionTypeAlias_typeParameters),
+ _readNodeLazy(data.functionTypeAlias_formalParameters),
+ _getToken(data.typeAlias_semicolon),
+ );
+ LazyFunctionTypeAlias.setData(node, data);
+ LazyFunctionTypeAlias.setHasSelfReference(
+ node,
+ data.typeAlias_hasSelfReference,
+ );
+ return node;
+ }
+
+ FunctionTypedFormalParameter _read_functionTypedFormalParameter(
+ LinkedNode data) {
+ var node = astFactory.functionTypedFormalParameter2(
+ comment: _readNodeLazy(data.normalFormalParameter_comment),
+ covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
+ identifier: _readNode(data.normalFormalParameter_identifier),
+ metadata: _readNodeListLazy(data.normalFormalParameter_metadata),
+ parameters: _readNodeLazy(
+ data.functionTypedFormalParameter_formalParameters,
+ ),
+ requiredKeyword: _getToken(data.normalFormalParameter_requiredKeyword),
+ returnType: _readNodeLazy(data.functionTypedFormalParameter_returnType),
+ typeParameters: _readNode(
+ data.functionTypedFormalParameter_typeParameters,
+ ),
+ );
+ LazyFormalParameter.setData(node, data);
+ return node;
+ }
+
+ GenericFunctionType _read_genericFunctionType(LinkedNode data) {
+ GenericFunctionTypeImpl node = astFactory.genericFunctionType(
+ _readNodeLazy(data.genericFunctionType_returnType),
+ _getToken(data.genericFunctionType_functionKeyword),
+ _readNode(data.genericFunctionType_typeParameters),
+ _readNodeLazy(data.genericFunctionType_formalParameters),
+ question: _getToken(data.genericFunctionType_question),
+ );
+ node.type = _readType(data.genericFunctionType_type);
+ LazyGenericFunctionType.setData(node, data);
+ _unitContext.addGenericFunctionType(data.genericFunctionType_id, node);
+ return node;
+ }
+
+ GenericTypeAlias _read_genericTypeAlias(LinkedNode data) {
+ var node = astFactory.genericTypeAlias(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.typeAlias_typedefKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNode(data.genericTypeAlias_typeParameters),
+ _getToken(data.genericTypeAlias_equals),
+ _readNodeLazy(data.genericTypeAlias_functionType),
+ _getToken(data.typeAlias_semicolon),
+ );
+ LazyGenericTypeAlias.setData(node, data);
+ LazyGenericTypeAlias.setHasSelfReference(
+ node,
+ data.typeAlias_hasSelfReference,
+ );
+ return node;
+ }
+
+ HideCombinator _read_hideCombinator(LinkedNode data) {
+ return astFactory.hideCombinator(
+ _getToken(data.combinator_keyword),
+ _readNodeList(data.hideCombinator_hiddenNames),
+ );
+ }
+
+ IfElement _read_ifElement(LinkedNode data) {
+ return astFactory.ifElement(
+ condition: _readNode(data.ifMixin_condition),
+ elseElement: _readNode(data.ifElement_elseElement),
+ elseKeyword: _getToken(data.ifMixin_elseKeyword),
+ ifKeyword: _getToken(data.ifMixin_ifKeyword),
+ leftParenthesis: _getToken(data.ifMixin_leftParenthesis),
+ rightParenthesis: _getToken(data.ifMixin_rightParenthesis),
+ thenElement: _readNode(data.ifElement_thenElement),
+ );
+ }
+
+ IfStatement _read_ifStatement(LinkedNode data) {
+ return astFactory.ifStatement(
+ _getToken(data.ifMixin_ifKeyword),
+ _getToken(data.ifMixin_leftParenthesis),
+ _readNode(data.ifMixin_condition),
+ _getToken(data.ifMixin_rightParenthesis),
+ _readNode(data.ifStatement_thenStatement),
+ _getToken(data.ifMixin_elseKeyword),
+ _readNode(data.ifStatement_elseStatement),
+ );
+ }
+
+ ImplementsClause _read_implementsClause(LinkedNode data) {
+ return astFactory.implementsClause(
+ _getToken(data.implementsClause_implementsKeyword),
+ _readNodeList(data.implementsClause_interfaces),
+ );
+ }
+
+ ImportDirective _read_importDirective(LinkedNode data) {
+ var node = astFactory.importDirective(
+ _readNode(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.directive_keyword),
+ _readNode(data.uriBasedDirective_uri),
+ _readNodeList(data.namespaceDirective_configurations),
+ _getToken(data.importDirective_deferredKeyword),
+ _getToken(data.importDirective_asKeyword),
+ _readNode(data.importDirective_prefix),
+ _readNodeList(data.namespaceDirective_combinators),
+ _getToken(data.directive_semicolon),
+ );
+ LazyDirective.setData(node, data);
+ return node;
+ }
+
+ IndexExpression _read_indexExpression(LinkedNode data) {
+ return astFactory.indexExpressionForTarget(
+ _readNode(data.indexExpression_target),
+ _getToken(data.indexExpression_leftBracket),
+ _readNode(data.indexExpression_index),
+ _getToken(data.indexExpression_rightBracket),
+ )
+ ..period = _getToken(data.indexExpression_period)
+ ..staticElement = _elementOfComponents(
+ data.indexExpression_element,
+ data.indexExpression_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ InstanceCreationExpression _read_instanceCreationExpression(LinkedNode data) {
+ var node = astFactory.instanceCreationExpression(
+ _getToken(data.instanceCreationExpression_keyword),
+ _readNode(data.instanceCreationExpression_constructorName),
+ _readNode(data.instanceCreationExpression_arguments),
+ typeArguments: _readNode(data.instanceCreationExpression_typeArguments),
+ );
+ node.staticElement = node.constructorName.staticElement;
+ node.staticType = _readType(data.expression_type);
+ return node;
+ }
+
+ IntegerLiteral _read_integerLiteral(LinkedNode data) {
+ return astFactory.integerLiteral(
+ _getToken(data.integerLiteral_literal),
+ data.integerLiteral_value,
+ )..staticType = _readType(data.expression_type);
+ }
+
+ InterpolationExpression _read_interpolationExpression(LinkedNode data) {
+ return astFactory.interpolationExpression(
+ _getToken(data.interpolationExpression_leftBracket),
+ _readNode(data.interpolationExpression_expression),
+ _getToken(data.interpolationExpression_rightBracket),
+ );
+ }
+
+ InterpolationString _read_interpolationString(LinkedNode data) {
+ return astFactory.interpolationString(
+ _getToken(data.interpolationString_token),
+ data.interpolationString_value,
+ );
+ }
+
+ IsExpression _read_isExpression(LinkedNode data) {
+ return astFactory.isExpression(
+ _readNode(data.isExpression_expression),
+ _getToken(data.isExpression_isOperator),
+ _getToken(data.isExpression_notOperator),
+ _readNode(data.isExpression_type),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ Label _read_label(LinkedNode data) {
+ return astFactory.label(
+ _readNode(data.label_label),
+ _getToken(data.label_colon),
+ );
+ }
+
+ LabeledStatement _read_labeledStatement(LinkedNode data) {
+ return astFactory.labeledStatement(
+ _readNodeList(data.labeledStatement_labels),
+ _readNode(data.labeledStatement_statement),
+ );
+ }
+
+ LibraryDirective _read_libraryDirective(LinkedNode data) {
+ var node = astFactory.libraryDirective(
+ _readNode(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.directive_keyword),
+ _readNode(data.libraryDirective_name),
+ _getToken(data.directive_semicolon),
+ );
+ LazyDirective.setData(node, data);
+ return node;
+ }
+
+ LibraryIdentifier _read_libraryIdentifier(LinkedNode data) {
+ return astFactory.libraryIdentifier(
+ _readNodeList(data.libraryIdentifier_components),
+ );
+ }
+
+ ListLiteral _read_listLiteral(LinkedNode data) {
+ return astFactory.listLiteral(
+ _getToken(data.typedLiteral_constKeyword),
+ _readNode(data.typedLiteral_typeArguments),
+ _getToken(data.listLiteral_leftBracket),
+ _readNodeList(data.listLiteral_elements),
+ _getToken(data.listLiteral_rightBracket),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ MapLiteralEntry _read_mapLiteralEntry(LinkedNode data) {
+ return astFactory.mapLiteralEntry(
+ _readNode(data.mapLiteralEntry_key),
+ _getToken(data.mapLiteralEntry_separator),
+ _readNode(data.mapLiteralEntry_value),
+ );
+ }
+
+ MethodDeclaration _read_methodDeclaration(LinkedNode data) {
+ var node = astFactory.methodDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.methodDeclaration_externalKeyword),
+ _getToken(data.methodDeclaration_modifierKeyword),
+ _readNodeLazy(data.methodDeclaration_returnType),
+ _getToken(data.methodDeclaration_propertyKeyword),
+ _getToken(data.methodDeclaration_operatorKeyword),
+ _readNode(data.methodDeclaration_name),
+ _readNode(data.methodDeclaration_typeParameters),
+ _readNodeLazy(data.methodDeclaration_formalParameters),
+ _readNodeLazy(data.methodDeclaration_body),
+ );
+ LazyMethodDeclaration.setData(node, data);
+ return node;
+ }
+
+ MethodInvocation _read_methodInvocation(LinkedNode data) {
+ return astFactory.methodInvocation(
+ _readNode(data.methodInvocation_target),
+ _getToken(data.methodInvocation_operator),
+ _readNode(data.methodInvocation_methodName),
+ _readNode(data.invocationExpression_typeArguments),
+ _readNode(data.invocationExpression_arguments),
+ )..staticInvokeType = _readType(data.invocationExpression_invokeType);
+ }
+
+ MixinDeclaration _read_mixinDeclaration(LinkedNode data) {
+ var node = astFactory.mixinDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.mixinDeclaration_mixinKeyword),
+ _readNode(data.namedCompilationUnitMember_name),
+ _readNode(data.classOrMixinDeclaration_typeParameters),
+ _readNodeLazy(data.mixinDeclaration_onClause),
+ _readNodeLazy(data.classOrMixinDeclaration_implementsClause),
+ _getToken(data.classOrMixinDeclaration_leftBracket),
+ _readNodeListLazy(data.classOrMixinDeclaration_members),
+ _getToken(data.classOrMixinDeclaration_rightBracket),
+ );
+ LazyMixinDeclaration(node, data);
+ return node;
+ }
+
+ NamedExpression _read_namedExpression(LinkedNode data) {
+ return astFactory.namedExpression(
+ _readNode(data.namedExpression_name),
+ _readNode(data.namedExpression_expression),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ NativeClause _read_nativeClause(LinkedNode data) {
+ return astFactory.nativeClause(
+ _getToken(data.nativeClause_nativeKeyword),
+ _readNode(data.nativeClause_name),
+ );
+ }
+
+ NativeFunctionBody _read_nativeFunctionBody(LinkedNode data) {
+ return astFactory.nativeFunctionBody(
+ _getToken(data.nativeFunctionBody_nativeKeyword),
+ _readNode(data.nativeFunctionBody_stringLiteral),
+ _getToken(data.nativeFunctionBody_semicolon),
+ );
+ }
+
+ NullLiteral _read_nullLiteral(LinkedNode data) {
+ return astFactory.nullLiteral(
+ _getToken(data.nullLiteral_literal),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ OnClause _read_onClause(LinkedNode data) {
+ return astFactory.onClause(
+ _getToken(data.onClause_onKeyword),
+ _readNodeList(data.onClause_superclassConstraints),
+ );
+ }
+
+ ParenthesizedExpression _read_parenthesizedExpression(LinkedNode data) {
+ return astFactory.parenthesizedExpression(
+ _getToken(data.parenthesizedExpression_leftParenthesis),
+ _readNode(data.parenthesizedExpression_expression),
+ _getToken(data.parenthesizedExpression_rightParenthesis),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ PartDirective _read_partDirective(LinkedNode data) {
+ var node = astFactory.partDirective(
+ _readNode(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.directive_keyword),
+ _readNode(data.uriBasedDirective_uri),
+ _getToken(data.directive_semicolon),
+ );
+ LazyDirective.setData(node, data);
+ return node;
+ }
+
+ PartOfDirective _read_partOfDirective(LinkedNode data) {
+ var node = astFactory.partOfDirective(
+ _readNode(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _getToken(data.directive_keyword),
+ _getToken(data.partOfDirective_ofKeyword),
+ _readNode(data.partOfDirective_uri),
+ _readNode(data.partOfDirective_libraryName),
+ _getToken(data.directive_semicolon),
+ );
+ LazyDirective.setData(node, data);
+ return node;
+ }
+
+ PostfixExpression _read_postfixExpression(LinkedNode data) {
+ return astFactory.postfixExpression(
+ _readNode(data.postfixExpression_operand),
+ _getToken(data.postfixExpression_operator),
+ )
+ ..staticElement = _elementOfComponents(
+ data.postfixExpression_element,
+ data.postfixExpression_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ PrefixedIdentifier _read_prefixedIdentifier(LinkedNode data) {
+ return astFactory.prefixedIdentifier(
+ _readNode(data.prefixedIdentifier_prefix),
+ _getToken(data.prefixedIdentifier_period),
+ _readNode(data.prefixedIdentifier_identifier),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ PrefixExpression _read_prefixExpression(LinkedNode data) {
+ return astFactory.prefixExpression(
+ _getToken(data.prefixExpression_operator),
+ _readNode(data.prefixExpression_operand),
+ )
+ ..staticElement = _elementOfComponents(
+ data.prefixExpression_element,
+ data.prefixExpression_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ PropertyAccess _read_propertyAccess(LinkedNode data) {
+ return astFactory.propertyAccess(
+ _readNode(data.propertyAccess_target),
+ _getToken(data.propertyAccess_operator),
+ _readNode(data.propertyAccess_propertyName),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ RedirectingConstructorInvocation _read_redirectingConstructorInvocation(
+ LinkedNode data) {
+ return astFactory.redirectingConstructorInvocation(
+ _getToken(data.redirectingConstructorInvocation_thisKeyword),
+ _getToken(data.redirectingConstructorInvocation_period),
+ _readNode(data.redirectingConstructorInvocation_constructorName),
+ _readNode(data.redirectingConstructorInvocation_arguments),
+ )..staticElement = _elementOfComponents(
+ data.redirectingConstructorInvocation_element,
+ data.redirectingConstructorInvocation_elementType,
+ );
+ }
+
+ RethrowExpression _read_rethrowExpression(LinkedNode data) {
+ return astFactory.rethrowExpression(
+ _getToken(data.rethrowExpression_rethrowKeyword),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ ReturnStatement _read_returnStatement(LinkedNode data) {
+ return astFactory.returnStatement(
+ _getToken(data.returnStatement_returnKeyword),
+ _readNode(data.returnStatement_expression),
+ _getToken(data.returnStatement_semicolon),
+ );
+ }
+
+ ScriptTag _read_scriptTag(LinkedNode data) {
+ return astFactory.scriptTag(
+ _getToken(data.scriptTag_scriptTag),
+ );
+ }
+
+ SetOrMapLiteral _read_setOrMapLiteral(LinkedNode data) {
+ SetOrMapLiteralImpl node = astFactory.setOrMapLiteral(
+ constKeyword: _getToken(data.typedLiteral_constKeyword),
+ elements: _readNodeList(data.setOrMapLiteral_elements),
+ leftBracket: _getToken(data.setOrMapLiteral_leftBracket),
+ typeArguments: _readNode(data.typedLiteral_typeArguments),
+ rightBracket: _getToken(data.setOrMapLiteral_rightBracket),
+ )..staticType = _readType(data.expression_type);
+ if (data.setOrMapLiteral_isMap) {
+ node.becomeMap();
+ } else if (data.setOrMapLiteral_isSet) {
+ node.becomeSet();
+ }
+ return node;
+ }
+
+ ShowCombinator _read_showCombinator(LinkedNode data) {
+ return astFactory.showCombinator(
+ _getToken(data.combinator_keyword),
+ _readNodeList(data.showCombinator_shownNames),
+ );
+ }
+
+ SimpleFormalParameter _read_simpleFormalParameter(LinkedNode data) {
+ SimpleFormalParameterImpl node = astFactory.simpleFormalParameter2(
+ identifier: _readNode(data.normalFormalParameter_identifier),
+ type: _readNode(data.simpleFormalParameter_type),
+ covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
+ comment: _readNode(data.normalFormalParameter_comment),
+ metadata: _readNodeList(data.normalFormalParameter_metadata),
+ keyword: _getToken(data.simpleFormalParameter_keyword),
+ requiredKeyword: _getToken(data.normalFormalParameter_requiredKeyword),
+ );
+ LazyFormalParameter.setData(node, data);
+ LazyAst.setInheritsCovariant(node, data.inheritsCovariant);
+ return node;
+ }
+
+ SimpleIdentifier _read_simpleIdentifier(LinkedNode data) {
+ return astFactory.simpleIdentifier(
+ _getToken(data.simpleIdentifier_token),
+ isDeclaration: data.simpleIdentifier_isDeclaration,
+ )
+ ..staticElement = _elementOfComponents(
+ data.simpleIdentifier_element,
+ data.simpleIdentifier_elementType,
+ )
+ ..staticType = _readType(data.expression_type);
+ }
+
+ SimpleStringLiteral _read_simpleStringLiteral(LinkedNode data) {
+ return astFactory.simpleStringLiteral(
+ _getToken(data.simpleStringLiteral_token),
+ data.simpleStringLiteral_value,
+ )..staticType = _readType(data.expression_type);
+ }
+
+ SpreadElement _read_spreadElement(LinkedNode data) {
+ return astFactory.spreadElement(
+ spreadOperator: _getToken(data.spreadElement_spreadOperator),
+ expression: _readNode(data.spreadElement_expression),
+ );
+ }
+
+ StringInterpolation _read_stringInterpolation(LinkedNode data) {
+ return astFactory.stringInterpolation(
+ _readNodeList(data.stringInterpolation_elements),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ SuperConstructorInvocation _read_superConstructorInvocation(LinkedNode data) {
+ return astFactory.superConstructorInvocation(
+ _getToken(data.superConstructorInvocation_superKeyword),
+ _getToken(data.superConstructorInvocation_period),
+ _readNode(data.superConstructorInvocation_constructorName),
+ _readNode(data.superConstructorInvocation_arguments),
+ )..staticElement = _elementOfComponents(
+ data.superConstructorInvocation_element,
+ data.superConstructorInvocation_elementType,
+ );
+ }
+
+ SuperExpression _read_superExpression(LinkedNode data) {
+ return astFactory.superExpression(
+ _getToken(data.superExpression_superKeyword),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ SwitchCase _read_switchCase(LinkedNode data) {
+ return astFactory.switchCase(
+ _readNodeList(data.switchMember_labels),
+ _getToken(data.switchMember_keyword),
+ _readNode(data.switchCase_expression),
+ _getToken(data.switchMember_colon),
+ _readNodeList(data.switchMember_statements),
+ );
+ }
+
+ SwitchDefault _read_switchDefault(LinkedNode data) {
+ return astFactory.switchDefault(
+ _readNodeList(data.switchMember_labels),
+ _getToken(data.switchMember_keyword),
+ _getToken(data.switchMember_colon),
+ _readNodeList(data.switchMember_statements),
+ );
+ }
+
+ SwitchStatement _read_switchStatement(LinkedNode data) {
+ return astFactory.switchStatement(
+ _getToken(data.switchStatement_switchKeyword),
+ _getToken(data.switchStatement_leftParenthesis),
+ _readNode(data.switchStatement_expression),
+ _getToken(data.switchStatement_rightParenthesis),
+ _getToken(data.switchStatement_leftBracket),
+ _readNodeList(data.switchStatement_members),
+ _getToken(data.switchStatement_rightBracket),
+ );
+ }
+
+ SymbolLiteral _read_symbolLiteral(LinkedNode data) {
+ return astFactory.symbolLiteral(
+ _getToken(data.symbolLiteral_poundSign),
+ _getTokens(data.symbolLiteral_components),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ ThisExpression _read_thisExpression(LinkedNode data) {
+ return astFactory.thisExpression(
+ _getToken(data.thisExpression_thisKeyword),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ ThrowExpression _read_throwExpression(LinkedNode data) {
+ return astFactory.throwExpression(
+ _getToken(data.throwExpression_throwKeyword),
+ _readNode(data.throwExpression_expression),
+ )..staticType = _readType(data.expression_type);
+ }
+
+ TopLevelVariableDeclaration _read_topLevelVariableDeclaration(
+ LinkedNode data) {
+ var node = astFactory.topLevelVariableDeclaration(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _readNode(data.topLevelVariableDeclaration_variableList),
+ _getToken(data.topLevelVariableDeclaration_semicolon),
+ );
+ LazyTopLevelVariableDeclaration.setData(node, data);
+ return node;
+ }
+
+ TryStatement _read_tryStatement(LinkedNode data) {
+ return astFactory.tryStatement(
+ _getToken(data.tryStatement_tryKeyword),
+ _readNode(data.tryStatement_body),
+ _readNodeList(data.tryStatement_catchClauses),
+ _getToken(data.tryStatement_finallyKeyword),
+ _readNode(data.tryStatement_finallyBlock),
+ );
+ }
+
+ TypeArgumentList _read_typeArgumentList(LinkedNode data) {
+ return astFactory.typeArgumentList(
+ _getToken(data.typeArgumentList_leftBracket),
+ _readNodeList(data.typeArgumentList_arguments),
+ _getToken(data.typeArgumentList_rightBracket),
+ );
+ }
+
+ TypeName _read_typeName(LinkedNode data) {
+ return astFactory.typeName(
+ _readNode(data.typeName_name),
+ _readNode(data.typeName_typeArguments),
+ question: _getToken(data.typeName_question),
+ )..type = _readType(data.typeName_type);
+ }
+
+ TypeParameter _read_typeParameter(LinkedNode data) {
+ var node = astFactory.typeParameter(
+ _readNodeLazy(data.annotatedNode_comment),
+ _readNodeListLazy(data.annotatedNode_metadata),
+ _readNode(data.typeParameter_name),
+ _getToken(data.typeParameter_extendsKeyword),
+ _readNodeLazy(data.typeParameter_bound),
+ );
+ LazyTypeParameter.setData(node, data);
+ return node;
+ }
+
+ TypeParameterList _read_typeParameterList(LinkedNode data) {
+ return astFactory.typeParameterList(
+ _getToken(data.typeParameterList_leftBracket),
+ _readNodeList(data.typeParameterList_typeParameters),
+ _getToken(data.typeParameterList_rightBracket),
+ );
+ }
+
+ VariableDeclaration _read_variableDeclaration(LinkedNode data) {
+ var node = astFactory.variableDeclaration(
+ _readNode(data.variableDeclaration_name),
+ _getToken(data.variableDeclaration_equals),
+ _readNodeLazy(data.variableDeclaration_initializer),
+ );
+ LazyVariableDeclaration.setData(node, data);
+ LazyAst.setInheritsCovariant(node, data.inheritsCovariant);
+ return node;
+ }
+
+ VariableDeclarationList _read_variableDeclarationList(LinkedNode data) {
+ var node = astFactory.variableDeclarationList2(
+ comment: _readNodeLazy(data.annotatedNode_comment),
+ keyword: _getToken(data.variableDeclarationList_keyword),
+ lateKeyword: _getToken(data.variableDeclarationList_lateKeyword),
+ metadata: _readNodeListLazy(data.annotatedNode_metadata),
+ type: _readNodeLazy(data.variableDeclarationList_type),
+ variables: _readNodeList(data.variableDeclarationList_variables),
+ );
+ LazyVariableDeclarationList.setData(node, data);
+ return node;
+ }
+
+ VariableDeclarationStatement _read_variableDeclarationStatement(
+ LinkedNode data) {
+ return astFactory.variableDeclarationStatement(
+ _readNode(data.variableDeclarationStatement_variables),
+ _getToken(data.variableDeclarationStatement_semicolon),
+ );
+ }
+
+ WhileStatement _read_whileStatement(LinkedNode data) {
+ return astFactory.whileStatement(
+ _getToken(data.whileStatement_whileKeyword),
+ _getToken(data.whileStatement_leftParenthesis),
+ _readNode(data.whileStatement_condition),
+ _getToken(data.whileStatement_rightParenthesis),
+ _readNode(data.whileStatement_body),
+ );
+ }
+
+ WithClause _read_withClause(LinkedNode data) {
+ return astFactory.withClause(
+ _getToken(data.withClause_withKeyword),
+ _readNodeList(data.withClause_mixinTypes),
+ );
+ }
+
+ YieldStatement _read_yieldStatement(LinkedNode data) {
+ return astFactory.yieldStatement(
+ _getToken(data.yieldStatement_yieldKeyword),
+ _getToken(data.yieldStatement_star),
+ _readNode(data.yieldStatement_expression),
+ _getToken(data.yieldStatement_semicolon),
+ );
+ }
+
+ AstNode _readNode(LinkedNode data) {
if (data == null) return null;
switch (data.kind) {
@@ -60,6 +1342,8 @@
return _read_classTypeAlias(data);
case LinkedNodeKind.comment:
return _read_comment(data);
+ case LinkedNodeKind.commentReference:
+ return _read_commentReference(data);
case LinkedNodeKind.compilationUnit:
return _read_compilationUnit(data);
case LinkedNodeKind.conditionalExpression:
@@ -176,6 +1460,10 @@
return _read_mixinDeclaration(data);
case LinkedNodeKind.namedExpression:
return _read_namedExpression(data);
+ case LinkedNodeKind.nativeClause:
+ return _read_nativeClause(data);
+ case LinkedNodeKind.nativeFunctionBody:
+ return _read_nativeFunctionBody(data);
case LinkedNodeKind.nullLiteral:
return _read_nullLiteral(data);
case LinkedNodeKind.onClause:
@@ -261,1187 +1549,45 @@
}
}
- T _getElement<T extends Element>(int index) {
- var bundleContext = _unitContext.bundleContext;
- return bundleContext.elementOfIndex(index);
- }
-
- List<T> _getElements<T extends Element>(List<int> indexList) {
- var bundleContext = _unitContext.bundleContext;
- return bundleContext.elementsOfIndexes(indexList);
- }
-
- Token _getToken(int index) {
- return _unitContext.tokensContext.tokenOfIndex(index);
- }
-
- List<Token> _getTokens(List<int> indexList) {
- var result = List<Token>(indexList.length);
- for (var i = 0; i < indexList.length; ++i) {
- var index = indexList[i];
- result[i] = _getToken(index);
- }
- return result;
- }
-
- AdjacentStrings _read_adjacentStrings(LinkedNode data) {
- return astFactory.adjacentStrings(
- _readNodeList(data.adjacentStrings_strings),
- )..staticType = _readType(data.expression_type);
- }
-
- Annotation _read_annotation(LinkedNode data) {
- return astFactory.annotation(
- _getToken(data.annotation_atSign),
- readNode(data.annotation_name),
- _getToken(data.annotation_period),
- readNode(data.annotation_constructorName),
- readNode(data.annotation_arguments),
- );
- }
-
- ArgumentList _read_argumentList(LinkedNode data) {
- return astFactory.argumentList(
- _getToken(data.argumentList_leftParenthesis),
- _readNodeList(data.argumentList_arguments),
- _getToken(data.argumentList_rightParenthesis),
- );
- }
-
- AsExpression _read_asExpression(LinkedNode data) {
- return astFactory.asExpression(
- readNode(data.asExpression_expression),
- _getToken(data.asExpression_asOperator),
- readNode(data.asExpression_type),
- )..staticType = _readType(data.expression_type);
- }
-
- AssertInitializer _read_assertInitializer(LinkedNode data) {
- return astFactory.assertInitializer(
- _getToken(data.assertInitializer_assertKeyword),
- _getToken(data.assertInitializer_leftParenthesis),
- readNode(data.assertInitializer_condition),
- _getToken(data.assertInitializer_comma),
- readNode(data.assertInitializer_message),
- _getToken(data.assertInitializer_rightParenthesis),
- );
- }
-
- AssertStatement _read_assertStatement(LinkedNode data) {
- return astFactory.assertStatement(
- _getToken(data.assertStatement_assertKeyword),
- _getToken(data.assertStatement_leftParenthesis),
- readNode(data.assertStatement_condition),
- _getToken(data.assertStatement_comma),
- readNode(data.assertStatement_message),
- _getToken(data.assertStatement_rightParenthesis),
- _getToken(data.assertStatement_semicolon),
- );
- }
-
- AssignmentExpression _read_assignmentExpression(LinkedNode data) {
- return astFactory.assignmentExpression(
- readNode(data.assignmentExpression_leftHandSide),
- _getToken(data.assignmentExpression_operator),
- readNode(data.assignmentExpression_rightHandSide),
- )
- ..staticElement = _getElement(data.assignmentExpression_element)
- ..staticType = _readType(data.expression_type);
- }
-
- AwaitExpression _read_awaitExpression(LinkedNode data) {
- return astFactory.awaitExpression(
- _getToken(data.awaitExpression_awaitKeyword),
- readNode(data.awaitExpression_expression),
- )..staticType = _readType(data.expression_type);
- }
-
- BinaryExpression _read_binaryExpression(LinkedNode data) {
- return astFactory.binaryExpression(
- readNode(data.binaryExpression_leftOperand),
- _getToken(data.binaryExpression_operator),
- readNode(data.binaryExpression_rightOperand),
- )
- ..staticElement = _getElement(data.binaryExpression_element)
- ..staticType = _readType(data.expression_type);
- }
-
- Block _read_block(LinkedNode data) {
- return astFactory.block(
- _getToken(data.block_leftBracket),
- _readNodeList(data.block_statements),
- _getToken(data.block_rightBracket),
- );
- }
-
- BlockFunctionBody _read_blockFunctionBody(LinkedNode data) {
- return astFactory.blockFunctionBody(
- _getToken(data.blockFunctionBody_keyword),
- _getToken(data.blockFunctionBody_star),
- readNode(data.blockFunctionBody_block),
- );
- }
-
- BooleanLiteral _read_booleanLiteral(LinkedNode data) {
- return astFactory.booleanLiteral(
- _getToken(data.booleanLiteral_literal),
- data.booleanLiteral_value,
- )..staticType = _readType(data.expression_type);
- }
-
- BreakStatement _read_breakStatement(LinkedNode data) {
- return astFactory.breakStatement(
- _getToken(data.breakStatement_breakKeyword),
- readNode(data.breakStatement_label),
- _getToken(data.breakStatement_semicolon),
- );
- }
-
- CascadeExpression _read_cascadeExpression(LinkedNode data) {
- return astFactory.cascadeExpression(
- readNode(data.cascadeExpression_target),
- _readNodeList(data.cascadeExpression_sections),
- )..staticType = _readType(data.expression_type);
- }
-
- CatchClause _read_catchClause(LinkedNode data) {
- return astFactory.catchClause(
- _getToken(data.catchClause_onKeyword),
- readNode(data.catchClause_exceptionType),
- _getToken(data.catchClause_catchKeyword),
- _getToken(data.catchClause_leftParenthesis),
- readNode(data.catchClause_exceptionParameter),
- _getToken(data.catchClause_comma),
- readNode(data.catchClause_stackTraceParameter),
- _getToken(data.catchClause_rightParenthesis),
- readNode(data.catchClause_body),
- );
- }
-
- ClassDeclaration _read_classDeclaration(LinkedNode data) {
- return astFactory.classDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.classDeclaration_abstractKeyword),
- _getToken(data.classDeclaration_classKeyword),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.classOrMixinDeclaration_typeParameters),
- readNode(data.classDeclaration_extendsClause),
- readNode(data.classDeclaration_withClause),
- readNode(data.classOrMixinDeclaration_implementsClause),
- _getToken(data.classOrMixinDeclaration_leftBracket),
- _readNodeList(data.classOrMixinDeclaration_members),
- _getToken(data.classOrMixinDeclaration_rightBracket),
- );
- }
-
- ClassTypeAlias _read_classTypeAlias(LinkedNode data) {
- return astFactory.classTypeAlias(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.typeAlias_typedefKeyword),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.classTypeAlias_typeParameters),
- _getToken(data.classTypeAlias_equals),
- _getToken(data.classTypeAlias_abstractKeyword),
- readNode(data.classTypeAlias_superclass),
- readNode(data.classTypeAlias_withClause),
- readNode(data.classTypeAlias_implementsClause),
- _getToken(data.typeAlias_semicolon),
- );
- }
-
- Comment _read_comment(LinkedNode data) {
- var tokens = _getTokens(data.comment_tokens);
- switch (data.comment_type) {
- case LinkedNodeCommentType.block:
- return astFactory.endOfLineComment(
- tokens,
- );
- case LinkedNodeCommentType.documentation:
- return astFactory.documentationComment(
- tokens,
- // TODO(scheglov) references
- );
- case LinkedNodeCommentType.endOfLine:
- return astFactory.endOfLineComment(
- tokens,
- );
- default:
- throw StateError('${data.comment_type}');
- }
- }
-
- CompilationUnit _read_compilationUnit(LinkedNode data) {
- return astFactory.compilationUnit(
- _getToken(data.compilationUnit_beginToken),
- readNode(data.compilationUnit_scriptTag),
- _readNodeList(data.compilationUnit_directives),
- _readNodeList(data.compilationUnit_declarations),
- _getToken(data.compilationUnit_endToken),
- );
- }
-
- ConditionalExpression _read_conditionalExpression(LinkedNode data) {
- return astFactory.conditionalExpression(
- readNode(data.conditionalExpression_condition),
- _getToken(data.conditionalExpression_question),
- readNode(data.conditionalExpression_thenExpression),
- _getToken(data.conditionalExpression_colon),
- readNode(data.conditionalExpression_elseExpression),
- )..staticType = _readType(data.expression_type);
- }
-
- Configuration _read_configuration(LinkedNode data) {
- return astFactory.configuration(
- _getToken(data.configuration_ifKeyword),
- _getToken(data.configuration_leftParenthesis),
- readNode(data.configuration_name),
- _getToken(data.configuration_equalToken),
- readNode(data.configuration_value),
- _getToken(data.configuration_rightParenthesis),
- readNode(data.configuration_uri),
- );
- }
-
- ConstructorDeclaration _read_constructorDeclaration(LinkedNode data) {
- return astFactory.constructorDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.constructorDeclaration_externalKeyword),
- _getToken(data.constructorDeclaration_constKeyword),
- _getToken(data.constructorDeclaration_factoryKeyword),
- readNode(data.constructorDeclaration_returnType),
- _getToken(data.constructorDeclaration_period),
- readNode(data.constructorDeclaration_name),
- readNode(data.constructorDeclaration_parameters),
- _getToken(data.constructorDeclaration_separator),
- _readNodeList(data.constructorDeclaration_initializers),
- readNode(data.constructorDeclaration_redirectedConstructor),
- readNode(data.constructorDeclaration_body),
- );
- }
-
- ConstructorFieldInitializer _read_constructorFieldInitializer(
- LinkedNode data) {
- return astFactory.constructorFieldInitializer(
- _getToken(data.constructorFieldInitializer_thisKeyword),
- _getToken(data.constructorFieldInitializer_period),
- readNode(data.constructorFieldInitializer_fieldName),
- _getToken(data.constructorFieldInitializer_equals),
- readNode(data.constructorFieldInitializer_expression),
- );
- }
-
- ConstructorName _read_constructorName(LinkedNode data) {
- return astFactory.constructorName(
- readNode(data.constructorName_type),
- _getToken(data.constructorName_period),
- readNode(data.constructorName_name),
- )..staticElement = _getElement(data.constructorName_element);
- }
-
- ContinueStatement _read_continueStatement(LinkedNode data) {
- return astFactory.continueStatement(
- _getToken(data.continueStatement_continueKeyword),
- readNode(data.continueStatement_label),
- _getToken(data.continueStatement_semicolon),
- );
- }
-
- DeclaredIdentifier _read_declaredIdentifier(LinkedNode data) {
- return astFactory.declaredIdentifier(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.declaredIdentifier_keyword),
- readNode(data.declaredIdentifier_type),
- readNode(data.declaredIdentifier_identifier),
- );
- }
-
- DefaultFormalParameter _read_defaultFormalParameter(LinkedNode data) {
- return astFactory.defaultFormalParameter(
- readNode(data.defaultFormalParameter_parameter),
- data.defaultFormalParameter_isNamed
- ? ParameterKind.NAMED
- : ParameterKind.POSITIONAL,
- _getToken(data.defaultFormalParameter_separator),
- readNode(data.defaultFormalParameter_defaultValue),
- );
- }
-
- DoStatement _read_doStatement(LinkedNode data) {
- return astFactory.doStatement(
- _getToken(data.doStatement_doKeyword),
- readNode(data.doStatement_body),
- _getToken(data.doStatement_whileKeyword),
- _getToken(data.doStatement_leftParenthesis),
- readNode(data.doStatement_condition),
- _getToken(data.doStatement_rightParenthesis),
- _getToken(data.doStatement_semicolon),
- );
- }
-
- DottedName _read_dottedName(LinkedNode data) {
- return astFactory.dottedName(
- _readNodeList(data.dottedName_components),
- );
- }
-
- DoubleLiteral _read_doubleLiteral(LinkedNode data) {
- return astFactory.doubleLiteral(
- _getToken(data.doubleLiteral_literal),
- data.doubleLiteral_value,
- )..staticType = _readType(data.expression_type);
- }
-
- EmptyFunctionBody _read_emptyFunctionBody(LinkedNode data) {
- return astFactory.emptyFunctionBody(
- _getToken(data.emptyFunctionBody_semicolon),
- );
- }
-
- EmptyStatement _read_emptyStatement(LinkedNode data) {
- return astFactory.emptyStatement(
- _getToken(data.emptyStatement_semicolon),
- );
- }
-
- EnumConstantDeclaration _read_enumConstantDeclaration(LinkedNode data) {
- return astFactory.enumConstantDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- readNode(data.enumConstantDeclaration_name),
- );
- }
-
- EnumDeclaration _read_enumDeclaration(LinkedNode data) {
- return astFactory.enumDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.enumDeclaration_enumKeyword),
- readNode(data.namedCompilationUnitMember_name),
- _getToken(data.enumDeclaration_leftBracket),
- _readNodeList(data.enumDeclaration_constants),
- _getToken(data.enumDeclaration_rightBracket),
- );
- }
-
- ExportDirective _read_exportDirective(LinkedNode data) {
- return astFactory.exportDirective(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.directive_keyword),
- readNode(data.uriBasedDirective_uri),
- _readNodeList(data.namespaceDirective_configurations),
- _readNodeList(data.namespaceDirective_combinators),
- _getToken(data.namespaceDirective_semicolon),
- );
- }
-
- ExpressionFunctionBody _read_expressionFunctionBody(LinkedNode data) {
- return astFactory.expressionFunctionBody(
- _getToken(data.expressionFunctionBody_keyword),
- _getToken(data.expressionFunctionBody_arrow),
- readNode(data.expressionFunctionBody_expression),
- _getToken(data.expressionFunctionBody_semicolon),
- );
- }
-
- ExpressionStatement _read_expressionStatement(LinkedNode data) {
- return astFactory.expressionStatement(
- readNode(data.expressionStatement_expression),
- _getToken(data.expressionStatement_semicolon),
- );
- }
-
- ExtendsClause _read_extendsClause(LinkedNode data) {
- return astFactory.extendsClause(
- _getToken(data.extendsClause_extendsKeyword),
- readNode(data.extendsClause_superclass),
- );
- }
-
- FieldDeclaration _read_fieldDeclaration(LinkedNode data) {
- return astFactory.fieldDeclaration2(
- comment: readNode(data.annotatedNode_comment),
- covariantKeyword: _getToken(data.fieldDeclaration_covariantKeyword),
- fieldList: readNode(data.fieldDeclaration_fields),
- metadata: _readNodeList(data.annotatedNode_metadata),
- semicolon: _getToken(data.fieldDeclaration_semicolon),
- staticKeyword: _getToken(data.fieldDeclaration_staticKeyword),
- );
- }
-
- FieldFormalParameter _read_fieldFormalParameter(LinkedNode data) {
- return astFactory.fieldFormalParameter2(
- identifier: readNode(data.normalFormalParameter_identifier),
- period: _getToken(data.fieldFormalParameter_period),
- thisKeyword: _getToken(data.fieldFormalParameter_thisKeyword),
- covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
- typeParameters: readNode(data.fieldFormalParameter_typeParameters),
- keyword: _getToken(data.fieldFormalParameter_keyword),
- metadata: _readNodeList(data.normalFormalParameter_metadata),
- comment: readNode(data.normalFormalParameter_comment),
- type: readNode(data.fieldFormalParameter_type),
- parameters: readNode(data.fieldFormalParameter_formalParameters),
- );
- }
-
- ForEachPartsWithDeclaration _read_forEachPartsWithDeclaration(
- LinkedNode data) {
- return astFactory.forEachPartsWithDeclaration(
- inKeyword: _getToken(data.forEachParts_inKeyword),
- iterable: readNode(data.forEachParts_iterable),
- loopVariable: readNode(data.forEachPartsWithDeclaration_loopVariable),
- );
- }
-
- ForEachPartsWithIdentifier _read_forEachPartsWithIdentifier(LinkedNode data) {
- return astFactory.forEachPartsWithIdentifier(
- inKeyword: _getToken(data.forEachParts_inKeyword),
- iterable: readNode(data.forEachParts_iterable),
- identifier: readNode(data.forEachPartsWithIdentifier_identifier),
- );
- }
-
- ForElement _read_forElement(LinkedNode data) {
- return astFactory.forElement(
- awaitKeyword: _getToken(data.forMixin_awaitKeyword),
- body: readNode(data.forElement_body),
- forKeyword: _getToken(data.forMixin_forKeyword),
- forLoopParts: readNode(data.forMixin_forLoopParts),
- leftParenthesis: _getToken(data.forMixin_leftParenthesis),
- rightParenthesis: _getToken(data.forMixin_rightParenthesis),
- );
- }
-
- FormalParameterList _read_formalParameterList(LinkedNode data) {
- return astFactory.formalParameterList(
- _getToken(data.formalParameterList_leftParenthesis),
- _readNodeList(data.formalParameterList_parameters),
- _getToken(data.formalParameterList_leftDelimiter),
- _getToken(data.formalParameterList_rightDelimiter),
- _getToken(data.formalParameterList_rightParenthesis),
- );
- }
-
- ForPartsWithDeclarations _read_forPartsWithDeclarations(LinkedNode data) {
- return astFactory.forPartsWithDeclarations(
- condition: readNode(data.forParts_condition),
- leftSeparator: _getToken(data.forParts_leftSeparator),
- rightSeparator: _getToken(data.forParts_rightSeparator),
- updaters: _readNodeList(data.forParts_updaters),
- variables: readNode(data.forPartsWithDeclarations_variables),
- );
- }
-
- ForPartsWithExpression _read_forPartsWithExpression(LinkedNode data) {
- return astFactory.forPartsWithExpression(
- condition: readNode(data.forParts_condition),
- initialization: readNode(data.forPartsWithExpression_initialization),
- leftSeparator: _getToken(data.forParts_leftSeparator),
- rightSeparator: _getToken(data.forParts_rightSeparator),
- updaters: _readNodeList(data.forParts_updaters),
- );
- }
-
- ForStatement2 _read_forStatement(LinkedNode data) {
- return astFactory.forStatement2(
- forKeyword: _getToken(data.forMixin_forKeyword),
- leftParenthesis: _getToken(data.forMixin_leftParenthesis),
- forLoopParts: readNode(data.forMixin_forLoopParts),
- rightParenthesis: _getToken(data.forMixin_rightParenthesis),
- body: readNode(data.forStatement_body),
- );
- }
-
- FunctionDeclaration _read_functionDeclaration(LinkedNode data) {
- return astFactory.functionDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.functionDeclaration_externalKeyword),
- readNode(data.functionDeclaration_returnType),
- _getToken(data.functionDeclaration_propertyKeyword),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.functionDeclaration_functionExpression),
- );
- }
-
- FunctionDeclarationStatement _read_functionDeclarationStatement(
- LinkedNode data) {
- return astFactory.functionDeclarationStatement(
- readNode(data.functionDeclarationStatement_functionDeclaration),
- );
- }
-
- FunctionExpression _read_functionExpression(LinkedNode data) {
- return astFactory.functionExpression(
- readNode(data.functionExpression_typeParameters),
- readNode(data.functionExpression_formalParameters),
- readNode(data.functionExpression_body),
- );
- }
-
- FunctionExpressionInvocation _read_functionExpressionInvocation(
- LinkedNode data) {
- return astFactory.functionExpressionInvocation(
- readNode(data.functionExpressionInvocation_function),
- readNode(data.invocationExpression_typeArguments),
- readNode(data.invocationExpression_arguments),
- )..staticInvokeType = _readType(data.invocationExpression_invokeType);
- }
-
- FunctionTypeAlias _read_functionTypeAlias(LinkedNode data) {
- return astFactory.functionTypeAlias(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.typeAlias_typedefKeyword),
- readNode(data.functionTypeAlias_returnType),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.functionTypeAlias_typeParameters),
- readNode(data.functionTypeAlias_formalParameters),
- _getToken(data.typeAlias_semicolon),
- );
- }
-
- FunctionTypedFormalParameter _read_functionTypedFormalParameter(
- LinkedNode data) {
- return astFactory.functionTypedFormalParameter2(
- identifier: readNode(data.normalFormalParameter_identifier),
- parameters: readNode(data.functionTypedFormalParameter_formalParameters),
- returnType: readNode(data.functionTypedFormalParameter_returnType),
- covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
- comment: readNode(data.normalFormalParameter_comment),
- metadata: _readNodeList(data.normalFormalParameter_metadata),
- typeParameters:
- readNode(data.functionTypedFormalParameter_typeParameters),
- );
- }
-
- GenericFunctionType _read_genericFunctionType(LinkedNode data) {
- return astFactory.genericFunctionType(
- readNode(data.genericFunctionType_returnType),
- _getToken(data.genericFunctionType_functionKeyword),
- readNode(data.genericFunctionType_typeParameters),
- readNode(data.genericFunctionType_formalParameters),
- question: _getToken(data.genericFunctionType_question),
- );
- }
-
- GenericTypeAlias _read_genericTypeAlias(LinkedNode data) {
- return astFactory.genericTypeAlias(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.typeAlias_typedefKeyword),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.genericTypeAlias_typeParameters),
- _getToken(data.genericTypeAlias_equals),
- readNode(data.genericTypeAlias_functionType),
- _getToken(data.typeAlias_semicolon),
- );
- }
-
- HideCombinator _read_hideCombinator(LinkedNode data) {
- return astFactory.hideCombinator(
- _getToken(data.combinator_keyword),
- _readNodeList(data.hideCombinator_hiddenNames),
- );
- }
-
- IfElement _read_ifElement(LinkedNode data) {
- return astFactory.ifElement(
- condition: readNode(data.ifMixin_condition),
- elseElement: readNode(data.ifElement_elseElement),
- elseKeyword: _getToken(data.ifMixin_elseKeyword),
- ifKeyword: _getToken(data.ifMixin_ifKeyword),
- leftParenthesis: _getToken(data.ifMixin_leftParenthesis),
- rightParenthesis: _getToken(data.ifMixin_rightParenthesis),
- thenElement: readNode(data.ifElement_thenElement),
- );
- }
-
- IfStatement _read_ifStatement(LinkedNode data) {
- return astFactory.ifStatement(
- _getToken(data.ifMixin_ifKeyword),
- _getToken(data.ifMixin_leftParenthesis),
- readNode(data.ifMixin_condition),
- _getToken(data.ifMixin_rightParenthesis),
- readNode(data.ifStatement_thenStatement),
- _getToken(data.ifMixin_elseKeyword),
- readNode(data.ifStatement_elseStatement),
- );
- }
-
- ImplementsClause _read_implementsClause(LinkedNode data) {
- return astFactory.implementsClause(
- _getToken(data.implementsClause_implementsKeyword),
- _readNodeList(data.implementsClause_interfaces),
- );
- }
-
- ImportDirective _read_importDirective(LinkedNode data) {
- return astFactory.importDirective(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.directive_keyword),
- readNode(data.uriBasedDirective_uri),
- _readNodeList(data.namespaceDirective_configurations),
- _getToken(data.importDirective_deferredKeyword),
- _getToken(data.importDirective_asKeyword),
- readNode(data.importDirective_prefix),
- _readNodeList(data.namespaceDirective_combinators),
- _getToken(data.namespaceDirective_semicolon),
- );
- }
-
- IndexExpression _read_indexExpression(LinkedNode data) {
- return astFactory.indexExpressionForTarget(
- readNode(data.indexExpression_target),
- _getToken(data.indexExpression_leftBracket),
- readNode(data.indexExpression_index),
- _getToken(data.indexExpression_rightBracket),
- )
- ..staticElement = _getElement(data.indexExpression_element)
- ..staticType = _readType(data.expression_type);
- }
-
- InstanceCreationExpression _read_instanceCreationExpression(LinkedNode data) {
- return astFactory.instanceCreationExpression(
- _getToken(data.instanceCreationExpression_keyword),
- readNode(data.instanceCreationExpression_constructorName),
- readNode(data.instanceCreationExpression_arguments),
- typeArguments: readNode(data.instanceCreationExpression_typeArguments),
- )..staticType = _readType(data.expression_type);
- }
-
- IntegerLiteral _read_integerLiteral(LinkedNode data) {
- return astFactory.integerLiteral(
- _getToken(data.integerLiteral_literal),
- data.integerLiteral_value,
- )..staticType = _readType(data.expression_type);
- }
-
- InterpolationExpression _read_interpolationExpression(LinkedNode data) {
- return astFactory.interpolationExpression(
- _getToken(data.interpolationExpression_leftBracket),
- readNode(data.interpolationExpression_expression),
- _getToken(data.interpolationExpression_rightBracket),
- );
- }
-
- InterpolationString _read_interpolationString(LinkedNode data) {
- return astFactory.interpolationString(
- _getToken(data.interpolationString_token),
- data.interpolationString_value,
- );
- }
-
- IsExpression _read_isExpression(LinkedNode data) {
- return astFactory.isExpression(
- readNode(data.isExpression_expression),
- _getToken(data.isExpression_isOperator),
- _getToken(data.isExpression_notOperator),
- readNode(data.isExpression_type),
- )..staticType = _readType(data.expression_type);
- }
-
- Label _read_label(LinkedNode data) {
- return astFactory.label(
- readNode(data.label_label),
- _getToken(data.label_colon),
- );
- }
-
- LabeledStatement _read_labeledStatement(LinkedNode data) {
- return astFactory.labeledStatement(
- _readNodeList(data.labeledStatement_labels),
- readNode(data.labeledStatement_statement),
- );
- }
-
- LibraryDirective _read_libraryDirective(LinkedNode data) {
- return astFactory.libraryDirective(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.directive_keyword),
- readNode(data.libraryDirective_name),
- _getToken(data.namespaceDirective_semicolon),
- );
- }
-
- LibraryIdentifier _read_libraryIdentifier(LinkedNode data) {
- return astFactory.libraryIdentifier(
- _readNodeList(data.libraryIdentifier_components),
- );
- }
-
- ListLiteral _read_listLiteral(LinkedNode data) {
- return astFactory.listLiteral(
- _getToken(data.typedLiteral_constKeyword),
- readNode(data.typedLiteral_typeArguments),
- _getToken(data.listLiteral_leftBracket),
- _readNodeList(data.listLiteral_elements),
- _getToken(data.listLiteral_rightBracket),
- )..staticType = _readType(data.expression_type);
- }
-
- MapLiteralEntry _read_mapLiteralEntry(LinkedNode data) {
- return astFactory.mapLiteralEntry(
- readNode(data.mapLiteralEntry_key),
- _getToken(data.mapLiteralEntry_separator),
- readNode(data.mapLiteralEntry_value),
- );
- }
-
- MethodDeclaration _read_methodDeclaration(LinkedNode data) {
- return astFactory.methodDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.methodDeclaration_externalKeyword),
- _getToken(data.methodDeclaration_modifierKeyword),
- readNode(data.methodDeclaration_returnType),
- _getToken(data.methodDeclaration_propertyKeyword),
- _getToken(data.methodDeclaration_operatorKeyword),
- readNode(data.methodDeclaration_name),
- readNode(data.methodDeclaration_typeParameters),
- readNode(data.methodDeclaration_formalParameters),
- readNode(data.methodDeclaration_body),
- );
- }
-
- MethodInvocation _read_methodInvocation(LinkedNode data) {
- return astFactory.methodInvocation(
- readNode(data.methodInvocation_target),
- _getToken(data.methodInvocation_operator),
- readNode(data.methodInvocation_methodName),
- readNode(data.invocationExpression_typeArguments),
- readNode(data.invocationExpression_arguments),
- )..staticInvokeType = _readType(data.invocationExpression_invokeType);
- }
-
- MixinDeclaration _read_mixinDeclaration(LinkedNode data) {
- return astFactory.mixinDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.mixinDeclaration_mixinKeyword),
- readNode(data.namedCompilationUnitMember_name),
- readNode(data.classOrMixinDeclaration_typeParameters),
- readNode(data.mixinDeclaration_onClause),
- readNode(data.classOrMixinDeclaration_implementsClause),
- _getToken(data.classOrMixinDeclaration_leftBracket),
- _readNodeList(data.classOrMixinDeclaration_members),
- _getToken(data.classOrMixinDeclaration_rightBracket),
- );
- }
-
- NamedExpression _read_namedExpression(LinkedNode data) {
- return astFactory.namedExpression(
- readNode(data.namedExpression_name),
- readNode(data.namedExpression_expression),
- )..staticType = _readType(data.expression_type);
- }
-
- NullLiteral _read_nullLiteral(LinkedNode data) {
- return astFactory.nullLiteral(
- _getToken(data.nullLiteral_literal),
- )..staticType = _readType(data.expression_type);
- }
-
- OnClause _read_onClause(LinkedNode data) {
- return astFactory.onClause(
- _getToken(data.onClause_onKeyword),
- _readNodeList(data.onClause_superclassConstraints),
- );
- }
-
- ParenthesizedExpression _read_parenthesizedExpression(LinkedNode data) {
- return astFactory.parenthesizedExpression(
- _getToken(data.parenthesizedExpression_leftParenthesis),
- readNode(data.parenthesizedExpression_expression),
- _getToken(data.parenthesizedExpression_rightParenthesis),
- )..staticType = _readType(data.expression_type);
- }
-
- PartDirective _read_partDirective(LinkedNode data) {
- return astFactory.partDirective(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.directive_keyword),
- readNode(data.uriBasedDirective_uri),
- _getToken(data.namespaceDirective_semicolon),
- );
- }
-
- PartOfDirective _read_partOfDirective(LinkedNode data) {
- return astFactory.partOfDirective(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.directive_keyword),
- _getToken(data.partOfDirective_ofKeyword),
- readNode(data.partOfDirective_uri),
- readNode(data.partOfDirective_libraryName),
- _getToken(data.partOfDirective_semicolon),
- );
- }
-
- PostfixExpression _read_postfixExpression(LinkedNode data) {
- return astFactory.postfixExpression(
- readNode(data.postfixExpression_operand),
- _getToken(data.postfixExpression_operator),
- )
- ..staticElement = _getElement(data.postfixExpression_element)
- ..staticType = _readType(data.expression_type);
- }
-
- PrefixedIdentifier _read_prefixedIdentifier(LinkedNode data) {
- return astFactory.prefixedIdentifier(
- readNode(data.prefixedIdentifier_prefix),
- _getToken(data.prefixedIdentifier_period),
- readNode(data.prefixedIdentifier_identifier),
- )..staticType = _readType(data.expression_type);
- }
-
- PrefixExpression _read_prefixExpression(LinkedNode data) {
- return astFactory.prefixExpression(
- _getToken(data.prefixExpression_operator),
- readNode(data.prefixExpression_operand),
- )
- ..staticElement = _getElement(data.prefixExpression_element)
- ..staticType = _readType(data.expression_type);
- }
-
- PropertyAccess _read_propertyAccess(LinkedNode data) {
- return astFactory.propertyAccess(
- readNode(data.propertyAccess_target),
- _getToken(data.propertyAccess_operator),
- readNode(data.propertyAccess_propertyName),
- )..staticType = _readType(data.expression_type);
- }
-
- RedirectingConstructorInvocation _read_redirectingConstructorInvocation(
- LinkedNode data) {
- return astFactory.redirectingConstructorInvocation(
- _getToken(data.redirectingConstructorInvocation_thisKeyword),
- _getToken(data.redirectingConstructorInvocation_period),
- readNode(data.redirectingConstructorInvocation_constructorName),
- readNode(data.redirectingConstructorInvocation_arguments),
- )..staticElement =
- _getElement(data.redirectingConstructorInvocation_element);
- }
-
- RethrowExpression _read_rethrowExpression(LinkedNode data) {
- return astFactory.rethrowExpression(
- _getToken(data.rethrowExpression_rethrowKeyword),
- )..staticType = _readType(data.expression_type);
- }
-
- ReturnStatement _read_returnStatement(LinkedNode data) {
- return astFactory.returnStatement(
- _getToken(data.returnStatement_returnKeyword),
- readNode(data.returnStatement_expression),
- _getToken(data.returnStatement_semicolon),
- );
- }
-
- ScriptTag _read_scriptTag(LinkedNode data) {
- return astFactory.scriptTag(
- _getToken(data.scriptTag_scriptTag),
- );
- }
-
- SetOrMapLiteral _read_setOrMapLiteral(LinkedNode data) {
- SetOrMapLiteralImpl node = astFactory.setOrMapLiteral(
- constKeyword: _getToken(data.typedLiteral_constKeyword),
- elements: _readNodeList(data.setOrMapLiteral_elements),
- leftBracket: _getToken(data.setOrMapLiteral_leftBracket),
- typeArguments: readNode(data.typedLiteral_typeArguments),
- rightBracket: _getToken(data.setOrMapLiteral_leftBracket),
- )..staticType = _readType(data.expression_type);
- if (data.setOrMapLiteral_isMap) {
- node.becomeMap();
- } else if (data.setOrMapLiteral_isSet) {
- node.becomeSet();
- }
- return node;
- }
-
- ShowCombinator _read_showCombinator(LinkedNode data) {
- return astFactory.showCombinator(
- _getToken(data.combinator_keyword),
- _readNodeList(data.showCombinator_shownNames),
- );
- }
-
- SimpleFormalParameter _read_simpleFormalParameter(LinkedNode data) {
- return astFactory.simpleFormalParameter2(
- identifier: readNode(data.normalFormalParameter_identifier),
- type: readNode(data.simpleFormalParameter_type),
- covariantKeyword: _getToken(data.normalFormalParameter_covariantKeyword),
- comment: readNode(data.normalFormalParameter_comment),
- metadata: _readNodeList(data.normalFormalParameter_metadata),
- keyword: _getToken(data.simpleFormalParameter_keyword),
- );
- }
-
- SimpleIdentifier _read_simpleIdentifier(LinkedNode data) {
- return astFactory.simpleIdentifier(
- _getToken(data.simpleIdentifier_token),
- )
- ..staticElement = _getElement(data.simpleIdentifier_element)
- ..staticType = _readType(data.expression_type);
- }
-
- SimpleStringLiteral _read_simpleStringLiteral(LinkedNode data) {
- return astFactory.simpleStringLiteral(
- _getToken(data.simpleStringLiteral_token),
- data.simpleStringLiteral_value,
- )..staticType = _readType(data.expression_type);
- }
-
- SpreadElement _read_spreadElement(LinkedNode data) {
- return astFactory.spreadElement(
- spreadOperator: _getToken(data.spreadElement_spreadOperator),
- expression: readNode(data.spreadElement_expression),
- );
- }
-
- StringInterpolation _read_stringInterpolation(LinkedNode data) {
- return astFactory.stringInterpolation(
- _readNodeList(data.stringInterpolation_elements),
- )..staticType = _readType(data.expression_type);
- }
-
- SuperConstructorInvocation _read_superConstructorInvocation(LinkedNode data) {
- return astFactory.superConstructorInvocation(
- _getToken(data.superConstructorInvocation_superKeyword),
- _getToken(data.superConstructorInvocation_period),
- readNode(data.superConstructorInvocation_constructorName),
- readNode(data.superConstructorInvocation_arguments),
- )..staticElement = _getElement(data.superConstructorInvocation_element);
- }
-
- SuperExpression _read_superExpression(LinkedNode data) {
- return astFactory.superExpression(
- _getToken(data.superExpression_superKeyword),
- )..staticType = _readType(data.expression_type);
- }
-
- SwitchCase _read_switchCase(LinkedNode data) {
- return astFactory.switchCase(
- _readNodeList(data.switchMember_labels),
- _getToken(data.switchMember_keyword),
- readNode(data.switchCase_expression),
- _getToken(data.switchMember_colon),
- _readNodeList(data.switchMember_statements),
- );
- }
-
- SwitchDefault _read_switchDefault(LinkedNode data) {
- return astFactory.switchDefault(
- _readNodeList(data.switchMember_labels),
- _getToken(data.switchMember_keyword),
- _getToken(data.switchMember_colon),
- _readNodeList(data.switchMember_statements),
- );
- }
-
- SwitchStatement _read_switchStatement(LinkedNode data) {
- return astFactory.switchStatement(
- _getToken(data.switchStatement_switchKeyword),
- _getToken(data.switchStatement_leftParenthesis),
- readNode(data.switchStatement_expression),
- _getToken(data.switchStatement_rightParenthesis),
- _getToken(data.switchStatement_leftBracket),
- _readNodeList(data.switchStatement_members),
- _getToken(data.switchStatement_rightBracket),
- );
- }
-
- SymbolLiteral _read_symbolLiteral(LinkedNode data) {
- return astFactory.symbolLiteral(
- _getToken(data.symbolLiteral_poundSign),
- _getTokens(data.symbolLiteral_components),
- )..staticType = _readType(data.expression_type);
- }
-
- ThisExpression _read_thisExpression(LinkedNode data) {
- return astFactory.thisExpression(
- _getToken(data.thisExpression_thisKeyword),
- )..staticType = _readType(data.expression_type);
- }
-
- ThrowExpression _read_throwExpression(LinkedNode data) {
- return astFactory.throwExpression(
- _getToken(data.throwExpression_throwKeyword),
- readNode(data.throwExpression_expression),
- )..staticType = _readType(data.expression_type);
- }
-
- TopLevelVariableDeclaration _read_topLevelVariableDeclaration(
- LinkedNode data) {
- return astFactory.topLevelVariableDeclaration(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- readNode(data.topLevelVariableDeclaration_variableList),
- _getToken(data.topLevelVariableDeclaration_semicolon),
- );
- }
-
- TryStatement _read_tryStatement(LinkedNode data) {
- return astFactory.tryStatement(
- _getToken(data.tryStatement_tryKeyword),
- readNode(data.tryStatement_body),
- _readNodeList(data.tryStatement_catchClauses),
- _getToken(data.tryStatement_tryKeyword),
- readNode(data.tryStatement_finallyBlock),
- );
- }
-
- TypeArgumentList _read_typeArgumentList(LinkedNode data) {
- return astFactory.typeArgumentList(
- _getToken(data.typeArgumentList_leftBracket),
- _readNodeList(data.typeArgumentList_arguments),
- _getToken(data.typeArgumentList_rightBracket),
- );
- }
-
- TypeName _read_typeName(LinkedNode data) {
- return astFactory.typeName(
- readNode(data.typeName_name),
- readNode(data.typeName_typeArguments),
- question: _getToken(data.typeName_question),
- )..type = _readType(data.typeName_type);
- }
-
- TypeParameter _read_typeParameter(LinkedNode data) {
- return astFactory.typeParameter(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- readNode(data.typeParameter_name),
- _getToken(data.typeParameter_extendsKeyword),
- readNode(data.typeParameter_bound),
- );
- }
-
- TypeParameterList _read_typeParameterList(LinkedNode data) {
- return astFactory.typeParameterList(
- _getToken(data.typeParameterList_leftBracket),
- _readNodeList(data.typeParameterList_typeParameters),
- _getToken(data.typeParameterList_rightBracket),
- );
- }
-
- VariableDeclaration _read_variableDeclaration(LinkedNode data) {
- return astFactory.variableDeclaration(
- readNode(data.variableDeclaration_name),
- _getToken(data.variableDeclaration_equals),
- readNode(data.variableDeclaration_initializer),
- );
- }
-
- VariableDeclarationList _read_variableDeclarationList(LinkedNode data) {
- return astFactory.variableDeclarationList(
- readNode(data.annotatedNode_comment),
- _readNodeList(data.annotatedNode_metadata),
- _getToken(data.variableDeclarationList_keyword),
- readNode(data.variableDeclarationList_type),
- _readNodeList(data.variableDeclarationList_variables),
- );
- }
-
- VariableDeclarationStatement _read_variableDeclarationStatement(
- LinkedNode data) {
- return astFactory.variableDeclarationStatement(
- readNode(data.variableDeclarationStatement_variables),
- _getToken(data.variableDeclarationStatement_semicolon),
- );
- }
-
- WhileStatement _read_whileStatement(LinkedNode data) {
- return astFactory.whileStatement(
- _getToken(data.whileStatement_whileKeyword),
- _getToken(data.whileStatement_leftParenthesis),
- readNode(data.whileStatement_condition),
- _getToken(data.whileStatement_rightParenthesis),
- readNode(data.whileStatement_body),
- );
- }
-
- WithClause _read_withClause(LinkedNode data) {
- return astFactory.withClause(
- _getToken(data.withClause_withKeyword),
- _readNodeList(data.withClause_mixinTypes),
- );
- }
-
- YieldStatement _read_yieldStatement(LinkedNode data) {
- return astFactory.yieldStatement(
- _getToken(data.yieldStatement_yieldKeyword),
- _getToken(data.yieldStatement_star),
- readNode(data.yieldStatement_expression),
- _getToken(data.yieldStatement_semicolon),
- );
+ AstNode _readNodeLazy(LinkedNode data) {
+ if (isLazy) return null;
+ return _readNode(data);
}
List<T> _readNodeList<T>(List<LinkedNode> nodeList) {
var result = List<T>.filled(nodeList.length, null);
for (var i = 0; i < nodeList.length; ++i) {
var linkedNode = nodeList[i];
- result[i] = readNode(linkedNode) as T;
+ result[i] = _readNode(linkedNode) as T;
}
return result;
}
+ List<T> _readNodeListLazy<T>(List<LinkedNode> nodeList) {
+ if (isLazy) {
+ return List<T>.filled(nodeList.length, null);
+ }
+ return _readNodeList(nodeList);
+ }
+
DartType _readType(LinkedNodeType data) {
- if (data == null) return null;
-
- switch (data.kind) {
- case LinkedNodeTypeKind.bottom:
- return BottomTypeImpl.instance;
- case LinkedNodeTypeKind.dynamic_:
- return DynamicTypeImpl.instance;
- case LinkedNodeTypeKind.function:
- return FunctionTypeImpl.synthetic(
- _readType(data.functionReturnType),
- _getElements(data.functionTypeParameters),
- _getElements(data.functionFormalParameters),
- );
- case LinkedNodeTypeKind.interface:
- var element = _getElement(data.interfaceClass);
- if (element != null) {
- return InterfaceTypeImpl.explicit(
- element,
- _readTypes(
- data.interfaceTypeArguments,
- const <InterfaceType>[],
- ),
- );
- }
- return DynamicTypeImpl.instance;
- case LinkedNodeTypeKind.typeParameter:
- var element = _getElement(data.typeParameterParameter);
- // TODO(scheglov) Remove when references include all type parameters.
- element ??= TypeParameterElementImpl('', -1);
- return TypeParameterTypeImpl(element);
- case LinkedNodeTypeKind.void_:
- return VoidTypeImpl.instance;
- default:
- throw UnimplementedError('Type kind: ${data.kind}');
- }
+ return _unitContext.readType(data);
}
- List<T> _readTypes<T extends DartType>(
- List<LinkedNodeType> dataList,
- List<T> ifEmpty,
- ) {
- if (dataList.isEmpty) return ifEmpty;
-
- var result = List<T>(dataList.length);
- for (var i = 0; i < dataList.length; ++i) {
- var data = dataList[i];
- result[i] = _readType(data);
+ static ParameterKind _toParameterKind(LinkedNodeFormalParameterKind kind) {
+ switch (kind) {
+ case LinkedNodeFormalParameterKind.requiredPositional:
+ return ParameterKind.REQUIRED;
+ case LinkedNodeFormalParameterKind.requiredNamed:
+ return ParameterKind.NAMED_REQUIRED;
+ break;
+ case LinkedNodeFormalParameterKind.optionalPositional:
+ return ParameterKind.POSITIONAL;
+ break;
+ case LinkedNodeFormalParameterKind.optionalNamed:
+ return ParameterKind.NAMED;
+ default:
+ throw StateError('Unexpected: $kind');
}
- return result;
}
}
diff --git a/analyzer/lib/src/summary2/ast_binary_writer.dart b/analyzer/lib/src/summary2/ast_binary_writer.dart
index 187dc7b..2cc58d4 100644
--- a/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, 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.
@@ -8,24 +8,26 @@
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/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/linking_bundle_context.dart';
-import 'package:analyzer/src/summary2/tokens_context.dart';
+import 'package:analyzer/src/summary2/tokens_writer.dart';
/// Serializer of fully resolved ASTs into flat buffers.
class AstBinaryWriter extends ThrowingAstVisitor<LinkedNodeBuilder> {
- final LinkingBundleContext _linkingBundleContext;
- final TokensContext _tokensContext;
+ final LinkingBundleContext _linkingContext;
+ final _tokensWriter = TokensWriter();
/// This field is set temporary while visiting [FieldDeclaration] or
/// [TopLevelVariableDeclaration] to store data shared among all variables
/// in these declarations.
LinkedNodeVariablesDeclarationBuilder _variablesDeclaration;
- AstBinaryWriter(this._linkingBundleContext, this._tokensContext);
+ AstBinaryWriter(this._linkingContext);
+
+ UnlinkedTokensBuilder get tokensBuilder => _tokensWriter.tokensBuilder;
@override
LinkedNodeBuilder visitAdjacentStrings(AdjacentStrings node) {
@@ -36,10 +38,13 @@
@override
LinkedNodeBuilder visitAnnotation(Annotation node) {
+ var elementComponents = _componentsOfElement(node.element);
return LinkedNodeBuilder.annotation(
annotation_arguments: node.arguments?.accept(this),
annotation_atSign: _getToken(node.atSign),
annotation_constructorName: node.constructorName?.accept(this),
+ annotation_element: elementComponents.rawElement,
+ annotation_elementType: elementComponents.definingType,
annotation_name: node.name?.accept(this),
annotation_period: _getToken(node.period),
);
@@ -92,8 +97,10 @@
@override
LinkedNodeBuilder visitAssignmentExpression(AssignmentExpression node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.assignmentExpression(
- assignmentExpression_element: _getReferenceIndex(node.staticElement),
+ assignmentExpression_element: elementComponents.rawElement,
+ assignmentExpression_elementType: elementComponents.definingType,
assignmentExpression_leftHandSide: node.leftHandSide.accept(this),
assignmentExpression_operator: _getToken(node.operator),
assignmentExpression_rightHandSide: node.rightHandSide.accept(this),
@@ -112,8 +119,10 @@
@override
LinkedNodeBuilder visitBinaryExpression(BinaryExpression node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.binaryExpression(
- binaryExpression_element: _getReferenceIndex(node.staticElement),
+ binaryExpression_element: elementComponents.rawElement,
+ binaryExpression_elementType: elementComponents.definingType,
binaryExpression_leftOperand: node.leftOperand.accept(this),
binaryExpression_operator: _getToken(node.operator),
binaryExpression_rightOperand: node.rightOperand.accept(this),
@@ -189,6 +198,7 @@
classDeclaration_abstractKeyword: _getToken(node.abstractKeyword),
classDeclaration_classKeyword: _getToken(node.classKeyword),
classDeclaration_extendsClause: node.extendsClause?.accept(this),
+ classDeclaration_nativeClause: node.nativeClause?.accept(this),
classDeclaration_withClause: node.withClause?.accept(this),
);
_storeClassOrMixinDeclaration(builder, node);
@@ -206,6 +216,7 @@
classTypeAlias_withClause: node.withClause.accept(this),
);
_storeTypeAlias(builder, node);
+ _storeIsSimpleBounded(builder, node);
return builder;
}
@@ -223,18 +234,35 @@
return LinkedNodeBuilder.comment(
comment_tokens: _getTokens(node.tokens),
comment_type: type,
+ comment_references: _writeNodeList(node.references),
+ );
+ }
+
+ @override
+ LinkedNodeBuilder visitCommentReference(CommentReference node) {
+ var identifier = node.identifier;
+ _tokensWriter.writeTokens(
+ node.newKeyword ?? identifier.beginToken,
+ identifier.endToken,
+ );
+
+ return LinkedNodeBuilder.commentReference(
+ commentReference_identifier: identifier.accept(this),
+ commentReference_newKeyword: _getToken(node.newKeyword),
);
}
@override
LinkedNodeBuilder visitCompilationUnit(CompilationUnit node) {
- return LinkedNodeBuilder.compilationUnit(
+ var builder = LinkedNodeBuilder.compilationUnit(
compilationUnit_beginToken: _getToken(node.beginToken),
compilationUnit_declarations: _writeNodeList(node.declarations),
compilationUnit_directives: _writeNodeList(node.directives),
compilationUnit_endToken: _getToken(node.endToken),
compilationUnit_scriptTag: node.scriptTag?.accept(this),
);
+ _storeCodeOffsetLength(builder, node);
+ return builder;
}
@override
@@ -280,6 +308,7 @@
constructorDeclaration_separator: _getToken(node.separator),
);
_storeClassMember(builder, node);
+ _storeCodeOffsetLength(builder, node);
return builder;
}
@@ -299,8 +328,10 @@
@override
LinkedNodeBuilder visitConstructorName(ConstructorName node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.constructorName(
- constructorName_element: _getReferenceIndex(node.staticElement),
+ constructorName_element: elementComponents.rawElement,
+ constructorName_elementType: elementComponents.definingType,
constructorName_name: node.name?.accept(this),
constructorName_period: _getToken(node.period),
constructorName_type: node.type.accept(this),
@@ -331,12 +362,14 @@
@override
LinkedNodeBuilder visitDefaultFormalParameter(DefaultFormalParameter node) {
- return LinkedNodeBuilder.defaultFormalParameter(
+ var builder = LinkedNodeBuilder.defaultFormalParameter(
defaultFormalParameter_defaultValue: node.defaultValue?.accept(this),
- defaultFormalParameter_isNamed: node.isNamed,
+ defaultFormalParameter_kind: _toParameterKind(node),
defaultFormalParameter_parameter: node.parameter.accept(this),
defaultFormalParameter_separator: _getToken(node.separator),
);
+ _storeCodeOffsetLength(builder, node);
+ return builder;
}
@override
@@ -347,7 +380,7 @@
doStatement_doKeyword: _getToken(node.doKeyword),
doStatement_leftParenthesis: _getToken(node.leftParenthesis),
doStatement_rightParenthesis: _getToken(node.rightParenthesis),
- doStatement_semicolon: _getToken(node.whileKeyword),
+ doStatement_semicolon: _getToken(node.semicolon),
doStatement_whileKeyword: _getToken(node.whileKeyword),
);
}
@@ -441,6 +474,7 @@
@override
LinkedNodeBuilder visitFieldDeclaration(FieldDeclaration node) {
_variablesDeclaration = LinkedNodeVariablesDeclarationBuilder(
+ isCovariant: node.covariantKeyword != null,
isStatic: node.isStatic,
);
@@ -532,11 +566,11 @@
}
@override
- LinkedNodeBuilder visitForStatement2(ForStatement2 node) {
+ LinkedNodeBuilder visitForStatement(ForStatement node) {
var builder = LinkedNodeBuilder.forStatement(
forStatement_body: node.body.accept(this),
);
- _storeForMixin(builder, node as ForStatement2Impl);
+ _storeForMixin(builder, node as ForStatementImpl);
return builder;
}
@@ -550,6 +584,7 @@
functionDeclaration_returnType: node.returnType?.accept(this),
);
_storeNamedCompilationUnitMember(builder, node);
+ _writeActualReturnType(builder, node);
return builder;
}
@@ -587,8 +622,12 @@
functionTypeAlias_formalParameters: node.parameters.accept(this),
functionTypeAlias_returnType: node.returnType?.accept(this),
functionTypeAlias_typeParameters: node.typeParameters?.accept(this),
+ typeAlias_hasSelfReference:
+ LazyFunctionTypeAlias.getHasSelfReference(node),
);
_storeTypeAlias(builder, node);
+ _writeActualReturnType(builder, node);
+ _storeIsSimpleBounded(builder, node);
return builder;
}
@@ -608,23 +647,33 @@
@override
LinkedNodeBuilder visitGenericFunctionType(GenericFunctionType node) {
- return LinkedNodeBuilder.genericFunctionType(
+ var builder = LinkedNodeBuilder.genericFunctionType(
genericFunctionType_formalParameters: node.parameters.accept(this),
genericFunctionType_functionKeyword: _getToken(node.functionKeyword),
genericFunctionType_question: _getToken(node.question),
genericFunctionType_returnType: node.returnType?.accept(this),
+ genericFunctionType_type: _writeType(node.type),
genericFunctionType_typeParameters: node.typeParameters?.accept(this),
);
+ _writeActualReturnType(builder, node);
+
+ var id = LazyAst.getGenericFunctionTypeId(node);
+ builder.genericFunctionType_id = id;
+
+ return builder;
}
@override
LinkedNodeBuilder visitGenericTypeAlias(GenericTypeAlias node) {
var builder = LinkedNodeBuilder.genericTypeAlias(
genericTypeAlias_equals: _getToken(node.equals),
- genericTypeAlias_functionType: node.functionType.accept(this),
+ genericTypeAlias_functionType: node.functionType?.accept(this),
genericTypeAlias_typeParameters: node.typeParameters?.accept(this),
+ typeAlias_hasSelfReference:
+ LazyGenericTypeAlias.getHasSelfReference(node),
);
_storeTypeAlias(builder, node);
+ _storeIsSimpleBounded(builder, node);
return builder;
}
@@ -683,10 +732,13 @@
@override
LinkedNodeBuilder visitIndexExpression(IndexExpression node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.indexExpression(
- indexExpression_element: _getReferenceIndex(node.staticElement),
+ indexExpression_element: elementComponents.rawElement,
+ indexExpression_elementType: elementComponents.definingType,
indexExpression_index: node.index.accept(this),
indexExpression_leftBracket: _getToken(node.leftBracket),
+ indexExpression_period: _getToken(node.period),
indexExpression_rightBracket: _getToken(node.rightBracket),
indexExpression_target: node.target?.accept(this),
expression_type: _writeType(node.staticType),
@@ -704,6 +756,7 @@
instanceCreationExpression_keyword: _getToken(node.keyword),
instanceCreationExpression_typeArguments:
nodeImpl.typeArguments?.accept(this),
+ expression_type: _writeType(node.staticType),
);
}
@@ -765,6 +818,7 @@
LinkedNodeBuilder visitLibraryDirective(LibraryDirective node) {
var builder = LinkedNodeBuilder.libraryDirective(
libraryDirective_name: node.name.accept(this),
+ directive_semicolon: _getToken(node.semicolon),
);
_storeDirective(builder, node);
return builder;
@@ -780,7 +834,7 @@
@override
LinkedNodeBuilder visitListLiteral(ListLiteral node) {
var builder = LinkedNodeBuilder.listLiteral(
- listLiteral_elements: _writeNodeList(node.elements2),
+ listLiteral_elements: _writeNodeList(node.elements),
listLiteral_leftBracket: _getToken(node.leftBracket),
listLiteral_rightBracket: _getToken(node.rightBracket),
);
@@ -811,6 +865,8 @@
methodDeclaration_typeParameters: node.typeParameters?.accept(this),
);
_storeClassMember(builder, node);
+ _storeCodeOffsetLength(builder, node);
+ _writeActualReturnType(builder, node);
return builder;
}
@@ -832,6 +888,7 @@
mixinDeclaration_onClause: node.onClause?.accept(this),
);
_storeClassOrMixinDeclaration(builder, node);
+ LazyMixinDeclaration.get(node).put(builder);
return builder;
}
@@ -844,6 +901,23 @@
}
@override
+ LinkedNodeBuilder visitNativeClause(NativeClause node) {
+ return LinkedNodeBuilder.nativeClause(
+ nativeClause_nativeKeyword: _getToken(node.nativeKeyword),
+ nativeClause_name: node.name.accept(this),
+ );
+ }
+
+ @override
+ LinkedNodeBuilder visitNativeFunctionBody(NativeFunctionBody node) {
+ return LinkedNodeBuilder.nativeFunctionBody(
+ nativeFunctionBody_nativeKeyword: _getToken(node.nativeKeyword),
+ nativeFunctionBody_semicolon: _getToken(node.semicolon),
+ nativeFunctionBody_stringLiteral: node.stringLiteral?.accept(this),
+ );
+ }
+
+ @override
LinkedNodeBuilder visitNullLiteral(NullLiteral node) {
var builder = LinkedNodeBuilder.nullLiteral(
nullLiteral_literal: _getToken(node.literal),
@@ -875,7 +949,9 @@
@override
LinkedNodeBuilder visitPartDirective(PartDirective node) {
- var builder = LinkedNodeBuilder.partDirective();
+ var builder = LinkedNodeBuilder.partDirective(
+ directive_semicolon: _getToken(node.semicolon),
+ );
_storeUriBasedDirective(builder, node);
return builder;
}
@@ -885,7 +961,7 @@
var builder = LinkedNodeBuilder.partOfDirective(
partOfDirective_libraryName: node.libraryName?.accept(this),
partOfDirective_ofKeyword: _getToken(node.ofKeyword),
- partOfDirective_semicolon: _getToken(node.semicolon),
+ directive_semicolon: _getToken(node.semicolon),
partOfDirective_uri: node.uri?.accept(this),
);
_storeDirective(builder, node);
@@ -894,9 +970,11 @@
@override
LinkedNodeBuilder visitPostfixExpression(PostfixExpression node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.postfixExpression(
expression_type: _writeType(node.staticType),
- postfixExpression_element: _getReferenceIndex(node.staticElement),
+ postfixExpression_element: elementComponents.rawElement,
+ postfixExpression_elementType: elementComponents.definingType,
postfixExpression_operand: node.operand.accept(this),
postfixExpression_operator: _getToken(node.operator),
);
@@ -914,9 +992,11 @@
@override
LinkedNodeBuilder visitPrefixExpression(PrefixExpression node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
return LinkedNodeBuilder.prefixExpression(
expression_type: _writeType(node.staticType),
- prefixExpression_element: _getReferenceIndex(node.staticElement),
+ prefixExpression_element: elementComponents.rawElement,
+ prefixExpression_elementType: elementComponents.definingType,
prefixExpression_operand: node.operand.accept(this),
prefixExpression_operator: _getToken(node.operator),
);
@@ -936,13 +1016,15 @@
@override
LinkedNodeBuilder visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
var builder = LinkedNodeBuilder.redirectingConstructorInvocation(
redirectingConstructorInvocation_arguments:
node.argumentList.accept(this),
redirectingConstructorInvocation_constructorName:
node.constructorName?.accept(this),
- redirectingConstructorInvocation_element:
- _getReferenceIndex(node.staticElement),
+ redirectingConstructorInvocation_element: elementComponents.rawElement,
+ redirectingConstructorInvocation_elementType:
+ elementComponents.definingType,
redirectingConstructorInvocation_period: _getToken(node.period),
redirectingConstructorInvocation_thisKeyword: _getToken(node.thisKeyword),
);
@@ -978,7 +1060,7 @@
@override
LinkedNodeBuilder visitSetOrMapLiteral(SetOrMapLiteral node) {
var builder = LinkedNodeBuilder.setOrMapLiteral(
- setOrMapLiteral_elements: _writeNodeList(node.elements2),
+ setOrMapLiteral_elements: _writeNodeList(node.elements),
setOrMapLiteral_isMap: node.isMap,
setOrMapLiteral_isSet: node.isSet,
setOrMapLiteral_leftBracket: _getToken(node.leftBracket),
@@ -1003,7 +1085,9 @@
simpleFormalParameter_keyword: _getToken(node.keyword),
simpleFormalParameter_type: node.type?.accept(this),
);
+ builder.topLevelTypeInferenceError = LazyAst.getTypeInferenceError(node);
_storeNormalFormalParameter(builder, node);
+ _storeInheritsCovariant(builder, node);
return builder;
}
@@ -1017,8 +1101,11 @@
}
}
+ var elementComponents = _componentsOfElement(element);
return LinkedNodeBuilder.simpleIdentifier(
- simpleIdentifier_element: _getReferenceIndex(element),
+ simpleIdentifier_element: elementComponents.rawElement,
+ simpleIdentifier_elementType: elementComponents.definingType,
+ simpleIdentifier_isDeclaration: node is DeclaredSimpleIdentifier,
simpleIdentifier_token: _getToken(node.token),
expression_type: _writeType(node.staticType),
);
@@ -1053,12 +1140,13 @@
@override
LinkedNodeBuilder visitSuperConstructorInvocation(
SuperConstructorInvocation node) {
+ var elementComponents = _componentsOfElement(node.staticElement);
var builder = LinkedNodeBuilder.superConstructorInvocation(
superConstructorInvocation_arguments: node.argumentList.accept(this),
superConstructorInvocation_constructorName:
node.constructorName?.accept(this),
- superConstructorInvocation_element:
- _getReferenceIndex(node.staticElement),
+ superConstructorInvocation_element: elementComponents.rawElement,
+ superConstructorInvocation_elementType: elementComponents.definingType,
superConstructorInvocation_period: _getToken(node.period),
superConstructorInvocation_superKeyword: _getToken(node.superKeyword),
);
@@ -1182,10 +1270,13 @@
@override
LinkedNodeBuilder visitTypeParameter(TypeParameter node) {
var builder = LinkedNodeBuilder.typeParameter(
- typeParameter_bound: node.bound?.accept(this),
- typeParameter_extendsKeyword: _getToken(node.extendsKeyword),
- typeParameter_name: node.name.accept(this));
+ typeParameter_bound: node.bound?.accept(this),
+ typeParameter_defaultType: _writeType(LazyAst.getDefaultType(node)),
+ typeParameter_extendsKeyword: _getToken(node.extendsKeyword),
+ typeParameter_name: node.name.accept(this),
+ );
_storeDeclaration(builder, node);
+ _storeCodeOffsetLength(builder, node);
return builder;
}
@@ -1200,12 +1291,16 @@
@override
LinkedNodeBuilder visitVariableDeclaration(VariableDeclaration node) {
- return LinkedNodeBuilder.variableDeclaration(
+ var builder = LinkedNodeBuilder.variableDeclaration(
variableDeclaration_equals: _getToken(node.equals),
variableDeclaration_initializer: node.initializer?.accept(this),
variableDeclaration_name: node.name.accept(this),
variableDeclaration_declaration: _variablesDeclaration,
);
+ builder.topLevelTypeInferenceError = LazyAst.getTypeInferenceError(node);
+ _writeActualType(builder, node);
+ _storeInheritsCovariant(builder, node);
+ return builder;
}
@override
@@ -1217,10 +1312,12 @@
var builder = LinkedNodeBuilder.variableDeclarationList(
variableDeclarationList_keyword: _getToken(node.keyword),
+ variableDeclarationList_lateKeyword: _getToken(node.lateKeyword),
variableDeclarationList_type: node.type?.accept(this),
variableDeclarationList_variables: _writeNodeList(node.variables),
);
_storeAnnotatedNode(builder, node);
+ _storeCodeOffsetLengthVariables(builder, node);
return builder;
}
@@ -1265,26 +1362,27 @@
}
LinkedNodeBuilder writeNode(AstNode node) {
+ _tokensWriter.writeTokens(node.beginToken, node.endToken);
return node.accept(this);
}
- int _getReferenceIndex(Element element) {
- if (element == null) return 0;
+ _ElementComponents _componentsOfElement(Element element) {
+ while (element is ParameterMember) {
+ element = (element as ParameterMember).baseElement;
+ }
if (element is Member) {
- element = (element as Member).baseElement;
+ var elementIndex = _indexOfElement(element.baseElement);
+ var definingTypeNode = _writeType(element.definingType);
+ return _ElementComponents(elementIndex, definingTypeNode);
}
- var reference = (element as ElementImpl).reference;
- if (identical(element, DynamicElementImpl.instance)) {
- reference = _linkingBundleContext.dynamicReference;
- }
-
- return _linkingBundleContext.indexOfReference(reference);
+ var elementIndex = _indexOfElement(element);
+ return _ElementComponents(elementIndex, null);
}
int _getToken(Token token) {
- return _tokensContext.indexOfToken(token);
+ return _tokensWriter.indexOfToken(token);
}
List<int> _getTokens(List<Token> tokenList) {
@@ -1296,6 +1394,10 @@
return result;
}
+ int _indexOfElement(Element element) {
+ return _linkingContext.indexOfElement(element);
+ }
+
void _storeAnnotatedNode(LinkedNodeBuilder builder, AnnotatedNode node) {
builder
..annotatedNode_comment = node.documentationComment?.accept(this)
@@ -1317,6 +1419,24 @@
..classOrMixinDeclaration_typeParameters =
node.typeParameters?.accept(this);
_storeNamedCompilationUnitMember(builder, node);
+ _storeIsSimpleBounded(builder, node);
+ }
+
+ void _storeCodeOffsetLength(LinkedNodeBuilder builder, AstNode node) {
+ builder.codeOffset = node.offset;
+ builder.codeLength = node.length;
+ }
+
+ void _storeCodeOffsetLengthVariables(
+ LinkedNodeBuilder builder, VariableDeclarationList node) {
+ var builders = builder.variableDeclarationList_variables;
+ for (var i = 0; i < builders.length; ++i) {
+ var variableBuilder = builders[i];
+ var variableNode = node.variables[i];
+ var offset = (i == 0 ? node.parent : variableNode).offset;
+ variableBuilder.codeOffset = offset;
+ variableBuilder.codeLength = variableNode.end - offset;
+ }
}
void _storeCombinator(LinkedNodeBuilder builder, Combinator node) {
@@ -1354,14 +1474,8 @@
void _storeForLoopParts(LinkedNodeBuilder builder, ForLoopParts node) {}
void _storeFormalParameter(LinkedNodeBuilder builder, FormalParameter node) {
- var kind = LinkedNodeFormalParameterKind.required;
- if (node.isNamed) {
- kind = LinkedNodeFormalParameterKind.optionalNamed;
- } else if (node.isOptionalPositional) {
- kind = LinkedNodeFormalParameterKind.optionalPositional;
- }
-
- builder.formalParameter_kind = kind;
+ _storeCodeOffsetLength(builder, node);
+ _writeActualType(builder, node);
}
void _storeForMixin(LinkedNodeBuilder builder, ForMixin node) {
@@ -1393,6 +1507,11 @@
..ifMixin_rightParenthesis = _getToken(node.rightParenthesis);
}
+ void _storeInheritsCovariant(LinkedNodeBuilder builder, AstNode node) {
+ var value = LazyAst.getInheritsCovariant(node);
+ builder.inheritsCovariant = value;
+ }
+
void _storeInvocationExpression(
LinkedNodeBuilder builder, InvocationExpression node) {
_storeExpression(builder, node);
@@ -1402,9 +1521,16 @@
..invocationExpression_typeArguments = node.typeArguments?.accept(this);
}
+ void _storeIsSimpleBounded(LinkedNodeBuilder builder, AstNode node) {
+ var flag = LazyAst.isSimplyBounded(node);
+ // TODO(scheglov) Check for `null` when writing resolved AST.
+ builder.simplyBoundable_isSimplyBounded = flag;
+ }
+
void _storeNamedCompilationUnitMember(
LinkedNodeBuilder builder, NamedCompilationUnitMember node) {
_storeCompilationUnitMember(builder, node);
+ _storeCodeOffsetLength(builder, node);
builder..namedCompilationUnitMember_name = node.name.accept(this);
}
@@ -1414,8 +1540,8 @@
builder
..namespaceDirective_combinators = _writeNodeList(node.combinators)
..namespaceDirective_configurations = _writeNodeList(node.configurations)
- ..namespaceDirective_selectedUriContent = node.selectedUriContent
- ..namespaceDirective_semicolon = _getToken(node.semicolon);
+ ..namespaceDirective_selectedUri = LazyDirective.getSelectedUri(node)
+ ..directive_semicolon = _getToken(node.semicolon);
}
void _storeNormalFormalParameter(
@@ -1426,7 +1552,8 @@
..normalFormalParameter_covariantKeyword =
_getToken(node.covariantKeyword)
..normalFormalParameter_identifier = node.identifier?.accept(this)
- ..normalFormalParameter_metadata = _writeNodeList(node.metadata);
+ ..normalFormalParameter_metadata = _writeNodeList(node.metadata)
+ ..normalFormalParameter_requiredKeyword = _getToken(node.requiredKeyword);
}
void _storeStatement(LinkedNodeBuilder builder, Statement node) {}
@@ -1458,7 +1585,19 @@
builder
..uriBasedDirective_uri = node.uri.accept(this)
..uriBasedDirective_uriContent = node.uriContent
- ..uriBasedDirective_uriElement = _getReferenceIndex(node.uriElement);
+ ..uriBasedDirective_uriElement = _indexOfElement(node.uriElement);
+ }
+
+ void _writeActualReturnType(LinkedNodeBuilder builder, AstNode node) {
+ var type = LazyAst.getReturnType(node);
+ // TODO(scheglov) Check for `null` when writing resolved AST.
+ builder.actualReturnType = _writeType(type);
+ }
+
+ void _writeActualType(LinkedNodeBuilder builder, AstNode node) {
+ var type = LazyAst.getType(node);
+ // TODO(scheglov) Check for `null` when writing resolved AST.
+ builder.actualType = _writeType(type);
}
List<LinkedNodeBuilder> _writeNodeList(List<AstNode> nodeList) {
@@ -1474,6 +1613,28 @@
}
LinkedNodeTypeBuilder _writeType(DartType type) {
- return _linkingBundleContext.writeType(type);
+ return _linkingContext.writeType(type);
}
+
+ static LinkedNodeFormalParameterKind _toParameterKind(FormalParameter node) {
+ if (node.isRequiredPositional) {
+ return LinkedNodeFormalParameterKind.requiredPositional;
+ } else if (node.isRequiredNamed) {
+ return LinkedNodeFormalParameterKind.requiredNamed;
+ } else if (node.isOptionalPositional) {
+ return LinkedNodeFormalParameterKind.optionalPositional;
+ } else if (node.isOptionalNamed) {
+ return LinkedNodeFormalParameterKind.optionalNamed;
+ } else {
+ throw new StateError('Unknown kind of parameter');
+ }
+ }
+}
+
+/// Components of a [Member] - the raw element, and the defining type.
+class _ElementComponents {
+ final int rawElement;
+ final LinkedNodeType definingType;
+
+ _ElementComponents(this.rawElement, this.definingType);
}
diff --git a/analyzer/lib/src/summary2/ast_resolver.dart b/analyzer/lib/src/summary2/ast_resolver.dart
index c3dcf81..bf3ac6d 100644
--- a/analyzer/lib/src/summary2/ast_resolver.dart
+++ b/analyzer/lib/src/summary2/ast_resolver.dart
@@ -2,30 +2,30 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/ast_binary_writer.dart';
-import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
import 'package:analyzer/src/summary2/link.dart';
-import 'package:analyzer/src/summary2/reference.dart';
/// Used to resolve some AST nodes - variable initializers, and annotations.
class AstResolver {
final Linker _linker;
+ final LibraryElement _library;
+ final Scope _nameScope;
- LibraryElement _library;
- Scope _nameScope;
+ AstResolver(this._linker, this._library, this._nameScope);
- AstResolver(this._linker, Reference libraryRef) {
- _library = _linker.elementFactory.elementOfReference(libraryRef);
- _nameScope = LibraryScope(_library);
- }
-
- LinkedNode resolve(UnitBuilder unit, AstNode node) {
+ void resolve(
+ AstNode node, {
+ ClassElement enclosingClassElement,
+ ExecutableElement enclosingExecutableElement,
+ FeatureSet featureSet,
+ bool doAstRewrite = false,
+ }) {
var source = _FakeSource();
var errorListener = AnalysisErrorListener.NULL_LISTENER;
@@ -34,27 +34,41 @@
nameScope: _nameScope);
node.accept(typeResolverVisitor);
-// expression.accept(_astRewriteVisitor);
-// expression.accept(_variableResolverVisitor);
+ if (doAstRewrite) {
+ var astRewriteVisitor = new AstRewriteVisitor(_linker.typeSystem,
+ _library, source, _linker.typeProvider, errorListener,
+ nameScope: _nameScope);
+ node.accept(astRewriteVisitor);
+ }
+
+ var variableResolverVisitor = new VariableResolverVisitor(
+ _library, source, _linker.typeProvider, errorListener,
+ nameScope: _nameScope, localVariableInfo: LocalVariableInfo());
+ node.accept(variableResolverVisitor);
+
// if (_linker.getAst != null) {
// expression.accept(_partialResolverVisitor);
// }
var resolverVisitor = new ResolverVisitor(_linker.inheritance, _library,
source, _linker.typeProvider, errorListener,
+ featureSet: featureSet,
nameScope: _nameScope,
propagateTypes: false,
reportConstEvaluationErrors: false);
- node.accept(resolverVisitor);
-
- var writer = AstBinaryWriter(
- _linker.linkingBundleContext,
- unit.context.tokensContext,
+ resolverVisitor.prepareEnclosingDeclarations(
+ enclosingClassElement: enclosingClassElement,
+ enclosingExecutableElement: enclosingExecutableElement,
);
- return writer.writeNode(node);
+
+ node.accept(resolverVisitor);
}
}
class _FakeSource implements Source {
+ @override
+ String get fullName => '/package/lib/test.dart';
+
+ @override
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
diff --git a/analyzer/lib/src/summary2/ast_text_printer.dart b/analyzer/lib/src/summary2/ast_text_printer.dart
new file mode 100644
index 0000000..eefebe8
--- /dev/null
+++ b/analyzer/lib/src/summary2/ast_text_printer.dart
@@ -0,0 +1,1068 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/source/line_info.dart';
+
+/// AST visitor that prints tokens into their original positions.
+class AstTextPrinter extends ThrowingAstVisitor<void> {
+ final StringBuffer _buffer;
+ final LineInfo _lineInfo;
+
+ Token _last;
+ int _lastEnd = 0;
+ int _lastEndLine = 0;
+
+ AstTextPrinter(this._buffer, this._lineInfo);
+
+ @override
+ void visitAdjacentStrings(AdjacentStrings node) {
+ _nodeList(node.strings);
+ }
+
+ @override
+ void visitAnnotation(Annotation node) {
+ _token(node.atSign);
+ node.name.accept(this);
+ _token(node.period);
+ node.constructorName?.accept(this);
+ node.arguments?.accept(this);
+ }
+
+ @override
+ void visitArgumentList(ArgumentList node) {
+ _token(node.leftParenthesis);
+ _nodeList(node.arguments, node.rightParenthesis);
+ _token(node.rightParenthesis);
+ }
+
+ @override
+ void visitAsExpression(AsExpression node) {
+ node.expression.accept(this);
+ _token(node.asOperator);
+ node.type.accept(this);
+ }
+
+ @override
+ void visitAssertInitializer(AssertInitializer node) {
+ _token(node.assertKeyword);
+ _token(node.leftParenthesis);
+
+ node.condition.accept(this);
+ _tokenIfNot(node.condition.endToken.next, node.rightParenthesis);
+
+ node.message?.accept(this);
+ _tokenIfNot(node.message?.endToken?.next, node.rightParenthesis);
+
+ _token(node.rightParenthesis);
+ }
+
+ @override
+ void visitAssertStatement(AssertStatement node) {
+ _token(node.assertKeyword);
+ _token(node.leftParenthesis);
+
+ node.condition.accept(this);
+ _tokenIfNot(node.condition.endToken.next, node.rightParenthesis);
+
+ node.message?.accept(this);
+ _tokenIfNot(node.message?.endToken?.next, node.rightParenthesis);
+
+ _token(node.rightParenthesis);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitAssignmentExpression(AssignmentExpression node) {
+ node.leftHandSide.accept(this);
+ _token(node.operator);
+ node.rightHandSide.accept(this);
+ }
+
+ @override
+ void visitAwaitExpression(AwaitExpression node) {
+ _token(node.awaitKeyword);
+ node.expression.accept(this);
+ }
+
+ @override
+ void visitBinaryExpression(BinaryExpression node) {
+ node.leftOperand.accept(this);
+ _token(node.operator);
+ node.rightOperand.accept(this);
+ }
+
+ @override
+ void visitBlock(Block node) {
+ _token(node.leftBracket);
+ _nodeList(node.statements);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitBlockFunctionBody(BlockFunctionBody node) {
+ _functionBody(node);
+ node.block.accept(this);
+ }
+
+ @override
+ void visitBooleanLiteral(BooleanLiteral node) {
+ _token(node.literal);
+ }
+
+ @override
+ void visitBreakStatement(BreakStatement node) {
+ _token(node.breakKeyword);
+ node.label?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitCascadeExpression(CascadeExpression node) {
+ node.target.accept(this);
+ _nodeList(node.cascadeSections);
+ }
+
+ @override
+ void visitCatchClause(CatchClause node) {
+ _token(node.onKeyword);
+ node.exceptionType?.accept(this);
+ _token(node.catchKeyword);
+ _token(node.leftParenthesis);
+ node.exceptionParameter?.accept(this);
+ _token(node.comma);
+ node.stackTraceParameter?.accept(this);
+ _token(node.rightParenthesis);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitClassDeclaration(ClassDeclaration node) {
+ _compilationUnitMember(node);
+ _token(node.abstractKeyword);
+ _token(node.classKeyword);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ node.extendsClause?.accept(this);
+ node.withClause?.accept(this);
+ node.implementsClause?.accept(this);
+ node.nativeClause?.accept(this);
+ _token(node.leftBracket);
+ node.members.accept(this);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitClassTypeAlias(ClassTypeAlias node) {
+ _compilationUnitMember(node);
+ _token(node.abstractKeyword);
+ _token(node.typedefKeyword);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ _token(node.equals);
+ node.superclass?.accept(this);
+ node.withClause.accept(this);
+ node.implementsClause?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitComment(Comment node) {}
+
+ @override
+ void visitCompilationUnit(CompilationUnit node) {
+ node.scriptTag?.accept(this);
+ node.directives.accept(this);
+ node.declarations.accept(this);
+ _token(node.endToken);
+ }
+
+ @override
+ void visitConditionalExpression(ConditionalExpression node) {
+ node.condition.accept(this);
+ _token(node.question);
+ node.thenExpression.accept(this);
+ _token(node.colon);
+ node.elseExpression.accept(this);
+ }
+
+ @override
+ void visitConfiguration(Configuration node) {
+ _token(node.ifKeyword);
+ _token(node.leftParenthesis);
+ node.name.accept(this);
+ _token(node.equalToken);
+ node.value?.accept(this);
+ _token(node.rightParenthesis);
+ node.uri.accept(this);
+ }
+
+ @override
+ void visitConstructorDeclaration(ConstructorDeclaration node) {
+ _classMember(node);
+ _token(node.externalKeyword);
+ _token(node.constKeyword);
+ _token(node.factoryKeyword);
+ node.returnType?.accept(this);
+ _token(node.period);
+ node.name?.accept(this);
+ node.parameters.accept(this);
+ _token(node.separator);
+ _nodeList(node.initializers, node.body.beginToken);
+ node.redirectedConstructor?.accept(this);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
+ _token(node.thisKeyword);
+ _token(node.period);
+ node.fieldName.accept(this);
+ _token(node.equals);
+ node.expression.accept(this);
+ }
+
+ @override
+ void visitConstructorName(ConstructorName node) {
+ node.type.accept(this);
+ _token(node.period);
+ node.name?.accept(this);
+ }
+
+ @override
+ void visitContinueStatement(ContinueStatement node) {
+ _token(node.continueKeyword);
+ node.label?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitDeclaredIdentifier(DeclaredIdentifier node) {
+ _declaration(node);
+ _token(node.keyword);
+ node.type?.accept(this);
+ node.identifier.accept(this);
+ }
+
+ @override
+ void visitDefaultFormalParameter(DefaultFormalParameter node) {
+ node.parameter.accept(this);
+ _token(node.separator);
+ node.defaultValue?.accept(this);
+ }
+
+ @override
+ void visitDoStatement(DoStatement node) {
+ _token(node.doKeyword);
+ node.body.accept(this);
+ _token(node.whileKeyword);
+ _token(node.leftParenthesis);
+ node.condition.accept(this);
+ _token(node.rightParenthesis);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitDottedName(DottedName node) {
+ _nodeList(node.components, node.endToken.next);
+ }
+
+ @override
+ void visitDoubleLiteral(DoubleLiteral node) {
+ _token(node.literal);
+ }
+
+ @override
+ void visitEmptyFunctionBody(EmptyFunctionBody node) {
+ _functionBody(node);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitEmptyStatement(EmptyStatement node) {
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
+ _declaration(node);
+ node.name.accept(this);
+ }
+
+ @override
+ void visitEnumDeclaration(EnumDeclaration node) {
+ _compilationUnitMember(node);
+ _token(node.enumKeyword);
+ node.name.accept(this);
+ _token(node.leftBracket);
+ _nodeList(node.constants, node.rightBracket);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitExportDirective(ExportDirective node) {
+ _directive(node);
+ _token(node.keyword);
+ node.uri.accept(this);
+ node.configurations?.accept(this);
+ _nodeList(node.combinators);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitExpressionFunctionBody(ExpressionFunctionBody node) {
+ _functionBody(node);
+ _token(node.functionDefinition);
+ node.expression.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitExpressionStatement(ExpressionStatement node) {
+ node.expression.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitExtendsClause(ExtendsClause node) {
+ _token(node.extendsKeyword);
+ node.superclass.accept(this);
+ }
+
+ @override
+ void visitFieldDeclaration(FieldDeclaration node) {
+ _classMember(node);
+ _token(node.staticKeyword);
+ _token(node.covariantKeyword);
+ node.fields.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitFieldFormalParameter(FieldFormalParameter node) {
+ _normalFormalParameter(node);
+ _token(node.keyword);
+ node.type?.accept(this);
+ _token(node.thisKeyword);
+ _token(node.period);
+ node.identifier.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ }
+
+ @override
+ void visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ node.loopVariable.accept(this);
+ _token(node.inKeyword);
+ node.iterable.accept(this);
+ }
+
+ @override
+ void visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ node.identifier.accept(this);
+ _token(node.inKeyword);
+ node.iterable.accept(this);
+ }
+
+ @override
+ void visitForElement(ForElement node) {
+ _token(node.forKeyword);
+ _token(node.leftParenthesis);
+ node.forLoopParts.accept(this);
+ _token(node.rightParenthesis);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitFormalParameterList(FormalParameterList node) {
+ _token(node.leftParenthesis);
+
+ var parameters = node.parameters;
+ for (var i = 0; i < parameters.length; ++i) {
+ var parameter = parameters[i];
+ if (node.leftDelimiter?.next == parameter.beginToken) {
+ _token(node.leftDelimiter);
+ }
+
+ parameter.accept(this);
+
+ var itemSeparator = parameter.endToken.next;
+ if (itemSeparator != node.rightParenthesis) {
+ _token(itemSeparator);
+ itemSeparator = itemSeparator.next;
+ }
+
+ if (itemSeparator == node.rightDelimiter) {
+ _token(node.rightDelimiter);
+ }
+ }
+
+ _token(node.rightParenthesis);
+ }
+
+ @override
+ void visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ node.variables.accept(this);
+ _token(node.leftSeparator);
+ node.condition?.accept(this);
+ _token(node.rightSeparator);
+ _nodeList(node.updaters, node.endToken.next);
+ }
+
+ @override
+ void visitForPartsWithExpression(ForPartsWithExpression node) {
+ node.initialization?.accept(this);
+ _token(node.leftSeparator);
+ node.condition?.accept(this);
+ _token(node.rightSeparator);
+ _nodeList(node.updaters, node.updaters.endToken?.next);
+ }
+
+ @override
+ void visitForStatement(ForStatement node) {
+ _token(node.awaitKeyword);
+ _token(node.forKeyword);
+ _token(node.leftParenthesis);
+ node.forLoopParts.accept(this);
+ _token(node.rightParenthesis);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitFunctionDeclaration(FunctionDeclaration node) {
+ _compilationUnitMember(node);
+ _token(node.externalKeyword);
+ node.returnType?.accept(this);
+ _token(node.propertyKeyword);
+ node.name.accept(this);
+ node.functionExpression.accept(this);
+ }
+
+ @override
+ void visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
+ node.functionDeclaration.accept(this);
+ }
+
+ @override
+ void visitFunctionExpression(FunctionExpression node) {
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ node.function.accept(this);
+ node.typeArguments?.accept(this);
+ node.argumentList.accept(this);
+ }
+
+ @override
+ void visitFunctionTypeAlias(FunctionTypeAlias node) {
+ _compilationUnitMember(node);
+ _token(node.typedefKeyword);
+ node.returnType?.accept(this);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ _normalFormalParameter(node);
+ node.returnType?.accept(this);
+ node.identifier.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitGenericFunctionType(GenericFunctionType node) {
+ node.returnType?.accept(this);
+ _token(node.functionKeyword);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitGenericTypeAlias(GenericTypeAlias node) {
+ _compilationUnitMember(node);
+ _token(node.typedefKeyword);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ _token(node.equals);
+ node.functionType.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitHideCombinator(HideCombinator node) {
+ _token(node.keyword);
+ _nodeList(node.hiddenNames, node.endToken.next);
+ }
+
+ @override
+ void visitIfElement(IfElement node) {
+ _token(node.ifKeyword);
+ _token(node.leftParenthesis);
+ node.condition.accept(this);
+ _token(node.rightParenthesis);
+ node.thenElement.accept(this);
+ _token(node.elseKeyword);
+ node.elseElement?.accept(this);
+ }
+
+ @override
+ void visitIfStatement(IfStatement node) {
+ _token(node.ifKeyword);
+ _token(node.leftParenthesis);
+ node.condition.accept(this);
+ _token(node.rightParenthesis);
+ node.thenStatement.accept(this);
+ _token(node.elseKeyword);
+ node.elseStatement?.accept(this);
+ }
+
+ @override
+ void visitImplementsClause(ImplementsClause node) {
+ _token(node.implementsKeyword);
+ _nodeList(node.interfaces, node.endToken.next);
+ }
+
+ @override
+ void visitImportDirective(ImportDirective node) {
+ _directive(node);
+ _token(node.keyword);
+ node.uri.accept(this);
+ node.configurations?.accept(this);
+ _token(node.deferredKeyword);
+ _token(node.asKeyword);
+ node.prefix?.accept(this);
+ _nodeList(node.combinators);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitIndexExpression(IndexExpression node) {
+ node.target?.accept(this);
+ _token(node.period);
+ _token(node.leftBracket);
+ node.index.accept(this);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitInstanceCreationExpression(InstanceCreationExpression node) {
+ _token(node.keyword);
+ node.constructorName.accept(this);
+ node.argumentList.accept(this);
+ }
+
+ @override
+ void visitIntegerLiteral(IntegerLiteral node) {
+ _token(node.literal);
+ }
+
+ @override
+ void visitInterpolationExpression(InterpolationExpression node) {
+ _token(node.leftBracket);
+ node.expression.accept(this);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitInterpolationString(InterpolationString node) {
+ _token(node.contents);
+ }
+
+ @override
+ void visitIsExpression(IsExpression node) {
+ node.expression.accept(this);
+ _token(node.isOperator);
+ _token(node.notOperator);
+ node.type.accept(this);
+ }
+
+ @override
+ void visitLabel(Label node) {
+ node.label.accept(this);
+ _token(node.colon);
+ }
+
+ @override
+ void visitLabeledStatement(LabeledStatement node) {
+ _nodeList(node.labels);
+ node.statement.accept(this);
+ }
+
+ @override
+ void visitLibraryDirective(LibraryDirective node) {
+ _directive(node);
+ _token(node.libraryKeyword);
+ node.name.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitLibraryIdentifier(LibraryIdentifier node) {
+ _nodeList(node.components, node.endToken.next);
+ }
+
+ @override
+ void visitListLiteral(ListLiteral node) {
+ _typedLiteral(node);
+ _token(node.leftBracket);
+ _nodeList(node.elements, node.rightBracket);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitMapLiteralEntry(MapLiteralEntry node) {
+ node.key.accept(this);
+ _token(node.separator);
+ node.value.accept(this);
+ }
+
+ @override
+ void visitMethodDeclaration(MethodDeclaration node) {
+ _classMember(node);
+ _token(node.externalKeyword);
+ _token(node.modifierKeyword);
+ node.returnType?.accept(this);
+ _token(node.propertyKeyword);
+ _token(node.operatorKeyword);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ node.body?.accept(this);
+ }
+
+ @override
+ void visitMethodInvocation(MethodInvocation node) {
+ node.target?.accept(this);
+ _token(node.operator);
+ node.methodName.accept(this);
+ node.typeArguments?.accept(this);
+ node.argumentList.accept(this);
+ }
+
+ @override
+ void visitMixinDeclaration(MixinDeclaration node) {
+ _compilationUnitMember(node);
+ _token(node.mixinKeyword);
+ node.name.accept(this);
+ node.typeParameters?.accept(this);
+ node.onClause?.accept(this);
+ node.implementsClause?.accept(this);
+ _token(node.leftBracket);
+ node.members.accept(this);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitNamedExpression(NamedExpression node) {
+ node.name.accept(this);
+ node.expression.accept(this);
+ }
+
+ @override
+ void visitNativeClause(NativeClause node) {
+ _token(node.nativeKeyword);
+ node.name.accept(this);
+ }
+
+ @override
+ void visitNativeFunctionBody(NativeFunctionBody node) {
+ _token(node.nativeKeyword);
+ node.stringLiteral?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitNullLiteral(NullLiteral node) {
+ _token(node.literal);
+ }
+
+ @override
+ void visitOnClause(OnClause node) {
+ _token(node.onKeyword);
+ _nodeList(node.superclassConstraints, node.endToken.next);
+ }
+
+ @override
+ void visitParenthesizedExpression(ParenthesizedExpression node) {
+ _token(node.leftParenthesis);
+ node.expression.accept(this);
+ _token(node.rightParenthesis);
+ }
+
+ @override
+ void visitPartDirective(PartDirective node) {
+ _directive(node);
+ _token(node.partKeyword);
+ node.uri.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitPartOfDirective(PartOfDirective node) {
+ _directive(node);
+ _token(node.partKeyword);
+ _token(node.ofKeyword);
+ node.uri?.accept(this);
+ node.libraryName?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitPostfixExpression(PostfixExpression node) {
+ node.operand.accept(this);
+ _token(node.operator);
+ }
+
+ @override
+ void visitPrefixedIdentifier(PrefixedIdentifier node) {
+ node.prefix.accept(this);
+ _token(node.period);
+ node.identifier.accept(this);
+ }
+
+ @override
+ void visitPrefixExpression(PrefixExpression node) {
+ _token(node.operator);
+ node.operand.accept(this);
+ }
+
+ @override
+ void visitPropertyAccess(PropertyAccess node) {
+ node.target?.accept(this);
+ _token(node.operator);
+ node.propertyName.accept(this);
+ }
+
+ @override
+ void visitRedirectingConstructorInvocation(
+ RedirectingConstructorInvocation node) {
+ _token(node.thisKeyword);
+ _token(node.period);
+ node.constructorName?.accept(this);
+ node.argumentList.accept(this);
+ }
+
+ @override
+ void visitRethrowExpression(RethrowExpression node) {
+ _token(node.rethrowKeyword);
+ }
+
+ @override
+ void visitReturnStatement(ReturnStatement node) {
+ _token(node.returnKeyword);
+ node.expression?.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitScriptTag(ScriptTag node) {
+ _token(node.scriptTag);
+ }
+
+ @override
+ void visitSetOrMapLiteral(SetOrMapLiteral node) {
+ _typedLiteral(node);
+ _token(node.leftBracket);
+ _nodeList(node.elements, node.rightBracket);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitShowCombinator(ShowCombinator node) {
+ _token(node.keyword);
+ _nodeList(node.shownNames, node.endToken.next);
+ }
+
+ @override
+ void visitSimpleFormalParameter(SimpleFormalParameter node) {
+ _normalFormalParameter(node);
+ _token(node.keyword);
+ node.type?.accept(this);
+ node.identifier?.accept(this);
+ }
+
+ @override
+ void visitSimpleIdentifier(SimpleIdentifier node) {
+ _token(node.token);
+ }
+
+ @override
+ void visitSimpleStringLiteral(SimpleStringLiteral node) {
+ _token(node.literal);
+ }
+
+ @override
+ void visitSpreadElement(SpreadElement node) {
+ _token(node.spreadOperator);
+ node.expression.accept(this);
+ }
+
+ @override
+ void visitStringInterpolation(StringInterpolation node) {
+ _nodeList(node.elements);
+ }
+
+ @override
+ void visitSuperConstructorInvocation(SuperConstructorInvocation node) {
+ _token(node.superKeyword);
+ _token(node.period);
+ node.constructorName?.accept(this);
+ node.argumentList.accept(this);
+ }
+
+ @override
+ void visitSuperExpression(SuperExpression node) {
+ _token(node.superKeyword);
+ }
+
+ @override
+ void visitSwitchCase(SwitchCase node) {
+ _nodeList(node.labels);
+ _token(node.keyword);
+ node.expression.accept(this);
+ _token(node.colon);
+ _nodeList(node.statements);
+ }
+
+ @override
+ void visitSwitchDefault(SwitchDefault node) {
+ _nodeList(node.labels);
+ _token(node.keyword);
+ _token(node.colon);
+ _nodeList(node.statements);
+ }
+
+ @override
+ void visitSwitchStatement(SwitchStatement node) {
+ _token(node.switchKeyword);
+ _token(node.leftParenthesis);
+ node.expression.accept(this);
+ _token(node.rightParenthesis);
+ _token(node.leftBracket);
+ _nodeList(node.members);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitSymbolLiteral(SymbolLiteral node) {
+ _token(node.poundSign);
+ var components = node.components;
+ for (var i = 0; i < components.length; ++i) {
+ var component = components[i];
+ _token(component);
+ if (i != components.length - 1) {
+ _token(component.next);
+ }
+ }
+ }
+
+ @override
+ void visitThisExpression(ThisExpression node) {
+ _token(node.thisKeyword);
+ }
+
+ @override
+ void visitThrowExpression(ThrowExpression node) {
+ _token(node.throwKeyword);
+ node.expression.accept(this);
+ }
+
+ @override
+ void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
+ _compilationUnitMember(node);
+ node.variables.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitTryStatement(TryStatement node) {
+ _token(node.tryKeyword);
+ node.body.accept(this);
+ _nodeList(node.catchClauses);
+ _token(node.finallyKeyword);
+ node.finallyBlock?.accept(this);
+ }
+
+ @override
+ void visitTypeArgumentList(TypeArgumentList node) {
+ _token(node.leftBracket);
+ _nodeList(node.arguments, node.rightBracket);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitTypeName(TypeName node) {
+ node.name.accept(this);
+ node.typeArguments?.accept(this);
+ }
+
+ @override
+ void visitTypeParameter(TypeParameter node) {
+ _declaration(node);
+ node.name?.accept(this);
+ _token(node.extendsKeyword);
+ node.bound?.accept(this);
+ }
+
+ @override
+ void visitTypeParameterList(TypeParameterList node) {
+ _token(node.leftBracket);
+ _nodeList(node.typeParameters, node.rightBracket);
+ _token(node.rightBracket);
+ }
+
+ @override
+ void visitVariableDeclaration(VariableDeclaration node) {
+ _annotatedNode(node);
+ node.name.accept(this);
+ _token(node.equals);
+ node.initializer?.accept(this);
+ }
+
+ @override
+ void visitVariableDeclarationList(VariableDeclarationList node) {
+ _annotatedNode(node);
+ _token(node.keyword);
+ node.type?.accept(this);
+ _nodeList(node.variables, node.endToken.next);
+ }
+
+ @override
+ void visitVariableDeclarationStatement(VariableDeclarationStatement node) {
+ node.variables.accept(this);
+ _token(node.semicolon);
+ }
+
+ @override
+ void visitWhileStatement(WhileStatement node) {
+ _token(node.whileKeyword);
+ _token(node.leftParenthesis);
+ node.condition.accept(this);
+ _token(node.rightParenthesis);
+ node.body.accept(this);
+ }
+
+ @override
+ void visitWithClause(WithClause node) {
+ _token(node.withKeyword);
+ _nodeList(node.mixinTypes, node.endToken.next);
+ }
+
+ @override
+ void visitYieldStatement(YieldStatement node) {
+ _token(node.yieldKeyword);
+ _token(node.star);
+ node.expression.accept(this);
+ _token(node.semicolon);
+ }
+
+ void _annotatedNode(AnnotatedNode node) {
+ node.documentationComment?.accept(this);
+ _nodeList(node.metadata);
+ }
+
+ void _classMember(ClassMember node) {
+ _declaration(node);
+ }
+
+ void _compilationUnitMember(CompilationUnitMember node) {
+ _declaration(node);
+ }
+
+ void _declaration(Declaration node) {
+ _annotatedNode(node);
+ }
+
+ void _directive(Directive node) {
+ _annotatedNode(node);
+ }
+
+ void _functionBody(FunctionBody node) {
+ _token(node.keyword);
+ _token(node.star);
+ }
+
+ /// Print nodes from the [nodeList].
+ ///
+ /// If the [endToken] is not `null`, print one token after every node,
+ /// unless it is the [endToken].
+ void _nodeList(List<AstNode> nodeList, [Token endToken]) {
+ var length = nodeList.length;
+ for (var i = 0; i < length; ++i) {
+ var node = nodeList[i];
+ node.accept(this);
+ if (endToken != null && node.endToken.next != endToken) {
+ _token(node.endToken.next);
+ }
+ }
+ }
+
+ void _normalFormalParameter(NormalFormalParameter node) {
+ node.documentationComment?.accept(this);
+ _nodeList(node.metadata);
+ _token(node.covariantKeyword);
+ }
+
+ void _token(Token token) {
+ if (token == null) return;
+
+ if (_last != null) {
+ if (_last.next != token) {
+ throw StateError(
+ '|$_last| must be followed by |${_last.next}|, got |$token|',
+ );
+ }
+ }
+
+ // Print preceding comments as a separate sequence of tokens.
+ if (token.precedingComments != null) {
+ var lastToken = _last;
+ _last = null;
+ for (var c = token.precedingComments; c != null; c = c.next) {
+ _token(c);
+ }
+ _last = lastToken;
+ }
+
+ for (var offset = _lastEnd; offset < token.offset; offset++) {
+ var offsetLocation = _lineInfo.getLocation(offset + 1);
+ var offsetLine = offsetLocation.lineNumber - 1;
+ if (offsetLine == _lastEndLine) {
+ _buffer.write(' ');
+ } else {
+ _buffer.write('\n');
+ _lastEndLine++;
+ }
+ }
+
+ _buffer.write(token.lexeme);
+
+ _last = token;
+ _lastEnd = token.end;
+
+ var endLocation = _lineInfo.getLocation(token.end);
+ _lastEndLine = endLocation.lineNumber - 1;
+ }
+
+ void _tokenIfNot(Token maybe, Token ifNot) {
+ if (maybe == null) return;
+ if (maybe == ifNot) return;
+ _token(maybe);
+ }
+
+ _typedLiteral(TypedLiteral node) {
+ _token(node.constKeyword);
+ node.typeArguments?.accept(this);
+ }
+}
diff --git a/analyzer/lib/src/summary2/builder/prefix_builder.dart b/analyzer/lib/src/summary2/builder/prefix_builder.dart
deleted file mode 100644
index c655f34..0000000
--- a/analyzer/lib/src/summary2/builder/prefix_builder.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/summary2/declaration.dart';
-
-class PrefixBuilder extends Declaration {
- PrefixBuilder(String name) : super(name, null);
-}
diff --git a/analyzer/lib/src/summary2/builder/source_library_builder.dart b/analyzer/lib/src/summary2/builder/source_library_builder.dart
index f029ec9..eff744a 100644
--- a/analyzer/lib/src/summary2/builder/source_library_builder.dart
+++ b/analyzer/lib/src/summary2/builder/source_library_builder.dart
@@ -2,168 +2,247 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart' as ast;
-import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/dart/ast/mixin_super_invoked_names.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart' show LibraryScope;
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/ast_binary_writer.dart';
-import 'package:analyzer/src/summary2/builder/prefix_builder.dart';
-import 'package:analyzer/src/summary2/declaration.dart';
+import 'package:analyzer/src/summary2/combinator.dart';
+import 'package:analyzer/src/summary2/constructor_initializer_resolver.dart';
+import 'package:analyzer/src/summary2/default_value_resolver.dart';
+import 'package:analyzer/src/summary2/export.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/link.dart';
+import 'package:analyzer/src/summary2/linked_bundle_context.dart';
import 'package:analyzer/src/summary2/linked_unit_context.dart';
import 'package:analyzer/src/summary2/metadata_resolver.dart';
import 'package:analyzer/src/summary2/reference.dart';
import 'package:analyzer/src/summary2/reference_resolver.dart';
import 'package:analyzer/src/summary2/scope.dart';
-import 'package:analyzer/src/summary2/tokens_writer.dart';
-import 'package:analyzer/src/summary2/top_level_inference.dart';
+import 'package:analyzer/src/summary2/types_builder.dart';
class SourceLibraryBuilder {
final Linker linker;
final Uri uri;
final Reference reference;
final LinkedNodeLibraryBuilder node;
- final List<UnitBuilder> units = [];
- /// The import scope of the library.
- final Scope importScope;
+ LinkedLibraryContext context;
- /// Local declarations, enclosed by [importScope].
- final Scope scope;
+ LibraryElementImpl element;
+ LibraryScope libraryScope;
+
+ /// Local declarations.
+ final Scope localScope = Scope.top();
/// The export scope of the library.
final Scope exportScope = Scope.top();
- SourceLibraryBuilder(Linker linker, Uri uri, Reference reference,
- LinkedNodeLibraryBuilder node)
- : this._(linker, uri, reference, node, Scope.top());
+ final List<Export> exporters = [];
- SourceLibraryBuilder._(
- this.linker, this.uri, this.reference, this.node, this.importScope)
- : scope = Scope(importScope, <String, Declaration>{});
+ SourceLibraryBuilder(this.linker, this.uri, this.reference, this.node);
- void addImportsToScope() {
- // TODO
- var hasDartCore = false;
- var unitContext = units[0].context;
- for (var directive in units[0].node.compilationUnit_directives) {
- if (directive.kind == LinkedNodeKind.importDirective) {
- var relativeUriStr = unitContext.getStringContent(
- directive.uriBasedDirective_uri,
- );
- var relativeUri = Uri.parse(relativeUriStr);
- var uri = resolveRelativeUri(this.uri, relativeUri);
- var builder = linker.builders[uri];
- if (builder != null) {
- builder.exportScope.forEach((name, declaration) {
- importScope.declare(name, declaration);
- });
+ void addExporters() {
+ var unitContext = context.units[0];
+ for (var directive in unitContext.unit_withDirectives.directives) {
+ if (directive is ast.ExportDirective) {
+ Uri uri;
+ try {
+ uri = _selectAbsoluteUri(directive);
+ if (uri == null) continue;
+ } on FormatException {
+ continue;
+ }
+
+ var combinators = directive.combinators.map((node) {
+ if (node is ast.ShowCombinator) {
+ var nameList = node.shownNames.map((i) => i.name).toList();
+ return Combinator.show(nameList);
+ } else if (node is ast.HideCombinator) {
+ var nameList = node.hiddenNames.map((i) => i.name).toList();
+ return Combinator.hide(nameList);
+ }
+ }).toList();
+
+ var exported = linker.builders[uri];
+ var export = Export(this, exported, combinators);
+ if (exported != null) {
+ exported.exporters.add(export);
} else {
var references = linker.elementFactory.exportsOfLibrary('$uri');
- _importExportedReferences(references);
+ for (var reference in references) {
+ export.addToExportScope(reference.name, reference);
+ }
}
- // TODO(scheglov) prefix
- // TODO(scheglov) combinators
}
}
- if (!hasDartCore) {
- var importDartCore = LinkedNodeBuilder.importDirective(
- uriBasedDirective_uri: LinkedNodeBuilder.simpleStringLiteral(
- simpleStringLiteral_value: 'dart:core',
- ),
- )..isSynthetic = true;
- units[0].node.compilationUnit_directives.add(importDartCore);
-
- // TODO(scheglov) This works only when dart:core is linked
- var references = linker.elementFactory.exportsOfLibrary('dart:core');
- _importExportedReferences(references);
- }
}
/// Add top-level declaration of the library units to the local scope.
void addLocalDeclarations() {
- for (var unit in units) {
- var unitRef = reference.getChild('@unit').getChild('${unit.uri}');
+ for (var unitContext in context.units) {
+ var unitRef = reference.getChild('@unit').getChild(unitContext.uriStr);
var classRef = unitRef.getChild('@class');
var enumRef = unitRef.getChild('@enum');
var functionRef = unitRef.getChild('@function');
+ var mixinRef = unitRef.getChild('@mixin');
var typeAliasRef = unitRef.getChild('@typeAlias');
var getterRef = unitRef.getChild('@getter');
var setterRef = unitRef.getChild('@setter');
var variableRef = unitRef.getChild('@variable');
- for (var node in unit.node.compilationUnit_declarations) {
- if (node.kind == LinkedNodeKind.classDeclaration ||
- node.kind == LinkedNodeKind.classTypeAlias) {
- var name = unit.context.getUnitMemberName(node);
+ for (var node in unitContext.unit.declarations) {
+ if (node is ast.ClassDeclaration) {
+ var name = node.name.name;
var reference = classRef.getChild(name);
- reference.node = node;
- var declaration = Declaration(name, reference);
- scope.declare(name, declaration);
- } else if (node.kind == LinkedNodeKind.enumDeclaration) {
- var name = unit.context.getUnitMemberName(node);
+ reference.node2 = node;
+ localScope.declare(name, reference);
+ } else if (node is ast.ClassTypeAlias) {
+ var name = node.name.name;
+ var reference = classRef.getChild(name);
+ reference.node2 = node;
+ localScope.declare(name, reference);
+ } else if (node is ast.EnumDeclaration) {
+ var name = node.name.name;
var reference = enumRef.getChild(name);
- reference.node = node;
- var declaration = Declaration(name, reference);
- scope.declare(name, declaration);
- } else if (node.kind == LinkedNodeKind.functionDeclaration) {
- var name = unit.context.getUnitMemberName(node);
+ reference.node2 = node;
+ localScope.declare(name, reference);
+ } else if (node is ast.FunctionDeclaration) {
+ var name = node.name.name;
Reference containerRef;
- if (unit.context.isGetterFunction(node)) {
+ if (node.isGetter) {
containerRef = getterRef;
- } else if (unit.context.isSetterFunction(node)) {
+ } else if (node.isSetter) {
containerRef = setterRef;
} else {
containerRef = functionRef;
}
var reference = containerRef.getChild(name);
- reference.node = node;
-
- var declaration = Declaration(name, reference);
- scope.declare(name, declaration);
- } else if (node.kind == LinkedNodeKind.functionTypeAlias) {
- var name = unit.context.getUnitMemberName(node);
+ reference.node2 = node;
+ localScope.declare(name, reference);
+ } else if (node is ast.FunctionTypeAlias) {
+ var name = node.name.name;
var reference = typeAliasRef.getChild(name);
- reference.node = node;
+ reference.node2 = node;
- var declaration = Declaration(name, reference);
- scope.declare(name, declaration);
- } else if (node.kind == LinkedNodeKind.genericTypeAlias) {
- var name = unit.context.getUnitMemberName(node);
+ localScope.declare(name, reference);
+ } else if (node is ast.GenericTypeAlias) {
+ var name = node.name.name;
var reference = typeAliasRef.getChild(name);
- reference.node = node;
+ reference.node2 = node;
- var declaration = Declaration(name, reference);
- scope.declare(name, declaration);
- } else if (node.kind == LinkedNodeKind.topLevelVariableDeclaration) {
- var variableList = node.topLevelVariableDeclaration_variableList;
- for (var variable in variableList.variableDeclarationList_variables) {
- var name = unit.context.getVariableName(variable);
+ localScope.declare(name, reference);
+ } else if (node is ast.MixinDeclaration) {
+ var name = node.name.name;
+ var reference = mixinRef.getChild(name);
+ reference.node2 = node;
+ localScope.declare(name, reference);
+ } else if (node is ast.TopLevelVariableDeclaration) {
+ for (var variable in node.variables.variables) {
+ var name = variable.name.name;
var reference = variableRef.getChild(name);
- reference.node = node;
+ reference.node2 = node;
var getter = getterRef.getChild(name);
- scope.declare(name, Declaration(name, getter));
+ localScope.declare(name, getter);
- if (!unit.context.isFinal(variable)) {
+ if (!variable.isConst && !variable.isFinal) {
var setter = setterRef.getChild(name);
- scope.declare('$name=', Declaration(name, setter));
+ localScope.declare('$name=', setter);
}
}
} else {
// TODO(scheglov) implement
- throw UnimplementedError('${node.kind}');
+ throw UnimplementedError('${node.runtimeType}');
}
}
}
+// for (var unit in units) {
+// var unitRef = reference.getChild('@unit').getChild('${unit.uri}');
+// var classRef = unitRef.getChild('@class');
+// var enumRef = unitRef.getChild('@enum');
+// var functionRef = unitRef.getChild('@function');
+// var typeAliasRef = unitRef.getChild('@typeAlias');
+// var getterRef = unitRef.getChild('@getter');
+// var setterRef = unitRef.getChild('@setter');
+// var variableRef = unitRef.getChild('@variable');
+// for (var node in unit.node.compilationUnit_declarations) {
+// if (node.kind == LinkedNodeKind.classDeclaration ||
+// node.kind == LinkedNodeKind.classTypeAlias ||
+// node.kind == LinkedNodeKind.mixinDeclaration) {
+// var name = unit.context.getUnitMemberName(node);
+// var reference = classRef.getChild(name);
+// reference.node = node;
+// scope.declare(name, reference);
+// } else if (node.kind == LinkedNodeKind.enumDeclaration) {
+// var name = unit.context.getUnitMemberName(node);
+// var reference = enumRef.getChild(name);
+// reference.node = node;
+// scope.declare(name, reference);
+// } else if (node.kind == LinkedNodeKind.functionDeclaration) {
+// var name = unit.context.getUnitMemberName(node);
+//
+// Reference containerRef;
+// if (unit.context.isGetterFunction(node)) {
+// containerRef = getterRef;
+// } else if (unit.context.isSetterFunction(node)) {
+// containerRef = setterRef;
+// } else {
+// containerRef = functionRef;
+// }
+//
+// var reference = containerRef.getChild(name);
+// reference.node = node;
+//
+// scope.declare(name, reference);
+// } else if (node.kind == LinkedNodeKind.functionTypeAlias) {
+// var name = unit.context.getUnitMemberName(node);
+// var reference = typeAliasRef.getChild(name);
+// reference.node = node;
+//
+// scope.declare(name, reference);
+// } else if (node.kind == LinkedNodeKind.genericTypeAlias) {
+// var name = unit.context.getUnitMemberName(node);
+// var reference = typeAliasRef.getChild(name);
+// reference.node = node;
+//
+// scope.declare(name, reference);
+// } else if (node.kind == LinkedNodeKind.topLevelVariableDeclaration) {
+// var variableList = node.topLevelVariableDeclaration_variableList;
+// for (var variable in variableList.variableDeclarationList_variables) {
+// var name = unit.context.getVariableName(variable);
+//
+// var reference = variableRef.getChild(name);
+// reference.node = node;
+//
+// var getter = getterRef.getChild(name);
+// scope.declare(name, getter);
+//
+// if (!unit.context.isConst(variable) &&
+// !unit.context.isFinal(variable)) {
+// var setter = setterRef.getChild(name);
+// scope.declare('$name=', setter);
+// }
+// }
+// } else {
+// // TODO(scheglov) implement
+// throw UnimplementedError('${node.kind}');
+// }
+// }
+// }
+ if ('$uri' == 'dart:core') {
+ localScope.declare('dynamic', reference.getChild('dynamic'));
+ localScope.declare('Never', reference.getChild('Never'));
+ }
}
void addSyntheticConstructors() {
- for (var declaration in scope.map.values) {
- var reference = declaration.reference;
+ for (var reference in localScope.map.values) {
var node = reference.node;
if (node == null) continue;
if (node.kind != LinkedNodeKind.classDeclaration) continue;
@@ -185,128 +264,139 @@
}
/// Return `true` if the export scope was modified.
- bool addToExportScope(String name, Declaration declaration) {
+ bool addToExportScope(String name, Reference reference) {
if (name.startsWith('_')) return false;
- if (declaration is PrefixBuilder) return false;
+ if (reference.isPrefix) return false;
var existing = exportScope.map[name];
- if (existing == declaration) return false;
+ if (existing == reference) return false;
// Ambiguous declaration detected.
if (existing != null) return false;
- exportScope.map[name] = declaration;
+ exportScope.map[name] = reference;
return true;
}
+ void buildElement() {
+ element = linker.elementFactory.libraryOfUri('$uri');
+ libraryScope = LibraryScope(element);
+ }
+
void buildInitialExportScope() {
- scope.forEach((name, declaration) {
- addToExportScope(name, declaration);
+ localScope.forEach((name, reference) {
+ addToExportScope(name, reference);
});
}
- void performTopLevelInference() {
- for (var unit in units) {
- TopLevelInference(linker, reference, unit).infer();
+ void collectMixinSuperInvokedNames() {
+ for (var unitContext in context.units) {
+ for (var declaration in unitContext.unit.declarations) {
+ if (declaration is ast.MixinDeclaration) {
+ var names = Set<String>();
+ var collector = MixinSuperInvokedNamesCollector(names);
+ for (var executable in declaration.members) {
+ if (executable is ast.MethodDeclaration) {
+ executable.body.accept(collector);
+ }
+ }
+ var lazy = LazyMixinDeclaration.get(declaration);
+ lazy.setSuperInvokedNames(names.toList());
+ }
+ }
}
}
+ void resolveConstructors() {
+ ConstructorInitializerResolver(linker, element).resolve();
+ }
+
+ void resolveDefaultValues() {
+ DefaultValueResolver(linker, element).resolve();
+ }
+
void resolveMetadata() {
- var metadataResolver = MetadataResolver(linker, reference);
- for (var unit in units) {
- metadataResolver.resolve(unit);
+ for (CompilationUnitElementImpl unit in element.units) {
+ var resolver = MetadataResolver(linker, element, unit);
+ unit.linkedNode.accept(resolver);
}
}
- void resolveTypes() {
- for (var unit in units) {
- var unitReference = reference.getChild('@unit').getChild('${unit.uri}');
- ReferenceResolver(
+ void resolveTypes(NodesToBuildType nodesToBuildType) {
+ for (var unitContext in context.units) {
+ var unitRef = reference.getChild('@unit');
+ var unitReference = unitRef.getChild(unitContext.uriStr);
+ var resolver = ReferenceResolver(
linker.linkingBundleContext,
- unit,
- scope,
+ nodesToBuildType,
+ linker.elementFactory,
+ element,
unitReference,
- ).resolve();
+ linker.contextFeatures.isEnabled(Feature.non_nullable),
+ libraryScope,
+ );
+ unitContext.unit.accept(resolver);
+ }
+ }
+
+ void resolveUriDirectives() {
+ var unitContext = context.units[0];
+ for (var directive in unitContext.unit.directives) {
+ if (directive is ast.NamespaceDirective) {
+ try {
+ var uri = _selectAbsoluteUri(directive);
+ if (uri != null) {
+ LazyDirective.setSelectedUri(directive, '$uri');
+ }
+ } on FormatException {}
+ }
}
}
void storeExportScope() {
var linkingBundleContext = linker.linkingBundleContext;
- for (var declaration in exportScope.map.values) {
- var reference = declaration.reference;
+ for (var reference in exportScope.map.values) {
var index = linkingBundleContext.indexOfReference(reference);
node.exports.add(index);
}
}
- void _importExportedReferences(List<Reference> exportedReferences) {
- for (var reference in exportedReferences) {
- var name = reference.name;
- importScope.declare(name, Declaration(name, reference));
+ Uri _selectAbsoluteUri(ast.NamespaceDirective directive) {
+ var relativeUriStr = _selectRelativeUri(
+ directive.configurations,
+ directive.uri.stringValue,
+ );
+ if (relativeUriStr == null || relativeUriStr.isEmpty) {
+ return null;
}
+ var relativeUri = Uri.parse(relativeUriStr);
+ return resolveRelativeUri(this.uri, relativeUri);
}
- static void build(Linker linker, Source librarySource,
- Map<Source, ast.CompilationUnit> libraryUnits) {
- var libraryUriStr = librarySource.uri.toString();
+ String _selectRelativeUri(
+ List<ast.Configuration> configurations,
+ String defaultUri,
+ ) {
+ for (var configuration in configurations) {
+ var name = configuration.name.components.join('.');
+ var value = configuration.value ?? 'true';
+ if (linker.declaredVariables.get(name) == (value)) {
+ return configuration.uri.stringValue;
+ }
+ }
+ return defaultUri;
+ }
+
+ static void build(Linker linker, LinkInputLibrary inputLibrary) {
+ var libraryUri = inputLibrary.source.uri;
+ var libraryUriStr = '$libraryUri';
var libraryReference = linker.rootReference.getChild(libraryUriStr);
- var unitNodeList = <LinkedNodeUnitBuilder>[];
var libraryNode = LinkedNodeLibraryBuilder(
- units: unitNodeList,
uriStr: libraryUriStr,
);
- var builder = SourceLibraryBuilder(
- linker,
- librarySource.uri,
- libraryReference,
- libraryNode,
- );
-
- ast.CompilationUnit definingUnit;
- for (var unitSource in libraryUnits.keys) {
- var unit = libraryUnits[unitSource];
- definingUnit ??= unit;
-
- var tokensResult = TokensWriter().writeTokens(
- unit.beginToken,
- unit.endToken,
- );
- var tokensContext = tokensResult.toContext();
-
- var unitContext = LinkedUnitContext(
- linker.bundleContext,
- tokensContext,
- );
-
- var writer = AstBinaryWriter(linker.linkingBundleContext, tokensContext);
- var unitNode = writer.writeNode(unit);
-
- builder.units.add(
- UnitBuilder(unitSource.uri, unitContext, unitNode),
- );
-
- libraryNode.units.add(
- LinkedNodeUnitBuilder(
- uriStr: '${unitSource.uri}',
- tokens: tokensResult.tokens,
- node: unitNode,
- ),
- );
-
- if (libraryUriStr == 'dart:core') {
- for (var declaration in unitNode.compilationUnit_declarations) {
- if (declaration.kind == LinkedNodeKind.classDeclaration) {
- var nameNode = declaration.namedCompilationUnitMember_name;
- if (unitContext.getSimpleName(nameNode) == 'Object') {
- declaration.classDeclaration_isDartObject = true;
- }
- }
- }
- }
- }
-
+ var definingUnit = inputLibrary.units[0].unit;
for (var directive in definingUnit.directives) {
if (directive is ast.LibraryDirective) {
var name = directive.name;
@@ -317,8 +407,19 @@
}
}
- linker.linkingLibraries.add(libraryNode);
+ var builder = SourceLibraryBuilder(
+ linker,
+ libraryUri,
+ libraryReference,
+ libraryNode,
+ );
linker.builders[builder.uri] = builder;
+
+ builder.context = linker.bundleContext.addLinkingLibrary(
+ libraryUriStr,
+ libraryNode,
+ inputLibrary,
+ );
}
}
diff --git a/analyzer/lib/src/summary2/combinator.dart b/analyzer/lib/src/summary2/combinator.dart
new file mode 100644
index 0000000..5d7b20e
--- /dev/null
+++ b/analyzer/lib/src/summary2/combinator.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2019, 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 Combinator {
+ final bool isShow;
+ final Set<String> names;
+
+ Combinator(this.isShow, this.names);
+
+ Combinator.show(Iterable<String> names) : this(true, names.toSet());
+
+ Combinator.hide(Iterable<String> names) : this(false, names.toSet());
+
+ bool get isHide => !isShow;
+}
diff --git a/analyzer/lib/src/summary2/constructor_initializer_resolver.dart b/analyzer/lib/src/summary2/constructor_initializer_resolver.dart
new file mode 100644
index 0000000..fbb7919
--- /dev/null
+++ b/analyzer/lib/src/summary2/constructor_initializer_resolver.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart';
+import 'package:analyzer/src/summary2/ast_resolver.dart';
+import 'package:analyzer/src/summary2/link.dart';
+import 'package:analyzer/src/summary2/linking_node_scope.dart';
+
+class ConstructorInitializerResolver {
+ final Linker _linker;
+ final LibraryElementImpl _libraryElement;
+
+ ClassElement _classElement;
+ ConstructorElement _constructorElement;
+ ConstructorDeclarationImpl _constructorNode;
+ AstResolver _astResolver;
+
+ ConstructorInitializerResolver(this._linker, this._libraryElement);
+
+ void resolve() {
+ for (var unit in _libraryElement.units) {
+ for (var classElement in unit.types) {
+ _classElement = classElement;
+ for (var constructorElement in classElement.constructors) {
+ _constructor(constructorElement);
+ }
+ }
+ }
+ }
+
+ void _constructor(ConstructorElementImpl constructorElement) {
+ if (constructorElement.isSynthetic) return;
+
+ _constructorElement = constructorElement;
+ _constructorNode = constructorElement.linkedNode;
+
+ var functionScope = LinkingNodeContext.get(_constructorNode).scope;
+ var initializerScope = ConstructorInitializerScope(
+ functionScope,
+ constructorElement,
+ );
+
+ _astResolver = AstResolver(_linker, _libraryElement, initializerScope);
+
+ _initializers();
+ _redirectedConstructor();
+ }
+
+ void _initializers() {
+ var initializers = _constructorNode.initializers;
+
+ var isConst = _constructorNode.constKeyword != null;
+ if (!isConst) {
+ initializers.clear();
+ return;
+ }
+
+ for (var initializer in initializers) {
+ _astResolver.resolve(
+ initializer,
+ enclosingClassElement: _classElement,
+ enclosingExecutableElement: _constructorElement,
+ );
+ }
+ }
+
+ void _redirectedConstructor() {
+ var redirected = _constructorNode.redirectedConstructor;
+ if (redirected != null) {
+ _astResolver.resolve(
+ redirected,
+ enclosingClassElement: _classElement,
+ enclosingExecutableElement: _constructorElement,
+ );
+ }
+ }
+}
diff --git a/analyzer/lib/src/summary2/core_types.dart b/analyzer/lib/src/summary2/core_types.dart
new file mode 100644
index 0000000..289ea8e
--- /dev/null
+++ b/analyzer/lib/src/summary2/core_types.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
+
+class CoreTypes {
+ final LinkedElementFactory _elementFactory;
+
+ LibraryElement _coreLibrary;
+ ClassElement _objectClass;
+
+ CoreTypes(this._elementFactory);
+
+ LibraryElement get coreLibrary {
+ return _coreLibrary ??= _elementFactory.libraryOfUri('dart:core');
+ }
+
+ ClassElement get objectClass {
+ return _objectClass ??= _getCoreClass('Object');
+ }
+
+ ClassElement _getCoreClass(String name) {
+ return coreLibrary.getType(name);
+ }
+}
diff --git a/analyzer/lib/src/summary2/declaration.dart b/analyzer/lib/src/summary2/declaration.dart
deleted file mode 100644
index d717375..0000000
--- a/analyzer/lib/src/summary2/declaration.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/summary2/reference.dart';
-
-/// A declaration in a scope.
-///
-/// A declaration can be associated with a named node and have [reference] set;
-/// or can be an import prefix, then the [reference] is `null`.
-class Declaration {
- final String name;
- final Reference reference;
-
- Declaration(this.name, this.reference);
-}
diff --git a/analyzer/lib/src/summary2/declaration_splicer.dart b/analyzer/lib/src/summary2/declaration_splicer.dart
new file mode 100644
index 0000000..deef9dc
--- /dev/null
+++ b/analyzer/lib/src/summary2/declaration_splicer.dart
@@ -0,0 +1,588 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/builder.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+
+/// This class takes a [CompilationUnitElement] lazily resynthesized from a
+/// fully resolved, but partial AST (contains only APIs), and full unresolved
+/// AST - and splices them into a single AST with all declaration nodes
+/// fully resolved, and function bodies and variable initializers unresolved.
+///
+class DeclarationSplicer {
+ final CompilationUnitElementImpl _unitElement;
+
+ _ElementWalker _walker;
+
+ DeclarationSplicer(this._unitElement);
+
+ void splice(CompilationUnit full) {
+ var partialNode = _unitElement.linkedContext.readUnitEagerly();
+ _directives(full, partialNode);
+ _declarations(full, partialNode);
+ }
+
+ FunctionBody _body(FunctionBody full) {
+ _buildLocalElements(full);
+ return full;
+ }
+
+ void _buildLocalElements(AstNode node) {
+ if (node == null) return;
+
+ var holder = ElementHolder();
+ var elementBuilder = LocalElementBuilder(holder, _unitElement);
+ node.accept(elementBuilder);
+
+ ElementImpl element = _walker.element;
+ element.encloseElements(holder.functions);
+ element.encloseElements(holder.labels);
+ element.encloseElements(holder.localVariables);
+ }
+
+ void _classDeclaration(ClassDeclaration full, ClassDeclaration partial) {
+ var element = _walker.getClass();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forClass(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ var fullList = full.members;
+ var partialList = partial.members;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _classTypeAlias(ClassTypeAlias full, ClassTypeAlias partial) {
+ var element = _walker.getClass();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forClass(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _constructorDeclaration(
+ ConstructorDeclaration full,
+ ConstructorDeclaration partial,
+ ) {
+ var element = _walker.getConstructor();
+ _match(partial.name, element);
+ (partial as ConstructorDeclarationImpl).declaredElement = element;
+ _walk(_ElementWalker.forExecutable(element), () {
+ _formalParameterList(full.parameters, partial.parameters);
+ _constructorInitializers(full.initializers, partial.initializers);
+ partial.body = _body(full.body);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _constructorInitializers(
+ List<ConstructorInitializer> full,
+ List<ConstructorInitializer> partial,
+ ) {
+ if (full.isNotEmpty && partial.isEmpty) {
+ partial.addAll(full);
+ }
+ partial.forEach(_buildLocalElements);
+ }
+
+ void _declarations(CompilationUnit full, CompilationUnit partial) {
+ _walk(_ElementWalker.forCompilationUnit(_unitElement), () {
+ var fullList = full.declarations;
+ var partialList = partial.declarations;
+ for (var i = 0; i < fullList.length; ++i) {
+ var partialNode = _node(fullList[i], partialList[i]);
+ fullList[i] = partialNode;
+ }
+ });
+ }
+
+ void _directives(CompilationUnit full, CompilationUnit partial) {
+ var libraryElement = _unitElement.library;
+ var exportIndex = 0;
+ var importIndex = 0;
+ var partIndex = 0;
+ for (var directive in full.directives) {
+ if (directive is ExportDirective) {
+ var element = libraryElement.exports[exportIndex++];
+ _metadata(directive.metadata, element);
+ } else if (directive is ImportDirective) {
+ var element = libraryElement.imports[importIndex++];
+ _metadata(directive.metadata, element);
+ } else if (directive is LibraryDirective) {
+ var element = libraryElement;
+ _metadata(directive.metadata, element);
+ } else if (directive is PartDirective) {
+ var element = libraryElement.parts[partIndex++];
+ _metadata(directive.metadata, element);
+ }
+ }
+ }
+
+ void _enumConstantDeclaration(
+ EnumConstantDeclaration full, EnumConstantDeclaration partial) {
+ var element = _walker.getVariable();
+ _match(partial.name, element);
+ _metadata(partial.metadata, element);
+ }
+
+ void _enumDeclaration(EnumDeclaration full, EnumDeclaration partial) {
+ var element = _walker.getEnum();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forClass(element), () {
+ var fullList = full.constants;
+ var partialList = partial.constants;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _fieldDeclaration(FieldDeclaration full, FieldDeclaration partial) {
+ _node(full.fields, partial.fields);
+
+ var first = partial.fields.variables[0];
+ _metadata(partial.metadata, first.declaredElement);
+ }
+
+ void _fieldFormalParameter(
+ FieldFormalParameter full,
+ FieldFormalParameter partial,
+ ) {
+ var element = _walker.getParameter();
+ _match(partial.identifier, element);
+ _walk(_ElementWalker.forParameter(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _formalParameterList(
+ FormalParameterList full,
+ FormalParameterList partial,
+ ) {
+ var fullList = full.parameters;
+ var partialList = partial.parameters;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ }
+
+ void _functionDeclaration(
+ FunctionDeclaration full,
+ FunctionDeclaration partial,
+ ) {
+ var element = partial.propertyKeyword == null
+ ? _walker.getFunction()
+ : _walker.getAccessor();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forExecutable(element), () {
+ _node(full.functionExpression, partial.functionExpression);
+ });
+ (partial.functionExpression as FunctionExpressionImpl).declaredElement =
+ element;
+ _metadata(partial.metadata, element);
+ _node(full.returnType, partial.returnType);
+ }
+
+ void _functionExpression(
+ FunctionExpression full,
+ FunctionExpression partial,
+ ) {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ partial.body = _body(full.body);
+ }
+
+ void _functionTypeAlias(FunctionTypeAlias full, FunctionTypeAlias partial) {
+ var element = _walker.getTypedef();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forGenericTypeAlias(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _functionTypedFormalParameter(
+ FunctionTypedFormalParameter full,
+ FunctionTypedFormalParameter partial,
+ ) {
+ var element = _walker.getParameter();
+ _match(partial.identifier, element);
+ _walk(_ElementWalker.forParameter(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ void _genericFunctionType(
+ GenericFunctionType full,
+ GenericFunctionType partial,
+ ) {
+ var element = (partial as GenericFunctionTypeImpl).declaredElement;
+ _walk(_ElementWalker.forGenericFunctionType(element), () {
+ _node(full.returnType, partial.returnType);
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ });
+ }
+
+ void _genericTypeAlias(GenericTypeAlias full, GenericTypeAlias partial) {
+ var element = _walker.getTypedef();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forGenericTypeAlias(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.functionType, partial.functionType);
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ /// Updates [node] to point to [element], after ensuring that the
+ /// element has the expected name.
+ E _match<E extends Element>(SimpleIdentifier node, E element) {
+ // TODO(scheglov) has troubles with getter/setter.
+// if (element.name != node.name) {
+// throw new StateError(
+// 'Expected an element matching `${node.name}`, got `${element.name}`',
+// );
+// }
+ if (node != null) {
+ node.staticElement = element;
+ }
+ return element;
+ }
+
+ void _methodDeclaration(MethodDeclaration full, MethodDeclaration partial) {
+ var element = partial.propertyKeyword == null
+ ? _walker.getFunction()
+ : _walker.getAccessor();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forExecutable(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ _node(full.parameters, partial.parameters);
+ partial.body = _body(full.body);
+ });
+ _metadata(partial.metadata, element);
+ _node(full.returnType, partial.returnType);
+ }
+
+ void _mixinDeclaration(MixinDeclaration full, MixinDeclaration partial) {
+ var element = _walker.getMixin();
+ _match(partial.name, element);
+ _walk(_ElementWalker.forClass(element), () {
+ _node(full.typeParameters, partial.typeParameters);
+ var fullList = full.members;
+ var partialList = partial.members;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ });
+ _metadata(partial.metadata, element);
+ }
+
+ AstNode _node(AstNode full, AstNode partial) {
+ if (full == null && partial == null) {
+ return partial;
+ } else if (full is ClassDeclaration && partial is ClassDeclaration) {
+ _classDeclaration(full, partial);
+ return partial;
+ } else if (full is ClassTypeAlias && partial is ClassTypeAlias) {
+ _classTypeAlias(full, partial);
+ return partial;
+ } else if (full is ConstructorDeclaration &&
+ partial is ConstructorDeclaration) {
+ _constructorDeclaration(full, partial);
+ return partial;
+ } else if (full is DefaultFormalParameter &&
+ partial is DefaultFormalParameter) {
+ _node(full.parameter, partial.parameter);
+ return partial;
+ } else if (full is EnumConstantDeclaration &&
+ partial is EnumConstantDeclaration) {
+ _enumConstantDeclaration(full, partial);
+ return partial;
+ } else if (full is EnumDeclaration && partial is EnumDeclaration) {
+ _enumDeclaration(full, partial);
+ return partial;
+ } else if (full is FieldDeclaration && partial is FieldDeclaration) {
+ _fieldDeclaration(full, partial);
+ return partial;
+ } else if (full is FieldFormalParameter &&
+ partial is FieldFormalParameter) {
+ _fieldFormalParameter(full, partial);
+ return partial;
+ } else if (full is FormalParameterList && partial is FormalParameterList) {
+ _formalParameterList(full, partial);
+ return partial;
+ } else if (full is FunctionDeclaration && partial is FunctionDeclaration) {
+ _functionDeclaration(full, partial);
+ return partial;
+ } else if (full is FunctionExpression && partial is FunctionExpression) {
+ _functionExpression(full, partial);
+ return partial;
+ } else if (full is FunctionTypedFormalParameter &&
+ partial is FunctionTypedFormalParameter) {
+ _functionTypedFormalParameter(full, partial);
+ return partial;
+ } else if (full is FunctionTypeAlias && partial is FunctionTypeAlias) {
+ _functionTypeAlias(full, partial);
+ return partial;
+ } else if (full is GenericFunctionType && partial is GenericFunctionType) {
+ _genericFunctionType(full, partial);
+ return partial;
+ } else if (full is GenericTypeAlias && partial is GenericTypeAlias) {
+ _genericTypeAlias(full, partial);
+ return partial;
+ } else if (full is MethodDeclaration && partial is MethodDeclaration) {
+ _methodDeclaration(full, partial);
+ return partial;
+ } else if (full is MixinDeclaration && partial is MixinDeclaration) {
+ _mixinDeclaration(full, partial);
+ return partial;
+ } else if (full is SimpleFormalParameter &&
+ partial is SimpleFormalParameter) {
+ _simpleFormalParameter(full, partial);
+ return partial;
+ } else if (full is TopLevelVariableDeclaration &&
+ partial is TopLevelVariableDeclaration) {
+ _topLevelVariableDeclaration(full, partial);
+ return partial;
+ } else if (full is TypeName && partial is TypeName) {
+ _typeName(full, partial);
+ return partial;
+ } else if (full is TypeParameter && partial is TypeParameter) {
+ _typeParameter(full, partial);
+ return partial;
+ } else if (full is TypeParameterList && partial is TypeParameterList) {
+ _typeParameterList(full, partial);
+ return partial;
+ } else if (full is VariableDeclaration && partial is VariableDeclaration) {
+ _variableDeclaration(full, partial);
+ return partial;
+ } else if (full is VariableDeclarationList &&
+ partial is VariableDeclarationList) {
+ _variableDeclarationList(full, partial);
+ return partial;
+ } else {
+ throw UnimplementedError(
+ '${full.runtimeType} and ${partial.runtimeType}',
+ );
+ }
+ }
+
+ void _simpleFormalParameter(
+ SimpleFormalParameter full,
+ SimpleFormalParameter partial,
+ ) {
+ var element = _walker.getParameter();
+ _match(partial.identifier, element);
+ (partial as SimpleFormalParameterImpl).declaredElement = element;
+ _metadata(partial.metadata, element);
+ _node(full.type, partial.type);
+ }
+
+ void _topLevelVariableDeclaration(
+ TopLevelVariableDeclaration full,
+ TopLevelVariableDeclaration partial,
+ ) {
+ _node(full.variables, partial.variables);
+
+ var first = partial.variables.variables[0];
+ _metadata(partial.metadata, first.declaredElement);
+ }
+
+ void _typeName(TypeName full, TypeName partial) {
+ var fullList = full.typeArguments?.arguments;
+ var partialList = partial.typeArguments?.arguments;
+ if (fullList != null && partialList != null) {
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ }
+ }
+
+ void _typeParameter(TypeParameter full, TypeParameter partial) {
+ var element = _walker.getTypeParameter();
+ _match(partial.name, element);
+ _node(full.bound, partial.bound);
+ _metadata(partial.metadata, element);
+ }
+
+ void _typeParameterList(TypeParameterList full, TypeParameterList partial) {
+ var fullList = full.typeParameters;
+ var partialList = partial.typeParameters;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ }
+
+ void _variableDeclaration(
+ VariableDeclaration full,
+ VariableDeclaration partial,
+ ) {
+ var element = _walker.getVariable();
+ _match(partial.name, element);
+
+ partial.initializer = full.initializer;
+ _buildLocalElements(partial.initializer);
+ }
+
+ void _variableDeclarationList(
+ VariableDeclarationList full,
+ VariableDeclarationList partial,
+ ) {
+ _node(full.type, partial.type);
+
+ var fullList = full.variables;
+ var partialList = partial.variables;
+ for (var i = 0; i < fullList.length; ++i) {
+ _node(fullList[i], partialList[i]);
+ }
+ }
+
+ void _walk(_ElementWalker walker, void f()) {
+ var outer = _walker;
+ _walker = walker;
+ f();
+ _walker = outer;
+ }
+
+ /// Associate [nodes] with the corresponding [ElementAnnotation]s.
+ static void _metadata(List<Annotation> nodes, Element element) {
+ var elements = element.metadata;
+ if (nodes.length != elements.length) {
+ throw StateError('Found ${nodes.length} annotation nodes and '
+ '${elements.length} element annotations');
+ }
+ for (var i = 0; i < nodes.length; i++) {
+ nodes[i].elementAnnotation = elements[i];
+ }
+ }
+}
+
+class _ElementWalker {
+ final Element element;
+
+ List<PropertyAccessorElement> _accessors;
+ int _accessorIndex = 0;
+
+ List<ClassElement> _classes;
+ int _classIndex = 0;
+
+ List<ConstructorElement> _constructors;
+ int _constructorIndex = 0;
+
+ List<ClassElement> _enums;
+ int _enumIndex = 0;
+
+ List<ExecutableElement> _functions;
+ int _functionIndex = 0;
+
+ List<ClassElement> _mixins;
+ int _mixinIndex = 0;
+
+ List<ParameterElement> _parameters;
+ int _parameterIndex = 0;
+
+ List<FunctionTypeAliasElement> _typedefs;
+ int _typedefIndex = 0;
+
+ List<TypeParameterElement> _typeParameters;
+ int _typeParameterIndex = 0;
+
+ List<VariableElement> _variables;
+ int _variableIndex = 0;
+
+ _ElementWalker.forClass(ClassElement element)
+ : element = element,
+ _accessors = element.accessors.where(_isNotSynthetic).toList(),
+ _constructors = element.isMixinApplication
+ ? null
+ : element.constructors.where(_isNotSynthetic).toList(),
+ _functions = element.methods,
+ _typeParameters = element.typeParameters,
+ _variables = element.fields.where(_isNotSynthetic).toList();
+
+ _ElementWalker.forCompilationUnit(CompilationUnitElement element)
+ : element = element,
+ _accessors = element.accessors.where(_isNotSynthetic).toList(),
+ _classes = element.types,
+ _enums = element.enums,
+ _functions = element.functions,
+ _mixins = element.mixins,
+ _typedefs = element.functionTypeAliases,
+ _variables = element.topLevelVariables.where(_isNotSynthetic).toList();
+
+ _ElementWalker.forExecutable(ExecutableElement element)
+ : element = element,
+ _parameters = element.parameters,
+ _typeParameters = element.typeParameters;
+
+ _ElementWalker.forGenericFunctionType(GenericFunctionTypeElement element)
+ : element = element,
+ _parameters = element.parameters,
+ _typeParameters = element.typeParameters;
+
+ _ElementWalker.forGenericTypeAlias(FunctionTypeAliasElement element)
+ : element = element,
+ _parameters = element.parameters,
+ _typeParameters = element.typeParameters;
+
+ _ElementWalker.forParameter(ParameterElement element)
+ : element = element,
+ _parameters = element.parameters,
+ _typeParameters = element.typeParameters;
+
+ PropertyAccessorElement getAccessor() {
+ return _accessors[_accessorIndex++];
+ }
+
+ ClassElement getClass() {
+ return _classes[_classIndex++];
+ }
+
+ ConstructorElement getConstructor() {
+ return _constructors[_constructorIndex++];
+ }
+
+ ClassElement getEnum() {
+ return _enums[_enumIndex++];
+ }
+
+ ExecutableElement getFunction() {
+ return _functions[_functionIndex++];
+ }
+
+ ClassElement getMixin() {
+ return _mixins[_mixinIndex++];
+ }
+
+ ParameterElement getParameter() {
+ return _parameters[_parameterIndex++];
+ }
+
+ FunctionTypeAliasElement getTypedef() {
+ return _typedefs[_typedefIndex++];
+ }
+
+ TypeParameterElement getTypeParameter() {
+ return _typeParameters[_typeParameterIndex++];
+ }
+
+ VariableElement getVariable() {
+ return _variables[_variableIndex++];
+ }
+
+ static bool _isNotSynthetic(Element e) => !e.isSynthetic;
+}
diff --git a/analyzer/lib/src/summary2/default_types_builder.dart b/analyzer/lib/src/summary2/default_types_builder.dart
new file mode 100644
index 0000000..18a4fcb
--- /dev/null
+++ b/analyzer/lib/src/summary2/default_types_builder.dart
@@ -0,0 +1,308 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
+import 'package:analyzer/src/generated/type_system.dart';
+import 'package:analyzer/src/summary2/function_type_builder.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/named_type_builder.dart';
+import 'package:analyzer/src/summary2/type_builder.dart';
+import 'package:kernel/util/graph.dart' show Graph, computeStrongComponents;
+
+class DefaultTypesBuilder {
+ final Dart2TypeSystem typeSystem;
+
+ DefaultTypesBuilder(this.typeSystem);
+
+ void build(List<AstNode> nodes) {
+ for (var node in nodes) {
+ if (node is ClassDeclaration) {
+ _breakRawTypeCycles(node.declaredElement, node.typeParameters);
+ _computeBounds(node.typeParameters);
+ } else if (node is ClassTypeAlias) {
+ _breakRawTypeCycles(node.declaredElement, node.typeParameters);
+ _computeBounds(node.typeParameters);
+ } else if (node is FunctionTypeAlias) {
+ _breakRawTypeCycles(node.declaredElement, node.typeParameters);
+ _computeBounds(node.typeParameters);
+ } else if (node is GenericTypeAlias) {
+ _breakRawTypeCycles(node.declaredElement, node.typeParameters);
+ _computeBounds(node.typeParameters);
+ } else if (node is MixinDeclaration) {
+ _breakRawTypeCycles(node.declaredElement, node.typeParameters);
+ _computeBounds(node.typeParameters);
+ }
+ }
+ for (var node in nodes) {
+ if (node is ClassDeclaration) {
+ _build(node.typeParameters);
+ } else if (node is ClassTypeAlias) {
+ _build(node.typeParameters);
+ } else if (node is FunctionTypeAlias) {
+ _build(node.typeParameters);
+ } else if (node is GenericTypeAlias) {
+ _build(node.typeParameters);
+ } else if (node is MixinDeclaration) {
+ _build(node.typeParameters);
+ }
+ }
+ }
+
+ void _breakRawTypeCycles(
+ Element declarationElement,
+ TypeParameterList parameterList,
+ ) {
+ if (parameterList == null) return;
+
+ var allCycles = <List<_CycleElement>>[];
+ for (var parameter in parameterList.typeParameters) {
+ var boundNode = parameter.bound;
+ if (boundNode == null) continue;
+
+ var cycles = _findRawTypePathsToDeclaration(
+ parameter,
+ boundNode.type,
+ declarationElement,
+ Set<Element>.identity(),
+ );
+ allCycles.addAll(cycles);
+ }
+
+ for (var cycle in allCycles) {
+ for (var element in cycle) {
+ var boundNode = element.parameter.bound;
+ if (boundNode is TypeName) {
+ boundNode.type = DynamicTypeImpl.instance;
+ } else {
+ throw UnimplementedError('(${boundNode.runtimeType}) $boundNode');
+ }
+ }
+ }
+ }
+
+ /// Build actual default type [DartType]s from computed [TypeBuilder]s.
+ void _build(TypeParameterList parameterList) {
+ if (parameterList == null) return;
+
+ for (var parameter in parameterList.typeParameters) {
+ var defaultType = LazyAst.getDefaultType(parameter);
+ if (defaultType is TypeBuilder) {
+ var builtType = defaultType.build();
+ LazyAst.setDefaultType(parameter, builtType);
+ }
+ }
+ }
+
+ /// Compute bounds to be provided as type arguments in place of missing type
+ /// arguments on raw types with the given type parameters.
+ void _computeBounds(TypeParameterList parameterList) {
+ if (parameterList == null) return;
+
+ var dynamicType = typeSystem.typeProvider.dynamicType;
+ var nullType = typeSystem.typeProvider.nullType;
+
+ var nodes = parameterList.typeParameters;
+ var length = nodes.length;
+ var elements = List<TypeParameterElement>(length);
+ var bounds = List<DartType>(length);
+ for (int i = 0; i < length; i++) {
+ var node = nodes[i];
+ elements[i] = node.declaredElement;
+ bounds[i] = node.bound?.type ?? dynamicType;
+ }
+
+ var graph = _TypeParametersGraph(elements, bounds);
+ var stronglyConnected = computeStrongComponents(graph);
+ for (var component in stronglyConnected) {
+ var dynamicSubstitution = <TypeParameterElement, DartType>{};
+ var nullSubstitution = <TypeParameterElement, DartType>{};
+ for (var i in component) {
+ var element = elements[i];
+ dynamicSubstitution[element] = dynamicType;
+ nullSubstitution[element] = nullType;
+ }
+
+ var substitution = Substitution.fromUpperAndLowerBounds(
+ dynamicSubstitution,
+ nullSubstitution,
+ );
+ for (var i in component) {
+ bounds[i] = substitution.substituteType(bounds[i]);
+ }
+ }
+
+ for (var i = 0; i < length; i++) {
+ var thisSubstitution = <TypeParameterElement, DartType>{};
+ var nullSubstitution = <TypeParameterElement, DartType>{};
+ var element = elements[i];
+ thisSubstitution[element] = bounds[i];
+ nullSubstitution[element] = nullType;
+
+ var substitution = Substitution.fromUpperAndLowerBounds(
+ thisSubstitution,
+ nullSubstitution,
+ );
+ for (var j = 0; j < length; j++) {
+ bounds[j] = substitution.substituteType(bounds[j]);
+ }
+ }
+
+ // Set computed TypeBuilder(s) as default types.
+ for (var i = 0; i < length; i++) {
+ LazyAst.setDefaultType(nodes[i], bounds[i]);
+ }
+ }
+
+ /// Finds raw type paths starting with the [startParameter] and a
+ /// [startType] that is used in its bound, and ending with [end].
+ List<List<_CycleElement>> _findRawTypePathsToDeclaration(
+ TypeParameter startParameter,
+ DartType startType,
+ Element end,
+ Set<Element> visited,
+ ) {
+ var paths = <List<_CycleElement>>[];
+ if (startType is NamedTypeBuilder) {
+ var declaration = startType.element;
+ if (startType.arguments.isEmpty) {
+ if (startType.element == end) {
+ paths.add([
+ _CycleElement(startParameter, startType),
+ ]);
+ } else if (visited.add(startType.element)) {
+ void recurseParameters(List<TypeParameterElement> parameters) {
+ for (TypeParameterElementImpl parameter in parameters) {
+ TypeParameter parameterNode = parameter.linkedNode;
+ var bound = parameterNode.bound;
+ if (bound != null) {
+ var tails = _findRawTypePathsToDeclaration(
+ parameterNode,
+ bound.type,
+ end,
+ visited,
+ );
+ for (var tail in tails) {
+ paths.add(<_CycleElement>[
+ _CycleElement(startParameter, startType),
+ ]..addAll(tail));
+ }
+ }
+ }
+ }
+
+ if (declaration is ClassElement) {
+ recurseParameters(declaration.typeParameters);
+ } else if (declaration is GenericTypeAliasElement) {
+ recurseParameters(declaration.typeParameters);
+ }
+ visited.remove(startType.element);
+ }
+ } else {
+ for (var argument in startType.arguments) {
+ paths.addAll(
+ _findRawTypePathsToDeclaration(
+ startParameter,
+ argument,
+ end,
+ visited,
+ ),
+ );
+ }
+ }
+ } else if (startType is FunctionTypeBuilder) {
+ paths.addAll(
+ _findRawTypePathsToDeclaration(
+ startParameter,
+ startType.returnType,
+ end,
+ visited,
+ ),
+ );
+ for (var formalParameter in startType.parameters) {
+ paths.addAll(
+ _findRawTypePathsToDeclaration(
+ startParameter,
+ formalParameter.type,
+ end,
+ visited,
+ ),
+ );
+ }
+ }
+ return paths;
+ }
+}
+
+class _CycleElement {
+ final TypeParameter parameter;
+ final DartType type;
+
+ _CycleElement(this.parameter, this.type);
+}
+
+/// Graph of mutual dependencies of type parameters from the same declaration.
+/// Type parameters are represented by their indices in the corresponding
+/// declaration.
+class _TypeParametersGraph implements Graph<int> {
+ @override
+ List<int> vertices;
+
+ // Each `edges[i]` is the list of indices of type parameters that reference
+ // the type parameter with the index `i` in their bounds.
+ List<List<int>> _edges;
+
+ Map<TypeParameterElement, int> _parameterToIndex = Map.identity();
+
+ _TypeParametersGraph(
+ List<TypeParameterElement> parameters,
+ List<DartType> bounds,
+ ) {
+ assert(parameters.length == bounds.length);
+
+ vertices = List<int>(parameters.length);
+ _edges = List<List<int>>(parameters.length);
+ for (int i = 0; i < vertices.length; i++) {
+ vertices[i] = i;
+ _edges[i] = <int>[];
+ _parameterToIndex[parameters[i]] = i;
+ }
+
+ for (int i = 0; i < vertices.length; i++) {
+ _collectReferencesFrom(i, bounds[i]);
+ }
+ }
+
+ /// Return type parameters that depend on the [index]th type parameter.
+ @override
+ Iterable<int> neighborsOf(int index) {
+ return _edges[index];
+ }
+
+ /// Collect references to the [index]th type parameter from the [type].
+ void _collectReferencesFrom(int index, DartType type) {
+ if (type is FunctionTypeBuilder) {
+ for (var parameter in type.typeFormals) {
+ _collectReferencesFrom(index, parameter.bound);
+ }
+ for (var parameter in type.parameters) {
+ _collectReferencesFrom(index, parameter.type);
+ }
+ _collectReferencesFrom(index, type.returnType);
+ } else if (type is NamedTypeBuilder) {
+ for (var argument in type.arguments) {
+ _collectReferencesFrom(index, argument);
+ }
+ } else if (type is TypeParameterType) {
+ var typeIndex = _parameterToIndex[type.element];
+ if (typeIndex != null) {
+ _edges[typeIndex].add(index);
+ }
+ }
+ }
+}
diff --git a/analyzer/lib/src/summary2/default_value_resolver.dart b/analyzer/lib/src/summary2/default_value_resolver.dart
new file mode 100644
index 0000000..f531465
--- /dev/null
+++ b/analyzer/lib/src/summary2/default_value_resolver.dart
@@ -0,0 +1,117 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/summary2/ast_resolver.dart';
+import 'package:analyzer/src/summary2/link.dart';
+import 'package:analyzer/src/summary2/linking_node_scope.dart';
+
+class DefaultValueResolver {
+ final Linker _linker;
+ final LibraryElementImpl _libraryElement;
+
+ ClassElement _classElement;
+ ExecutableElement _executableElement;
+ Scope _scope;
+
+ AstResolver _astResolver;
+
+ DefaultValueResolver(this._linker, this._libraryElement);
+
+ void resolve() {
+ for (CompilationUnitElementImpl unit in _libraryElement.units) {
+ for (var classElement in unit.types) {
+ _classElement = classElement;
+
+ for (var element in classElement.constructors) {
+ _constructor(element);
+ }
+
+ for (var element in classElement.methods) {
+ _setScopeFromElement(element);
+ _method(element);
+ }
+
+ _classElement = null;
+ }
+
+ for (var element in unit.functions) {
+ _function(element);
+ }
+ }
+ }
+
+ void _constructor(ConstructorElementImpl element) {
+ if (element.isSynthetic) return;
+
+ _astResolver = null;
+ _executableElement = element;
+ _setScopeFromElement(element);
+
+ _parameters(element.parameters);
+ }
+
+ void _function(FunctionElementImpl element) {
+ _astResolver = null;
+ _executableElement = element;
+ _setScopeFromElement(element);
+
+ _parameters(element.parameters);
+ }
+
+ void _method(MethodElementImpl element) {
+ _astResolver = null;
+ _executableElement = element;
+ _setScopeFromElement(element);
+
+ _parameters(element.parameters);
+ }
+
+ void _parameter(ParameterElementImpl parameter) {
+ Expression defaultValue;
+ var node = parameter.linkedNode;
+ if (node is DefaultFormalParameter) {
+ defaultValue = node.defaultValue;
+ }
+ if (defaultValue == null) return;
+
+ var contextType = TypeVariableEliminator(_linker.typeProvider)
+ .substituteType(parameter.type);
+ InferenceContext.setType(defaultValue, contextType);
+
+ _astResolver ??= AstResolver(_linker, _libraryElement, _scope);
+ _astResolver.resolve(
+ defaultValue,
+ enclosingClassElement: _classElement,
+ enclosingExecutableElement: _executableElement,
+ );
+ }
+
+ void _parameters(List<ParameterElement> parameters) {
+ for (var parameter in parameters) {
+ _parameter(parameter);
+ }
+ }
+
+ void _setScopeFromElement(Element element) {
+ _scope = LinkingNodeContext.get((element as ElementImpl).linkedNode).scope;
+ }
+}
+
+class TypeVariableEliminator extends Substitution {
+ final TypeProvider _typeProvider;
+
+ TypeVariableEliminator(this._typeProvider);
+
+ @override
+ DartType getSubstitute(TypeParameterElement parameter, bool upperBound) {
+ return upperBound ? _typeProvider.nullType : _typeProvider.objectType;
+ }
+}
diff --git a/analyzer/lib/src/summary2/export.dart b/analyzer/lib/src/summary2/export.dart
new file mode 100644
index 0000000..63a1365
--- /dev/null
+++ b/analyzer/lib/src/summary2/export.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
+import 'package:analyzer/src/summary2/combinator.dart';
+import 'package:analyzer/src/summary2/reference.dart';
+
+class Export {
+ final SourceLibraryBuilder exporter;
+ final SourceLibraryBuilder exported;
+ final List<Combinator> combinators;
+
+ Export(this.exporter, this.exported, this.combinators);
+
+ bool addToExportScope(String name, Reference reference) {
+ if (combinators != null) {
+ for (Combinator combinator in combinators) {
+ if (combinator.isShow && !combinator.names.contains(name)) return false;
+ if (combinator.isHide && combinator.names.contains(name)) return false;
+ }
+ }
+ return exporter.addToExportScope(name, reference);
+ }
+}
diff --git a/analyzer/lib/src/summary2/function_type_builder.dart b/analyzer/lib/src/summary2/function_type_builder.dart
new file mode 100644
index 0000000..39425e6
--- /dev/null
+++ b/analyzer/lib/src/summary2/function_type_builder.dart
@@ -0,0 +1,145 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/type_builder.dart';
+
+/// The type builder for a [GenericFunctionType].
+class FunctionTypeBuilder extends TypeBuilder {
+ static DynamicTypeImpl get _dynamicType => DynamicTypeImpl.instance;
+
+ final List<TypeParameterElement> typeFormals;
+ final List<ParameterElement> parameters;
+ final DartType returnType;
+ final NullabilitySuffix nullabilitySuffix;
+
+ /// The node for which this builder is created, or `null` if the builder
+ /// was detached from its node, e.g. during computing default types for
+ /// type parameters.
+ final GenericFunctionTypeImpl node;
+
+ /// The actual built type, not a [TypeBuilder] anymore.
+ ///
+ /// When [build] is called, the type is built, stored into this field,
+ /// and set for the [node].
+ DartType _type;
+
+ FunctionTypeBuilder(
+ this.typeFormals,
+ this.parameters,
+ this.returnType,
+ this.nullabilitySuffix, {
+ this.node,
+ });
+
+ factory FunctionTypeBuilder.of(
+ GenericFunctionType node,
+ NullabilitySuffix nullabilitySuffix,
+ ) {
+ return FunctionTypeBuilder(
+ node.typeParameters?.typeParameters
+ ?.map((n) => n.declaredElement as TypeParameterElement)
+ ?.toList() ??
+ [],
+ node.parameters.parameters.map((n) {
+ return ParameterElementImpl.synthetic(
+ n.identifier?.name ?? '',
+ _getParameterType(n),
+ // ignore: deprecated_member_use_from_same_package
+ n.kind,
+ );
+ }).toList(),
+ _getNodeType(node.returnType),
+ nullabilitySuffix,
+ node: node,
+ );
+ }
+
+ @override
+ Element get element => null;
+
+ @override
+ DartType build() {
+ if (_type != null) {
+ return _type;
+ }
+
+ var builtReturnType = _buildType(returnType);
+ _type = FunctionTypeImpl.synthetic(
+ builtReturnType,
+ typeFormals,
+ parameters.map((e) {
+ return ParameterElementImpl.synthetic(
+ e.name,
+ _buildType(e.type),
+ // ignore: deprecated_member_use_from_same_package
+ e.parameterKind,
+ );
+ }).toList(),
+ nullabilitySuffix: nullabilitySuffix,
+ );
+
+ if (node != null) {
+ node.type = _type;
+ LazyAst.setReturnType(node, builtReturnType ?? _dynamicType);
+ }
+
+ return _type;
+ }
+
+ @override
+ String toString() {
+ var buffer = StringBuffer();
+
+ if (typeFormals.isNotEmpty) {
+ buffer.write('<');
+ buffer.write(typeFormals.join(', '));
+ buffer.write('>');
+ }
+
+ buffer.write('(');
+ buffer.write(parameters.join(', '));
+ buffer.write(')');
+
+ buffer.write(' → ');
+ buffer.write(returnType);
+
+ return buffer.toString();
+ }
+
+ /// If the [type] is a [TypeBuilder], build it; otherwise return as is.
+ static DartType _buildType(DartType type) {
+ if (type is TypeBuilder) {
+ return type.build();
+ } else {
+ return type;
+ }
+ }
+
+ /// Return the type of the [node] as is, possibly a [TypeBuilder].
+ static DartType _getNodeType(TypeAnnotation node) {
+ if (node == null) {
+ return _dynamicType;
+ } else {
+ return node.type;
+ }
+ }
+
+ /// Return the type of the [node] as is, possibly a [TypeBuilder].
+ static DartType _getParameterType(FormalParameter node) {
+ if (node is DefaultFormalParameter) {
+ return _getParameterType(node.parameter);
+ } else if (node is SimpleFormalParameter) {
+ return _getNodeType(node.type);
+ } else {
+ throw UnimplementedError('(${node.runtimeType}) $node');
+ }
+ }
+}
diff --git a/analyzer/lib/src/summary2/lazy_ast.dart b/analyzer/lib/src/summary2/lazy_ast.dart
new file mode 100644
index 0000000..9f7fd21
--- /dev/null
+++ b/analyzer/lib/src/summary2/lazy_ast.dart
@@ -0,0 +1,1496 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/ast_binary_reader.dart';
+
+/// Accessor for reading AST lazily, or read data that is stored in IDL, but
+/// cannot be stored in AST, like inferred types.
+class LazyAst {
+ static const _defaultTypedKey = 'lazyAst_defaultType';
+ static const _genericFunctionTypeIdKey = 'lazyAst_genericFunctionTypeId';
+ static const _hasOverrideInferenceKey = 'lazyAst_hasOverrideInference';
+ static const _inheritsCovariantKey = 'lazyAst_isCovariant';
+ static const _isSimplyBoundedKey = 'lazyAst_simplyBounded';
+ static const _returnTypeKey = 'lazyAst_returnType';
+ static const _typeInferenceErrorKey = 'lazyAst_typeInferenceError';
+ static const _typeKey = 'lazyAst_type';
+
+ final LinkedNode data;
+
+ LazyAst(this.data);
+
+ static DartType getDefaultType(TypeParameter node) {
+ return node.getProperty(_defaultTypedKey);
+ }
+
+ static int getGenericFunctionTypeId(GenericFunctionType node) {
+ return node.getProperty(_genericFunctionTypeIdKey);
+ }
+
+ static bool getInheritsCovariant(AstNode node) {
+ return node.getProperty(_inheritsCovariantKey) ?? false;
+ }
+
+ static DartType getReturnType(AstNode node) {
+ return node.getProperty(_returnTypeKey);
+ }
+
+ static DartType getType(AstNode node) {
+ return node.getProperty(_typeKey);
+ }
+
+ static TopLevelInferenceError getTypeInferenceError(AstNode node) {
+ return node.getProperty(_typeInferenceErrorKey);
+ }
+
+ static bool hasOverrideInferenceDone(AstNode node) {
+ return node.getProperty(_hasOverrideInferenceKey) ?? false;
+ }
+
+ static bool isSimplyBounded(AstNode node) {
+ return node.getProperty(_isSimplyBoundedKey);
+ }
+
+ static void setDefaultType(TypeParameter node, DartType type) {
+ node.setProperty(_defaultTypedKey, type);
+ }
+
+ static void setGenericFunctionTypeId(GenericFunctionType node, int id) {
+ node.setProperty(_genericFunctionTypeIdKey, id);
+ }
+
+ static void setInheritsCovariant(AstNode node, bool value) {
+ node.setProperty(_inheritsCovariantKey, value);
+ }
+
+ static void setOverrideInferenceDone(AstNode node) {
+ node.setProperty(_hasOverrideInferenceKey, true);
+ }
+
+ static void setReturnType(AstNode node, DartType type) {
+ node.setProperty(_returnTypeKey, type);
+ }
+
+ static void setSimplyBounded(AstNode node, bool simplyBounded) {
+ node.setProperty(_isSimplyBoundedKey, simplyBounded);
+ }
+
+ static void setType(AstNode node, DartType type) {
+ node.setProperty(_typeKey, type);
+ }
+
+ static void setTypeInferenceError(
+ AstNode node, TopLevelInferenceError error) {
+ node.setProperty(_typeInferenceErrorKey, error);
+ }
+}
+
+class LazyClassDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasExtendsClause = false;
+ bool _hasImplementsClause = false;
+ bool _hasMembers = false;
+ bool _hasMetadata = false;
+ bool _hasWithClause = false;
+
+ LazyClassDeclaration(this.data);
+
+ static LazyClassDeclaration get(ClassDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = LazyClassDeclaration.get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readExtendsClause(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasExtendsClause) {
+ node.extendsClause = reader.readNode(
+ lazy.data.classDeclaration_extendsClause,
+ );
+ lazy._hasExtendsClause = true;
+ }
+ }
+
+ static void readImplementsClause(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = LazyClassDeclaration.get(node);
+ if (lazy != null && !lazy._hasImplementsClause) {
+ node.implementsClause = reader.readNode(
+ lazy.data.classOrMixinDeclaration_implementsClause,
+ );
+ lazy._hasImplementsClause = true;
+ }
+ }
+
+ static void readMembers(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = LazyClassDeclaration.get(node);
+ if (lazy != null && !lazy._hasMembers) {
+ var dataList = lazy.data.classOrMixinDeclaration_members;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.members[i] = reader.readNode(data);
+ }
+ lazy._hasMembers = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = LazyClassDeclaration.get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readWithClause(
+ AstBinaryReader reader,
+ ClassDeclaration node,
+ ) {
+ var lazy = LazyClassDeclaration.get(node);
+ if (lazy != null && !lazy._hasWithClause) {
+ node.withClause = reader.readNode(
+ lazy.data.classDeclaration_withClause,
+ );
+ lazy._hasWithClause = true;
+ }
+ }
+
+ static void setData(ClassDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyClassDeclaration(data));
+ LazyAst.setSimplyBounded(node, data.simplyBoundable_isSimplyBounded);
+ }
+}
+
+class LazyClassTypeAlias {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasImplementsClause = false;
+ bool _hasMetadata = false;
+ bool _hasSuperclass = false;
+ bool _hasWithClause = false;
+
+ LazyClassTypeAlias(this.data);
+
+ static LazyClassTypeAlias get(ClassTypeAlias node) {
+ return node.getProperty(_key);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ ClassTypeAlias node,
+ ) {
+ var lazy = LazyClassTypeAlias.get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readImplementsClause(
+ AstBinaryReader reader,
+ ClassTypeAlias node,
+ ) {
+ var lazy = LazyClassTypeAlias.get(node);
+ if (lazy != null && !lazy._hasImplementsClause) {
+ node.implementsClause = reader.readNode(
+ lazy.data.classTypeAlias_implementsClause,
+ );
+ lazy._hasImplementsClause = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ ClassTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readSuperclass(
+ AstBinaryReader reader,
+ ClassTypeAlias node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasSuperclass) {
+ node.superclass = reader.readNode(
+ lazy.data.classTypeAlias_superclass,
+ );
+ lazy._hasSuperclass = true;
+ }
+ }
+ }
+
+ static void readWithClause(
+ AstBinaryReader reader,
+ ClassTypeAlias node,
+ ) {
+ var lazy = LazyClassTypeAlias.get(node);
+ if (lazy != null && !lazy._hasWithClause) {
+ node.withClause = reader.readNode(
+ lazy.data.classTypeAlias_withClause,
+ );
+ lazy._hasWithClause = true;
+ }
+ }
+
+ static void setData(ClassTypeAlias node, LinkedNode data) {
+ node.setProperty(_key, LazyClassTypeAlias(data));
+ LazyAst.setSimplyBounded(node, data.simplyBoundable_isSimplyBounded);
+ }
+}
+
+class LazyConstructorDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasBody = false;
+ bool _hasDocumentationComment = false;
+ bool _hasFormalParameters = false;
+ bool _hasInitializers = false;
+ bool _hasMetadata = false;
+ bool _hasRedirectedConstructor = false;
+
+ LazyConstructorDeclaration(this.data);
+
+ static LazyConstructorDeclaration get(ConstructorDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readBody(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasBody) {
+ node.body = reader.readNode(
+ lazy.data.constructorDeclaration_body,
+ );
+ lazy._hasBody = true;
+ }
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = LazyConstructorDeclaration.get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = LazyConstructorDeclaration.get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ node.parameters = reader.readNode(
+ lazy.data.constructorDeclaration_parameters,
+ );
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void readInitializers(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasInitializers) {
+ var dataList = lazy.data.constructorDeclaration_initializers;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.initializers[i] = reader.readNode(data);
+ }
+ lazy._hasInitializers = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readRedirectedConstructor(
+ AstBinaryReader reader,
+ ConstructorDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasRedirectedConstructor) {
+ node.redirectedConstructor = reader.readNode(
+ lazy.data.constructorDeclaration_redirectedConstructor,
+ );
+ lazy._hasRedirectedConstructor = true;
+ }
+ }
+
+ static void setData(ConstructorDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyConstructorDeclaration(data));
+ }
+}
+
+class LazyDirective {
+ static const _key = 'lazyAst';
+ static const _uriKey = 'lazyAst_selectedUri';
+
+ final LinkedNode data;
+
+ bool _hasMetadata = false;
+
+ LazyDirective(this.data);
+
+ static LazyDirective get(Directive node) {
+ return node.getProperty(_key);
+ }
+
+ static String getSelectedUri(UriBasedDirective node) {
+ return node.getProperty(_uriKey);
+ }
+
+ static void readMetadata(AstBinaryReader reader, Directive node) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(Directive node, LinkedNode data) {
+ node.setProperty(_key, LazyDirective(data));
+ if (node is NamespaceDirective) {
+ node.setProperty(_uriKey, data.namespaceDirective_selectedUri);
+ }
+ }
+
+ static void setSelectedUri(UriBasedDirective node, String uriStr) {
+ node.setProperty(_uriKey, uriStr);
+ }
+}
+
+class LazyEnumConstantDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasMetadata = false;
+
+ LazyEnumConstantDeclaration(this.data);
+
+ static LazyEnumConstantDeclaration get(EnumConstantDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ EnumConstantDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ EnumConstantDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(EnumConstantDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyEnumConstantDeclaration(data));
+ }
+}
+
+class LazyEnumDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasConstants = false;
+ bool _hasDocumentationComment = false;
+ bool _hasMetadata = false;
+
+ LazyEnumDeclaration(this.data);
+
+ static LazyEnumDeclaration get(EnumDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readConstants(
+ AstBinaryReader reader,
+ EnumDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasConstants) {
+ var dataList = lazy.data.enumDeclaration_constants;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.constants[i] = reader.readNode(data);
+ }
+ lazy._hasConstants = true;
+ }
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ EnumDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ EnumDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(EnumDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyEnumDeclaration(data));
+ }
+}
+
+class LazyFieldDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasMetadata = false;
+
+ LazyFieldDeclaration(this.data);
+
+ static LazyFieldDeclaration get(FieldDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ FieldDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ FieldDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(FieldDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyFieldDeclaration(data));
+ }
+}
+
+class LazyFormalParameter {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDefaultValue = false;
+ bool _hasFormalParameters = false;
+ bool _hasMetadata = false;
+ bool _hasType = false;
+ bool _hasTypeInferenceError = false;
+ bool _hasTypeNode = false;
+
+ LazyFormalParameter(this.data);
+
+ static LazyFormalParameter get(FormalParameter node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getType(
+ AstBinaryReader reader,
+ FormalParameter node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasType) {
+ var type = reader.readType(lazy.data.actualType);
+ LazyAst.setType(node, type);
+ lazy._hasType = true;
+ }
+ }
+ return LazyAst.getType(node);
+ }
+
+ static TopLevelInferenceError getTypeInferenceError(FormalParameter node) {
+ var lazy = get(node);
+ if (!lazy._hasTypeInferenceError) {
+ var error = lazy.data.topLevelTypeInferenceError;
+ LazyAst.setTypeInferenceError(node, error);
+ lazy._hasTypeInferenceError = true;
+ }
+ return LazyAst.getTypeInferenceError(node);
+ }
+
+ static void readDefaultValue(
+ AstBinaryReader reader,
+ DefaultFormalParameter node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = LazyFormalParameter.get(node);
+ if (lazy != null && !lazy._hasDefaultValue) {
+ node.defaultValue = reader.readNode(
+ lazy.data.defaultFormalParameter_defaultValue,
+ );
+ lazy._hasDefaultValue = true;
+ }
+ }
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ FormalParameter node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ if (node is FunctionTypedFormalParameter) {
+ node.parameters = reader.readNode(
+ lazy.data.functionTypedFormalParameter_formalParameters,
+ );
+ } else if (node is FieldFormalParameter) {
+ node.parameters = reader.readNode(
+ lazy.data.fieldFormalParameter_formalParameters,
+ );
+ }
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ FormalParameter node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.normalFormalParameter_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readTypeNode(
+ AstBinaryReader reader,
+ FormalParameter node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasTypeNode) {
+ if (node is SimpleFormalParameter) {
+ node.type = reader.readNode(
+ lazy.data.simpleFormalParameter_type,
+ );
+ }
+ lazy._hasTypeNode = true;
+ }
+ }
+ }
+
+ static void setData(FormalParameter node, LinkedNode data) {
+ node.setProperty(_key, LazyFormalParameter(data));
+ }
+}
+
+class LazyFunctionDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasMetadata = false;
+ bool _hasReturnType = false;
+ bool _hasReturnTypeNode = false;
+
+ LazyFunctionDeclaration(this.data);
+
+ static LazyFunctionDeclaration get(FunctionDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getReturnType(
+ AstBinaryReader reader,
+ FunctionDeclaration node,
+ ) {
+ readFunctionExpression(reader, node);
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasReturnType) {
+ var type = reader.readType(lazy.data.actualReturnType);
+ LazyAst.setReturnType(node, type);
+ lazy._hasReturnType = true;
+ }
+ }
+ return LazyAst.getReturnType(node);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ FunctionDeclaration node,
+ ) {
+ var lazy = LazyFunctionDeclaration.get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readFunctionExpression(
+ AstBinaryReader reader,
+ FunctionDeclaration node,
+ ) {
+ if (node.functionExpression == null) {
+ var lazy = LazyFunctionDeclaration.get(node);
+ node.functionExpression = reader.readNode(
+ lazy.data.functionDeclaration_functionExpression,
+ );
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ FunctionDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readReturnTypeNode(
+ AstBinaryReader reader,
+ FunctionDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasReturnTypeNode) {
+ node.returnType = reader.readNode(
+ lazy.data.functionDeclaration_returnType,
+ );
+ lazy._hasReturnTypeNode = true;
+ }
+ }
+
+ static void setData(FunctionDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyFunctionDeclaration(data));
+ }
+}
+
+class LazyFunctionExpression {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasBody = false;
+ bool _hasFormalParameters = false;
+
+ LazyFunctionExpression(this.data);
+
+ static LazyFunctionExpression get(FunctionExpression node) {
+ return node.getProperty(_key);
+ }
+
+ static void readBody(
+ AstBinaryReader reader,
+ FunctionExpression node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasBody) {
+ node.body = reader.readNode(
+ lazy.data.functionExpression_body,
+ );
+ lazy._hasBody = true;
+ }
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ FunctionExpression node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ node.parameters = reader.readNode(
+ lazy.data.functionExpression_formalParameters,
+ );
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void setData(FunctionExpression node, LinkedNode data) {
+ node.setProperty(_key, LazyFunctionExpression(data));
+ }
+}
+
+class LazyFunctionTypeAlias {
+ static const _key = 'lazyAst';
+ static const _hasSelfReferenceKey = 'lazyAst_hasSelfReferenceKey';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasFormalParameters = false;
+ bool _hasMetadata = false;
+ bool _hasReturnType = false;
+ bool _hasReturnTypeNode = false;
+
+ LazyFunctionTypeAlias(this.data);
+
+ static LazyFunctionTypeAlias get(FunctionTypeAlias node) {
+ return node.getProperty(_key);
+ }
+
+ static bool getHasSelfReference(FunctionTypeAlias node) {
+ return node.getProperty(_hasSelfReferenceKey);
+ }
+
+ static DartType getReturnType(
+ AstBinaryReader reader,
+ FunctionTypeAlias node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasReturnType) {
+ var type = reader.readType(lazy.data.actualReturnType);
+ LazyAst.setReturnType(node, type);
+ lazy._hasReturnType = true;
+ }
+ }
+ return LazyAst.getReturnType(node);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ FunctionTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ FunctionTypeAlias node,
+ ) {
+ var lazy = LazyFunctionTypeAlias.get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ node.parameters = reader.readNode(
+ lazy.data.functionTypeAlias_formalParameters,
+ );
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ FunctionTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readReturnTypeNode(
+ AstBinaryReader reader,
+ FunctionTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasReturnTypeNode) {
+ node.returnType = reader.readNode(
+ lazy.data.functionTypeAlias_returnType,
+ );
+ lazy._hasReturnTypeNode = true;
+ }
+ }
+
+ static void setData(FunctionTypeAlias node, LinkedNode data) {
+ node.setProperty(_key, LazyFunctionTypeAlias(data));
+ LazyAst.setSimplyBounded(node, data.simplyBoundable_isSimplyBounded);
+ }
+
+ static void setHasSelfReference(FunctionTypeAlias node, bool value) {
+ node.setProperty(_hasSelfReferenceKey, value);
+ }
+}
+
+class LazyGenericFunctionType {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasFormalParameters = false;
+ bool _hasReturnType = false;
+ bool _hasReturnTypeNode = false;
+
+ LazyGenericFunctionType(this.data);
+
+ static LazyGenericFunctionType get(GenericFunctionType node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getReturnType(
+ AstBinaryReader reader,
+ GenericFunctionType node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasReturnType) {
+ var type = reader.readType(lazy.data.actualReturnType);
+ LazyAst.setReturnType(node, type);
+ lazy._hasReturnType = true;
+ }
+ }
+ return LazyAst.getReturnType(node);
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ GenericFunctionType node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ node.parameters = reader.readNode(
+ lazy.data.genericFunctionType_formalParameters,
+ );
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void readReturnTypeNode(
+ AstBinaryReader reader,
+ GenericFunctionType node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasReturnTypeNode) {
+ node.returnType = reader.readNode(
+ lazy.data.genericFunctionType_returnType,
+ );
+ lazy._hasReturnTypeNode = true;
+ }
+ }
+
+ static void setData(GenericFunctionType node, LinkedNode data) {
+ node.setProperty(_key, LazyGenericFunctionType(data));
+ }
+}
+
+class LazyGenericTypeAlias {
+ static const _key = 'lazyAst';
+ static const _hasSelfReferenceKey = 'lazyAst_hasSelfReferenceKey';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasFunction = false;
+ bool _hasMetadata = false;
+
+ LazyGenericTypeAlias(this.data);
+
+ static LazyGenericTypeAlias get(GenericTypeAlias node) {
+ return node.getProperty(_key);
+ }
+
+ static bool getHasSelfReference(GenericTypeAlias node) {
+ return node.getProperty(_hasSelfReferenceKey);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ GenericTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readFunctionType(
+ AstBinaryReader reader,
+ GenericTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasFunction) {
+ node.functionType = reader.readNode(
+ lazy.data.genericTypeAlias_functionType,
+ );
+ lazy._hasFunction = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ GenericTypeAlias node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(GenericTypeAlias node, LinkedNode data) {
+ node.setProperty(_key, LazyGenericTypeAlias(data));
+ LazyAst.setSimplyBounded(node, data.simplyBoundable_isSimplyBounded);
+ }
+
+ static void setHasSelfReference(GenericTypeAlias node, bool value) {
+ node.setProperty(_hasSelfReferenceKey, value);
+ }
+}
+
+class LazyMethodDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasBody = false;
+ bool _hasDocumentationComment = false;
+ bool _hasFormalParameters = false;
+ bool _hasMetadata = false;
+ bool _hasReturnType = false;
+ bool _hasReturnTypeNode = false;
+
+ LazyMethodDeclaration(this.data);
+
+ static LazyMethodDeclaration get(MethodDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getReturnType(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasReturnType) {
+ var type = reader.readType(lazy.data.actualReturnType);
+ LazyAst.setReturnType(node, type);
+ lazy._hasReturnType = true;
+ }
+ }
+ return LazyAst.getReturnType(node);
+ }
+
+ static bool isAbstract(MethodDeclaration node) {
+ var lazy = get(node);
+ if (lazy != null) {
+ return lazy.data.methodDeclaration_body.kind ==
+ LinkedNodeKind.emptyFunctionBody;
+ } else {
+ return node.isAbstract;
+ }
+ }
+
+ static void readBody(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasBody) {
+ node.body = reader.readNode(
+ lazy.data.methodDeclaration_body,
+ );
+ lazy._hasBody = true;
+ }
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ var lazy = LazyMethodDeclaration.get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readFormalParameters(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ var lazy = LazyMethodDeclaration.get(node);
+ if (lazy != null && !lazy._hasFormalParameters) {
+ node.parameters = reader.readNode(
+ lazy.data.methodDeclaration_formalParameters,
+ );
+ lazy._hasFormalParameters = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readReturnTypeNode(
+ AstBinaryReader reader,
+ MethodDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasReturnTypeNode) {
+ node.returnType = reader.readNode(
+ lazy.data.methodDeclaration_returnType,
+ );
+ lazy._hasReturnTypeNode = true;
+ }
+ }
+
+ static void setData(MethodDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyMethodDeclaration(data));
+ }
+}
+
+class LazyMixinDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasOnClause = false;
+ bool _hasImplementsClause = false;
+ bool _hasMembers = false;
+ bool _hasMetadata = false;
+
+ List<String> _superInvokedNames;
+
+ LazyMixinDeclaration(MixinDeclaration node, this.data) {
+ node.setProperty(_key, this);
+ if (data != null) {
+ LazyAst.setSimplyBounded(node, data.simplyBoundable_isSimplyBounded);
+ }
+ }
+
+ List<String> getSuperInvokedNames() {
+ return _superInvokedNames ??= data.mixinDeclaration_superInvokedNames;
+ }
+
+ void put(LinkedNodeBuilder builder) {
+ builder.mixinDeclaration_superInvokedNames = _superInvokedNames ?? [];
+ }
+
+ void setSuperInvokedNames(List<String> value) {
+ _superInvokedNames = value;
+ }
+
+ static LazyMixinDeclaration get(MixinDeclaration node) {
+ LazyMixinDeclaration lazy = node.getProperty(_key);
+ if (lazy == null) {
+ return LazyMixinDeclaration(node, null);
+ }
+ return lazy;
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ MixinDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy.data != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readImplementsClause(
+ AstBinaryReader reader,
+ MixinDeclarationImpl node,
+ ) {
+ var lazy = get(node);
+ if (lazy.data != null && !lazy._hasImplementsClause) {
+ node.implementsClause = reader.readNode(
+ lazy.data.classOrMixinDeclaration_implementsClause,
+ );
+ lazy._hasImplementsClause = true;
+ }
+ }
+
+ static void readMembers(
+ AstBinaryReader reader,
+ MixinDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy.data != null && !lazy._hasMembers) {
+ var dataList = lazy.data.classOrMixinDeclaration_members;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.members[i] = reader.readNode(data);
+ }
+ lazy._hasMembers = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ MixinDeclaration node,
+ ) {
+ var lazy = LazyMixinDeclaration.get(node);
+ if (lazy.data != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void readOnClause(
+ AstBinaryReader reader,
+ MixinDeclarationImpl node,
+ ) {
+ var lazy = get(node);
+ if (lazy.data != null && !lazy._hasOnClause) {
+ node.onClause = reader.readNode(
+ lazy.data.mixinDeclaration_onClause,
+ );
+ lazy._hasOnClause = true;
+ }
+ }
+}
+
+class LazyTopLevelVariableDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasDocumentationComment = false;
+ bool _hasMetadata = false;
+
+ LazyTopLevelVariableDeclaration(this.data);
+
+ static LazyTopLevelVariableDeclaration get(TopLevelVariableDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static void readDocumentationComment(
+ AstBinaryReader reader,
+ TopLevelVariableDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDocumentationComment) {
+ node.documentationComment = reader.readNode(
+ lazy.data.annotatedNode_comment,
+ );
+ lazy._hasDocumentationComment = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ TopLevelVariableDeclaration node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(TopLevelVariableDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyTopLevelVariableDeclaration(data));
+ }
+}
+
+class LazyTypeParameter {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasBound = false;
+ bool _hasDefaultType = false;
+ bool _hasMetadata = false;
+
+ LazyTypeParameter(this.data);
+
+ static LazyTypeParameter get(TypeParameter node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getDefaultType(AstBinaryReader reader, TypeParameter node) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasDefaultType) {
+ lazy._hasDefaultType = true;
+ var type = reader.readType(lazy.data.typeParameter_defaultType);
+ LazyAst.setDefaultType(node, type);
+ return type;
+ }
+ return LazyAst.getDefaultType(node);
+ }
+
+ static void readBound(AstBinaryReader reader, TypeParameter node) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasBound) {
+ node.bound = reader.readNode(lazy.data.typeParameter_bound);
+ lazy._hasBound = true;
+ }
+ }
+
+ static void readMetadata(
+ AstBinaryReader reader,
+ TypeParameter node,
+ ) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasMetadata) {
+ var dataList = lazy.data.annotatedNode_metadata;
+ for (var i = 0; i < dataList.length; ++i) {
+ var data = dataList[i];
+ node.metadata[i] = reader.readNode(data);
+ }
+ lazy._hasMetadata = true;
+ }
+ }
+
+ static void setData(TypeParameter node, LinkedNode data) {
+ node.setProperty(_key, LazyTypeParameter(data));
+ }
+}
+
+class LazyVariableDeclaration {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasInitializer = false;
+ bool _hasType = false;
+ bool _hasTypeInferenceError = false;
+
+ LazyVariableDeclaration(this.data);
+
+ static LazyVariableDeclaration get(VariableDeclaration node) {
+ return node.getProperty(_key);
+ }
+
+ static DartType getType(
+ AstBinaryReader reader,
+ VariableDeclaration node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasType) {
+ var type = reader.readType(lazy.data.actualType);
+ LazyAst.setType(node, type);
+ lazy._hasType = true;
+ }
+ }
+ return LazyAst.getType(node);
+ }
+
+ static TopLevelInferenceError getTypeInferenceError(
+ VariableDeclaration node) {
+ var lazy = get(node);
+ if (!lazy._hasTypeInferenceError) {
+ var error = lazy.data.topLevelTypeInferenceError;
+ LazyAst.setTypeInferenceError(node, error);
+ lazy._hasTypeInferenceError = true;
+ }
+ return LazyAst.getTypeInferenceError(node);
+ }
+
+ static void readInitializer(
+ AstBinaryReader reader,
+ VariableDeclaration node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (lazy != null && !lazy._hasInitializer) {
+ node.initializer = reader.readNode(
+ lazy.data.variableDeclaration_initializer,
+ );
+ lazy._hasInitializer = true;
+ }
+ }
+ }
+
+ static void setData(VariableDeclaration node, LinkedNode data) {
+ node.setProperty(_key, LazyVariableDeclaration(data));
+ }
+}
+
+class LazyVariableDeclarationList {
+ static const _key = 'lazyAst';
+
+ final LinkedNode data;
+
+ bool _hasTypeNode = false;
+
+ LazyVariableDeclarationList(this.data);
+
+ static LazyVariableDeclarationList get(VariableDeclarationList node) {
+ return node.getProperty(_key);
+ }
+
+ static void readTypeNode(
+ AstBinaryReader reader,
+ VariableDeclarationList node,
+ ) {
+ if (reader.isLazy) {
+ var lazy = get(node);
+ if (!lazy._hasTypeNode) {
+ node.type = reader.readNode(
+ lazy.data.variableDeclarationList_type,
+ );
+ lazy._hasTypeNode = true;
+ }
+ }
+ }
+
+ static void setData(VariableDeclarationList node, LinkedNode data) {
+ node.setProperty(_key, LazyVariableDeclarationList(data));
+ }
+}
diff --git a/analyzer/lib/src/summary2/link.dart b/analyzer/lib/src/summary2/link.dart
index aec825a..b3cd018 100644
--- a/analyzer/lib/src/summary2/link.dart
+++ b/analyzer/lib/src/summary2/link.dart
@@ -1,12 +1,14 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/inheritance_manager2.dart';
+import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -14,31 +16,38 @@
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:analyzer/src/summary2/ast_binary_writer.dart';
import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
import 'package:analyzer/src/summary2/linked_bundle_context.dart';
import 'package:analyzer/src/summary2/linked_element_factory.dart';
import 'package:analyzer/src/summary2/linking_bundle_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
+import 'package:analyzer/src/summary2/simply_bounded.dart';
+import 'package:analyzer/src/summary2/top_level_inference.dart';
+import 'package:analyzer/src/summary2/type_alias.dart';
+import 'package:analyzer/src/summary2/types_builder.dart';
LinkResult link(
AnalysisOptions analysisOptions,
SourceFactory sourceFactory,
- List<LinkedNodeBundle> inputs,
- Map<Source, Map<Source, CompilationUnit>> unitMap,
+ DeclaredVariables declaredVariables,
+ List<LinkedNodeBundle> inputBundles,
+ List<LinkInputLibrary> inputLibraries,
) {
- var linker = Linker(analysisOptions, sourceFactory);
- linker.link(inputs, unitMap);
+ var linker = Linker(analysisOptions, sourceFactory, declaredVariables);
+ linker.link(inputBundles, inputLibraries);
return LinkResult(linker.linkingBundle);
}
class Linker {
+ final DeclaredVariables declaredVariables;
+
final Reference rootReference = Reference.root();
LinkedElementFactory elementFactory;
- LinkingBundleContext linkingBundleContext;
- List<LinkedNodeLibraryBuilder> linkingLibraries = [];
LinkedNodeBundleBuilder linkingBundle;
LinkedBundleContext bundleContext;
+ LinkingBundleContext linkingBundleContext;
/// Libraries that are being linked.
final Map<Uri, SourceLibraryBuilder> builders = {};
@@ -48,9 +57,15 @@
Dart2TypeSystem typeSystem;
InheritanceManager2 inheritance;
- Linker(AnalysisOptions analysisOptions, SourceFactory sourceFactory) {
+ Linker(
+ AnalysisOptions analysisOptions,
+ SourceFactory sourceFactory,
+ this.declaredVariables,
+ ) {
var dynamicRef = rootReference.getChild('dart:core').getChild('dynamic');
dynamicRef.element = DynamicElementImpl.instance;
+ var neverRef = rootReference.getChild('dart:core').getChild('Never');
+ neverRef.element = NeverElementImpl.instance;
linkingBundleContext = LinkingBundleContext(dynamicRef);
@@ -65,31 +80,32 @@
rootReference,
);
- linkingBundle = LinkedNodeBundleBuilder(
- references: linkingBundleContext.referencesBuilder,
- libraries: linkingLibraries,
- );
-
- bundleContext = LinkedBundleContext(
+ bundleContext = LinkedBundleContext.forAst(
elementFactory,
- linkingBundle.references,
+ linkingBundleContext.references,
);
}
- void link(List<LinkedNodeBundle> inputs,
- Map<Source, Map<Source, CompilationUnit>> unitMap) {
- for (var input in inputs) {
- elementFactory.addBundle(input);
+ FeatureSet get contextFeatures {
+ return analysisContext.analysisOptions.contextFeatures;
+ }
+
+ void link(List<LinkedNodeBundle> inputBundles,
+ List<LinkInputLibrary> inputLibraries) {
+ for (var input in inputBundles) {
+ var inputBundleContext = LinkedBundleContext(elementFactory, input);
+ elementFactory.addBundle(inputBundleContext);
}
- for (var librarySource in unitMap.keys) {
- SourceLibraryBuilder.build(this, librarySource, unitMap[librarySource]);
+ for (var inputLibrary in inputLibraries) {
+ SourceLibraryBuilder.build(this, inputLibrary);
}
-
- // Add libraries being linked, so we can ask for their elements as well.
- elementFactory.addBundle(linkingBundle, context: bundleContext);
+ // TODO(scheglov) do in build() ?
+ elementFactory.addBundle(bundleContext);
_buildOutlines();
+
+ _createLinkingBundle();
}
void _addSyntheticConstructors() {
@@ -99,12 +115,25 @@
}
void _buildOutlines() {
+ _resolveUriDirectives();
_computeLibraryScopes();
_addSyntheticConstructors();
_createTypeSystem();
_resolveTypes();
+ TypeAliasSelfReferenceFinder().perform(this);
+ _createLoadLibraryFunctions();
_performTopLevelInference();
+ _resolveConstructors();
+ _resolveConstantInitializers();
+ _resolveDefaultValues();
_resolveMetadata();
+ _collectMixinSuperInvokedNames();
+ }
+
+ void _collectMixinSuperInvokedNames() {
+ for (var library in builders.values) {
+ library.collectMixinSuperInvokedNames();
+ }
}
void _computeLibraryScopes() {
@@ -116,21 +145,98 @@
library.buildInitialExportScope();
}
+ var exporters = new Set<SourceLibraryBuilder>();
+ var exportees = new Set<SourceLibraryBuilder>();
+
for (var library in builders.values) {
- library.addImportsToScope();
+ library.addExporters();
+ }
+
+ for (var library in builders.values) {
+ if (library.exporters.isNotEmpty) {
+ exportees.add(library);
+ for (var exporter in library.exporters) {
+ exporters.add(exporter.exporter);
+ }
+ }
+ }
+
+ var both = new Set<SourceLibraryBuilder>();
+ for (var exported in exportees) {
+ if (exporters.contains(exported)) {
+ both.add(exported);
+ }
+ for (var export in exported.exporters) {
+ exported.exportScope.forEach(export.addToExportScope);
+ }
+ }
+
+ while (true) {
+ var hasChanges = false;
+ for (var exported in both) {
+ for (var export in exported.exporters) {
+ exported.exportScope.forEach((name, member) {
+ if (export.addToExportScope(name, member)) {
+ hasChanges = true;
+ }
+ });
+ }
+ }
+ if (!hasChanges) break;
}
for (var library in builders.values) {
library.storeExportScope();
}
- // TODO(scheglov) process imports and exports
+ for (var library in builders.values) {
+ library.buildElement();
+ }
+ }
+
+ void _createLinkingBundle() {
+ var linkingLibraries = <LinkedNodeLibraryBuilder>[];
+ for (var builder in builders.values) {
+ linkingLibraries.add(builder.node);
+
+ for (var unitContext in builder.context.units) {
+ var unit = unitContext.unit;
+
+ var writer = AstBinaryWriter(linkingBundleContext);
+ var unitLinkedNode = writer.writeNode(unit);
+ builder.node.units.add(
+ LinkedNodeUnitBuilder(
+ isSynthetic: unitContext.isSynthetic,
+ uriStr: unitContext.uriStr,
+ lineStarts: unit.lineInfo.lineStarts,
+ tokens: writer.tokensBuilder,
+ node: unitLinkedNode,
+ ),
+ );
+ }
+ }
+ linkingBundle = LinkedNodeBundleBuilder(
+ references: linkingBundleContext.referencesBuilder,
+ libraries: linkingLibraries,
+ );
+ }
+
+ void _createLoadLibraryFunctions() {
+ for (var library in builders.values) {
+ library.element.createLoadLibraryFunction(typeProvider);
+ }
}
void _createTypeSystem() {
var coreRef = rootReference.getChild('dart:core');
var coreLib = elementFactory.elementOfReference(coreRef);
- typeProvider = SummaryTypeProvider()..initializeCore(coreLib);
+
+ var asyncRef = rootReference.getChild('dart:async');
+ var asyncLib = elementFactory.elementOfReference(asyncRef);
+
+ typeProvider = SummaryTypeProvider()
+ ..initializeCore(coreLib)
+ ..initializeAsync(asyncLib);
analysisContext.typeProvider = typeProvider;
typeSystem = Dart2TypeSystem(typeProvider);
@@ -140,8 +246,22 @@
}
void _performTopLevelInference() {
+ TopLevelInference(this).infer();
+ }
+
+ void _resolveConstantInitializers() {
+ ConstantInitializersResolver(this).perform();
+ }
+
+ void _resolveConstructors() {
for (var library in builders.values) {
- library.performTopLevelInference();
+ library.resolveConstructors();
+ }
+ }
+
+ void _resolveDefaultValues() {
+ for (var library in builders.values) {
+ library.resolveDefaultValues();
}
}
@@ -152,12 +272,36 @@
}
void _resolveTypes() {
+ var nodesToBuildType = NodesToBuildType();
for (var library in builders.values) {
- library.resolveTypes();
+ library.resolveTypes(nodesToBuildType);
+ }
+ computeSimplyBounded(bundleContext, builders.values);
+ TypesBuilder(typeSystem).build(nodesToBuildType);
+ }
+
+ void _resolveUriDirectives() {
+ for (var library in builders.values) {
+ library.resolveUriDirectives();
}
}
}
+class LinkInputLibrary {
+ final Source source;
+ final List<LinkInputUnit> units;
+
+ LinkInputLibrary(this.source, this.units);
+}
+
+class LinkInputUnit {
+ final Source source;
+ final bool isSynthetic;
+ final CompilationUnit unit;
+
+ LinkInputUnit(this.source, this.isSynthetic, this.unit);
+}
+
class LinkResult {
final LinkedNodeBundleBuilder bundle;
diff --git a/analyzer/lib/src/summary2/linked_bundle_context.dart b/analyzer/lib/src/summary2/linked_bundle_context.dart
index fbaf454..7688746 100644
--- a/analyzer/lib/src/summary2/linked_bundle_context.dart
+++ b/analyzer/lib/src/summary2/linked_bundle_context.dart
@@ -1,24 +1,92 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/link.dart';
import 'package:analyzer/src/summary2/linked_element_factory.dart';
+import 'package:analyzer/src/summary2/linked_unit_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
/// The context of a linked bundle, with shared references.
class LinkedBundleContext {
final LinkedElementFactory elementFactory;
- final LinkedNodeReferences referencesData;
+ final LinkedNodeBundle _bundle;
final List<Reference> _references;
+ final Map<String, LinkedLibraryContext> libraryMap = {};
- LinkedBundleContext(this.elementFactory, this.referencesData)
- : _references = List<Reference>.filled(referencesData.name.length, null,
- growable: true);
+ LinkedBundleContext(this.elementFactory, this._bundle)
+ : _references = List<Reference>(_bundle.references.name.length) {
+ for (var library in _bundle.libraries) {
+ var uriStr = library.uriStr;
+ var reference = elementFactory.rootReference.getChild(uriStr);
+ var libraryContext = LinkedLibraryContext(
+ this,
+ uriStr,
+ reference,
+ library,
+ );
+ libraryMap[uriStr] = libraryContext;
+
+ var unitRef = reference.getChild('@unit');
+ var units = library.units;
+ for (var unitIndex = 0; unitIndex < units.length; ++unitIndex) {
+ var unit = units[unitIndex];
+ var uriStr = unit.uriStr;
+ var reference = unitRef.getChild(uriStr);
+ var unitContext = LinkedUnitContext(
+ this,
+ libraryContext,
+ unitIndex,
+ uriStr,
+ reference,
+ unit.isSynthetic,
+ unit,
+ );
+ libraryContext.units.add(unitContext);
+ }
+ }
+ }
+
+ LinkedBundleContext.forAst(this.elementFactory, this._references)
+ : _bundle = null;
+
+ /// Return `true` if this bundle is being linked.
+ bool get isLinking => _bundle == null;
+
+ LinkedLibraryContext addLinkingLibrary(
+ String uriStr,
+ LinkedNodeLibraryBuilder data,
+ LinkInputLibrary inputLibrary,
+ ) {
+ var uriStr = data.uriStr;
+ var reference = elementFactory.rootReference.getChild(uriStr);
+ var libraryContext = LinkedLibraryContext(this, uriStr, reference, data);
+ libraryMap[uriStr] = libraryContext;
+
+ var unitRef = reference.getChild('@unit');
+ var unitIndex = 0;
+ for (var inputUnit in inputLibrary.units) {
+ var source = inputUnit.source;
+ var uriStr = source != null ? '${source.uri}' : '';
+ var reference = unitRef.getChild(uriStr);
+ libraryContext.units.add(
+ LinkedUnitContext(
+ this,
+ libraryContext,
+ unitIndex++,
+ uriStr,
+ reference,
+ inputUnit.isSynthetic,
+ null,
+ unit: inputUnit.unit,
+ ),
+ );
+ }
+ return libraryContext;
+ }
T elementOfIndex<T extends Element>(int index) {
var reference = referenceOfIndex(index);
@@ -34,59 +102,7 @@
return result;
}
- InterfaceType getInterfaceType(LinkedNodeType linkedType) {
- var type = getType(linkedType);
- if (type is InterfaceType && !type.element.isEnum) {
- return type;
- }
- return null;
- }
-
- DartType getType(LinkedNodeType linkedType) {
- var kind = linkedType.kind;
- if (kind == LinkedNodeTypeKind.dynamic_) {
- return DynamicTypeImpl.instance;
- } else if (kind == LinkedNodeTypeKind.function) {
- var returnType = getType(linkedType.functionReturnType);
- var typeParameters = linkedType.functionTypeParameters
- .map(referenceOfIndex)
- .map(elementFactory.elementOfReference)
- .cast<TypeParameterElement>()
- .toList();
- var formalParameters = linkedType.functionFormalParameters
- .map(referenceOfIndex)
- .map(elementFactory.elementOfReference)
- .cast<ParameterElement>()
- .toList();
- // TODO(scheglov) Rework this to purely synthetic types.
- return FunctionElementImpl.synthetic(formalParameters, returnType).type;
- } else if (kind == LinkedNodeTypeKind.interface) {
- var reference = referenceOfIndex(linkedType.interfaceClass);
- Element element = elementFactory.elementOfReference(reference);
- return InterfaceTypeImpl.explicit(
- element,
- linkedType.interfaceTypeArguments.map(getType).toList(),
- );
- } else if (kind == LinkedNodeTypeKind.typeParameter) {
- var reference = referenceOfIndex(linkedType.typeParameterParameter);
- Element element = elementFactory.elementOfReference(reference);
- return TypeParameterTypeImpl(element);
- } else if (kind == LinkedNodeTypeKind.void_) {
- return VoidTypeImpl.instance;
- } else {
- throw UnimplementedError('$kind');
- }
- }
-
Reference referenceOfIndex(int index) {
- // When we are linking a bundle, we add new references.
- // So, grow the list of references when we have data for them.
- if (index >= _references.length) {
- if (referencesData.name.length > _references.length) {
- _references.length = referencesData.name.length;
- }
- }
-
var reference = _references[index];
if (reference != null) return reference;
@@ -96,13 +112,25 @@
return reference;
}
- var parentIndex = referencesData.parent[index];
+ var parentIndex = _bundle.references.parent[index];
var parent = referenceOfIndex(parentIndex);
- var name = referencesData.name[index];
+ var name = _bundle.references.name[index];
reference = parent.getChild(name);
_references[index] = reference;
return reference;
}
}
+
+class LinkedLibraryContext {
+ final LinkedBundleContext context;
+ final String uriStr;
+ final Reference reference;
+ final LinkedNodeLibrary node;
+ final List<LinkedUnitContext> units = [];
+
+ LinkedLibraryContext(this.context, this.uriStr, this.reference, this.node);
+
+ LinkedUnitContext get definingUnit => units.first;
+}
diff --git a/analyzer/lib/src/summary2/linked_element_factory.dart b/analyzer/lib/src/summary2/linked_element_factory.dart
index 7653ed6..f02b5e7 100644
--- a/analyzer/lib/src/summary2/linked_element_factory.dart
+++ b/analyzer/lib/src/summary2/linked_element_factory.dart
@@ -3,29 +3,46 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/core_types.dart';
import 'package:analyzer/src/summary2/linked_bundle_context.dart';
import 'package:analyzer/src/summary2/linked_unit_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
-import 'package:analyzer/src/summary2/tokens_context.dart';
class LinkedElementFactory {
final AnalysisContext analysisContext;
final AnalysisSession analysisSession;
final Reference rootReference;
- final Map<String, _Library> libraryMap = {};
+ final Map<String, LinkedLibraryContext> libraryMap = {};
+
+ CoreTypes _coreTypes;
LinkedElementFactory(
this.analysisContext, this.analysisSession, this.rootReference);
- void addBundle(LinkedNodeBundle bundle, {LinkedBundleContext context}) {
- context ??= LinkedBundleContext(this, bundle.references);
- for (var library in bundle.libraries) {
- libraryMap[library.uriStr] = _Library(context, library);
+ CoreTypes get coreTypes {
+ return _coreTypes ??= CoreTypes(this);
+ }
+
+ void addBundle(LinkedBundleContext context) {
+ libraryMap.addAll(context.libraryMap);
+ }
+
+ Namespace buildExportNamespace(Uri uri) {
+ var exportedNames = <String, Element>{};
+
+ var exportedReferences = exportsOfLibrary('$uri');
+ for (var exportedReference in exportedReferences) {
+ var element = elementOfReference(exportedReference);
+ exportedNames[element.name] = element;
}
+
+ return Namespace(exportedNames);
}
Element elementOfReference(Reference reference) {
@@ -41,6 +58,8 @@
List<Reference> exportsOfLibrary(String uriStr) {
var library = libraryMap[uriStr];
+ if (library == null) return const [];
+
var exportIndexList = library.node.exports;
var exportReferences = List<Reference>(exportIndexList.length);
for (var i = 0; i < exportIndexList.length; ++i) {
@@ -51,10 +70,42 @@
return exportReferences;
}
+ bool isLibraryUri(String uriStr) {
+ var libraryContext = libraryMap[uriStr];
+ return !libraryContext.definingUnit.hasPartOfDirective;
+ }
+
LibraryElementImpl libraryOfUri(String uriStr) {
var reference = rootReference.getChild(uriStr);
return elementOfReference(reference);
}
+
+ LinkedNode nodeOfReference(Reference reference) {
+// if (reference.node != null) {
+// return reference.node;
+// }
+//
+// var unitRef = reference.parent?.parent;
+// var unitContainer = unitRef?.parent;
+// if (unitContainer?.name == '@unit') {
+// var libraryUriStr = unitContainer.parent.name;
+// var libraryData = libraryMap[libraryUriStr];
+// for (var unitData in libraryData.node.units) {
+// var definingUnitContext = LinkedUnitContext(
+// libraryData.context,
+// TokensContext(unitData.tokens),
+// );
+// _ElementRequest._indexUnitDeclarations(
+// definingUnitContext,
+// unitRef,
+// unitData.node,
+// );
+// return reference.node;
+// }
+// }
+
+ throw UnimplementedError('$reference');
+ }
}
class _ElementRequest {
@@ -85,14 +136,24 @@
return _constructor(class_, reference);
}
+ if (parentName == '@enum') {
+ var unit = elementOfReference(parent2);
+ return _enum(unit, reference);
+ }
+
+ if (parentName == '@field') {
+ var enclosing = elementOfReference(parent2);
+ return _field(enclosing, reference);
+ }
+
if (parentName == '@function') {
CompilationUnitElementImpl enclosing = elementOfReference(parent2);
return _function(enclosing, reference);
}
- if (parentName == '@getter') {
+ if (parentName == '@getter' || parentName == '@setter') {
var enclosing = elementOfReference(parent2);
- return _getter(enclosing, reference);
+ return _accessor(enclosing, reference);
}
if (parentName == '@method') {
@@ -100,19 +161,35 @@
return _method(enclosing, reference);
}
+ if (parentName == '@mixin') {
+ var unit = elementOfReference(parent2);
+ return _mixin(unit, reference);
+ }
+
if (parentName == '@parameter') {
ExecutableElementImpl enclosing = elementOfReference(parent2);
return _parameter(enclosing, reference);
}
+ if (parentName == '@prefix') {
+ LibraryElementImpl enclosing = elementOfReference(parent2);
+ return _prefix(enclosing, reference);
+ }
+
if (parentName == '@typeAlias') {
var unit = elementOfReference(parent2);
return _typeAlias(unit, reference);
}
if (parentName == '@typeParameter') {
- var enclosing = elementOfReference(parent2) as TypeParameterizedElement;
- return _typeParameter(enclosing, reference);
+ var enclosing = elementOfReference(parent2);
+ if (enclosing is ParameterElement) {
+ (enclosing as ParameterElement).typeParameters;
+ } else {
+ (enclosing as TypeParameterizedElement).typeParameters;
+ }
+ assert(reference.element != null);
+ return reference.element;
}
if (parentName == '@unit') {
@@ -126,84 +203,7 @@
throw StateError('Not found: $input');
}
- ClassElementImpl _class(
- CompilationUnitElementImpl unit, Reference reference) {
- if (reference.node == null) {
- _indexUnitDeclarations(unit);
- assert(reference.node != 0, '$reference');
- }
- return reference.element = ClassElementImpl.forLinkedNode(
- unit,
- reference,
- reference.node,
- );
- }
-
- ConstructorElementImpl _constructor(
- ClassElementImpl class_, Reference reference) {
- return reference.element = ConstructorElementImpl.forLinkedNode(
- reference,
- reference.node,
- class_,
- );
- }
-
- LibraryElementImpl _createLibraryElement(Reference reference) {
- var uriStr = reference.name;
-
- var sourceFactory = elementFactory.analysisContext.sourceFactory;
- var librarySource = sourceFactory.forUri(uriStr);
-
- var libraryData = elementFactory.libraryMap[uriStr];
- var node = libraryData.node;
- var hasName = node.name.isNotEmpty;
-
- var definingUnitData = node.units[0];
- var definingUnitContext = LinkedUnitContext(
- libraryData.context,
- TokensContext(definingUnitData.tokens),
- );
-
- var libraryElement = LibraryElementImpl.forLinkedNode(
- elementFactory.analysisContext,
- elementFactory.analysisSession,
- node.name,
- hasName ? node.nameOffset : -1,
- node.name.length,
- definingUnitContext,
- reference,
- definingUnitData.node,
- );
-
- var units = <CompilationUnitElementImpl>[];
- var unitContainerRef = reference.getChild('@unit');
- for (var unitData in node.units) {
- var unitSource = sourceFactory.forUri(unitData.uriStr);
- var tokensContext = TokensContext(unitData.tokens);
- var unitElement = CompilationUnitElementImpl.forLinkedNode(
- libraryElement,
- LinkedUnitContext(libraryData.context, tokensContext),
- unitContainerRef.getChild(unitData.uriStr),
- unitData.node,
- );
- unitElement.source = unitSource;
- unitElement.librarySource = librarySource;
- units.add(unitElement);
- unitContainerRef.getChild(unitData.uriStr).element = unitElement;
- }
-
- libraryElement.definingCompilationUnit = units[0];
- libraryElement.parts = units.skip(1).toList();
- return reference.element = libraryElement;
- }
-
- Element _function(CompilationUnitElementImpl enclosing, Reference reference) {
- enclosing.functions;
- assert(reference.element != null);
- return reference.element;
- }
-
- PropertyAccessorElementImpl _getter(
+ PropertyAccessorElementImpl _accessor(
ElementImpl enclosing, Reference reference) {
if (enclosing is ClassElementImpl) {
enclosing.accessors;
@@ -217,43 +217,118 @@
assert(reference.element != null);
return reference.element;
}
+ if (enclosing is EnumElementImpl) {
+ enclosing.accessors;
+ // Requesting accessors sets elements for accessors and variables.
+ assert(reference.element != null);
+ return reference.element;
+ }
// Only classes and units have accessors.
throw StateError('${enclosing.runtimeType}');
}
- void _indexUnitDeclarations(CompilationUnitElementImpl unit) {
- var context = unit.linkedContext;
- var unitRef = unit.reference;
- var classRef = unitRef.getChild('@class');
- var enumRef = unitRef.getChild('@class');
- var functionRef = unitRef.getChild('@function');
- var typeAliasRef = unitRef.getChild('@typeAlias');
- var variableRef = unitRef.getChild('@variable');
- for (var declaration in unit.linkedNode.compilationUnit_declarations) {
- var kind = declaration.kind;
- if (kind == LinkedNodeKind.classDeclaration ||
- kind == LinkedNodeKind.classTypeAlias) {
- var name = context.getUnitMemberName(declaration);
- classRef.getChild(name).node = declaration;
- } else if (kind == LinkedNodeKind.enumDeclaration) {
- var name = context.getUnitMemberName(declaration);
- enumRef.getChild(name).node = declaration;
- } else if (kind == LinkedNodeKind.functionDeclaration) {
- var name = context.getUnitMemberName(declaration);
- functionRef.getChild(name).node = declaration;
- } else if (kind == LinkedNodeKind.functionTypeAlias) {
- var name = context.getUnitMemberName(declaration);
- typeAliasRef.getChild(name).node = declaration;
- } else if (kind == LinkedNodeKind.topLevelVariableDeclaration) {
- var variables = declaration.topLevelVariableDeclaration_variableList;
- for (var variable in variables.variableDeclarationList_variables) {
- var name = context.getSimpleName(variable.variableDeclaration_name);
- variableRef.getChild(name).node = variable;
- }
- } else {
- throw UnimplementedError('$kind');
- }
+ ClassElementImpl _class(
+ CompilationUnitElementImpl unit, Reference reference) {
+ if (reference.node2 == null) {
+ _indexUnitElementDeclarations(unit);
+ assert(reference.node2 != null, '$reference');
}
+ ClassElementImpl.forLinkedNode(unit, reference, reference.node2);
+ return reference.element;
+ }
+
+ ConstructorElementImpl _constructor(
+ ClassElementImpl enclosing, Reference reference) {
+ enclosing.constructors;
+ // Requesting constructors sets elements for all of them.
+ assert(reference.element != null);
+ return reference.element;
+ }
+
+ LibraryElementImpl _createLibraryElement(Reference reference) {
+ var uriStr = reference.name;
+
+ var sourceFactory = elementFactory.analysisContext.sourceFactory;
+ var librarySource = sourceFactory.forUri(uriStr);
+
+ // The URI cannot be resolved, we don't know the library.
+ if (librarySource == null) return null;
+
+ var libraryContext = elementFactory.libraryMap[uriStr];
+ var libraryNode = libraryContext.node;
+ var hasName = libraryNode.name.isNotEmpty;
+
+ var definingUnitContext = libraryContext.definingUnit;
+
+ var libraryElement = LibraryElementImpl.forLinkedNode(
+ elementFactory.analysisContext,
+ elementFactory.analysisSession,
+ libraryNode.name,
+ hasName ? libraryNode.nameOffset : -1,
+ libraryNode.name.length,
+ definingUnitContext,
+ reference,
+ definingUnitContext.unit_withDeclarations,
+ );
+
+ var units = <CompilationUnitElementImpl>[];
+ var unitContainerRef = reference.getChild('@unit');
+ for (var unitContext in libraryContext.units) {
+ var unitNode = unitContext.unit_withDeclarations;
+
+ var unitSource = sourceFactory.forUri(unitContext.uriStr);
+ var unitElement = CompilationUnitElementImpl.forLinkedNode(
+ libraryElement,
+ unitContext,
+ unitContext.reference,
+ unitNode,
+ );
+ unitElement.lineInfo = unitNode.lineInfo;
+ unitElement.source = unitSource;
+ unitElement.librarySource = librarySource;
+ units.add(unitElement);
+ unitContainerRef.getChild(unitContext.uriStr).element = unitElement;
+ }
+
+ libraryElement.definingCompilationUnit = units[0];
+ libraryElement.parts = units.skip(1).toList();
+ reference.element = libraryElement;
+
+ var typeProvider = elementFactory.analysisContext.typeProvider;
+ if (typeProvider != null) {
+ libraryElement.createLoadLibraryFunction(typeProvider);
+ }
+
+ return libraryElement;
+ }
+
+ EnumElementImpl _enum(CompilationUnitElementImpl unit, Reference reference) {
+ if (reference.node2 == null) {
+ _indexUnitElementDeclarations(unit);
+ assert(reference.node2 != null, '$reference');
+ }
+ EnumElementImpl.forLinkedNode(unit, reference, reference.node2);
+ return reference.element;
+ }
+
+ FieldElementImpl _field(ClassElementImpl enclosing, Reference reference) {
+ enclosing.fields;
+ // Requesting fields sets elements for all fields.
+ assert(reference.element != null);
+ return reference.element;
+ }
+
+ Element _function(CompilationUnitElementImpl enclosing, Reference reference) {
+ enclosing.functions;
+ assert(reference.element != null);
+ return reference.element;
+ }
+
+ void _indexUnitElementDeclarations(CompilationUnitElementImpl unit) {
+ var unitContext = unit.linkedContext;
+ var unitRef = unit.reference;
+ var unitNode = unit.linkedNode;
+ _indexUnitDeclarations(unitContext, unitRef, unitNode);
}
MethodElementImpl _method(ClassElementImpl enclosing, Reference reference) {
@@ -263,37 +338,82 @@
return reference.element;
}
+ MixinElementImpl _mixin(
+ CompilationUnitElementImpl unit, Reference reference) {
+ if (reference.node2 == null) {
+ _indexUnitElementDeclarations(unit);
+ assert(reference.node2 != null, '$reference');
+ }
+ MixinElementImpl.forLinkedNode(unit, reference, reference.node2);
+ return reference.element;
+ }
+
Element _parameter(ExecutableElementImpl enclosing, Reference reference) {
enclosing.parameters;
assert(reference.element != null);
return reference.element;
}
- GenericTypeAliasElementImpl _typeAlias(
- CompilationUnitElementImpl unit, Reference reference) {
- if (reference.node == null) {
- _indexUnitDeclarations(unit);
- assert(reference.node != 0, '$reference');
+ PrefixElementImpl _prefix(LibraryElementImpl library, Reference reference) {
+ for (var import in library.imports) {
+ import.prefix;
}
- return reference.element = GenericTypeAliasElementImpl.forLinkedNode(
- unit,
- reference,
- reference.node,
- );
- }
-
- Element _typeParameter(
- TypeParameterizedElement enclosing, Reference reference) {
- enclosing.typeParameters;
- // Requesting type parameters sets elements for all their references.
assert(reference.element != null);
return reference.element;
}
-}
-class _Library {
- final LinkedBundleContext context;
- final LinkedNodeLibrary node;
+ GenericTypeAliasElementImpl _typeAlias(
+ CompilationUnitElementImpl unit, Reference reference) {
+ if (reference.node2 == null) {
+ _indexUnitElementDeclarations(unit);
+ assert(reference.node2 != null, '$reference');
+ }
+ GenericTypeAliasElementImpl.forLinkedNode(unit, reference, reference.node2);
+ return reference.element;
+ }
- _Library(this.context, this.node);
+ /// Index nodes for which we choose to create elements individually,
+ /// for example [ClassDeclaration], so that its [Reference] has the node,
+ /// and we can call the [ClassElementImpl] constructor.
+ static void _indexUnitDeclarations(
+ LinkedUnitContext unitContext,
+ Reference unitRef,
+ CompilationUnit unitNode,
+ ) {
+ var classRef = unitRef.getChild('@class');
+ var enumRef = unitRef.getChild('@enum');
+ var functionRef = unitRef.getChild('@function');
+ var mixinRef = unitRef.getChild('@mixin');
+ var typeAliasRef = unitRef.getChild('@typeAlias');
+ var variableRef = unitRef.getChild('@variable');
+ for (var declaration in unitNode.declarations) {
+ if (declaration is ClassDeclaration) {
+ var name = declaration.name.name;
+ classRef.getChild(name).node2 = declaration;
+ } else if (declaration is ClassTypeAlias) {
+ var name = declaration.name.name;
+ classRef.getChild(name).node2 = declaration;
+ } else if (declaration is EnumDeclaration) {
+ var name = declaration.name.name;
+ enumRef.getChild(name).node2 = declaration;
+ } else if (declaration is FunctionDeclaration) {
+ var name = declaration.name.name;
+ functionRef.getChild(name).node2 = declaration;
+ } else if (declaration is FunctionTypeAlias) {
+ var name = declaration.name.name;
+ typeAliasRef.getChild(name).node2 = declaration;
+ } else if (declaration is GenericTypeAlias) {
+ var name = declaration.name.name;
+ typeAliasRef.getChild(name).node2 = declaration;
+ } else if (declaration is MixinDeclaration) {
+ var name = declaration.name.name;
+ mixinRef.getChild(name).node2 = declaration;
+ } else if (declaration is TopLevelVariableDeclaration) {
+ for (var variable in declaration.variables.variables) {
+ var name = variable.name.name;
+ variableRef.getChild(name).node2 = declaration;
+ }
+ }
+ }
+ }
}
diff --git a/analyzer/lib/src/summary2/linked_unit_context.dart b/analyzer/lib/src/summary2/linked_unit_context.dart
index b1bb1f4..6402f7d 100644
--- a/analyzer/lib/src/summary2/linked_unit_context.dart
+++ b/analyzer/lib/src/summary2/linked_unit_context.dart
@@ -1,11 +1,19 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/dart/element/visitor.dart';
+import 'package:analyzer/source/line_info.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary2/ast_binary_reader.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/linked_bundle_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
import 'package:analyzer/src/summary2/tokens_context.dart';
@@ -13,25 +21,175 @@
/// The context of a unit - the context of the bundle, and the unit tokens.
class LinkedUnitContext {
final LinkedBundleContext bundleContext;
+ final LinkedLibraryContext libraryContext;
+ final int indexInLibrary;
+ final String uriStr;
+ final Reference reference;
+ final bool isSynthetic;
+ final LinkedNodeUnit data;
final TokensContext tokensContext;
- LinkedUnitContext(this.bundleContext, this.tokensContext);
+ AstBinaryReader _astReader;
- Iterable<LinkedNode> classFields(LinkedNode class_) sync* {
- for (var declaration in class_.classOrMixinDeclaration_members) {
- if (declaration.kind == LinkedNodeKind.fieldDeclaration) {
- var variableList = declaration.fieldDeclaration_fields;
- for (var field in variableList.variableDeclarationList_variables) {
- yield field;
- }
- }
- }
+ CompilationUnit _unit;
+ bool _hasDirectivesRead = false;
+
+ /// Mapping from identifiers to elements for generic function types.
+ final Map<int, GenericFunctionTypeElementImpl> _genericFunctionTypes = {};
+
+ /// Mapping from identifiers to synthetic type parameters.
+ ///
+ /// Synthetic type parameters are added when [readType] begins reading a
+ /// [FunctionType], and removed when reading is done.
+ final Map<int, TypeParameterElementImpl> _typeParameters = {};
+
+ int _nextSyntheticTypeParameterId = 0x10000;
+
+ LinkedUnitContext(
+ this.bundleContext,
+ this.libraryContext,
+ this.indexInLibrary,
+ this.uriStr,
+ this.reference,
+ this.isSynthetic,
+ this.data,
+ {CompilationUnit unit})
+ : tokensContext = data != null ? TokensContext(data.tokens) : null {
+ _astReader = AstBinaryReader(this);
+ _astReader.isLazy = unit == null;
+
+ _unit = unit;
+ _hasDirectivesRead = _unit != null;
}
- String getCommentText(LinkedNode comment) {
- if (comment == null) return null;
+ LinkedUnitContext._(
+ this.bundleContext,
+ this.libraryContext,
+ this.indexInLibrary,
+ this.uriStr,
+ this.reference,
+ this.isSynthetic,
+ this.data,
+ this.tokensContext);
- return comment.comment_tokens.map(getTokenLexeme).join('\n');
+ bool get hasPartOfDirective {
+ for (var directive in unit_withDirectives.directives) {
+ if (directive is PartOfDirective) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// Return `true` if this unit is a part of a bundle that is being linked.
+ bool get isLinking => bundleContext.isLinking;
+
+ CompilationUnit get unit => _unit;
+
+ CompilationUnit get unit_withDeclarations {
+ if (_unit == null) {
+ _unit = _astReader.readNode(data.node);
+ _unit.lineInfo = LineInfo(data.lineStarts);
+ }
+ return _unit;
+ }
+
+ CompilationUnit get unit_withDirectives {
+ if (!_hasDirectivesRead) {
+ var directiveDataList = data.node.compilationUnit_directives;
+ for (var i = 0; i < directiveDataList.length; ++i) {
+ var directiveData = directiveDataList[i];
+ _unit.directives[i] = _astReader.readNode(directiveData);
+ }
+ _hasDirectivesRead = true;
+ }
+ return _unit;
+ }
+
+ /// Every [GenericFunctionType] node has [GenericFunctionTypeElement], which
+ /// is created during reading of this node.
+ void addGenericFunctionType(int id, GenericFunctionTypeImpl node) {
+ if (this.reference == null) return;
+
+ LazyAst.setGenericFunctionTypeId(node, id);
+
+ var element = _genericFunctionTypes[id];
+ if (element == null) {
+ element = GenericFunctionTypeElementImpl.forLinkedNode(
+ this.reference.element,
+ null,
+ node,
+ );
+ _genericFunctionTypes[id] = element;
+ }
+
+ node.declaredElement = element;
+
+ var containerRef = this.reference.getChild('@genericFunctionType');
+ var reference = containerRef.getChild('$id');
+ reference.element = element;
+ element.reference = reference;
+ }
+
+ /// Return the [LibraryElement] referenced in the [node].
+ LibraryElement directiveLibrary(UriBasedDirective node) {
+ var uriStr = LazyDirective.getSelectedUri(node);
+ if (uriStr == null || uriStr.isEmpty) return null;
+ return bundleContext.elementFactory.libraryOfUri(uriStr);
+ }
+
+ int getCodeLength(AstNode node) {
+ if (node is ClassDeclaration) {
+ return LazyClassDeclaration.get(node).data.codeLength;
+ } else if (node is ClassTypeAlias) {
+ return LazyClassTypeAlias.get(node).data.codeLength;
+ } else if (node is CompilationUnit) {
+ return data.node.codeLength;
+ } else if (node is ConstructorDeclaration) {
+ return LazyConstructorDeclaration.get(node).data.codeLength;
+ } else if (node is EnumDeclaration) {
+ return LazyEnumDeclaration.get(node).data.codeLength;
+ } else if (node is FormalParameter) {
+ return LazyFormalParameter.get(node).data.codeLength;
+ } else if (node is FunctionDeclaration) {
+ return LazyFunctionDeclaration.get(node).data.codeLength;
+ } else if (node is MethodDeclaration) {
+ return LazyMethodDeclaration.get(node).data.codeLength;
+ } else if (node is MixinDeclaration) {
+ return LazyMixinDeclaration.get(node).data.codeLength;
+ } else if (node is TypeParameter) {
+ return LazyTypeParameter.get(node).data.codeLength;
+ } else if (node is VariableDeclaration) {
+ return LazyVariableDeclaration.get(node).data.codeLength;
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ int getCodeOffset(AstNode node) {
+ if (node is ClassDeclaration) {
+ return LazyClassDeclaration.get(node).data.codeOffset;
+ } else if (node is ClassTypeAlias) {
+ return LazyClassTypeAlias.get(node).data.codeOffset;
+ } else if (node is CompilationUnit) {
+ return data.node.codeOffset;
+ } else if (node is ConstructorDeclaration) {
+ return LazyConstructorDeclaration.get(node).data.codeOffset;
+ } else if (node is EnumDeclaration) {
+ return LazyEnumDeclaration.get(node).data.codeOffset;
+ } else if (node is FormalParameter) {
+ return LazyFormalParameter.get(node).data.codeOffset;
+ } else if (node is FunctionDeclaration) {
+ return LazyFunctionDeclaration.get(node).data.codeOffset;
+ } else if (node is MethodDeclaration) {
+ return LazyMethodDeclaration.get(node).data.codeOffset;
+ } else if (node is MixinDeclaration) {
+ return LazyMixinDeclaration.get(node).data.codeOffset;
+ } else if (node is TypeParameter) {
+ return LazyTypeParameter.get(node).data.codeOffset;
+ } else if (node is VariableDeclaration) {
+ return LazyVariableDeclaration.get(node).data.codeOffset;
+ }
+ throw UnimplementedError('${node.runtimeType}');
}
String getConstructorDeclarationName(LinkedNode node) {
@@ -42,110 +200,967 @@
return '';
}
+ List<ConstructorInitializer> getConstructorInitializers(
+ ConstructorDeclaration node,
+ ) {
+ LazyConstructorDeclaration.readInitializers(_astReader, node);
+ return node.initializers;
+ }
+
+ ConstructorName getConstructorRedirected(ConstructorDeclaration node) {
+ LazyConstructorDeclaration.readRedirectedConstructor(_astReader, node);
+ return node.redirectedConstructor;
+ }
+
+ Iterable<ConstructorDeclaration> getConstructors(AstNode node) sync* {
+ if (node is ClassOrMixinDeclaration) {
+ var members = _getClassOrMixinMembers(node);
+ for (var member in members) {
+ if (member is ConstructorDeclaration) {
+ yield member;
+ }
+ }
+ }
+ }
+
+ DartType getDefaultType(TypeParameter node) {
+ return LazyTypeParameter.getDefaultType(_astReader, node);
+ }
+
+ String getDefaultValueCode(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ LazyFormalParameter.readDefaultValue(_astReader, node);
+ return node.defaultValue?.toString();
+ }
+ return null;
+ }
+
+ int getDirectiveOffset(AstNode node) {
+ LazyDirective.readMetadata(_astReader, node);
+ return node.offset;
+ }
+
+ Comment getDocumentationComment(AstNode node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is ClassTypeAlias) {
+ LazyClassTypeAlias.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is ConstructorDeclaration) {
+ LazyConstructorDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is EnumConstantDeclaration) {
+ LazyEnumConstantDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is EnumDeclaration) {
+ LazyEnumDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is FunctionTypeAlias) {
+ LazyFunctionTypeAlias.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is GenericTypeAlias) {
+ LazyGenericTypeAlias.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is MixinDeclaration) {
+ LazyMixinDeclaration.readDocumentationComment(_astReader, node);
+ return node.documentationComment;
+ } else if (node is VariableDeclaration) {
+ var parent2 = node.parent.parent;
+ if (parent2 is FieldDeclaration) {
+ LazyFieldDeclaration.readDocumentationComment(_astReader, parent2);
+ return parent2.documentationComment;
+ } else if (parent2 is TopLevelVariableDeclaration) {
+ LazyTopLevelVariableDeclaration.readDocumentationComment(
+ _astReader,
+ parent2,
+ );
+ return parent2.documentationComment;
+ } else {
+ throw UnimplementedError('${parent2.runtimeType}');
+ }
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ List<EnumConstantDeclaration> getEnumConstants(EnumDeclaration node) {
+ LazyEnumDeclaration.readConstants(_astReader, node);
+ return node.constants;
+ }
+
+ String getFieldFormalParameterName(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ return getFieldFormalParameterName(node.parameter);
+ } else if (node is FieldFormalParameter) {
+ return node.identifier.name;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ Iterable<VariableDeclaration> getFields(ClassOrMixinDeclaration node) sync* {
+ var members = _getClassOrMixinMembers(node);
+ for (var member in members) {
+ if (member is FieldDeclaration) {
+ for (var field in member.fields.variables) {
+ yield field;
+ }
+ }
+ }
+ }
+
String getFormalParameterName(LinkedNode node) {
return getSimpleName(node.normalFormalParameter_identifier);
}
- List<LinkedNode> getFormalParameters(LinkedNode node) {
- LinkedNode parameterList;
- var kind = node.kind;
- if (kind == LinkedNodeKind.constructorDeclaration) {
- parameterList = node.constructorDeclaration_parameters;
- } else if (kind == LinkedNodeKind.functionDeclaration) {
- parameterList = node.functionDeclaration_functionExpression
- .functionExpression_formalParameters;
- } else if (kind == LinkedNodeKind.functionTypeAlias) {
- parameterList = node.functionTypeAlias_formalParameters;
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- parameterList = node.methodDeclaration_formalParameters;
+ List<FormalParameter> getFormalParameters(AstNode node) {
+ if (node is ConstructorDeclaration) {
+ LazyConstructorDeclaration.readFormalParameters(_astReader, node);
+ return node.parameters.parameters;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
+ return getFormalParameters(node.functionExpression);
+ } else if (node is FunctionExpression) {
+ LazyFunctionExpression.readFormalParameters(_astReader, node);
+ return node.parameters?.parameters;
+ } else if (node is FormalParameter) {
+ if (node is DefaultFormalParameter) {
+ return getFormalParameters(node.parameter);
+ } else if (node is FieldFormalParameter) {
+ LazyFormalParameter.readFormalParameters(_astReader, node);
+ return node.parameters?.parameters;
+ } else if (node is FunctionTypedFormalParameter) {
+ LazyFormalParameter.readFormalParameters(_astReader, node);
+ return node.parameters.parameters;
+ } else {
+ return null;
+ }
+ } else if (node is FunctionTypeAlias) {
+ LazyFunctionTypeAlias.readFormalParameters(_astReader, node);
+ return node.parameters.parameters;
+ } else if (node is GenericFunctionType) {
+ LazyGenericFunctionType.readFormalParameters(_astReader, node);
+ return node.parameters.parameters;
+ } else if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readFormalParameters(_astReader, node);
+ return node.parameters?.parameters;
} else {
- throw UnimplementedError('$kind');
+ throw UnimplementedError('${node.runtimeType}');
}
- return parameterList?.formalParameterList_parameters;
+// if (kind == LinkedNodeKind.constructorDeclaration) {
+// parameterList = node.constructorDeclaration_parameters;
+// } else if (kind == LinkedNodeKind.functionDeclaration) {
+// return getFormalParameters(node.functionDeclaration_functionExpression);
+// } else if (kind == LinkedNodeKind.functionExpression) {
+// parameterList = node.functionExpression_formalParameters;
+// } else if (kind == LinkedNodeKind.functionTypeAlias) {
+// parameterList = node.functionTypeAlias_formalParameters;
+// } else if (kind == LinkedNodeKind.genericFunctionType) {
+// parameterList = node.genericFunctionType_formalParameters;
+// } else if (kind == LinkedNodeKind.methodDeclaration) {
+// parameterList = node.methodDeclaration_formalParameters;
+// } else {
+// throw UnimplementedError('$kind');
+// }
}
- LinkedNode getImplementsClause(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.classDeclaration) {
- return node.classOrMixinDeclaration_implementsClause;
- } else if (kind == LinkedNodeKind.classTypeAlias) {
- return node.classTypeAlias_implementsClause;
+ Reference getGenericFunctionTypeReference(GenericFunctionType node) {
+ var id = LazyAst.getGenericFunctionTypeId(node);
+ return reference.getChild('@genericFunctionType').getChild('$id');
+ }
+
+ GenericFunctionType getGeneticTypeAliasFunction(GenericTypeAlias node) {
+ LazyGenericTypeAlias.readFunctionType(_astReader, node);
+ return node.functionType;
+ }
+
+ bool getHasTypedefSelfReference(AstNode node) {
+ if (node is FunctionTypeAlias) {
+ return LazyFunctionTypeAlias.getHasSelfReference(node);
+ } else if (node is GenericTypeAlias) {
+ return LazyGenericTypeAlias.getHasSelfReference(node);
+ }
+ return false;
+ }
+
+ ImplementsClause getImplementsClause(AstNode node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readImplementsClause(_astReader, node);
+ return node.implementsClause;
+ } else if (node is ClassTypeAlias) {
+ LazyClassTypeAlias.readImplementsClause(_astReader, node);
+ return node.implementsClause;
+ } else if (node is MixinDeclaration) {
+ LazyMixinDeclaration.readImplementsClause(_astReader, node);
+ return node.implementsClause;
} else {
- throw UnimplementedError('$kind');
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ bool getInheritsCovariant(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ return getInheritsCovariant(node.parameter);
+ } else if (node is FormalParameter) {
+ return LazyAst.getInheritsCovariant(node);
+ } else if (node is VariableDeclaration) {
+ return LazyAst.getInheritsCovariant(node);
+ } else {
+ throw StateError('${node.runtimeType}');
}
}
InterfaceType getInterfaceType(LinkedNodeType linkedType) {
- return bundleContext.getInterfaceType(linkedType);
+ var type = readType(linkedType);
+ if (type is InterfaceType && !type.element.isEnum) {
+ return type;
+ }
+ return null;
}
- List<LinkedNode> getMetadataOrEmpty(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.classDeclaration ||
- kind == LinkedNodeKind.classTypeAlias ||
- kind == LinkedNodeKind.constructorDeclaration ||
- kind == LinkedNodeKind.enumConstantDeclaration ||
- kind == LinkedNodeKind.enumDeclaration ||
- kind == LinkedNodeKind.functionDeclaration ||
- kind == LinkedNodeKind.functionTypeAlias ||
- kind == LinkedNodeKind.methodDeclaration ||
- kind == LinkedNodeKind.mixinDeclaration ||
- kind == LinkedNodeKind.variableDeclaration) {
- return node.annotatedNode_metadata;
+ Comment getLibraryDocumentationComment(CompilationUnit unit) {
+ for (var directive in unit.directives) {
+ if (directive is LibraryDirective) {
+ return directive.documentationComment;
+ }
}
- if (kind == LinkedNodeKind.fieldFormalParameter ||
- kind == LinkedNodeKind.functionTypedFormalParameter ||
- kind == LinkedNodeKind.simpleFormalParameter) {
- return node.normalFormalParameter_metadata;
+ return null;
+ }
+
+ List<Annotation> getLibraryMetadata(CompilationUnit unit) {
+ for (var directive in unit.directives) {
+ if (directive is LibraryDirective) {
+ return getMetadata(directive);
+ }
}
- return const <LinkedNode>[];
+ return const <Annotation>[];
+ }
+
+ List<Annotation> getMetadata(AstNode node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is ClassTypeAlias) {
+ LazyClassTypeAlias.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is CompilationUnit) {
+ assert(node == _unit);
+ return _getPartDirectiveAnnotation();
+ } else if (node is ConstructorDeclaration) {
+ LazyConstructorDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is DefaultFormalParameter) {
+ return getMetadata(node.parameter);
+ } else if (node is Directive) {
+ LazyDirective.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is EnumConstantDeclaration) {
+ LazyEnumConstantDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is EnumDeclaration) {
+ LazyEnumDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is FormalParameter) {
+ LazyFormalParameter.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is FunctionTypeAlias) {
+ LazyFunctionTypeAlias.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is GenericTypeAlias) {
+ LazyGenericTypeAlias.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is MixinDeclaration) {
+ LazyMixinDeclaration.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is TypeParameter) {
+ LazyTypeParameter.readMetadata(_astReader, node);
+ return node.metadata;
+ } else if (node is VariableDeclaration) {
+ var parent2 = node.parent.parent;
+ if (parent2 is FieldDeclaration) {
+ LazyFieldDeclaration.readMetadata(_astReader, parent2);
+ return parent2.metadata;
+ } else if (parent2 is TopLevelVariableDeclaration) {
+ LazyTopLevelVariableDeclaration.readMetadata(_astReader, parent2);
+ return parent2.metadata;
+ }
+ }
+// var kind = node.kind;
+// if (kind == LinkedNodeKind.classDeclaration ||
+// kind == LinkedNodeKind.classTypeAlias ||
+// kind == LinkedNodeKind.constructorDeclaration ||
+// kind == LinkedNodeKind.enumConstantDeclaration ||
+// kind == LinkedNodeKind.enumDeclaration ||
+// kind == LinkedNodeKind.exportDirective ||
+// kind == LinkedNodeKind.functionDeclaration ||
+// kind == LinkedNodeKind.functionTypeAlias ||
+// kind == LinkedNodeKind.libraryDirective ||
+// kind == LinkedNodeKind.importDirective ||
+// kind == LinkedNodeKind.methodDeclaration ||
+// kind == LinkedNodeKind.mixinDeclaration ||
+// kind == LinkedNodeKind.partDirective ||
+// kind == LinkedNodeKind.partOfDirective ||
+// kind == LinkedNodeKind.variableDeclaration) {
+// return node.annotatedNode_metadata;
+// }
+// if (kind == LinkedNodeKind.defaultFormalParameter) {
+// return getMetadataOrEmpty(node.defaultFormalParameter_parameter);
+// }
+// if (kind == LinkedNodeKind.fieldFormalParameter ||
+// kind == LinkedNodeKind.functionTypedFormalParameter ||
+// kind == LinkedNodeKind.simpleFormalParameter) {
+// return node.normalFormalParameter_metadata;
+// }
+ return const <Annotation>[];
}
String getMethodName(LinkedNode node) {
return getSimpleName(node.methodDeclaration_name);
}
- DartType getReturnType(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.functionDeclaration) {
- return getType(node.functionDeclaration_returnType2);
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- return getType(node.methodDeclaration_returnType2);
- } else {
- throw UnimplementedError('$kind');
+ Iterable<MethodDeclaration> getMethods(AstNode node) sync* {
+ if (node is ClassOrMixinDeclaration) {
+ var members = _getClassOrMixinMembers(node);
+ for (var member in members) {
+ if (member is MethodDeclaration) {
+ yield member;
+ }
+ }
}
}
+ List<String> getMixinSuperInvokedNames(MixinDeclaration node) {
+ return LazyMixinDeclaration.get(node).getSuperInvokedNames();
+ }
+
+ int getNameOffset(AstNode node) {
+ if (node is ConstructorDeclaration) {
+ if (node.name != null) {
+ return node.name.offset;
+ } else {
+ return node.returnType.offset;
+ }
+ } else if (node is EnumConstantDeclaration) {
+ return node.name.offset;
+ } else if (node is FormalParameter) {
+ return node.identifier?.offset ?? -1;
+ } else if (node is MethodDeclaration) {
+ return node.name.offset;
+ } else if (node is NamedCompilationUnitMember) {
+ return node.name.offset;
+ } else if (node is TypeParameter) {
+ return node.name.offset;
+ } else if (node is VariableDeclaration) {
+ return node.name.offset;
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ OnClause getOnClause(MixinDeclaration node) {
+ LazyMixinDeclaration.readOnClause(_astReader, node);
+ return node.onClause;
+ }
+
+ /// Return the actual return type for the [node] - explicit or inferred.
+ DartType getReturnType(AstNode node) {
+ if (node is FunctionDeclaration) {
+ return LazyFunctionDeclaration.getReturnType(_astReader, node);
+ } else if (node is FunctionTypeAlias) {
+ return LazyFunctionTypeAlias.getReturnType(_astReader, node);
+ } else if (node is GenericFunctionType) {
+ return LazyGenericFunctionType.getReturnType(_astReader, node);
+ } else if (node is MethodDeclaration) {
+ return LazyMethodDeclaration.getReturnType(_astReader, node);
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ TypeAnnotation getReturnTypeNode(AstNode node) {
+ if (node is FunctionTypeAlias) {
+ LazyFunctionTypeAlias.readReturnTypeNode(_astReader, node);
+ return node.returnType;
+ } else if (node is GenericFunctionType) {
+ LazyGenericFunctionType.readReturnTypeNode(_astReader, node);
+ return node.returnType;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readReturnTypeNode(_astReader, node);
+ return node.returnType;
+ } else if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readReturnTypeNode(_astReader, node);
+ return node.returnType;
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ String getSelectedUri(UriBasedDirective node) {
+ return LazyDirective.getSelectedUri(node);
+ }
+
String getSimpleName(LinkedNode node) {
return getTokenLexeme(node.simpleIdentifier_token);
}
+ List<String> getSimpleNameList(List<LinkedNode> nodeList) {
+ return nodeList.map(getSimpleName).toList();
+ }
+
int getSimpleOffset(LinkedNode node) {
- return tokensContext.offset(node.simpleIdentifier_token);
+ return getTokenOffset(node.simpleIdentifier_token);
}
String getStringContent(LinkedNode node) {
return node.simpleStringLiteral_value;
}
+ TypeName getSuperclass(AstNode node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readExtendsClause(_astReader, node);
+ return node.extendsClause?.superclass;
+ } else if (node is ClassTypeAlias) {
+ LazyClassTypeAlias.readSuperclass(_astReader, node);
+ return node.superclass;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
String getTokenLexeme(int token) {
return tokensContext.lexeme(token);
}
- DartType getType(LinkedNodeType linkedType) {
- return bundleContext.getType(linkedType);
+ int getTokenOffset(int token) {
+ return tokensContext.offset(token);
}
- DartType getTypeAnnotationType(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.typeName) {
- return getType(node.typeName_type);
+ /// Return the actual type for the [node] - explicit or inferred.
+ DartType getType(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ return getType(node.parameter);
+ } else if (node is FormalParameter) {
+ return LazyFormalParameter.getType(_astReader, node);
+ } else if (node is VariableDeclaration) {
+ return LazyVariableDeclaration.getType(_astReader, node);
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ TopLevelInferenceError getTypeInferenceError(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ return getTypeInferenceError(node.parameter);
+ } else if (node is SimpleFormalParameter) {
+ return LazyFormalParameter.getTypeInferenceError(node);
+ } else if (node is VariableDeclaration) {
+ return LazyVariableDeclaration.getTypeInferenceError(node);
+ } else {
+ return null;
+ }
+ }
+
+ TypeAnnotation getTypeParameterBound(TypeParameter node) {
+ LazyTypeParameter.readBound(_astReader, node);
+ return node.bound;
+ }
+
+ TypeParameterList getTypeParameters2(AstNode node) {
+ if (node is ClassDeclaration) {
+ return node.typeParameters;
+ } else if (node is ClassTypeAlias) {
+ return node.typeParameters;
+ } else if (node is ConstructorDeclaration) {
+ return null;
+ } else if (node is DefaultFormalParameter) {
+ return getTypeParameters2(node.parameter);
+ } else if (node is FieldFormalParameter) {
+ return null;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
+ return getTypeParameters2(node.functionExpression);
+ } else if (node is FunctionExpression) {
+ return node.typeParameters;
+ } else if (node is FunctionTypedFormalParameter) {
+ return node.typeParameters;
+ } else if (node is FunctionTypeAlias) {
+ return node.typeParameters;
+ } else if (node is GenericFunctionType) {
+ return node.typeParameters;
+ } else if (node is GenericTypeAlias) {
+ return node.typeParameters;
+ } else if (node is MethodDeclaration) {
+ return node.typeParameters;
+ } else if (node is MixinDeclaration) {
+ return node.typeParameters;
+ } else if (node is SimpleFormalParameter) {
+ return null;
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ String getUnitMemberName(LinkedNode node) {
+ return getSimpleName(node.namedCompilationUnitMember_name);
+ }
+
+ String getVariableName(LinkedNode node) {
+ return getSimpleName(node.variableDeclaration_name);
+ }
+
+ WithClause getWithClause(AstNode node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readWithClause(_astReader, node);
+ return node.withClause;
+ } else if (node is ClassTypeAlias) {
+ LazyClassTypeAlias.readWithClause(_astReader, node);
+ return node.withClause;
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ bool hasImplicitReturnType(AstNode node) {
+ if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
+ return node.returnType == null;
+ }
+ if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readReturnTypeNode(_astReader, node);
+ return node.returnType == null;
+ }
+ return false;
+ }
+
+ bool hasImplicitType(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ return hasImplicitType(node.parameter);
+ } else if (node is SimpleFormalParameter) {
+ return node.type == null;
+ } else if (node is VariableDeclaration) {
+ VariableDeclarationList parent = node.parent;
+ LazyVariableDeclarationList.readTypeNode(_astReader, parent);
+ return parent.type == null;
+ }
+ return false;
+ }
+
+ bool hasOverrideInferenceDone(AstNode node) {
+ // Only nodes in the libraries being linked might be not inferred yet.
+ if (_astReader.isLazy) return true;
+
+ return LazyAst.hasOverrideInferenceDone(node);
+ }
+
+ bool isAbstract(AstNode node) {
+ if (node is ClassDeclaration) {
+ return node.abstractKeyword != null;
+ } else if (node is ClassTypeAlias) {
+ return node.abstractKeyword != null;
+ } else if (node is FunctionDeclaration) {
+ return false;
+ } else if (node is MethodDeclaration) {
+ return LazyMethodDeclaration.isAbstract(node);
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ bool isAsynchronous(AstNode node) {
+ var body = _getFunctionBody(node);
+ return body.isAsynchronous;
+ }
+
+ bool isAsyncKeyword(int token) {
+ return tokensContext.type(token) == UnlinkedTokenType.ASYNC;
+ }
+
+ bool isConst(AstNode node) {
+ if (node is FormalParameter) {
+ return node.isConst;
+ }
+ if (node is VariableDeclaration) {
+ VariableDeclarationList parent = node.parent;
+ return parent.isConst;
+ }
+// var kind = node.kind;
+// if (kind == LinkedNodeKind.defaultFormalParameter) {
+// return isConst(node.defaultFormalParameter_parameter);
+// }
+// if (kind == LinkedNodeKind.simpleFormalParameter) {
+// return isConstKeyword(node.simpleFormalParameter_keyword);
+// }
+// if (kind == LinkedNodeKind.variableDeclaration) {
+// return node.variableDeclaration_declaration.isConst;
+// }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ bool isConstKeyword(int token) {
+ return tokensContext.type(token) == UnlinkedTokenType.CONST;
+ }
+
+ bool isConstVariableList(LinkedNode node) {
+ return isConstKeyword(node.variableDeclarationList_keyword);
+ }
+
+ bool isExplicitlyCovariant(AstNode node) {
+ if (node is EnumConstantDeclaration) {
+ return false;
+ } else if (node is FormalParameter) {
+ return node.covariantKeyword != null;
+ } else if (node is VariableDeclaration) {
+ var parent2 = node.parent.parent;
+ return parent2 is FieldDeclaration && parent2.covariantKeyword != null;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ bool isExternal(AstNode node) {
+ if (node is ConstructorDeclaration) {
+ return node.externalKeyword != null;
+ } else if (node is FunctionDeclaration) {
+ return node.externalKeyword != null;
+ } else if (node is MethodDeclaration) {
+ return node.externalKeyword != null;
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ bool isFinal(AstNode node) {
+ if (node is EnumConstantDeclaration) {
+ return false;
+ }
+ if (node is VariableDeclaration) {
+ VariableDeclarationList parent = node.parent;
+ return parent.isFinal;
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ bool isFinalKeyword(int token) {
+ return tokensContext.type(token) == UnlinkedTokenType.FINAL;
+ }
+
+ bool isFinalVariableList(LinkedNode node) {
+ return isFinalKeyword(node.variableDeclarationList_keyword);
+ }
+
+ bool isFunction(LinkedNode node) {
+ return node.kind == LinkedNodeKind.functionDeclaration;
+ }
+
+ bool isGenerator(AstNode node) {
+ var body = _getFunctionBody(node);
+ return body.isGenerator;
+ }
+
+ bool isGetter(AstNode node) {
+ if (node is FunctionDeclaration) {
+ return node.isGetter;
+ } else if (node is MethodDeclaration) {
+ return node.isGetter;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ bool isLate(AstNode node) {
+ if (node is VariableDeclaration) {
+ return node.isLate;
+ }
+ if (node is VariableDeclarationList) {
+ return node.isLate;
+ }
+ if (node is EnumConstantDeclaration) {
+ return false;
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ bool isLibraryKeyword(int token) {
+ return tokensContext.type(token) == UnlinkedTokenType.LIBRARY;
+ }
+
+ bool isMethod(LinkedNode node) {
+ return node.kind == LinkedNodeKind.methodDeclaration;
+ }
+
+ bool isSetter(AstNode node) {
+ if (node is FunctionDeclaration) {
+ return node.isSetter;
+ } else if (node is MethodDeclaration) {
+ return node.isSetter;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ bool isSimplyBounded(AstNode node) {
+ return LazyAst.isSimplyBounded(node);
+ }
+
+ bool isStatic(AstNode node) {
+ if (node is FunctionDeclaration) {
+ return true;
+ } else if (node is MethodDeclaration) {
+ return node.modifierKeyword != null;
+ } else if (node is VariableDeclaration) {
+ var parent2 = node.parent.parent;
+ return parent2 is FieldDeclaration && parent2.isStatic;
+ }
+ throw UnimplementedError('${node.runtimeType}');
+ }
+
+ bool isSyncKeyword(int token) {
+ return tokensContext.type(token) == UnlinkedTokenType.SYNC;
+ }
+
+ Expression readInitializer(AstNode node) {
+ if (node is DefaultFormalParameter) {
+ LazyFormalParameter.readDefaultValue(_astReader, node);
+ return node.defaultValue;
+ } else if (node is VariableDeclaration) {
+ LazyVariableDeclaration.readInitializer(_astReader, node);
+ return node.initializer;
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ AstNode readNode(LinkedNode linkedNode) {
+ return _astReader.readNode(linkedNode);
+ }
+
+ DartType readType(LinkedNodeType linkedType) {
+ if (linkedType == null) return null;
+
+ var kind = linkedType.kind;
+ if (kind == LinkedNodeTypeKind.bottom) {
+ return BottomTypeImpl.instance;
+ } else if (kind == LinkedNodeTypeKind.dynamic_) {
+ return DynamicTypeImpl.instance;
+ } else if (kind == LinkedNodeTypeKind.function) {
+ var typeParameterDataList = linkedType.functionTypeParameters;
+
+ var typeParametersLength = typeParameterDataList.length;
+ var typeParameters = List<TypeParameterElement>(typeParametersLength);
+ for (var i = 0; i < typeParametersLength; ++i) {
+ var typeParameterData = typeParameterDataList[i];
+ var element = TypeParameterElementImpl(typeParameterData.name, -1);
+ typeParameters[i] = element;
+ _typeParameters[_nextSyntheticTypeParameterId++] = element;
+ }
+
+ // Type parameters might use each other in bounds, including forward
+ // references. So, we read bounds after reading all type parameters.
+ for (var i = 0; i < typeParametersLength; ++i) {
+ var typeParameterData = typeParameterDataList[i];
+ TypeParameterElementImpl element = typeParameters[i];
+ element.bound = readType(typeParameterData.bound);
+ }
+
+ var returnType = readType(linkedType.functionReturnType);
+ var formalParameters = linkedType.functionFormalParameters.map((p) {
+ var type = readType(p.type);
+ var kind = _formalParameterKind(p.kind);
+ return ParameterElementImpl.synthetic(p.name, type, kind);
+ }).toList();
+
+ for (var i = 0; i < typeParametersLength; ++i) {
+ _typeParameters.remove(--_nextSyntheticTypeParameterId);
+ }
+
+ var nullabilitySuffix = _nullabilitySuffix(linkedType.nullabilitySuffix);
+
+ return FunctionTypeImpl.synthetic(
+ returnType,
+ typeParameters,
+ formalParameters,
+ ).withNullability(nullabilitySuffix);
+ } else if (kind == LinkedNodeTypeKind.interface) {
+ var element = bundleContext.elementOfIndex(linkedType.interfaceClass);
+ var nullabilitySuffix = _nullabilitySuffix(linkedType.nullabilitySuffix);
+ return InterfaceTypeImpl.explicit(
+ element,
+ linkedType.interfaceTypeArguments.map(readType).toList(),
+ nullabilitySuffix: nullabilitySuffix,
+ );
+ } else if (kind == LinkedNodeTypeKind.typeParameter) {
+ TypeParameterElement element;
+ var id = linkedType.typeParameterId;
+ if (id != 0) {
+ element = _typeParameters[id];
+ assert(element != null);
+ } else {
+ var index = linkedType.typeParameterElement;
+ element = bundleContext.elementOfIndex(index);
+ }
+ var nullabilitySuffix = _nullabilitySuffix(linkedType.nullabilitySuffix);
+ return TypeParameterTypeImpl(element).withNullability(nullabilitySuffix);
+ } else if (kind == LinkedNodeTypeKind.void_) {
+ return VoidTypeImpl.instance;
} else {
throw UnimplementedError('$kind');
}
}
- List<LinkedNode> getTypeParameters(LinkedNode node) {
+ /// Read new resolved [CompilationUnit] from the [data], and in contrast to
+ /// reading AST for element model, read it eagerly. We can do this, because
+ /// the element model is fully accessible, so we don't need to worry about
+ /// potential forward references.
+ ///
+ /// The new instance of [CompilationUnit] is required because the client of
+ /// this method is going to modify the unit - merge parsed, not yet resolved
+ /// function bodies into it, and resolve them.
+ CompilationUnit readUnitEagerly() {
+ reference.element.accept(
+ _TypeParameterReader(),
+ );
+ _RecursiveTypeReader(this).read(unit);
+
+ var context = LinkedUnitContext._(
+ bundleContext,
+ libraryContext,
+ indexInLibrary,
+ uriStr,
+ reference,
+ isSynthetic,
+ data,
+ TokensContext(data.tokens),
+ );
+ context._genericFunctionTypes.addAll(_genericFunctionTypes);
+ var astReader = AstBinaryReader(context);
+ return astReader.readNode(data.node);
+ }
+
+ void setInheritsCovariant(AstNode node, bool value) {
+ if (node is FormalParameter) {
+ LazyAst.setInheritsCovariant(node, value);
+ } else if (node is VariableDeclaration) {
+ LazyAst.setInheritsCovariant(node, value);
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ }
+
+ void setOverrideInferenceDone(AstNode node) {
+ // TODO(scheglov) This assert fails, check how to avoid this.
+// assert(!_astReader.isLazy);
+ LazyAst.setOverrideInferenceDone(node);
+ }
+
+ void setReturnType(AstNode node, DartType type) {
+ LazyAst.setReturnType(node, type);
+ }
+
+ void setVariableType(AstNode node, DartType type) {
+ if (node is DefaultFormalParameter) {
+ setVariableType(node.parameter, type);
+ } else {
+ LazyAst.setType(node, type);
+ }
+ }
+
+ bool shouldBeConstFieldElement(AstNode node) {
+ if (node is VariableDeclaration) {
+ VariableDeclarationList variableList = node.parent;
+ if (variableList.isConst) return true;
+
+ if (variableList.isFinal) {
+ ClassOrMixinDeclaration class_ = variableList.parent.parent;
+ for (var member in class_.members) {
+ if (member is ConstructorDeclaration && member.constKeyword != null) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ Iterable<VariableDeclaration> topLevelVariables(CompilationUnit unit) sync* {
+ for (var declaration in unit.declarations) {
+ if (declaration is TopLevelVariableDeclaration) {
+ for (var variable in declaration.variables.variables) {
+ yield variable;
+ }
+ }
+ }
+ }
+
+ ParameterKind _formalParameterKind(LinkedNodeFormalParameterKind kind) {
+ if (kind == LinkedNodeFormalParameterKind.optionalNamed) {
+ return ParameterKind.NAMED;
+ } else if (kind == LinkedNodeFormalParameterKind.optionalPositional) {
+ return ParameterKind.POSITIONAL;
+ } else if (kind == LinkedNodeFormalParameterKind.requiredNamed) {
+ return ParameterKind.NAMED_REQUIRED;
+ }
+ return ParameterKind.REQUIRED;
+ }
+
+ List<ClassMember> _getClassOrMixinMembers(ClassOrMixinDeclaration node) {
+ if (node is ClassDeclaration) {
+ LazyClassDeclaration.readMembers(_astReader, node);
+ } else if (node is MixinDeclaration) {
+ LazyMixinDeclaration.readMembers(_astReader, node);
+ } else {
+ throw StateError('${node.runtimeType}');
+ }
+ return node.members;
+ }
+
+ FunctionBody _getFunctionBody(AstNode node) {
+ if (node is ConstructorDeclaration) {
+ LazyConstructorDeclaration.readBody(_astReader, node);
+ return node.body;
+ } else if (node is FunctionDeclaration) {
+ LazyFunctionDeclaration.readFunctionExpression(_astReader, node);
+ return _getFunctionBody(node.functionExpression);
+ } else if (node is FunctionExpression) {
+ LazyFunctionExpression.readBody(_astReader, node);
+ return node.body;
+ } else if (node is MethodDeclaration) {
+ LazyMethodDeclaration.readBody(_astReader, node);
+ return node.body;
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ NodeList<Annotation> _getPartDirectiveAnnotation() {
+ if (indexInLibrary != 0) {
+ var definingContext = libraryContext.definingUnit;
+ var unit = definingContext.unit;
+ var partDirectiveIndex = 0;
+ for (var directive in unit.directives) {
+ if (directive is PartDirective) {
+ partDirectiveIndex++;
+ if (partDirectiveIndex == indexInLibrary) {
+ LazyDirective.readMetadata(definingContext._astReader, directive);
+ return directive.metadata;
+ }
+ }
+ }
+ }
+ throw StateError('Expected to find $indexInLibrary part directive.');
+ }
+
+ static List<LinkedNode> getTypeParameters(LinkedNode node) {
LinkedNode typeParameterList;
var kind = node.kind;
if (kind == LinkedNodeKind.classTypeAlias) {
@@ -161,6 +1176,10 @@
typeParameterList = node.functionExpression_typeParameters;
} else if (kind == LinkedNodeKind.functionTypeAlias) {
typeParameterList = node.functionTypeAlias_typeParameters;
+ } else if (kind == LinkedNodeKind.genericFunctionType) {
+ typeParameterList = node.genericFunctionType_typeParameters;
+ } else if (kind == LinkedNodeKind.genericTypeAlias) {
+ typeParameterList = node.genericTypeAlias_typeParameters;
} else if (kind == LinkedNodeKind.methodDeclaration) {
typeParameterList = node.methodDeclaration_typeParameters;
} else {
@@ -169,216 +1188,108 @@
return typeParameterList?.typeParameterList_typeParameters;
}
- String getUnitMemberName(LinkedNode node) {
- return getSimpleName(node.namedCompilationUnitMember_name);
+ static NullabilitySuffix _nullabilitySuffix(EntityRefNullabilitySuffix data) {
+ switch (data) {
+ case EntityRefNullabilitySuffix.starOrIrrelevant:
+ return NullabilitySuffix.star;
+ case EntityRefNullabilitySuffix.question:
+ return NullabilitySuffix.question;
+ case EntityRefNullabilitySuffix.none:
+ return NullabilitySuffix.none;
+ default:
+ throw StateError('$data');
+ }
}
+}
- String getVariableName(LinkedNode node) {
- return getSimpleName(node.variableDeclaration_name);
- }
+/// Ensure that all [GenericFunctionType] and [TypeParameter] nodes are read,
+/// so their elements are created and set in [Reference]s.
+class _RecursiveTypeReader {
+ final LinkedUnitContext context;
- bool isAbstract(LinkedNode node) {
- return node.kind == LinkedNodeKind.methodDeclaration &&
- node.methodDeclaration_body.kind == LinkedNodeKind.emptyFunctionBody;
- }
+ _RecursiveTypeReader(this.context);
- bool isAsynchronous(LinkedNode node) {
- LinkedNode body = _getFunctionBody(node);
- if (body.kind == LinkedNodeKind.blockFunctionBody) {
- return body.blockFunctionBody_keyword != 0;
- } else if (body.kind == LinkedNodeKind.emptyFunctionBody) {
- return false;
+ void read(AstNode node) {
+ if (node == null) {
+ } else if (node is ClassDeclaration) {
+ _readTypeParameters(node);
+ node.members.forEach(read);
+ } else if (node is ClassTypeAlias) {
+ _readTypeParameters(node);
+ } else if (node is CompilationUnit) {
+ for (var declaration in node.declarations) {
+ read(declaration);
+ }
+ } else if (node is ConstructorDeclaration) {
+ _readFormalParameters(node);
+ } else if (node is EnumDeclaration) {
+ } else if (node is FieldDeclaration) {
+ read(node.fields);
+ } else if (node is FunctionDeclaration) {
+ _readTypeParameters(node);
+ _readFormalParameters(node);
+ _readReturnType(node);
+ } else if (node is FunctionTypeAlias) {
+ _readTypeParameters(node);
+ _readFormalParameters(node);
+ _readReturnType(node);
+ } else if (node is GenericFunctionType) {
+ _readTypeParameters(node);
+ _readFormalParameters(node);
+ _readReturnType(node);
+ } else if (node is GenericTypeAlias) {
+ _readTypeParameters(node);
+ LazyGenericTypeAlias.readFunctionType(context._astReader, node);
+ read(node.functionType);
+ } else if (node is MethodDeclaration) {
+ _readTypeParameters(node);
+ _readFormalParameters(node);
+ _readReturnType(node);
+ } else if (node is MixinDeclaration) {
+ _readTypeParameters(node);
+ node.members.forEach(read);
+ } else if (node is TopLevelVariableDeclaration) {
+ read(node.variables);
+ } else if (node is TypeName) {
+ node.typeArguments?.arguments?.forEach(read);
+ } else if (node is VariableDeclarationList) {
+ LazyVariableDeclarationList.readTypeNode(context._astReader, node);
+ read(node.type);
} else {
- return body.expressionFunctionBody_keyword != 0;
+ throw StateError('${node.runtimeType}');
}
}
- bool isConst(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.variableDeclaration) {
- return node.variableDeclaration_declaration.isConst;
- }
- throw UnimplementedError('$kind');
- }
+ void _readFormalParameters(AstNode node) {
+ var formalParameters = context.getFormalParameters(node);
+ if (formalParameters == null) return;
- bool isConstKeyword(int token) {
- return tokensContext.type(token) == UnlinkedTokenType.CONST;
- }
-
- bool isConstVariableList(LinkedNode node) {
- return isConstKeyword(node.variableDeclarationList_keyword);
- }
-
- bool isExternal(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.constructorDeclaration) {
- return node.constructorDeclaration_externalKeyword != 0;
- } else if (kind == LinkedNodeKind.functionDeclaration) {
- return node.functionDeclaration_externalKeyword != 0;
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- return node.methodDeclaration_externalKeyword != 0;
- } else {
- throw UnimplementedError('$kind');
- }
- }
-
- bool isFinal(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.enumConstantDeclaration) {
- return false;
- }
- if (kind == LinkedNodeKind.variableDeclaration) {
- return node.variableDeclaration_declaration.isFinal;
- }
- throw UnimplementedError('$kind');
- }
-
- bool isFinalKeyword(int token) {
- return tokensContext.type(token) == UnlinkedTokenType.FINAL;
- }
-
- bool isFinalVariableList(LinkedNode node) {
- return isFinalKeyword(node.variableDeclarationList_keyword);
- }
-
- bool isFunction(LinkedNode node) {
- return node.kind == LinkedNodeKind.functionDeclaration;
- }
-
- bool isGenerator(LinkedNode node) {
- LinkedNode body = _getFunctionBody(node);
- if (body.kind == LinkedNodeKind.blockFunctionBody) {
- return body.blockFunctionBody_star != 0;
- }
- return false;
- }
-
- bool isGetter(LinkedNode node) {
- return isGetterMethod(node) || isGetterFunction(node);
- }
-
- bool isGetterFunction(LinkedNode node) {
- return isFunction(node) &&
- _isGetToken(node.functionDeclaration_propertyKeyword);
- }
-
- bool isGetterMethod(LinkedNode node) {
- return isMethod(node) &&
- _isGetToken(node.methodDeclaration_propertyKeyword);
- }
-
- bool isLibraryKeyword(int token) {
- return tokensContext.type(token) == UnlinkedTokenType.LIBRARY;
- }
-
- bool isMethod(LinkedNode node) {
- return node.kind == LinkedNodeKind.methodDeclaration;
- }
-
- bool isSetter(LinkedNode node) {
- return isSetterMethod(node) || isSetterFunction(node);
- }
-
- bool isSetterFunction(LinkedNode node) {
- return isFunction(node) &&
- _isSetToken(node.functionDeclaration_propertyKeyword);
- }
-
- bool isSetterMethod(LinkedNode node) {
- return isMethod(node) &&
- _isSetToken(node.methodDeclaration_propertyKeyword);
- }
-
- bool isStatic(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.functionDeclaration) {
- return true;
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- return node.methodDeclaration_modifierKeyword != 0;
- } else if (kind == LinkedNodeKind.variableDeclaration) {
- return node.variableDeclaration_declaration.isStatic;
- }
- throw UnimplementedError('$kind');
- }
-
- void loadClassMemberReferences(Reference reference) {
- var node = reference.node;
- if (node.kind != LinkedNodeKind.classDeclaration &&
- node.kind != LinkedNodeKind.mixinDeclaration) {
- return;
- }
-
- var constructorContainerRef = reference.getChild('@constructor');
- var fieldContainerRef = reference.getChild('@field');
- var methodContainerRef = reference.getChild('@method');
- var getterContainerRef = reference.getChild('@getter');
- var setterContainerRef = reference.getChild('@setter');
- for (var member in node.classOrMixinDeclaration_members) {
- if (member.kind == LinkedNodeKind.constructorDeclaration) {
- var name = getConstructorDeclarationName(member);
- constructorContainerRef.getChild(name).node = member;
- } else if (member.kind == LinkedNodeKind.fieldDeclaration) {
- var variableList = member.fieldDeclaration_fields;
- for (var field in variableList.variableDeclarationList_variables) {
- var name = getSimpleName(field.variableDeclaration_name);
- fieldContainerRef.getChild(name).node = field;
- }
- } else if (member.kind == LinkedNodeKind.methodDeclaration) {
- var name = getSimpleName(member.methodDeclaration_name);
- var propertyKeyword = member.methodDeclaration_propertyKeyword;
- if (_isGetToken(propertyKeyword)) {
- getterContainerRef.getChild(name).node = member;
- } else if (_isSetToken(propertyKeyword)) {
- setterContainerRef.getChild(name).node = member;
- } else {
- methodContainerRef.getChild(name).node = member;
- }
+ for (var formalParameter in formalParameters) {
+ if (formalParameter is SimpleFormalParameter) {
+ read(formalParameter.type);
}
}
}
- Expression readInitializer(LinkedNode linkedNode) {
- if (linkedNode.kind == LinkedNodeKind.defaultFormalParameter) {
- return readNode(linkedNode.defaultFormalParameter_defaultValue);
- }
- return readNode(linkedNode.variableDeclaration_initializer);
+ void _readReturnType(AstNode node) {
+ var returnType = context.getReturnTypeNode(node);
+ read(returnType);
}
- AstNode readNode(LinkedNode linkedNode) {
- var reader = AstBinaryReader(this);
- return reader.readNode(linkedNode);
- }
+ void _readTypeParameters(AstNode node) {
+ var typeParameters = context.getTypeParameters2(node);
+ if (typeParameters == null) return;
- Iterable<LinkedNode> topLevelVariables(LinkedNode unit) sync* {
- for (var declaration in unit.compilationUnit_declarations) {
- if (declaration.kind == LinkedNodeKind.topLevelVariableDeclaration) {
- var variableList = declaration.topLevelVariableDeclaration_variableList;
- for (var variable in variableList.variableDeclarationList_variables) {
- yield variable;
- }
- }
+ for (var typeParameter in typeParameters.typeParameters) {
+ var bound = context.getTypeParameterBound(typeParameter);
+ read(bound);
}
}
+}
- LinkedNode _getFunctionBody(LinkedNode node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.constructorDeclaration) {
- return node.constructorDeclaration_body;
- } else if (kind == LinkedNodeKind.functionDeclaration) {
- return node
- .functionDeclaration_functionExpression.functionExpression_body;
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- return node.methodDeclaration_body;
- } else {
- throw UnimplementedError('$kind');
- }
- }
-
- bool _isGetToken(int token) {
- return tokensContext.type(token) == UnlinkedTokenType.GET;
- }
-
- bool _isSetToken(int token) {
- return tokensContext.type(token) == UnlinkedTokenType.SET;
+class _TypeParameterReader extends RecursiveElementVisitor<void> {
+ @override
+ void visitTypeParameterElement(TypeParameterElement element) {
+ super.visitTypeParameterElement(element);
}
}
diff --git a/analyzer/lib/src/summary2/linking_bundle_context.dart b/analyzer/lib/src/summary2/linking_bundle_context.dart
index 50b9b92..fd4148c 100644
--- a/analyzer/lib/src/summary2/linking_bundle_context.dart
+++ b/analyzer/lib/src/summary2/linking_bundle_context.dart
@@ -1,11 +1,13 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary2/reference.dart';
@@ -27,9 +29,37 @@
name: [''],
);
+ final Map<TypeParameterElement, int> _typeParameters = Map.identity();
+ int _nextSyntheticTypeParameterId = 0x10000;
+
+ final Map<GenericFunctionTypeElement, int> _genericFunctionTypes =
+ Map.identity();
+ int _nextGenericFunctionTypeId = 1;
+
LinkingBundleContext(this.dynamicReference);
+ int idOfGenericFunctionType(GenericFunctionTypeElement element) {
+ return _genericFunctionTypes[element];
+ }
+
+ int idOfTypeParameter(TypeParameterElement element) {
+ return _typeParameters[element];
+ }
+
+ int indexOfElement(Element element) {
+ if (element == null) return 0;
+ assert(element is! Member);
+
+ if (identical(element, DynamicElementImpl.instance)) {
+ return indexOfReference(dynamicReference);
+ }
+
+ var reference = (element as ElementImpl).reference;
+ return indexOfReference(reference);
+ }
+
int indexOfReference(Reference reference) {
+ if (reference == null) return 0;
if (reference.parent == null) return 0;
if (reference.index != null) return reference.index;
@@ -42,6 +72,10 @@
return reference.index;
}
+ int nextGenericFunctionTypeId() {
+ return _nextGenericFunctionTypeId++;
+ }
+
LinkedNodeTypeBuilder writeType(DartType type) {
if (type == null) return null;
@@ -54,23 +88,31 @@
kind: LinkedNodeTypeKind.dynamic_,
);
} else if (type is FunctionType) {
- return LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.function,
- functionFormalParameters: _getReferences(type.parameters),
- functionReturnType: writeType(type.returnType),
- functionTypeParameters: _getReferences(type.typeParameters),
- );
+ return _writeFunctionType(type);
} else if (type is InterfaceType) {
return LinkedNodeTypeBuilder(
kind: LinkedNodeTypeKind.interface,
- interfaceClass: _getReferenceIndex(type.element),
+ interfaceClass: indexOfElement(type.element),
interfaceTypeArguments: type.typeArguments.map(writeType).toList(),
+ nullabilitySuffix: _nullabilitySuffix(type),
);
} else if (type is TypeParameterType) {
- return LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.typeParameter,
- typeParameterParameter: _getReferenceIndex(type.element),
- );
+ TypeParameterElementImpl element = type.element;
+ var id = _typeParameters[element];
+ if (id != null) {
+ return LinkedNodeTypeBuilder(
+ kind: LinkedNodeTypeKind.typeParameter,
+ nullabilitySuffix: _nullabilitySuffix(type),
+ typeParameterId: id,
+ );
+ } else {
+ var index = indexOfElement(element);
+ return LinkedNodeTypeBuilder(
+ kind: LinkedNodeTypeKind.typeParameter,
+ nullabilitySuffix: _nullabilitySuffix(type),
+ typeParameterElement: index,
+ );
+ }
} else if (type is VoidType) {
return LinkedNodeTypeBuilder(
kind: LinkedNodeTypeKind.void_,
@@ -80,19 +122,86 @@
}
}
- int _getReferenceIndex(Element element) {
- if (element == null) return 0;
-
- var reference = (element as ElementImpl).reference;
- return indexOfReference(reference);
+ LinkedNodeFormalParameterKind _formalParameterKind(ParameterElement p) {
+ if (p.isRequiredPositional) {
+ return LinkedNodeFormalParameterKind.requiredPositional;
+ } else if (p.isRequiredNamed) {
+ return LinkedNodeFormalParameterKind.requiredNamed;
+ } else if (p.isOptionalPositional) {
+ return LinkedNodeFormalParameterKind.optionalPositional;
+ } else if (p.isOptionalNamed) {
+ return LinkedNodeFormalParameterKind.optionalNamed;
+ } else {
+ throw StateError('Unexpected parameter kind: $p');
+ }
}
- List<int> _getReferences(List<Element> elements) {
- var result = List<int>(elements.length);
- for (var i = 0; i < elements.length; ++i) {
- var element = elements[i];
- result[i] = _getReferenceIndex(element);
+ FunctionType _toSyntheticFunctionType(FunctionType type) {
+ var typeParameters = type.typeFormals;
+
+ if (typeParameters.isEmpty) return type;
+
+ var onlySyntheticTypeParameters = typeParameters.every((e) {
+ return e is TypeParameterElementImpl && e.linkedNode == null;
+ });
+ if (onlySyntheticTypeParameters) return type;
+
+ var parameters = getFreshTypeParameters(typeParameters);
+ return parameters.applyToFunctionType(type);
+ }
+
+ LinkedNodeTypeBuilder _writeFunctionType(FunctionType type) {
+ type = _toSyntheticFunctionType(type);
+
+ var typeParameterBuilders = <LinkedNodeTypeTypeParameterBuilder>[];
+
+ var typeParameters = type.typeFormals;
+ for (var i = 0; i < typeParameters.length; ++i) {
+ var typeParameter = typeParameters[i];
+ _typeParameters[typeParameter] = _nextSyntheticTypeParameterId++;
+ typeParameterBuilders.add(
+ LinkedNodeTypeTypeParameterBuilder(name: typeParameter.name),
+ );
}
+
+ for (var i = 0; i < typeParameters.length; ++i) {
+ var typeParameter = typeParameters[i];
+ typeParameterBuilders[i].bound = writeType(typeParameter.bound);
+ }
+
+ var result = LinkedNodeTypeBuilder(
+ kind: LinkedNodeTypeKind.function,
+ functionFormalParameters: type.parameters
+ .map((p) => LinkedNodeTypeFormalParameterBuilder(
+ kind: _formalParameterKind(p),
+ name: p.name,
+ type: writeType(p.type),
+ ))
+ .toList(),
+ functionReturnType: writeType(type.returnType),
+ functionTypeParameters: typeParameterBuilders,
+ nullabilitySuffix: _nullabilitySuffix(type),
+ );
+
+ for (var typeParameter in typeParameters) {
+ _typeParameters.remove(typeParameter);
+ --_nextSyntheticTypeParameterId;
+ }
+
return result;
}
+
+ static EntityRefNullabilitySuffix _nullabilitySuffix(DartType type) {
+ var nullabilitySuffix = (type as TypeImpl).nullabilitySuffix;
+ switch (nullabilitySuffix) {
+ case NullabilitySuffix.question:
+ return EntityRefNullabilitySuffix.question;
+ case NullabilitySuffix.star:
+ return EntityRefNullabilitySuffix.starOrIrrelevant;
+ case NullabilitySuffix.none:
+ return EntityRefNullabilitySuffix.none;
+ default:
+ throw StateError('$nullabilitySuffix');
+ }
+ }
}
diff --git a/analyzer/lib/src/summary2/linking_node_scope.dart b/analyzer/lib/src/summary2/linking_node_scope.dart
new file mode 100644
index 0000000..7617125
--- /dev/null
+++ b/analyzer/lib/src/summary2/linking_node_scope.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+
+/// This class provides access to [Scope]s corresponding to [AstNode]s.
+class LinkingNodeContext {
+ static const _key = 'linkingNodeContext';
+
+ final Scope scope;
+
+ LinkingNodeContext(AstNode node, this.scope) {
+ node.setProperty(_key, this);
+ }
+
+ static LinkingNodeContext get(AstNode node) {
+ LinkingNodeContext context = node.getProperty(_key);
+ if (context == null) {
+ throw StateError('No context for: $node');
+ }
+ return context;
+ }
+}
diff --git a/analyzer/lib/src/summary2/metadata_resolver.dart b/analyzer/lib/src/summary2/metadata_resolver.dart
index 2030086..4705ec8 100644
--- a/analyzer/lib/src/summary2/metadata_resolver.dart
+++ b/analyzer/lib/src/summary2/metadata_resolver.dart
@@ -3,143 +3,182 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/summary/format.dart';
-import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/ast_binary_reader.dart';
+import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/summary2/ast_resolver.dart';
-import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
import 'package:analyzer/src/summary2/link.dart';
-import 'package:analyzer/src/summary2/reference.dart';
-class MetadataResolver {
- AstResolver _astResolver;
+class MetadataResolver extends ThrowingAstVisitor<void> {
+ final Linker _linker;
+ final LibraryElement _libraryElement;
+ final CompilationUnitElement _unitElement;
- MetadataResolver(Linker linker, Reference libraryRef) {
- _astResolver = AstResolver(linker, libraryRef);
+ Scope scope;
+
+ MetadataResolver(this._linker, this._libraryElement, this._unitElement);
+
+ @override
+ void visitAnnotation(Annotation node) {
+ node.elementAnnotation = ElementAnnotationImpl(_unitElement);
+
+ var astResolver = AstResolver(_linker, _libraryElement, scope);
+ astResolver.resolve(node);
}
- void resolve(UnitBuilder unit) {
- var unitDeclarations = unit.node.compilationUnit_declarations;
- for (LinkedNodeBuilder unitDeclaration in unitDeclarations) {
- var kind = unitDeclaration.kind;
- if (_isAnnotatedNode(kind)) {
- _annotatedNode(
- unit,
- unitDeclaration,
- );
- }
- if (kind == LinkedNodeKind.classDeclaration) {
- _class(unit, unitDeclaration);
- } else if (kind == LinkedNodeKind.enumDeclaration) {
- _enumDeclaration(unit, unitDeclaration);
- } else if (kind == LinkedNodeKind.functionDeclaration) {
- var function = unitDeclaration.functionDeclaration_functionExpression;
- _formalParameterList(
- unit,
- function.functionExpression_formalParameters,
- );
- } else if (kind == LinkedNodeKind.topLevelVariableDeclaration) {
- _variables(
- unit,
- unitDeclaration,
- unitDeclaration.topLevelVariableDeclaration_variableList,
- );
- }
- }
+ @override
+ void visitClassDeclaration(ClassDeclaration node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.members.accept(this);
}
- void _annotatedNode(UnitBuilder unit, LinkedNodeBuilder node) {
- var unresolved = node.annotatedNode_metadata;
- var resolved = _list(unit, unresolved);
- node.annotatedNode_metadata = resolved;
+ @override
+ void visitClassTypeAlias(ClassTypeAlias node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
}
- void _class(UnitBuilder unit, LinkedNodeBuilder unitDeclaration) {
- var members = unitDeclaration.classOrMixinDeclaration_members;
- for (var classMember in members) {
- var kind = classMember.kind;
- if (_isAnnotatedNode(kind)) {
- _annotatedNode(unit, classMember);
- }
- if (kind == LinkedNodeKind.fieldDeclaration) {
- _variables(
- unit,
- classMember,
- classMember.fieldDeclaration_fields,
- );
- } else if (kind == LinkedNodeKind.methodDeclaration) {
- _formalParameterList(
- unit,
- classMember.methodDeclaration_formalParameters,
- );
- }
- }
+ @override
+ void visitCompilationUnit(CompilationUnit node) {
+ node.directives.accept(this);
+ node.declarations.accept(this);
}
- void _enumDeclaration(UnitBuilder unit, LinkedNodeBuilder node) {
- for (var constant in node.enumDeclaration_constants) {
- var kind = constant.kind;
- if (kind == LinkedNodeKind.enumConstantDeclaration) {
- _annotatedNode(unit, constant);
- }
- }
+ @override
+ void visitConstructorDeclaration(ConstructorDeclaration node) {
+ node.metadata.accept(this);
+ node.parameters.accept(this);
}
- void _formalParameterList(UnitBuilder unit, LinkedNodeBuilder node) {
- if (node == null) return;
-
- for (var parameter in node.formalParameterList_parameters) {
- if (parameter.kind == LinkedNodeKind.defaultFormalParameter) {
- var actual = parameter.defaultFormalParameter_parameter;
- var unresolved = actual.normalFormalParameter_metadata;
- var resolved = _list(unit, unresolved);
- actual.normalFormalParameter_metadata = resolved;
- } else {
- var unresolved = parameter.normalFormalParameter_metadata;
- var resolved = _list(unit, unresolved);
- parameter.normalFormalParameter_metadata = resolved;
- }
- }
+ @override
+ void visitDefaultFormalParameter(DefaultFormalParameter node) {
+ node.parameter.accept(this);
}
- List<LinkedNodeBuilder> _list(UnitBuilder unit, List<LinkedNode> unresolved) {
- var resolved = List<LinkedNodeBuilder>(unresolved.length);
- for (var i = 0; i < unresolved.length; ++i) {
- var unresolvedNode = unresolved[i];
-
- var reader = AstBinaryReader(unit.context);
- var ast = reader.readNode(unresolvedNode) as Annotation;
- ast.elementAnnotation = ElementAnnotationImpl(null);
-
- // Set some parent, so that resolver does not bail out.
- astFactory.libraryDirective(null, [ast], null, null, null);
-
- var resolvedNode = _astResolver.resolve(unit, ast);
- resolved[i] = resolvedNode;
- }
- return resolved;
+ @override
+ void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
+ node.metadata.accept(this);
}
- /// Resolve annotations of the [declaration] (field or top-level variable),
- /// and set them as metadata for each variable in the [variableList].
- void _variables(UnitBuilder unit, LinkedNodeBuilder declaration,
- LinkedNodeBuilder variableList) {
- for (var variable in variableList.variableDeclarationList_variables) {
- var unresolved = declaration.annotatedNode_metadata;
- var resolved = _list(unit, unresolved);
- variable.annotatedNode_metadata = resolved;
- }
+ @override
+ void visitEnumDeclaration(EnumDeclaration node) {
+ node.metadata.accept(this);
+ node.constants.accept(this);
}
- static bool _isAnnotatedNode(LinkedNodeKind kind) {
- return kind == LinkedNodeKind.classDeclaration ||
- kind == LinkedNodeKind.classTypeAlias ||
- kind == LinkedNodeKind.constructorDeclaration ||
- kind == LinkedNodeKind.enumDeclaration ||
- kind == LinkedNodeKind.functionDeclaration ||
- kind == LinkedNodeKind.functionTypeAlias ||
- kind == LinkedNodeKind.methodDeclaration;
+ @override
+ void visitExportDirective(ExportDirective node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitFieldDeclaration(FieldDeclaration node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitFieldFormalParameter(FieldFormalParameter node) {
+ node.metadata.accept(this);
+ node.parameters?.accept(this);
+ }
+
+ @override
+ void visitFormalParameterList(FormalParameterList node) {
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitFunctionDeclaration(FunctionDeclaration node) {
+ node.metadata.accept(this);
+ node.functionExpression.accept(this);
+ }
+
+ @override
+ void visitFunctionExpression(FunctionExpression node) {
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ }
+
+ @override
+ void visitFunctionTypeAlias(FunctionTypeAlias node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitGenericFunctionType(GenericFunctionType node) {
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitGenericTypeAlias(GenericTypeAlias node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.functionType?.accept(this);
+ }
+
+ @override
+ void visitImportDirective(ImportDirective node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitLibraryDirective(LibraryDirective node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitMethodDeclaration(MethodDeclaration node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ }
+
+ @override
+ void visitMixinDeclaration(MixinDeclaration node) {
+ node.metadata.accept(this);
+ node.typeParameters?.accept(this);
+ node.members.accept(this);
+ }
+
+ @override
+ void visitPartDirective(PartDirective node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitPartOfDirective(PartOfDirective node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitSimpleFormalParameter(SimpleFormalParameter node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitTypeParameter(TypeParameter node) {
+ node.metadata.accept(this);
+ }
+
+ @override
+ void visitTypeParameterList(TypeParameterList node) {
+ node.typeParameters.accept(this);
}
}
diff --git a/analyzer/lib/src/summary2/named_type_builder.dart b/analyzer/lib/src/summary2/named_type_builder.dart
new file mode 100644
index 0000000..003f614
--- /dev/null
+++ b/analyzer/lib/src/summary2/named_type_builder.dart
@@ -0,0 +1,236 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
+import 'package:analyzer/src/summary2/type_builder.dart';
+
+/// The type builder for a [TypeName].
+class NamedTypeBuilder extends TypeBuilder {
+ static DynamicTypeImpl get _dynamicType => DynamicTypeImpl.instance;
+
+ final Element element;
+ final List<DartType> arguments;
+ final NullabilitySuffix nullabilitySuffix;
+
+ /// The node for which this builder is created, or `null` if the builder
+ /// was detached from its node, e.g. during computing default types for
+ /// type parameters.
+ final TypeName node;
+
+ /// The actual built type, not a [TypeBuilder] anymore.
+ ///
+ /// When [build] is called, the type is built, stored into this field,
+ /// and set for the [node].
+ DartType _type;
+
+ NamedTypeBuilder(this.element, this.arguments, this.nullabilitySuffix,
+ {this.node});
+
+ factory NamedTypeBuilder.of(
+ TypeName node,
+ Element element,
+ NullabilitySuffix nullabilitySuffix,
+ ) {
+ List<DartType> arguments;
+ var argumentList = node.typeArguments;
+ if (argumentList != null) {
+ arguments = argumentList.arguments.map((n) => n.type).toList();
+ } else {
+ arguments = <DartType>[];
+ }
+
+ return NamedTypeBuilder(element, arguments, nullabilitySuffix, node: node);
+ }
+
+ @override
+ DartType build() {
+ if (_type != null) {
+ return _type;
+ }
+
+ var element = this.element;
+ if (element is ClassElement) {
+ var parameters = element.typeParameters;
+ if (parameters.isEmpty) {
+ var rawType = element.type;
+ _type = (rawType as TypeImpl).withNullability(nullabilitySuffix);
+ } else {
+ var arguments = _buildArguments(parameters);
+ _type = InterfaceTypeImpl.explicit(
+ element,
+ arguments,
+ nullabilitySuffix: nullabilitySuffix,
+ );
+ }
+ } else if (element is GenericTypeAliasElement) {
+ // Break a possible recursion.
+ _type = _dynamicType;
+
+ var rawType = _getRawFunctionType(element);
+
+ var parameters = element.typeParameters;
+ if (parameters.isEmpty) {
+ _type = rawType;
+ } else {
+ var arguments = _buildArguments(parameters);
+ var substitution = Substitution.fromPairs(parameters, arguments);
+ _type = substitution.substituteType(rawType);
+ }
+ } else if (element is TypeParameterElement) {
+ _type = TypeParameterTypeImpl(element);
+ } else {
+ _type = _dynamicType;
+ }
+
+ node?.type = _type;
+ return _type;
+ }
+
+ @override
+ String toString() {
+ var buffer = StringBuffer();
+ buffer.write(element.displayName);
+ if (arguments.isNotEmpty) {
+ buffer.write('<');
+ buffer.write(arguments.join(', '));
+ buffer.write('>');
+ }
+ return buffer.toString();
+ }
+
+ /// Build arguments that correspond to the type [parameters].
+ List<DartType> _buildArguments(List<TypeParameterElement> parameters) {
+ if (arguments.isNotEmpty) {
+ if (arguments.length == parameters.length) {
+ var result = List<DartType>(parameters.length);
+ for (int i = 0; i < result.length; ++i) {
+ var type = arguments[i];
+ result[i] = _buildType(type);
+ }
+ return result;
+ } else {
+ return _listOfDynamic(parameters.length);
+ }
+ } else {
+ var result = List<DartType>(parameters.length);
+ for (int i = 0; i < result.length; ++i) {
+ TypeParameterElementImpl parameter = parameters[i];
+ var defaultType = parameter.defaultType;
+ defaultType = _buildType(defaultType);
+ result[i] = defaultType;
+ }
+ return result;
+ }
+ }
+
+ DartType _buildFormalParameterType(FormalParameter node) {
+ if (node is DefaultFormalParameter) {
+ return _buildFormalParameterType(node.parameter);
+ } else if (node is FunctionTypedFormalParameter) {
+ return _buildFunctionType(
+ node.typeParameters,
+ node.returnType,
+ node.parameters,
+ );
+ } else if (node is SimpleFormalParameter) {
+ return _buildNodeType(node.type);
+ } else {
+ throw UnimplementedError('(${node.runtimeType}) $node');
+ }
+ }
+
+ FunctionType _buildFunctionType(
+ TypeParameterList typeParameterList,
+ TypeAnnotation returnTypeNode,
+ FormalParameterList parameterList,
+ ) {
+ var returnType = _buildNodeType(returnTypeNode);
+
+ List<TypeParameterElement> typeParameters;
+ if (typeParameterList != null) {
+ typeParameters = typeParameterList.typeParameters
+ .map<TypeParameterElement>((p) => p.declaredElement)
+ .toList();
+ } else {
+ typeParameters = const <TypeParameterElement>[];
+ }
+
+ var formalParameters = parameterList.parameters.map((parameter) {
+ return ParameterElementImpl.synthetic(
+ parameter.identifier?.name ?? '',
+ _buildFormalParameterType(parameter),
+ // ignore: deprecated_member_use_from_same_package
+ parameter.kind,
+ );
+ }).toList();
+
+ return FunctionTypeImpl.synthetic(
+ returnType,
+ typeParameters,
+ formalParameters,
+ );
+ }
+
+ DartType _buildNodeType(TypeAnnotation node) {
+ if (node == null) {
+ return _dynamicType;
+ } else {
+ return _buildType(node.type);
+ }
+ }
+
+ /// If the [type] is a [TypeBuilder], build it; otherwise return as is.
+ DartType _buildType(DartType type) {
+ if (type is TypeBuilder) {
+ return type.build();
+ } else {
+ return type;
+ }
+ }
+
+ DartType _getRawFunctionType(GenericTypeAliasElementImpl element) {
+ // If the element is not being linked, there is no reason (or a way,
+ // because the linked node might be read only partially) to go through
+ // its node - all its types have already been built.
+ if (!element.linkedContext.isLinking) {
+ var function = element.function;
+ if (function != null) {
+ return function.type;
+ } else {
+ return _dynamicType;
+ }
+ }
+
+ var typedefNode = element.linkedNode;
+ if (typedefNode is FunctionTypeAlias) {
+ return _buildFunctionType(
+ null,
+ typedefNode.returnType,
+ typedefNode.parameters,
+ );
+ } else if (typedefNode is GenericTypeAlias) {
+ var functionNode = typedefNode.functionType;
+ if (functionNode != null) {
+ return _buildFunctionType(
+ functionNode.typeParameters,
+ functionNode.returnType,
+ functionNode.parameters,
+ );
+ } else {
+ return _dynamicType;
+ }
+ } else {
+ throw StateError('(${element.runtimeType}) $element');
+ }
+ }
+
+ static List<DartType> _listOfDynamic(int length) {
+ return List<DartType>.filled(length, _dynamicType);
+ }
+}
diff --git a/analyzer/lib/src/summary2/reference.dart b/analyzer/lib/src/summary2/reference.dart
index c89239d..95c0ae7 100644
--- a/analyzer/lib/src/summary2/reference.dart
+++ b/analyzer/lib/src/summary2/reference.dart
@@ -1,9 +1,11 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/scope.dart';
/// Indirection between a name and the corresponding [Element].
///
@@ -34,6 +36,9 @@
/// The corresponding [LinkedNode], or `null` if a named container.
LinkedNode node;
+ /// The corresponding [AstNode], or `null` if a named container.
+ AstNode node2;
+
/// The corresponding [Element], or `null` if a named container.
Element element;
@@ -42,19 +47,29 @@
Map<String, Reference> _children;
+ /// If this reference is an import prefix, the scope of this prefix.
+ Scope prefixScope;
+
Reference.root() : this._(null, '');
Reference._(this.parent, this.name);
+ Iterable<Reference> get children {
+ if (_children != null) {
+ return _children.values;
+ }
+ return const [];
+ }
+
bool get isClass => parent != null && parent.name == '@class';
+ bool get isDynamic => name == 'dynamic' && parent?.name == 'dart:core';
+
bool get isEnum => parent != null && parent.name == '@enum';
- bool get isGenericTypeAlias => parent != null && parent.name == '@typeAlias';
+ bool get isPrefix => parent != null && parent.name == '@prefix';
- bool get isTypeParameter => parent != null && parent.name == '@typeParameter';
-
- int get numOfChildren => _children != null ? _children.length : 0;
+ bool get isTypeAlias => parent != null && parent.name == '@typeAlias';
/// Return the child with the given name, or `null` if does not exist.
Reference operator [](String name) {
@@ -67,5 +82,20 @@
return map[name] ??= new Reference._(this, name);
}
+ /// If the reference has element, and it is for the [node], return `true`.
+ ///
+ /// The element might be not `null`, but the node is different in case of
+ /// duplicate declarations.
+ bool hasElementFor(AstNode node) {
+ if (element != null && node2 == node) {
+ return true;
+ } else {
+ if (node2 == null) {
+ node2 = node;
+ }
+ return false;
+ }
+ }
+
String toString() => parent == null ? 'root' : '$parent::$name';
}
diff --git a/analyzer/lib/src/summary2/reference_resolver.dart b/analyzer/lib/src/summary2/reference_resolver.dart
index f044c1b..74b8547 100644
--- a/analyzer/lib/src/summary2/reference_resolver.dart
+++ b/analyzer/lib/src/summary2/reference_resolver.dart
@@ -2,13 +2,509 @@
// 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/summary/format.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
-import 'package:analyzer/src/summary2/declaration.dart';
+import 'package:analyzer/src/summary2/function_type_builder.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
import 'package:analyzer/src/summary2/linking_bundle_context.dart';
+import 'package:analyzer/src/summary2/linking_node_scope.dart';
+import 'package:analyzer/src/summary2/named_type_builder.dart';
import 'package:analyzer/src/summary2/reference.dart';
-import 'package:analyzer/src/summary2/scope.dart';
+import 'package:analyzer/src/summary2/types_builder.dart';
+
+//class ReferenceResolver {
+// final LinkingBundleContext linkingBundleContext;
+// final TypesToBuild typesToBuild;
+// final UnitBuilder unit;
+//
+// /// TODO(scheglov) Update scope with local scopes (formal / type parameters).
+// Scope scope;
+//
+// Reference reference;
+//
+// ReferenceResolver(
+// this.linkingBundleContext,
+// this.typesToBuild,
+// this.unit,
+// this.scope,
+// this.reference,
+// );
+//
+// LinkedNodeTypeBuilder get _dynamicType {
+// return LinkedNodeTypeBuilder(
+// kind: LinkedNodeTypeKind.dynamic_,
+// );
+// }
+//
+// void resolve() {
+// _node(unit.node);
+// }
+//
+// void _classDeclaration(LinkedNodeBuilder node) {
+// var name = unit.context.getUnitMemberName(node);
+// reference = reference.getChild('@class').getChild(name);
+//
+// var typeParameters = node.classOrMixinDeclaration_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// _extendsClause(node.classDeclaration_extendsClause);
+// _withClause(node.classDeclaration_withClause);
+// _implementsClause(node.classOrMixinDeclaration_implementsClause);
+//
+// for (var member in node.classOrMixinDeclaration_members) {
+// if (member.kind != LinkedNodeKind.constructorDeclaration) {
+// _node(member);
+// }
+// }
+// for (var member in node.classOrMixinDeclaration_members) {
+// if (member.kind == LinkedNodeKind.constructorDeclaration) {
+// _node(member);
+// }
+// }
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _classTypeAlias(LinkedNodeBuilder node) {
+// var name = unit.context.getUnitMemberName(node);
+// reference = reference.getChild('@class').getChild(name);
+//
+// var typeParameters = node.classTypeAlias_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// _typeName(node.classTypeAlias_superclass);
+// _withClause(node.classTypeAlias_withClause);
+// _implementsClause(node.classTypeAlias_implementsClause);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _compilationUnit(LinkedNodeBuilder node) {
+// _nodeList(node.compilationUnit_directives);
+// _nodeList(node.compilationUnit_declarations);
+// }
+//
+// void _constructorDeclaration(LinkedNodeBuilder node) {
+// _node(node.constructorDeclaration_parameters);
+// }
+//
+// void _enumConstantDeclaration(LinkedNodeBuilder node) {}
+//
+// void _enumDeclaration(LinkedNodeBuilder node) {
+// _nodeList(node.enumDeclaration_constants);
+// }
+//
+// void _exportDirective(LinkedNodeBuilder node) {}
+//
+// void _extendsClause(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// _typeName(node.extendsClause_superclass);
+// }
+//
+// void _fieldDeclaration(LinkedNodeBuilder node) {
+// _node(node.fieldDeclaration_fields);
+// }
+//
+// void _fieldFormalParameter(LinkedNodeBuilder node) {
+// var typeNode = node.fieldFormalParameter_type;
+// if (typeNode != null) {
+// _node(typeNode);
+// }
+//
+// var formalParameters = node.fieldFormalParameter_formalParameters;
+// if (formalParameters != null) {
+// _formalParameters(formalParameters);
+// }
+//
+// if (typeNode != null || formalParameters != null) {
+// typesToBuild.declarations.add(node);
+// }
+// }
+//
+// void _formalParameters(LinkedNodeBuilder node) {
+// for (var parameter in node.formalParameterList_parameters) {
+// _node(parameter);
+// }
+// }
+//
+// void _functionDeclaration(LinkedNodeBuilder node) {
+// var name = unit.context.getUnitMemberName(node);
+// reference = reference.getChild('@function').getChild(name);
+//
+// var function = node.functionDeclaration_functionExpression;
+// var typeParameters = function.functionExpression_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// var returnType = node.functionDeclaration_returnType;
+// if (returnType != null) {
+// _node(returnType);
+// typesToBuild.declarations.add(node);
+// } else {
+// node.functionDeclaration_returnType2 = _dynamicType;
+// }
+//
+// _node(function.functionExpression_formalParameters);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _functionExpression(LinkedNodeBuilder node) {
+// var typeParameters = node.functionExpression_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// _node(node.functionExpression_formalParameters);
+// });
+// }
+//
+// void _functionTypeAlias(LinkedNodeBuilder node) {
+// var name = unit.context.getUnitMemberName(node);
+// reference = reference.getChild('@typeAlias').getChild(name);
+//
+// var typeParameters = node.functionTypeAlias_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// var returnType = node.functionTypeAlias_returnType;
+// if (returnType != null) {
+// _node(returnType);
+// typesToBuild.declarations.add(node);
+// } else {
+// node.functionTypeAlias_returnType2 = _dynamicType;
+// }
+//
+// _node(node.functionTypeAlias_formalParameters);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _functionTypedFormalParameter(LinkedNodeBuilder node) {
+// var typeParameters = node.functionTypedFormalParameter_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// var typeNode = node.functionTypedFormalParameter_returnType;
+// if (typeNode != null) {
+// _node(typeNode);
+// }
+//
+// _formalParameters(node.functionTypedFormalParameter_formalParameters);
+// typesToBuild.declarations.add(node);
+// });
+// }
+//
+// void _genericFunctionType(LinkedNodeBuilder node) {
+// reference = reference.getChild('@function');
+//
+// var name = '${reference.numOfChildren}';
+// reference = reference.getChild(name);
+//
+// var typeParameters = node.genericFunctionType_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// var returnType = node.genericFunctionType_returnType;
+// if (returnType != null) {
+// _node(returnType);
+// typesToBuild.declarations.add(node);
+// }
+//
+// _formalParameters(node.genericFunctionType_formalParameters);
+//
+// typesToBuild.typeAnnotations.add(node);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _genericTypeAlias(LinkedNodeBuilder node) {
+// var name = unit.context.getSimpleName(
+// node.namedCompilationUnitMember_name,
+// );
+// reference = reference.getChild('@typeAlias').getChild(name);
+//
+// var typeParameters = node.genericTypeAlias_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// _node(node.genericTypeAlias_functionType);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _implementsClause(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// _typeNameList(node.implementsClause_interfaces);
+// }
+//
+// void _importDirective(LinkedNodeBuilder node) {}
+//
+// void _libraryDirective(LinkedNodeBuilder node) {}
+//
+// void _methodDeclaration(LinkedNodeBuilder node) {
+// var name = unit.context.getMethodName(node);
+// reference = reference.getChild('@method').getChild(name);
+//
+// var typeParameters = node.methodDeclaration_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// var returnType = node.methodDeclaration_returnType;
+// if (returnType != null) {
+// _node(returnType);
+// typesToBuild.declarations.add(node);
+// }
+//
+// _node(node.methodDeclaration_formalParameters);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _mixinDeclaration(LinkedNodeBuilder node) {
+// var name = unit.context.getUnitMemberName(node);
+// reference = reference.getChild('@class').getChild(name);
+//
+// var typeParameters = node.classOrMixinDeclaration_typeParameters;
+// _withTypeParameters(typeParameters, () {
+// _onClause(node.mixinDeclaration_onClause);
+// _implementsClause(node.classOrMixinDeclaration_implementsClause);
+// _nodeList(node.classOrMixinDeclaration_members);
+// });
+//
+// reference = reference.parent.parent;
+// }
+//
+// void _node(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// if (node.kind == LinkedNodeKind.classDeclaration) {
+// _classDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.classTypeAlias) {
+// _classTypeAlias(node);
+// } else if (node.kind == LinkedNodeKind.compilationUnit) {
+// _compilationUnit(node);
+// } else if (node.kind == LinkedNodeKind.constructorDeclaration) {
+// _constructorDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.defaultFormalParameter) {
+// _node(node.defaultFormalParameter_parameter);
+// } else if (node.kind == LinkedNodeKind.enumDeclaration) {
+// _enumDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.enumConstantDeclaration) {
+// _enumConstantDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.exportDirective) {
+// _exportDirective(node);
+// } else if (node.kind == LinkedNodeKind.fieldDeclaration) {
+// _fieldDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.fieldFormalParameter) {
+// _fieldFormalParameter(node);
+// } else if (node.kind == LinkedNodeKind.formalParameterList) {
+// _formalParameters(node);
+// } else if (node.kind == LinkedNodeKind.functionDeclaration) {
+// _functionDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.functionExpression) {
+// _functionExpression(node);
+// } else if (node.kind == LinkedNodeKind.functionTypeAlias) {
+// _functionTypeAlias(node);
+// } else if (node.kind == LinkedNodeKind.functionTypedFormalParameter) {
+// _functionTypedFormalParameter(node);
+// } else if (node.kind == LinkedNodeKind.genericFunctionType) {
+// _genericFunctionType(node);
+// } else if (node.kind == LinkedNodeKind.genericTypeAlias) {
+// _genericTypeAlias(node);
+// } else if (node.kind == LinkedNodeKind.importDirective) {
+// _importDirective(node);
+// } else if (node.kind == LinkedNodeKind.libraryDirective) {
+// _libraryDirective(node);
+// } else if (node.kind == LinkedNodeKind.methodDeclaration) {
+// _methodDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.mixinDeclaration) {
+// _mixinDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.partDirective) {
+// _partDirective(node);
+// } else if (node.kind == LinkedNodeKind.partOfDirective) {
+// _partOfDirective(node);
+// } else if (node.kind == LinkedNodeKind.simpleFormalParameter) {
+// _simpleFormalParameter(node);
+// } else if (node.kind == LinkedNodeKind.topLevelVariableDeclaration) {
+// _topLevelVariableDeclaration(node);
+// } else if (node.kind == LinkedNodeKind.typeArgumentList) {
+// _typeArgumentList(node);
+// } else if (node.kind == LinkedNodeKind.typeName) {
+// _typeName(node);
+// } else if (node.kind == LinkedNodeKind.typeParameter) {
+// _typeParameter(node);
+// } else if (node.kind == LinkedNodeKind.typeParameterList) {
+// _typeParameterList(node);
+// } else if (node.kind == LinkedNodeKind.variableDeclarationList) {
+// _variableDeclarationList(node);
+// } else {
+// // TODO(scheglov) implement
+// throw UnimplementedError('${node.kind}');
+// }
+// }
+//
+// void _nodeList(List<LinkedNode> nodeList) {
+// if (nodeList == null) return;
+//
+// for (var i = 0; i < nodeList.length; ++i) {
+// var node = nodeList[i];
+// _node(node);
+// }
+// }
+//
+// void _onClause(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// _typeNameList(node.onClause_superclassConstraints);
+// }
+//
+// void _partDirective(LinkedNodeBuilder node) {}
+//
+// void _partOfDirective(LinkedNodeBuilder node) {}
+//
+// void _setSimpleElement(LinkedNodeBuilder identifier, Reference reference) {
+// var referenceIndex = linkingBundleContext.indexOfReference(reference);
+// identifier.simpleIdentifier_element = referenceIndex;
+// }
+//
+// void _simpleFormalParameter(LinkedNodeBuilder node) {
+// var typeNode = node.simpleFormalParameter_type;
+// if (typeNode != null) {
+// _node(typeNode);
+// typesToBuild.declarations.add(node);
+// } else {
+// // TODO(scheglov) might be inferred
+// node.simpleFormalParameter_type2 = _dynamicType;
+// }
+//
+// if (node.normalFormalParameter_covariantKeyword != 0) {
+// node.normalFormalParameter_isCovariant = true;
+// } else {
+// // TODO(scheglov) might be inferred
+// }
+// }
+//
+// void _topLevelVariableDeclaration(LinkedNodeBuilder node) {
+// _node(node.topLevelVariableDeclaration_variableList);
+// }
+//
+// void _typeArgumentList(LinkedNodeBuilder node) {
+// for (var typeArgument in node.typeArgumentList_arguments) {
+// _typeName(typeArgument);
+// }
+// }
+//
+// void _typeName(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// var identifier = node.typeName_name;
+// Reference reference;
+//
+// if (identifier.kind == LinkedNodeKind.simpleIdentifier) {
+// var name = unit.context.getSimpleName(identifier);
+//
+// if (name == 'void') {
+// node.typeName_type = LinkedNodeTypeBuilder(
+// kind: LinkedNodeTypeKind.void_,
+// );
+// return;
+// }
+//
+// reference = scope.lookup(name);
+// } else {
+// var prefixNode = identifier.prefixedIdentifier_prefix;
+// var prefixName = unit.context.getSimpleName(prefixNode);
+// var prefixReference = scope.lookup(prefixName);
+// _setSimpleElement(prefixNode, prefixReference);
+//
+// identifier = identifier.prefixedIdentifier_identifier;
+// var name = unit.context.getSimpleName(identifier);
+//
+// if (prefixReference != null && prefixReference.isPrefix) {
+// var prefixScope = prefixReference.prefixScope;
+// reference = prefixScope.lookup(name);
+// } else {
+// identifier.simpleIdentifier_element = 0;
+// node.typeName_type = _dynamicType;
+// return;
+// }
+// }
+//
+// if (reference == null) {
+// identifier.simpleIdentifier_element = 0;
+// node.typeName_type = _dynamicType;
+// return;
+// }
+//
+// _setSimpleElement(identifier, reference);
+//
+// var typeArgumentList = node.typeName_typeArguments;
+// if (typeArgumentList != null) {
+// _node(typeArgumentList);
+// }
+//
+// typesToBuild.typeAnnotations.add(node);
+// }
+//
+// void _typeNameList(List<LinkedNode> nodeList) {
+// for (var i = 0; i < nodeList.length; ++i) {
+// var node = nodeList[i];
+// _typeName(node);
+// }
+// }
+//
+// void _typeParameter(LinkedNodeBuilder node) {
+// _node(node.typeParameter_bound);
+// // TODO(scheglov) set Object bound if no explicit?
+// }
+//
+// void _typeParameterList(LinkedNodeBuilder node) {
+// for (var typeParameter in node.typeParameterList_typeParameters) {
+// _node(typeParameter);
+// }
+// }
+//
+// void _variableDeclarationList(LinkedNodeBuilder node) {
+// var typeNode = node.variableDeclarationList_type;
+// if (typeNode != null) {
+// _node(typeNode);
+// typesToBuild.declarations.add(node);
+// }
+// }
+//
+// void _withClause(LinkedNodeBuilder node) {
+// if (node == null) return;
+//
+// _typeNameList(node.withClause_mixinTypes);
+// }
+//
+// /// Enter the type parameters scope, visit them, and run [f].
+// void _withTypeParameters(LinkedNode typeParameterList, void f()) {
+// if (typeParameterList == null) {
+// f();
+// return;
+// }
+//
+// scope = Scope(this.scope, {});
+//
+// var containerRef = this.reference.getChild('@typeParameter');
+// var typeParameters = typeParameterList.typeParameterList_typeParameters;
+// for (var typeParameter in typeParameters) {
+// var name = unit.context.getSimpleName(typeParameter.typeParameter_name);
+// var reference = containerRef.getChild(name);
+// reference.node = typeParameter;
+// scope.declare(name, reference);
+// }
+//
+// _node(typeParameterList);
+// f();
+//
+// if (typeParameterList != null) {
+// scope = scope.parent;
+// }
+// }
+//}
/// Recursive visitor of [LinkedNode]s that resolves explicit type annotations
/// in outlines. This includes resolving element references in identifiers
@@ -19,445 +515,461 @@
/// the corresponding type set (so, if there is an explicit type annotation,
/// the type is set, otherwise we keep it empty, so we will attempt to infer
/// it later).
-class ReferenceResolver {
- final LinkingBundleContext linkingBundleContext;
- final UnitBuilder unit;
-
- /// TODO(scheglov) Update scope with local scopes (formal / type parameters).
- Scope scope;
+class ReferenceResolver extends ThrowingAstVisitor<void> {
+ final LinkingBundleContext linkingContext;
+ final NodesToBuildType nodesToBuildType;
+ final LinkedElementFactory elementFactory;
+ final LibraryElement _libraryElement;
+ final Reference unitReference;
+ final bool nnbd;
Reference reference;
+ Scope scope;
ReferenceResolver(
- this.linkingBundleContext,
- this.unit,
+ this.linkingContext,
+ this.nodesToBuildType,
+ this.elementFactory,
+ this._libraryElement,
+ this.unitReference,
+ this.nnbd,
this.scope,
- this.reference,
- );
+ ) : reference = unitReference;
- LinkedNodeTypeBuilder get _dynamicType {
- return LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.dynamic_,
- );
- }
+ @override
+ void visitBlockFunctionBody(BlockFunctionBody node) {}
- void resolve() {
- _node(unit.node);
- }
+ @override
+ void visitClassDeclaration(ClassDeclaration node) {
+ var outerScope = scope;
+ var outerReference = reference;
- void _classDeclaration(LinkedNodeBuilder node) {
- var name = unit.context.getUnitMemberName(node);
+ var name = node.name.name;
reference = reference.getChild('@class').getChild(name);
- var typeParameters = node.classOrMixinDeclaration_typeParameters;
- _withTypeParameters(typeParameters, () {
- var extendsClause = node.classDeclaration_extendsClause;
- if (extendsClause != null) {
- _typeName(extendsClause.extendsClause_superclass);
- }
+ ClassElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = new TypeParameterScope(scope, element);
+ scope = new ClassScope(scope, element);
+ LinkingNodeContext(node, scope);
- _nodeList(
- node.classDeclaration_withClause?.withClause_mixinTypes,
- );
+ node.typeParameters?.accept(this);
+ node.extendsClause?.accept(this);
+ node.implementsClause?.accept(this);
+ node.withClause?.accept(this);
+ node.members.accept(this);
+ nodesToBuildType.addDeclaration(node);
- _nodeList(
- node.classOrMixinDeclaration_implementsClause
- ?.implementsClause_interfaces,
- );
-
- for (var field in node.classOrMixinDeclaration_members) {
- if (field.kind != LinkedNodeKind.constructorDeclaration) {
- _node(field);
- }
- }
- for (var field in node.classOrMixinDeclaration_members) {
- if (field.kind == LinkedNodeKind.constructorDeclaration) {
- _node(field);
- }
- }
- });
-
- reference = reference.parent.parent;
+ scope = outerScope;
+ reference = outerReference;
}
- void _classTypeAlias(LinkedNodeBuilder node) {
- var name = unit.context.getUnitMemberName(node);
+ @override
+ void visitClassTypeAlias(ClassTypeAlias node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var name = node.name.name;
reference = reference.getChild('@class').getChild(name);
- var typeParameters = node.classTypeAlias_typeParameters;
- _withTypeParameters(typeParameters, () {
- var superclass = node.classTypeAlias_superclass;
- if (superclass != null) {
- _typeName(superclass);
- }
+ ClassElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = new TypeParameterScope(scope, element);
+ scope = new ClassScope(scope, element);
+ LinkingNodeContext(node, scope);
- _nodeList(
- node.classTypeAlias_withClause?.withClause_mixinTypes,
- );
+ node.typeParameters?.accept(this);
+ node.superclass?.accept(this);
+ node.withClause?.accept(this);
+ node.implementsClause?.accept(this);
+ nodesToBuildType.addDeclaration(node);
- _nodeList(
- node.classTypeAlias_implementsClause?.implementsClause_interfaces,
- );
- });
-
- reference = reference.parent.parent;
+ scope = outerScope;
+ reference = outerReference;
}
- void _compilationUnit(LinkedNodeBuilder node) {
- _nodeList(node.compilationUnit_directives);
- _nodeList(node.compilationUnit_declarations);
+ @override
+ void visitCompilationUnit(CompilationUnit node) {
+ LinkingNodeContext(node, scope);
+ node.declarations.accept(this);
}
- void _constructorDeclaration(LinkedNodeBuilder node) {
- _node(node.constructorDeclaration_parameters);
- }
+ @override
+ void visitConstructorDeclaration(ConstructorDeclaration node) {
+ var outerScope = scope;
+ var outerReference = reference;
- void _enumConstantDeclaration(LinkedNodeBuilder node) {}
+ var name = node.name?.name ?? '';
+ reference = reference.getChild('@constructor').getChild(name);
- void _enumDeclaration(LinkedNodeBuilder node) {
- _nodeList(node.enumDeclaration_constants);
- }
-
- void _fieldDeclaration(LinkedNodeBuilder node) {
- _node(node.fieldDeclaration_fields);
- }
-
- void _fieldFormalParameter(LinkedNodeBuilder node) {
- var typeNode = node.fieldFormalParameter_type;
- if (typeNode != null) {
- _node(typeNode);
- node.fieldFormalParameter_type2 = _getTypeAnnotationType(typeNode);
- }
-
- var formalParameters = node.fieldFormalParameter_formalParameters;
- if (formalParameters != null) {
- _node(formalParameters);
- throw 'incomplete';
- }
- }
-
- void _formalParameters(LinkedNodeBuilder node) {
- for (var parameter in node.formalParameterList_parameters) {
- _node(parameter);
- }
- }
-
- void _functionDeclaration(LinkedNodeBuilder node) {
- var name = unit.context.getUnitMemberName(node);
- reference = reference.getChild('@function').getChild(name);
-
- var function = node.functionDeclaration_functionExpression;
- var typeParameters = function.functionExpression_typeParameters;
- _withTypeParameters(typeParameters, () {
- var returnType = node.functionDeclaration_returnType;
- if (returnType != null) {
- _node(returnType);
- node.functionDeclaration_returnType2 =
- _getTypeAnnotationType(returnType);
- } else {
- node.functionDeclaration_returnType2 = _dynamicType;
- }
-
- _node(function.functionExpression_formalParameters);
- });
-
- reference = reference.parent.parent;
- }
-
- void _functionExpression(LinkedNodeBuilder node) {
- var typeParameters = node.functionExpression_typeParameters;
- _withTypeParameters(typeParameters, () {
- _node(node.functionExpression_formalParameters);
- });
- }
-
- void _functionTypeAlias(LinkedNodeBuilder node) {
- var name = unit.context.getUnitMemberName(node);
- reference = reference.getChild('@typeAlias').getChild(name);
-
- var typeParameters = node.functionTypeAlias_typeParameters;
- _withTypeParameters(typeParameters, () {
- var returnType = node.functionTypeAlias_returnType;
- if (returnType != null) {
- _node(returnType);
- node.functionTypeAlias_returnType2 = _getTypeAnnotationType(returnType);
- } else {
- node.functionTypeAlias_returnType2 = _dynamicType;
- }
-
- _node(node.functionTypeAlias_formalParameters);
- });
-
- reference = reference.parent.parent;
- }
-
- void _genericFunctionType(LinkedNodeBuilder node) {
- reference = reference.getChild('@function');
-
- var name = '${reference.numOfChildren}';
- reference = reference.getChild(name);
-
- var typeParameters = node.genericFunctionType_typeParameters;
- _withTypeParameters(typeParameters, () {
- var returnType = node.genericFunctionType_returnType;
- if (returnType != null) {
- _node(returnType);
- node.genericFunctionType_returnType2 =
- _getTypeAnnotationType(returnType);
- } else {
- node.genericFunctionType_returnType2 = _dynamicType;
- }
-
- _node(node.genericFunctionType_formalParameters);
- });
-
- reference = reference.parent.parent;
- }
-
- void _genericTypeAlias(LinkedNodeBuilder node) {
- var name = unit.context.getSimpleName(
- node.namedCompilationUnitMember_name,
+ var element = ConstructorElementImpl.forLinkedNode(
+ outerReference.element,
+ reference,
+ node,
);
+
+ var functionScope = FunctionScope(scope, element);
+ functionScope.defineParameters();
+ LinkingNodeContext(node, functionScope);
+
+ node.parameters?.accept(this);
+
+ scope = outerScope;
+ reference = outerReference;
+ }
+
+ @override
+ void visitDefaultFormalParameter(DefaultFormalParameter node) {
+ node.parameter.accept(this);
+ }
+
+ @override
+ void visitEnumDeclaration(EnumDeclaration node) {}
+
+ @override
+ void visitExpressionFunctionBody(ExpressionFunctionBody node) {}
+
+ @override
+ void visitExtendsClause(ExtendsClause node) {
+ node.superclass.accept(this);
+ }
+
+ @override
+ void visitFieldDeclaration(FieldDeclaration node) {
+ node.fields.accept(this);
+ }
+
+ @override
+ void visitFieldFormalParameter(FieldFormalParameter node) {
+ node.type?.accept(this);
+ node.parameters?.accept(this);
+ nodesToBuildType.addDeclaration(node);
+ }
+
+ @override
+ void visitFormalParameterList(FormalParameterList node) {
+ node.parameters.accept(this);
+ }
+
+ @override
+ void visitFunctionDeclaration(FunctionDeclaration node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var container = '@function';
+ var propertyKeyword = node.propertyKeyword?.keyword;
+ if (propertyKeyword == Keyword.GET) {
+ container = '@getter';
+ } else if (propertyKeyword == Keyword.SET) {
+ container = '@setter';
+ }
+
+ var name = node.name.name;
+ reference = reference.getChild(container).getChild(name);
+
+ ExecutableElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.functionExpression.typeParameters);
+ scope = new FunctionScope(scope, element);
+ LinkingNodeContext(node, scope);
+
+ node.returnType?.accept(this);
+ node.functionExpression.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
+ }
+
+ @override
+ void visitFunctionExpression(FunctionExpression node) {
+ node.typeParameters?.accept(this);
+ node.parameters?.accept(this);
+ }
+
+ @override
+ void visitFunctionTypeAlias(FunctionTypeAlias node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var name = node.name.name;
reference = reference.getChild('@typeAlias').getChild(name);
- var typeParameters = node.genericTypeAlias_typeParameters;
- _withTypeParameters(typeParameters, () {
- _node(node.genericTypeAlias_functionType);
- });
+ GenericTypeAliasElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = FunctionTypeScope(outerScope, element);
- reference = reference.parent.parent;
+ node.returnType?.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
}
- LinkedNodeTypeBuilder _getTypeAnnotationType(LinkedNodeBuilder node) {
- var kind = node.kind;
- if (kind == LinkedNodeKind.typeName) {
- return node.typeName_type;
- } else {
- throw UnimplementedError('$kind');
- }
- }
+ @override
+ void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ var outerScope = scope;
+ var outerReference = reference;
- void _importDirective(LinkedNodeBuilder node) {}
+ var name = node.identifier.name;
+ reference = reference.getChild('@parameter').getChild(name);
+ reference.node2 = node;
- void _libraryDirective(LinkedNodeBuilder node) {}
+ var element = ParameterElementImpl.forLinkedNode(
+ outerReference.element,
+ reference,
+ node,
+ );
+ node.identifier.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
- void _methodDeclaration(LinkedNodeBuilder node) {
- var name = unit.context.getMethodName(node);
- reference = reference.getChild('@method').getChild(name);
-
- var typeParameters = node.methodDeclaration_typeParameters;
- _withTypeParameters(typeParameters, () {
- var returnType = node.methodDeclaration_returnType;
- if (returnType != null) {
- _node(returnType);
- node.methodDeclaration_returnType2 = _getTypeAnnotationType(returnType);
- }
-
- _node(node.methodDeclaration_formalParameters);
- });
-
- reference = reference.parent.parent;
- }
-
- void _node(LinkedNodeBuilder node) {
- if (node == null) return;
-
- if (node.kind == LinkedNodeKind.classDeclaration) {
- _classDeclaration(node);
- } else if (node.kind == LinkedNodeKind.classTypeAlias) {
- _classTypeAlias(node);
- } else if (node.kind == LinkedNodeKind.compilationUnit) {
- _compilationUnit(node);
- } else if (node.kind == LinkedNodeKind.constructorDeclaration) {
- _constructorDeclaration(node);
- } else if (node.kind == LinkedNodeKind.defaultFormalParameter) {
- _node(node.defaultFormalParameter_parameter);
- } else if (node.kind == LinkedNodeKind.enumDeclaration) {
- _enumDeclaration(node);
- } else if (node.kind == LinkedNodeKind.enumConstantDeclaration) {
- _enumConstantDeclaration(node);
- } else if (node.kind == LinkedNodeKind.fieldDeclaration) {
- _fieldDeclaration(node);
- } else if (node.kind == LinkedNodeKind.fieldFormalParameter) {
- _fieldFormalParameter(node);
- } else if (node.kind == LinkedNodeKind.formalParameterList) {
- _formalParameters(node);
- } else if (node.kind == LinkedNodeKind.functionDeclaration) {
- _functionDeclaration(node);
- } else if (node.kind == LinkedNodeKind.functionExpression) {
- _functionExpression(node);
- } else if (node.kind == LinkedNodeKind.functionTypeAlias) {
- _functionTypeAlias(node);
- } else if (node.kind == LinkedNodeKind.genericFunctionType) {
- _genericFunctionType(node);
- } else if (node.kind == LinkedNodeKind.genericTypeAlias) {
- _genericTypeAlias(node);
- } else if (node.kind == LinkedNodeKind.importDirective) {
- _importDirective(node);
- } else if (node.kind == LinkedNodeKind.libraryDirective) {
- _libraryDirective(node);
- } else if (node.kind == LinkedNodeKind.methodDeclaration) {
- _methodDeclaration(node);
- } else if (node.kind == LinkedNodeKind.simpleFormalParameter) {
- _simpleFormalParameter(node);
- } else if (node.kind == LinkedNodeKind.topLevelVariableDeclaration) {
- _topLevelVariableDeclaration(node);
- } else if (node.kind == LinkedNodeKind.typeArgumentList) {
- _typeArgumentList(node);
- } else if (node.kind == LinkedNodeKind.typeName) {
- _typeName(node);
- } else if (node.kind == LinkedNodeKind.typeParameter) {
- _typeParameter(node);
- } else if (node.kind == LinkedNodeKind.typeParameterList) {
- _typeParameterList(node);
- } else if (node.kind == LinkedNodeKind.variableDeclarationList) {
- _variableDeclarationList(node);
- } else {
- // TODO(scheglov) implement
- throw UnimplementedError('${node.kind}');
- }
- }
-
- void _nodeList(List<LinkedNode> nodeList) {
- if (nodeList == null) return;
-
- for (var i = 0; i < nodeList.length; ++i) {
- var node = nodeList[i];
- _node(node);
- }
- }
-
- void _simpleFormalParameter(LinkedNodeBuilder node) {
- var typeNode = node.simpleFormalParameter_type;
- if (typeNode != null) {
- _node(typeNode);
- node.simpleFormalParameter_type2 = _getTypeAnnotationType(typeNode);
- } else {
- // TODO(scheglov) might be inferred
- node.simpleFormalParameter_type2 = _dynamicType;
+ scope = new EnclosedScope(scope);
+ for (var typeParameter in element.typeParameters) {
+ scope.define(typeParameter);
}
- if (node.normalFormalParameter_covariantKeyword != 0) {
- node.normalFormalParameter_isCovariant = true;
- } else {
- // TODO(scheglov) might be inferred
+ node.returnType?.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
+ }
+
+ @override
+ void visitGenericFunctionType(GenericFunctionType node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var id = linkingContext.nextGenericFunctionTypeId();
+ LazyAst.setGenericFunctionTypeId(node, id);
+
+ var containerRef = unitReference.getChild('@genericFunctionType');
+ reference = containerRef.getChild('$id');
+
+ var element = GenericFunctionTypeElementImpl.forLinkedNode(
+ unitReference.element,
+ reference,
+ node,
+ );
+ (node as GenericFunctionTypeImpl).declaredElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = TypeParameterScope(outerScope, element);
+
+ node.returnType?.accept(this);
+ node.typeParameters?.accept(this);
+ node.parameters.accept(this);
+
+ var nullabilitySuffix = _getNullabilitySuffix(node.question != null);
+ var builder = FunctionTypeBuilder.of(node, nullabilitySuffix);
+ (node as GenericFunctionTypeImpl).type = builder;
+ nodesToBuildType.addTypeBuilder(builder);
+
+ scope = outerScope;
+ reference = outerReference;
+ }
+
+ @override
+ void visitGenericTypeAlias(GenericTypeAlias node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var name = node.name.name;
+ reference = reference.getChild('@typeAlias').getChild(name);
+
+ GenericTypeAliasElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = TypeParameterScope(outerScope, element);
+
+ node.typeParameters?.accept(this);
+ node.functionType?.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
+ }
+
+ @override
+ void visitImplementsClause(ImplementsClause node) {
+ node.interfaces.accept(this);
+ }
+
+ @override
+ void visitMethodDeclaration(MethodDeclaration node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var container = '@method';
+ var propertyKeyword = node.propertyKeyword?.keyword;
+ if (propertyKeyword == Keyword.GET) {
+ container = '@getter';
+ } else if (propertyKeyword == Keyword.SET) {
+ container = '@setter';
}
+
+ var name = node.name.name;
+ reference = reference.getChild(container).getChild(name);
+
+ var element = MethodElementImpl.forLinkedNode(
+ outerReference.element,
+ reference,
+ node,
+ );
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = new FunctionScope(scope, element);
+ LinkingNodeContext(node, scope);
+
+ node.returnType?.accept(this);
+ node.parameters?.accept(this);
+ node.typeParameters?.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
}
- void _topLevelVariableDeclaration(LinkedNodeBuilder node) {
- _node(node.topLevelVariableDeclaration_variableList);
+ @override
+ void visitMixinDeclaration(MixinDeclaration node) {
+ var outerScope = scope;
+ var outerReference = reference;
+
+ var name = node.name.name;
+ reference = reference.getChild('@mixin').getChild(name);
+
+ MixinElementImpl element = reference.element;
+ node.name.staticElement = element;
+ _createTypeParameterElements(node.typeParameters);
+ scope = new TypeParameterScope(scope, element);
+ scope = new ClassScope(scope, element);
+ LinkingNodeContext(node, scope);
+
+ node.typeParameters?.accept(this);
+ node.onClause?.accept(this);
+ node.implementsClause?.accept(this);
+ node.members.accept(this);
+ nodesToBuildType.addDeclaration(node);
+
+ scope = outerScope;
+ reference = outerReference;
}
- void _typeArgumentList(LinkedNodeBuilder node) {
- for (var typeArgument in node.typeArgumentList_arguments) {
- _typeName(typeArgument);
- }
+ @override
+ void visitOnClause(OnClause node) {
+ node.superclassConstraints.accept(this);
}
- void _typeName(LinkedNodeBuilder node) {
- if (node == null) return;
-
- var identifier = node.typeName_name;
- if (identifier.kind == LinkedNodeKind.simpleIdentifier) {
- var name = unit.context.getSimpleName(identifier);
-
- if (name == 'void') {
- node.typeName_type = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.void_,
- );
- return;
- }
-
- var declaration = scope.lookup(name);
- if (declaration == null) {
- identifier.simpleIdentifier_element = 0;
- node.typeName_type = _dynamicType;
- return;
- }
-
- var reference = declaration.reference;
- var referenceIndex = linkingBundleContext.indexOfReference(reference);
- identifier.simpleIdentifier_element = referenceIndex;
-
- var typeArguments = const <LinkedNodeTypeBuilder>[];
- var typeArgumentList = node.typeName_typeArguments;
- if (typeArgumentList != null) {
- _node(typeArgumentList);
- typeArguments = typeArgumentList.typeArgumentList_arguments
- .map((node) => _getTypeAnnotationType(node))
- .toList();
- }
-
- if (reference.isClass) {
- node.typeName_type = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.interface,
- interfaceClass: referenceIndex,
- interfaceTypeArguments: typeArguments,
- );
- } else if (reference.isEnum) {
- node.typeName_type = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.interface,
- interfaceClass: referenceIndex,
- );
- } else if (reference.isTypeParameter) {
- node.typeName_type = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.typeParameter,
- typeParameterParameter: referenceIndex,
- );
- } else {
- // TODO(scheglov) set Object? keep unresolved?
- throw UnimplementedError();
- }
- } else {
- // TODO(scheglov) implement
- throw UnimplementedError();
- }
+ @override
+ void visitSimpleFormalParameter(SimpleFormalParameter node) {
+ node.type?.accept(this);
+ nodesToBuildType.addDeclaration(node);
}
- void _typeParameter(LinkedNodeBuilder node) {
- _node(node.typeParameter_bound);
- // TODO(scheglov) set Object bound if no explicit?
+ @override
+ void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
+ node.variables.accept(this);
}
- void _typeParameterList(LinkedNodeBuilder node) {
- for (var typeParameter in node.typeParameterList_typeParameters) {
- _node(typeParameter);
- }
+ @override
+ void visitTypeArgumentList(TypeArgumentList node) {
+ node.arguments.accept(this);
}
- void _variableDeclarationList(LinkedNodeBuilder node) {
- var typeNode = node.variableDeclarationList_type;
- if (typeNode != null) {
- _node(typeNode);
- for (var field in node.variableDeclarationList_variables) {
- field.variableDeclaration_type2 = _getTypeAnnotationType(typeNode);
- }
- }
- }
-
- /// Enter the type parameters scope, visit them, and run [f].
- void _withTypeParameters(LinkedNode typeParameterList, void f()) {
- if (typeParameterList == null) {
- f();
+ @override
+ void visitTypeName(TypeName node) {
+ var typeName = node.name;
+ if (typeName is SimpleIdentifier && typeName.name == 'void') {
+ node.type = VoidTypeImpl.instance;
return;
}
- scope = Scope(this.scope, {});
-
- var containerRef = this.reference.getChild('@typeParameter');
- var typeParameters = typeParameterList.typeParameterList_typeParameters;
- for (var typeParameter in typeParameters) {
- var name = unit.context.getSimpleName(typeParameter.typeParameter_name);
- var reference = containerRef.getChild(name);
- reference.node = typeParameter;
- scope.declare(name, Declaration(name, reference));
+ var element = scope.lookup(typeName, _libraryElement);
+ if (typeName is SimpleIdentifier) {
+ typeName.staticElement = element;
+ } else if (typeName is PrefixedIdentifier) {
+ typeName.identifier.staticElement = element;
+ SimpleIdentifier prefix = typeName.prefix;
+ prefix.staticElement = scope.lookup(prefix, _libraryElement);
}
- _node(typeParameterList);
- f();
+ node.typeArguments?.accept(this);
- if (typeParameterList != null) {
- scope = scope.parent;
+ var nullabilitySuffix = _getNullabilitySuffix(node.question != null);
+ if (element is TypeParameterElement) {
+ node.type = TypeParameterTypeImpl(
+ element,
+ nullabilitySuffix: nullabilitySuffix,
+ );
+ } else {
+ var builder = NamedTypeBuilder.of(
+ node,
+ element,
+ nullabilitySuffix,
+ );
+ node.type = builder;
+ nodesToBuildType.addTypeBuilder(builder);
+ }
+ }
+
+ @override
+ void visitTypeParameter(TypeParameter node) {
+ node.bound?.accept(this);
+ }
+
+ @override
+ void visitTypeParameterList(TypeParameterList node) {
+ node.typeParameters.accept(this);
+ }
+
+ @override
+ void visitVariableDeclarationList(VariableDeclarationList node) {
+ node.type?.accept(this);
+ nodesToBuildType.addDeclaration(node);
+ }
+
+ @override
+ void visitWithClause(WithClause node) {
+ node.mixinTypes.accept(this);
+ }
+
+ void _createTypeParameterElement(TypeParameter node) {
+ var outerReference = this.reference;
+ var containerRef = outerReference.getChild('@typeParameter');
+ var reference = containerRef.getChild(node.name.name);
+ reference.node2 = node;
+
+ var element = TypeParameterElementImpl.forLinkedNode(
+ outerReference.element,
+ reference,
+ node,
+ );
+ node.name.staticElement = element;
+ }
+
+ void _createTypeParameterElements(TypeParameterList typeParameterList) {
+ if (typeParameterList == null) return;
+
+ for (var typeParameter in typeParameterList.typeParameters) {
+ _createTypeParameterElement(typeParameter);
+ }
+ }
+
+ NullabilitySuffix _getNullabilitySuffix(bool hasQuestion) {
+ if (nnbd) {
+ if (hasQuestion) {
+ return NullabilitySuffix.question;
+ } else {
+ return NullabilitySuffix.none;
+ }
+ } else {
+ return NullabilitySuffix.star;
}
}
}
diff --git a/analyzer/lib/src/summary2/scope.dart b/analyzer/lib/src/summary2/scope.dart
index 30f7419..2af6ace 100644
--- a/analyzer/lib/src/summary2/scope.dart
+++ b/analyzer/lib/src/summary2/scope.dart
@@ -2,27 +2,27 @@
// 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/summary2/declaration.dart';
+import 'package:analyzer/src/summary2/reference.dart';
class Scope {
final Scope parent;
- final Map<String, Declaration> map;
+ final Map<String, Reference> map;
Scope(this.parent, this.map);
- Scope.top() : this(null, <String, Declaration>{});
+ Scope.top() : this(null, <String, Reference>{});
- void declare(String name, Declaration declaration) {
- map[name] = declaration;
+ void declare(String name, Reference reference) {
+ map[name] = reference;
}
- void forEach(f(String name, Declaration declaration)) {
+ void forEach(f(String name, Reference reference)) {
map.forEach(f);
}
- Declaration lookup(String name) {
- var declaration = map[name];
- if (declaration != null) return declaration;
+ Reference lookup(String name) {
+ var reference = map[name];
+ if (reference != null) return reference;
if (parent == null) return null;
return parent.lookup(name);
diff --git a/analyzer/lib/src/summary2/simply_bounded.dart b/analyzer/lib/src/summary2/simply_bounded.dart
new file mode 100644
index 0000000..e1bbe8a
--- /dev/null
+++ b/analyzer/lib/src/summary2/simply_bounded.dart
@@ -0,0 +1,320 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/summary/link.dart' as graph
+ show DependencyWalker, Node;
+import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/linked_bundle_context.dart';
+
+/// Compute simple-boundedness for all classes and generic types aliases in
+/// the source [libraryBuilders]. There might be dependencies between them,
+/// so they all should be processed simultaneously.
+void computeSimplyBounded(
+ LinkedBundleContext bundleContext,
+ Iterable<SourceLibraryBuilder> libraryBuilders,
+) {
+ var walker = SimplyBoundedDependencyWalker(bundleContext);
+ var nodes = <SimplyBoundedNode>[];
+ for (var libraryBuilder in libraryBuilders) {
+ for (var unit in libraryBuilder.element.units) {
+ for (var element in unit.functionTypeAliases) {
+ var node = walker.getNode(element);
+ nodes.add(node);
+ }
+ for (var element in unit.mixins) {
+ var node = walker.getNode(element);
+ nodes.add(node);
+ }
+ for (var element in unit.types) {
+ var node = walker.getNode(element);
+ nodes.add(node);
+ }
+ }
+ }
+
+ for (var node in nodes) {
+ if (!node.isEvaluated) {
+ walker.walk(node);
+ }
+ LazyAst.setSimplyBounded(node._node, node.isSimplyBounded);
+ }
+}
+
+/// The graph walker for evaluating whether types are simply bounded.
+class SimplyBoundedDependencyWalker
+ extends graph.DependencyWalker<SimplyBoundedNode> {
+ final LinkedBundleContext bundleContext;
+ final Map<Element, SimplyBoundedNode> nodeMap = Map.identity();
+
+ SimplyBoundedDependencyWalker(this.bundleContext);
+
+ @override
+ void evaluate(SimplyBoundedNode v) {
+ v._evaluate();
+ }
+
+ @override
+ void evaluateScc(List<SimplyBoundedNode> scc) {
+ for (var node in scc) {
+ node._markCircular();
+ }
+ }
+
+ SimplyBoundedNode getNode(Element element) {
+ var graphNode = nodeMap[element];
+ if (graphNode == null) {
+ var node = (element as ElementImpl).linkedNode;
+ if (node is ClassDeclaration) {
+ var parameters = node.typeParameters?.typeParameters;
+ graphNode = SimplyBoundedNode(
+ this,
+ node,
+ parameters ?? const <TypeParameter>[],
+ const <TypeAnnotation>[],
+ );
+ } else if (node is ClassTypeAlias) {
+ var parameters = node.typeParameters?.typeParameters;
+ graphNode = SimplyBoundedNode(
+ this,
+ node,
+ parameters ?? const <TypeParameter>[],
+ const <TypeAnnotation>[],
+ );
+ } else if (node is FunctionTypeAlias) {
+ var parameters = node.typeParameters?.typeParameters;
+ graphNode = SimplyBoundedNode(
+ this,
+ node,
+ parameters ?? const <TypeParameter>[],
+ _collectTypedefRhsTypes(node),
+ );
+ } else if (node is GenericTypeAlias) {
+ var parameters = node.typeParameters?.typeParameters;
+ graphNode = SimplyBoundedNode(
+ this,
+ node,
+ parameters ?? const <TypeParameter>[],
+ _collectTypedefRhsTypes(node),
+ );
+ } else if (node is MixinDeclaration) {
+ var parameters = node.typeParameters?.typeParameters;
+ graphNode = SimplyBoundedNode(
+ this,
+ node,
+ parameters ?? const <TypeParameter>[],
+ const <TypeAnnotation>[],
+ );
+ } else {
+ throw UnimplementedError('(${node.runtimeType}) $node');
+ }
+ nodeMap[element] = graphNode;
+ }
+ return graphNode;
+ }
+
+ /// Collects all the type references appearing on the "right hand side" of a
+ /// typedef.
+ ///
+ /// The "right hand side" of a typedef is the type appearing after the "="
+ /// in a new style typedef declaration, or for an old style typedef
+ /// declaration, the type that *would* appear after the "=" if it were
+ /// converted to a new style typedef declaration. This means that type
+ /// parameter declarations and their bounds are not included.
+ static List<TypeAnnotation> _collectTypedefRhsTypes(AstNode node) {
+ if (node is FunctionTypeAlias) {
+ var collector = _TypeCollector();
+ collector.addType(node.returnType);
+ collector.visitParameters(node.parameters);
+ return collector.types;
+ } else if (node is GenericTypeAlias) {
+ var functionType = node.functionType;
+ if (functionType != null) {
+ var collector = _TypeCollector();
+ collector.addType(functionType.returnType);
+ collector.visitParameters(functionType.parameters);
+ return collector.types;
+ } else {
+ return const <TypeAnnotation>[];
+ }
+ } else {
+ throw StateError('(${node.runtimeType}) $node');
+ }
+ }
+}
+
+/// The graph node used to construct the dependency graph for evaluating
+/// whether types are simply bounded.
+class SimplyBoundedNode extends graph.Node<SimplyBoundedNode> {
+ final SimplyBoundedDependencyWalker _walker;
+ final AstNode _node;
+
+ /// The type parameters of the type whose simple-boundedness we check.
+ final List<TypeParameter> _typeParameters;
+
+ /// If the type whose simple-boundedness we check is a typedef, the types
+ /// appearing in its "right hand side".
+ final List<TypeAnnotation> _rhsTypes;
+
+ @override
+ bool isEvaluated = false;
+
+ /// After execution of [_evaluate], indicates whether the type is
+ /// simply bounded.
+ ///
+ /// Prior to execution of [computeDependencies], `true`.
+ ///
+ /// Between execution of [computeDependencies] and [_evaluate], `true`
+ /// indicates that the type is simply bounded only if all of its dependencies
+ /// are simply bounded; `false` indicates that the type is not simply bounded.
+ bool isSimplyBounded = true;
+
+ SimplyBoundedNode(
+ this._walker,
+ this._node,
+ this._typeParameters,
+ this._rhsTypes,
+ );
+
+ @override
+ List<SimplyBoundedNode> computeDependencies() {
+ var dependencies = <SimplyBoundedNode>[];
+ for (var typeParameter in _typeParameters) {
+ var bound = typeParameter.bound;
+ if (bound != null) {
+ if (!_visitType(dependencies, bound, false)) {
+ // Note: we might consider setting isEvaluated=true here to prevent an
+ // unnecessary call to SimplyBoundedDependencyWalker.evaluate.
+ // However, we'd have to be careful to make sure this doesn't violate
+ // an invariant of the DependencyWalker algorithm, since normally it
+ // only expects isEvaluated to change during a call to .evaluate or
+ // .evaluateScc.
+ isSimplyBounded = false;
+ return const [];
+ }
+ }
+ }
+ for (var type in _rhsTypes) {
+ if (!_visitType(dependencies, type, true)) {
+ // Note: we might consider setting isEvaluated=true here to prevent an
+ // unnecessary call to SimplyBoundedDependencyWalker.evaluate.
+ // However, we'd have to be careful to make sure this doesn't violate
+ // an invariant of the DependencyWalker algorithm, since normally it
+ // only expects isEvaluated to change during a call to .evaluate or
+ // .evaluateScc.
+ isSimplyBounded = false;
+ return const [];
+ }
+ }
+ return dependencies;
+ }
+
+ void _evaluate() {
+ for (var dependency in graph.Node.getDependencies(this)) {
+ if (!dependency.isSimplyBounded) {
+ isSimplyBounded = false;
+ break;
+ }
+ }
+ isEvaluated = true;
+ }
+
+ void _markCircular() {
+ isSimplyBounded = false;
+ isEvaluated = true;
+ }
+
+ /// Visits the type specified by [type], storing the [SimplyBoundedNode] for
+ /// any types it references in [dependencies].
+ ///
+ /// Return `false` if a type that is known to be not simply bound is found.
+ ///
+ /// Return `false` if a reference to a type parameter is found, and
+ /// [allowTypeParameters] is `false`.
+ ///
+ /// If `false` is returned, further visiting is short-circuited.
+ ///
+ /// Otherwise `true` is returned.
+ bool _visitType(List<SimplyBoundedNode> dependencies, TypeAnnotation type,
+ bool allowTypeParameters) {
+ if (type == null) return true;
+
+ if (type is TypeName) {
+ var element = type.name.staticElement;
+
+ if (element is TypeParameterElement) {
+ return allowTypeParameters;
+ }
+
+ var arguments = type.typeArguments;
+ if (arguments == null) {
+ var graphNode = _walker.nodeMap[element];
+
+ // If not a node being linked, then the flag is already set.
+ if (graphNode == null) {
+ if (element is TypeParameterizedElement) {
+ return element.isSimplyBounded;
+ }
+ return true;
+ }
+
+ dependencies.add(graphNode);
+ } else {
+ for (var argument in arguments.arguments) {
+ if (!_visitType(dependencies, argument, allowTypeParameters)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ if (type is GenericFunctionType) {
+ var collector = _TypeCollector();
+ collector.addType(type.returnType);
+ collector.visitParameters(type.parameters);
+ for (var type in collector.types) {
+ if (!_visitType(dependencies, type, allowTypeParameters)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ throw UnimplementedError('(${type.runtimeType}) $type');
+ }
+}
+
+/// Helper for collecting type annotations.
+class _TypeCollector {
+ final List<TypeAnnotation> types = [];
+
+ void addType(TypeAnnotation type) {
+ if (type != null) {
+ types.add(type);
+ }
+ }
+
+ void visitParameter(FormalParameter node) {
+ if (node is DefaultFormalParameter) {
+ visitParameter(node.parameter);
+ } else if (node is FunctionTypedFormalParameter) {
+ addType(node.returnType);
+ visitParameters(node.parameters);
+ } else if (node is SimpleFormalParameter) {
+ addType(node.type);
+ } else {
+ throw UnimplementedError('(${node.runtimeType}) $node');
+ }
+ }
+
+ void visitParameters(FormalParameterList parameterList) {
+ for (var parameter in parameterList.parameters) {
+ visitParameter(parameter);
+ }
+ }
+}
diff --git a/analyzer/lib/src/summary2/tokens_context.dart b/analyzer/lib/src/summary2/tokens_context.dart
index 36b9d5a..eb8f654 100644
--- a/analyzer/lib/src/summary2/tokens_context.dart
+++ b/analyzer/lib/src/summary2/tokens_context.dart
@@ -4,15 +4,9 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/tokens_writer.dart';
-/// The context for reading or writing tokens.
-///
-/// Tokens cannot be compared, so tokens for [indexOfToken] must be previously
-/// received from [tokenOfIndex], or the context must be created from a
-/// [TokensResult] (the result of writing previously parsed tokens).
+/// The context for reading tokens.
class TokensContext {
final UnlinkedTokens _tokens;
final List<Token> _indexToToken;
@@ -22,40 +16,25 @@
: _indexToToken = List<Token>(_tokens.type.length),
_tokenToIndex = Map.identity();
- TokensContext.fromResult(
- this._tokens, this._indexToToken, this._tokenToIndex);
-
- /// TODO(scheglov) Not used yet, maybe remove.
- int addSyntheticToken(
- UnlinkedTokenKind kind, UnlinkedTokenType type, String lexeme) {
- var index = _tokens.kind.length;
- UnlinkedTokensBuilder tokens = _tokens;
- tokens.kind.add(kind);
- tokens.lexeme.add(lexeme);
- tokens.offset.add(0);
- tokens.length.add(0);
- tokens.type.add(type);
- tokens.next.add(0);
- tokens.endGroup.add(0);
- tokens.precedingComment.add(0);
- tokens.isSynthetic.add(true);
- return index;
- }
-
- int indexOfToken(Token token) {
- if (token == null) return 0;
-
- var index = _tokenToIndex[token];
- if (index == null) {
- throw StateError('Unexpected token: $token');
- }
- return index;
- }
-
String lexeme(int index) {
return _tokens.lexeme[index];
}
+ void linkTokens(Token from, Token to) {
+ var fromIndex = _tokenToIndex[from];
+ var toIndex = _tokenToIndex[to];
+ Token prevToken = null;
+ for (var index = fromIndex; index <= toIndex && index != 0;) {
+ var token = _indexToToken[index];
+ token ??= tokenOfIndex(index);
+
+ prevToken?.next = token;
+
+ prevToken = token;
+ index = _tokens.next[index];
+ }
+ }
+
int offset(int index) {
return _tokens.offset[index];
}
@@ -70,33 +49,39 @@
case UnlinkedTokenKind.nothing:
return null;
case UnlinkedTokenKind.comment:
- return CommentToken(
+ token = CommentToken(
_binaryToAstTokenType(_tokens.type[index]),
_tokens.lexeme[index],
_tokens.offset[index],
);
+ break;
case UnlinkedTokenKind.keyword:
- return KeywordToken(
+ token = KeywordToken(
_binaryToAstTokenType(_tokens.type[index]),
_tokens.offset[index],
_getCommentToken(_tokens.precedingComment[index]),
);
+ break;
case UnlinkedTokenKind.simple:
- return SimpleToken(
+ token = SimpleToken(
_binaryToAstTokenType(_tokens.type[index]),
_tokens.offset[index],
_getCommentToken(_tokens.precedingComment[index]),
);
+ break;
case UnlinkedTokenKind.string:
- return StringToken(
+ token = StringToken(
_binaryToAstTokenType(_tokens.type[index]),
_tokens.lexeme[index],
_tokens.offset[index],
_getCommentToken(_tokens.precedingComment[index]),
);
+ break;
default:
throw UnimplementedError('Token kind: $kind');
}
+ _indexToToken[index] = token;
+ _tokenToIndex[token] = index;
}
return token;
}
@@ -146,6 +131,8 @@
return TokenType.BANG;
case UnlinkedTokenType.BANG_EQ:
return TokenType.BANG_EQ;
+ case UnlinkedTokenType.BANG_EQ_EQ:
+ return TokenType.BANG_EQ_EQ;
case UnlinkedTokenType.BAR:
return TokenType.BAR;
case UnlinkedTokenType.BAR_BAR:
@@ -200,6 +187,8 @@
return TokenType.EQ;
case UnlinkedTokenType.EQ_EQ:
return TokenType.EQ_EQ;
+ case UnlinkedTokenType.EQ_EQ_EQ:
+ return TokenType.EQ_EQ_EQ;
case UnlinkedTokenType.EXPORT:
return Keyword.EXPORT;
case UnlinkedTokenType.EXTENDS:
@@ -230,6 +219,10 @@
return TokenType.GT_GT;
case UnlinkedTokenType.GT_GT_EQ:
return TokenType.GT_GT_EQ;
+ case UnlinkedTokenType.GT_GT_GT:
+ return TokenType.GT_GT_GT;
+ case UnlinkedTokenType.GT_GT_GT_EQ:
+ return TokenType.GT_GT_GT_EQ;
case UnlinkedTokenType.HASH:
return TokenType.HASH;
case UnlinkedTokenType.HEXADECIMAL:
@@ -256,6 +249,8 @@
return Keyword.INTERFACE;
case UnlinkedTokenType.IS:
return TokenType.IS;
+ case UnlinkedTokenType.LATE:
+ return Keyword.LATE;
case UnlinkedTokenType.LIBRARY:
return Keyword.LIBRARY;
case UnlinkedTokenType.LT:
@@ -324,6 +319,8 @@
return TokenType.QUESTION_QUESTION;
case UnlinkedTokenType.QUESTION_QUESTION_EQ:
return TokenType.QUESTION_QUESTION_EQ;
+ case UnlinkedTokenType.REQUIRED:
+ return Keyword.REQUIRED;
case UnlinkedTokenType.RETHROW:
return Keyword.RETHROW;
case UnlinkedTokenType.RETURN:
diff --git a/analyzer/lib/src/summary2/tokens_writer.dart b/analyzer/lib/src/summary2/tokens_writer.dart
index 3a9e989..6668845 100644
--- a/analyzer/lib/src/summary2/tokens_writer.dart
+++ b/analyzer/lib/src/summary2/tokens_writer.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, 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.
@@ -6,25 +6,10 @@
import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/tokens_context.dart';
import 'package:meta/meta.dart';
-/// The result of writing a sequence of tokens.
-class TokensResult {
- final UnlinkedTokensBuilder tokens;
- final List<Token> _indexToToken;
- final Map<Token, int> _tokenToIndex;
-
- TokensResult(this.tokens, this._indexToToken, this._tokenToIndex);
-
- TokensContext toContext() {
- return TokensContext.fromResult(tokens, _indexToToken, _tokenToIndex);
- }
-}
-
class TokensWriter {
final UnlinkedTokensBuilder _tokens = UnlinkedTokensBuilder();
- final List<Token> _indexToToken = [];
final Map<Token, int> _tokenToIndex = Map.identity();
TokensWriter() {
@@ -40,8 +25,20 @@
);
}
+ UnlinkedTokensBuilder get tokensBuilder => _tokens;
+
+ int indexOfToken(Token token) {
+ if (token == null) return 0;
+
+ var index = _tokenToIndex[token];
+ if (index == null) {
+ throw StateError('Unexpected token: $token');
+ }
+ return index;
+ }
+
/// Write all the tokens from the [first] to the [last] inclusively.
- TokensResult writeTokens(Token first, Token last) {
+ void writeTokens(Token first, Token last) {
if (first is CommentToken) {
first = (first as CommentToken).parent;
}
@@ -67,8 +64,6 @@
if (token == last) break;
}
-
- return TokensResult(_tokens, _indexToToken, _tokenToIndex);
}
int _addToken(
@@ -91,8 +86,7 @@
_tokens.precedingComment.add(precedingComment);
_tokens.type.add(type);
- var index = _indexToToken.length;
- _indexToToken.add(token);
+ var index = _tokenToIndex.length;
_tokenToIndex[token] = index;
return index;
}
@@ -196,6 +190,8 @@
return UnlinkedTokenType.BANG;
} else if (type == TokenType.BANG_EQ) {
return UnlinkedTokenType.BANG_EQ;
+ } else if (type == TokenType.BANG_EQ_EQ) {
+ return UnlinkedTokenType.BANG_EQ_EQ;
} else if (type == TokenType.BAR) {
return UnlinkedTokenType.BAR;
} else if (type == TokenType.BAR_BAR) {
@@ -250,6 +246,8 @@
return UnlinkedTokenType.EQ;
} else if (type == TokenType.EQ_EQ) {
return UnlinkedTokenType.EQ_EQ;
+ } else if (type == TokenType.EQ_EQ_EQ) {
+ return UnlinkedTokenType.EQ_EQ_EQ;
} else if (type == Keyword.EXPORT) {
return UnlinkedTokenType.EXPORT;
} else if (type == Keyword.EXTENDS) {
@@ -280,6 +278,10 @@
return UnlinkedTokenType.GT_GT;
} else if (type == TokenType.GT_GT_EQ) {
return UnlinkedTokenType.GT_GT_EQ;
+ } else if (type == TokenType.GT_GT_GT) {
+ return UnlinkedTokenType.GT_GT_GT;
+ } else if (type == TokenType.GT_GT_GT_EQ) {
+ return UnlinkedTokenType.GT_GT_GT_EQ;
} else if (type == TokenType.HASH) {
return UnlinkedTokenType.HASH;
} else if (type == TokenType.HEXADECIMAL) {
@@ -306,6 +308,8 @@
return UnlinkedTokenType.INTERFACE;
} else if (type == TokenType.IS) {
return UnlinkedTokenType.IS;
+ } else if (type == Keyword.LATE) {
+ return UnlinkedTokenType.LATE;
} else if (type == Keyword.LIBRARY) {
return UnlinkedTokenType.LIBRARY;
} else if (type == TokenType.LT) {
@@ -374,6 +378,8 @@
return UnlinkedTokenType.QUESTION_QUESTION;
} else if (type == TokenType.QUESTION_QUESTION_EQ) {
return UnlinkedTokenType.QUESTION_QUESTION_EQ;
+ } else if (type == Keyword.REQUIRED) {
+ return UnlinkedTokenType.REQUIRED;
} else if (type == Keyword.RETHROW) {
return UnlinkedTokenType.RETHROW;
} else if (type == Keyword.RETURN) {
diff --git a/analyzer/lib/src/summary2/top_level_inference.dart b/analyzer/lib/src/summary2/top_level_inference.dart
index def0f8d..52b911f 100644
--- a/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/analyzer/lib/src/summary2/top_level_inference.dart
@@ -2,15 +2,24 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+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/element/builder.dart';
+import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart';
+import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary/link.dart' as graph
+ show DependencyWalker, Node;
import 'package:analyzer/src/summary2/ast_resolver.dart';
-import 'package:analyzer/src/summary2/builder/source_library_builder.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/link.dart';
-import 'package:analyzer/src/summary2/reference.dart';
+import 'package:analyzer/src/summary2/linking_node_scope.dart';
+import 'package:analyzer/src/task/strong_mode.dart';
DartType _dynamicIfNull(DartType type) {
if (type == null || type.isBottom || type.isDartCoreNull) {
@@ -19,158 +28,341 @@
return type;
}
+AstNode _getLinkedNode(Element element) {
+ return (element as ElementImpl).linkedNode;
+}
+
+/// Resolver for typed constant top-level variables and fields initializers.
+///
+/// Initializers of untyped variables are resolved during [TopLevelInference].
+class ConstantInitializersResolver {
+ final Linker linker;
+
+ LibraryElement _library;
+ Scope _scope;
+
+ ConstantInitializersResolver(this.linker);
+
+ DynamicTypeImpl get _dynamicType => DynamicTypeImpl.instance;
+
+ void perform() {
+ for (var builder in linker.builders.values) {
+ _library = builder.element;
+ for (var unitContext in builder.context.units) {
+ for (var unitMember in unitContext.unit.declarations) {
+ _scope = builder.libraryScope;
+ if (unitMember is TopLevelVariableDeclaration) {
+ _variableDeclarationList(unitMember.variables);
+ } else if (unitMember is ClassOrMixinDeclaration) {
+ _scope = LinkingNodeContext.get(unitMember).scope;
+ for (var classMember in unitMember.members) {
+ if (classMember is FieldDeclaration) {
+ _variableDeclarationList(classMember.fields);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void _variableDeclarationList(VariableDeclarationList node) {
+ if (node.isConst && node.type != null) {
+ for (var variable in node.variables) {
+ var initializer = variable.initializer;
+ if (initializer != null) {
+ var astResolver = AstResolver(linker, _library, _scope);
+ astResolver.resolve(initializer, doAstRewrite: true);
+ }
+ }
+ }
+ }
+}
+
class TopLevelInference {
final Linker linker;
- final Reference libraryRef;
- final UnitBuilder unit;
- TopLevelInference(this.linker, this.libraryRef, this.unit);
+ TopLevelInference(this.linker);
+
+ DynamicTypeImpl get _dynamicType => DynamicTypeImpl.instance;
void infer() {
- _inferFieldsTemporary();
+ var initializerInference = _InitializerInference(linker);
+ initializerInference.createNodes();
+
+ _performOverrideInference();
+ initializerInference.perform();
_inferConstructorFieldFormals();
}
void _inferConstructorFieldFormals() {
- _visitClassList((unitDeclaration) {
- var members = unitDeclaration.classOrMixinDeclaration_members;
+ for (var builder in linker.builders.values) {
+ for (var unit in builder.element.units) {
+ for (var class_ in unit.types) {
+ var fields = <String, DartType>{};
+ for (var field in class_.fields) {
+ if (field.isSynthetic) continue;
- var fields = <String, LinkedNodeType>{};
- _visitClassFields(unitDeclaration, (field) {
- var name = unit.context.getVariableName(field);
- var type = field.variableDeclaration_type2;
- if (type == null) {
- throw StateError('Field $name should have a type.');
- }
- fields[name] = type;
- });
-
- for (var member in members) {
- if (member.kind == LinkedNodeKind.constructorDeclaration) {
- for (var parameter in member.constructorDeclaration_parameters
- .formalParameterList_parameters) {
- if (parameter.kind == LinkedNodeKind.fieldFormalParameter &&
- parameter.fieldFormalParameter_type2 == null) {
- var name = unit.context.getSimpleName(
- parameter.normalFormalParameter_identifier,
- );
- var type = fields[name];
- if (type == null) {
- type = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.dynamic_,
- );
- }
- parameter.fieldFormalParameter_type2 = type;
+ var name = field.name;
+ var type = field.type;
+ if (type == null) {
+ throw StateError('Field $name should have a type.');
}
+ fields[name] ??= type;
}
- }
- }
- });
- }
- void _inferFieldsTemporary() {
- var unitDeclarations = unit.node.compilationUnit_declarations;
- for (LinkedNodeBuilder unitDeclaration in unitDeclarations) {
- if (unitDeclaration.kind == LinkedNodeKind.classDeclaration) {
- _visitClassFields(unitDeclaration, (field) {
- var name = unit.context.getVariableName(field);
- // TODO(scheglov) Use inheritance
- if (field.variableDeclaration_type2 == null) {
- field.variableDeclaration_type2 = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.dynamic_,
- );
- }
- });
+ for (var constructor in class_.constructors) {
+ for (var parameter in constructor.parameters) {
+ if (parameter is FieldFormalParameterElement) {
+ var node = _getLinkedNode(parameter);
+ if (node is DefaultFormalParameter) {
+ var defaultParameter = node as DefaultFormalParameter;
+ node = defaultParameter.parameter;
+ }
- var members = unitDeclaration.classOrMixinDeclaration_members;
- for (var member in members) {
- if (member.kind == LinkedNodeKind.methodDeclaration) {
- // TODO(scheglov) Use inheritance
- if (member.methodDeclaration_returnType2 == null) {
- if (unit.context.isSetter(member)) {
- member.methodDeclaration_returnType2 = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.void_,
- );
- } else {
- member.methodDeclaration_returnType2 = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.dynamic_,
- );
+ if (node is FieldFormalParameter &&
+ node.type == null &&
+ node.parameters == null) {
+ var name = parameter.name;
+ var type = fields[name] ?? _dynamicType;
+ LazyAst.setType(node, type);
+ }
}
}
}
}
- } else if (unitDeclaration.kind == LinkedNodeKind.functionDeclaration) {
- if (unit.context.isSetter(unitDeclaration)) {
- unitDeclaration.functionDeclaration_returnType2 =
- LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.void_,
- );
- }
- } else if (unitDeclaration.kind ==
- LinkedNodeKind.topLevelVariableDeclaration) {
- var variableList =
- unitDeclaration.topLevelVariableDeclaration_variableList;
- for (var variable in variableList.variableDeclarationList_variables) {
- // TODO(scheglov) infer in the correct order
- if (variable.variableDeclaration_type2 == null ||
- unit.context.isConst(variable)) {
- _inferVariableTypeFromInitializerTemporary(variable);
- }
- }
}
}
}
- void _inferVariableTypeFromInitializerTemporary(LinkedNodeBuilder node) {
- var unresolvedNode = node.variableDeclaration_initializer;
+ void _performOverrideInference() {
+ var inferrer = new InstanceMemberInferrer(
+ linker.typeProvider,
+ linker.inheritance,
+ );
+ for (var builder in linker.builders.values) {
+ for (var unit in builder.element.units) {
+ inferrer.inferCompilationUnit(unit);
+ }
+ }
+ }
+}
- if (unresolvedNode == null) {
- node.variableDeclaration_type2 = LinkedNodeTypeBuilder(
- kind: LinkedNodeTypeKind.dynamic_,
- );
- return;
+class _FunctionElementForLink_Initializer implements FunctionElementImpl {
+ final _InferenceNode _node;
+
+ @override
+ Element enclosingElement;
+
+ _FunctionElementForLink_Initializer(this._node);
+
+ @override
+ DartType get returnType {
+ if (!_node.isEvaluated) {
+ _node._walker.walk(_node);
+ }
+ return LazyAst.getType(_node._node);
+ }
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+class _InferenceDependenciesCollector extends RecursiveAstVisitor<void> {
+ final Set<PropertyInducingElement> _set = Set.identity();
+
+ @override
+ void visitSimpleIdentifier(SimpleIdentifier node) {
+ var element = node.staticElement;
+ if (element is PropertyAccessorElement && element.isGetter) {
+ _set.add(element.variable);
+ }
+ }
+}
+
+class _InferenceNode extends graph.Node<_InferenceNode> {
+ final _InferenceWalker _walker;
+ final LibraryElement _library;
+ final Scope _scope;
+ final PropertyInducingElementImpl _element;
+ final VariableDeclaration _node;
+
+ @override
+ bool isEvaluated = false;
+
+ _InferenceNode(
+ this._walker,
+ this._library,
+ this._scope,
+ this._element,
+ this._node,
+ );
+
+ bool get isImplicitlyTypedInstanceField {
+ VariableDeclarationList variables = _node.parent;
+ if (variables.type == null) {
+ var parent = variables.parent;
+ return parent is FieldDeclaration && !parent.isStatic;
+ }
+ return false;
+ }
+
+ @override
+ List<_InferenceNode> computeDependencies() {
+ _buildLocalElements();
+ _resolveInitializer();
+
+ var collector = _InferenceDependenciesCollector();
+ _node.initializer.accept(collector);
+
+ if (collector._set.isEmpty) {
+ return const <_InferenceNode>[];
}
- var expression = unit.context.readInitializer(node);
- astFactory.expressionFunctionBody(null, null, expression, null);
+ var dependencies = collector._set
+ .map(_walker.getNode)
+ .where((node) => node != null)
+ .toList();
- // TODO(scheglov) can be shared for the whole library
- var astResolver = AstResolver(linker, libraryRef);
+ for (var node in dependencies) {
+ if (node.isImplicitlyTypedInstanceField) {
+ LazyAst.setType(_node, DynamicTypeImpl.instance);
+ isEvaluated = true;
+ return const <_InferenceNode>[];
+ }
+ }
- var resolvedNode = astResolver.resolve(unit, expression);
- node.variableDeclaration_initializer = resolvedNode;
+ return dependencies;
+ }
- if (node.variableDeclaration_type2 == null) {
- var initializerType = expression.staticType;
+ void evaluate() {
+ _resolveInitializer();
+
+ if (LazyAst.getType(_node) == null) {
+ var initializerType = _node.initializer.staticType;
initializerType = _dynamicIfNull(initializerType);
+ LazyAst.setType(_node, initializerType);
+ }
- var linkingBundleContext = linker.linkingBundleContext;
- node.variableDeclaration_type2 = linkingBundleContext.writeType(
- initializerType,
- );
+ isEvaluated = true;
+ }
+
+ void markCircular(List<_InferenceNode> cycle) {
+ LazyAst.setType(_node, DynamicTypeImpl.instance);
+
+ var cycleNames = Set<String>();
+ for (var inferenceNode in cycle) {
+ var node = inferenceNode._node;
+ if (node is VariableDeclaration) {
+ cycleNames.add(node.name.name);
+ } else {
+ cycleNames.add('<unknown>');
+ }
+ }
+
+ LazyAst.setTypeInferenceError(
+ _node,
+ TopLevelInferenceErrorBuilder(
+ kind: TopLevelInferenceErrorKind.dependencyCycle,
+ arguments: cycleNames.toList(),
+ ),
+ );
+
+ isEvaluated = true;
+ }
+
+ void _buildLocalElements() {
+ var holder = ElementHolder();
+ _node.initializer.accept(LocalElementBuilder(holder, null));
+ _element.encloseElements(holder.functions);
+ }
+
+ void _resolveInitializer() {
+ var astResolver = AstResolver(_walker._linker, _library, _scope);
+ astResolver.resolve(_node.initializer, doAstRewrite: true);
+ }
+}
+
+class _InferenceWalker extends graph.DependencyWalker<_InferenceNode> {
+ final Linker _linker;
+ final Map<Element, _InferenceNode> _nodes = Map.identity();
+
+ _InferenceWalker(this._linker);
+
+ @override
+ void evaluate(_InferenceNode v) {
+ v.evaluate();
+ }
+
+ @override
+ void evaluateScc(List<_InferenceNode> scc) {
+ for (var node in scc) {
+ node.markCircular(scc);
}
}
- void _visitClassFields(
- LinkedNode class_, void Function(LinkedNodeBuilder) f) {
- var members = class_.classOrMixinDeclaration_members;
+ _InferenceNode getNode(Element element) {
+ return _nodes[element];
+ }
- for (var member in members) {
- if (member.kind == LinkedNodeKind.fieldDeclaration) {
- var variableList = member.fieldDeclaration_fields;
- for (var field in variableList.variableDeclarationList_variables) {
- f(field);
+ void walkNodes() {
+ for (var node in _nodes.values) {
+ if (!node.isEvaluated) {
+ walk(node);
+ }
+ }
+ }
+}
+
+class _InitializerInference {
+ final Linker _linker;
+ final _InferenceWalker _walker;
+
+ LibraryElement _library;
+ Scope _scope;
+
+ _InitializerInference(this._linker) : _walker = _InferenceWalker(_linker);
+
+ void createNodes() {
+ for (var builder in _linker.builders.values) {
+ _library = builder.element;
+ for (var unit in _library.units) {
+ unit.types.forEach(_addClassElementFields);
+ unit.mixins.forEach(_addClassElementFields);
+
+ _scope = builder.libraryScope;
+ for (var element in unit.topLevelVariables) {
+ _addNode(element);
}
}
}
}
- void _visitClassList(void Function(LinkedNodeBuilder) f) {
- var unitDeclarations = unit.node.compilationUnit_declarations;
- for (LinkedNodeBuilder unitDeclaration in unitDeclarations) {
- if (unitDeclaration.kind == LinkedNodeKind.classDeclaration) {
- f(unitDeclaration);
- }
+ void perform() {
+ _walker.walkNodes();
+ }
+
+ void _addClassElementFields(ClassElement class_) {
+ var node = _getLinkedNode(class_);
+ _scope = LinkingNodeContext.get(node).scope;
+ for (var element in class_.fields) {
+ _addNode(element);
+ }
+ }
+
+ void _addNode(PropertyInducingElement element) {
+ if (element.isSynthetic) return;
+
+ VariableDeclaration node = _getLinkedNode(element);
+ if (LazyAst.getType(node) != null) return;
+
+ if (node.initializer != null) {
+ var inferenceNode =
+ _InferenceNode(_walker, _library, _scope, element, node);
+ _walker._nodes[element] = inferenceNode;
+ (element as PropertyInducingElementImpl).initializer =
+ _FunctionElementForLink_Initializer(inferenceNode);
+ } else {
+ LazyAst.setType(node, DynamicTypeImpl.instance);
}
}
}
diff --git a/analyzer/lib/src/summary2/type_alias.dart b/analyzer/lib/src/summary2/type_alias.dart
new file mode 100644
index 0000000..56ed006
--- /dev/null
+++ b/analyzer/lib/src/summary2/type_alias.dart
@@ -0,0 +1,118 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/link.dart';
+
+class TypeAliasSelfReferenceFinder {
+ /// Check typedefs and mark the ones having self references.
+ void perform(Linker linker) {
+ for (var builder in linker.builders.values) {
+ for (var unitContext in builder.context.units) {
+ for (var node in unitContext.unit.declarations) {
+ if (node is FunctionTypeAlias) {
+ var finder = _Finder(node);
+ finder.functionTypeAlias(node);
+ LazyFunctionTypeAlias.setHasSelfReference(
+ node,
+ finder.hasSelfReference,
+ );
+ } else if (node is GenericTypeAlias) {
+ var finder = _Finder(node);
+ finder.genericTypeAlias(node);
+ LazyGenericTypeAlias.setHasSelfReference(
+ node,
+ finder.hasSelfReference,
+ );
+ }
+ }
+ }
+ }
+ }
+}
+
+class _Finder {
+ final AstNode self;
+ bool hasSelfReference = false;
+
+ _Finder(this.self);
+
+ void functionTypeAlias(FunctionTypeAlias node) {
+ _typeParameterList(node.typeParameters);
+ _formalParameterList(node.parameters);
+ _visit(node.returnType);
+ }
+
+ void genericTypeAlias(GenericTypeAlias node) {
+ var functionType = node.functionType;
+ if (functionType != null) {
+ _typeParameterList(functionType.typeParameters);
+ _formalParameterList(functionType.parameters);
+ _visit(functionType.returnType);
+ }
+ }
+
+ void _argumentList(TypeArgumentList node) {
+ if (node != null) {
+ for (var argument in node.arguments) {
+ _visit(argument);
+ }
+ }
+ }
+
+ void _formalParameter(FormalParameter node) {
+ if (node is DefaultFormalParameter) {
+ _formalParameter(node.parameter);
+ } else if (node is FunctionTypedFormalParameter) {
+ _visit(node.returnType);
+ _formalParameterList(node.parameters);
+ } else if (node is SimpleFormalParameter) {
+ _visit(node.type);
+ }
+ }
+
+ void _formalParameterList(FormalParameterList node) {
+ for (var parameter in node.parameters) {
+ _formalParameter(parameter);
+ }
+ }
+
+ void _typeParameterList(TypeParameterList node) {
+ if (node != null) {
+ for (var parameter in node.typeParameters) {
+ _visit(parameter.bound);
+ }
+ }
+ }
+
+ void _visit(TypeAnnotation node) {
+ if (hasSelfReference) return;
+ if (node == null) return;
+
+ if (node is TypeName) {
+ var element = node.name.staticElement;
+ if (element is ElementImpl) {
+ var typeNode = element.linkedNode;
+ if (typeNode == self) {
+ hasSelfReference = true;
+ return;
+ }
+ if (typeNode is FunctionTypeAlias) {
+ functionTypeAlias(typeNode);
+ } else if (typeNode is GenericTypeAlias) {
+ genericTypeAlias(typeNode);
+ }
+ _argumentList(node.typeArguments);
+ }
+ } else if (node is GenericFunctionType) {
+ _typeParameterList(node.typeParameters);
+ _formalParameterList(node.parameters);
+ _visit(node.returnType);
+ } else {
+ throw UnimplementedError('(${node.runtimeType}) $node');
+ }
+ }
+}
diff --git a/analyzer/lib/src/summary2/type_builder.dart b/analyzer/lib/src/summary2/type_builder.dart
new file mode 100644
index 0000000..ffa1d14
--- /dev/null
+++ b/analyzer/lib/src/summary2/type_builder.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/element/type.dart';
+
+/// The builder for a [DartType] represented by a node.
+abstract class TypeBuilder implements DartType {
+ /// Build the type, and set it for the corresponding node.
+ /// Does nothing if the type has been already built.
+ ///
+ /// Return the built type.
+ DartType build();
+
+ noSuchMethod(Invocation invocation) {
+ return super.noSuchMethod(invocation);
+ }
+}
diff --git a/analyzer/lib/src/summary2/types_builder.dart b/analyzer/lib/src/summary2/types_builder.dart
new file mode 100644
index 0000000..0fa8a2b
--- /dev/null
+++ b/analyzer/lib/src/summary2/types_builder.dart
@@ -0,0 +1,352 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/generated/type_system.dart';
+import 'package:analyzer/src/summary2/default_types_builder.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
+import 'package:analyzer/src/summary2/type_builder.dart';
+
+class NodesToBuildType {
+ final List<AstNode> declarations = [];
+ final List<TypeBuilder> typeBuilders = [];
+
+ void addDeclaration(AstNode node) {
+ declarations.add(node);
+ }
+
+ void addTypeBuilder(TypeBuilder builder) {
+ typeBuilders.add(builder);
+ }
+}
+
+class TypesBuilder {
+ final Dart2TypeSystem typeSystem;
+
+ TypesBuilder(this.typeSystem);
+
+ DynamicTypeImpl get _dynamicType => DynamicTypeImpl.instance;
+
+ VoidTypeImpl get _voidType => VoidTypeImpl.instance;
+
+ /// Build types for all type annotations, and set types for declarations.
+ void build(NodesToBuildType nodes) {
+ DefaultTypesBuilder(typeSystem).build(nodes.declarations);
+
+ for (var builder in nodes.typeBuilders) {
+ builder.build();
+ }
+
+ _MixinsInference(typeSystem).perform(nodes.declarations);
+
+ for (var declaration in nodes.declarations) {
+ _declaration(declaration);
+ }
+ }
+
+ FunctionType _buildFunctionType(
+ TypeParameterList typeParameterList,
+ TypeAnnotation returnTypeNode,
+ FormalParameterList parameterList,
+ ) {
+ var returnType = returnTypeNode?.type ?? _dynamicType;
+
+ List<TypeParameterElement> typeParameters;
+ if (typeParameterList != null) {
+ typeParameters = typeParameterList.typeParameters
+ .map<TypeParameterElement>((p) => p.declaredElement)
+ .toList();
+ } else {
+ typeParameters = const <TypeParameterElement>[];
+ }
+
+ var formalParameters = parameterList.parameters.map((parameter) {
+ return ParameterElementImpl.synthetic(
+ parameter.identifier?.name ?? '',
+ _getType(parameter),
+ // ignore: deprecated_member_use_from_same_package
+ parameter.kind,
+ );
+ }).toList();
+
+ return FunctionTypeImpl.synthetic(
+ returnType,
+ typeParameters,
+ formalParameters,
+ );
+ }
+
+ void _classDeclaration(ClassDeclaration node) {}
+
+ void _declaration(AstNode node) {
+ if (node is ClassDeclaration) {
+ _classDeclaration(node);
+ } else if (node is ClassTypeAlias) {
+ // TODO(scheglov) ???
+ } else if (node is FieldFormalParameter) {
+ _fieldFormalParameter(node);
+ } else if (node is FunctionDeclaration) {
+ var returnType = node.returnType?.type;
+ if (returnType == null) {
+ if (node.isSetter) {
+ returnType = _voidType;
+ } else {
+ returnType = _dynamicType;
+ }
+ }
+ LazyAst.setReturnType(node, returnType);
+ } else if (node is FunctionTypeAlias) {
+ _functionTypeAlias(node);
+ } else if (node is FunctionTypedFormalParameter) {
+ _functionTypedFormalParameter(node);
+ } else if (node is GenericTypeAlias) {
+ // TODO(scheglov) ???
+ } else if (node is MethodDeclaration) {
+ var returnType = node.returnType?.type;
+ if (returnType == null) {
+ if (node.isSetter) {
+ returnType = _voidType;
+ } else if (node.isOperator && node.name.name == '[]=') {
+ returnType = _voidType;
+ } else {
+ returnType = _dynamicType;
+ }
+ }
+ LazyAst.setReturnType(node, returnType);
+ } else if (node is MixinDeclaration) {
+ // TODO(scheglov) ???
+ } else if (node is SimpleFormalParameter) {
+ LazyAst.setType(node, node.type?.type ?? _dynamicType);
+ } else if (node is VariableDeclarationList) {
+ var type = node.type?.type;
+ if (type != null) {
+ for (var variable in node.variables) {
+ LazyAst.setType(variable, type);
+ }
+ }
+ } else {
+ throw UnimplementedError('${node.runtimeType}');
+ }
+ }
+
+ void _fieldFormalParameter(FieldFormalParameter node) {
+ var parameterList = node.parameters;
+ if (parameterList != null) {
+ var type = _buildFunctionType(
+ node.typeParameters,
+ node.type,
+ parameterList,
+ );
+ LazyAst.setType(node, type);
+ } else {
+ LazyAst.setType(node, node.type?.type ?? _dynamicType);
+ }
+ }
+
+ void _functionTypeAlias(FunctionTypeAlias node) {
+ var returnTypeNode = node.returnType;
+ LazyAst.setReturnType(node, returnTypeNode?.type ?? _dynamicType);
+ }
+
+ void _functionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ var type = _buildFunctionType(
+ node.typeParameters,
+ node.returnType,
+ node.parameters,
+ );
+ LazyAst.setType(node, type);
+ }
+
+ static DartType _getType(FormalParameter node) {
+ if (node is DefaultFormalParameter) {
+ return _getType(node.parameter);
+ }
+ return LazyAst.getType(node);
+ }
+}
+
+/// Performs mixins inference in a [ClassDeclaration].
+class _MixinInference {
+ final Dart2TypeSystem typeSystem;
+
+ InterfaceType classType;
+ List<InterfaceType> mixinTypes = [];
+ List<InterfaceType> supertypesForMixinInference;
+
+ _MixinInference(this.typeSystem, this.classType);
+
+ void perform(WithClause withClause) {
+ if (withClause == null) return;
+
+ for (var mixinNode in withClause.mixinTypes) {
+ var mixinType = _inferSingle(mixinNode);
+ mixinTypes.add(mixinType);
+
+ _addSupertypes(mixinType);
+ }
+ }
+
+ void _addSupertypes(InterfaceType type) {
+ if (supertypesForMixinInference != null) {
+ ClassElementImpl.collectAllSupertypes(
+ supertypesForMixinInference,
+ type,
+ classType,
+ );
+ }
+ }
+
+ InterfaceType _findInterfaceTypeForElement(
+ ClassElement element,
+ List<InterfaceType> interfaceTypes,
+ ) {
+ for (var interfaceType in interfaceTypes) {
+ if (interfaceType.element == element) return interfaceType;
+ }
+ return null;
+ }
+
+ List<InterfaceType> _findInterfaceTypesForConstraints(
+ List<InterfaceType> constraints,
+ List<InterfaceType> interfaceTypes,
+ ) {
+ var result = <InterfaceType>[];
+ for (var constraint in constraints) {
+ var interfaceType = _findInterfaceTypeForElement(
+ constraint.element,
+ interfaceTypes,
+ );
+
+ // No matching interface type found, so inference fails.
+ if (interfaceType == null) {
+ return null;
+ }
+
+ result.add(interfaceType);
+ }
+ return result;
+ }
+
+ InterfaceType _inferSingle(TypeName mixinNode) {
+ var mixinType = _interfaceType(mixinNode.type);
+
+ if (mixinNode.typeArguments != null) {
+ return mixinType;
+ }
+
+ var mixinElement = mixinType.element;
+ if (mixinElement.typeParameters.isEmpty) {
+ return mixinType;
+ }
+
+ var mixinSupertypeConstraints =
+ typeSystem.gatherMixinSupertypeConstraintsForInference(mixinElement);
+ if (mixinSupertypeConstraints.isEmpty) {
+ return mixinType;
+ }
+
+ if (supertypesForMixinInference == null) {
+ supertypesForMixinInference = <InterfaceType>[];
+ _addSupertypes(classType.superclass);
+ for (var previousMixinType in mixinTypes) {
+ _addSupertypes(previousMixinType);
+ }
+ }
+
+ var matchingInterfaceTypes = _findInterfaceTypesForConstraints(
+ mixinSupertypeConstraints,
+ supertypesForMixinInference,
+ );
+
+ // Note: if matchingInterfaceType is null, that's an error. Also,
+ // if there are multiple matching interface types that use
+ // different type parameters, that's also an error. But we can't
+ // report errors from the linker, so we just use the
+ // first matching interface type (if there is one). The error
+ // detection logic is implemented in the ErrorVerifier.
+ if (matchingInterfaceTypes == null) {
+ return mixinType;
+ }
+
+ // Try to pattern match matchingInterfaceTypes against
+ // mixinSupertypeConstraints to find the correct set of type
+ // parameters to apply to the mixin.
+ var inferredMixin = typeSystem.matchSupertypeConstraints(
+ mixinElement,
+ mixinSupertypeConstraints,
+ matchingInterfaceTypes,
+ );
+ if (inferredMixin != null) {
+ mixinType = inferredMixin;
+ mixinNode.type = inferredMixin;
+ }
+
+ return mixinType;
+ }
+
+ InterfaceType _interfaceType(DartType type) {
+ if (type is InterfaceType && !type.element.isEnum) {
+ return type;
+ }
+ return typeSystem.typeProvider.objectType;
+ }
+}
+
+/// Performs mixin inference for all declarations.
+class _MixinsInference {
+ final Dart2TypeSystem typeSystem;
+
+ _MixinsInference(this.typeSystem);
+
+ void perform(List<AstNode> declarations) {
+ for (var node in declarations) {
+ if (node is ClassDeclaration || node is ClassTypeAlias) {
+ ClassElementImpl element = (node as Declaration).declaredElement;
+ element.linkedMixinInferenceCallback = _callbackWhenRecursion;
+ }
+ }
+
+ for (var declaration in declarations) {
+ _inferDeclaration(declaration);
+ }
+ }
+
+ /// This method is invoked when mixins are asked from the [element], and
+ /// we are inferring the [element] now, i.e. there is a loop.
+ ///
+ /// This is an error. So, we return the empty list, and break the loop.
+ List<InterfaceType> _callbackWhenLoop(ClassElementImpl element) {
+ element.linkedMixinInferenceCallback = null;
+ return <InterfaceType>[];
+ }
+
+ /// This method is invoked when mixins are asked from the [element], and
+ /// we are not inferring the [element] now, i.e. there is no loop.
+ List<InterfaceType> _callbackWhenRecursion(ClassElementImpl element) {
+ _inferDeclaration(element.linkedNode);
+ // The inference was successful, let the element return actual mixins.
+ return null;
+ }
+
+ void _infer(ClassElementImpl element, WithClause withClause) {
+ element.linkedMixinInferenceCallback = _callbackWhenLoop;
+ try {
+ _MixinInference(typeSystem, element.type).perform(withClause);
+ } finally {
+ element.linkedMixinInferenceCallback = null;
+ }
+ }
+
+ void _inferDeclaration(AstNode node) {
+ if (node is ClassDeclaration) {
+ _infer(node.declaredElement, node.withClause);
+ } else if (node is ClassTypeAlias) {
+ _infer(node.declaredElement, node.withClause);
+ }
+ }
+}
diff --git a/analyzer/lib/src/task/api/dart.dart b/analyzer/lib/src/task/api/dart.dart
index f1f19e6..9064e25 100644
--- a/analyzer/lib/src/task/api/dart.dart
+++ b/analyzer/lib/src/task/api/dart.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -9,7 +9,6 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/dart.dart';
/**
* The analysis errors associated with a [Source] representing a compilation
@@ -89,8 +88,7 @@
* The result is only available for [Source]s representing a compilation unit.
*/
final ResultDescriptor<CompilationUnit> PARSED_UNIT =
- new ResultDescriptor<CompilationUnit>('PARSED_UNIT', null,
- cachingPolicy: AST_CACHING_POLICY);
+ new ResultDescriptor<CompilationUnit>('PARSED_UNIT', null);
/**
* The resolved [CompilationUnit] associated with a compilation unit, with
@@ -99,8 +97,7 @@
* The result is only available for [LibrarySpecificUnit]s.
*/
final ResultDescriptor<CompilationUnit> RESOLVED_UNIT =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null,
- cachingPolicy: AST_CACHING_POLICY);
+ new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null);
/**
* The kind of a [Source].
@@ -116,9 +113,8 @@
*
* The result is only available for [Source]s representing a compilation unit.
*/
-final ResultDescriptor<Token> TOKEN_STREAM = new ResultDescriptor<Token>(
- 'TOKEN_STREAM', null,
- cachingPolicy: TOKEN_STREAM_CACHING_POLICY);
+final ResultDescriptor<Token> TOKEN_STREAM =
+ new ResultDescriptor<Token>('TOKEN_STREAM', null);
/**
* The sources of the Dart files that a library consists of.
diff --git a/analyzer/lib/src/task/api/general.dart b/analyzer/lib/src/task/api/general.dart
index 2f7ab11..d884116 100644
--- a/analyzer/lib/src/task/api/general.dart
+++ b/analyzer/lib/src/task/api/general.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/api/model.dart b/analyzer/lib/src/task/api/model.dart
index fe0edef..2d13057 100644
--- a/analyzer/lib/src/task/api/model.dart
+++ b/analyzer/lib/src/task/api/model.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/api/yaml.dart b/analyzer/lib/src/task/api/yaml.dart
index 8bfe390..aacc75d 100644
--- a/analyzer/lib/src/task/api/yaml.dart
+++ b/analyzer/lib/src/task/api/yaml.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/dart.dart b/analyzer/lib/src/task/dart.dart
deleted file mode 100644
index 36dd7f6..0000000
--- a/analyzer/lib/src/task/dart.dart
+++ /dev/null
@@ -1,5601 +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.
-
-import 'dart:collection';
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/standard_resolution_map.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/dart/ast/visitor.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/exception/exception.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/source/line_info.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/dart/ast/ast.dart'
- show
- CompilationUnitImpl,
- NamespaceDirectiveImpl,
- UriBasedDirectiveImpl,
- UriValidationCode;
-import 'package:analyzer/src/dart/ast/utilities.dart';
-import 'package:analyzer/src/dart/constant/constant_verifier.dart';
-import 'package:analyzer/src/dart/constant/evaluation.dart';
-import 'package:analyzer/src/dart/element/builder.dart';
-import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/dart/element/inheritance_manager2.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/dart/sdk/patch.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
-import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/error/inheritance_override.dart';
-import 'package:analyzer/src/error/pending_error.dart';
-import 'package:analyzer/src/generated/constant.dart';
-import 'package:analyzer/src/generated/declaration_resolver.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/error_verifier.dart';
-import 'package:analyzer/src/generated/incremental_resolver.dart';
-import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/resolver.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:analyzer/src/ignore_comments/ignore_info.dart';
-import 'package:analyzer/src/services/lint.dart';
-import 'package:analyzer/src/task/api/dart.dart';
-import 'package:analyzer/src/task/api/general.dart';
-import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/driver.dart';
-import 'package:analyzer/src/task/general.dart';
-import 'package:analyzer/src/task/inputs.dart';
-import 'package:analyzer/src/task/model.dart';
-import 'package:analyzer/src/task/strong/checker.dart';
-import 'package:analyzer/src/task/strong_mode.dart';
-
-export 'package:analyzer/src/dart/constant/evaluation.dart'
- show ConstantEvaluationTarget;
-export 'package:analyzer/src/ignore_comments/ignore_info.dart';
-
-/**
- * The [ResultCachingPolicy] for ASTs.
- */
-const ResultCachingPolicy AST_CACHING_POLICY =
- const SimpleResultCachingPolicy(1024 * 64, 32);
-
-/**
- * The [ResultCachingPolicy] for lists of [ConstantEvaluationTarget]s.
- */
-const ResultCachingPolicy CONSTANT_EVALUATION_TARGET_LIST_POLICY =
- const SimpleResultCachingPolicy(-1, -1);
-
-/**
- * The [ResultCachingPolicy] for [ConstantEvaluationTarget]s.
- */
-const ResultCachingPolicy CONSTANT_EVALUATION_TARGET_POLICY =
- const SimpleResultCachingPolicy(-1, -1);
-
-/**
- * The [ResultCachingPolicy] for [Element]s.
- */
-const ResultCachingPolicy ELEMENT_CACHING_POLICY =
- const SimpleResultCachingPolicy(-1, -1);
-
-/**
- * The [ResultCachingPolicy] for [TOKEN_STREAM].
- */
-const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY =
- const SimpleResultCachingPolicy(1, 1);
-
-/**
- * The [ResultCachingPolicy] for [UsedImportedElements]s.
- */
-const ResultCachingPolicy USED_IMPORTED_ELEMENTS_POLICY =
- const SimpleResultCachingPolicy(-1, -1);
-
-/**
- * The [ResultCachingPolicy] for [UsedLocalElements]s.
- */
-const ResultCachingPolicy USED_LOCAL_ELEMENTS_POLICY =
- const SimpleResultCachingPolicy(-1, -1);
-
-/**
- * The errors produced while building a library's directives.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS);
-/**
- * The errors produced while building a library element.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'BUILD_LIBRARY_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * A list of the [ConstantEvaluationTarget]s defined in a unit. This includes
- * constants defined at top level, statically inside classes, and local to
- * functions, as well as constant constructors, annotations, and default values
- * of parameters.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<ConstantEvaluationTarget>
- COMPILATION_UNIT_CONSTANTS =
- new ListResultDescriptor<ConstantEvaluationTarget>(
- 'COMPILATION_UNIT_CONSTANTS', null,
- cachingPolicy: CONSTANT_EVALUATION_TARGET_LIST_POLICY);
-
-/**
- * The element model associated with a single compilation unit.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT =
- new ResultDescriptor<CompilationUnitElement>(
- 'COMPILATION_UNIT_ELEMENT', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The list of [ConstantEvaluationTarget]s on which the target constant element
- * depends.
- *
- * The result is only available for targets representing a
- * [ConstantEvaluationTarget] (i.e. a constant variable declaration, a constant
- * constructor, or a parameter element with a default value).
- */
-final ListResultDescriptor<ConstantEvaluationTarget> CONSTANT_DEPENDENCIES =
- new ListResultDescriptor<ConstantEvaluationTarget>(
- 'CONSTANT_DEPENDENCIES', const <ConstantEvaluationTarget>[]);
-
-/**
- * The flag specifying that the target constant element expression AST is
- * resolved, i.e. identifiers have all required elements set.
- *
- * The result is only available for targets representing a
- * [ConstantEvaluationTarget] (i.e. a constant variable declaration, a constant
- * constructor, or a parameter element with a default value).
- */
-final ResultDescriptor<bool> CONSTANT_EXPRESSION_RESOLVED =
- new ResultDescriptor<bool>('CONSTANT_EXPRESSION_RESOLVED', false);
-
-/**
- * The list of [ConstantEvaluationTarget]s on which constant expressions of a
- * unit depend.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<ConstantEvaluationTarget>
- CONSTANT_EXPRESSIONS_DEPENDENCIES =
- new ListResultDescriptor<ConstantEvaluationTarget>(
- 'CONSTANT_EXPRESSIONS_DEPENDENCIES',
- const <ConstantEvaluationTarget>[]);
-
-/**
- * A [ConstantEvaluationTarget] that has been successfully constant-evaluated.
- *
- * TODO(paulberry): is ELEMENT_CACHING_POLICY the correct caching policy?
- *
- * The result is only available for [ConstantEvaluationTarget]s.
- *
- */
-final ResultDescriptor<ConstantEvaluationTarget> CONSTANT_VALUE =
- new ResultDescriptor<ConstantEvaluationTarget>('CONSTANT_VALUE', null,
- cachingPolicy: CONSTANT_EVALUATION_TARGET_POLICY);
-
-/**
- * The sources representing the libraries that include a given source as a part.
- *
- * The result is only available for [Source]s representing a compilation unit.
- */
-final ListResultDescriptor<Source> CONTAINING_LIBRARIES =
- new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', const <Source>[]);
-
-/**
- * The flag specifying that [RESOLVED_UNIT] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT1] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT1 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT1', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT10] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT10 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT10', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT11] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT11 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT11', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT12] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT12 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT12', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT2] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT2 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT2', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT3] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT3 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT3', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT4] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT4 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT4', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT5] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT5 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT5', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT6] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT6 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT6', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT7] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT7 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT7', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT8] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT8 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT8', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT9] has been been computed for this
- * compilation unit (without requiring that the AST for it still be in cache).
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT9 =
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT9', false);
-
-/**
- * All [AnalysisError]s results for [Source]s.
- */
-final List<ListResultDescriptor<AnalysisError>> ERROR_SOURCE_RESULTS =
- <ListResultDescriptor<AnalysisError>>[
- BUILD_DIRECTIVES_ERRORS,
- BUILD_LIBRARY_ERRORS,
- PARSE_ERRORS,
- SCAN_ERRORS,
-];
-
-/**
- * All [AnalysisError]s results in for [LibrarySpecificUnit]s.
- */
-final List<ListResultDescriptor<AnalysisError>> ERROR_UNIT_RESULTS =
- <ListResultDescriptor<AnalysisError>>[
- HINTS,
- LIBRARY_UNIT_ERRORS,
- LINTS,
- RESOLVE_DIRECTIVES_ERRORS,
- RESOLVE_TYPE_BOUNDS_ERRORS,
- RESOLVE_TYPE_NAMES_ERRORS,
- RESOLVE_UNIT_ERRORS,
- STRONG_MODE_ERRORS,
- VARIABLE_REFERENCE_ERRORS,
- VERIFY_ERRORS
-];
-
-/**
- * The sources representing the export closure of a library.
- * The [Source]s include only library sources, not their units.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE =
- new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null);
-
-/**
- * The errors produced while generating hints a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> HINTS =
- new ListResultDescriptor<AnalysisError>(
- 'HINT_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The ignore information for a [Source].
- */
-final ResultDescriptor<IgnoreInfo> IGNORE_INFO =
- new ResultDescriptor<IgnoreInfo>('IGNORE_INFO', null);
-
-/**
- * A list of the [VariableElement]s whose type should be inferred that another
- * inferable static variable (the target) depends on.
- *
- * The result is only available for [VariableElement]s, and only when strong
- * mode is enabled.
- */
-final ListResultDescriptor<VariableElement>
- INFERABLE_STATIC_VARIABLE_DEPENDENCIES =
- new ListResultDescriptor<VariableElement>(
- 'INFERABLE_STATIC_VARIABLE_DEPENDENCIES', null);
-
-/**
- * A list of the [VariableElement]s defined in a unit whose type should be
- * inferred. This includes variables defined at the library level as well as
- * static members inside classes.
- *
- * The result is only available for [LibrarySpecificUnit]s, and only when strong
- * mode is enabled.
- */
-final ListResultDescriptor<VariableElement> INFERABLE_STATIC_VARIABLES_IN_UNIT =
- new ListResultDescriptor<VariableElement>(
- 'INFERABLE_STATIC_VARIABLES_IN_UNIT', null);
-
-/**
- * An inferable static variable ([VariableElement]) whose type has been
- * inferred.
- *
- * The result is only available for [VariableElement]s, and only when strong
- * mode is enabled.
- */
-final ResultDescriptor<VariableElement> INFERRED_STATIC_VARIABLE =
- new ResultDescriptor<VariableElement>('INFERRED_STATIC_VARIABLE', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * A list of the [LibraryElement]s that make up the strongly connected
- * component in the import/export graph in which the target resides.
- *
- * Only non-empty in strongMode.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<LibraryElement> LIBRARY_CYCLE =
- new ListResultDescriptor<LibraryElement>('LIBRARY_CYCLE', null);
-
-/**
- * A list of the [LibrarySpecificUnit]s that comprise all of the parts and
- * libraries in the direct import/export dependencies of the library cycle
- * of the target, with the intra-component dependencies excluded.
- *
- * Only non-empty in strongMode.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_CYCLE_DEPENDENCIES =
- new ListResultDescriptor<LibrarySpecificUnit>(
- 'LIBRARY_CYCLE_DEPENDENCIES', null);
-
-/**
- * A list of the [LibrarySpecificUnit]s (including all parts) that make up
- * the strongly connected component in the import/export graph in which the
- * target resides.
- *
- * Only non-empty in strongMode.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_CYCLE_UNITS =
- new ListResultDescriptor<LibrarySpecificUnit>('LIBRARY_CYCLE_UNITS', null);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * The [LibraryElement] and its [CompilationUnitElement]s are attached to each
- * other. Directives 'library', 'part' and 'part of' are resolved.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT1', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * In addition to [LIBRARY_ELEMENT1] also [LibraryElement.imports] and
- * [LibraryElement.exports] are set.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT2 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT2', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * In addition to [LIBRARY_ELEMENT2] the [LibraryElement.publicNamespace] is set.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT3 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT3', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * In addition to [LIBRARY_ELEMENT3] the [LibraryElement.entryPoint] is set,
- * if the library does not declare one already and one of the exported
- * libraries exports one.
- *
- * Also [LibraryElement.exportNamespace] is set.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT4 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT4', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * [LIBRARY_ELEMENT5] plus resolved types type parameter bounds.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * [LIBRARY_ELEMENT5] plus resolved types for every element.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT6 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT6', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * [LIBRARY_ELEMENT6] plus [RESOLVED_UNIT7] for all library units.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT7 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT7', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * [LIBRARY_ELEMENT7] for the library and its import/export closure.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT8 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT8', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * The partial [LibraryElement] associated with a library.
- *
- * The same as a [LIBRARY_ELEMENT8].
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT9 =
- new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT9', null,
- cachingPolicy: ELEMENT_CACHING_POLICY);
-
-/**
- * List of all `LIBRARY_ELEMENT` results.
- */
-final List<ResultDescriptor<LibraryElement>> LIBRARY_ELEMENT_RESULTS =
- <ResultDescriptor<LibraryElement>>[
- LIBRARY_ELEMENT1,
- LIBRARY_ELEMENT2,
- LIBRARY_ELEMENT3,
- LIBRARY_ELEMENT4,
- LIBRARY_ELEMENT5,
- LIBRARY_ELEMENT6,
- LIBRARY_ELEMENT7,
- LIBRARY_ELEMENT8,
- LIBRARY_ELEMENT9,
- LIBRARY_ELEMENT
-];
-
-/**
- * The flag specifying whether all analysis errors are computed in a specific
- * library.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<bool> LIBRARY_ERRORS_READY =
- new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false);
-
-/**
- * The [LibrarySpecificUnit]s that a library consists of.
- *
- * The list will include the defining unit and units for [INCLUDED_PARTS].
- * So, it is never empty or `null`.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_SPECIFIC_UNITS =
- new ListResultDescriptor<LibrarySpecificUnit>(
- 'LIBRARY_SPECIFIC_UNITS', const <LibrarySpecificUnit>[]);
-
-/**
- * The analysis errors associated with a compilation unit in a specific library.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while generating lints for a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> LINTS =
- new ListResultDescriptor<AnalysisError>(
- 'LINT_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while parsing a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [Source]s representing a compilation unit.
- */
-final ListResultDescriptor<AnalysisError> PARSE_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'PARSE_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The list of [PendingError]s for a compilation unit.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<PendingError> PENDING_ERRORS =
- new ListResultDescriptor<PendingError>(
- 'PENDING_ERRORS', const <PendingError>[]);
-
-/**
- * The flag specifying that [LIBRARY_ELEMENT2] is ready for a library and its
- * import/export closure.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<bool> READY_LIBRARY_ELEMENT2 =
- new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT2', false);
-
-/**
- * The flag specifying that [LIBRARY_ELEMENT6] is ready for a library and its
- * import/export closure.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<bool> READY_LIBRARY_ELEMENT6 =
- new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT6', false);
-
-/**
- * The flag specifying that [LIBRARY_ELEMENT7] is ready for a library and its
- * import/export closure.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<bool> READY_LIBRARY_ELEMENT7 =
- new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT7', false);
-
-/**
- * The flag specifying that [RESOLVED_UNIT] is ready for all of the units of a
- * library.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ResultDescriptor<bool> READY_RESOLVED_UNIT =
- new ResultDescriptor<bool>('READY_RESOLVED_UNIT', false);
-
-/**
- * The sources of the Dart files that a library references.
- *
- * The list is the union of [IMPORTED_LIBRARIES], [EXPORTED_LIBRARIES] and
- * [UNITS] of the defining unit and [INCLUDED_PARTS]. Never empty or `null`.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<Source> REFERENCED_SOURCES =
- new ListResultDescriptor<Source>('REFERENCED_SOURCES', const <Source>[]);
-
-/**
- * The list of [ConstantEvaluationTarget]s on which error verification depends.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<ConstantEvaluationTarget> REQUIRED_CONSTANTS =
- new ListResultDescriptor<ConstantEvaluationTarget>(
- 'REQUIRED_CONSTANTS', const <ConstantEvaluationTarget>[]);
-
-/**
- * The errors produced while resolving a library's directives.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [Source]s representing a library.
- */
-final ListResultDescriptor<AnalysisError> RESOLVE_DIRECTIVES_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'RESOLVE_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while resolving bounds of type parameters of classes,
- * class and function aliases.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_BOUNDS_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'RESOLVE_TYPE_BOUNDS_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while resolving type names.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_NAMES_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while resolving a full compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> RESOLVE_UNIT_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'RESOLVE_UNIT_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * Tasks that use this value as an input can assume that the [SimpleIdentifier]s
- * at all declaration sites have been bound to the element defined by the
- * declaration, except for the constants defined in an 'enum' declaration.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The resolved [CompilationUnit] associated with a compilation unit in which
- * the types of class members have been inferred in addition to everything that
- * is true of a [RESOLVED_UNIT9].
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT10', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The resolved [CompilationUnit] associated with a compilation unit, with
- * constants not yet resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT11', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The resolved [CompilationUnit] associated with a compilation unit, with
- * constants resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT12 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT12', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT1], tasks that use this value
- * as an input can assume that its directives have been resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * Tasks that use this value as an input can assume that the [SimpleIdentifier]s
- * at all declaration sites have been bound to the element defined by the
- * declaration, including the constants defined in an 'enum' declaration.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT3], tasks that use this value
- * as an input can assume that the types associated with type bounds have been
- * resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT4], tasks that use this value
- * as an input can assume that the types associated with declarations have been
- * resolved. This includes the types of superclasses, mixins, interfaces,
- * fields, return types, parameters, and local variables.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT5], tasks that use this value
- * as an input can assume that references to local variables and formal
- * parameters have been resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT6], tasks that use this value
- * as an input can assume that elements and types associated with expressions
- * outside of method bodies (essentially initializers) have been initially
- * resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT7', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT7], tasks that use this value
- * as an input can assume that the types of static variables have been inferred.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT8', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * The partially resolved [CompilationUnit] associated with a compilation unit.
- *
- * In addition to what is true of a [RESOLVED_UNIT8], tasks that use this value
- * as an input can assume that the initializers of instance variables have been
- * re-resolved.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT9 =
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT9', null,
- cachingPolicy: AST_CACHING_POLICY);
-
-/**
- * List of all `RESOLVED_UNITx` results.
- */
-final List<ResultDescriptor<CompilationUnit>> RESOLVED_UNIT_RESULTS =
- <ResultDescriptor<CompilationUnit>>[
- RESOLVED_UNIT1,
- RESOLVED_UNIT2,
- RESOLVED_UNIT3,
- RESOLVED_UNIT4,
- RESOLVED_UNIT5,
- RESOLVED_UNIT6,
- RESOLVED_UNIT7,
- RESOLVED_UNIT8,
- RESOLVED_UNIT9,
- RESOLVED_UNIT10,
- RESOLVED_UNIT11,
- RESOLVED_UNIT12,
- RESOLVED_UNIT
-];
-
-/**
- * The errors produced while scanning a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [Source]s representing a compilation unit.
- */
-final ListResultDescriptor<AnalysisError> SCAN_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'SCAN_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while resolving a static [VariableElement] initializer.
- *
- * The result is only available for [VariableElement]s, and only when strong
- * mode is enabled.
- */
-final ListResultDescriptor<AnalysisError> STATIC_VARIABLE_RESOLUTION_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'STATIC_VARIABLE_RESOLUTION_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * A list of the [AnalysisError]s reported while resolving static
- * [INFERABLE_STATIC_VARIABLES_IN_UNIT] defined in a unit.
- *
- * The result is only available for [LibrarySpecificUnit]s, and only when strong
- * mode is enabled.
- */
-final ListResultDescriptor<AnalysisError>
- STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT =
- new ListResultDescriptor<AnalysisError>(
- 'STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT', AnalysisError.NO_ERRORS);
-
-/**
- * The additional strong mode errors produced while verifying a
- * compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnits]s representing a
- * compilation unit.
- *
- */
-final ListResultDescriptor<AnalysisError> STRONG_MODE_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'STRONG_MODE_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The [TypeProvider] of the [AnalysisContext].
- */
-final ResultDescriptor<TypeProvider> TYPE_PROVIDER =
- new ResultDescriptor<TypeProvider>('TYPE_PROVIDER', null);
-
-/**
- * The [UsedImportedElements] of a [LibrarySpecificUnit].
- */
-final ResultDescriptor<UsedImportedElements> USED_IMPORTED_ELEMENTS =
- new ResultDescriptor<UsedImportedElements>('USED_IMPORTED_ELEMENTS', null,
- cachingPolicy: USED_IMPORTED_ELEMENTS_POLICY);
-
-/**
- * The [UsedLocalElements] of a [LibrarySpecificUnit].
- */
-final ResultDescriptor<UsedLocalElements> USED_LOCAL_ELEMENTS =
- new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null,
- cachingPolicy: USED_LOCAL_ELEMENTS_POLICY);
-
-/**
- * The errors produced while resolving variable references in a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> VARIABLE_REFERENCE_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'VARIABLE_REFERENCE_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * The errors produced while verifying a compilation unit.
- *
- * The list will be empty if there were no errors, but will not be `null`.
- *
- * The result is only available for [LibrarySpecificUnit]s.
- */
-final ListResultDescriptor<AnalysisError> VERIFY_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'VERIFY_ERRORS', AnalysisError.NO_ERRORS);
-
-/**
- * Return a list of unique errors for the [Source] of the given [target].
- */
-List<AnalysisError> getTargetSourceErrors(
- RecordingErrorListener listener, AnalysisTarget target) {
- Source source = target.source;
- List<AnalysisError> errors = listener.getErrorsForSource(source);
- return getUniqueErrors(errors);
-}
-
-/**
- * Return a list of errors containing the errors from the given [errors] list
- * but with duplications removed.
- */
-List<AnalysisError> getUniqueErrors(List<AnalysisError> errors) {
- if (errors.isEmpty) {
- return errors;
- }
- return errors.toSet().toList();
-}
-
-/**
- * A task that builds a compilation unit element for a single compilation unit.
- */
-class BuildCompilationUnitElementTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the AST for the compilation unit.
- */
- static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME';
-
- /**
- * The name of the input whose value is the source line info.
- */
- static const String LINE_INFO_INPUT_NAME = 'LINE_INFO_INPUT_NAME';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildCompilationUnitElementTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- COMPILATION_UNIT_CONSTANTS,
- COMPILATION_UNIT_ELEMENT,
- CREATED_RESOLVED_UNIT1,
- RESOLVED_UNIT1
- ]);
-
- /**
- * Initialize a newly created task to build a compilation unit element for
- * the given [target] in the given [context].
- */
- BuildCompilationUnitElementTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibrarySpecificUnit librarySpecificUnit = target;
- Source source = getRequiredSource();
- CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME);
- LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
- //
- // Try to get the existing CompilationUnitElement.
- //
- CompilationUnitElement element;
- {
- InternalAnalysisContext internalContext =
- context as InternalAnalysisContext;
- AnalysisCache analysisCache = internalContext.analysisCache;
- CacheEntry cacheEntry = internalContext.getCacheEntry(target);
- element = analysisCache.getValue(target, COMPILATION_UNIT_ELEMENT);
- if (element == null &&
- internalContext.aboutToComputeResult(
- cacheEntry, COMPILATION_UNIT_ELEMENT)) {
- element = analysisCache.getValue(target, COMPILATION_UNIT_ELEMENT);
- }
- }
- //
- // Build or reuse CompilationUnitElement.
- //
- if (element == null) {
- CompilationUnitBuilder builder = new CompilationUnitBuilder();
- element = builder.buildCompilationUnit(
- source, unit, librarySpecificUnit.library);
- (element as CompilationUnitElementImpl).lineInfo = lineInfo;
- } else {
- new DeclarationResolver().resolve(unit, element);
- }
- //
- // Prepare constants.
- //
- ConstantFinder constantFinder = new ConstantFinder();
- unit.accept(constantFinder);
- List<ConstantEvaluationTarget> constants =
- constantFinder.constantsToCompute;
- //
- // Record outputs.
- //
- outputs[COMPILATION_UNIT_CONSTANTS] = constants;
- outputs[COMPILATION_UNIT_ELEMENT] = element;
- outputs[RESOLVED_UNIT1] = unit;
- outputs[CREATED_RESOLVED_UNIT1] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- PARSED_UNIT_INPUT_NAME: PARSED_UNIT.of(unit.unit, flushOnAccess: true),
- LINE_INFO_INPUT_NAME: LINE_INFO.of(unit.unit)
- };
- }
-
- /**
- * Create a [BuildCompilationUnitElementTask] based on the given [target] in
- * the given [context].
- */
- static BuildCompilationUnitElementTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildCompilationUnitElementTask(context, target);
- }
-}
-
-/**
- * A task that builds imports and export directive elements for a library.
- */
-class BuildDirectiveElementsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [LIBRARY_ELEMENT1].
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the input for [RESOLVED_UNIT1] of a library unit.
- */
- static const String UNIT_INPUT_NAME = 'UNIT_INPUT_NAME';
-
- /**
- * The input with a map from referenced sources to their modification times.
- */
- static const String SOURCES_MODIFICATION_TIME_INPUT_NAME =
- 'SOURCES_MODIFICATION_TIME_INPUT_NAME';
-
- /**
- * The input with a list of [LIBRARY_ELEMENT3]s of imported libraries.
- */
- static const String IMPORTS_LIBRARY_ELEMENT_INPUT_NAME =
- 'IMPORTS_LIBRARY_ELEMENT1_INPUT_NAME';
-
- /**
- * The input with a list of [LIBRARY_ELEMENT3]s of exported libraries.
- */
- static const String EXPORTS_LIBRARY_ELEMENT_INPUT_NAME =
- 'EXPORTS_LIBRARY_ELEMENT_INPUT_NAME';
-
- /**
- * The input with a list of [SOURCE_KIND]s of imported libraries.
- */
- static const String IMPORTS_SOURCE_KIND_INPUT_NAME =
- 'IMPORTS_SOURCE_KIND_INPUT_NAME';
-
- /**
- * The input with a list of [SOURCE_KIND]s of exported libraries.
- */
- static const String EXPORTS_SOURCE_KIND_INPUT_NAME =
- 'EXPORTS_SOURCE_KIND_INPUT_NAME';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildDirectiveElementsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT2, BUILD_DIRECTIVES_ERRORS]);
-
- BuildDirectiveElementsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElementImpl libraryElement = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit libraryUnit = getRequiredInput(UNIT_INPUT_NAME);
- Map<Source, int> sourceModificationTimeMap =
- getRequiredInput(SOURCES_MODIFICATION_TIME_INPUT_NAME);
- Map<Source, LibraryElement> importLibraryMap =
- getRequiredInput(IMPORTS_LIBRARY_ELEMENT_INPUT_NAME);
- Map<Source, LibraryElement> exportLibraryMap =
- getRequiredInput(EXPORTS_LIBRARY_ELEMENT_INPUT_NAME);
- Map<Source, SourceKind> importSourceKindMap =
- getRequiredInput(IMPORTS_SOURCE_KIND_INPUT_NAME);
- Map<Source, SourceKind> exportSourceKindMap =
- getRequiredInput(EXPORTS_SOURCE_KIND_INPUT_NAME);
- //
- // Try to get the existing LibraryElement.
- //
- LibraryElement element;
- {
- InternalAnalysisContext internalContext =
- context as InternalAnalysisContext;
- AnalysisCache analysisCache = internalContext.analysisCache;
- CacheEntry cacheEntry = internalContext.getCacheEntry(target);
- element = analysisCache.getValue(target, LIBRARY_ELEMENT2);
- if (element == null &&
- internalContext.aboutToComputeResult(cacheEntry, LIBRARY_ELEMENT2)) {
- element = analysisCache.getValue(target, LIBRARY_ELEMENT2);
- }
- }
- //
- // Build or reuse the directive elements.
- //
- List<AnalysisError> errors;
- if (element == null) {
- DirectiveElementBuilder builder = new DirectiveElementBuilder(
- context,
- libraryElement,
- sourceModificationTimeMap,
- importLibraryMap,
- importSourceKindMap,
- exportLibraryMap,
- exportSourceKindMap);
- libraryUnit.accept(builder);
- // See the commentary in the computation of the LIBRARY_CYCLE result
- // for details on library cycle invalidation.
- libraryElement.invalidateLibraryCycles();
- errors = builder.errors;
- } else {
- DirectiveResolver resolver = new DirectiveResolver(
- sourceModificationTimeMap, importSourceKindMap, exportSourceKindMap);
- libraryUnit.accept(resolver);
- errors = resolver.errors;
- }
- //
- // Record outputs.
- //
- outputs[LIBRARY_ELEMENT2] = libraryElement;
- outputs[BUILD_DIRECTIVES_ERRORS] = errors;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given library [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT1.of(source),
- UNIT_INPUT_NAME:
- RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)),
- SOURCES_MODIFICATION_TIME_INPUT_NAME:
- REFERENCED_SOURCES.of(source).toMapOf(MODIFICATION_TIME),
- IMPORTS_LIBRARY_ELEMENT_INPUT_NAME:
- IMPORTED_LIBRARIES.of(source).toMapOf(LIBRARY_ELEMENT1),
- EXPORTS_LIBRARY_ELEMENT_INPUT_NAME:
- EXPORTED_LIBRARIES.of(source).toMapOf(LIBRARY_ELEMENT1),
- IMPORTS_SOURCE_KIND_INPUT_NAME:
- IMPORTED_LIBRARIES.of(source).toMapOf(SOURCE_KIND),
- EXPORTS_SOURCE_KIND_INPUT_NAME:
- EXPORTED_LIBRARIES.of(source).toMapOf(SOURCE_KIND)
- };
- }
-
- /**
- * Create a [BuildDirectiveElementsTask] based on the given [target] in
- * the given [context].
- */
- static BuildDirectiveElementsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildDirectiveElementsTask(context, target);
- }
-}
-
-/**
- * A task that builds the elements representing the members of enum
- * declarations.
- */
-class BuildEnumMemberElementsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT1] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildEnumMemberElementsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT3, RESOLVED_UNIT3]);
-
- BuildEnumMemberElementsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- //
- // Build the enum members if they have not already been created.
- //
- EnumDeclaration findFirstEnum() {
- NodeList<CompilationUnitMember> members = unit.declarations;
- int length = members.length;
- for (int i = 0; i < length; i++) {
- CompilationUnitMember member = members[i];
- if (member is EnumDeclaration) {
- return member;
- }
- }
- return null;
- }
-
- EnumDeclaration firstEnum = findFirstEnum();
- if (firstEnum != null &&
- resolutionMap
- .elementDeclaredByEnumDeclaration(firstEnum)
- .accessors
- .isEmpty) {
- EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider);
- unit.accept(builder);
- }
- //
- // Record outputs.
- //
- outputs[CREATED_RESOLVED_UNIT3] = true;
- outputs[RESOLVED_UNIT3] = unit;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT2.of(unit)
- };
- }
-
- /**
- * Create a [BuildEnumMemberElementsTask] based on the given [target] in
- * the given [context].
- */
- static BuildEnumMemberElementsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildEnumMemberElementsTask(context, target);
- }
-}
-
-/**
- * A task that builds [EXPORT_NAMESPACE] and [LIBRARY_ELEMENT4] for a library.
- */
-class BuildExportNamespaceTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input for [LIBRARY_ELEMENT3] of a library.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildExportNamespaceTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT4]);
-
- BuildExportNamespaceTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElementImpl library = getRequiredInput(LIBRARY_INPUT);
- //
- // Compute export namespace.
- //
- library.exportNamespace = null;
- NamespaceBuilder builder = new NamespaceBuilder();
- Namespace namespace = builder.createExportNamespaceForLibrary(library);
- library.exportNamespace = namespace;
- //
- // Update entry point.
- //
- if (library.entryPoint == null) {
- Iterable<Element> exportedElements = namespace.definedNames.values;
- library.entryPoint = exportedElements.firstWhere(
- (element) => element is FunctionElement && element.isEntryPoint,
- orElse: () => null);
- }
- //
- // Record outputs.
- //
- outputs[LIBRARY_ELEMENT4] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given library [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT3.of(source),
- 'exportsLibraryPublicNamespace':
- EXPORT_SOURCE_CLOSURE.of(source).toMapOf(LIBRARY_ELEMENT3)
- };
- }
-
- /**
- * Create a [BuildExportNamespaceTask] based on the given [target] in
- * the given [context].
- */
- static BuildExportNamespaceTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildExportNamespaceTask(context, target);
- }
-}
-
-/**
- * A task that builds a library element for a Dart library.
- */
-class BuildLibraryElementTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [RESOLVED_UNIT1].
- */
- static const String DEFINING_UNIT_INPUT = 'DEFINING_UNIT_INPUT';
-
- /**
- * The name of the input whose value is a list of built [RESOLVED_UNIT1]s
- * of the parts sourced by a library.
- */
- static const String PARTS_UNIT_INPUT = 'PARTS_UNIT_INPUT';
-
- /**
- * The name of the input whose value is the modification time of the source.
- */
- static const String MODIFICATION_TIME_INPUT = 'MODIFICATION_TIME_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildLibraryElementTask', createTask, buildInputs, <ResultDescriptor>[
- BUILD_LIBRARY_ERRORS,
- LIBRARY_ELEMENT1,
- IS_LAUNCHABLE
- ]);
-
- /**
- * The constant used as an unknown common library name in parts.
- */
- static const String _UNKNOWN_LIBRARY_NAME = 'unknown-library-name';
-
- /**
- * Initialize a newly created task to build a library element for the given
- * [target] in the given [context].
- */
- BuildLibraryElementTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- List<AnalysisError> errors = <AnalysisError>[];
- //
- // Prepare inputs.
- //
- Source librarySource = getRequiredSource();
- CompilationUnit definingCompilationUnit =
- getRequiredInput(DEFINING_UNIT_INPUT);
- List<CompilationUnit> partUnits = getRequiredInput(PARTS_UNIT_INPUT);
- int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT);
- //
- // Process inputs.
- //
- CompilationUnitElementImpl definingCompilationUnitElement =
- definingCompilationUnit.declaredElement;
- Map<Source, CompilationUnit> partUnitMap =
- new HashMap<Source, CompilationUnit>();
- int partLength = partUnits.length;
- for (int i = 0; i < partLength; i++) {
- CompilationUnit partUnit = partUnits[i];
- Source partSource =
- resolutionMap.elementDeclaredByCompilationUnit(partUnit).source;
- partUnitMap[partSource] = partUnit;
- }
- //
- // Update "part" directives.
- //
- LibraryIdentifier libraryNameNode = null;
- String partsLibraryName = _UNKNOWN_LIBRARY_NAME;
- Set<Source> seenPartSources = new Set<Source>();
- FunctionElement entryPoint =
- _findEntryPoint(definingCompilationUnitElement);
- List<Directive> directivesToResolve = <Directive>[];
- List<CompilationUnitElementImpl> sourcedCompilationUnits =
- <CompilationUnitElementImpl>[];
- NodeList<Directive> directives = definingCompilationUnit.directives;
- int directiveLength = directives.length;
- for (int i = 0; i < directiveLength; i++) {
- Directive directive = directives[i];
- if (directive is LibraryDirective) {
- libraryNameNode = directive.name;
- directivesToResolve.add(directive);
- } else if (directive is PartDirective) {
- StringLiteral partUri = directive.uri;
- Source partSource = directive.uriSource;
- CompilationUnit partUnit = partUnitMap[partSource];
- if (partUnit != null) {
- CompilationUnitElementImpl partElement = partUnit.declaredElement;
- partElement.uriOffset = partUri.offset;
- partElement.uriEnd = partUri.end;
- partElement.uri = directive.uriContent;
- //
- // Validate that the part source is unique in the library.
- //
- if (!seenPartSources.add(partSource)) {
- errors.add(new AnalysisError(
- librarySource,
- partUri.offset,
- partUri.length,
- CompileTimeErrorCode.DUPLICATE_PART,
- [partSource.uri]));
- }
- //
- // Validate that the part contains a part-of directive with the same
- // name as the library.
- //
- if (context.exists(partSource)) {
- _NameOrSource nameOrSource = _getPartLibraryNameOrUri(
- context, partSource, partUnit, directivesToResolve);
- if (nameOrSource == null) {
- errors.add(new AnalysisError(
- librarySource,
- partUri.offset,
- partUri.length,
- CompileTimeErrorCode.PART_OF_NON_PART,
- [partUri.toSource()]));
- } else {
- String name = nameOrSource.name;
- if (name != null) {
- if (libraryNameNode == null) {
- if (partsLibraryName == _UNKNOWN_LIBRARY_NAME) {
- partsLibraryName = name;
- } else if (partsLibraryName != name) {
- partsLibraryName = null;
- }
- } else if (libraryNameNode.name != name) {
- errors.add(new AnalysisError(
- librarySource,
- partUri.offset,
- partUri.length,
- StaticWarningCode.PART_OF_DIFFERENT_LIBRARY,
- [libraryNameNode.name, name]));
- }
- } else {
- Source source = nameOrSource.source;
- if (source != librarySource) {
- errors.add(new AnalysisError(
- librarySource,
- partUri.offset,
- partUri.length,
- StaticWarningCode.PART_OF_DIFFERENT_LIBRARY,
- [librarySource.uri.toString(), source.uri.toString()]));
- }
- }
- }
- }
- if (entryPoint == null) {
- entryPoint = _findEntryPoint(partElement);
- }
- directive.element = partElement;
- sourcedCompilationUnits.add(partElement);
- }
- }
- }
- // TODO(brianwilkerson) Report the error
- // ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART
- //
- // Create and populate the library element.
- //
- AnalysisContext owningContext = context;
- if (context is InternalAnalysisContext) {
- InternalAnalysisContext internalContext = context;
- owningContext = internalContext.getContextFor(librarySource);
- }
- //
- // Try to get the existing LibraryElement.
- //
- LibraryElementImpl libraryElement;
- {
- InternalAnalysisContext internalContext =
- context as InternalAnalysisContext;
- AnalysisCache analysisCache = internalContext.analysisCache;
- CacheEntry cacheEntry = internalContext.getCacheEntry(target);
- libraryElement = analysisCache.getValue(target, LIBRARY_ELEMENT1)
- as LibraryElementImpl;
- if (libraryElement == null &&
- internalContext.aboutToComputeResult(cacheEntry, LIBRARY_ELEMENT1)) {
- libraryElement = analysisCache.getValue(target, LIBRARY_ELEMENT1)
- as LibraryElementImpl;
- }
- }
- //
- // Create a new LibraryElement.
- //
- if (libraryElement == null) {
- libraryElement =
- new LibraryElementImpl.forNode(owningContext, null, libraryNameNode);
- libraryElement.isSynthetic = modificationTime < 0;
- libraryElement.definingCompilationUnit = definingCompilationUnitElement;
- libraryElement.entryPoint = entryPoint;
- libraryElement.parts = sourcedCompilationUnits;
- libraryElement.hasExtUri = _hasExtUri(definingCompilationUnit);
- BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement);
- // set the library documentation to the docs associated with the first
- // directive in the compilation unit.
- if (definingCompilationUnit.directives.isNotEmpty) {
- setElementDocumentationComment(
- libraryElement, definingCompilationUnit.directives.first);
- }
- }
- //
- // Resolve the relevant directives to the library element.
- //
- // TODO(brianwilkerson) This updates the state of the AST structures but
- // does not associate a new result with it.
- //
- int length = directivesToResolve.length;
- for (int i = 0; i < length; i++) {
- Directive directive = directivesToResolve[i];
- directive.element = libraryElement;
- }
- //
- // Record outputs.
- //
- outputs[BUILD_LIBRARY_ERRORS] = errors;
- outputs[LIBRARY_ELEMENT1] = libraryElement;
- outputs[IS_LAUNCHABLE] = entryPoint != null;
- }
-
- /**
- * Return the top-level [FunctionElement] entry point, or `null` if the given
- * [element] does not define an entry point.
- */
- FunctionElement _findEntryPoint(CompilationUnitElementImpl element) {
- List<FunctionElement> functions = element.functions;
- int length = functions.length;
- for (int i = 0; i < length; i++) {
- FunctionElement function = functions[i];
- if (function.isEntryPoint) {
- return function;
- }
- }
- return null;
- }
-
- /**
- * Return the name of the library that the given part is declared to be a
- * part of, or `null` if the part does not contain a part-of directive.
- */
- _NameOrSource _getPartLibraryNameOrUri(
- AnalysisContext context,
- Source partSource,
- CompilationUnit partUnit,
- List<Directive> directivesToResolve) {
- NodeList<Directive> directives = partUnit.directives;
- int length = directives.length;
- for (int i = 0; i < length; i++) {
- Directive directive = directives[i];
- if (directive is PartOfDirective) {
- directivesToResolve.add(directive);
- LibraryIdentifier libraryName = directive.libraryName;
- if (libraryName != null) {
- return new _NameOrSource(libraryName.name, null);
- }
- String uri = directive.uri?.stringValue;
- if (uri != null) {
- Source librarySource =
- context.sourceFactory.resolveUri(partSource, uri);
- if (librarySource != null) {
- return new _NameOrSource(null, librarySource);
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Return `true` if the given compilation [unit] contains at least one
- * import directive with a `dart-ext:` URI.
- */
- bool _hasExtUri(CompilationUnit unit) {
- NodeList<Directive> directives = unit.directives;
- int length = directives.length;
- for (int i = 0; i < length; i++) {
- Directive directive = directives[i];
- if (directive is ImportDirective) {
- if (DartUriResolver.isDartExtUri(directive.uriContent)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- DEFINING_UNIT_INPUT:
- RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)),
- PARTS_UNIT_INPUT: INCLUDED_PARTS.of(source).toList((Source unit) {
- return RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, unit));
- }),
- MODIFICATION_TIME_INPUT: MODIFICATION_TIME.of(source)
- };
- }
-
- /**
- * Create a [BuildLibraryElementTask] based on the given [target] in the
- * given [context].
- */
- static BuildLibraryElementTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildLibraryElementTask(context, target);
- }
-}
-
-/**
- * A task that builds [PUBLIC_NAMESPACE] for a library.
- */
-class BuildPublicNamespaceTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input for [LIBRARY_ELEMENT2] of a library.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildPublicNamespaceTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT3]);
-
- BuildPublicNamespaceTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElementImpl library = getRequiredInput(LIBRARY_INPUT);
- NamespaceBuilder builder = new NamespaceBuilder();
- library.publicNamespace = builder.createPublicNamespaceForLibrary(library);
- outputs[LIBRARY_ELEMENT3] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given library [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{LIBRARY_INPUT: LIBRARY_ELEMENT2.of(source)};
- }
-
- /**
- * Create a [BuildPublicNamespaceTask] based on the given [target] in
- * the given [context].
- */
- static BuildPublicNamespaceTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildPublicNamespaceTask(context, target);
- }
-}
-
-/**
- * A task that builds [EXPORT_SOURCE_CLOSURE] of a library.
- */
-class BuildSourceExportClosureTask extends SourceBasedAnalysisTask {
- /**
- * The name of the export closure.
- */
- static const String EXPORT_INPUT = 'EXPORT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildSourceExportClosureTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[EXPORT_SOURCE_CLOSURE]);
-
- BuildSourceExportClosureTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- List<Source> exportClosure = getRequiredInput(EXPORT_INPUT);
- //
- // Record output.
- //
- outputs[EXPORT_SOURCE_CLOSURE] = exportClosure;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given library [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- EXPORT_INPUT: new _ExportSourceClosureTaskInput(source, LIBRARY_ELEMENT2)
- };
- }
-
- /**
- * Create a [BuildSourceExportClosureTask] based on the given [target] in
- * the given [context].
- */
- static BuildSourceExportClosureTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildSourceExportClosureTask(context, target);
- }
-}
-
-/**
- * A task that builds [TYPE_PROVIDER] for a context.
- */
-class BuildTypeProviderTask extends SourceBasedAnalysisTask {
- /**
- * The [PUBLIC_NAMESPACE] input of the `dart:core` library.
- */
- static const String CORE_INPUT = 'CORE_INPUT';
-
- /**
- * The [PUBLIC_NAMESPACE] input of the `dart:async` library.
- */
- static const String ASYNC_INPUT = 'ASYNC_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'BuildTypeProviderTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[TYPE_PROVIDER]);
-
- BuildTypeProviderTask(
- InternalAnalysisContext context, AnalysisContextTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElement coreLibrary = getRequiredInput(CORE_INPUT);
- LibraryElement asyncLibrary = getOptionalInput(ASYNC_INPUT);
- Namespace coreNamespace = coreLibrary.publicNamespace;
- Namespace asyncNamespace = asyncLibrary.publicNamespace;
- //
- // Record outputs.
- //
- TypeProvider typeProvider =
- new TypeProviderImpl.forNamespaces(coreNamespace, asyncNamespace);
- (context as InternalAnalysisContext).typeProvider = typeProvider;
- outputs[TYPE_PROVIDER] = typeProvider;
- }
-
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- AnalysisContextTarget contextTarget = target;
- SourceFactory sourceFactory = contextTarget.context.sourceFactory;
- Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE);
- Source asyncSource = sourceFactory.forUri(DartSdk.DART_ASYNC);
- if (asyncSource == null) {
- return <String, TaskInput>{CORE_INPUT: LIBRARY_ELEMENT3.of(coreSource)};
- }
- return <String, TaskInput>{
- CORE_INPUT: LIBRARY_ELEMENT3.of(coreSource),
- ASYNC_INPUT: LIBRARY_ELEMENT3.of(asyncSource)
- };
- }
-
- /**
- * Create a [BuildTypeProviderTask] based on the given [context].
- */
- static BuildTypeProviderTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new BuildTypeProviderTask(context, target);
- }
-}
-
-/**
- * A task that computes [CONSTANT_DEPENDENCIES] for a constant.
- */
-class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask {
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ComputeConstantDependenciesTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CONSTANT_DEPENDENCIES]);
-
- ComputeConstantDependenciesTask(
- InternalAnalysisContext context, ConstantEvaluationTarget constant)
- : super(context, constant);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- ConstantEvaluationTarget constant = target;
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Compute dependencies.
- //
- List<ConstantEvaluationTarget> dependencies = <ConstantEvaluationTarget>[];
- new ConstantEvaluationEngine(typeProvider, context.declaredVariables,
- typeSystem: context.typeSystem)
- .computeDependencies(constant, dependencies.add);
- //
- // Record outputs.
- //
- outputs[CONSTANT_DEPENDENCIES] = dependencies;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- return <String, TaskInput>{
- 'constantExpressionResolved': CONSTANT_EXPRESSION_RESOLVED.of(target),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [ComputeConstantDependenciesTask] based on the given [target] in
- * the given [context].
- */
- static ComputeConstantDependenciesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ComputeConstantDependenciesTask(context, target);
- }
-}
-
-/**
- * A task that computes the value of a constant ([CONSTANT_VALUE]) and
- * stores it in the element model.
- */
-class ComputeConstantValueTask extends ConstantEvaluationAnalysisTask {
- /**
- * The name of the input which ensures that dependent constants are evaluated
- * before the target.
- */
- static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ComputeConstantValueTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CONSTANT_VALUE]);
-
- ComputeConstantValueTask(
- InternalAnalysisContext context, ConstantEvaluationTarget constant)
- : super(context, constant);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping
- // dependency to ensure that the constants that this constant depends on
- // are computed first.
- ConstantEvaluationTarget constant = target;
- AnalysisContext context = constant.context;
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Compute the value of the constant, or report an error if there was a
- // cycle.
- //
- ConstantEvaluationEngine constantEvaluationEngine =
- new ConstantEvaluationEngine(typeProvider, context.declaredVariables,
- typeSystem: context.typeSystem);
- if (dependencyCycle == null) {
- constantEvaluationEngine.computeConstantValue(constant);
- } else {
- List<ConstantEvaluationTarget> constantsInCycle =
- <ConstantEvaluationTarget>[];
- int length = dependencyCycle.length;
- for (int i = 0; i < length; i++) {
- WorkItem workItem = dependencyCycle[i];
- if (workItem.descriptor == DESCRIPTOR) {
- AnalysisTarget target = workItem.target;
- constantsInCycle.add(target);
- if (target is ConstructorElementImpl) {
- target.isCycleFree = false;
- }
- }
- }
- assert(constantsInCycle.isNotEmpty);
- constantEvaluationEngine.generateCycleError(constantsInCycle, constant);
- }
- //
- // Record outputs.
- //
- outputs[CONSTANT_VALUE] = constant;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- ConstantEvaluationTarget evaluationTarget = target;
- return <String, TaskInput>{
- DEPENDENCIES_INPUT:
- CONSTANT_DEPENDENCIES.of(evaluationTarget).toListOf(CONSTANT_VALUE),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [ComputeConstantValueTask] based on the given [target] in the
- * given [context].
- */
- static ComputeConstantValueTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ComputeConstantValueTask(context, target);
- }
-}
-
-/**
- * A task that computes the [INFERABLE_STATIC_VARIABLE_DEPENDENCIES] for a
- * static variable whose type should be inferred.
- */
-class ComputeInferableStaticVariableDependenciesTask
- extends InferStaticVariableTask {
- /**
- * The name of the [RESOLVED_UNIT7] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ComputeInferableStaticVariableDependenciesTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[INFERABLE_STATIC_VARIABLE_DEPENDENCIES]);
-
- ComputeInferableStaticVariableDependenciesTask(
- InternalAnalysisContext context, VariableElement variable)
- : super(context, variable);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- //
- // Compute dependencies.
- //
- VariableDeclaration declaration = getDeclaration(unit);
- VariableGatherer gatherer = new VariableGatherer(_isInferableStatic);
- declaration.initializer.accept(gatherer);
- //
- // Record outputs.
- //
- outputs[INFERABLE_STATIC_VARIABLE_DEPENDENCIES] = gatherer.results.toList();
- }
-
- /**
- * Return `true` if the given [variable] is a static variable whose type
- * should be inferred.
- */
- bool _isInferableStatic(VariableElement variable) =>
- variable.isStatic &&
- variable.hasImplicitType &&
- variable.initializer != null;
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- if (target is VariableElement) {
- CompilationUnitElementImpl unit = target
- .getAncestor((Element element) => element is CompilationUnitElement);
- return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT7
- .of(new LibrarySpecificUnit(unit.librarySource, unit.source))
- };
- }
- throw new AnalysisException(
- 'Cannot build inputs for a ${target.runtimeType}');
- }
-
- /**
- * Create a [ComputeInferableStaticVariableDependenciesTask] based on the
- * given [target] in the given [context].
- */
- static ComputeInferableStaticVariableDependenciesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ComputeInferableStaticVariableDependenciesTask(context, target);
- }
-}
-
-/**
- * A task that computes the [LIBRARY_CYCLE] for a
- * library element. Also computes the [LIBRARY_CYCLE_UNITS] and the
- * [LIBRARY_CYCLE_DEPENDENCIES].
- */
-class ComputeLibraryCycleTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT2] input.
- */
- static const String LIBRARY_ELEMENT_INPUT = 'LIBRARY_ELEMENT_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ComputeLibraryCycleForUnitTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- LIBRARY_CYCLE,
- LIBRARY_CYCLE_UNITS,
- LIBRARY_CYCLE_DEPENDENCIES
- ]);
-
- ComputeLibraryCycleTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- // The computation of library cycles is necessarily non-local, since we
- // in general have to look at all of the reachable libraries
- // in order to find the strongly connected components. Repeating this
- // computation for every node would be quadratic. The libraryCycle getter
- // will avoid this by computing the library cycles for every reachable
- // library and recording it in the element model. This means that this
- // task implicitly produces the output for many other targets. This
- // can't be expressed in the task model right now: instead, we just
- // run tasks for those other targets, and they pick up the recorded
- // version off of the element model. Unfortunately, this means that
- // the task model will not handle the invalidation of the recorded
- // results for us. Instead, we must explicitly invalidate the recorded
- // library cycle information when we add or subtract edges from the
- // import/export graph. Any update that changes the
- // import/export graph will induce a recomputation of the LIBRARY_ELEMENT2
- // result for the changed node. This recomputation is responsible for
- // conservatively invalidating the library cycle information recorded
- // in the element model. The LIBRARY_CYCLE results that have been cached
- // by the task model are conservatively invalidated by the
- // IMPORT_EXPORT_SOURCE_CLOSURE dependency below. If anything reachable
- // from a node is changed, its LIBRARY_CYCLE results will be re-computed
- // here (possibly re-using the result from the element model if invalidation
- // did not cause it to be erased). In summary, task model dependencies
- // on the import/export source closure ensure that this method will be
- // re-run if anything reachable from this target has been invalidated,
- // and the invalidation code (invalidateLibraryCycles) will ensure that
- // element model results will be re-used here only if they are still valid.
- LibraryElement library = getRequiredInput(LIBRARY_ELEMENT_INPUT);
- if (!LibraryElementImpl.hasResolutionCapability(
- library, LibraryResolutionCapability.resolvedTypeNames)) {
- List<LibraryElement> component = library.libraryCycle;
- Set<LibraryElement> filter = component.toSet();
- Set<CompilationUnitElement> deps = new Set<CompilationUnitElement>();
- void addLibrary(LibraryElement l) {
- if (!filter.contains(l)) {
- deps.addAll(l.units);
- }
- }
-
- int length = component.length;
- for (int i = 0; i < length; i++) {
- LibraryElement library = component[i];
- library.importedLibraries.forEach(addLibrary);
- library.exportedLibraries.forEach(addLibrary);
- }
- //
- // Record outputs.
- //
- LibrarySpecificUnit unitToLSU(CompilationUnitElement unit) =>
- new LibrarySpecificUnit(unit.librarySource, unit.source);
- outputs[LIBRARY_CYCLE] = component;
- outputs[LIBRARY_CYCLE_UNITS] =
- component.expand((l) => l.units).map(unitToLSU).toList();
- outputs[LIBRARY_CYCLE_DEPENDENCIES] = deps.map(unitToLSU).toList();
- } else {
- outputs[LIBRARY_CYCLE] = <LibraryElement>[];
- outputs[LIBRARY_CYCLE_UNITS] = <LibrarySpecificUnit>[];
- outputs[LIBRARY_CYCLE_DEPENDENCIES] = <LibrarySpecificUnit>[];
- }
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source librarySource = target;
- return <String, TaskInput>{
- LIBRARY_ELEMENT_INPUT: LIBRARY_ELEMENT2.of(librarySource),
- 'resolveReachableLibraries': READY_LIBRARY_ELEMENT2.of(librarySource),
- };
- }
-
- /**
- * Create a [ComputeLibraryCycleTask] based on the
- * given [target] in the given [context].
- */
- static ComputeLibraryCycleTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ComputeLibraryCycleTask(context, target);
- }
-}
-
-/**
- * A task that builds [REQUIRED_CONSTANTS] for a unit.
- */
-class ComputeRequiredConstantsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ComputeRequiredConstantsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[PENDING_ERRORS, REQUIRED_CONSTANTS]);
-
- ComputeRequiredConstantsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- Source source = getRequiredSource();
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- //
- // Use the ErrorVerifier to compute errors.
- //
- RequiredConstantsComputer computer = new RequiredConstantsComputer(source);
- unit.accept(computer);
- List<PendingError> pendingErrors = computer.pendingErrors;
- List<ConstantEvaluationTarget> requiredConstants =
- computer.requiredConstants;
- //
- // Record outputs.
- //
- outputs[PENDING_ERRORS] = pendingErrors;
- outputs[REQUIRED_CONSTANTS] = requiredConstants;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT.of(unit)};
- }
-
- /**
- * Create a [ComputeRequiredConstantsTask] based on the given [target] in
- * the given [context].
- */
- static ComputeRequiredConstantsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ComputeRequiredConstantsTask(context, target);
- }
-}
-
-/**
- * A base class for analysis tasks whose target is expected to be a
- * [ConstantEvaluationTarget].
- */
-abstract class ConstantEvaluationAnalysisTask extends AnalysisTask {
- /**
- * Initialize a newly created task to perform analysis within the given
- * [context] in order to produce results for the given [constant].
- */
- ConstantEvaluationAnalysisTask(
- AnalysisContext context, ConstantEvaluationTarget constant)
- : super(context, constant);
-
- @override
- String get description {
- Source source = target.source;
- String sourceName = source == null ? '<unknown source>' : source.fullName;
- return '${descriptor.name} for element $target in source $sourceName';
- }
-}
-
-/**
- * A task that computes a list of the libraries containing the target source.
- */
-class ContainingLibrariesTask extends SourceBasedAnalysisTask {
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ContainingLibrariesTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CONTAINING_LIBRARIES]);
-
- ContainingLibrariesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- // TODO(brianwilkerson) This value can change as new libraries are analyzed
- // so we need some way of making sure that this result is removed from the
- // cache appropriately.
- Source source = getRequiredSource();
- outputs[CONTAINING_LIBRARIES] = context.getLibrariesContaining(source);
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- return <String, TaskInput>{};
- }
-
- /**
- * Create a [ContainingLibrariesTask] based on the given [target] in the given
- * [context].
- */
- static ContainingLibrariesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ContainingLibrariesTask(context, target);
- }
-}
-
-/**
- * A task that merges all of the errors for a single source into a single list
- * of errors.
- */
-class DartErrorsTask extends SourceBasedAnalysisTask {
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('DartErrorsTask',
- createTask, buildInputs, <ResultDescriptor>[DART_ERRORS]);
-
- /**
- * The name of the [IGNORE_INFO_INPUT] input.
- */
- static const String IGNORE_INFO_INPUT = 'IGNORE_INFO_INPUT';
-
- /**
- * The name of the [LINE_INFO_INPUT] input.
- */
- static const String LINE_INFO_INPUT = 'LINE_INFO_INPUT';
-
- DartErrorsTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- List<List<AnalysisError>> errorLists = <List<AnalysisError>>[];
-
- //
- // Filter ignored errors.
- //
- List<AnalysisError> errors =
- _filterIgnores(AnalysisError.mergeLists(errorLists));
-
- //
- // Record outputs.
- //
- outputs[DART_ERRORS] = errors;
- }
-
- List<AnalysisError> _filterIgnores(List<AnalysisError> errors) {
- if (errors.isEmpty) {
- return errors;
- }
-
- IgnoreInfo ignoreInfo = getRequiredInput(IGNORE_INFO_INPUT);
- if (!ignoreInfo.hasIgnores) {
- return errors;
- }
-
- LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT);
-
- return filterIgnored(errors, ignoreInfo, lineInfo);
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- Map<String, TaskInput> inputs = <String, TaskInput>{};
- inputs[LINE_INFO_INPUT] = LINE_INFO.of(source);
- inputs[IGNORE_INFO_INPUT] = IGNORE_INFO.of(source);
- return inputs;
- }
-
- /**
- * Create a [DartErrorsTask] based on the given [target] in the given
- * [context].
- */
- static DartErrorsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new DartErrorsTask(context, target);
- }
-
- /**
- * Return a new list with items from [errors] which are not filtered out by
- * the [ignoreInfo].
- */
- static List<AnalysisError> filterIgnored(
- List<AnalysisError> errors, IgnoreInfo ignoreInfo, LineInfo lineInfo) {
- if (errors.isEmpty || !ignoreInfo.hasIgnores) {
- return errors;
- }
-
- bool isIgnored(AnalysisError error) {
- int errorLine = lineInfo.getLocation(error.offset).lineNumber;
- String errorCode = error.errorCode.name.toLowerCase();
- return ignoreInfo.ignoredAt(errorCode, errorLine);
- }
-
- return errors.where((AnalysisError e) => !isIgnored(e)).toList();
- }
-}
-
-/**
- * A task that builds [RESOLVED_UNIT12] for a unit.
- */
-class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT11] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [CONSTANT_VALUE] input.
- */
- static const String CONSTANT_VALUES = 'CONSTANT_VALUES';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'EvaluateUnitConstantsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT12, RESOLVED_UNIT12]);
-
- EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- // No actual work needs to be performed; the task manager will ensure that
- // all constants are evaluated before this method is called.
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- outputs[RESOLVED_UNIT12] = unit;
- outputs[CREATED_RESOLVED_UNIT12] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- 'libraryElement': LIBRARY_ELEMENT9.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT11.of(unit),
- CONSTANT_VALUES:
- COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE),
- 'constantExpressionsDependencies':
- CONSTANT_EXPRESSIONS_DEPENDENCIES.of(unit).toListOf(CONSTANT_VALUE)
- };
- }
-
- /**
- * Create an [EvaluateUnitConstantsTask] based on the given [target] in
- * the given [context].
- */
- static EvaluateUnitConstantsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new EvaluateUnitConstantsTask(context, target);
- }
-}
-
-/**
- * A task that builds [USED_IMPORTED_ELEMENTS] for a unit.
- */
-class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT11] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'GatherUsedImportedElementsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[USED_IMPORTED_ELEMENTS]);
-
- GatherUsedImportedElementsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- LibraryElement libraryElement = unitElement.library;
- //
- // Prepare used imported elements.
- //
- GatherUsedImportedElementsVisitor visitor =
- new GatherUsedImportedElementsVisitor(libraryElement);
- unit.accept(visitor);
- //
- // Record outputs.
- //
- outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)};
- }
-
- /**
- * Create a [GatherUsedImportedElementsTask] based on the given [target] in
- * the given [context].
- */
- static GatherUsedImportedElementsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new GatherUsedImportedElementsTask(context, target);
- }
-}
-
-/**
- * A task that builds [USED_LOCAL_ELEMENTS] for a unit.
- */
-class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT11] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'GatherUsedLocalElementsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[USED_LOCAL_ELEMENTS]);
-
- GatherUsedLocalElementsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- LibraryElement libraryElement = unitElement.library;
- //
- // Prepare used local elements.
- //
- GatherUsedLocalElementsVisitor visitor =
- new GatherUsedLocalElementsVisitor(libraryElement);
- unit.accept(visitor);
- //
- // Record outputs.
- //
- outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)};
- }
-
- /**
- * Create a [GatherUsedLocalElementsTask] based on the given [target] in
- * the given [context].
- */
- static GatherUsedLocalElementsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new GatherUsedLocalElementsTask(context, target);
- }
-}
-
-/**
- * A task that generates [HINTS] for a unit.
- */
-class GenerateHintsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT11] input.
- */
- static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT';
-
- /**
- * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input.
- */
- static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS';
-
- /**
- * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input.
- */
- static const String USED_IMPORTED_ELEMENTS_INPUT = 'USED_IMPORTED_ELEMENTS';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'GenerateHintsTask', createTask, buildInputs, <ResultDescriptor>[HINTS]);
-
- GenerateHintsTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- AnalysisOptions analysisOptions = context.analysisOptions;
- if (!analysisOptions.hint) {
- outputs[HINTS] = AnalysisError.NO_ERRORS;
- return;
- }
- //
- // Prepare collectors.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- Source source = getRequiredSource();
- ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT);
- List<UsedImportedElements> usedImportedElementsList =
- getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT);
- List<UsedLocalElements> usedLocalElementsList =
- getRequiredInput(USED_LOCAL_ELEMENTS_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- LibraryElement libraryElement = unitElement.library;
- TypeSystem typeSystem = context.typeSystem;
-
- //
- // Generate errors.
- //
- unit.accept(new DeadCodeVerifier(
- errorReporter, (unit as CompilationUnitImpl).isNonNullable,
- typeSystem: typeSystem));
- // Verify imports.
- {
- ImportsVerifier verifier = new ImportsVerifier();
- verifier.addImports(unit);
- usedImportedElementsList.forEach(verifier.removeUsedElements);
- verifier.generateDuplicateImportHints(errorReporter);
- verifier.generateDuplicateShownHiddenNameHints(errorReporter);
- verifier.generateUnusedImportHints(errorReporter);
- verifier.generateUnusedShownNameHints(errorReporter);
- }
- // Unused local elements.
- {
- UsedLocalElements usedElements =
- new UsedLocalElements.merge(usedLocalElementsList);
- UnusedLocalElementsVerifier visitor =
- new UnusedLocalElementsVerifier(errorListener, usedElements);
- unit.accept(visitor);
- }
- // Dart2js analysis.
- if (analysisOptions.dart2jsHint) {
- unit.accept(new Dart2JSVerifier(errorReporter));
- }
- // Dart best practices.
- var inheritanceManager2 = new InheritanceManager2(context.typeSystem);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE;
-
- unit.accept(new BestPracticesVerifier(
- errorReporter, typeProvider, libraryElement,
- typeSystem: typeSystem,
- resourceProvider: resourceProvider,
- analysisOptions: context.analysisOptions));
- unit.accept(new OverrideVerifier(
- inheritanceManager2,
- libraryElement,
- errorReporter,
- ));
- // Find to-do comments.
- new ToDoFinder(errorReporter).findIn(unit);
- //
- // Record outputs.
- //
- outputs[HINTS] = errorListener.errors;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- Source libSource = unit.library;
- return <String, TaskInput>{
- RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(unit),
- USED_LOCAL_ELEMENTS_INPUT:
- LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_LOCAL_ELEMENTS),
- USED_IMPORTED_ELEMENTS_INPUT:
- LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_IMPORTED_ELEMENTS),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [GenerateHintsTask] based on the given [target] in
- * the given [context].
- */
- static GenerateHintsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new GenerateHintsTask(context, target);
- }
-}
-
-/**
- * A task that generates [LINTS] for a unit.
- */
-class GenerateLintsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT] input.
- */
- static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'GenerateLintsTask', createTask, buildInputs, <ResultDescriptor>[LINTS]);
-
- GenerateLintsTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- AnalysisOptions analysisOptions = context.analysisOptions;
- if (!analysisOptions.lint) {
- outputs[LINTS] = AnalysisError.NO_ERRORS;
- return;
- }
- //
- // Prepare collectors.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- Source source = getRequiredSource();
- ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT);
- //
- // Generate lints.
- //
- List<AstVisitor> visitors = <AstVisitor>[];
- bool timeVisits = analysisOptions.enableTiming;
- List<Linter> linters = getLints(context);
- int length = linters.length;
- for (int i = 0; i < length; i++) {
- Linter linter = linters[i];
- AstVisitor visitor = linter.getVisitor();
- if (visitor != null) {
- linter.reporter = errorReporter;
- if (timeVisits) {
- visitor = new TimedAstVisitor(visitor, lintRegistry.getTimer(linter));
- }
- visitors.add(visitor);
- }
- }
- AstVisitor visitor = new ExceptionHandlingDelegatingAstVisitor(
- visitors, ExceptionHandlingDelegatingAstVisitor.logException);
- unit.accept(visitor);
- //
- // Record outputs.
- //
- outputs[LINTS] = errorListener.errors;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) =>
- <String, TaskInput>{RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(target)};
-
- /**
- * Create a [GenerateLintsTask] based on the given [target] in
- * the given [context].
- */
- static GenerateLintsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new GenerateLintsTask(context, target);
- }
-}
-
-/**
- * A task that ensures that all of the inferable instance members in a
- * compilation unit have had their type inferred.
- */
-class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the input whose value is the [RESOLVED_UNIT8] for the
- * compilation unit.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'InferInstanceMembersInUnitTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT10, RESOLVED_UNIT10]);
-
- /**
- * Initialize a newly created task to build a library element for the given
- * [unit] in the given [context].
- */
- InferInstanceMembersInUnitTask(
- InternalAnalysisContext context, LibrarySpecificUnit unit)
- : super(context, unit);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
-
- //
- // Infer instance members.
- //
- var inheritance = new InheritanceManager2(context.typeSystem);
- InstanceMemberInferrer inferrer =
- new InstanceMemberInferrer(typeProvider, inheritance);
- inferrer.inferCompilationUnit(unit.declaredElement);
- //
- // Record outputs.
- //
- outputs[RESOLVED_UNIT10] = unit;
- outputs[CREATED_RESOLVED_UNIT10] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT9.of(unit),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- // In strong mode, add additional dependencies to enforce inference
- // ordering.
-
- // Require that field re-resolution be complete for all units in the
- // current library cycle.
- 'orderLibraryCycleTasks':
- LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT9),
- // Require that full inference be complete for all dependencies of the
- // current library cycle.
- 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
- .of(unit.library)
- .toListOf(CREATED_RESOLVED_UNIT10)
- };
- }
-
- /**
- * Create a [InferInstanceMembersInUnitTask] based on the given [target] in
- * the given [context].
- */
- static InferInstanceMembersInUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new InferInstanceMembersInUnitTask(context, target);
- }
-}
-
-/**
- * An abstract class that defines utility methods that are useful for tasks
- * operating on static variables.
- */
-abstract class InferStaticVariableTask extends ConstantEvaluationAnalysisTask {
- InferStaticVariableTask(
- InternalAnalysisContext context, VariableElement variable)
- : super(context, variable);
-
- /**
- * Return the declaration of the target within the given compilation [unit].
- * Throw an exception if the declaration cannot be found.
- */
- VariableDeclaration getDeclaration(CompilationUnit unit) {
- VariableElement variable = target;
- int offset = variable.nameOffset;
- AstNode node = new NodeLocator2(offset).searchWithin(unit);
- if (node == null) {
- Source variableSource = variable.source;
- Source unitSource =
- resolutionMap.elementDeclaredByCompilationUnit(unit).source;
- if (variableSource != unitSource) {
- throw new AnalysisException(
- "Failed to find the AST node for the variable "
- "${variable.displayName} at $offset in $variableSource "
- "because we were looking in $unitSource");
- }
- throw new AnalysisException(
- "Failed to find the AST node for the variable "
- "${variable.displayName} at $offset in $variableSource");
- }
- VariableDeclaration declaration =
- node.thisOrAncestorOfType<VariableDeclaration>();
- if (declaration == null || declaration.name != node) {
- Source variableSource = variable.source;
- Source unitSource =
- resolutionMap.elementDeclaredByCompilationUnit(unit).source;
- if (variableSource != unitSource) {
- if (declaration == null) {
- throw new AnalysisException(
- "Failed to find the declaration of the variable "
- "${variable.displayName} at $offset in $variableSource "
- "because the node was not in a variable declaration "
- "possibly because we were looking in $unitSource");
- }
- throw new AnalysisException(
- "Failed to find the declaration of the variable "
- "${variable.displayName} at $offset in $variableSource "
- "because we were looking in $unitSource");
- }
- if (declaration == null) {
- throw new AnalysisException(
- "Failed to find the declaration of the variable "
- "${variable.displayName} at $offset in $variableSource "
- "because the node was not in a variable declaration");
- }
- throw new AnalysisException(
- "Failed to find the declaration of the variable "
- "${variable.displayName} at $offset in $variableSource "
- "because the node was not the name in a variable declaration");
- }
- return declaration;
- }
-}
-
-/**
- * A task that ensures that all of the inferable static variables in a
- * compilation unit have had their type inferred.
- */
-class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the [RESOLVED_UNIT8] for the
- * compilation unit.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [STATIC_VARIABLE_RESOLUTION_ERRORS] for all static
- * variables in the compilation unit.
- */
- static const String ERRORS_LIST_INPUT = 'INFERRED_VARIABLES_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'InferStaticVariableTypesInUnitTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- CREATED_RESOLVED_UNIT8,
- RESOLVED_UNIT8,
- STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT
- ]);
-
- /**
- * Initialize a newly created task to build a library element for the given
- * [unit] in the given [context].
- */
- InferStaticVariableTypesInUnitTask(
- InternalAnalysisContext context, LibrarySpecificUnit unit)
- : super(context, unit);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- List<List<AnalysisError>> errorLists = getRequiredInput(ERRORS_LIST_INPUT);
- //
- // Record outputs. There is no additional work to be done at this time
- // because the work has implicitly been done by virtue of the task model
- // preparing all of the inputs.
- //
- outputs[RESOLVED_UNIT8] = unit;
- outputs[CREATED_RESOLVED_UNIT8] = true;
- outputs[STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT] =
- AnalysisError.mergeLists(errorLists);
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- 'inferredTypes': INFERABLE_STATIC_VARIABLES_IN_UNIT
- .of(unit)
- .toListOf(INFERRED_STATIC_VARIABLE),
- ERRORS_LIST_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT
- .of(unit)
- .toListOf(STATIC_VARIABLE_RESOLUTION_ERRORS),
- UNIT_INPUT: RESOLVED_UNIT7.of(unit)
- };
- }
-
- /**
- * Create a [InferStaticVariableTypesInUnitTask] based on the given [target]
- * in the given [context].
- */
- static InferStaticVariableTypesInUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new InferStaticVariableTypesInUnitTask(context, target);
- }
-}
-
-/**
- * A task that computes the type of an inferable static variable and
- * stores it in the element model.
- */
-class InferStaticVariableTypeTask extends InferStaticVariableTask {
- /**
- * The name of the input which ensures that dependent values have their type
- * inferred before the target.
- */
- static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT8] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'InferStaticVariableTypeTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- INFERRED_STATIC_VARIABLE,
- STATIC_VARIABLE_RESOLUTION_ERRORS
- ]);
-
- InferStaticVariableTypeTask(
- InternalAnalysisContext context, VariableElement variable)
- : super(context, variable);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- // Note: DEPENDENCIES_INPUT is not needed. It is merely a bookkeeping
- // dependency to ensure that the variables that this variable references
- // have types inferred before inferring the type of this variable.
- //
- VariableElementImpl variable = target;
-
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- var inheritance = new InheritanceManager2(context.typeSystem);
-
- // If we're not in a dependency cycle, and we have no type annotation,
- // re-resolve the right hand side and do inference.
- List<AnalysisError> errors = AnalysisError.NO_ERRORS;
- if (dependencyCycle == null && variable.hasImplicitType) {
- VariableDeclaration declaration = getDeclaration(unit);
- //
- // Re-resolve the variable's initializer so that the inferred types
- // of other variables will be propagated.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- Expression initializer = declaration.initializer;
-
- ResolutionContext resolutionContext =
- ResolutionContextBuilder.contextFor(initializer);
- ResolverVisitor visitor = new ResolverVisitor(inheritance,
- variable.library, variable.source, typeProvider, errorListener,
- nameScope: resolutionContext.scope);
- if (resolutionContext.enclosingClassDeclaration != null) {
- visitor.prepareToResolveMembersInClass(
- resolutionContext.enclosingClassDeclaration);
- }
- initializer.accept(visitor);
- DartType newType = initializer.staticType;
- if (newType == null || newType.isBottom || newType.isDartCoreNull) {
- newType = typeProvider.dynamicType;
- }
-
- //
- // Record the type of the variable.
- //
- setFieldType(variable, newType);
- errors = getUniqueErrors(errorListener.errors);
- } else {
- // TODO(brianwilkerson) For now we simply don't infer any type for
- // variables or fields involved in a cycle. We could try to be smarter
- // by re-resolving the initializer in a context in which the types of all
- // of the variables in the cycle are assumed to be `null`, but it isn't
- // clear to me that this would produce better results often enough to
- // warrant the extra effort.
- }
- //
- // Record outputs.
- //
- outputs[INFERRED_STATIC_VARIABLE] = variable;
- outputs[STATIC_VARIABLE_RESOLUTION_ERRORS] = errors;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- VariableElement variable = target;
- LibrarySpecificUnit unit =
- new LibrarySpecificUnit(variable.library.source, variable.source);
- return <String, TaskInput>{
- DEPENDENCIES_INPUT: INFERABLE_STATIC_VARIABLE_DEPENDENCIES
- .of(variable)
- .toListOf(INFERRED_STATIC_VARIABLE),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT7.of(unit),
- // In strong mode, add additional dependencies to enforce inference
- // ordering.
-
- // Require that full inference be complete for all dependencies of the
- // current library cycle.
- 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
- .of(unit.library)
- .toListOf(CREATED_RESOLVED_UNIT10)
- };
- }
-
- /**
- * Create a [InferStaticVariableTypeTask] based on the given [target] in the
- * given [context].
- */
- static InferStaticVariableTypeTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new InferStaticVariableTypeTask(context, target);
- }
-}
-
-/**
- * A task computes all of the errors of all of the units for a single
- * library source and sets the [LIBRARY_ERRORS_READY] flag.
- */
-class LibraryErrorsReadyTask extends SourceBasedAnalysisTask {
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'LibraryErrorsReadyTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ERRORS_READY]);
-
- LibraryErrorsReadyTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- outputs[LIBRARY_ERRORS_READY] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'allErrors': UNITS.of(source).toListOf(DART_ERRORS),
- 'libraryElement': LIBRARY_ELEMENT.of(source)
- };
- }
-
- /**
- * Create a [LibraryErrorsReadyTask] based on the given [target] in the given
- * [context].
- */
- static LibraryErrorsReadyTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new LibraryErrorsReadyTask(context, target);
- }
-}
-
-/**
- * A task that merges all of the errors for a single source into a single list
- * of errors.
- */
-class LibraryUnitErrorsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [BUILD_DIRECTIVES_ERRORS] input.
- */
- static const String BUILD_DIRECTIVES_ERRORS_INPUT = 'BUILD_DIRECTIVES_ERRORS';
-
- /**
- * The name of the [BUILD_LIBRARY_ERRORS] input.
- */
- static const String BUILD_LIBRARY_ERRORS_INPUT = 'BUILD_LIBRARY_ERRORS';
-
- /**
- * The name of the [HINTS] input.
- */
- static const String HINTS_INPUT = 'HINTS';
-
- /**
- * The name of the [LINTS] input.
- */
- static const String LINTS_INPUT = 'LINTS';
-
- /**
- * The name of the [STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT] input.
- */
- static const String STATIC_VARIABLE_RESOLUTION_ERRORS_INPUT =
- 'STATIC_VARIABLE_RESOLUTION_ERRORS_INPUT';
-
- /**
- * The name of the [RESOLVE_DIRECTIVES_ERRORS] input.
- */
- static const String RESOLVE_DIRECTIVES_ERRORS_INPUT =
- 'RESOLVE_DIRECTIVES_ERRORS';
-
- /**
- * The name of the [STRONG_MODE_ERRORS] input.
- */
- static const String STRONG_MODE_ERRORS_INPUT = 'STRONG_MODE_ERRORS';
-
- /**
- * The name of the [RESOLVE_TYPE_NAMES_ERRORS] input.
- */
- static const String RESOLVE_TYPE_NAMES_ERRORS_INPUT =
- 'RESOLVE_TYPE_NAMES_ERRORS';
-
- /**
- * The name of the [RESOLVE_TYPE_BOUNDS_ERRORS] input.
- */
- static const String RESOLVE_TYPE_NAMES_ERRORS2_INPUT =
- 'RESOLVE_TYPE_NAMES_ERRORS2';
-
- /**
- * The name of the [RESOLVE_UNIT_ERRORS] input.
- */
- static const String RESOLVE_UNIT_ERRORS_INPUT = 'RESOLVE_UNIT_ERRORS';
-
- /**
- * The name of the [VARIABLE_REFERENCE_ERRORS] input.
- */
- static const String VARIABLE_REFERENCE_ERRORS_INPUT =
- 'VARIABLE_REFERENCE_ERRORS';
-
- /**
- * The name of the [VERIFY_ERRORS] input.
- */
- static const String VERIFY_ERRORS_INPUT = 'VERIFY_ERRORS';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'LibraryUnitErrorsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_UNIT_ERRORS]);
-
- LibraryUnitErrorsTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- List<List<AnalysisError>> errorLists = <List<AnalysisError>>[];
- errorLists.add(getRequiredInput(BUILD_DIRECTIVES_ERRORS_INPUT));
- errorLists.add(getRequiredInput(BUILD_LIBRARY_ERRORS_INPUT));
- errorLists.add(getRequiredInput(HINTS_INPUT));
- errorLists.add(getRequiredInput(LINTS_INPUT));
- errorLists.add(getRequiredInput(RESOLVE_DIRECTIVES_ERRORS_INPUT));
- errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS_INPUT));
- errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS2_INPUT));
- errorLists.add(getRequiredInput(RESOLVE_UNIT_ERRORS_INPUT));
- errorLists.add(getRequiredInput(STATIC_VARIABLE_RESOLUTION_ERRORS_INPUT));
- errorLists.add(getRequiredInput(STRONG_MODE_ERRORS_INPUT));
- errorLists.add(getRequiredInput(VARIABLE_REFERENCE_ERRORS_INPUT));
- errorLists.add(getRequiredInput(VERIFY_ERRORS_INPUT));
- //
- // Record outputs.
- //
- outputs[LIBRARY_UNIT_ERRORS] = AnalysisError.mergeLists(errorLists);
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [unit].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- Map<String, TaskInput> inputs = <String, TaskInput>{
- HINTS_INPUT: HINTS.of(unit),
- LINTS_INPUT: LINTS.of(unit),
- RESOLVE_DIRECTIVES_ERRORS_INPUT: RESOLVE_DIRECTIVES_ERRORS.of(unit),
- RESOLVE_TYPE_NAMES_ERRORS_INPUT: RESOLVE_TYPE_NAMES_ERRORS.of(unit),
- RESOLVE_TYPE_NAMES_ERRORS2_INPUT: RESOLVE_TYPE_BOUNDS_ERRORS.of(unit),
- RESOLVE_UNIT_ERRORS_INPUT: RESOLVE_UNIT_ERRORS.of(unit),
- STATIC_VARIABLE_RESOLUTION_ERRORS_INPUT:
- STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT.of(unit),
- STRONG_MODE_ERRORS_INPUT: STRONG_MODE_ERRORS.of(unit),
- VARIABLE_REFERENCE_ERRORS_INPUT: VARIABLE_REFERENCE_ERRORS.of(unit),
- VERIFY_ERRORS_INPUT: VERIFY_ERRORS.of(unit)
- };
- Source source = unit.source;
- if (unit.library == source) {
- inputs[BUILD_DIRECTIVES_ERRORS_INPUT] =
- BUILD_DIRECTIVES_ERRORS.of(source);
- inputs[BUILD_LIBRARY_ERRORS_INPUT] = BUILD_LIBRARY_ERRORS.of(source);
- } else {
- inputs[BUILD_DIRECTIVES_ERRORS_INPUT] =
- new ConstantTaskInput(AnalysisError.NO_ERRORS);
- inputs[BUILD_LIBRARY_ERRORS_INPUT] =
- new ConstantTaskInput(AnalysisError.NO_ERRORS);
- }
- return inputs;
- }
-
- /**
- * Create a [LibraryUnitErrorsTask] based on the given [target] in the given
- * [context].
- */
- static LibraryUnitErrorsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new LibraryUnitErrorsTask(context, target);
- }
-}
-
-/**
- * A task that parses the content of a Dart file, producing an AST structure,
- * any lexical errors found in the process, the kind of the file (library or
- * part), and several lists based on the AST.
- */
-class ParseDartTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the line information produced for the
- * file.
- */
- static const String LINE_INFO_INPUT_NAME = 'LINE_INFO_INPUT_NAME';
-
- /**
- * The name of the input whose value is the modification time of the file.
- */
- static const String MODIFICATION_TIME_INPUT_NAME =
- 'MODIFICATION_TIME_INPUT_NAME';
-
- /**
- * The name of the input whose value is the token stream produced for the file.
- */
- static const String TOKEN_STREAM_INPUT_NAME = 'TOKEN_STREAM_INPUT_NAME';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ParseDartTask', createTask, buildInputs, <ResultDescriptor>[
- EXPLICITLY_IMPORTED_LIBRARIES,
- EXPORTED_LIBRARIES,
- IMPORTED_LIBRARIES,
- INCLUDED_PARTS,
- LIBRARY_SPECIFIC_UNITS,
- PARSE_ERRORS,
- PARSED_UNIT,
- REFERENCED_SOURCES,
- SOURCE_KIND,
- UNITS,
- ]);
-
- /**
- * The source that is being parsed.
- */
- Source _source;
-
- /**
- * The [ErrorReporter] to report errors to.
- */
- ErrorReporter _errorReporter;
-
- /**
- * Initialize a newly created task to parse the content of the Dart file
- * associated with the given [target] in the given [context].
- */
- ParseDartTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- _source = getRequiredSource();
- LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
- int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT_NAME);
- Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME);
-
- RecordingErrorListener errorListener = new RecordingErrorListener();
- _errorReporter = new ErrorReporter(errorListener, _source);
-
- AnalysisOptions options = context.analysisOptions;
- Parser parser =
- new Parser(_source, errorListener, useFasta: options.useFastaParser);
- parser.parseFunctionBodies =
- options.analyzeFunctionBodiesPredicate(_source);
- parser.enableOptionalNewAndConst = true;
- CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
- unit.lineInfo = lineInfo;
-
- if (options.patchPaths.isNotEmpty && _source.uri.scheme == 'dart') {
- var resourceProvider =
- (context.sourceFactory.dartSdk as FolderBasedDartSdk)
- .resourceProvider;
- new SdkPatcher().patch(resourceProvider,
- context.analysisOptions.patchPaths, errorListener, _source, unit);
- }
-
- bool hasNonPartOfDirective = false;
- bool hasPartOfDirective = false;
- HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>();
- HashSet<Source> exportedSourceSet = new HashSet<Source>();
- HashSet<Source> includedSourceSet = new HashSet<Source>();
- NodeList<Directive> directives = unit.directives;
- int length = directives.length;
- for (int i = 0; i < length; i++) {
- Directive directive = directives[i];
- if (directive is PartOfDirective) {
- hasPartOfDirective = true;
- } else {
- hasNonPartOfDirective = true;
- if (directive is UriBasedDirective) {
- Source referencedSource = _resolveDirective(directive);
- if (referencedSource != null) {
- if (directive is ExportDirective) {
- exportedSourceSet.add(referencedSource);
- } else if (directive is ImportDirective) {
- explicitlyImportedSourceSet.add(referencedSource);
- } else if (directive is PartDirective) {
- includedSourceSet.add(referencedSource);
- } else {
- throw new AnalysisException(
- '$runtimeType failed to handle a ${directive.runtimeType}');
- }
- }
- }
- }
- }
- //
- // Always include "dart:core" source.
- //
- HashSet<Source> importedSourceSet =
- new HashSet.from(explicitlyImportedSourceSet);
- Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE);
- if (coreLibrarySource == null) {
- String message;
- DartSdk sdk = context.sourceFactory.dartSdk;
- if (sdk == null) {
- message = 'Could not resolve "dart:core": SDK not defined';
- } else {
- message = 'Could not resolve "dart:core": SDK incorrectly configured';
- }
- throw new AnalysisException(message);
- }
- importedSourceSet.add(coreLibrarySource);
- //
- // Compute kind.
- //
- SourceKind sourceKind = SourceKind.LIBRARY;
- if (modificationTime == -1) {
- sourceKind = SourceKind.UNKNOWN;
- } else if (hasPartOfDirective && !hasNonPartOfDirective) {
- sourceKind = SourceKind.PART;
- }
- //
- // Compute source lists.
- //
- List<Source> explicitlyImportedSources =
- explicitlyImportedSourceSet.toList();
- List<Source> exportedSources = exportedSourceSet.toList();
- List<Source> importedSources = importedSourceSet.toList();
- List<Source> includedSources = includedSourceSet.toList();
- List<Source> unitSources = <Source>[_source]..addAll(includedSourceSet);
- List<LibrarySpecificUnit> librarySpecificUnits =
- unitSources.map((s) => new LibrarySpecificUnit(_source, s)).toList();
- //
- // Compute referenced sources.
- //
- Set<Source> referencedSources = new Set<Source>();
- referencedSources.add(coreLibrarySource);
- referencedSources.addAll(unitSources);
- for (Directive directive in unit.directives) {
- if (directive is NamespaceDirective) {
- referencedSources.add(directive.uriSource);
- for (Configuration configuration in directive.configurations) {
- referencedSources.add(configuration.uriSource);
- }
- }
- }
- referencedSources.removeWhere((source) => source == null);
- //
- // Record outputs.
- //
- List<AnalysisError> parseErrors = getUniqueErrors(errorListener.errors);
- outputs[EXPLICITLY_IMPORTED_LIBRARIES] = explicitlyImportedSources;
- outputs[EXPORTED_LIBRARIES] = exportedSources;
- outputs[IMPORTED_LIBRARIES] = importedSources;
- outputs[INCLUDED_PARTS] = includedSources;
- outputs[LIBRARY_SPECIFIC_UNITS] = librarySpecificUnits;
- outputs[PARSE_ERRORS] = parseErrors;
- outputs[PARSED_UNIT] = unit;
- outputs[REFERENCED_SOURCES] = referencedSources.toList();
- outputs[SOURCE_KIND] = sourceKind;
- outputs[UNITS] = unitSources;
- }
-
- /**
- * Return the result of resolving the URI of the given URI-based [directive]
- * against the URI of the given library, or `null` if the URI is not valid.
- */
- Source _resolveDirective(UriBasedDirective directive) {
- bool isImport = directive is ImportDirective;
-
- // Resolve the default URI.
- Source defaultSource;
- {
- StringLiteral uriLiteral = directive.uri;
- String uriContent = uriLiteral.stringValue;
- if (uriContent != null) {
- uriContent = uriContent.trim();
- directive.uriContent = uriContent;
- }
- defaultSource = _resolveUri(isImport, uriLiteral, uriContent);
- directive.uriSource = defaultSource;
- }
-
- // Resolve all configurations and try to choose one.
- if (directive is NamespaceDirectiveImpl) {
- String configuredUriContent;
- Source configuredSource;
- for (Configuration configuration in directive.configurations) {
- String uriContent = configuration.uri.stringValue;
- Source source = _resolveUri(isImport, configuration.uri, uriContent);
- configuration.uriSource = source;
- if (configuredSource == null) {
- String variableName =
- configuration.name.components.map((i) => i.name).join('.');
- String variableValue = context.declaredVariables.get(variableName);
- if (configuration.value != null &&
- variableValue == configuration.value.stringValue ||
- variableValue == 'true') {
- configuredUriContent = configuration.uri.stringValue;
- configuredSource = source;
- }
- }
- }
- String selectedContentUri = configuredUriContent ?? directive.uriContent;
- Source selectedSource = configuredSource ?? defaultSource;
- directive.selectedUriContent = selectedContentUri;
- directive.selectedSource = selectedSource;
- return selectedSource;
- }
- return defaultSource;
- }
-
- /**
- * Return the result of resolve the given [uriContent], reporting errors
- * against the [uriLiteral].
- */
- Source _resolveUri(
- bool isImport, StringLiteral uriLiteral, String uriContent) {
- UriValidationCode code =
- UriBasedDirectiveImpl.validateUri(isImport, uriLiteral, uriContent);
- if (code == null) {
- try {
- Uri.parse(uriContent);
- } on FormatException {
- return null;
- }
- return context.sourceFactory.resolveUri(_source, uriContent);
- } else if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) {
- return null;
- } else if (code == UriValidationCode.URI_WITH_INTERPOLATION) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.URI_WITH_INTERPOLATION, uriLiteral);
- return null;
- } else if (code == UriValidationCode.INVALID_URI) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.INVALID_URI, uriLiteral, [uriContent]);
- return null;
- }
- throw new AnalysisException('Failed to handle validation code: $code');
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- return <String, TaskInput>{
- LINE_INFO_INPUT_NAME: LINE_INFO.of(target),
- MODIFICATION_TIME_INPUT_NAME: MODIFICATION_TIME.of(target),
- TOKEN_STREAM_INPUT_NAME: TOKEN_STREAM.of(target, flushOnAccess: true)
- };
- }
-
- /**
- * Create a [ParseDartTask] based on the given [target] in the given
- * [context].
- */
- static ParseDartTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ParseDartTask(context, target);
- }
-}
-
-/**
- * A task that builds [RESOLVED_UNIT7] for a unit.
- */
-class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT6] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT6] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'PartiallyResolveUnitReferencesTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- INFERABLE_STATIC_VARIABLES_IN_UNIT,
- CREATED_RESOLVED_UNIT7,
- RESOLVED_UNIT7
- ]);
-
- PartiallyResolveUnitReferencesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- var inheritance = new InheritanceManager2(context.typeSystem);
- //
- // Resolve references and record outputs.
- //
- PartialResolverVisitor visitor = new PartialResolverVisitor(
- inheritance,
- libraryElement,
- unitElement.source,
- typeProvider,
- AnalysisErrorListener.NULL_LISTENER);
- unit.accept(visitor);
- //
- // Record outputs.
- //
- outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables;
- outputs[RESOLVED_UNIT7] = unit;
- outputs[CREATED_RESOLVED_UNIT7] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT6.of(unit.library),
- LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT6.of(unit),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- // In strong mode, add additional dependencies to enforce inference
- // ordering.
-
- // Require that full inference be complete for all dependencies of the
- // current library cycle.
- 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
- .of(unit.library)
- .toListOf(CREATED_RESOLVED_UNIT10)
- };
- }
-
- /**
- * Create a [PartiallyResolveUnitReferencesTask] based on the given [target]
- * in the given [context].
- */
- static PartiallyResolveUnitReferencesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new PartiallyResolveUnitReferencesTask(context, target);
- }
-}
-
-/**
- * A task that ensures that [LIBRARY_ELEMENT2] is ready for the target library
- * source and its import/export closure.
- */
-class ReadyLibraryElement2Task extends SourceBasedAnalysisTask {
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ReadyLibraryElement2Task',
- createTask,
- buildInputs,
- <ResultDescriptor>[READY_LIBRARY_ELEMENT2]);
-
- ReadyLibraryElement2Task(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- outputs[READY_LIBRARY_ELEMENT2] = true;
- }
-
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'thisLibraryElementReady': LIBRARY_ELEMENT2.of(source),
- 'directlyImportedLibrariesReady':
- IMPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT2),
- 'directlyExportedLibrariesReady':
- EXPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT2),
- };
- }
-
- static ReadyLibraryElement2Task createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ReadyLibraryElement2Task(context, target);
- }
-}
-
-/**
- * A task that ensures that [LIBRARY_ELEMENT6] is ready for the target library
- * source and its import/export closure.
- */
-class ReadyLibraryElement5Task extends SourceBasedAnalysisTask {
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ReadyLibraryElement5Task',
- createTask,
- buildInputs,
- <ResultDescriptor>[READY_LIBRARY_ELEMENT6]);
-
- ReadyLibraryElement5Task(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- outputs[READY_LIBRARY_ELEMENT6] = true;
- }
-
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'thisLibraryElementReady': LIBRARY_ELEMENT6.of(source),
- 'directlyImportedLibrariesReady':
- IMPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT6),
- 'directlyExportedLibrariesReady':
- EXPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT6),
- };
- }
-
- static ReadyLibraryElement5Task createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ReadyLibraryElement5Task(context, target);
- }
-}
-
-/**
- * A task that ensures that [LIBRARY_ELEMENT7] is ready for the target library
- * source and its import/export closure.
- */
-class ReadyLibraryElement7Task extends SourceBasedAnalysisTask {
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ReadyLibraryElement7Task',
- createTask,
- buildInputs,
- <ResultDescriptor>[READY_LIBRARY_ELEMENT7]);
-
- ReadyLibraryElement7Task(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- outputs[READY_LIBRARY_ELEMENT7] = true;
- }
-
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'thisLibraryElementReady': LIBRARY_ELEMENT7.of(source),
- 'directlyImportedLibrariesReady':
- IMPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT7),
- 'directlyExportedLibrariesReady':
- EXPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT7),
- };
- }
-
- static ReadyLibraryElement7Task createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ReadyLibraryElement7Task(context, target);
- }
-}
-
-/**
- * A task that ensures that [RESOLVED_UNIT] is ready for every unit of the
- * target library source and its import/export closure.
- */
-class ReadyResolvedUnitTask extends SourceBasedAnalysisTask {
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ReadyResolvedUnitTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[READY_RESOLVED_UNIT]);
-
- ReadyResolvedUnitTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- outputs[READY_RESOLVED_UNIT] = true;
- }
-
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'thisLibraryUnitsReady':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT),
- };
- }
-
- static ReadyResolvedUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ReadyResolvedUnitTask(context, target);
- }
-}
-
-/**
- * A task that ensures that the expression AST for a constant is resolved and
- * sets the [CONSTANT_EXPRESSION_RESOLVED] result.
- */
-class ResolveConstantExpressionTask extends ConstantEvaluationAnalysisTask {
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveConstantExpressionTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CONSTANT_EXPRESSION_RESOLVED]);
-
- ResolveConstantExpressionTask(
- InternalAnalysisContext context, ConstantEvaluationTarget constant)
- : super(context, constant);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Record outputs.
- //
- outputs[CONSTANT_EXPRESSION_RESOLVED] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source librarySource;
- if (target is Element) {
- CompilationUnitElementImpl unit = target
- .getAncestor((Element element) => element is CompilationUnitElement);
- librarySource = unit.librarySource;
- } else if (target is ElementAnnotationImpl) {
- librarySource = target.librarySource;
- } else {
- throw new AnalysisException(
- 'Cannot build inputs for a ${target.runtimeType}');
- }
- return <String, TaskInput>{
- 'createdResolvedUnit': CREATED_RESOLVED_UNIT11
- .of(new LibrarySpecificUnit(librarySource, target.source))
- };
- }
-
- /**
- * Create a [ResolveConstantExpressionTask] based on the given [target] in
- * the given [context].
- */
- static ResolveConstantExpressionTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveConstantExpressionTask(context, target);
- }
-}
-
-/**
- * A task that resolves imports and export directives to already built elements.
- */
-class ResolveDirectiveElementsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [LIBRARY_ELEMENT2].
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the input for [RESOLVED_UNIT1] of a unit.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- static const String SOURCES_MODIFICATION_TIME_INPUT =
- 'SOURCES_MODIFICATION_TIME_INPUT';
- static const String IMPORTS_SOURCE_KIND_INPUT = 'IMPORTS_SOURCE_KIND_INPUT';
- static const String EXPORTS_SOURCE_KIND_INPUT = 'EXPORTS_SOURCE_KIND_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveDirectiveElementsTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- CREATED_RESOLVED_UNIT2,
- RESOLVED_UNIT2,
- RESOLVE_DIRECTIVES_ERRORS
- ]);
-
- ResolveDirectiveElementsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibrarySpecificUnit targetUnit = target;
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- Map<Source, int> sourceModificationTimeMap =
- getRequiredInput(SOURCES_MODIFICATION_TIME_INPUT);
- Map<Source, SourceKind> importSourceKindMap =
- getRequiredInput(IMPORTS_SOURCE_KIND_INPUT);
- Map<Source, SourceKind> exportSourceKindMap =
- getRequiredInput(EXPORTS_SOURCE_KIND_INPUT);
- //
- // Resolve directive AST nodes to elements.
- //
- List<AnalysisError> errors = const <AnalysisError>[];
- if (targetUnit.unit == targetUnit.library) {
- DirectiveResolver resolver = new DirectiveResolver(
- sourceModificationTimeMap, importSourceKindMap, exportSourceKindMap);
- unit.accept(resolver);
- errors = resolver.errors;
- }
- //
- // Record outputs.
- //
- outputs[CREATED_RESOLVED_UNIT2] = true;
- outputs[RESOLVED_UNIT2] = unit;
- outputs[RESOLVE_DIRECTIVES_ERRORS] = errors;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT2.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT1.of(unit),
- SOURCES_MODIFICATION_TIME_INPUT:
- REFERENCED_SOURCES.of(unit.library).toMapOf(MODIFICATION_TIME),
- IMPORTS_SOURCE_KIND_INPUT:
- IMPORTED_LIBRARIES.of(unit.library).toMapOf(SOURCE_KIND),
- EXPORTS_SOURCE_KIND_INPUT:
- EXPORTED_LIBRARIES.of(unit.library).toMapOf(SOURCE_KIND)
- };
- }
-
- /**
- * Create a [ResolveDirectiveElementsTask] based on the given [target] in
- * the given [context].
- */
- static ResolveDirectiveElementsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveDirectiveElementsTask(context, target);
- }
-}
-
-/**
- * An artificial task that does nothing except to force [LIBRARY_ELEMENT7] for
- * the target library and its import/export closure.
- */
-class ResolvedUnit7InLibraryClosureTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT7] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolvedUnit7InLibraryClosureTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT8]);
-
- ResolvedUnit7InLibraryClosureTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- outputs[LIBRARY_ELEMENT8] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'readyForClosure': READY_LIBRARY_ELEMENT7.of(source),
- LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source),
- };
- }
-
- /**
- * Create a [ResolvedUnit7InLibraryClosureTask] based on the given
- * [target] in the given [context].
- */
- static ResolvedUnit7InLibraryClosureTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolvedUnit7InLibraryClosureTask(context, target);
- }
-}
-
-/**
- * An artificial task that does nothing except to force [LIBRARY_ELEMENT6] and
- * [RESOLVED_UNIT7] in the defining and part units of a library.
- */
-class ResolvedUnit7InLibraryTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT6] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolvedUnit7InLibraryTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT7]);
-
- ResolvedUnit7InLibraryTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- outputs[LIBRARY_ELEMENT7] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'resolvedUnits':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT7),
- LIBRARY_INPUT: LIBRARY_ELEMENT6.of(source),
- };
- }
-
- /**
- * Create a [ResolvedUnit7InLibraryTask] based on the given [target]
- * in the given [context].
- */
- static ResolvedUnit7InLibraryTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolvedUnit7InLibraryTask(context, target);
- }
-}
-
-/**
- * A task that ensures that all of the inferable instance members in a
- * compilation unit have had their right hand sides re-resolved
- */
-class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT6] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the input whose value is the [RESOLVED_UNIT8] for the
- * compilation unit.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveInstanceFieldsInUnitTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]);
-
- /**
- * Initialize a newly created task to build a library element for the given
- * [unit] in the given [context].
- */
- ResolveInstanceFieldsInUnitTask(
- InternalAnalysisContext context, LibrarySpecificUnit unit)
- : super(context, unit);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- var inheritance = new InheritanceManager2(context.typeSystem);
-
- CompilationUnitElement unitElement = unit.declaredElement;
- //
- // Resolve references.
- //
- InstanceFieldResolverVisitor visitor = new InstanceFieldResolverVisitor(
- inheritance,
- libraryElement,
- unitElement.source,
- typeProvider,
- AnalysisErrorListener.NULL_LISTENER);
- visitor.resolveCompilationUnit(unit);
- //
- // Record outputs.
- //
- outputs[RESOLVED_UNIT9] = unit;
- outputs[CREATED_RESOLVED_UNIT9] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [libSource].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT8.of(unit),
- LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- // In strong mode, add additional dependencies to enforce inference
- // ordering.
-
- // Require that static variable inference be complete for all units in
- // the current library cycle.
- 'orderLibraryCycleTasks':
- LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT8),
- // Require that full inference be complete for all dependencies of the
- // current library cycle.
- 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
- .of(unit.library)
- .toListOf(CREATED_RESOLVED_UNIT10)
- };
- }
-
- /**
- * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in
- * the given [context].
- */
- static ResolveInstanceFieldsInUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveInstanceFieldsInUnitTask(context, target);
- }
-}
-
-/**
- * A task that finishes resolution by requesting [RESOLVED_UNIT11] for every
- * unit in the libraries closure and produces [LIBRARY_ELEMENT9].
- */
-class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT8] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveLibraryReferencesTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT9]);
-
- ResolveLibraryReferencesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- outputs[LIBRARY_ELEMENT9] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT8.of(source),
- 'resolvedUnits':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT11),
- };
- }
-
- /**
- * Create a [ResolveLibraryReferencesTask] based on the given [target] in
- * the given [context].
- */
- static ResolveLibraryReferencesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveLibraryReferencesTask(context, target);
- }
-}
-
-/**
- * A task that finishes resolution by requesting [RESOLVED_UNIT12] for every
- * unit in the libraries closure and produces [LIBRARY_ELEMENT].
- */
-class ResolveLibraryTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT9] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the list of [RESOLVED_UNIT12] input.
- */
- static const String UNITS_INPUT = 'UNITS_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveLibraryTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT]);
-
- ResolveLibraryTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- //
- // Record outputs.
- //
- outputs[LIBRARY_ELEMENT] = library;
- }
-
-/**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT9.of(source),
- 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT.of(source),
- };
- }
-
-/**
- * Create a [ResolveLibraryTask] based on the given [target] in the given
- * [context].
- */
- static ResolveLibraryTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveLibraryTask(context, target);
- }
-}
-
-/**
- * An artificial task that does nothing except to force type names resolution
- * for the defining and part units of a library.
- */
-class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT5] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveLibraryTypeNamesTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT6]);
-
- ResolveLibraryTypeNamesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Create the synthetic element for `loadLibrary`.
- //
- (library as LibraryElementImpl).createLoadLibraryFunction(typeProvider);
- //
- // Record outputs.
- //
- outputs[LIBRARY_ELEMENT6] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- 'resolvedUnit':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT5),
- LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in
- * the given [context].
- */
- static ResolveLibraryTypeNamesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveLibraryTypeNamesTask(context, target);
- }
-}
-
-/**
- * An artificial task that does nothing except to force type parameter bounds
- * type names resolution for the defining and part units of a library.
- */
-class ResolveTopLevelLibraryTypeBoundsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT4] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveTopLevelLibraryTypeBoundsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[LIBRARY_ELEMENT5]);
-
- ResolveTopLevelLibraryTypeBoundsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- bool get handlesDependencyCycles => true;
-
- @override
- void internalPerform() {
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- outputs[LIBRARY_ELEMENT5] = library;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- Source source = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source),
- 'thisLibraryUnitsReady':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT4),
- 'directlyImportedLibrariesReady':
- IMPORTED_LIBRARIES.of(source).toListOf(LIBRARY_ELEMENT5),
- 'directlyExportedLibrariesReady':
- EXPORTED_LIBRARIES.of(source).toListOf(LIBRARY_ELEMENT5),
- };
- }
-
- /**
- * Create a [ResolveTopLevelLibraryTypeBoundsTask] based on the given [target]
- * in the given [context].
- */
- static ResolveTopLevelLibraryTypeBoundsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveTopLevelLibraryTypeBoundsTask(context, target);
- }
-}
-
-/**
- * A task that builds [RESOLVED_UNIT4] for a unit.
- */
-class ResolveTopLevelUnitTypeBoundsTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [LIBRARY_ELEMENT4].
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT3] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveTopLevelUnitTypeBoundsTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- RESOLVE_TYPE_BOUNDS_ERRORS,
- CREATED_RESOLVED_UNIT4,
- RESOLVED_UNIT4
- ]);
-
- ResolveTopLevelUnitTypeBoundsTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- //
- // Resolve TypeName nodes.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- new TypeParameterBoundsResolver(
- context.typeSystem, library, unitElement.source, errorListener)
- .resolveTypeBounds(unit);
- //
- // Record outputs.
- //
- outputs[RESOLVE_TYPE_BOUNDS_ERRORS] =
- getTargetSourceErrors(errorListener, target);
- outputs[RESOLVED_UNIT4] = unit;
- outputs[CREATED_RESOLVED_UNIT4] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- // TODO(brianwilkerson) This task updates the element model to have type
- // information and updates the class hierarchy. It should produce a new
- // version of the element model in order to record those changes.
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- 'importsExportNamespace':
- IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4),
- 'dependOnAllExportedSources':
- IMPORTED_LIBRARIES.of(unit.library).toMapOf(EXPORT_SOURCE_CLOSURE),
- LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT3.of(unit)
- };
- }
-
- /**
- * Create a [ResolveTopLevelUnitTypeBoundsTask] based on the given [target] in
- * the given [context].
- */
- static ResolveTopLevelUnitTypeBoundsTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveTopLevelUnitTypeBoundsTask(context, target);
- }
-}
-
-/**
- * A task that resolves the bodies of top-level functions, constructors, and
- * methods within a single compilation unit.
- */
-class ResolveUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [LIBRARY_ELEMENT8].
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT10] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[
- CONSTANT_EXPRESSIONS_DEPENDENCIES,
- RESOLVE_UNIT_ERRORS,
- CREATED_RESOLVED_UNIT11,
- RESOLVED_UNIT11
- ]);
-
- ResolveUnitTask(
- InternalAnalysisContext context, LibrarySpecificUnit compilationUnit)
- : super(context, compilationUnit);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibrarySpecificUnit target = this.target;
- LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- var inheritance = new InheritanceManager2(context.typeSystem);
- //
- // Resolve everything.
- //
- CompilationUnitElement unitElement = unit.declaredElement;
- RecordingErrorListener errorListener = new RecordingErrorListener();
- ResolverVisitor visitor = new ResolverVisitor(inheritance, libraryElement,
- unitElement.source, typeProvider, errorListener);
- unit.accept(visitor);
- //
- // Compute constant expressions' dependencies.
- //
- List<ConstantEvaluationTarget> constExprDependencies;
- {
- ConstantExpressionsDependenciesFinder finder =
- new ConstantExpressionsDependenciesFinder();
- unit.accept(finder);
- constExprDependencies = finder.dependencies.toList();
- }
- //
- // Record outputs.
- //
- // TODO(brianwilkerson) This task modifies the element model (by copying the
- // AST's for constructor initializers into it) but does not produce an
- // updated version of the element model.
- //
- outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies;
- outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target);
- outputs[RESOLVED_UNIT11] = unit;
- outputs[CREATED_RESOLVED_UNIT11] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT8.of(unit.library),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT10.of(unit),
- // In strong mode, add additional dependencies to enforce inference
- // ordering.
-
- // Require that inference be complete for all units in the
- // current library cycle.
- 'orderLibraryCycleTasks':
- LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT10)
- };
- }
-
- /**
- * Create a [ResolveUnitTask] based on the given [target] in
- * the given [context].
- */
- static ResolveUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveUnitTask(context, target);
- }
-}
-
-/**
- * A task that builds [RESOLVED_UNIT5] for a unit.
- */
-class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the defining [LIBRARY_ELEMENT5].
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT4] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[
- RESOLVE_TYPE_NAMES_ERRORS,
- CREATED_RESOLVED_UNIT5,
- RESOLVED_UNIT5
- ]);
-
- ResolveUnitTypeNamesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement library = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Resolve TypeName nodes.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- TypeResolverVisitor visitor = new TypeResolverVisitor(
- library, unitElement.source, typeProvider, errorListener,
- shouldUseWithClauseInferredTypes: false,
- shouldSetElementSupertypes: true);
- unit.accept(visitor);
- //
- // Re-write the AST to handle the optional new and const feature.
- //
- unit.accept(new AstRewriteVisitor(context.typeSystem, library,
- unit.declaredElement.source, typeProvider, errorListener));
- //
- // Record outputs.
- //
- outputs[RESOLVE_TYPE_NAMES_ERRORS] =
- getTargetSourceErrors(errorListener, target);
- outputs[RESOLVED_UNIT5] = unit;
- outputs[CREATED_RESOLVED_UNIT5] = true;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- // TODO(brianwilkerson) This task updates the element model to have type
- // information and updates the class hierarchy. It should produce a new
- // version of the element model in order to record those changes.
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT4.of(unit),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [ResolveUnitTypeNamesTask] based on the given [target] in
- * the given [context].
- */
- static ResolveUnitTypeNamesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveUnitTypeNamesTask(context, target);
- }
-}
-
-/**
- * A task that builds [RESOLVED_UNIT6] for a unit.
- */
-class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [LIBRARY_ELEMENT1] input.
- */
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT5] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ResolveVariableReferencesTask',
- createTask,
- buildInputs, <ResultDescriptor>[
- CREATED_RESOLVED_UNIT6,
- RESOLVED_UNIT6,
- VARIABLE_REFERENCE_ERRORS
- ]);
-
- ResolveVariableReferencesTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- //
- // Prepare inputs.
- //
- LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Resolve local variables.
- //
- RecordingErrorListener errorListener = new RecordingErrorListener();
- Scope nameScope = new LibraryScope(libraryElement);
- VariableResolverVisitor visitor = new VariableResolverVisitor(
- libraryElement, unitElement.source, typeProvider, errorListener,
- nameScope: nameScope);
- unit.accept(visitor);
- //
- // Record outputs.
- //
- outputs[RESOLVED_UNIT6] = unit;
- outputs[CREATED_RESOLVED_UNIT6] = true;
- outputs[VARIABLE_REFERENCE_ERRORS] =
- getTargetSourceErrors(errorListener, target);
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- LIBRARY_INPUT: LIBRARY_ELEMENT1.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT5.of(unit),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [ResolveVariableReferencesTask] based on the given [target] in
- * the given [context].
- */
- static ResolveVariableReferencesTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ResolveVariableReferencesTask(context, target);
- }
-}
-
-/**
- * A task that scans the content of a Dart file, producing a stream of Dart
- * tokens, line information, and any lexical errors encountered in the process.
- */
-class ScanDartTask extends SourceBasedAnalysisTask {
- /**
- * The name of the input whose value is the content of the file.
- */
- static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME';
-
- /**
- * The name of the input whose value is the modification time of the file.
- */
- static const String MODIFICATION_TIME_INPUT = 'MODIFICATION_TIME_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'ScanDartTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[IGNORE_INFO, LINE_INFO, SCAN_ERRORS, TOKEN_STREAM],
- suitabilityFor: suitabilityFor);
-
- /**
- * Initialize a newly created task to access the content of the source
- * associated with the given [target] in the given [context].
- */
- ScanDartTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- Source source = getRequiredSource();
- RecordingErrorListener errorListener = new RecordingErrorListener();
-
- int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT);
- if (modificationTime < 0) {
- String message = 'Content could not be read';
- if (context is InternalAnalysisContext) {
- CacheEntry entry =
- (context as InternalAnalysisContext).getCacheEntry(target);
- CaughtException exception = entry.exception;
- if (exception != null) {
- message = exception.toString();
- }
- }
- if (source.exists()) {
- errorListener.onError(new AnalysisError(
- source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message]));
- }
- }
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the given
- * [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- if (target is Source) {
- return <String, TaskInput>{
- CONTENT_INPUT_NAME: CONTENT.of(target, flushOnAccess: true),
- MODIFICATION_TIME_INPUT: MODIFICATION_TIME.of(target)
- };
- }
- throw new AnalysisException(
- 'Cannot build inputs for a ${target.runtimeType}');
- }
-
- /**
- * Create a [ScanDartTask] based on the given [target] in the given [context].
- */
- static ScanDartTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new ScanDartTask(context, target);
- }
-
- /**
- * Return an indication of how suitable this task is for the given [target].
- */
- static TaskSuitability suitabilityFor(AnalysisTarget target) {
- if (target is Source) {
- if (target.shortName.endsWith(AnalysisEngine.SUFFIX_DART)) {
- return TaskSuitability.HIGHEST;
- }
- return TaskSuitability.LOWEST;
- }
- return TaskSuitability.NONE;
- }
-}
-
-/**
- * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds
- * [RESOLVED_UNIT] for a unit.
- */
-class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [RESOLVED_UNIT12] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'StrongModeVerifyUnitTask', createTask, buildInputs, <ResultDescriptor>[
- STRONG_MODE_ERRORS,
- CREATED_RESOLVED_UNIT,
- RESOLVED_UNIT
- ]);
-
- StrongModeVerifyUnitTask(
- InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- RecordingErrorListener errorListener = new RecordingErrorListener();
- //
- // Prepare inputs.
- //
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- AnalysisOptionsImpl options = context.analysisOptions;
- if (options.strongMode) {
- CodeChecker checker = new CodeChecker(
- typeProvider,
- new Dart2TypeSystem(typeProvider,
- implicitCasts: options.implicitCasts),
- errorListener,
- options);
- checker.visitCompilationUnit(unit);
- }
- //
- // Record outputs.
- //
- outputs[STRONG_MODE_ERRORS] = getUniqueErrors(errorListener.errors);
- outputs[CREATED_RESOLVED_UNIT] = true;
- outputs[RESOLVED_UNIT] = unit;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT12.of(unit),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- };
- }
-
- /**
- * Create a [StrongModeVerifyUnitTask] based on the given [target] in
- * the given [context].
- */
- static StrongModeVerifyUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new StrongModeVerifyUnitTask(context, target);
- }
-}
-
-/**
- * A task that builds [VERIFY_ERRORS] for a unit.
- */
-class VerifyUnitTask extends SourceBasedAnalysisTask {
- /**
- * The name of the [PENDING_ERRORS] input.
- */
- static const String PENDING_ERRORS_INPUT = 'PENDING_ERRORS_INPUT';
-
- /**
- * The name of the input of a mapping from [REFERENCED_SOURCES] to their
- * [MODIFICATION_TIME]s.
- */
- static const String REFERENCED_SOURCE_MODIFICATION_TIME_MAP_INPUT =
- 'REFERENCED_SOURCE_MODIFICATION_TIME_MAP_INPUT';
-
- /**
- * The name of the [TYPE_PROVIDER] input.
- */
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
-
- /**
- * The name of the [RESOLVED_UNIT] input.
- */
- static const String UNIT_INPUT = 'UNIT_INPUT';
-
- /**
- * The task descriptor describing this kind of task.
- */
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('VerifyUnitTask',
- createTask, buildInputs, <ResultDescriptor>[VERIFY_ERRORS]);
-
- /**
- * The [ErrorReporter] to report errors to.
- */
- ErrorReporter errorReporter;
-
- /**
- * The mapping from the current library referenced sources to their
- * modification times.
- */
- Map<Source, int> sourceTimeMap;
-
- VerifyUnitTask(InternalAnalysisContext context, AnalysisTarget target)
- : super(context, target);
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- @override
- void internalPerform() {
- RecordingErrorListener errorListener = new RecordingErrorListener();
- Source source = getRequiredSource();
- errorReporter = new ErrorReporter(errorListener, source);
- //
- // Prepare inputs.
- //
- CompilationUnit unit = getRequiredInput(UNIT_INPUT);
- CompilationUnitElement unitElement = unit.declaredElement;
- LibraryElement libraryElement = unitElement.library;
- if (libraryElement == null) {
- throw new AnalysisException(
- 'VerifyUnitTask verifying a unit with no library: '
- '${unitElement.source.fullName}');
- }
- List<PendingError> pendingErrors = getRequiredInput(PENDING_ERRORS_INPUT);
- sourceTimeMap =
- getRequiredInput(REFERENCED_SOURCE_MODIFICATION_TIME_MAP_INPUT);
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
- //
- // Validate the directives.
- //
- validateDirectives(unit);
- //
- // Use the ConstantVerifier to compute errors.
- //
- ConstantVerifier constantVerifier = new ConstantVerifier(
- errorReporter, libraryElement, typeProvider, context.declaredVariables);
- unit.accept(constantVerifier);
-
- //
- // Compute inheritance and override errors.
- //
- var typeSystem = libraryElement.context.typeSystem;
- var inheritanceManager = new InheritanceManager2(typeSystem);
- var inheritanceOverrideVerifier = new InheritanceOverrideVerifier(
- typeSystem, inheritanceManager, errorReporter);
- inheritanceOverrideVerifier.verifyUnit(unit);
-
- //
- // Use the ErrorVerifier to compute errors.
- //
- ErrorVerifier errorVerifier = new ErrorVerifier(
- errorReporter, libraryElement, typeProvider, inheritanceManager, false,
- disableConflictingGenericsCheck: true);
- unit.accept(errorVerifier);
- //
- // Convert the pending errors into actual errors.
- //
- for (PendingError pendingError in pendingErrors) {
- errorListener.onError(pendingError.toAnalysisError());
- }
- //
- // Record outputs.
- //
- outputs[VERIFY_ERRORS] = getUniqueErrors(errorListener.errors);
- }
-
- /**
- * Check each directive in the given [unit] to see if the referenced source
- * exists and report an error if it does not.
- */
- void validateDirectives(CompilationUnit unit) {
- NodeList<Directive> directives = unit.directives;
- int length = directives.length;
- for (int i = 0; i < length; i++) {
- Directive directive = directives[i];
- if (directive is UriBasedDirective) {
- validateReferencedSource(directive);
- }
- }
- }
-
- /**
- * Check the given [directive] to see if the referenced source exists and
- * report an error if it does not.
- */
- void validateReferencedSource(UriBasedDirectiveImpl directive) {
- if (directive is NamespaceDirectiveImpl) {
- for (Configuration configuration in directive.configurations) {
- Source source = configuration.uriSource;
- StringLiteral uriLiteral = configuration.uri;
- String uriContent = uriLiteral?.stringValue?.trim();
- if (source != null) {
- int modificationTime = sourceTimeMap[source] ?? -1;
- if (modificationTime >= 0) {
- continue;
- }
- } else {
- // Don't report errors already reported by ParseDartTask.resolveDirective
- if (UriBasedDirectiveImpl.validateUri(
- directive is ImportDirective, uriLiteral, uriContent) !=
- null) {
- continue;
- }
- }
- CompileTimeErrorCode errorCode =
- CompileTimeErrorCode.URI_DOES_NOT_EXIST;
- if (_isGenerated(source)) {
- errorCode = CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED;
- }
- errorReporter.reportErrorForNode(errorCode, uriLiteral, [uriContent]);
- }
- }
- Source source = directive.uriSource;
- if (source != null) {
- int modificationTime = sourceTimeMap[source] ?? -1;
- if (modificationTime >= 0) {
- return;
- }
- } else {
- // Don't report errors already reported by ParseDartTask.resolveDirective
- if (directive.validate() != null) {
- return;
- }
- }
- StringLiteral uriLiteral = directive.uri;
- CompileTimeErrorCode errorCode = CompileTimeErrorCode.URI_DOES_NOT_EXIST;
- if (_isGenerated(source)) {
- errorCode = CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED;
- }
- errorReporter
- .reportErrorForNode(errorCode, uriLiteral, [directive.uriContent]);
- }
-
- /**
- * Return `true` if the given [source] refers to a file that is assumed to be
- * generated.
- */
- bool _isGenerated(Source source) {
- if (source == null) {
- return false;
- }
- // TODO(brianwilkerson) Generalize this mechanism.
- const List<String> suffixes = const <String>[
- '.g.dart',
- '.pb.dart',
- '.pbenum.dart',
- '.pbserver.dart',
- '.pbjson.dart',
- '.template.dart'
- ];
- String fullName = source.fullName;
- for (String suffix in suffixes) {
- if (fullName.endsWith(suffix)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return a map from the names of the inputs of this kind of task to the task
- * input descriptors describing those inputs for a task with the
- * given [target].
- */
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
- LibrarySpecificUnit unit = target;
- return <String, TaskInput>{
- 'thisLibraryClosureIsReady': READY_RESOLVED_UNIT.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT.of(unit),
- REFERENCED_SOURCE_MODIFICATION_TIME_MAP_INPUT:
- REFERENCED_SOURCES.of(unit.library).toMapOf(MODIFICATION_TIME),
- PENDING_ERRORS_INPUT: PENDING_ERRORS.of(unit),
- 'requiredConstants': REQUIRED_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE),
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
- };
- }
-
- /**
- * Create a [VerifyUnitTask] based on the given [target] in
- * the given [context].
- */
- static VerifyUnitTask createTask(
- AnalysisContext context, AnalysisTarget target) {
- return new VerifyUnitTask(context, target);
- }
-}
-
-/**
- * A [TaskInput] whose value is a list of library sources exported directly
- * or indirectly by the target [Source].
- *
- * [resultDescriptor] is the type of result which should be produced for each
- * target [Source].
- */
-class _ExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> {
- final Source target;
- final ResultDescriptor resultDescriptor;
-
- _ExportSourceClosureTaskInput(this.target, this.resultDescriptor);
-
- @override
- TaskInputBuilder<List<Source>> createBuilder() =>
- new _SourceClosureTaskInputBuilder(
- target, _SourceClosureKind.EXPORT, resultDescriptor);
-}
-
-/**
- * An object holding either the name or the source associated with a part-of
- * directive.
- */
-class _NameOrSource {
- final String name;
-
- final Source source;
-
- _NameOrSource(this.name, this.source);
-}
-
-/**
- * The kind of the source closure to build.
- */
-enum _SourceClosureKind { IMPORT, EXPORT, IMPORT_EXPORT }
-
-/**
- * A [TaskInputBuilder] used by [_ExportSourceClosureTaskInput].
- */
-class _SourceClosureTaskInputBuilder implements TaskInputBuilder<List<Source>> {
- final _SourceClosureKind kind;
- final Set<LibraryElement> _libraries = new HashSet<LibraryElement>();
- final List<Source> _newSources = <Source>[];
-
- @override
- final ResultDescriptor currentResult;
-
- Source currentTarget;
-
- _SourceClosureTaskInputBuilder(
- Source librarySource, this.kind, this.currentResult) {
- _newSources.add(librarySource);
- }
-
- @override
- void set currentValue(Object value) {
- LibraryElement library = value;
- if (_libraries.add(library)) {
- if (kind == _SourceClosureKind.IMPORT ||
- kind == _SourceClosureKind.IMPORT_EXPORT) {
- List<ImportElement> imports = library.imports;
- int length = imports.length;
- for (int i = 0; i < length; i++) {
- ImportElement importElement = imports[i];
- Source importedSource = importElement.importedLibrary?.source;
- if (importedSource != null) {
- _newSources.add(importedSource);
- }
- }
- }
- if (kind == _SourceClosureKind.EXPORT ||
- kind == _SourceClosureKind.IMPORT_EXPORT) {
- List<ExportElement> exports = library.exports;
- int length = exports.length;
- for (int i = 0; i < length; i++) {
- ExportElement exportElement = exports[i];
- Source exportedSource = exportElement.exportedLibrary?.source;
- if (exportedSource != null) {
- _newSources.add(exportedSource);
- }
- }
- }
- }
- }
-
- @override
- bool get flushOnAccess => false;
-
- @override
- List<Source> get inputValue {
- return _libraries.map((LibraryElement library) => library.source).toList();
- }
-
- @override
- void currentValueNotAvailable() {
- // Nothing needs to be done. moveNext() will simply go on to the next new
- // source.
- }
-
- @override
- bool moveNext() {
- if (_newSources.isEmpty) {
- return false;
- }
- currentTarget = _newSources.removeLast();
- return true;
- }
-}
diff --git a/analyzer/lib/src/task/dart_work_manager.dart b/analyzer/lib/src/task/dart_work_manager.dart
deleted file mode 100644
index 5aa9869..0000000
--- a/analyzer/lib/src/task/dart_work_manager.dart
+++ /dev/null
@@ -1,498 +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.
-
-import 'dart:collection';
-
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/generated/engine.dart'
- show AnalysisEngine, AnalysisErrorInfo, CacheState, InternalAnalysisContext;
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_collection.dart';
-import 'package:analyzer/src/task/api/dart.dart';
-import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/dart.dart';
-
-/**
- * The manager for Dart specific analysis.
- */
-class DartWorkManager implements WorkManager {
- /**
- * The list of errors that are reported for raw Dart [Source]s.
- */
- static final List<ResultDescriptor<List<AnalysisError>>> _SOURCE_ERRORS =
- <ResultDescriptor<List<AnalysisError>>>[
- BUILD_DIRECTIVES_ERRORS,
- BUILD_LIBRARY_ERRORS,
- PARSE_ERRORS,
- SCAN_ERRORS
- ];
-
- /**
- * The list of errors that are reported for raw Dart [LibrarySpecificUnit]s.
- */
- static final List<ResultDescriptor<List<AnalysisError>>> _UNIT_ERRORS =
- <ResultDescriptor<List<AnalysisError>>>[
- HINTS,
- LINTS,
- LIBRARY_UNIT_ERRORS,
- RESOLVE_DIRECTIVES_ERRORS,
- RESOLVE_TYPE_NAMES_ERRORS,
- RESOLVE_TYPE_BOUNDS_ERRORS,
- RESOLVE_UNIT_ERRORS,
- STRONG_MODE_ERRORS,
- VARIABLE_REFERENCE_ERRORS,
- VERIFY_ERRORS
- ];
-
- final InternalAnalysisContext context;
-
- /**
- * The [TargetedResult]s that should be computed with priority.
- */
- final LinkedHashSet<TargetedResult> priorityResultQueue =
- new LinkedHashSet<TargetedResult>();
-
- /**
- * The sources whose kind we don't know yet.
- */
- final LinkedHashSet<Source> unknownSourceQueue = new LinkedHashSet<Source>();
-
- /**
- * The queue of library sources to process.
- */
- final LinkedHashSet<Source> librarySourceQueue = new LinkedHashSet<Source>();
-
- /**
- * A table mapping library sources to the part sources they include.
- */
- final HashMap<Source, List<Source>> libraryPartsMap =
- new HashMap<Source, List<Source>>();
-
- /**
- * A table mapping part sources to the library sources that include them.
- */
- final HashMap<Source, List<Source>> partLibrariesMap =
- new HashMap<Source, List<Source>>();
-
- /**
- * Initialize a newly created manager.
- */
- DartWorkManager(this.context) {
- context.onResultInvalidated.listen((InvalidatedResult event) {
- if (event.descriptor == LIBRARY_ERRORS_READY) {
- CacheEntry entry = event.entry;
- if (entry.explicitlyAdded &&
- entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY) {
- librarySourceQueue.add(entry.target);
- }
- }
- });
- }
-
- /**
- * Returns the correctly typed result of `context.analysisCache`.
- */
- AnalysisCache get analysisCache => context.analysisCache;
-
- /**
- * The partition that contains analysis results that are not shared with other
- * contexts.
- */
- CachePartition get privateAnalysisCachePartition =>
- context.privateAnalysisCachePartition;
-
- /**
- * Specifies that the client want the given [result] of the given [target]
- * to be computed with priority.
- */
- void addPriorityResult(AnalysisTarget target, ResultDescriptor result) {
- priorityResultQueue.add(new TargetedResult(target, result));
- }
-
- @override
- void applyChange(List<Source> addedSources, List<Source> changedSources,
- List<Source> removedSources) {
- addedSources = addedSources.where(_isDartSource).toList();
- changedSources = changedSources
- .where(_isDartSource)
- .where((source) => _needsComputing(source, SOURCE_KIND))
- .toList();
- removedSources = removedSources.where(_isDartSource).toList();
- // unknown queue
- unknownSourceQueue.addAll(addedSources);
- unknownSourceQueue.addAll(changedSources);
- unknownSourceQueue.removeAll(removedSources);
- // library queue
- librarySourceQueue.removeAll(changedSources);
- librarySourceQueue.removeAll(removedSources);
- // parts in libraries
- for (Source changedSource in changedSources) {
- _onLibrarySourceChangedOrRemoved(changedSource);
- }
- for (Source removedSource in removedSources) {
- partLibrariesMap.remove(removedSource);
- _onLibrarySourceChangedOrRemoved(removedSource);
- }
- }
-
- @override
- void applyPriorityTargets(List<AnalysisTarget> targets) {
- // Unschedule the old targets.
- List<TargetedResult> resultsToUnschedule = <TargetedResult>[];
- for (TargetedResult result in priorityResultQueue) {
- if (result.result == LIBRARY_ERRORS_READY) {
- resultsToUnschedule.add(result);
- }
- }
- priorityResultQueue.removeAll(resultsToUnschedule);
- // Schedule new targets.
- for (AnalysisTarget target in targets) {
- if (_isDartSource(target)) {
- SourceKind sourceKind = analysisCache.getValue(target, SOURCE_KIND);
- if (sourceKind == SourceKind.UNKNOWN) {
- addPriorityResult(target, SOURCE_KIND);
- } else if (sourceKind == SourceKind.LIBRARY) {
- _schedulePriorityLibrarySourceAnalysis(target);
- } else if (sourceKind == SourceKind.PART) {
- List<Source> libraries = context.getLibrariesContaining(target);
- for (Source library in libraries) {
- addPriorityResult(library, LIBRARY_ERRORS_READY);
- }
- }
- }
- }
- }
-
- @override
- List<AnalysisError> getErrors(Source source) {
- if (!_isDartSource(source)) {
- return AnalysisError.NO_ERRORS;
- }
- // If analysis is finished, use all the errors.
- if (analysisCache.getState(source, DART_ERRORS) == CacheState.VALID) {
- return analysisCache.getValue(source, DART_ERRORS);
- }
- // If analysis is in progress, combine all known partial results.
- List<AnalysisError> errors = <AnalysisError>[];
- for (ResultDescriptor<List<AnalysisError>> descriptor in _SOURCE_ERRORS) {
- errors.addAll(analysisCache.getValue(source, descriptor));
- }
- for (Source library in context.getLibrariesContaining(source)) {
- LibrarySpecificUnit unit = new LibrarySpecificUnit(library, source);
- for (ResultDescriptor<List<AnalysisError>> descriptor in _UNIT_ERRORS) {
- errors.addAll(analysisCache.getValue(unit, descriptor));
- }
- }
- return errors;
- }
-
- /**
- * Returns libraries containing the given [part].
- * Maybe empty, but not null.
- */
- List<Source> getLibrariesContainingPart(Source part) {
- if (part.isInSystemLibrary) {
- DartWorkManager sdkDartWorkManager = _getSdkDartWorkManager();
- if (sdkDartWorkManager != this) {
- return sdkDartWorkManager.getLibrariesContainingPart(part);
- }
- }
- List<Source> libraries = partLibrariesMap[part];
- libraries ??= _getLibrariesContainingPartFromResultProvider(part);
- return libraries?.toList() ?? const <Source>[];
- }
-
- @override
- TargetedResult getNextResult() {
- // Try to find a priority result to compute.
- while (priorityResultQueue.isNotEmpty) {
- TargetedResult result = priorityResultQueue.first;
- if (!_needsComputing(result.target, result.result)) {
- priorityResultQueue.remove(result);
- continue;
- }
- return result;
- }
- // Try to find a new library to analyze.
- while (librarySourceQueue.isNotEmpty) {
- Source librarySource = librarySourceQueue.first;
- // Maybe done with this library.
- if (!_needsComputing(librarySource, LIBRARY_ERRORS_READY)) {
- librarySourceQueue.remove(librarySource);
- continue;
- }
- // Analyze this library.
- return new TargetedResult(librarySource, LIBRARY_ERRORS_READY);
- }
- // No libraries in the queue, check whether there are sources to organize.
- while (unknownSourceQueue.isNotEmpty) {
- Source source = unknownSourceQueue.first;
- // Maybe done with this source.
- if (!_needsComputing(source, SOURCE_KIND)) {
- unknownSourceQueue.remove(source);
- continue;
- }
- // Compute the kind of this source.
- return new TargetedResult(source, SOURCE_KIND);
- }
- // TODO(scheglov) Report errors for parts that remained in the queue after
- // all libraries had been processed.
- // No results to compute.
- return null;
- }
-
- @override
- WorkOrderPriority getNextResultPriority() {
- if (priorityResultQueue.isNotEmpty) {
- return WorkOrderPriority.PRIORITY;
- }
- if (unknownSourceQueue.isNotEmpty || librarySourceQueue.isNotEmpty) {
- return WorkOrderPriority.NORMAL;
- }
- return WorkOrderPriority.NONE;
- }
-
- /**
- * Notifies the manager about analysis options changes.
- */
- void onAnalysisOptionsChanged() {
- _invalidateAllLocalResolutionInformation(false);
- }
-
- /**
- * Notifies the manager about [SourceFactory] changes.
- */
- void onSourceFactoryChanged() {
- _invalidateAllLocalResolutionInformation(true);
- }
-
- @override
- void resultsComputed(
- AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs) {
- bool isDartSource = _isDartSource(target);
- // Route SDK outputs to the SDK WorkManager.
- if (isDartSource && target.source.isInSystemLibrary) {
- DartWorkManager sdkWorkManager = _getSdkDartWorkManager();
- if (sdkWorkManager != this) {
- sdkWorkManager.resultsComputed(target, outputs);
- return;
- }
- }
- // Organize sources.
- bool isDartLibrarySource = false;
- if (isDartSource) {
- Source source = target;
- SourceKind kind = outputs[SOURCE_KIND];
- if (kind != null) {
- unknownSourceQueue.remove(source);
- if (kind == SourceKind.LIBRARY) {
- isDartLibrarySource = true;
- if (context.prioritySources.contains(source)) {
- _schedulePriorityLibrarySourceAnalysis(source);
- } else {
- bool needErrors = _shouldErrorsBeComputed(source);
- if (needErrors) {
- librarySourceQueue.add(target);
- }
- }
- }
- }
- }
- // Update parts in libraries.
- if (isDartLibrarySource) {
- Source library = target;
- List<Source> includedParts = outputs[INCLUDED_PARTS] as List<Source>;
- if (includedParts != null) {
- libraryPartsMap[library] = includedParts;
- for (Source part in includedParts) {
- List<Source> libraries =
- partLibrariesMap.putIfAbsent(part, () => <Source>[]);
- if (!libraries.contains(library)) {
- libraries.add(library);
- _invalidateContainingLibraries(part);
- }
- }
- }
- }
- // Update notice.
- if (isDartSource) {
- bool shouldSetErrors = false;
- outputs.forEach((ResultDescriptor descriptor, value) {
- if (descriptor == PARSED_UNIT && value != null) {
- context.getNotice(target).parsedDartUnit = value;
- shouldSetErrors = true;
- }
- if (descriptor == DART_ERRORS) {
- shouldSetErrors = true;
- }
- });
- if (shouldSetErrors) {
- AnalysisErrorInfo info = context.getErrors(target);
- context.getNotice(target).setErrors(info.errors, info.lineInfo);
- }
- }
- if (target is LibrarySpecificUnit) {
- Source source = target.source;
- bool shouldSetErrors = false;
- outputs.forEach((ResultDescriptor descriptor, value) {
- if (descriptor == RESOLVED_UNIT && value != null) {
- context.getNotice(source).resolvedDartUnit = value;
- shouldSetErrors = true;
- }
- });
- if (shouldSetErrors) {
- AnalysisErrorInfo info = context.getErrors(source);
- context.getNotice(source).setErrors(info.errors, info.lineInfo);
- }
- }
- }
-
- /**
- * The given unit was incrementally resolved. Some of its error results might
- * have been invalidated, so we schedule it for computing errors.
- */
- void unitIncrementallyResolved(Source librarySource, Source unitSource) {
- librarySourceQueue.add(librarySource);
- }
-
- /**
- * Ask the [context]'s result provider for [CONTAINING_LIBRARIES].
- * Return the list of containing libraries, or `null` if unknown.
- */
- List<Source> _getLibrariesContainingPartFromResultProvider(Source part) {
- CacheEntry cacheEntry = context.getCacheEntry(part);
- bool knows = context.aboutToComputeResult(cacheEntry, CONTAINING_LIBRARIES);
- if (knows) {
- return cacheEntry.getValue(CONTAINING_LIBRARIES);
- }
- return null;
- }
-
- /**
- * Return the SDK [DartWorkManager] or this one.
- */
- DartWorkManager _getSdkDartWorkManager() {
- SourceFactory sourceFactory = context.sourceFactory;
- InternalAnalysisContext sdkContext = sourceFactory.dartSdk.context;
- if (sdkContext != context) {
- for (WorkManager workManager in sdkContext.workManagers) {
- if (workManager is DartWorkManager) {
- return workManager;
- }
- }
- }
- return this;
- }
-
- /**
- * Invalidate all of the resolution results computed by this context. The flag
- * [invalidateUris] should be `true` if the cached results of converting URIs
- * to source files should also be invalidated.
- */
- void _invalidateAllLocalResolutionInformation(bool invalidateUris) {
- CachePartition partition = privateAnalysisCachePartition;
- // Prepare targets and values to invalidate.
- List<Source> dartSources = <Source>[];
- List<LibrarySpecificUnit> unitTargets = <LibrarySpecificUnit>[];
- MapIterator<AnalysisTarget, CacheEntry> iterator = partition.iterator();
- while (iterator.moveNext()) {
- AnalysisTarget target = iterator.key;
- // Optionally gather Dart sources to invalidate URIs resolution.
- if (invalidateUris && _isDartSource(target)) {
- dartSources.add(target);
- }
- // LibrarySpecificUnit(s) are roots of Dart resolution.
- // When one is invalidated, invalidation is propagated to all resolution.
- if (target is LibrarySpecificUnit) {
- unitTargets.add(target);
- Source library = target.library;
- if (context.exists(library)) {
- CacheEntry entry = iterator.value;
- if (entry.explicitlyAdded) {
- librarySourceQueue.add(library);
- }
- }
- }
- }
- // Invalidate targets and values.
- unitTargets.forEach(partition.remove);
- for (Source dartSource in dartSources) {
- CacheEntry entry = partition.get(dartSource);
- if (entry != null) {
- // TODO(scheglov) we invalidate too much.
- // Would be nice to invalidate just URLs resolution.
- entry.setState(PARSED_UNIT, CacheState.INVALID);
- entry.setState(IMPORTED_LIBRARIES, CacheState.INVALID);
- entry.setState(EXPLICITLY_IMPORTED_LIBRARIES, CacheState.INVALID);
- entry.setState(EXPORTED_LIBRARIES, CacheState.INVALID);
- entry.setState(INCLUDED_PARTS, CacheState.INVALID);
- entry.setState(LIBRARY_SPECIFIC_UNITS, CacheState.INVALID);
- entry.setState(UNITS, CacheState.INVALID);
- }
- }
- }
-
- /**
- * Invalidate [CONTAINING_LIBRARIES] for the given [source].
- * [CONTAINING_LIBRARIES] does not have dependencies, so we manage it here.
- * The [source] may be a part, or a library whose contents is updated so
- * will be a part.
- */
- void _invalidateContainingLibraries(Source source) {
- CacheEntry entry = analysisCache.get(source);
- if (entry != null) {
- entry.setState(CONTAINING_LIBRARIES, CacheState.INVALID);
- }
- }
-
- /**
- * Returns `true` if the given [result] of the given [target] needs
- * computing, i.e. it is not in the valid and not in the error state.
- */
- bool _needsComputing(AnalysisTarget target, ResultDescriptor result) {
- CacheState state = analysisCache.getState(target, result);
- return state != CacheState.VALID && state != CacheState.ERROR;
- }
-
- /**
- * The given [library] source was changed or removed.
- * Update [libraryPartsMap] and [partLibrariesMap].
- */
- void _onLibrarySourceChangedOrRemoved(Source library) {
- List<Source> parts = libraryPartsMap.remove(library);
- if (parts != null) {
- for (Source part in parts) {
- List<Source> libraries = partLibrariesMap[part];
- if (libraries != null) {
- libraries.remove(library);
- _invalidateContainingLibraries(part);
- }
- }
- }
- _invalidateContainingLibraries(library);
- }
-
- /**
- * Schedule computing [RESOLVED_UNIT] for the given [librarySource].
- * If errors should be computed, then schedule [LIBRARY_ERRORS_READY] instead,
- * it also computes [RESOLVED_UNIT] in process.
- */
- void _schedulePriorityLibrarySourceAnalysis(Source librarySource) {
- bool needErrors = _shouldErrorsBeComputed(librarySource);
- if (needErrors) {
- addPriorityResult(librarySource, LIBRARY_ERRORS_READY);
- } else {
- var target = new LibrarySpecificUnit(librarySource, librarySource);
- addPriorityResult(target, RESOLVED_UNIT);
- }
- }
-
- bool _shouldErrorsBeComputed(Source source) =>
- context.shouldErrorsBeAnalyzed(source);
-
- static bool _isDartSource(AnalysisTarget target) {
- return target is Source && AnalysisEngine.isDartFileName(target.fullName);
- }
-}
diff --git a/analyzer/lib/src/task/driver.dart b/analyzer/lib/src/task/driver.dart
index c7f12e2..843041d 100644
--- a/analyzer/lib/src/task/driver.dart
+++ b/analyzer/lib/src/task/driver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/general.dart b/analyzer/lib/src/task/general.dart
index 446f14a..5fcb776 100644
--- a/analyzer/lib/src/task/general.dart
+++ b/analyzer/lib/src/task/general.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/inputs.dart b/analyzer/lib/src/task/inputs.dart
index d490238..30fd244 100644
--- a/analyzer/lib/src/task/inputs.dart
+++ b/analyzer/lib/src/task/inputs.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/manager.dart b/analyzer/lib/src/task/manager.dart
index 40778cb..009afaf 100644
--- a/analyzer/lib/src/task/manager.dart
+++ b/analyzer/lib/src/task/manager.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/model.dart b/analyzer/lib/src/task/model.dart
index a84a960..ec62312 100644
--- a/analyzer/lib/src/task/model.dart
+++ b/analyzer/lib/src/task/model.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/task/options.dart b/analyzer/lib/src/task/options.dart
index b195c6c..9bc342b 100644
--- a/analyzer/lib/src/task/options.dart
+++ b/analyzer/lib/src/task/options.dart
@@ -19,22 +19,93 @@
import 'package:analyzer/src/lint/options_rule_validator.dart';
import 'package:analyzer/src/lint/registry.dart';
import 'package:analyzer/src/plugin/options.dart';
-import 'package:analyzer/src/task/api/general.dart';
-import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/general.dart';
import 'package:analyzer/src/util/yaml.dart';
import 'package:source_span/source_span.dart';
import 'package:yaml/yaml.dart';
-/// The errors produced while parsing an analysis options file.
-///
-/// The list will be empty if there were no errors, but will not be `null`.
-final ListResultDescriptor<AnalysisError> ANALYSIS_OPTIONS_ERRORS =
- new ListResultDescriptor<AnalysisError>(
- 'ANALYSIS_OPTIONS_ERRORS', AnalysisError.NO_ERRORS);
-
final _OptionsProcessor _processor = new _OptionsProcessor();
+List<AnalysisError> analyzeAnalysisOptions(
+ Source source, String content, SourceFactory sourceFactory) {
+ List<AnalysisError> errors = <AnalysisError>[];
+ Source initialSource = source;
+ SourceSpan initialIncludeSpan;
+ AnalysisOptionsProvider optionsProvider =
+ new AnalysisOptionsProvider(sourceFactory);
+
+ // Validate the specified options and any included option files
+ void validate(Source source, YamlMap options) {
+ List<AnalysisError> validationErrors =
+ new OptionsFileValidator(source).validate(options);
+ if (initialIncludeSpan != null && validationErrors.isNotEmpty) {
+ for (AnalysisError error in validationErrors) {
+ var args = [
+ source.fullName,
+ error.offset.toString(),
+ (error.offset + error.length - 1).toString(),
+ error.message,
+ ];
+ errors.add(new AnalysisError(
+ initialSource,
+ initialIncludeSpan.start.column + 1,
+ initialIncludeSpan.length,
+ AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING,
+ args));
+ }
+ } else {
+ errors.addAll(validationErrors);
+ }
+
+ YamlNode node = getValue(options, AnalyzerOptions.include);
+ if (node == null) {
+ return;
+ }
+ SourceSpan span = node.span;
+ initialIncludeSpan ??= span;
+ String includeUri = span.text;
+ Source includedSource = sourceFactory.resolveUri(source, includeUri);
+ if (includedSource == null || !includedSource.exists()) {
+ errors.add(new AnalysisError(
+ initialSource,
+ initialIncludeSpan.start.column + 1,
+ initialIncludeSpan.length,
+ AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND,
+ [includeUri, source.fullName]));
+ return;
+ }
+ try {
+ YamlMap options =
+ optionsProvider.getOptionsFromString(includedSource.contents.data);
+ validate(includedSource, options);
+ } on OptionsFormatException catch (e) {
+ var args = [
+ includedSource.fullName,
+ e.span.start.offset.toString(),
+ e.span.end.offset.toString(),
+ e.message,
+ ];
+ // Report errors for included option files
+ // on the include directive located in the initial options file.
+ errors.add(new AnalysisError(
+ initialSource,
+ initialIncludeSpan.start.column + 1,
+ initialIncludeSpan.length,
+ AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR,
+ args));
+ }
+ }
+
+ try {
+ YamlMap options = optionsProvider.getOptionsFromString(content);
+ validate(source, options);
+ } on OptionsFormatException catch (e) {
+ SourceSpan span = e.span;
+ errors.add(new AnalysisError(source, span.start.column + 1, span.length,
+ AnalysisOptionsErrorCode.PARSE_ERROR, [e.message]));
+ }
+ return errors;
+}
+
void applyToAnalysisOptions(AnalysisOptionsImpl options, YamlMap optionMap) {
_processor.applyToAnalysisOptions(options, optionMap);
}
@@ -50,9 +121,13 @@
static const String exclude = 'exclude';
static const String include = 'include';
static const String language = 'language';
+ static const String optionalChecks = 'optional-checks';
static const String plugins = 'plugins';
static const String strong_mode = 'strong-mode';
+ // Optional checks options.
+ static const String chromeOsManifestChecks = 'chrome-os-manifest-checks';
+
// Strong mode options (see AnalysisOptionsImpl for documentation).
static const String declarationCasts = 'declaration-casts';
static const String implicitCasts = 'implicit-casts';
@@ -81,6 +156,7 @@
errors,
exclude,
language,
+ optionalChecks,
plugins,
strong_mode,
];
@@ -97,6 +173,11 @@
strictInference,
strictRawTypes
];
+
+ // Supported 'analyzer' optional checks options.
+ static const List<String> optionalCecksOptions = const [
+ chromeOsManifestChecks,
+ ];
}
/// Validates `analyzer` options.
@@ -107,7 +188,8 @@
new StrongModeOptionValueValidator(),
new ErrorFilterOptionValidator(),
new EnabledExperimentsValidator(),
- new LanguageOptionValidator()
+ new LanguageOptionValidator(),
+ new OptionalChecksValueValidator()
]);
}
@@ -273,153 +355,6 @@
}
}
-/// A task that generates errors for an analysis options file.
-class GenerateOptionsErrorsTask extends SourceBasedAnalysisTask {
- /// The name of the input whose value is the content of the file.
- static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME';
-
- /// The task descriptor describing this kind of task.
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
- 'GenerateOptionsErrorsTask',
- createTask,
- buildInputs,
- <ResultDescriptor>[ANALYSIS_OPTIONS_ERRORS, LINE_INFO],
- suitabilityFor: suitabilityFor);
-
- AnalysisOptionsProvider optionsProvider;
-
- GenerateOptionsErrorsTask(AnalysisContext context, AnalysisTarget target)
- : super(context, target) {
- optionsProvider = new AnalysisOptionsProvider(context?.sourceFactory);
- }
-
- @override
- TaskDescriptor get descriptor => DESCRIPTOR;
-
- Source get source => target.source;
-
- @override
- void internalPerform() {
- String content = getRequiredInput(CONTENT_INPUT_NAME);
- //
- // Record outputs.
- //
- outputs[ANALYSIS_OPTIONS_ERRORS] =
- analyzeAnalysisOptions(source, content, context?.sourceFactory);
- outputs[LINE_INFO] = computeLineInfo(content);
- }
-
- static List<AnalysisError> analyzeAnalysisOptions(
- Source source, String content, SourceFactory sourceFactory) {
- List<AnalysisError> errors = <AnalysisError>[];
- Source initialSource = source;
- SourceSpan initialIncludeSpan;
- AnalysisOptionsProvider optionsProvider =
- new AnalysisOptionsProvider(sourceFactory);
-
- // Validate the specified options and any included option files
- void validate(Source source, YamlMap options) {
- List<AnalysisError> validationErrors =
- new OptionsFileValidator(source).validate(options);
- if (initialIncludeSpan != null && validationErrors.isNotEmpty) {
- for (AnalysisError error in validationErrors) {
- var args = [
- source.fullName,
- error.offset.toString(),
- (error.offset + error.length - 1).toString(),
- error.message,
- ];
- errors.add(new AnalysisError(
- initialSource,
- initialIncludeSpan.start.column + 1,
- initialIncludeSpan.length,
- AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING,
- args));
- }
- } else {
- errors.addAll(validationErrors);
- }
-
- YamlNode node = getValue(options, AnalyzerOptions.include);
- if (node == null) {
- return;
- }
- SourceSpan span = node.span;
- initialIncludeSpan ??= span;
- String includeUri = span.text;
- Source includedSource = sourceFactory.resolveUri(source, includeUri);
- if (includedSource == null || !includedSource.exists()) {
- errors.add(new AnalysisError(
- initialSource,
- initialIncludeSpan.start.column + 1,
- initialIncludeSpan.length,
- AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND,
- [includeUri, source.fullName]));
- return;
- }
- try {
- YamlMap options =
- optionsProvider.getOptionsFromString(includedSource.contents.data);
- validate(includedSource, options);
- } on OptionsFormatException catch (e) {
- var args = [
- includedSource.fullName,
- e.span.start.offset.toString(),
- e.span.end.offset.toString(),
- e.message,
- ];
- // Report errors for included option files
- // on the include directive located in the initial options file.
- errors.add(new AnalysisError(
- initialSource,
- initialIncludeSpan.start.column + 1,
- initialIncludeSpan.length,
- AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR,
- args));
- }
- }
-
- try {
- YamlMap options = optionsProvider.getOptionsFromString(content);
- validate(source, options);
- } on OptionsFormatException catch (e) {
- SourceSpan span = e.span;
- errors.add(new AnalysisError(source, span.start.column + 1, span.length,
- AnalysisOptionsErrorCode.PARSE_ERROR, [e.message]));
- }
- return errors;
- }
-
- /// Return a map from the names of the inputs of this kind of task to the
- /// task input descriptors describing those inputs for a task with the
- /// given [target].
- static Map<String, TaskInput> buildInputs(AnalysisTarget source) =>
- <String, TaskInput>{CONTENT_INPUT_NAME: CONTENT.of(source)};
-
- /// Compute [LineInfo] for the given [content].
- static LineInfo computeLineInfo(String content) {
- List<int> lineStarts = StringUtilities.computeLineStarts(content);
- return new LineInfo(lineStarts);
- }
-
- /// Create a task based on the given [target] in the given [context].
- static GenerateOptionsErrorsTask createTask(
- AnalysisContext context, AnalysisTarget target) =>
- new GenerateOptionsErrorsTask(context, target);
-
- /**
- * Return an indication of how suitable this task is for the given [target].
- */
- static TaskSuitability suitabilityFor(AnalysisTarget target) {
- if (target is Source &&
- (target.shortName == AnalysisEngine.ANALYSIS_OPTIONS_FILE ||
- target.shortName == AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE)) {
- return TaskSuitability.HIGHEST;
- }
- return TaskSuitability.NONE;
- }
-}
-
/// Validates `analyzer` language configuration options.
class LanguageOptionValidator extends OptionsValidator {
ErrorBuilder builder = new ErrorBuilder(AnalyzerOptions.languageOptions);
@@ -560,6 +495,43 @@
}
}
+/// Validates `analyzer` optional-checks value configuration options.
+class OptionalChecksValueValidator extends OptionsValidator {
+ ErrorBuilder builder = new ErrorBuilder(AnalyzerOptions.optionalCecksOptions);
+ ErrorBuilder trueOrFalseBuilder = new TrueOrFalseValueErrorBuilder();
+
+ @override
+ void validate(ErrorReporter reporter, YamlMap options) {
+ var analyzer = getValue(options, AnalyzerOptions.analyzer);
+ if (analyzer is YamlMap) {
+ var v = getValue(analyzer, AnalyzerOptions.optionalChecks);
+ if (v is YamlScalar) {
+ var value = toLowerCase(v.value);
+ if (value != AnalyzerOptions.chromeOsManifestChecks) {
+ builder.reportError(
+ reporter, AnalyzerOptions.chromeOsManifestChecks, v);
+ }
+ } else if (v is YamlMap) {
+ v.nodes.forEach((k, v) {
+ String key, value;
+ if (k is YamlScalar) {
+ key = k.value?.toString();
+ if (key != AnalyzerOptions.chromeOsManifestChecks) {
+ builder.reportError(
+ reporter, AnalyzerOptions.chromeOsManifestChecks, k);
+ } else {
+ value = toLowerCase(v.value);
+ if (!AnalyzerOptions.trueOrFalse.contains(value)) {
+ trueOrFalseBuilder.reportError(reporter, key, v);
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+}
+
/// Validates `analyzer` top-level options.
class TopLevelAnalyzerOptionsValidator extends TopLevelOptionValidator {
TopLevelAnalyzerOptionsValidator()
@@ -648,6 +620,10 @@
options.enabledExperiments = enabledExperiments;
}
+ // Process optional checks options.
+ var optionalChecks = getValue(analyzer, AnalyzerOptions.optionalChecks);
+ _applyOptionalChecks(options, optionalChecks);
+
// Process language options.
var language = getValue(analyzer, AnalyzerOptions.language);
_applyLanguageOptions(options, language);
@@ -751,6 +727,31 @@
}
}
+ void _applyOptionalChecksOption(
+ AnalysisOptionsImpl options, String feature, Object value) {
+ bool boolValue = toBool(value);
+ if (boolValue != null) {
+ if (feature == AnalyzerOptions.chromeOsManifestChecks) {
+ options.chromeOsManifestChecks = boolValue;
+ }
+ }
+ }
+
+ void _applyOptionalChecks(AnalysisOptionsImpl options, YamlNode config) {
+ if (config is YamlMap) {
+ config.nodes.forEach((k, v) {
+ if (k is YamlScalar && v is YamlScalar) {
+ _applyOptionalChecksOption(options, k.value?.toString(), v.value);
+ }
+ });
+ }
+ if (config is YamlScalar) {
+ if (config.value?.toString() == AnalyzerOptions.chromeOsManifestChecks) {
+ options.chromeOsManifestChecks = true;
+ }
+ }
+ }
+
String _toString(YamlNode node) {
if (node is YamlScalar) {
var value = node.value;
diff --git a/analyzer/lib/src/task/options_work_manager.dart b/analyzer/lib/src/task/options_work_manager.dart
deleted file mode 100644
index fab4ebe..0000000
--- a/analyzer/lib/src/task/options_work_manager.dart
+++ /dev/null
@@ -1,167 +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.
-
-import 'dart:collection';
-
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/generated/engine.dart'
- show AnalysisEngine, AnalysisErrorInfo, CacheState, InternalAnalysisContext;
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/task/api/model.dart';
-import 'package:analyzer/src/task/options.dart';
-
-/// The manager for analysis options specific analysis.
-class OptionsWorkManager implements WorkManager {
- /// The context for which work is being managed.
- final InternalAnalysisContext context;
-
- /// The options file sources.
- final LinkedHashSet<Source> sourceQueue = new LinkedHashSet<Source>();
-
- /// The [TargetedResult]s that should be computed with priority.
- final LinkedHashSet<TargetedResult> priorityResultQueue =
- new LinkedHashSet<TargetedResult>();
-
- /// Initialize a newly created manager.
- OptionsWorkManager(this.context) {
- analysisCache.onResultInvalidated.listen(onResultInvalidated);
- }
-
- /// Returns the correctly typed result of `context.analysisCache`.
- AnalysisCache get analysisCache => context.analysisCache;
-
- /// Specifies that the client wants the given [result] of the given [target]
- /// to be computed with priority.
- void addPriorityResult(AnalysisTarget target, ResultDescriptor result) {
- priorityResultQueue.add(new TargetedResult(target, result));
- }
-
- @override
- void applyChange(List<Source> addedSources, List<Source> changedSources,
- List<Source> removedSources) {
- addedSources = addedSources.where(_isOptionsSource).toList();
- changedSources = changedSources.where(_isOptionsSource).toList();
- removedSources = removedSources.where(_isOptionsSource).toList();
- // source queue
- sourceQueue.addAll(addedSources);
- sourceQueue.addAll(changedSources);
- sourceQueue.removeAll(removedSources);
- }
-
- @override
- void applyPriorityTargets(List<AnalysisTarget> targets) {
- // Unschedule the old targets.
- List<TargetedResult> resultsToUnschedule = <TargetedResult>[];
- for (TargetedResult result in priorityResultQueue) {
- if (result.result == ANALYSIS_OPTIONS_ERRORS) {
- resultsToUnschedule.add(result);
- }
- }
- priorityResultQueue.removeAll(resultsToUnschedule);
- // Schedule new targets.
- for (AnalysisTarget target in targets) {
- if (_isOptionsSource(target)) {
- addPriorityResult(target, ANALYSIS_OPTIONS_ERRORS);
- }
- }
- }
-
- @override
- List<AnalysisError> getErrors(Source source) {
- if (!_isOptionsSource(source)) {
- return AnalysisError.NO_ERRORS;
- }
- // If analysis is finished, use all the errors.
- if (analysisCache.getState(source, ANALYSIS_OPTIONS_ERRORS) ==
- CacheState.VALID) {
- return analysisCache.getValue(source, ANALYSIS_OPTIONS_ERRORS);
- }
- // No partial results.
- return AnalysisError.NO_ERRORS;
- }
-
- @override
- TargetedResult getNextResult() {
- // Try to find a priority result to compute.
- while (priorityResultQueue.isNotEmpty) {
- TargetedResult result = priorityResultQueue.first;
- if (!_needsComputing(result.target, result.result)) {
- priorityResultQueue.remove(result);
- continue;
- }
- return result;
- }
- // Try to find a new options file to analyze.
- while (sourceQueue.isNotEmpty) {
- Source optionsSource = sourceQueue.first;
- if (!_needsComputing(optionsSource, ANALYSIS_OPTIONS_ERRORS)) {
- sourceQueue.remove(optionsSource);
- continue;
- }
- return new TargetedResult(optionsSource, ANALYSIS_OPTIONS_ERRORS);
- }
- // No results to compute.
- return null;
- }
-
- @override
- WorkOrderPriority getNextResultPriority() {
- if (priorityResultQueue.isNotEmpty) {
- return WorkOrderPriority.PRIORITY;
- }
- if (sourceQueue.isNotEmpty) {
- return WorkOrderPriority.NORMAL;
- }
- return WorkOrderPriority.NONE;
- }
-
- @override
- void onAnalysisOptionsChanged() {
- // Do nothing.
- }
-
- /// Notifies the manager that a result has been invalidated.
- void onResultInvalidated(InvalidatedResult event) {
- ResultDescriptor descriptor = event.descriptor;
- if (descriptor == ANALYSIS_OPTIONS_ERRORS) {
- sourceQueue.add(event.entry.target);
- }
- }
-
- @override
- void onSourceFactoryChanged() {
- // Do nothing.
- }
-
- @override
- void resultsComputed(
- AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs) {
- // Update notice.
- if (_isOptionsSource(target)) {
- bool shouldSetErrors = false;
- outputs.forEach((ResultDescriptor descriptor, value) {
- if (descriptor == ANALYSIS_OPTIONS_ERRORS) {
- shouldSetErrors = true;
- }
- });
- if (shouldSetErrors) {
- AnalysisErrorInfo info = context.getErrors(target);
- context.getNotice(target).setErrors(info.errors, info.lineInfo);
- }
- }
- }
-
- /// Returns `true` if the given [result] of the given [target] needs
- /// computing, i.e. it is not in the valid and not in the error state.
- bool _needsComputing(AnalysisTarget target, ResultDescriptor result) {
- CacheState state = analysisCache.getState(target, result);
- return state != CacheState.VALID && state != CacheState.ERROR;
- }
-
- /// Return `true` if the given target is an analysis options source.
- static bool _isOptionsSource(AnalysisTarget target) =>
- target is Source &&
- AnalysisEngine.isAnalysisOptionsFileName(target.fullName);
-}
diff --git a/analyzer/lib/src/task/strong/ast_properties.dart b/analyzer/lib/src/task/strong/ast_properties.dart
index d2fea4e..d2891ad 100644
--- a/analyzer/lib/src/task/strong/ast_properties.dart
+++ b/analyzer/lib/src/task/strong/ast_properties.dart
@@ -15,6 +15,9 @@
const String _hasImplicitCasts = '_hasImplicitCasts';
const String _implicitCast = '_implicitCast';
const String _implicitOperationCast = '_implicitAssignmentCast';
+const String _implicitSpreadCast = '_implicitSpreadCast';
+const String _implicitSpreadKeyCast = '_implicitSpreadKeyCast';
+const String _implicitSpreadValueCast = '_implicitSpreadValueCast';
const String _isDynamicInvoke = '_isDynamicInvoke';
const String _superclassCovariantParameters = '_superclassCovariantParameters';
@@ -48,6 +51,24 @@
return node.getProperty<DartType>(_implicitOperationCast);
}
+/// If this expression is passed into a spread and the items in the spread need
+/// an implicit cast, return the type the items are coerced to.
+DartType getImplicitSpreadCast(Expression node) {
+ return node.getProperty<DartType>(_implicitSpreadCast);
+}
+
+/// If this expression is a map passed into a spread and the keys in the spread
+/// need an implicit cast, return the type the keys are coerced to.
+DartType getImplicitSpreadKeyCast(Expression node) {
+ return node.getProperty<DartType>(_implicitSpreadKeyCast);
+}
+
+/// If this expression is a map passed into a spread and the values in the
+/// spread need an implicit cast, return the type the values are coerced to.
+DartType getImplicitSpreadValueCast(Expression node) {
+ return node.getProperty<DartType>(_implicitSpreadValueCast);
+}
+
/// Returns a list of parameters and method type parameters from mixins and
/// superclasses of this class that need a stub method to check their type at
/// runtime for soundness.
@@ -94,6 +115,21 @@
node.setProperty(_implicitOperationCast, type);
}
+/// Sets the result of [getImplicitSpreadCast] for this node.
+void setImplicitSpreadCast(Expression node, DartType type) {
+ node.setProperty(_implicitSpreadCast, type);
+}
+
+/// Sets the result of [getImplicitSpreadKeyCast] for this node.
+void setImplicitSpreadKeyCast(Expression node, DartType type) {
+ node.setProperty(_implicitSpreadKeyCast, type);
+}
+
+/// Sets the result of [getImplicitSpreadValueCast] for this node.
+void setImplicitSpreadValueCast(Expression node, DartType type) {
+ node.setProperty(_implicitSpreadValueCast, type);
+}
+
/// Sets [isDynamicInvoke] property for this expression.
void setIsDynamicInvoke(Expression node, bool value) {
node.setProperty(_isDynamicInvoke, value == true ? true : null);
diff --git a/analyzer/lib/src/task/strong/checker.dart b/analyzer/lib/src/task/strong/checker.dart
index feb81ad..0708ecf 100644
--- a/analyzer/lib/src/task/strong/checker.dart
+++ b/analyzer/lib/src/task/strong/checker.dart
@@ -18,6 +18,7 @@
import 'package:analyzer/source/error_processor.dart' show ErrorProcessor;
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/inheritance_manager2.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart' show StrongModeCode;
@@ -102,6 +103,9 @@
return null;
}
+ // TODO(jmesserly): I'm not sure this method will still return the correct
+ // type. This code may need to use InheritanceManager2.getMember instead,
+ // similar to the fix in _checkImplicitCovarianceCast.
var name = member.name;
var baseMember = member is PropertyAccessorElement
? (member.isGetter ? type.getGetter(name) : type.getSetter(name))
@@ -114,6 +118,7 @@
class CodeChecker extends RecursiveAstVisitor {
final Dart2TypeSystem rules;
final TypeProvider typeProvider;
+ final InheritanceManager2 inheritance;
final AnalysisErrorListener reporter;
final AnalysisOptionsImpl _options;
_OverrideChecker _overrideChecker;
@@ -123,7 +128,7 @@
HashSet<ExecutableElement> _covariantPrivateMembers;
CodeChecker(TypeProvider typeProvider, Dart2TypeSystem rules,
- AnalysisErrorListener reporter, this._options)
+ this.inheritance, AnalysisErrorListener reporter, this._options)
: typeProvider = typeProvider,
rules = rules,
reporter = reporter {
@@ -169,14 +174,28 @@
if (element is ForElement) {
checkCollectionElement(element.body, expectedType);
} else if (element is IfElement) {
+ checkBoolean(element.condition);
checkCollectionElement(element.thenElement, expectedType);
checkCollectionElement(element.elseElement, expectedType);
} else if (element is Expression) {
checkAssignment(element, expectedType);
} else if (element is SpreadElement) {
- DartType iterableType =
- typeProvider.iterableType.instantiate([expectedType]);
- checkAssignment(element.expression, iterableType);
+ // Spread expression may be dynamic in which case it's implicitly downcast
+ // to Iterable<dynamic>
+ DartType expressionCastType =
+ typeProvider.iterableType.instantiate([DynamicTypeImpl.instance]);
+ checkAssignment(element.expression, expressionCastType);
+
+ var exprType = element.expression.staticType;
+ var asIterableType = exprType is InterfaceTypeImpl
+ ? exprType.asInstanceOf(typeProvider.iterableType.element)
+ : null;
+ var elementType =
+ asIterableType == null ? null : asIterableType.typeArguments[0];
+ // Items in the spread will then potentially be downcast to the expected
+ // type.
+ _checkImplicitCast(element.expression, expectedType,
+ from: elementType, forSpread: true);
}
}
@@ -193,15 +212,34 @@
if (element is ForElement) {
checkMapElement(element.body, expectedKeyType, expectedValueType);
} else if (element is IfElement) {
+ checkBoolean(element.condition);
checkMapElement(element.thenElement, expectedKeyType, expectedValueType);
checkMapElement(element.elseElement, expectedKeyType, expectedValueType);
} else if (element is MapLiteralEntry) {
checkAssignment(element.key, expectedKeyType);
checkAssignment(element.value, expectedValueType);
} else if (element is SpreadElement) {
- DartType mapType = typeProvider.mapType
- .instantiate([expectedKeyType, expectedValueType]);
- checkAssignment(element.expression, mapType);
+ // Spread expression may be dynamic in which case it's implicitly downcast
+ // to Map<dynamic, dynamic>
+ DartType expressionCastType = typeProvider.mapType
+ .instantiate([DynamicTypeImpl.instance, DynamicTypeImpl.instance]);
+ checkAssignment(element.expression, expressionCastType);
+
+ var exprType = element.expression.staticType;
+ var asMapType = exprType is InterfaceTypeImpl
+ ? exprType.asInstanceOf(typeProvider.mapType.element)
+ : null;
+
+ var elementKeyType =
+ asMapType == null ? null : asMapType.typeArguments[0];
+ var elementValueType =
+ asMapType == null ? null : asMapType.typeArguments[1];
+ // Keys and values in the spread will then potentially be downcast to
+ // the expected types.
+ _checkImplicitCast(element.expression, expectedKeyType,
+ from: elementKeyType, forSpreadKey: true);
+ _checkImplicitCast(element.expression, expectedValueType,
+ from: elementValueType, forSpreadValue: true);
}
}
@@ -469,7 +507,7 @@
}
}
}
- NodeList<CollectionElement> elements = node.elements2;
+ NodeList<CollectionElement> elements = node.elements;
for (int i = 0; i < elements.length; i++) {
checkCollectionElement(elements[i], type);
}
@@ -583,7 +621,7 @@
}
}
}
- NodeList<CollectionElement> elements = node.elements2;
+ NodeList<CollectionElement> elements = node.elements;
for (int i = 0; i < elements.length; i++) {
checkMapElement(elements[i], keyType, valueType);
}
@@ -603,7 +641,7 @@
}
}
}
- NodeList<CollectionElement> elements = node.elements2;
+ NodeList<CollectionElement> elements = node.elements;
for (int i = 0; i < elements.length; i++) {
checkCollectionElement(elements[i], type);
}
@@ -651,7 +689,6 @@
@override
void visitVariableDeclarationList(VariableDeclarationList node) {
TypeAnnotation type = node.type;
-
if (type != null) {
for (VariableDeclaration variable in node.variables) {
var initializer = variable.initializer;
@@ -776,11 +813,20 @@
/// If [expr] does not require an implicit cast because it is not related to
/// [to] or is already a subtype of it, does nothing.
void _checkImplicitCast(Expression expr, DartType to,
- {DartType from, bool opAssign: false}) {
+ {DartType from,
+ bool opAssign: false,
+ bool forSpread: false,
+ bool forSpreadKey: false,
+ bool forSpreadValue: false}) {
from ??= _getExpressionType(expr);
if (_needsImplicitCast(expr, to, from: from) == true) {
- _recordImplicitCast(expr, to, from: from, opAssign: opAssign);
+ _recordImplicitCast(expr, to,
+ from: from,
+ opAssign: opAssign,
+ forSpread: forSpread,
+ forSpreadKey: forSpreadKey,
+ forSpreadValue: forSpreadValue);
}
}
@@ -824,7 +870,10 @@
_isInstanceMember(element) &&
targetType is InterfaceType &&
targetType.typeArguments.isNotEmpty &&
- !_targetHasKnownGenericTypeArguments(target)) {
+ !_targetHasKnownGenericTypeArguments(target) &&
+ // Make sure we don't overwrite an existing implicit cast based on
+ // the context type. It will be more precise and will ensure soundness.
+ getImplicitCast(node) == null) {
// Track private setters/method calls. We can sometimes eliminate the
// parameter check in code generation, if it was never needed.
// This member will need a check, however, because we are calling through
@@ -834,14 +883,18 @@
.add(element is ExecutableMember ? element.baseElement : element);
}
- // Get the lower bound of the declared return type (e.g. `F<Null>`) and
+ // Get the lower bound of the declared return type (e.g. `F<bottom>`) and
// see if it can be assigned to the expected type (e.g. `F<Object>`).
//
// That way we can tell if any lower `T` will work or not.
+
+ // The member may be from a superclass, so we need to ensure the type
+ // parameters are properly substituted.
var classType = targetType.element.type;
var classLowerBound = classType.instantiate(new List.filled(
- classType.typeParameters.length, typeProvider.nullType));
- var memberLowerBound = _lookUpMember(classLowerBound, element).type;
+ classType.typeParameters.length, typeProvider.bottomType));
+ var memberLowerBound = inheritance.getMember(
+ classLowerBound, Name(element.librarySource.uri, element.name));
var expectedType = invokeType.returnType;
if (!rules.isSubtypeOf(memberLowerBound.returnType, expectedType)) {
@@ -982,6 +1035,17 @@
DartType _getExpressionType(Expression expr) =>
getExpressionType(expr, rules, typeProvider);
+ DartType _getInstanceTypeArgument(
+ DartType expressionType, ClassElement instanceType) {
+ if (expressionType is InterfaceTypeImpl) {
+ var asInstanceType = expressionType.asInstanceOf(instanceType);
+ if (asInstanceType != null) {
+ return asInstanceType.typeArguments[0];
+ }
+ }
+ return null;
+ }
+
/// Given an expression, return its type assuming it is
/// in the caller position of a call (that is, accounting
/// for the possibility of a call method). Returns null
@@ -1007,19 +1071,19 @@
(e is MethodElement ||
e is PropertyAccessorElement && e.variable is FieldElement);
- ExecutableElement _lookUpMember(InterfaceType type, ExecutableElement e) {
- var name = e.name;
- var library = e.library;
- return e is PropertyAccessorElement
- ? (e.isGetter
- ? type.lookUpInheritedGetter(name, library: library)
- : type.lookUpInheritedSetter(name, library: library))
- : type.lookUpInheritedMethod(name, library: library);
- }
-
- void _markImplicitCast(Expression expr, DartType to, {bool opAssign: false}) {
+ void _markImplicitCast(Expression expr, DartType to,
+ {bool opAssign: false,
+ bool forSpread: false,
+ bool forSpreadKey: false,
+ bool forSpreadValue: false}) {
if (opAssign) {
setImplicitOperationCast(expr, to);
+ } else if (forSpread) {
+ setImplicitSpreadCast(expr, to);
+ } else if (forSpreadKey) {
+ setImplicitSpreadKeyCast(expr, to);
+ } else if (forSpreadValue) {
+ setImplicitSpreadValueCast(expr, to);
} else {
setImplicitCast(expr, to);
}
@@ -1082,66 +1146,80 @@
/// This will emit the appropriate error/warning/hint message as well as mark
/// the AST node.
void _recordImplicitCast(Expression expr, DartType to,
- {DartType from, bool opAssign: false}) {
+ {DartType from,
+ bool opAssign: false,
+ forSpread: false,
+ forSpreadKey: false,
+ forSpreadValue: false}) {
// If this is an implicit tearoff, we need to mark the cast, but we don't
// want to warn if it's a legal subtype.
if (from is InterfaceType && rules.acceptsFunctionType(to)) {
var type = rules.getCallMethodType(from);
if (type != null && rules.isSubtypeOf(type, to)) {
- _markImplicitCast(expr, to, opAssign: opAssign);
+ _markImplicitCast(expr, to,
+ opAssign: opAssign,
+ forSpread: forSpread,
+ forSpreadKey: forSpreadKey,
+ forSpreadValue: forSpreadValue);
return;
}
}
- // Inference "casts":
- if (expr is Literal) {
- // fromT should be an exact type - this will almost certainly fail at
- // runtime.
- if (expr is ListLiteral) {
- _recordMessage(
- expr, StrongModeCode.INVALID_CAST_LITERAL_LIST, [from, to]);
- } else if (expr is SetOrMapLiteral) {
- if (expr.isMap) {
- _recordMessage(
- expr, StrongModeCode.INVALID_CAST_LITERAL_MAP, [from, to]);
- } else {
- // Ambiguity should be resolved by now
- assert(expr.isSet);
- _recordMessage(
- expr, StrongModeCode.INVALID_CAST_LITERAL_SET, [from, to]);
- }
- } else {
- _recordMessage(
- expr, StrongModeCode.INVALID_CAST_LITERAL, [expr, from, to]);
- }
- return;
- }
+ if (!forSpread && !forSpreadKey && !forSpreadValue) {
+ // Spreads are special in that they may create downcasts at runtime but
+ // those casts are implied so we don't treat them as strictly.
- if (expr is FunctionExpression) {
- _recordMessage(
- expr, StrongModeCode.INVALID_CAST_FUNCTION_EXPR, [from, to]);
- return;
- }
-
- if (expr is InstanceCreationExpression) {
- ConstructorElement e = expr.staticElement;
- if (e == null || !e.isFactory) {
+ // Inference "casts":
+ if (expr is Literal) {
// fromT should be an exact type - this will almost certainly fail at
// runtime.
- _recordMessage(expr, StrongModeCode.INVALID_CAST_NEW_EXPR, [from, to]);
+ if (expr is ListLiteral) {
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_LITERAL_LIST, [from, to]);
+ } else if (expr is SetOrMapLiteral) {
+ if (expr.isMap) {
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_LITERAL_MAP, [from, to]);
+ } else {
+ // Ambiguity should be resolved by now
+ assert(expr.isSet);
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_LITERAL_SET, [from, to]);
+ }
+ } else {
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_LITERAL, [expr, from, to]);
+ }
return;
}
- }
- Element e = _getKnownElement(expr);
- if (e is FunctionElement || e is MethodElement && e.isStatic) {
- _recordMessage(
- expr,
- e is MethodElement
- ? StrongModeCode.INVALID_CAST_METHOD
- : StrongModeCode.INVALID_CAST_FUNCTION,
- [e.name, from, to]);
- return;
+ if (expr is FunctionExpression) {
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_FUNCTION_EXPR, [from, to]);
+ return;
+ }
+
+ if (expr is InstanceCreationExpression) {
+ ConstructorElement e = expr.staticElement;
+ if (e == null || !e.isFactory) {
+ // fromT should be an exact type - this will almost certainly fail at
+ // runtime.
+ _recordMessage(
+ expr, StrongModeCode.INVALID_CAST_NEW_EXPR, [from, to]);
+ return;
+ }
+ }
+
+ Element e = _getKnownElement(expr);
+ if (e is FunctionElement || e is MethodElement && e.isStatic) {
+ _recordMessage(
+ expr,
+ e is MethodElement
+ ? StrongModeCode.INVALID_CAST_METHOD
+ : StrongModeCode.INVALID_CAST_FUNCTION,
+ [e.name, from, to]);
+ return;
+ }
}
// Composite cast: these are more likely to fail.
@@ -1175,7 +1253,11 @@
: StrongModeCode.DOWN_CAST_IMPLICIT;
}
_recordMessage(expr, errorCode, [from, to]);
- _markImplicitCast(expr, to, opAssign: opAssign);
+ _markImplicitCast(expr, to,
+ opAssign: opAssign,
+ forSpread: forSpread,
+ forSpreadKey: forSpreadKey,
+ forSpreadValue: forSpreadValue);
}
void _recordMessage(AstNode node, ErrorCode errorCode, List arguments) {
@@ -1257,7 +1339,7 @@
}
Token awaitKeyword;
AstNode parent = node.parent;
- if (parent is ForStatement2) {
+ if (parent is ForStatement) {
awaitKeyword = parent.awaitKeyword;
} else if (parent is ForElement) {
awaitKeyword = parent.awaitKeyword;
@@ -1271,7 +1353,7 @@
: typeProvider.iterableType;
var iterableType = _getExpressionType(node.iterable);
var elementType =
- rules.mostSpecificTypeArgument(iterableType, sequenceInterface);
+ _getInstanceTypeArgument(iterableType, sequenceInterface.element);
// If the sequence is not an Iterable (or Stream for await for) but is a
// supertype of it, do an implicit downcast to Iterable<dynamic>. Then
diff --git a/analyzer/lib/src/task/strong_mode.dart b/analyzer/lib/src/task/strong_mode.dart
index fdbc6d4..ed2c5c3 100644
--- a/analyzer/lib/src/task/strong_mode.dart
+++ b/analyzer/lib/src/task/strong_mode.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -16,6 +16,7 @@
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/link.dart'
show FieldElementForLink_ClassField, ParameterElementForLink;
+import 'package:analyzer/src/summary2/lazy_ast.dart';
/**
* Sets the type of the field. The types in implicit accessors are updated
@@ -156,6 +157,7 @@
DartType type = matchingParameter?.type ?? typeProvider.dynamicType;
if (parameterType == null) {
if (type is FunctionType &&
+ type.element != null &&
type.element is! TypeDefiningElement &&
type.element.enclosingElement is! TypeDefiningElement) {
// The resulting parameter's type element has an `enclosingElement` of
@@ -168,7 +170,14 @@
parameterType = type;
}
} else if (parameterType != type) {
- if (parameter is ParameterElementForLink) {
+ if (parameter is ParameterElementImpl && parameter.linkedNode != null) {
+ LazyAst.setTypeInferenceError(
+ parameter.linkedNode,
+ TopLevelInferenceErrorBuilder(
+ kind: TopLevelInferenceErrorKind.overrideConflictParameterType,
+ ),
+ );
+ } else if (parameter is ParameterElementForLink) {
parameter.setInferenceError(new TopLevelInferenceErrorBuilder(
kind: TopLevelInferenceErrorKind.overrideConflictParameterType));
}
@@ -410,7 +419,14 @@
_FieldOverrideInferenceResult typeResult =
_computeFieldOverrideType(field.getter);
if (typeResult.isError) {
- if (field is FieldElementForLink_ClassField) {
+ if (field is FieldElementImpl && field.linkedNode != null) {
+ LazyAst.setTypeInferenceError(
+ field.linkedNode,
+ TopLevelInferenceErrorBuilder(
+ kind: TopLevelInferenceErrorKind.overrideConflictFieldType,
+ ),
+ );
+ } else if (field is FieldElementForLink_ClassField) {
field.setInferenceError(new TopLevelInferenceErrorBuilder(
kind: TopLevelInferenceErrorKind.overrideConflictFieldType));
}
@@ -419,8 +435,12 @@
if (field.hasImplicitType) {
DartType newType = typeResult.type;
- if (newType == null && field.initializer != null) {
- newType = field.initializer.returnType;
+
+ if (newType == null) {
+ var initializer = field.initializer;
+ if (initializer != null) {
+ newType = initializer.returnType;
+ }
}
if (newType == null || newType.isBottom || newType.isDartCoreNull) {
diff --git a/analyzer/lib/src/task/yaml.dart b/analyzer/lib/src/task/yaml.dart
index 431cf30..56ea51c 100644
--- a/analyzer/lib/src/task/yaml.dart
+++ b/analyzer/lib/src/task/yaml.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/test_utilities/find_element.dart b/analyzer/lib/src/test_utilities/find_element.dart
index 86b3e1f..f8ff22c 100644
--- a/analyzer/lib/src/test_utilities/find_element.dart
+++ b/analyzer/lib/src/test_utilities/find_element.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/test_utilities/find_node.dart b/analyzer/lib/src/test_utilities/find_node.dart
index 90dc42a..ced02d0 100644
--- a/analyzer/lib/src/test_utilities/find_node.dart
+++ b/analyzer/lib/src/test_utilities/find_node.dart
@@ -91,8 +91,8 @@
return _node(search, (n) => n is FieldFormalParameter);
}
- ForStatement2 forStatement2(String search) {
- return _node(search, (n) => n is ForStatement2);
+ ForStatement forStatement(String search) {
+ return _node(search, (n) => n is ForStatement);
}
FunctionBody functionBody(String search) {
@@ -151,6 +151,10 @@
return _node(search, (n) => n is MixinDeclaration);
}
+ NamedExpression namedExpression(String search) {
+ return _node(search, (n) => n is NamedExpression);
+ }
+
ParenthesizedExpression parenthesized(String search) {
return _node(search, (n) => n is ParenthesizedExpression);
}
@@ -252,6 +256,10 @@
return _node(search, (n) => n is VariableDeclaration);
}
+ VariableDeclarationList variableDeclarationList(String search) {
+ return _node(search, (n) => n is VariableDeclarationList);
+ }
+
WhileStatement whileStatement(String search) {
return _node(search, (n) => n is WhileStatement);
}
diff --git a/analyzer/lib/src/test_utilities/function_ast_visitor.dart b/analyzer/lib/src/test_utilities/function_ast_visitor.dart
index f3c951b..df7a2f1 100644
--- a/analyzer/lib/src/test_utilities/function_ast_visitor.dart
+++ b/analyzer/lib/src/test_utilities/function_ast_visitor.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/test_utilities/mock_sdk.dart b/analyzer/lib/src/test_utilities/mock_sdk.dart
index f9828f5..917fc1c 100644
--- a/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -143,9 +143,12 @@
void print(Object object) {}
-class bool extends Object {
+abstract class bool extends Object {
external const factory bool.fromEnvironment(String name,
{bool defaultValue: false});
+ bool operator &(bool other);
+ bool operator |(bool other);
+ bool operator ^(bool other);
}
abstract class Comparable<T> {
@@ -337,6 +340,7 @@
external factory String.fromCharCodes(Iterable<int> charCodes,
[int start = 0, int end]);
List<int> get codeUnits;
+ int indexOf(Pattern pattern, [int start]);
bool get isEmpty => false;
bool get isNotEmpty => false;
int get length => 0;
diff --git a/analyzer/lib/src/test_utilities/package_mixin.dart b/analyzer/lib/src/test_utilities/package_mixin.dart
index 9ad69d8..9fe449e 100644
--- a/analyzer/lib/src/test_utilities/package_mixin.dart
+++ b/analyzer/lib/src/test_utilities/package_mixin.dart
@@ -22,6 +22,7 @@
const Immutable immutable = const Immutable();
const _Literal literal = const _Literal();
const _MustCallSuper mustCallSuper = const _MustCallSuper();
+const _OptionalTypeArgs optionalTypeArgs = const _OptionalTypeArgs();
const _Protected protected = const _Protected();
const Required required = const Required();
const _Sealed sealed = const _Sealed();
@@ -43,6 +44,9 @@
class _MustCallSuper {
const _MustCallSuper();
}
+class _OptionalTypeArgs {
+ const _OptionalTypeArgs();
+}
class _Protected {
const _Protected();
}
diff --git a/analyzer/lib/src/test_utilities/resource_provider_mixin.dart b/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
index 8f20457..6c0072b 100644
--- a/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
+++ b/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/util/sdk.dart b/analyzer/lib/src/util/sdk.dart
index b89f3d7..abffd58 100644
--- a/analyzer/lib/src/util/sdk.dart
+++ b/analyzer/lib/src/util/sdk.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/util/uri.dart b/analyzer/lib/src/util/uri.dart
index 91bbdb2..963dafc 100644
--- a/analyzer/lib/src/util/uri.dart
+++ b/analyzer/lib/src/util/uri.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/analyzer/lib/src/util/yaml.dart b/analyzer/lib/src/util/yaml.dart
index 1950bdd..4485072 100644
--- a/analyzer/lib/src/util/yaml.dart
+++ b/analyzer/lib/src/util/yaml.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/lib/src/workspace/basic.dart b/analyzer/lib/src/workspace/basic.dart
index 0b177f0..59ff9e1 100644
--- a/analyzer/lib/src/workspace/basic.dart
+++ b/analyzer/lib/src/workspace/basic.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/workspace/simple.dart';
import 'package:analyzer/src/workspace/workspace.dart';
import 'package:package_config/packages.dart';
@@ -68,10 +69,13 @@
BasicWorkspacePackage(this.root, this.workspace);
@override
- bool contains(String path) {
+ bool contains(Source source) {
+ // When dealing with a BasicWorkspace, [source] will always have a valid
+ // fullName.
+ String filePath = source.fullName;
// There is a 1-1 relationship between [BasicWorkspace]s and
// [BasicWorkspacePackage]s. If a file is in a package's workspace, then it
// is in the package as well.
- return workspace.provider.pathContext.isWithin(root, path);
+ return workspace.provider.pathContext.isWithin(root, filePath);
}
}
diff --git a/analyzer/lib/src/workspace/bazel.dart b/analyzer/lib/src/workspace/bazel.dart
index 5e90c71..d66c851 100644
--- a/analyzer/lib/src/workspace/bazel.dart
+++ b/analyzer/lib/src/workspace/bazel.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -97,34 +97,8 @@
@override
Uri restoreAbsolute(Source source) {
- path.Context context = _workspace.provider.pathContext;
String filePath = source.fullName;
- Uri restore(String root, String filePath) {
- if (root != null && context.isWithin(root, filePath)) {
- String relative = context.relative(filePath, from: root);
- List<String> components = context.split(relative);
- if (components.length > 4 &&
- components[0] == 'third_party' &&
- components[1] == 'dart' &&
- components[3] == 'lib') {
- String packageName = components[2];
- String pathInLib = components.skip(4).join('/');
- return Uri.parse('package:$packageName/$pathInLib');
- } else {
- for (int i = 2; i < components.length - 1; i++) {
- String component = components[i];
- if (component == 'lib') {
- String packageName = components.getRange(0, i).join('.');
- String pathInLib = components.skip(i + 1).join('/');
- return Uri.parse('package:$packageName/$pathInLib');
- }
- }
- }
- }
- return null;
- }
-
// Search in each root.
for (String root in [
_workspace.bin,
@@ -132,14 +106,43 @@
_workspace.readonly,
_workspace.root
]) {
- Uri uri = restore(root, filePath);
- if (uri != null) {
- return uri;
+ List<String> uriParts = _restoreUriParts(root, filePath);
+ if (uriParts != null) {
+ return Uri.parse('package:${uriParts[0]}/${uriParts[1]}');
}
}
return null;
}
+
+ /// Restore [filePath] to its 'package:' URI parts.
+ ///
+ /// Returns `null` if [root] is null or if [filePath] is not within [root].
+ List<String> _restoreUriParts(String root, String filePath) {
+ path.Context context = _workspace.provider.pathContext;
+ if (root != null && context.isWithin(root, filePath)) {
+ String relative = context.relative(filePath, from: root);
+ List<String> components = context.split(relative);
+ if (components.length > 4 &&
+ components[0] == 'third_party' &&
+ components[1] == 'dart' &&
+ components[3] == 'lib') {
+ String packageName = components[2];
+ String pathInLib = components.skip(4).join('/');
+ return [packageName, pathInLib];
+ } else {
+ for (int i = 2; i < components.length - 1; i++) {
+ String component = components[i];
+ if (component == 'lib') {
+ String packageName = components.getRange(0, i).join('.');
+ String pathInLib = components.skip(i + 1).join('/');
+ return [packageName, pathInLib];
+ }
+ }
+ }
+ }
+ return null;
+ }
}
/**
@@ -276,7 +279,13 @@
if (folder.getChildAssumingFile(_buildFileName).exists) {
// Found the BUILD file, denoting a Dart package.
- return BazelWorkspacePackage(folder.path, this);
+ List<String> uriParts = (packageUriResolver as BazelPackageUriResolver)
+ ._restoreUriParts(root, '${folder.path}/lib/__fake__.dart');
+ if (uriParts == null || uriParts.isEmpty) {
+ return BazelWorkspacePackage(null, folder.path, this);
+ } else {
+ return BazelWorkspacePackage(uriParts[0], folder.path, this);
+ }
}
// Go up a folder.
@@ -299,6 +308,10 @@
* corresponding readonly workspace root.
*/
static BazelWorkspace find(ResourceProvider provider, String filePath) {
+ Resource resource = provider.getResource(filePath);
+ if (resource is File && resource.parent != null) {
+ filePath = resource.parent.path;
+ }
path.Context context = provider.pathContext;
Folder folder = provider.getFolder(filePath);
while (true) {
@@ -373,24 +386,33 @@
* a given package in a BazelWorkspace.
*/
class BazelWorkspacePackage extends WorkspacePackage {
+ /// A prefix for any URI of a path in this package.
+ final String _uriPrefix;
+
final String root;
final BazelWorkspace workspace;
- BazelWorkspacePackage(this.root, this.workspace);
+ BazelWorkspacePackage(String packageName, this.root, this.workspace)
+ : this._uriPrefix = 'package:$packageName/';
@override
- bool contains(String path) {
- if (workspace.findFile(path) == null) {
+ bool contains(Source source) {
+ if (source.uri.isScheme('package')) {
+ return source.uri.toString().startsWith(_uriPrefix);
+ }
+ String filePath = source.fullName;
+ if (filePath == null) return false;
+ if (workspace.findFile(filePath) == null) {
return false;
}
- if (!workspace.provider.pathContext.isWithin(root, path)) {
+ if (!workspace.provider.pathContext.isWithin(root, filePath)) {
return false;
}
- // Just because [path] is within [root] does not mean it is in this
+ // Just because [filePath] is within [root] does not mean it is in this
// package; it could be in a "subpackage." Must go through the work of
- // learning exactly which package [path] is contained in.
- return workspace.findPackageFor(path).root == root;
+ // learning exactly which package [filePath] is contained in.
+ return workspace.findPackageFor(filePath).root == root;
}
}
diff --git a/analyzer/lib/src/workspace/gn.dart b/analyzer/lib/src/workspace/gn.dart
index 191c421..7244b90 100644
--- a/analyzer/lib/src/workspace/gn.dart
+++ b/analyzer/lib/src/workspace/gn.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -267,15 +267,14 @@
* that file cannot be found, looks for standard output directory locations.
*/
static Folder _getOutDirectory(String root, ResourceProvider provider) {
+ const String fuchsiaDirConfigFile = '.fx-build-dir';
+
path.Context pathContext = provider.pathContext;
- File config = provider.getFile(pathContext.join(root, '.config'));
- if (config.exists) {
- String content = config.readAsStringSync();
- Match match =
- new RegExp(r'^FUCHSIA_BUILD_DIR=["\x27](.+)["\x27]$', multiLine: true)
- .firstMatch(content);
- if (match != null) {
- String buildDirPath = match.group(1);
+ File configFile =
+ provider.getFile(pathContext.join(root, fuchsiaDirConfigFile));
+ if (configFile.exists) {
+ String buildDirPath = configFile.readAsStringSync().trim();
+ if (buildDirPath.isNotEmpty) {
if (pathContext.isRelative(buildDirPath)) {
buildDirPath = pathContext.join(root, buildDirPath);
}
@@ -314,17 +313,19 @@
GnWorkspacePackage(this.root, this.workspace);
@override
- bool contains(String path) {
- if (workspace.findFile(path) == null) {
+ bool contains(Source source) {
+ String filePath = filePathFromSource(source);
+ if (filePath == null) return false;
+ if (workspace.findFile(filePath) == null) {
return false;
}
- if (!workspace.provider.pathContext.isWithin(root, path)) {
+ if (!workspace.provider.pathContext.isWithin(root, filePath)) {
return false;
}
- // Just because [path] is within [root] does not mean it is in this
+ // Just because [filePath] is within [root] does not mean it is in this
// package; it could be in a "subpackage." Must go through the work of
- // learning exactly which package [path] is contained in.
- return workspace.findPackageFor(path).root == root;
+ // learning exactly which package [filePath] is contained in.
+ return workspace.findPackageFor(filePath).root == root;
}
}
diff --git a/analyzer/lib/src/workspace/package_build.dart b/analyzer/lib/src/workspace/package_build.dart
index c5c7467..7e5bcbd 100644
--- a/analyzer/lib/src/workspace/package_build.dart
+++ b/analyzer/lib/src/workspace/package_build.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -106,19 +106,27 @@
String filePath = source.fullName;
if (_context.isWithin(_workspace.root, filePath)) {
- String relative = _context.relative(filePath, from: _workspace.root);
- List<String> components = _context.split(relative);
- if (components.length > 4 &&
- components[0] == 'build' &&
- components[1] == 'generated' &&
- components[3] == 'lib') {
- String packageName = components[2];
- String pathInLib = components.skip(4).join('/');
- return Uri.parse('package:$packageName/$pathInLib');
+ List<String> uriParts = _restoreUriParts(filePath);
+ if (uriParts != null) {
+ return Uri.parse('package:${uriParts[0]}/${uriParts[1]}');
}
}
return source.uri;
}
+
+ List<String> _restoreUriParts(String filePath) {
+ String relative = _context.relative(filePath, from: _workspace.root);
+ List<String> components = _context.split(relative);
+ if (components.length > 4 &&
+ components[0] == 'build' &&
+ components[1] == 'generated' &&
+ components[3] == 'lib') {
+ String packageName = components[2];
+ String pathInLib = components.skip(4).join('/');
+ return [packageName, pathInLib];
+ }
+ return null;
+ }
}
/**
@@ -279,7 +287,15 @@
WorkspacePackage findPackageFor(String filePath) {
final Folder folder = provider.getFolder(filePath);
if (provider.pathContext.isWithin(root, folder.path)) {
- _theOnlyPackage ??= new PackageBuildWorkspacePackage(root, this);
+ List<String> uriParts =
+ (packageUriResolver as PackageBuildPackageUriResolver)
+ ._restoreUriParts('${folder.path}/lib/__fake__.dart');
+ if (uriParts == null || uriParts.isEmpty) {
+ _theOnlyPackage ??= new PackageBuildWorkspacePackage(null, root, this);
+ } else {
+ _theOnlyPackage ??=
+ new PackageBuildWorkspacePackage(uriParts[0], root, this);
+ }
return _theOnlyPackage;
} else {
return null;
@@ -330,14 +346,23 @@
* a given package in a PackageBuildWorkspace.
*/
class PackageBuildWorkspacePackage extends WorkspacePackage {
+ /// A prefix for any URI of a path in this package.
+ final String _uriPrefix;
+
final String root;
final PackageBuildWorkspace workspace;
- PackageBuildWorkspacePackage(this.root, this.workspace);
+ PackageBuildWorkspacePackage(String packageName, this.root, this.workspace)
+ : this._uriPrefix = 'package:$packageName/';
@override
- bool contains(String filePath) {
+ bool contains(Source source) {
+ if (source.uri.isScheme('package')) {
+ return source.uri.toString().startsWith(_uriPrefix);
+ }
+ String filePath = source.fullName;
+ if (filePath == null) return false;
// There is a 1-1 relationship between PackageBuildWorkspaces and
// PackageBuildWorkspacePackages. If a file is in a package's workspace,
// then it is in the package as well.
diff --git a/analyzer/lib/src/workspace/pub.dart b/analyzer/lib/src/workspace/pub.dart
index 3cfbe59..65347eb 100644
--- a/analyzer/lib/src/workspace/pub.dart
+++ b/analyzer/lib/src/workspace/pub.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/workspace/simple.dart';
import 'package:analyzer/src/workspace/workspace.dart';
import 'package:package_config/packages.dart';
@@ -71,10 +72,12 @@
PubWorkspacePackage(this.root, this.workspace);
@override
- bool contains(String path) {
+ bool contains(Source source) {
+ String filePath = filePathFromSource(source);
+ if (filePath == null) return false;
// There is a 1-1 relationship between [PubWorkspace]s and
// [PubWorkspacePackage]s. If a file is in a package's workspace, then it
// is in the package as well.
- return workspace.provider.pathContext.isWithin(root, path);
+ return workspace.provider.pathContext.isWithin(root, filePath);
}
}
diff --git a/analyzer/lib/src/workspace/workspace.dart b/analyzer/lib/src/workspace/workspace.dart
index be58cdb..7b74cb5 100644
--- a/analyzer/lib/src/workspace/workspace.dart
+++ b/analyzer/lib/src/workspace/workspace.dart
@@ -62,5 +62,18 @@
Workspace get workspace;
- bool contains(String path);
+ bool contains(Source source);
+
+ /// Return a file path for the location of [source].
+ ///
+ /// If [source]'s URI scheme is package, it's fullName might be unusable (for
+ /// example, the case of a [InSummarySource]). In this case, use
+ /// [workspace]'s package URI resolver to fetch the file path.
+ String filePathFromSource(Source source) {
+ if (source.uri.scheme == 'package') {
+ return workspace.packageUriResolver.resolveAbsolute(source.uri)?.fullName;
+ } else {
+ return source.fullName;
+ }
+ }
}
diff --git a/analyzer/lib/task/model.dart b/analyzer/lib/task/model.dart
index 1b33bf4..6768ca2 100644
--- a/analyzer/lib/task/model.dart
+++ b/analyzer/lib/task/model.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/pubspec.yaml b/analyzer/pubspec.yaml
index 81048a3..1723adb 100644
--- a/analyzer/pubspec.yaml
+++ b/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.35.4
+version: 0.36.3
author: Dart Team <misc@dartlang.org>
description: Static analyzer for Dart.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
@@ -11,9 +11,10 @@
collection: ^1.10.1
convert: ^2.0.0
crypto: '>=1.1.1 <3.0.0'
- front_end: 0.1.14
+ front_end: 0.1.18
glob: ^1.0.3
- kernel: 0.3.14
+ html: '>=0.13.4+1 <0.15.0'
+ kernel: 0.3.18
meta: ^1.0.2
package_config: '>=0.1.5 <2.0.0'
path: '>=0.9.0 <2.0.0'
diff --git a/analyzer/tool/analysis_driver/inspect_exception.dart b/analyzer/tool/analysis_driver/inspect_exception.dart
index 9813944..b15b904 100644
--- a/analyzer/tool/analysis_driver/inspect_exception.dart
+++ b/analyzer/tool/analysis_driver/inspect_exception.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/tool/summary/check_test.dart b/analyzer/tool/summary/check_test.dart
index ff689ba..af669fb 100644
--- a/analyzer/tool/summary/check_test.dart
+++ b/analyzer/tool/summary/check_test.dart
@@ -13,7 +13,10 @@
* user to run generate.dart.
*/
main() async {
- String pkgPath = normalize(join(package_root.packageRoot, 'analyzer'));
- await GeneratedContent.checkAll(
- pkgPath, 'tool/summary/generate.dart', allTargets);
+ var idlFolderPath = normalize(
+ join(package_root.packageRoot, 'analyzer', 'lib', 'src', 'summary'));
+ var idlPath = normalize(join(idlFolderPath, 'idl.dart'));
+ await GeneratedContent.checkAll(idlFolderPath,
+ 'pkg/analyzer/tool/summary/generate.dart', getAllTargets(idlPath),
+ args: [idlPath]);
}
diff --git a/analyzer/tool/summary/dump_inferred_types.dart b/analyzer/tool/summary/dump_inferred_types.dart
index ffc71af..ee6bb64 100644
--- a/analyzer/tool/summary/dump_inferred_types.dart
+++ b/analyzer/tool/summary/dump_inferred_types.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -176,9 +176,9 @@
} else {
result = param.name;
}
- if (param.kind == UnlinkedParamKind.named) {
+ if (param.kind == UnlinkedParamKind.optionalNamed) {
result = '{$result}';
- } else if (param.kind == UnlinkedParamKind.positional) {
+ } else if (param.kind == UnlinkedParamKind.optionalPositional) {
result = '[$result]';
}
return result;
diff --git a/analyzer/tool/summary/generate.dart b/analyzer/tool/summary/generate.dart
index f3426c1..798e369 100644
--- a/analyzer/tool/summary/generate.dart
+++ b/analyzer/tool/summary/generate.dart
@@ -2,56 +2,55 @@
// 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 file contains code to generate serialization/deserialization logic for
- * summaries based on an "IDL" description of the summary format (written in
- * stylized Dart).
- *
- * For each class in the "IDL" input, two corresponding classes are generated:
- * - A class with the same name which represents deserialized summary data in
- * memory. This class has read-only semantics.
- * - A "builder" class which can be used to generate serialized summary data.
- * This class has write-only semantics.
- *
- * Each of the "builder" classes has a single `finish` method which writes
- * the entity being built into the given FlatBuffer and returns the `Offset`
- * reference to it.
- */
+/// This file contains code to generate serialization/deserialization logic for
+/// summaries based on an "IDL" description of the summary format (written in
+/// stylized Dart).
+///
+/// For each class in the "IDL" input, two corresponding classes are generated:
+/// - A class with the same name which represents deserialized summary data in
+/// memory. This class has read-only semantics.
+/// - A "builder" class which can be used to generate serialized summary data.
+/// This class has write-only semantics.
+///
+/// Each of the "builder" classes has a single `finish` method which writes
+/// the entity being built into the given FlatBuffer and returns the `Offset`
+/// reference to it.
import 'dart:convert';
import 'dart:io';
import 'package:analysis_tool/tools.dart';
import 'package:front_end/src/fasta/scanner/string_scanner.dart';
import 'package:front_end/src/scanner/token.dart' show Token;
-import 'package:front_end/src/testing/package_root.dart' as package_root;
-import 'package:path/path.dart';
import 'idl_model.dart' as idlModel;
import 'mini_ast.dart';
-main() async {
- String pkgPath = normalize(join(package_root.packageRoot, 'analyzer'));
- await GeneratedContent.generateAll(pkgPath, allTargets);
+main(List<String> args) async {
+ if (args.length != 1) {
+ print('Error: IDL path is required');
+ print('usage: dart generate.dart path/to/idl.dart');
+ }
+ String idlPath = args[0];
+ await GeneratedContent.generateAll(
+ File(idlPath).parent.path, getAllTargets(idlPath));
}
-final List<GeneratedContent> allTargets = <GeneratedContent>[
- formatTarget,
- schemaTarget
-];
+List<GeneratedContent> getAllTargets(String idlPath) {
+ final GeneratedFile formatTarget =
+ new GeneratedFile('format.dart', (_) async {
+ _CodeGenerator codeGenerator = new _CodeGenerator(idlPath);
+ codeGenerator.generateFormatCode();
+ return codeGenerator._outBuffer.toString();
+ });
-final GeneratedFile formatTarget =
- new GeneratedFile('lib/src/summary/format.dart', (String pkgPath) async {
- _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath);
- codeGenerator.generateFormatCode();
- return codeGenerator._outBuffer.toString();
-});
+ final GeneratedFile schemaTarget = new GeneratedFile('format.fbs', (_) async {
+ _CodeGenerator codeGenerator = new _CodeGenerator(idlPath);
+ codeGenerator.generateFlatBufferSchema();
+ return codeGenerator._outBuffer.toString();
+ });
-final GeneratedFile schemaTarget =
- new GeneratedFile('lib/src/summary/format.fbs', (String pkgPath) async {
- _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath);
- codeGenerator.generateFlatBufferSchema();
- return codeGenerator._outBuffer.toString();
-});
+ return <GeneratedContent>[formatTarget, schemaTarget];
+}
typedef String _StringToString(String s);
@@ -59,24 +58,17 @@
static const String _throwDeprecated =
"throw new UnimplementedError('attempt to access deprecated field')";
- /**
- * Buffer in which generated code is accumulated.
- */
+ /// Buffer in which generated code is accumulated.
final StringBuffer _outBuffer = new StringBuffer();
- /**
- * Current indentation level.
- */
+ /// Current indentation level.
String _indentation = '';
- /**
- * Semantic model of the "IDL" input file.
- */
+ /// Semantic model of the "IDL" input file.
idlModel.Idl _idl;
- _CodeGenerator(String pkgPath) {
+ _CodeGenerator(String idlPath) {
// Parse the input "IDL" file.
- String idlPath = join(pkgPath, 'lib', 'src', 'summary', 'idl.dart');
File idlFile = new File(idlPath);
String idlText =
idlFile.readAsStringSync().replaceAll(new RegExp('\r\n?'), '\n');
@@ -90,10 +82,8 @@
checkIdl();
}
- /**
- * Perform basic sanity checking of the IDL (over and above that done by
- * [extractIdl]).
- */
+ /// Perform basic sanity checking of the IDL (over and above that done by
+ /// [extractIdl]).
void checkIdl() {
_idl.classes.forEach((String name, idlModel.ClassDeclaration cls) {
if (cls.fileIdentifier != null) {
@@ -143,10 +133,8 @@
});
}
- /**
- * Generate a string representing the Dart type which should be used to
- * represent [type] when deserialized.
- */
+ /// Generate a string representing the Dart type which should be used to
+ /// represent [type] when deserialized.
String dartType(idlModel.FieldType type) {
String baseType = idlPrefix(type.typeName);
if (type.isList) {
@@ -156,13 +144,11 @@
}
}
- /**
- * Generate a Dart expression representing the default value for a field
- * having the given [type], or `null` if there is no default value.
- *
- * If [builder] is `true`, the returned type should be appropriate for use in
- * a builder class.
- */
+ /// Generate a Dart expression representing the default value for a field
+ /// having the given [type], or `null` if there is no default value.
+ ///
+ /// If [builder] is `true`, the returned type should be appropriate for use in
+ /// a builder class.
String defaultValue(idlModel.FieldType type, bool builder) {
if (type.isList) {
if (builder) {
@@ -188,10 +174,8 @@
}
}
- /**
- * Generate a string representing the Dart type which should be used to
- * represent [type] while building a serialized data structure.
- */
+ /// Generate a string representing the Dart type which should be used to
+ /// represent [type] while building a serialized data structure.
String encodedType(idlModel.FieldType type) {
String typeStr;
if (_idl.classes.containsKey(type.typeName)) {
@@ -206,10 +190,8 @@
}
}
- /**
- * Process the AST in [idlParsed] and store the resulting semantic model in
- * [_idl]. Also perform some error checking.
- */
+ /// Process the AST in [idlParsed] and store the resulting semantic model in
+ /// [_idl]. Also perform some error checking.
void extractIdl(CompilationUnit idlParsed) {
_idl = new idlModel.Idl();
for (CompilationUnitMember decl in idlParsed.declarations) {
@@ -301,10 +283,8 @@
}
}
- /**
- * Generate a string representing the FlatBuffer schema type which should be
- * used to represent [type].
- */
+ /// Generate a string representing the FlatBuffer schema type which should be
+ /// used to represent [type].
String fbsType(idlModel.FieldType type) {
String typeStr;
switch (type.typeName) {
@@ -337,9 +317,7 @@
}
}
- /**
- * Entry point to the code generator when generating the "format.fbs" file.
- */
+ /// Entry point to the code generator when generating the "format.fbs" file.
void generateFlatBufferSchema() {
outputHeader();
for (idlModel.EnumDeclaration enm in _idl.enums.values) {
@@ -392,9 +370,7 @@
}
}
- /**
- * Entry point to the code generator when generating the "format.dart" file.
- */
+ /// Entry point to the code generator when generating the "format.dart" file.
void generateFormatCode() {
outputHeader();
out('library analyzer.src.summary.format;');
@@ -430,10 +406,8 @@
}
}
- /**
- * Add the prefix `idl.` to a type name, unless that type name is the name of
- * a built-in type.
- */
+ /// Add the prefix `idl.` to a type name, unless that type name is the name of
+ /// a built-in type.
String idlPrefix(String s) {
switch (s) {
case 'bool':
@@ -446,9 +420,7 @@
}
}
- /**
- * Execute [callback] with two spaces added to [_indentation].
- */
+ /// Execute [callback] with two spaces added to [_indentation].
void indent(void callback()) {
String oldIndentation = _indentation;
try {
@@ -459,10 +431,8 @@
}
}
- /**
- * Add the string [s] to the output as a single line, indenting as
- * appropriate.
- */
+ /// Add the string [s] to the output as a single line, indenting as
+ /// appropriate.
void out([String s = '']) {
if (s == '') {
_outBuffer.writeln('');
@@ -478,18 +448,18 @@
}
void outputHeader() {
- out('// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file');
+ out('// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file');
out('// for details. All rights reserved. Use of this source code is governed by a');
out('// BSD-style license that can be found in the LICENSE file.');
out('//');
out('// This file has been automatically generated. Please do not edit it manually.');
- out('// To regenerate the file, use the script "pkg/analyzer/tool/generate_files".');
+ out('// To regenerate the file, use the SDK script');
+ out('// "pkg/analyzer/tool/summary/generate.dart \$IDL_FILE_PATH",');
+ out('// or "pkg/analyzer/tool/generate_files" for the analyzer package IDL/sources.');
out();
}
- /**
- * Enclose [s] in quotes, escaping as necessary.
- */
+ /// Enclose [s] in quotes, escaping as necessary.
String quoted(String s) {
return json.encode(s);
}
@@ -711,7 +681,7 @@
if (field.variantMap != null) {
for (var logicalName in field.variantMap.keys) {
var variants = field.variantMap[logicalName];
- out('void set $logicalName($typeStr value) {');
+ out('set $logicalName($typeStr value) {');
indent(() {
out(_variantAssertStatement(cls, variants));
_generateNonNegativeInt(fieldType);
@@ -721,7 +691,7 @@
out();
}
} else {
- out('void set $fieldName($typeStr value) {');
+ out('set $fieldName($typeStr value) {');
indent(() {
_generateNonNegativeInt(fieldType);
out('this._$fieldName = value;');
@@ -780,9 +750,7 @@
// Generate flushInformative().
{
out();
- out('/**');
- out(' * Flush [informative] data recursively.');
- out(' */');
+ out('/// Flush [informative] data recursively.');
out('void flushInformative() {');
indent(() {
for (idlModel.FieldDeclaration field in cls.fields) {
@@ -804,9 +772,7 @@
// Generate collectApiSignature().
{
out();
- out('/**');
- out(' * Accumulate non-[informative] data into [signature].');
- out(' */');
+ out('/// Accumulate non-[informative] data into [signature].');
out('void collectApiSignature(api_sig.ApiSignature signature) {');
indent(() {
List<idlModel.FieldDeclaration> sortedFields = cls.fields.toList()
@@ -1239,12 +1205,10 @@
out('}');
}
- /**
- * Generate a call to the appropriate method of [ApiSignature] for the type
- * [typeName], using the data named by [ref]. If [couldBeNull] is `true`,
- * generate code to handle the possibility that [ref] is `null` (substituting
- * in the appropriate default value).
- */
+ /// Generate a call to the appropriate method of [ApiSignature] for the type
+ /// [typeName], using the data named by [ref]. If [couldBeNull] is `true`,
+ /// generate code to handle the possibility that [ref] is `null` (substituting
+ /// in the appropriate default value).
void _generateSignatureCall(String typeName, String ref, bool couldBeNull) {
if (_idl.enums.containsKey(typeName)) {
if (couldBeNull) {
@@ -1289,10 +1253,8 @@
}
}
- /**
- * Return the documentation text of the given [node], or `null` if the [node]
- * does not have a comment. Each line is `\n` separated.
- */
+ /// Return the documentation text of the given [node], or `null` if the [node]
+ /// does not have a comment. Each line is `\n` separated.
String _getNodeDoc(AnnotatedNode node) {
Comment comment = node.documentationComment;
if (comment != null && comment.isDocumentation) {
diff --git a/analyzer/tool/summary/inspect.dart b/analyzer/tool/summary/inspect.dart
index e1daf10..b968118 100644
--- a/analyzer/tool/summary/inspect.dart
+++ b/analyzer/tool/summary/inspect.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
diff --git a/analyzer/tool/summary/mini_ast.dart b/analyzer/tool/summary/mini_ast.dart
index a4e718e..b218815 100644
--- a/analyzer/tool/summary/mini_ast.dart
+++ b/analyzer/tool/summary/mini_ast.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -454,8 +454,14 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
// We ignore top level variable declarations; they are present just to make
// the IDL analyze without warnings.
debugEvent("TopLevelFields");
diff --git a/build/BUILD.gn b/build/BUILD.gn
index 2cffa88..cbb8b39 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build-1.1.3
+# This file is generated by importer.py for build-1.1.4
import("//build/dart/dart_library.gni")
diff --git a/build/CHANGELOG.md b/build/CHANGELOG.md
index a1ba664..538aa9a 100644
--- a/build/CHANGELOG.md
+++ b/build/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.1.4
+
+- Internal cleanup: use "strict raw types".
+- Some return types for interfaces to implement changed from `Future<dynamic>`
+ to `Future<void>`.
+
## 1.1.3
- Update the minimum sdk constraint to 2.1.0.
diff --git a/build/lib/src/asset/id.dart b/build/lib/src/asset/id.dart
index 62f66db..a743cf7 100644
--- a/build/lib/src/asset/id.dart
+++ b/build/lib/src/asset/id.dart
@@ -107,7 +107,7 @@
/// Deserializes an [AssetId] from [data], which must be the result of
/// calling [serialize] on an existing [AssetId].
- AssetId.deserialize(List data)
+ AssetId.deserialize(List<dynamic> data)
: package = data[0] as String,
path = data[1] as String;
diff --git a/build/lib/src/asset/writer.dart b/build/lib/src/asset/writer.dart
index 2d25779..68ba81f 100644
--- a/build/lib/src/asset/writer.dart
+++ b/build/lib/src/asset/writer.dart
@@ -14,7 +14,7 @@
///
/// * Throws a `PackageNotFoundException` if `id.package` is not found.
/// * Throws an `InvalidOutputException` if the output was not valid.
- Future writeAsBytes(AssetId id, List<int> bytes);
+ Future<void> writeAsBytes(AssetId id, List<int> bytes);
/// Writes [contents] to a text file located at [id] with [encoding].
///
@@ -22,7 +22,8 @@
///
/// * Throws a `PackageNotFoundException` if `id.package` is not found.
/// * Throws an `InvalidOutputException` if the output was not valid.
- Future writeAsString(AssetId id, String contents, {Encoding encoding = utf8});
+ Future<void> writeAsString(AssetId id, String contents,
+ {Encoding encoding = utf8});
}
/// An [AssetWriter] which tracks all [assetsWritten] during its lifetime.
@@ -35,13 +36,13 @@
Iterable<AssetId> get assetsWritten => _assetsWritten;
@override
- Future writeAsBytes(AssetId id, List<int> bytes) {
+ Future<void> writeAsBytes(AssetId id, List<int> bytes) {
_assetsWritten.add(id);
return _delegate.writeAsBytes(id, bytes);
}
@override
- Future writeAsString(AssetId id, String contents,
+ Future<void> writeAsString(AssetId id, String contents,
{Encoding encoding = utf8}) {
_assetsWritten.add(id);
return _delegate.writeAsString(id, contents, encoding: encoding);
diff --git a/build/lib/src/builder/build_step.dart b/build/lib/src/builder/build_step.dart
index 2c28830..ae1d64a 100644
--- a/build/lib/src/builder/build_step.dart
+++ b/build/lib/src/builder/build_step.dart
@@ -45,7 +45,7 @@
/// Future since the runner will be responsible for waiting until all outputs
/// are written.
@override
- Future writeAsBytes(AssetId id, FutureOr<List<int>> bytes);
+ Future<void> writeAsBytes(AssetId id, FutureOr<List<int>> bytes);
/// Writes [contents] to a text file located at [id] with [encoding].
///
@@ -58,7 +58,7 @@
/// Future since the runner will be responsible for waiting until all outputs
/// are written.
@override
- Future writeAsString(AssetId id, FutureOr<String> contents,
+ Future<void> writeAsString(AssetId id, FutureOr<String> contents,
{Encoding encoding = utf8});
/// A [Resolver] for [inputId].
diff --git a/build/lib/src/builder/build_step_impl.dart b/build/lib/src/builder/build_step_impl.dart
index 63d71c2..380204b 100644
--- a/build/lib/src/builder/build_step_impl.dart
+++ b/build/lib/src/builder/build_step_impl.dart
@@ -42,7 +42,7 @@
final Set<AssetId> _expectedOutputs;
/// The result of any writes which are starting during this step.
- final _writeResults = <Future<Result>>[];
+ final _writeResults = <Future<Result<void>>>[];
/// Used internally for reading files.
final AssetReader _reader;
@@ -109,7 +109,7 @@
}
@override
- Future writeAsBytes(AssetId id, FutureOr<List<int>> bytes) {
+ Future<void> writeAsBytes(AssetId id, FutureOr<List<int>> bytes) {
if (_isComplete) throw BuildStepCompletedException();
_checkOutput(id);
var done =
@@ -119,7 +119,7 @@
}
@override
- Future writeAsString(AssetId id, FutureOr<String> content,
+ Future<void> writeAsString(AssetId id, FutureOr<String> content,
{Encoding encoding = utf8}) {
if (_isComplete) throw BuildStepCompletedException();
_checkOutput(id);
@@ -140,7 +140,8 @@
T trackStage<T>(String label, action, {bool isExternal = false}) =>
_stageTracker.trackStage(label, action, isExternal: isExternal);
- Future _futureOrWrite<T>(FutureOr<T> content, Future write(T content)) =>
+ Future<void> _futureOrWrite<T>(
+ FutureOr<T> content, Future<void> write(T content)) =>
(content is Future<T>) ? content.then(write) : write(content as T);
/// Waits for work to finish and cleans up resources.
@@ -148,7 +149,7 @@
/// This method should be called after a build has completed. After the
/// returned [Future] completes then all outputs have been written and the
/// [Resolver] for this build step - if any - has been released.
- Future complete() async {
+ Future<void> complete() async {
_isComplete = true;
await Future.wait(_writeResults.map(Result.release));
(await _resolver)?.release();
diff --git a/build/lib/src/builder/multiplexing_builder.dart b/build/lib/src/builder/multiplexing_builder.dart
index fa08a9c..e91ee15 100644
--- a/build/lib/src/builder/multiplexing_builder.dart
+++ b/build/lib/src/builder/multiplexing_builder.dart
@@ -22,7 +22,7 @@
.where((builder) =>
builder.buildExtensions.keys.any(buildStep.inputId.path.endsWith))
.map((builder) => builder.build(buildStep))
- .whereType<Future>());
+ .whereType<Future<void>>());
}
/// Merges output extensions from all builders.
diff --git a/build/lib/src/builder/post_process_build_step.dart b/build/lib/src/builder/post_process_build_step.dart
index 3a58a4f..5fef55f 100644
--- a/build/lib/src/builder/post_process_build_step.dart
+++ b/build/lib/src/builder/post_process_build_step.dart
@@ -29,7 +29,7 @@
final void Function(AssetId) _deleteAsset;
/// The result of any writes which are starting during this step.
- final _writeResults = <Future<Result>>[];
+ final _writeResults = <Future<Result<void>>>[];
PostProcessBuildStep._(this.inputId, this._reader, this._writer,
this._addAsset, this._deleteAsset);
@@ -43,7 +43,7 @@
Future<String> readInputAsString({Encoding encoding = utf8}) =>
_reader.readAsString(inputId, encoding: encoding);
- Future writeAsBytes(AssetId id, FutureOr<List<int>> bytes) {
+ Future<void> writeAsBytes(AssetId id, FutureOr<List<int>> bytes) {
_addAsset(id);
var done =
_futureOrWrite(bytes, (List<int> b) => _writer.writeAsBytes(id, b));
@@ -51,7 +51,7 @@
return done;
}
- Future writeAsString(AssetId id, FutureOr<String> content,
+ Future<void> writeAsString(AssetId id, FutureOr<String> content,
{Encoding encoding = utf8}) {
_addAsset(id);
var done = _futureOrWrite(content,
@@ -69,10 +69,11 @@
///
/// This method should be called after a build has completed. After the
/// returned [Future] completes then all outputs have been written.
- Future complete() async {
+ Future<void> complete() async {
await Future.wait(_writeResults.map(Result.release));
}
}
-Future _futureOrWrite<T>(FutureOr<T> content, Future write(T content)) =>
+Future<void> _futureOrWrite<T>(
+ FutureOr<T> content, Future<void> write(T content)) =>
(content is Future<T>) ? content.then(write) : write(content as T);
diff --git a/build/lib/src/generate/run_builder.dart b/build/lib/src/generate/run_builder.dart
index ed368d8..4adfc0f 100644
--- a/build/lib/src/generate/run_builder.dart
+++ b/build/lib/src/generate/run_builder.dart
@@ -26,7 +26,7 @@
/// automatically disposed of (its up to the caller to dispose of it later). If
/// one is not provided then one will be created and disposed at the end of
/// this function call.
-Future<Null> runBuilder(Builder builder, Iterable<AssetId> inputs,
+Future<void> runBuilder(Builder builder, Iterable<AssetId> inputs,
AssetReader reader, AssetWriter writer, Resolvers resolvers,
{Logger logger,
ResourceManager resourceManager,
@@ -36,7 +36,7 @@
resourceManager ??= ResourceManager();
logger ??= Logger('runBuilder');
//TODO(nbosch) check overlapping outputs?
- Future<Null> buildForInput(AssetId input) async {
+ Future<void> buildForInput(AssetId input) async {
var outputs = expectedOutputs(builder, input);
if (outputs.isEmpty) return;
var buildStep = BuildStepImpl(input, outputs, reader, writer,
diff --git a/build/lib/src/generate/run_post_process_builder.dart b/build/lib/src/generate/run_post_process_builder.dart
index 881f359..a4945fb 100644
--- a/build/lib/src/generate/run_post_process_builder.dart
+++ b/build/lib/src/generate/run_post_process_builder.dart
@@ -20,7 +20,7 @@
/// If an asset should not be written this function should throw.
/// [deleteAsset] should remove the asset from the build system, it will not be
/// deleted on disk since the `writer` has no mechanism for delete.
-Future<Null> runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId,
+Future<void> runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId,
AssetReader reader, AssetWriter writer, Logger logger,
{@required void Function(AssetId) addAsset,
@required void Function(AssetId) deleteAsset}) async {
diff --git a/build/lib/src/resource/resource.dart b/build/lib/src/resource/resource.dart
index 0af3c63..8e786de 100644
--- a/build/lib/src/resource/resource.dart
+++ b/build/lib/src/resource/resource.dart
@@ -5,8 +5,8 @@
import 'dart:async';
typedef CreateInstance<T> = FutureOr<T> Function();
-typedef DisposeInstance<T> = FutureOr Function(T instance);
-typedef BeforeExit = FutureOr Function();
+typedef DisposeInstance<T> = FutureOr<void> Function(T instance);
+typedef BeforeExit = FutureOr<void> Function();
/// A [Resource] encapsulates the logic for creating and disposing of some
/// expensive object which has a lifecycle.
@@ -42,7 +42,7 @@
_instanceByManager.putIfAbsent(manager, () async => await _create());
/// Disposes the actual instance of this resource for [manager] if present.
- Future _dispose(ResourceManager manager) {
+ Future<void> _dispose(ResourceManager manager) {
if (!_instanceByManager.containsKey(manager)) return Future.value(null);
var oldInstance = _fetch(manager);
_instanceByManager.remove(manager);
@@ -60,14 +60,14 @@
/// implementations and not general end users. Instead end users should use
/// the `buildStep#fetchResource` method to get [Resource]s.
class ResourceManager {
- final _resources = Set<Resource>();
+ final _resources = Set<Resource<void>>();
/// The [Resource]s that we need to call `beforeExit` on.
///
/// We have to hang on to these forever, but they should be small in number,
/// and we don't hold on to the actual created instances, just the [Resource]
/// instances.
- final _resourcesWithBeforeExit = Set<Resource>();
+ final _resourcesWithBeforeExit = Set<Resource<void>>();
/// Fetches an instance of [resource].
Future<T> fetch<T>(Resource<T> resource) async {
diff --git a/build/pubspec.yaml b/build/pubspec.yaml
index bc7aed0..ebf9750 100644
--- a/build/pubspec.yaml
+++ b/build/pubspec.yaml
@@ -1,5 +1,5 @@
name: build
-version: 1.1.3
+version: 1.1.4
description: A build system for Dart.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build
@@ -21,6 +21,6 @@
build_resolvers: ^1.0.0
build_runner: ^1.0.0
build_test: ^0.10.0
- build_vm_compilers: ^0.1.0
+ build_vm_compilers: ">=0.1.0 <2.0.0"
pedantic: ^1.0.0
test: ^1.2.0
diff --git a/build_config/BUILD.gn b/build_config/BUILD.gn
index fd60893..60b6d86 100644
--- a/build_config/BUILD.gn
+++ b/build_config/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_config-0.3.2
+# This file is generated by importer.py for build_config-0.4.0
import("//build/dart/dart_library.gni")
@@ -12,11 +12,10 @@
disable_analysis = true
deps = [
- "//third_party/dart-pkg/pub/yaml",
- "//third_party/dart-pkg/pub/meta",
- "//third_party/dart-pkg/pub/build",
"//third_party/dart-pkg/pub/pubspec_parse",
"//third_party/dart-pkg/pub/path",
+ "//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/json_annotation",
+ "//third_party/dart-pkg/pub/yaml",
]
}
diff --git a/build_config/CHANGELOG.md b/build_config/CHANGELOG.md
index a2b4717..f722884 100644
--- a/build_config/CHANGELOG.md
+++ b/build_config/CHANGELOG.md
@@ -1,3 +1,14 @@
+## 0.4.0
+
+- Breaking for build systems - change type of `BuilderOptions` fields to
+ `Map<String, dynamic>` to drop dependency on `build`. Does not impact packages
+ only depending on `build.yaml` parsing.
+- Breaking for build systems - versioning scheme is changing to match
+ `package:build`. Changes which are breaking to _users_ - those with
+ `build.yaml` files will be indicated with a breaking major version bump.
+ Changed which are breaking to build system _implementors_ - those who use the
+ Dart API for this package, will be indicated with a minor version bump.
+
## 0.3.2
- Add an explicit error when `buildExtensions` is configured to overwrite it's
diff --git a/build_config/lib/src/build_target.dart b/build_config/lib/src/build_target.dart
index 45fa9f6..6cf17ec 100644
--- a/build_config/lib/src/build_target.dart
+++ b/build_config/lib/src/build_target.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:build/build.dart';
import 'package:json_annotation/json_annotation.dart';
import 'builder_definition.dart';
@@ -84,27 +83,26 @@
///
/// Individual keys may be overridden by either [devOptions] or
/// [releaseOptions].
- @JsonKey(fromJson: builderOptionsFromJson)
- final BuilderOptions options;
+ final Map<String, dynamic> options;
/// Overrides for [options] in dev mode.
- @JsonKey(name: 'dev_options', fromJson: builderOptionsFromJson)
- final BuilderOptions devOptions;
+ @JsonKey(name: 'dev_options')
+ final Map<String, dynamic> devOptions;
/// Overrides for [options] in release mode.
- @JsonKey(name: 'release_options', fromJson: builderOptionsFromJson)
- final BuilderOptions releaseOptions;
+ @JsonKey(name: 'release_options')
+ final Map<String, dynamic> releaseOptions;
TargetBuilderConfig({
bool isEnabled,
this.generateFor,
- BuilderOptions options,
- BuilderOptions devOptions,
- BuilderOptions releaseOptions,
+ Map<String, dynamic> options,
+ Map<String, dynamic> devOptions,
+ Map<String, dynamic> releaseOptions,
}) : isEnabled = isEnabled ?? true,
- options = options ?? BuilderOptions.empty,
- devOptions = devOptions ?? BuilderOptions.empty,
- releaseOptions = releaseOptions ?? BuilderOptions.empty;
+ options = options ?? const {},
+ devOptions = devOptions ?? const {},
+ releaseOptions = releaseOptions ?? const {};
factory TargetBuilderConfig.fromJson(Map json) =>
_$TargetBuilderConfigFromJson(json);
@@ -113,9 +111,9 @@
String toString() => {
'isEnabled': isEnabled,
'generateFor': generateFor,
- 'options': options.config,
- 'devOptions': devOptions.config,
- 'releaseOptions': releaseOptions.config,
+ 'options': options,
+ 'devOptions': devOptions,
+ 'releaseOptions': releaseOptions,
}.toString();
}
@@ -129,32 +127,31 @@
///
/// Individual keys may be overridden by either [devOptions] or
/// [releaseOptions].
- @JsonKey(fromJson: builderOptionsFromJson)
- final BuilderOptions options;
+ final Map<String, dynamic> options;
/// Overrides for [options] in dev mode.
- @JsonKey(name: 'dev_options', fromJson: builderOptionsFromJson)
- final BuilderOptions devOptions;
+ @JsonKey(name: 'dev_options')
+ final Map<String, dynamic> devOptions;
/// Overrides for [options] in release mode.
- @JsonKey(name: 'release_options', fromJson: builderOptionsFromJson)
- final BuilderOptions releaseOptions;
+ @JsonKey(name: 'release_options')
+ final Map<String, dynamic> releaseOptions;
GlobalBuilderConfig({
- BuilderOptions options,
- BuilderOptions devOptions,
- BuilderOptions releaseOptions,
- }) : options = options ?? BuilderOptions.empty,
- devOptions = devOptions ?? BuilderOptions.empty,
- releaseOptions = releaseOptions ?? BuilderOptions.empty;
+ Map<String, dynamic> options,
+ Map<String, dynamic> devOptions,
+ Map<String, dynamic> releaseOptions,
+ }) : options = options ?? const {},
+ devOptions = devOptions ?? const {},
+ releaseOptions = releaseOptions ?? const {};
factory GlobalBuilderConfig.fromJson(Map json) =>
_$GlobalBuilderConfigFromJson(json);
@override
String toString() => {
- 'options': options.config,
- 'devOptions': devOptions.config,
- 'releaseOptions': releaseOptions.config,
+ 'options': options,
+ 'devOptions': devOptions,
+ 'releaseOptions': releaseOptions,
}.toString();
}
diff --git a/build_config/lib/src/build_target.g.dart b/build_config/lib/src/build_target.g.dart
index 2781b4f..4e6406f 100644
--- a/build_config/lib/src/build_target.g.dart
+++ b/build_config/lib/src/build_target.g.dart
@@ -38,11 +38,11 @@
generateFor: $checkedConvert(json, 'generate_for',
(v) => v == null ? null : InputSet.fromJson(v)),
options: $checkedConvert(json, 'options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
devOptions: $checkedConvert(json, 'dev_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
releaseOptions: $checkedConvert(json, 'release_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)));
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))));
return val;
}, fieldKeyMap: const {
'isEnabled': 'enabled',
@@ -58,11 +58,11 @@
allowedKeys: const ['options', 'dev_options', 'release_options']);
final val = GlobalBuilderConfig(
options: $checkedConvert(json, 'options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
devOptions: $checkedConvert(json, 'dev_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
releaseOptions: $checkedConvert(json, 'release_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)));
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))));
return val;
}, fieldKeyMap: const {
'devOptions': 'dev_options',
diff --git a/build_config/lib/src/builder_definition.dart b/build_config/lib/src/builder_definition.dart
index 554d7b9..0abdfc1 100644
--- a/build_config/lib/src/builder_definition.dart
+++ b/build_config/lib/src/builder_definition.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:build/build.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
@@ -176,7 +175,7 @@
String get key => builderKeyExpando[this];
/// The name of the top-level method in [import] from
- /// BuilderOptions -> Builder.
+ /// Map<String, dynamic> -> Builder.
@JsonKey(
name: 'builder_factory',
nullable: false,
@@ -229,24 +228,23 @@
@JsonKey(name: 'generate_for')
final InputSet generateFor;
- @JsonKey(fromJson: builderOptionsFromJson)
- final BuilderOptions options;
+ final Map<String, dynamic> options;
- @JsonKey(name: 'dev_options', fromJson: builderOptionsFromJson)
- final BuilderOptions devOptions;
+ @JsonKey(name: 'dev_options')
+ final Map<String, dynamic> devOptions;
- @JsonKey(name: 'release_options', fromJson: builderOptionsFromJson)
- final BuilderOptions releaseOptions;
+ @JsonKey(name: 'release_options')
+ final Map<String, dynamic> releaseOptions;
const TargetBuilderConfigDefaults({
InputSet generateFor,
- BuilderOptions options,
- BuilderOptions devOptions,
- BuilderOptions releaseOptions,
+ Map<String, dynamic> options,
+ Map<String, dynamic> devOptions,
+ Map<String, dynamic> releaseOptions,
}) : generateFor = generateFor ?? InputSet.anything,
- options = options ?? BuilderOptions.empty,
- devOptions = devOptions ?? BuilderOptions.empty,
- releaseOptions = releaseOptions ?? BuilderOptions.empty;
+ options = options ?? const {},
+ devOptions = devOptions ?? const {},
+ releaseOptions = releaseOptions ?? const {};
factory TargetBuilderConfigDefaults.fromJson(Map json) =>
_$TargetBuilderConfigDefaultsFromJson(json);
diff --git a/build_config/lib/src/builder_definition.g.dart b/build_config/lib/src/builder_definition.g.dart
index 9a42fd0..48f7a65 100644
--- a/build_config/lib/src/builder_definition.g.dart
+++ b/build_config/lib/src/builder_definition.g.dart
@@ -148,11 +148,11 @@
generateFor: $checkedConvert(json, 'generate_for',
(v) => v == null ? null : InputSet.fromJson(v)),
options: $checkedConvert(json, 'options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
devOptions: $checkedConvert(json, 'dev_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)),
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))),
releaseOptions: $checkedConvert(json, 'release_options',
- (v) => v == null ? null : builderOptionsFromJson(v as Map)));
+ (v) => (v as Map)?.map((k, e) => MapEntry(k as String, e))));
return val;
}, fieldKeyMap: const {
'generateFor': 'generate_for',
diff --git a/build_config/lib/src/common.dart b/build_config/lib/src/common.dart
index 78a8bb0..bb61045 100644
--- a/build_config/lib/src/common.dart
+++ b/build_config/lib/src/common.dart
@@ -4,11 +4,6 @@
import 'dart:async';
-import 'package:build/build.dart';
-
-BuilderOptions builderOptionsFromJson(Map config) =>
- BuilderOptions(Map<String, dynamic>.from(config));
-
final _defaultDependenciesZoneKey = Symbol('buildConfigDefaultDependencies');
final _packageZoneKey = Symbol('buildConfigPackage');
diff --git a/build_config/mono_pkg.yaml b/build_config/mono_pkg.yaml
index 314818e..552adb0 100644
--- a/build_config/mono_pkg.yaml
+++ b/build_config/mono_pkg.yaml
@@ -8,7 +8,7 @@
- dartanalyzer: --fatal-infos --fatal-warnings .
- dartanalyzer: --fatal-warnings .
dart:
- - 2.0.0
+ - 2.2.0
- unit_test:
# Run the script directly - running from snapshot has issues for packages
# that are depended on by build_runner itself.
diff --git a/build_config/pubspec.yaml b/build_config/pubspec.yaml
index f905d7a..03f8995 100644
--- a/build_config/pubspec.yaml
+++ b/build_config/pubspec.yaml
@@ -1,14 +1,13 @@
name: build_config
-version: 0.3.2
+version: 0.4.0
description: Support for parsing `build.yaml` configuration.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_config
environment:
- sdk: '>=2.0.0 <3.0.0'
+ sdk: '>=2.2.0 <3.0.0'
dependencies:
- build: '>=0.12.1 <2.0.0'
json_annotation: '>=1.0.0 <3.0.0'
meta: ^1.1.0
path: ^1.4.0
@@ -18,6 +17,19 @@
dev_dependencies:
build_runner: ^1.0.0
build_test: ^0.10.0
- build_vm_compilers: ^0.1.0
+ build_vm_compilers: ">=0.1.0 <2.0.0"
json_serializable: ^2.0.0
test: ^1.0.0
+
+ #dependency_overrides:
+ # json_serializable: ^2.0.0
+ # build_runner:
+ # path: ../build_runner
+ # build_runner_core:
+ # path: ../build_runner_core
+ # build_vm_compilers:
+ # path: ../build_vm_compilers
+ # build_modules:
+ # path: ../build_modules
+ # build_test:
+ # path: ../build_test
diff --git a/build_daemon/BUILD.gn b/build_daemon/BUILD.gn
index ef3a19d..5079236 100644
--- a/build_daemon/BUILD.gn
+++ b/build_daemon/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_daemon-0.5.0
+# This file is generated by importer.py for build_daemon-0.6.0
import("//build/dart/dart_library.gni")
diff --git a/build_daemon/CHANGELOG.md b/build_daemon/CHANGELOG.md
index 1f453a9..aba0241 100644
--- a/build_daemon/CHANGELOG.md
+++ b/build_daemon/CHANGELOG.md
@@ -1,3 +1,13 @@
+## 0.6.0
+
+- Add retry logic to the state file helpers `runningVersion` and `currentOptions`.
+- `DaemonBuilder` is now an abstract class.
+- Significantly increase doc comment coverage.
+
+## 0.5.1
+
+- Support shutting down the daemon with a notification.
+
## 0.5.0
- Add OutputLocation to DefaultBuildTarget.
diff --git a/build_daemon/example/example.dart b/build_daemon/example/example.dart
index d39738e..3bd8b84 100644
--- a/build_daemon/example/example.dart
+++ b/build_daemon/example/example.dart
@@ -15,6 +15,8 @@
p.normalize(p.join(Directory.current.path + '/../example'));
try {
+ // First we connect to the daemon. This will start one if one is not
+ // currently running.
client = await BuildDaemonClient.connect(
workingDirectory,
[
@@ -40,6 +42,10 @@
}
if (client == null) throw Exception('Error connecting');
print('Connected to Dart Build Daemon');
+
+ // Next we register a build target (directory) to build.
+ // Note this will not cause a build to occur unless there are relevant file
+ // changes.
if (Random().nextBool()) {
client.registerBuildTarget(DefaultBuildTarget((b) => b
..target = 'web'
@@ -59,7 +65,12 @@
print('Registered test target...');
}
+
+ // Handle events coming from the daemon.
client.buildResults.listen((status) => print('BUILD STATUS: $status'));
+
+ // Force a build of all registered targets.
client.startBuild();
+
await client.finished;
}
diff --git a/build_daemon/lib/client.dart b/build_daemon/lib/client.dart
index e2076a0..bbad969 100644
--- a/build_daemon/lib/client.dart
+++ b/build_daemon/lib/client.dart
@@ -16,10 +16,11 @@
import 'data/build_target_request.dart';
import 'data/serializers.dart';
import 'data/server_log.dart';
+import 'src/file_wait.dart';
-int _existingPort(String workingDirectory) {
+Future<int> _existingPort(String workingDirectory) async {
var portFile = File(portFilePath(workingDirectory));
- if (!portFile.existsSync()) throw MissingPortFile();
+ if (!await waitForFile(portFile)) throw MissingPortFile();
return int.parse(portFile.readAsStringSync());
}
@@ -60,6 +61,12 @@
bool _isActionMessage(String line) =>
line == versionSkew || line == readyToConnectLog || line == optionsSkew;
+/// A client of the build daemon.
+///
+/// Handles starting and connecting to the build daemon.
+///
+/// Example:
+/// https://pub.dartlang.org/packages/build_daemon#-example-tab-
class BuildDaemonClient {
final _buildResults = StreamController<BuildResults>.broadcast();
final Serializers _serializers;
@@ -96,7 +103,10 @@
void registerBuildTarget(BuildTarget target) => _channel.sink.add(jsonEncode(
_serializers.serialize(BuildTargetRequest((b) => b..target = target))));
- /// Builds all registered targets.
+ /// Builds all registered targets, including those not from this client.
+ ///
+ /// Note this will wait for any ongoing build to finish before starting a new
+ /// one.
void startBuild() {
var request = BuildRequest();
_channel.sink.add(jsonEncode(_serializers.serialize(request)));
@@ -104,6 +114,9 @@
Future<void> close() => _channel.sink.close();
+ /// Connects to the current daemon instance.
+ ///
+ /// If one is not running, a new daemon instance will be started.
static Future<BuildDaemonClient> connect(
String workingDirectory,
List<String> daemonCommand, {
@@ -129,12 +142,17 @@
await _handleDaemonStartup(process, logHandler);
return BuildDaemonClient._(
- _existingPort(workingDirectory), daemonSerializers, logHandler);
+ await _existingPort(workingDirectory), daemonSerializers, logHandler);
}
}
+/// Thrown when the port file for the running daemon instance can't be found.
class MissingPortFile implements Exception {}
+/// Thrown if the client requests conflicting options with the current daemon
+/// instance.
class OptionsSkew implements Exception {}
+/// Thrown if the current daemon instance version does not match that of the
+/// client.
class VersionSkew implements Exception {}
diff --git a/build_daemon/lib/constants.dart b/build_daemon/lib/constants.dart
index a0643e0..711fa99 100644
--- a/build_daemon/lib/constants.dart
+++ b/build_daemon/lib/constants.dart
@@ -11,7 +11,7 @@
const optionsSkew = 'DIFFERENT OPTIONS';
// TODO(grouma) - use pubspec version when this is open sourced.
-const currentVersion = '5.0.0';
+const currentVersion = '6.0.0';
var _username = Platform.environment['USER'] ?? '';
String daemonWorkspace(String workingDirectory) {
diff --git a/build_daemon/lib/daemon_builder.dart b/build_daemon/lib/daemon_builder.dart
index 10130a7..1d7824c 100644
--- a/build_daemon/lib/daemon_builder.dart
+++ b/build_daemon/lib/daemon_builder.dart
@@ -10,13 +10,16 @@
import 'data/build_target.dart';
import 'data/server_log.dart';
-class DaemonBuilder {
- Stream<BuildResults> get builds => Stream.empty();
+/// A builder for the daemon.
+///
+/// Intended to be used as an interface for specific builder implementations
+/// which actually do the building.
+abstract class DaemonBuilder {
+ Stream<BuildResults> get builds;
- Stream<ServerLog> get logs => Stream.empty();
+ Stream<ServerLog> get logs;
- Future<void> build(
- Set<BuildTarget> targets, Iterable<WatchEvent> changes) async {}
+ Future<void> build(Set<BuildTarget> targets, Iterable<WatchEvent> changes);
- Future<void> stop() async {}
+ Future<void> stop();
}
diff --git a/build_daemon/lib/data/build_request.dart b/build_daemon/lib/data/build_request.dart
index cbee2a6..0f4c145 100644
--- a/build_daemon/lib/data/build_request.dart
+++ b/build_daemon/lib/data/build_request.dart
@@ -7,6 +7,7 @@
part 'build_request.g.dart';
+/// A request to trigger a build of all registered build targets.
abstract class BuildRequest
implements Built<BuildRequest, BuildRequestBuilder> {
static Serializer<BuildRequest> get serializer => _$buildRequestSerializer;
diff --git a/build_daemon/lib/data/build_status.dart b/build_daemon/lib/data/build_status.dart
index 306072d..2758ee5 100644
--- a/build_daemon/lib/data/build_status.dart
+++ b/build_daemon/lib/data/build_status.dart
@@ -20,6 +20,7 @@
static BuiltSet<BuildStatus> get values => _$values;
}
+/// The build result for a single target.
abstract class BuildResult {
BuildStatus get status;
String get target;
@@ -44,6 +45,13 @@
DefaultBuildResult._();
}
+/// The group of [BuildResult]s for a single build done by the daemon.
+///
+/// Since the daemon can build multiple targets in parallel, the results are
+/// grouped together.
+///
+/// Build results will only be provided if the client has registered a target
+/// that was built.
abstract class BuildResults
implements Built<BuildResults, BuildResultsBuilder> {
static Serializer<BuildResults> get serializer => _$buildResultsSerializer;
diff --git a/build_daemon/lib/data/build_target.dart b/build_daemon/lib/data/build_target.dart
index 5be4350..ebc2806 100644
--- a/build_daemon/lib/data/build_target.dart
+++ b/build_daemon/lib/data/build_target.dart
@@ -4,6 +4,7 @@
part 'build_target.g.dart';
+/// The string representation of a build target, e.g. folder path.
abstract class BuildTarget {
String get target;
}
@@ -20,12 +21,16 @@
DefaultBuildTarget._();
+ /// A set of file path patterns to match changes against.
+ ///
+ /// If a change matches a pattern this target will not be built.
BuiltSet<RegExp> get blackListPatterns;
@nullable
OutputLocation get outputLocation;
}
+/// The location to write the build outputs.
abstract class OutputLocation
implements Built<OutputLocation, OutputLocationBuilder> {
static Serializer<OutputLocation> get serializer =>
@@ -37,7 +42,17 @@
String get output;
+ /// Whether to use symlinks for build outputs.
bool get useSymlinks;
+ /// Whether to hoist the build output.
+ ///
+ /// Hoisted outputs will not contain the build target folder within their
+ /// path.
+ ///
+ /// For example hoisting the build target web:
+ /// <web>/<web-contents>
+ /// Should result in:
+ /// <output-folder>/<web-contents>
bool get hoist;
}
diff --git a/build_daemon/lib/data/build_target_request.dart b/build_daemon/lib/data/build_target_request.dart
index 102c949..134cf7a 100644
--- a/build_daemon/lib/data/build_target_request.dart
+++ b/build_daemon/lib/data/build_target_request.dart
@@ -8,6 +8,9 @@
part 'build_target_request.g.dart';
+/// Registers a build target to be built by the daemon.
+///
+/// Note this does not trigger a build.
abstract class BuildTargetRequest
implements Built<BuildTargetRequest, BuildTargetRequestBuilder> {
static Serializer<BuildTargetRequest> get serializer =>
diff --git a/build_daemon/lib/data/serializers.dart b/build_daemon/lib/data/serializers.dart
index 1b1ad14..7f4f71f 100644
--- a/build_daemon/lib/data/serializers.dart
+++ b/build_daemon/lib/data/serializers.dart
@@ -4,11 +4,13 @@
import 'package:built_collection/built_collection.dart';
import 'package:built_value/serializer.dart';
+
import 'build_request.dart';
import 'build_status.dart';
import 'build_target.dart';
import 'build_target_request.dart';
import 'server_log.dart';
+import 'shutdown_notification.dart';
part 'serializers.g.dart';
@@ -21,5 +23,6 @@
DefaultBuildResult,
DefaultBuildTarget,
ServerLog,
+ ShutdownNotification,
])
final Serializers serializers = _$serializers;
diff --git a/build_daemon/lib/data/serializers.g.dart b/build_daemon/lib/data/serializers.g.dart
index 67b5cc9..ba37a28 100644
--- a/build_daemon/lib/data/serializers.g.dart
+++ b/build_daemon/lib/data/serializers.g.dart
@@ -15,6 +15,7 @@
..add(DefaultBuildTarget.serializer)
..add(OutputLocation.serializer)
..add(ServerLog.serializer)
+ ..add(ShutdownNotification.serializer)
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(BuildResult)]),
() => new ListBuilder<BuildResult>())
diff --git a/build_daemon/lib/data/shutdown_notification.dart b/build_daemon/lib/data/shutdown_notification.dart
new file mode 100644
index 0000000..01341a8
--- /dev/null
+++ b/build_daemon/lib/data/shutdown_notification.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2019, 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:built_value/built_value.dart';
+import 'package:built_value/serializer.dart';
+
+part 'shutdown_notification.g.dart';
+
+/// An event provided by the daemon to clients immediately before shutdown.
+abstract class ShutdownNotification
+ implements Built<ShutdownNotification, ShutdownNotificationBuilder> {
+ static Serializer<ShutdownNotification> get serializer =>
+ _$shutdownNotificationSerializer;
+
+ factory ShutdownNotification([updates(ShutdownNotificationBuilder b)]) =
+ _$ShutdownNotification;
+
+ String get message;
+
+ ShutdownNotification._();
+}
diff --git a/build_daemon/lib/data/shutdown_notification.g.dart b/build_daemon/lib/data/shutdown_notification.g.dart
new file mode 100644
index 0000000..4a5ecb9
--- /dev/null
+++ b/build_daemon/lib/data/shutdown_notification.g.dart
@@ -0,0 +1,136 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'shutdown_notification.dart';
+
+// **************************************************************************
+// BuiltValueGenerator
+// **************************************************************************
+
+Serializer<ShutdownNotification> _$shutdownNotificationSerializer =
+ new _$ShutdownNotificationSerializer();
+
+class _$ShutdownNotificationSerializer
+ implements StructuredSerializer<ShutdownNotification> {
+ @override
+ final Iterable<Type> types = const [
+ ShutdownNotification,
+ _$ShutdownNotification
+ ];
+ @override
+ final String wireName = 'ShutdownNotification';
+
+ @override
+ Iterable serialize(Serializers serializers, ShutdownNotification object,
+ {FullType specifiedType = FullType.unspecified}) {
+ final result = <Object>[
+ 'message',
+ serializers.serialize(object.message,
+ specifiedType: const FullType(String)),
+ ];
+
+ return result;
+ }
+
+ @override
+ ShutdownNotification deserialize(Serializers serializers, Iterable serialized,
+ {FullType specifiedType = FullType.unspecified}) {
+ final result = new ShutdownNotificationBuilder();
+
+ final iterator = serialized.iterator;
+ while (iterator.moveNext()) {
+ final key = iterator.current as String;
+ iterator.moveNext();
+ final dynamic value = iterator.current;
+ switch (key) {
+ case 'message':
+ result.message = serializers.deserialize(value,
+ specifiedType: const FullType(String)) as String;
+ break;
+ }
+ }
+
+ return result.build();
+ }
+}
+
+class _$ShutdownNotification extends ShutdownNotification {
+ @override
+ final String message;
+
+ factory _$ShutdownNotification(
+ [void updates(ShutdownNotificationBuilder b)]) =>
+ (new ShutdownNotificationBuilder()..update(updates)).build();
+
+ _$ShutdownNotification._({this.message}) : super._() {
+ if (message == null) {
+ throw new BuiltValueNullFieldError('ShutdownNotification', 'message');
+ }
+ }
+
+ @override
+ ShutdownNotification rebuild(void updates(ShutdownNotificationBuilder b)) =>
+ (toBuilder()..update(updates)).build();
+
+ @override
+ ShutdownNotificationBuilder toBuilder() =>
+ new ShutdownNotificationBuilder()..replace(this);
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(other, this)) return true;
+ return other is ShutdownNotification && message == other.message;
+ }
+
+ @override
+ int get hashCode {
+ return $jf($jc(0, message.hashCode));
+ }
+
+ @override
+ String toString() {
+ return (newBuiltValueToStringHelper('ShutdownNotification')
+ ..add('message', message))
+ .toString();
+ }
+}
+
+class ShutdownNotificationBuilder
+ implements Builder<ShutdownNotification, ShutdownNotificationBuilder> {
+ _$ShutdownNotification _$v;
+
+ String _message;
+ String get message => _$this._message;
+ set message(String message) => _$this._message = message;
+
+ ShutdownNotificationBuilder();
+
+ ShutdownNotificationBuilder get _$this {
+ if (_$v != null) {
+ _message = _$v.message;
+ _$v = null;
+ }
+ return this;
+ }
+
+ @override
+ void replace(ShutdownNotification other) {
+ if (other == null) {
+ throw new ArgumentError.notNull('other');
+ }
+ _$v = other as _$ShutdownNotification;
+ }
+
+ @override
+ void update(void updates(ShutdownNotificationBuilder b)) {
+ if (updates != null) updates(this);
+ }
+
+ @override
+ _$ShutdownNotification build() {
+ final _$result = _$v ?? new _$ShutdownNotification._(message: message);
+ replace(_$result);
+ return _$result;
+ }
+}
+
+// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,lines_longer_than_80_chars,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new
diff --git a/build_daemon/lib/src/daemon.dart b/build_daemon/lib/src/daemon.dart
index 0cb8c3a..e3bfad1 100644
--- a/build_daemon/lib/src/daemon.dart
+++ b/build_daemon/lib/src/daemon.dart
@@ -12,26 +12,34 @@
import '../constants.dart';
import '../daemon_builder.dart';
import '../data/build_target.dart';
+import 'file_wait.dart';
import 'server.dart';
/// Returns the current version of the running build daemon.
///
/// Null if one isn't running.
-String runningVersion(String workingDirectory) {
+Future<String> runningVersion(String workingDirectory) async {
var versionFile = File(versionFilePath(workingDirectory));
- if (!versionFile.existsSync()) return null;
+ if (!await waitForFile(versionFile)) return null;
return versionFile.readAsStringSync();
}
/// Returns the current options of the running build daemon.
///
/// Null if one isn't running.
-Set<String> currentOptions(String workingDirectory) {
+Future<Set<String>> currentOptions(String workingDirectory) async {
var optionsFile = File(optionsFilePath(workingDirectory));
- if (!optionsFile.existsSync()) return Set();
+ if (!await waitForFile(optionsFile)) return Set();
return optionsFile.readAsLinesSync().toSet();
}
+/// The long running daemon process.
+///
+/// Obtains a file lock to ensure a single instance and writes various status
+/// files to be used by clients for connection.
+///
+/// Also starts a [Server] to listen for build target registration and event
+/// notification.
class Daemon {
final String _workingDirectory;
@@ -45,6 +53,8 @@
Future<void> get onDone => _doneCompleter.future;
+ Future<void> stop({String message}) => _server.stop(message: message);
+
Future<void> start(
Set<String> options, DaemonBuilder builder, Stream<WatchEvent> changes,
{Serializers serializersOverride,
diff --git a/build_daemon/lib/src/fake_builder.dart b/build_daemon/lib/src/fake_builder.dart
new file mode 100644
index 0000000..988d635
--- /dev/null
+++ b/build_daemon/lib/src/fake_builder.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:build_daemon/daemon_builder.dart';
+import 'package:build_daemon/data/build_status.dart';
+import 'package:build_daemon/data/build_target.dart';
+import 'package:build_daemon/data/server_log.dart';
+import 'package:watcher/src/watch_event.dart';
+
+class FakeDaemonBuilder implements DaemonBuilder {
+ @override
+ Stream<BuildResults> get builds => Stream.empty();
+
+ @override
+ Stream<ServerLog> get logs => Stream.empty();
+
+ @override
+ Future<void> build(
+ Set<BuildTarget> targets, Iterable<WatchEvent> changes) async {}
+
+ @override
+ Future<void> stop() async {}
+}
diff --git a/build_daemon/lib/src/file_wait.dart b/build_daemon/lib/src/file_wait.dart
new file mode 100644
index 0000000..f318103
--- /dev/null
+++ b/build_daemon/lib/src/file_wait.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+
+const _readDelay = Duration(milliseconds: 100);
+const _maxWait = Duration(seconds: 5);
+
+/// Returns true if the file exists.
+///
+/// If the file does not exist it keeps retrying for a period of time.
+/// Returns false if the file never becomes available.
+///
+/// This reduces the likelihood of race conditions.
+Future<bool> waitForFile(File file) async {
+ final end = DateTime.now().add(_maxWait);
+ while (!DateTime.now().isAfter(end)) {
+ if (file.existsSync()) return true;
+ await Future.delayed(_readDelay);
+ }
+ return file.existsSync();
+}
diff --git a/build_daemon/lib/src/managers/build_target_manager.dart b/build_daemon/lib/src/managers/build_target_manager.dart
index cca2214..965ace2 100644
--- a/build_daemon/lib/src/managers/build_target_manager.dart
+++ b/build_daemon/lib/src/managers/build_target_manager.dart
@@ -30,12 +30,18 @@
Set<BuildTarget> get targets => _buildTargets.keys.toSet();
+ /// All the tracked channels.
+ Set<WebSocketChannel> get allChannels =>
+ _buildTargets.values.expand((s) => s).toSet();
+
+ /// Adds a tracked build target with corresponding interested channel.
void addBuildTarget(BuildTarget target, WebSocketChannel channel) {
_buildTargets
.putIfAbsent(target, () => Set<WebSocketChannel>())
.add(channel);
}
+ /// Returns channels that are interested in the provided target.
Set<WebSocketChannel> channels(BuildTarget target) =>
_buildTargets[target] ?? Set();
diff --git a/build_daemon/lib/src/server.dart b/build_daemon/lib/src/server.dart
index fa563f5..a668894 100644
--- a/build_daemon/lib/src/server.dart
+++ b/build_daemon/lib/src/server.dart
@@ -19,8 +19,13 @@
import '../data/build_target.dart';
import '../data/build_target_request.dart';
import '../data/serializers.dart';
+import '../data/shutdown_notification.dart';
import 'managers/build_target_manager.dart';
+/// A server which communicates with build daemon clients over websockets.
+///
+/// Handles notifying clients of logs and results for registered build targets.
+/// Note the server will only notify clients of pertinent events.
class Server {
final _isDoneCompleter = Completer();
final BuildTargetManager _buildTargetManager;
@@ -54,6 +59,7 @@
Future<void> get onDone => _isDoneCompleter.future;
+ /// Starts listening for build daemon clients.
Future<int> listen() async {
var handler = webSocketHandler((WebSocketChannel channel) async {
channel.stream.listen((message) async {
@@ -77,7 +83,12 @@
return _server.port;
}
- Future<void> stop() async {
+ Future<void> stop({String message}) async {
+ if (message?.isNotEmpty ?? false) {
+ for (var connection in _buildTargetManager.allChannels) {
+ connection.sink.add(ShutdownNotification((b) => b.message));
+ }
+ }
_timeout.cancel();
await _server?.close(force: true);
await _builder?.stop();
diff --git a/build_daemon/mono_pkg.yaml b/build_daemon/mono_pkg.yaml
index f6ff9a4..a4571f7 100644
--- a/build_daemon/mono_pkg.yaml
+++ b/build_daemon/mono_pkg.yaml
@@ -6,5 +6,8 @@
- group:
- dartfmt: sdk
- dartanalyzer: --fatal-infos --fatal-warnings .
+ - dartanalyzer: --fatal-warnings .
+ dart:
+ - 2.1.0
- unit_test:
- command: pub run test
diff --git a/build_daemon/pubspec.yaml b/build_daemon/pubspec.yaml
index 36c2d00..f937905 100644
--- a/build_daemon/pubspec.yaml
+++ b/build_daemon/pubspec.yaml
@@ -1,5 +1,5 @@
name: build_daemon
-version: 0.5.0
+version: 0.6.0
description: A daemon for running Dart builds.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_daemon
diff --git a/build_modules/BUILD.gn b/build_modules/BUILD.gn
index 500e895..1db1579 100644
--- a/build_modules/BUILD.gn
+++ b/build_modules/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_modules-1.0.9
+# This file is generated by importer.py for build_modules-2.1.2
import("//build/dart/dart_library.gni")
@@ -15,11 +15,13 @@
"//third_party/dart-pkg/pub/pedantic",
"//third_party/dart-pkg/pub/logging",
"//third_party/dart-pkg/pub/glob",
- "//third_party/dart-pkg/pub/analyzer",
+ "//third_party/dart-pkg/pub/crypto",
+ "//third_party/dart-pkg/pub/collection",
"//third_party/dart-pkg/pub/graphs",
+ "//third_party/dart-pkg/pub/build",
"//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/scratch_space",
- "//third_party/dart-pkg/pub/build",
+ "//third_party/dart-pkg/pub/analyzer",
"//third_party/dart-pkg/pub/async",
"//third_party/dart-pkg/pub/build_config",
"//third_party/dart-pkg/pub/path",
diff --git a/build_modules/CHANGELOG.md b/build_modules/CHANGELOG.md
index 82418da..6583686 100644
--- a/build_modules/CHANGELOG.md
+++ b/build_modules/CHANGELOG.md
@@ -1,3 +1,47 @@
+## 2.1.2
+
+- Output additional `.module` files for all entrypoints to ease discovery of
+ modules for compilers.
+
+## 2.1.1
+
+- Allow `build_config` `0.4.x`.
+
+## 2.1.0
+
+- Make using the incremental compiler in the `KernelBuilder` configurable.
+
+## 2.0.0
+
+### Breaking Changes
+
+- Remove the `merge` method from `Module` and replace with a static
+ `Module.merge`. Module instances are now immutable.
+- Remove `jsId`, and `jsSourceMapId` from `Module`.
+- `DartPlatform` no longer has hard coded platforms, and its constructor is now
+ public. Anybody is now free to create their own `platform`.
+- Removed the platform specific builder factories from the `builders.dart` file.
+ - Packages that want to target compilation for a platform should create their
+ own builder factories.
+- Removed completely the analyzer based builders - `UnlinkedSummaryBuilder` and
+ `LinkedSummaryBuilder`.
+ - All backends should now be using the `KernelBuilder` instead.
+- Removed the default module builders for each supported platform. These
+ must now be created by the packages that want to add compilation targeting a
+ specific platform.
+ - This will help reduce asset graph bloat caused by platforms that you weren't
+ actually targeting.
+
+### Improvements
+
+- Update the kernel worker to pass input digests, along with
+ `--reuse-compiler-result` and `--use-incremental-compiler`.
+- Increased the upper bound for `package:analyzer` to `<0.37.0`.
+
+## 1.0.10
+
+- Fix a performance issue in the kernel_builder, especially for larger projects.
+
## 1.0.9
- Allow configuring the platform SDK directory in the `KernelBuilder` builder.
diff --git a/build_modules/README.md b/build_modules/README.md
index 26ec288..3e98188 100644
--- a/build_modules/README.md
+++ b/build_modules/README.md
@@ -1,5 +1,3 @@
-# build_modules
-
<p align="center">
Module builders for web, used by <a href="https://pub.dartlang.org/packages/build_web_compilers"><code>package:build_web_compilers</code></a>.
<br>
diff --git a/build_modules/build.yaml b/build_modules/build.yaml
index 0f051c4..a73fedf 100644
--- a/build_modules/build.yaml
+++ b/build_modules/build.yaml
@@ -10,58 +10,6 @@
is_optional: True
required_inputs: [".dart"]
applies_builders: ["|module_cleanup"]
- dartdevc:
- import: "package:build_modules/builders.dart"
- builder_factories:
- - metaModuleBuilderFactoryForPlatform('dartdevc')
- - metaModuleCleanBuilderFactoryForPlatform('dartdevc')
- - moduleBuilderFactoryForPlatform('dartdevc')
- - unlinkedSummaryBuilderForPlatform('dartdevc')
- - linkedSummaryBuilderForPlatform('dartdevc')
- build_extensions:
- $lib$:
- - .dartdevc.meta_module.raw
- - .dartdevc.meta_module.clean
- .dart:
- - .dartdevc.module
- - .dartdevc.linked.sum
- - .dartdevc.unlinked.sum
- is_optional: True
- auto_apply: none
- required_inputs: [".dart", ".module.library"]
- applies_builders: ["|module_cleanup"]
- dart2js:
- import: "package:build_modules/builders.dart"
- builder_factories:
- - metaModuleBuilderFactoryForPlatform('dart2js')
- - metaModuleCleanBuilderFactoryForPlatform('dart2js')
- - moduleBuilderFactoryForPlatform('dart2js')
- build_extensions:
- $lib$:
- - .dart2js.meta_module.raw
- - .dart2js.meta_module.clean
- .dart:
- - .dart2js.module
- is_optional: True
- auto_apply: none
- required_inputs: [".dart", ".module.library"]
- applies_builders: ["|module_cleanup"]
- vm:
- import: "package:build_modules/builders.dart"
- builder_factories:
- - metaModuleBuilderFactoryForPlatform('vm')
- - metaModuleCleanBuilderFactoryForPlatform('vm')
- - moduleBuilderFactoryForPlatform('vm')
- build_extensions:
- $lib$:
- - .vm.meta_module.raw
- - .vm.meta_module.clean
- .dart:
- - .vm.module
- is_optional: True
- auto_apply: none
- required_inputs: [".dart", ".module.library"]
- applies_builders: ["|module_cleanup"]
post_process_builders:
module_cleanup:
import: "package:build_modules/builders.dart"
diff --git a/build_modules/lib/build_modules.dart b/build_modules/lib/build_modules.dart
index 0d91310..809915c 100644
--- a/build_modules/lib/build_modules.dart
+++ b/build_modules/lib/build_modules.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.
-export 'src/errors.dart' show MissingModulesException;
+export 'src/errors.dart' show MissingModulesException, UnsupportedModules;
export 'src/kernel_builder.dart' show KernelBuilder, multiRootScheme;
export 'src/meta_module_builder.dart'
show MetaModuleBuilder, metaModuleExtension;
@@ -14,11 +14,4 @@
export 'src/modules.dart';
export 'src/platform.dart' show DartPlatform;
export 'src/scratch_space.dart' show scratchSpace, scratchSpaceResource;
-export 'src/summary_builder.dart'
- show
- LinkedSummaryBuilder,
- UnlinkedSummaryBuilder,
- linkedSummaryExtension,
- unlinkedSummaryExtension;
-export 'src/workers.dart'
- show dart2JsWorkerResource, dartdevcDriverResource, dartdevkDriverResource;
+export 'src/workers.dart' show dart2JsWorkerResource, dartdevkDriverResource;
diff --git a/build_modules/lib/builders.dart b/build_modules/lib/builders.dart
index 00719ea..4366a82 100644
--- a/build_modules/lib/builders.dart
+++ b/build_modules/lib/builders.dart
@@ -4,25 +4,9 @@
import 'package:build/build.dart';
import 'package:build_modules/build_modules.dart';
-import 'package:build_modules/src/meta_module_builder.dart';
-import 'package:build_modules/src/meta_module_clean_builder.dart';
import 'package:build_modules/src/module_cleanup.dart';
import 'package:build_modules/src/module_library_builder.dart';
-typedef Builder _BuilderFactory(BuilderOptions options);
-
Builder moduleLibraryBuilder(_) => const ModuleLibraryBuilder();
-_BuilderFactory metaModuleBuilderFactoryForPlatform(String platform) =>
- (BuilderOptions options) =>
- MetaModuleBuilder.forOptions(DartPlatform(platform), options);
-_BuilderFactory metaModuleCleanBuilderFactoryForPlatform(String platform) =>
- (_) => MetaModuleCleanBuilder(DartPlatform(platform));
-_BuilderFactory moduleBuilderFactoryForPlatform(String platform) =>
- (_) => ModuleBuilder(DartPlatform(platform));
-_BuilderFactory unlinkedSummaryBuilderForPlatform(String platform) =>
- (BuilderOptions options) => UnlinkedSummaryBuilder(DartPlatform(platform));
-_BuilderFactory linkedSummaryBuilderForPlatform(String platform) =>
- (BuilderOptions options) => LinkedSummaryBuilder(DartPlatform(platform));
-
PostProcessBuilder moduleCleanup(_) => const ModuleCleanup();
diff --git a/build_modules/lib/src/analysis_options.default.yaml b/build_modules/lib/src/analysis_options.default.yaml
deleted file mode 100644
index a10d4c5..0000000
--- a/build_modules/lib/src/analysis_options.default.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-analyzer:
- strong-mode: true
diff --git a/build_modules/lib/src/errors.dart b/build_modules/lib/src/errors.dart
index 3b9ce33..752c36e 100644
--- a/build_modules/lib/src/errors.dart
+++ b/build_modules/lib/src/errors.dart
@@ -8,6 +8,8 @@
import 'package:analyzer/analyzer.dart';
import 'package:build/build.dart';
+import 'module_library.dart';
+import 'module_library_builder.dart';
import 'modules.dart';
/// An [Exception] that is thrown when a worker returns an error.
@@ -102,3 +104,36 @@
var lineInfo = parsed.lineInfo.getLocation(import.offset);
return '`$import` from $sourceId at $lineInfo';
}
+
+/// An [Exception] that is thrown when there are some unsupported modules.
+class UnsupportedModules implements Exception {
+ final Set<Module> unsupportedModules;
+
+ UnsupportedModules(this.unsupportedModules);
+
+ Stream<ModuleLibrary> exactLibraries(AssetReader reader) async* {
+ for (var module in unsupportedModules) {
+ for (var source in module.sources) {
+ var libraryId = source.changeExtension(moduleLibraryExtension);
+ ModuleLibrary library;
+ if (await reader.canRead(libraryId)) {
+ library = ModuleLibrary.deserialize(
+ libraryId, await reader.readAsString(libraryId));
+ } else {
+ // A missing .module.library file indicates a part file, which can't
+ // have import statements, so we just skip them.
+ continue;
+ }
+ if (library.sdkDeps
+ .any((lib) => !module.platform.supportsLibrary(lib))) {
+ yield library;
+ }
+ }
+ }
+ }
+
+ @override
+ String toString() =>
+ 'Some modules contained libraries that were incompatible '
+ 'with the current platform.';
+}
diff --git a/build_modules/lib/src/kernel_builder.dart b/build_modules/lib/src/kernel_builder.dart
index d885452..7abdfe1 100644
--- a/build_modules/lib/src/kernel_builder.dart
+++ b/build_modules/lib/src/kernel_builder.dart
@@ -3,11 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:collection';
import 'dart:convert';
import 'dart:io';
import 'package:bazel_worker/bazel_worker.dart';
import 'package:build/build.dart';
+import 'package:crypto/crypto.dart';
+import 'package:graphs/graphs.dart' show crawlAsync;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import 'package:scratch_space/scratch_space.dart';
@@ -15,6 +18,7 @@
import 'common.dart';
import 'errors.dart';
import 'module_builder.dart';
+import 'module_cache.dart';
import 'modules.dart';
import 'platform.dart';
import 'scratch_space.dart';
@@ -30,6 +34,8 @@
@override
final Map<String, List<String>> buildExtensions;
+ final bool useIncrementalCompiler;
+
final String outputExtension;
final DartPlatform platform;
@@ -57,8 +63,10 @@
@required this.summaryOnly,
@required this.sdkKernelPath,
@required this.outputExtension,
+ bool useIncrementalCompiler,
String platformSdk})
: platformSdk = platformSdk ?? sdkDir,
+ useIncrementalCompiler = useIncrementalCompiler ?? false,
buildExtensions = {
moduleExtension(platform): [outputExtension]
};
@@ -74,8 +82,12 @@
buildStep: buildStep,
summaryOnly: summaryOnly,
outputExtension: outputExtension,
+ platform: platform,
dartSdkDir: platformSdk,
- sdkKernelPath: sdkKernelPath);
+ sdkKernelPath: sdkKernelPath,
+ useIncrementalCompiler: useIncrementalCompiler);
+ } on MissingModulesException catch (e) {
+ log.severe(e.toString());
} on KernelException catch (e, s) {
log.severe(
'Error creating '
@@ -92,8 +104,10 @@
@required BuildStep buildStep,
@required bool summaryOnly,
@required String outputExtension,
+ @required DartPlatform platform,
@required String dartSdkDir,
- @required String sdkKernelPath}) async {
+ @required String sdkKernelPath,
+ @required bool useIncrementalCompiler}) async {
var request = WorkRequest();
var scratchSpace = await buildStep.fetchResource(scratchSpaceResource);
var outputId = module.primarySource.changeExtension(outputExtension);
@@ -101,35 +115,39 @@
File packagesFile;
- {
- var transitiveDeps = await module.computeTransitiveDependencies(buildStep);
- var transitiveKernelDeps = <AssetId>[];
- var transitiveSourceDeps = <AssetId>[];
+ await buildStep.trackStage('CollectDeps', () async {
+ var kernelDeps = <AssetId>[];
+ var sourceDeps = <AssetId>[];
- await Future.wait(transitiveDeps.map((dep) => _addModuleDeps(
- dep,
- module,
- transitiveKernelDeps,
- transitiveSourceDeps,
- buildStep,
- outputExtension)));
+ await _findModuleDeps(
+ module, kernelDeps, sourceDeps, buildStep, outputExtension);
var allAssetIds = Set<AssetId>()
..addAll(module.sources)
- ..addAll(transitiveKernelDeps)
- ..addAll(transitiveSourceDeps);
+ ..addAll(kernelDeps)
+ ..addAll(sourceDeps);
await scratchSpace.ensureAssets(allAssetIds, buildStep);
packagesFile = await createPackagesFile(allAssetIds);
- _addRequestArguments(request, module, transitiveKernelDeps, dartSdkDir,
- sdkKernelPath, outputFile, packagesFile, summaryOnly);
- }
+ await _addRequestArguments(
+ request,
+ module,
+ kernelDeps,
+ platform,
+ sdkDir,
+ sdkKernelPath,
+ outputFile,
+ packagesFile,
+ summaryOnly,
+ useIncrementalCompiler,
+ buildStep);
+ });
// We need to make sure and clean up the temp dir, even if we fail to compile.
try {
- var analyzer = await buildStep.fetchResource(frontendDriverResource);
- var response = await analyzer.doWork(request,
+ var frontendWorker = await buildStep.fetchResource(frontendDriverResource);
+ var response = await frontendWorker.doWork(request,
trackWork: (response) => buildStep
.trackStage('Kernel Generate', () => response, isExternal: true));
if (response.exitCode != EXIT_CODE_OK || !await outputFile.exists()) {
@@ -148,42 +166,107 @@
}
}
-/// Adds the source or kernel dependencies for [dependency] to
-/// [transitiveKernelDeps] or [transitiveSourceDeps].
-Future<void> _addModuleDeps(
- Module dependency,
+/// Finds the transitive dependencies of [root] and categorizes them as
+/// [kernelDeps] or [sourceDeps].
+///
+/// A module will have it's kernel file in [kernelDeps] if it and all of it's
+/// transitive dependencies have readable kernel files. If any module has no
+/// readable kernel file then it, and all of it's dependents will be categorized
+/// as [sourceDeps] which will have all of their [Module.sources].
+Future<void> _findModuleDeps(
Module root,
- List<AssetId> transitiveKernelDeps,
- List<AssetId> transitiveSourceDeps,
+ List<AssetId> kernelDeps,
+ List<AssetId> sourceDeps,
BuildStep buildStep,
String outputExtension) async {
- var kernelId = dependency.primarySource.changeExtension(outputExtension);
- if (await buildStep.canRead(kernelId)) {
- // If we can read the kernel file, but it depends on any module in this
- // package, then we need to only provide sources for that file since its
- // dependencies in this package will only be providing sources as well.
- if ((await dependency.computeTransitiveDependencies(buildStep))
- .any((m) => m.primarySource.package == root.primarySource.package)) {
- transitiveSourceDeps.addAll(dependency.sources);
+ final resolvedModules = await _resolveTransitiveModules(root, buildStep);
+
+ final sourceOnly = await _parentsOfMissingKernelFiles(
+ resolvedModules, buildStep, outputExtension);
+
+ for (final module in resolvedModules) {
+ if (sourceOnly.contains(module.primarySource)) {
+ sourceDeps.addAll(module.sources);
} else {
- transitiveKernelDeps.add(kernelId);
+ kernelDeps.add(module.primarySource.changeExtension(outputExtension));
}
- } else {
- transitiveSourceDeps.addAll(dependency.sources);
}
}
+/// The transitive dependencies of [root], not including [root] itself.
+Future<List<Module>> _resolveTransitiveModules(
+ Module root, BuildStep buildStep) async {
+ var missing = Set<AssetId>();
+ var modules = await crawlAsync<AssetId, Module>(
+ [root.primarySource],
+ (id) => buildStep.fetchResource(moduleCache).then((c) async {
+ var moduleId =
+ id.changeExtension(moduleExtension(root.platform));
+ var module = await c.find(moduleId, buildStep);
+ if (module == null) {
+ missing.add(moduleId);
+ } else if (module.isMissing) {
+ missing.add(module.primarySource);
+ }
+ return module;
+ }),
+ (id, module) => module.directDependencies)
+ .skip(1) // Skip the root.
+ .toList();
+
+ if (missing.isNotEmpty) {
+ throw await MissingModulesException.create(
+ missing, modules.toList()..add(root), buildStep);
+ }
+
+ return modules;
+}
+
+/// Finds the primary source of all transitive parents of any module which does
+/// not have a readable kernel file.
+///
+/// Inverts the direction of the graph and then crawls to all reachables nodes
+/// from the modules which do not have a readable kernel file
+Future<Set<AssetId>> _parentsOfMissingKernelFiles(
+ List<Module> modules, BuildStep buildStep, String outputExtension) async {
+ final sourceOnly = Set<AssetId>();
+ final parents = <AssetId, Set<AssetId>>{};
+ for (final module in modules) {
+ for (final dep in module.directDependencies) {
+ parents.putIfAbsent(dep, () => Set<AssetId>()).add(module.primarySource);
+ }
+ if (!await buildStep
+ .canRead(module.primarySource.changeExtension(outputExtension))) {
+ sourceOnly.add(module.primarySource);
+ }
+ }
+ final toCrawl = Queue.of(sourceOnly);
+ while (toCrawl.isNotEmpty) {
+ final current = toCrawl.removeFirst();
+ if (!parents.containsKey(current)) continue;
+ for (final next in parents[current]) {
+ if (!sourceOnly.add(next)) {
+ toCrawl.add(next);
+ }
+ }
+ }
+ return sourceOnly;
+}
+
/// Fills in all the required arguments for [request] in order to compile the
/// kernel file for [module].
-void _addRequestArguments(
+Future<void> _addRequestArguments(
WorkRequest request,
Module module,
Iterable<AssetId> transitiveKernelDeps,
+ DartPlatform platform,
String sdkDir,
String sdkKernelPath,
File outputFile,
File packagesFile,
- bool summaryOnly) {
+ bool summaryOnly,
+ bool useIncrementalCompiler,
+ AssetReader reader) async {
request.arguments.addAll([
'--dart-sdk-summary',
Uri.file(p.join(sdkDir, sdkKernelPath)).toString(),
@@ -195,18 +278,33 @@
multiRootScheme,
'--exclude-non-sources',
summaryOnly ? '--summary-only' : '--no-summary-only',
+ '--libraries-file',
+ p.toUri(p.join(sdkDir, 'lib', 'libraries.json')).toString(),
]);
+ if (useIncrementalCompiler) {
+ request.arguments.addAll([
+ '--reuse-compiler-result',
+ '--use-incremental-compiler',
+ ]);
+ }
- // Add all summaries as summary inputs.
- request.arguments.addAll(transitiveKernelDeps.map((id) {
+ request.inputs.add(Input()
+ ..path = '${Uri.file(p.join(sdkDir, sdkKernelPath))}'
+ // Sdk updates fully invalidate the build anyways.
+ ..digest = md5.convert(utf8.encode(platform.name)).bytes);
+
+ // Add all kernel outlines as summary inputs, with digests.
+ var inputs = await Future.wait(transitiveKernelDeps.map((id) async {
var relativePath = p.url.relative(scratchSpace.fileFor(id).uri.path,
from: scratchSpace.tempDir.uri.path);
- if (summaryOnly) {
- return '--input-summary=$multiRootScheme:///$relativePath';
- } else {
- return '--input-linked=$multiRootScheme:///$relativePath';
- }
+
+ return Input()
+ ..path = '$multiRootScheme:///$relativePath'
+ ..digest = (await reader.digest(id)).bytes;
}));
+ request.arguments.addAll(inputs
+ .map((i) => '--input-${summaryOnly ? 'summary' : 'linked'}=${i.path}'));
+ request.inputs.addAll(inputs);
request.arguments.addAll(module.sources.map((id) {
var uri = id.path.startsWith('lib')
diff --git a/build_modules/lib/src/meta_module.dart b/build_modules/lib/src/meta_module.dart
index 39bff4c..185fef5 100644
--- a/build_modules/lib/src/meta_module.dart
+++ b/build_modules/lib/src/meta_module.dart
@@ -55,11 +55,6 @@
return Module(primaryId, sources, directDependencies, platform, isSupported);
}
-Map<AssetId, Module> _entryPointModules(
- Iterable<Module> modules, Set<AssetId> entrypoints) =>
- Map.fromIterable(modules.where((m) => m.sources.any(entrypoints.contains)),
- key: (m) => (m as Module).primarySource);
-
/// Gets the local (same top level dir of the same package) transitive deps of
/// [module] using [assetsToModules].
Set<AssetId> _localTransitiveDeps(
@@ -113,22 +108,26 @@
/// * Else merge it into with others that are depended on by the same set of
/// entrypoints
List<Module> _mergeModules(Iterable<Module> modules, Set<AssetId> entrypoints) {
- // Modules which have any entrypoing keyed by primary source.
- var entrypointModules = _entryPointModules(modules, entrypoints);
+ var entrypointModules =
+ modules.where((m) => m.sources.any(entrypoints.contains)).toList();
+
+ // Groups of modules that can be merged into an existing entrypoint module.
+ var entrypointModuleGroups = Map.fromIterable(entrypointModules,
+ key: (m) => (m as Module).primarySource, value: (m) => [m as Module]);
// Maps modules to entrypoint modules that transitively depend on them.
var modulesToEntryPoints =
- _findReverseEntrypointDeps(entrypointModules.values, modules);
+ _findReverseEntrypointDeps(entrypointModules, modules);
// Modules which are not depended on by any entrypoint
var standaloneModules = <Module>[];
// Modules which are merged with others.
- var mergedModules = <String, Module>{};
+ var mergedModules = <String, List<Module>>{};
for (var module in modules) {
// Skip entrypoint modules.
- if (entrypointModules.containsKey(module.primarySource)) continue;
+ if (entrypointModuleGroups.containsKey(module.primarySource)) continue;
// The entry points that transitively import this module.
var entrypointIds = modulesToEntryPoints[module.primarySource];
@@ -143,19 +142,16 @@
// a new shared module. Use `$` to signal that it is a shared module.
if (entrypointIds.length > 1) {
var mId = (entrypointIds.toList()..sort()).map((m) => m.path).join('\$');
- if (mergedModules.containsKey(mId)) {
- mergedModules[mId].merge(module);
- } else {
- mergedModules[mId] = module;
- }
+ mergedModules.putIfAbsent(mId, () => []).add(module);
} else {
- entrypointModules[entrypointIds.single].merge(module);
+ entrypointModuleGroups[entrypointIds.single].add(module);
}
}
return mergedModules.values
+ .map(Module.merge)
.map(_withConsistentPrimarySource)
- .followedBy(entrypointModules.values)
+ .followedBy(entrypointModuleGroups.values.map(Module.merge))
.followedBy(standaloneModules)
.toList();
}
@@ -208,7 +204,7 @@
@JsonKey(name: 'm', nullable: false)
final List<Module> modules;
- MetaModule(this.modules);
+ MetaModule(List<Module> modules) : modules = List.unmodifiable(modules);
/// Generated factory constructor.
factory MetaModule.fromJson(Map<String, dynamic> json) =>
diff --git a/build_modules/lib/src/meta_module_clean_builder.dart b/build_modules/lib/src/meta_module_clean_builder.dart
index 6530f94..590a6a4 100644
--- a/build_modules/lib/src/meta_module_clean_builder.dart
+++ b/build_modules/lib/src/meta_module_clean_builder.dart
@@ -11,6 +11,7 @@
import 'meta_module.dart';
import 'meta_module_builder.dart';
+import 'module_cache.dart';
import 'modules.dart';
import 'platform.dart';
@@ -93,9 +94,8 @@
var dependentModules = Set<Module>();
// Ensures we only process a meta file once.
var seenMetas = Set<AssetId>()..add(metaAsset);
- var meta = MetaModule.fromJson(
- jsonDecode(await buildStep.readAsString(buildStep.inputId))
- as Map<String, dynamic>);
+ var metaModules = await buildStep.fetchResource(metaModuleCache);
+ var meta = await metaModules.find(buildStep.inputId, buildStep);
var nextModules = List.of(meta.modules);
while (nextModules.isNotEmpty) {
var module = nextModules.removeLast();
@@ -122,9 +122,7 @@
'on it in your pubspec.');
continue;
}
- var depMeta = MetaModule.fromJson(
- jsonDecode(await buildStep.readAsString(depMetaAsset))
- as Map<String, dynamic>);
+ var depMeta = await metaModules.find(depMetaAsset, buildStep);
nextModules.addAll(depMeta.modules);
}
}
diff --git a/build_modules/lib/src/module_builder.dart b/build_modules/lib/src/module_builder.dart
index 3f4ca61..2e4403b 100644
--- a/build_modules/lib/src/module_builder.dart
+++ b/build_modules/lib/src/module_builder.dart
@@ -5,43 +5,18 @@
import 'dart:async';
import 'dart:convert';
-import 'package:async/async.dart';
import 'package:build/build.dart';
-import 'meta_module.dart';
import 'meta_module_clean_builder.dart';
+import 'module_cache.dart';
+import 'module_library.dart';
+import 'module_library_builder.dart' show moduleLibraryExtension;
import 'modules.dart';
import 'platform.dart';
/// The extension for serialized module assets.
String moduleExtension(DartPlatform platform) => '.${platform.name}.module';
-/// A [Resource] that provides a [_CleanMetaModuleCache].
-final _cleanMetaModules = Resource<_CleanMetaModuleCache>(
- () => _CleanMetaModuleCache(),
- dispose: (c) => c.dispose());
-
-/// Safely caches deserialized [MetaModule] objects by their [AssetId].
-///
-/// Tracks access to assets via [BuildStep.canRead] calls.
-class _CleanMetaModuleCache {
- final _modules = <AssetId, Future<Result<MetaModule>>>{};
-
- void dispose() => _modules.clear();
-
- Future<MetaModule> find(
- DartPlatform platform, String package, AssetReader reader) async {
- var cleanMetaAsset =
- AssetId(package, 'lib/${metaModuleCleanExtension(platform)}');
- if (!await reader.canRead(cleanMetaAsset)) return null;
- var metaResult = _modules.putIfAbsent(
- cleanMetaAsset,
- () => Result.capture(reader.readAsString(cleanMetaAsset).then((c) =>
- MetaModule.fromJson(jsonDecode(c) as Map<String, dynamic>))));
- return Result.release(metaResult);
- }
-}
-
/// Creates `.module` files for any `.dart` file that is the primary dart
/// source of a [Module].
class ModuleBuilder implements Builder {
@@ -57,12 +32,24 @@
@override
Future build(BuildStep buildStep) async {
- var cleanMetaModules = await buildStep.fetchResource(_cleanMetaModules);
- var metaModule = await cleanMetaModules.find(
- _platform, buildStep.inputId.package, buildStep);
- final outputModule = metaModule.modules.firstWhere(
+ final cleanMetaModules = await buildStep.fetchResource(metaModuleCache);
+ final metaModule = await cleanMetaModules.find(
+ AssetId(buildStep.inputId.package,
+ 'lib/${metaModuleCleanExtension(_platform)}'),
+ buildStep);
+ var outputModule = metaModule.modules.firstWhere(
(m) => m.primarySource == buildStep.inputId,
orElse: () => null);
+ if (outputModule == null) {
+ final serializedLibrary = await buildStep.readAsString(
+ buildStep.inputId.changeExtension(moduleLibraryExtension));
+ final libraryModule =
+ ModuleLibrary.deserialize(buildStep.inputId, serializedLibrary);
+ if (libraryModule.isEntryPoint) {
+ outputModule = metaModule.modules
+ .firstWhere((m) => m.sources.contains(buildStep.inputId));
+ }
+ }
if (outputModule == null) return;
await buildStep.writeAsString(
buildStep.inputId.changeExtension(moduleExtension(_platform)),
diff --git a/build_modules/lib/src/module_cache.dart b/build_modules/lib/src/module_cache.dart
new file mode 100644
index 0000000..44a54b8
--- /dev/null
+++ b/build_modules/lib/src/module_cache.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2019, 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:convert';
+
+import 'package:async/async.dart';
+import 'package:build/build.dart';
+
+import 'meta_module.dart';
+import 'modules.dart';
+
+final metaModuleCache = DecodingCache.resource((m) => MetaModule.fromJson(m));
+
+final moduleCache = DecodingCache.resource((m) => Module.fromJson(m));
+
+/// A cache of objects decoded from written assets suitable for use as a
+/// [Resource].
+///
+/// Instances that are decoded will be cached throughout the duration of a build
+/// and invalidated between builds. Instances that are shared through the cache
+/// should be treated as immutable to avoid leaking any information which was
+/// not loaded from the underlying asset.
+class DecodingCache<T> {
+ /// Create a [Resource] which can decoded instances of [T] serialized via json
+ /// to assets.
+ static Resource<DecodingCache<T>> resource<T>(
+ T Function(Map<String, dynamic>) _fromJson) =>
+ Resource<DecodingCache<T>>(() => DecodingCache._(_fromJson),
+ dispose: (c) => c._dispose());
+
+ final _cached = <AssetId, Future<Result<T>>>{};
+
+ final T Function(Map<String, dynamic>) _fromJson;
+
+ DecodingCache._(this._fromJson);
+
+ void _dispose() => _cached.clear();
+
+ /// Find and deserialize a [T] stored in [id].
+ ///
+ /// If the asset at [id] is unreadable the returned future will resolve to
+ /// `null`. If the instance is cached it will not be decoded again, but the
+ /// content dependencies will be tracked through [reader].
+ Future<T> find(AssetId id, AssetReader reader) async {
+ if (!await reader.canRead(id)) return null;
+ var result = _cached.putIfAbsent(
+ id,
+ () => Result.capture(reader
+ .readAsString(id)
+ .then((c) => jsonDecode(c) as Map<String, dynamic>)
+ .then(_fromJson)));
+ return Result.release(result);
+ }
+}
diff --git a/build_modules/lib/src/module_cleanup.dart b/build_modules/lib/src/module_cleanup.dart
index 8d7f9f5..ff1af73 100644
--- a/build_modules/lib/src/module_cleanup.dart
+++ b/build_modules/lib/src/module_cleanup.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:build/build.dart';
import 'module_library_builder.dart';
@@ -12,9 +10,8 @@
const ModuleCleanup();
@override
- FutureOr<Null> build(PostProcessBuildStep buildStep) {
+ void build(PostProcessBuildStep buildStep) {
buildStep.deletePrimaryInput();
- return null;
}
@override
@@ -23,7 +20,5 @@
'.meta_module.raw',
'.meta_module.clean',
'.module',
- '.linked.sum',
- '.unlinked.sum'
];
}
diff --git a/build_modules/lib/src/modules.dart b/build_modules/lib/src/modules.dart
index a6af2e8..efbda5c 100644
--- a/build_modules/lib/src/modules.dart
+++ b/build_modules/lib/src/modules.dart
@@ -3,43 +3,57 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:convert';
+import 'dart:collection';
import 'package:build/build.dart';
+import 'package:collection/collection.dart' show UnmodifiableSetView;
import 'package:graphs/graphs.dart';
import 'package:json_annotation/json_annotation.dart';
import 'errors.dart';
import 'module_builder.dart';
+import 'module_cache.dart';
import 'platform.dart';
-import 'summary_builder.dart';
part 'modules.g.dart';
-/// A collection of Dart libraries in a strongly connected component and the
-/// modules they depend on.
+/// A collection of Dart libraries in a strongly connected component of the
+/// import graph.
///
+/// Modules track their sources and the other modules they depend on.
+/// modules they depend on.
/// Modules can span pub package boundaries when there are import cycles across
/// packages.
@JsonSerializable()
@_AssetIdConverter()
@_DartPlatformConverter()
class Module {
- /// The JS file for this module.
- AssetId jsId(String jsModuleExtension) =>
- primarySource.changeExtension(jsModuleExtension);
+ /// Merge the sources and dependencies from [modules] into a single module.
+ ///
+ /// All modules must have the same [platform].
+ /// [primarySource] will be the earliest value from the combined [sources] if
+ /// they were sorted.
+ /// [isMissing] will be true if any input module is missing.
+ /// [isSupported] will be true if all input modules are supported.
+ /// [directDependencies] will be merged for all modules, but if any module
+ /// depended on a source from any other they will be filtered out.
+ static Module merge(List<Module> modules) {
+ assert(modules.isNotEmpty);
+ if (modules.length == 1) return modules.single;
+ assert(modules.every((m) => m.platform == modules.first.platform));
- // The sourcemap for the JS file for this module.
- AssetId jsSourceMapId(String jsSourceMapExtension) =>
- primarySource.changeExtension(jsSourceMapExtension);
-
- /// The linked summary for this module.
- AssetId get linkedSummaryId =>
- primarySource.changeExtension(linkedSummaryExtension(platform));
-
- /// The unlinked summary for this module.
- AssetId get unlinkedSummaryId =>
- primarySource.changeExtension(unlinkedSummaryExtension(platform));
+ final allSources = HashSet.of(modules.expand((m) => m.sources));
+ final allDependencies =
+ HashSet.of(modules.expand((m) => m.directDependencies))
+ ..removeAll(allSources);
+ final primarySource =
+ allSources.reduce((a, b) => a.compareTo(b) < 0 ? a : b);
+ final isMissing = modules.any((m) => m.isMissing);
+ final isSupported = modules.every((m) => m.isSupported);
+ return Module(primarySource, allSources, allDependencies,
+ modules.first.platform, isSupported,
+ isMissing: isMissing);
+ }
/// The library which will be used to reference any library in [sources].
///
@@ -70,12 +84,12 @@
/// Libraries `foo` and `bar` form an import cycle so they would be grouped in
/// the same module. Every Dart library will only be contained in a single
/// [Module].
- @JsonKey(name: 's', nullable: false)
+ @JsonKey(name: 's', nullable: false, toJson: _toJsonAssetIds)
final Set<AssetId> sources;
/// The [primarySource]s of the [Module]s which contain any library imported
/// from any of the [sources] in this module.
- @JsonKey(name: 'd', nullable: false)
+ @JsonKey(name: 'd', nullable: false, toJson: _toJsonAssetIds)
final Set<AssetId> directDependencies;
/// Missing modules are created if a module depends on another non-existent
@@ -105,8 +119,9 @@
Module(this.primarySource, Iterable<AssetId> sources,
Iterable<AssetId> directDependencies, this.platform, this.isSupported,
{bool isMissing})
- : sources = sources.toSet(),
- directDependencies = directDependencies.toSet(),
+ : sources = UnmodifiableSetView(HashSet.of(sources)),
+ directDependencies =
+ UnmodifiableSetView(HashSet.of(directDependencies)),
isMissing = isMissing ?? false;
/// Generated factory constructor.
@@ -119,32 +134,39 @@
///
/// Throws a [MissingModulesException] if there are any missing modules. This
/// typically means that somebody is trying to import a non-existing file.
- Future<List<Module>> computeTransitiveDependencies(AssetReader reader) async {
+ ///
+ /// If [throwIfUnsupported] is `true`, then an [UnsupportedModules]
+ /// will be thrown if there are any modules that are not supported.
+ Future<List<Module>> computeTransitiveDependencies(BuildStep buildStep,
+ {bool throwIfUnsupported = false}) async {
+ throwIfUnsupported ??= false;
+ final modules = await buildStep.fetchResource(moduleCache);
var transitiveDeps = <AssetId, Module>{};
var modulesToCrawl = directDependencies.toSet();
var missingModuleSources = Set<AssetId>();
+ var unsupportedModules = Set<Module>();
while (modulesToCrawl.isNotEmpty) {
var next = modulesToCrawl.last;
modulesToCrawl.remove(next);
if (transitiveDeps.containsKey(next)) continue;
var nextModuleId = next.changeExtension(moduleExtension(platform));
- if (!await reader.canRead(nextModuleId)) {
+ var module = await modules.find(nextModuleId, buildStep);
+ if (module == null || module.isMissing) {
missingModuleSources.add(next);
continue;
}
- var module = Module.fromJson(
- json.decode(await reader.readAsString(nextModuleId))
- as Map<String, dynamic>);
- if (module.isMissing) {
- missingModuleSources.add(module.primarySource);
- continue;
+ if (throwIfUnsupported && !module.isSupported) {
+ unsupportedModules.add(module);
}
transitiveDeps[next] = module;
modulesToCrawl.addAll(module.directDependencies);
}
if (missingModuleSources.isNotEmpty) {
throw await MissingModulesException.create(missingModuleSources,
- transitiveDeps.values.toList()..add(this), reader);
+ transitiveDeps.values.toList()..add(this), buildStep);
+ }
+ if (throwIfUnsupported && unsupportedModules.isNotEmpty) {
+ throw UnsupportedModules(unsupportedModules);
}
var orderedModules = stronglyConnectedComponents<Module>(
transitiveDeps.values,
@@ -153,15 +175,6 @@
hashCode: (m) => m.primarySource.hashCode);
return orderedModules.map((c) => c.single).toList();
}
-
- /// Add all of [other]'s source and dependencies to this module and keep this
- /// module's primary source.
- void merge(Module other) {
- sources.addAll(other.sources);
- directDependencies
- ..addAll(other.directDependencies)
- ..removeAll(sources);
- }
}
class _AssetIdConverter implements JsonConverter<AssetId, List> {
@@ -178,8 +191,13 @@
const _DartPlatformConverter();
@override
- DartPlatform fromJson(String json) => DartPlatform(json);
+ DartPlatform fromJson(String json) => DartPlatform.byName(json);
@override
String toJson(DartPlatform object) => object.name;
}
+
+/// Ensure sets of asset IDs are sorted before writing them for a consistent
+/// output.
+List<List> _toJsonAssetIds(Set<AssetId> ids) =>
+ (ids.toList()..sort()).map((i) => i.serialize() as List).toList();
diff --git a/build_modules/lib/src/modules.g.dart b/build_modules/lib/src/modules.g.dart
index c6ed2e4..bf0bf70 100644
--- a/build_modules/lib/src/modules.g.dart
+++ b/build_modules/lib/src/modules.g.dart
@@ -20,10 +20,8 @@
Map<String, dynamic> _$ModuleToJson(Module instance) => <String, dynamic>{
'p': const _AssetIdConverter().toJson(instance.primarySource),
- 's': instance.sources.map(const _AssetIdConverter().toJson).toList(),
- 'd': instance.directDependencies
- .map(const _AssetIdConverter().toJson)
- .toList(),
+ 's': _toJsonAssetIds(instance.sources),
+ 'd': _toJsonAssetIds(instance.directDependencies),
'm': instance.isMissing,
'is': instance.isSupported,
'pf': const _DartPlatformConverter().toJson(instance.platform)
diff --git a/build_modules/lib/src/platform.dart b/build_modules/lib/src/platform.dart
index 7f64f32..c74e47a 100644
--- a/build_modules/lib/src/platform.dart
+++ b/build_modules/lib/src/platform.dart
@@ -2,109 +2,48 @@
// 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.
-/// A supported platform for compilation of Dart libraries, including knowledge
-/// of which core libraries are supported.
+/// A supported "platform" for compilation of Dart libraries.
+///
+/// Each "platform" has its own compilation pipeline and builders, and could
+/// differ from other platforms in many ways:
+///
+/// - The core libs that are supported
+/// - The implementations of the core libs
+/// - The compilation steps that are required (frontends or backends could be
+/// different).
+///
+/// Typically these should correspond to `libraries.json` files in the SDK.
+///
+/// New platforms should be created with [register], and can later be
+/// fetched by name using the [DartPlatform.byName] static method.
class DartPlatform {
+ /// A list of all registered platforms by name, populated by
+ /// [register].
+ static final _platformsByName = <String, DartPlatform>{};
+
final List<String> _supportedLibraries;
final String name;
- static const dartdevc = DartPlatform._('dartdevc', [
- 'async',
- 'collection',
- 'convert',
- 'core',
- 'developer',
- 'html',
- 'html_common',
- 'indexed_db',
- 'js',
- 'js_util',
- 'math',
- 'svg',
- 'typed_data',
- 'web_audio',
- 'web_gl',
- 'web_sql',
- ]);
- static const dart2js = DartPlatform._('dart2js', [
- 'async',
- 'collection',
- 'convert',
- 'core',
- 'developer',
- 'html',
- 'html_common',
- 'indexed_db',
- 'js',
- 'js_util',
- 'math',
- 'svg',
- 'typed_data',
- 'web_audio',
- 'web_gl',
- 'web_sql',
- ]);
- static const dart2jsServer = DartPlatform._('dart2js_server', [
- 'async',
- 'collection',
- 'convert',
- 'core',
- 'developer',
- 'js',
- 'js_util',
- 'math',
- 'typed_data',
- ]);
- static const flutter = DartPlatform._('flutter', [
- 'async',
- 'cli',
- 'collection',
- 'convert',
- 'core',
- 'developer',
- 'io',
- 'isolate',
- 'math',
- 'nativewrappers',
- 'profiler',
- 'typed_data',
- 'ui',
- 'vmservice_io',
- ]);
- static const vm = DartPlatform._('vm', [
- 'async',
- 'cli',
- 'collection',
- 'convert',
- 'core',
- 'developer',
- 'io',
- 'isolate',
- 'math',
- 'mirrors',
- 'nativewrappers',
- 'profiler',
- 'typed_data',
- 'vmservice_io',
- ]);
+ /// Returns a [DartPlatform] instance by name.
+ ///
+ /// Throws an [UnrecognizedDartPlatform] if [name] has not been
+ /// registered with [DartPlatform.register].
+ static DartPlatform byName(String name) =>
+ _platformsByName[name] ?? (throw UnrecognizedDartPlatform(name));
- factory DartPlatform(String name) {
- var platform = _byName[name];
- if (platform == null) {
- throw ArgumentError('Unrecognized paltform $name, the recognized '
- 'platforms are ${_byName.keys.join(', ')}.');
+ /// Registers a new [DartPlatform].
+ ///
+ /// Throws a [DartPlatformAlreadyRegistered] if [name] has already
+ /// been registered by somebody else.
+ static DartPlatform register(String name, List<String> supportedLibraries) {
+ if (_platformsByName.containsKey(name)) {
+ throw DartPlatformAlreadyRegistered(name);
}
- return platform;
- }
- static const _byName = {
- 'dart2js': dart2js,
- 'dart2js_server': dart2jsServer,
- 'dartdevc': dartdevc,
- 'flutter': flutter,
- 'vm': vm
- };
+ return _platformsByName[name] =
+ DartPlatform._(name, List.unmodifiable(supportedLibraries));
+ }
const DartPlatform._(this.name, this._supportedLibraries);
@@ -120,3 +59,22 @@
@override
bool operator ==(other) => other is DartPlatform && other.name == name;
}
+
+class DartPlatformAlreadyRegistered implements Exception {
+ final String name;
+
+ const DartPlatformAlreadyRegistered(this.name);
+
+ @override
+ String toString() => 'The platform `$name`, has already been registered.';
+}
+
+class UnrecognizedDartPlatform implements Exception {
+ final String name;
+
+ const UnrecognizedDartPlatform(this.name);
+
+ @override
+ String toString() => 'Unrecognized platform `$name`, it must be registered '
+ 'first using `DartPlatform.register`';
+}
diff --git a/build_modules/lib/src/scratch_space.dart b/build_modules/lib/src/scratch_space.dart
index 1e00a10..6149341 100644
--- a/build_modules/lib/src/scratch_space.dart
+++ b/build_modules/lib/src/scratch_space.dart
@@ -29,8 +29,6 @@
}, beforeExit: () async {
// The workers are running inside the scratch space, so wait for them to
// shut down before deleting it.
- await analyzerWorkersAreDone;
- await dartdevcWorkersAreDone;
await dartdevkWorkersAreDone;
await frontendWorkersAreDone;
await dart2jsWorkersAreDone;
diff --git a/build_modules/lib/src/summary_builder.dart b/build_modules/lib/src/summary_builder.dart
deleted file mode 100644
index 238cdb5..0000000
--- a/build_modules/lib/src/summary_builder.dart
+++ /dev/null
@@ -1,184 +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:async';
-import 'dart:convert';
-
-import 'package:bazel_worker/bazel_worker.dart';
-import 'package:build/build.dart';
-import 'package:scratch_space/scratch_space.dart';
-
-import 'common.dart';
-import 'errors.dart';
-import 'module_builder.dart';
-import 'modules.dart';
-import 'platform.dart';
-import 'scratch_space.dart';
-import 'workers.dart';
-
-String linkedSummaryExtension(DartPlatform platform) =>
- '.${platform.name}.linked.sum';
-String unlinkedSummaryExtension(DartPlatform platform) =>
- '.${platform.name}.unlinked.sum';
-
-/// A builder which can output unlinked summaries!
-class UnlinkedSummaryBuilder implements Builder {
- UnlinkedSummaryBuilder(DartPlatform platform)
- : buildExtensions = {
- moduleExtension(platform): [unlinkedSummaryExtension(platform)]
- };
-
- @override
- final Map<String, List<String>> buildExtensions;
-
- @override
- Future build(BuildStep buildStep) async {
- var module = Module.fromJson(
- json.decode(await buildStep.readAsString(buildStep.inputId))
- as Map<String, dynamic>);
- try {
- await _createUnlinkedSummary(module, buildStep);
- } on AnalyzerSummaryException catch (e) {
- log.severe('Error creating ${module.unlinkedSummaryId}:\n$e');
- }
- }
-}
-
-/// A builder which can output linked summaries!
-class LinkedSummaryBuilder implements Builder {
- LinkedSummaryBuilder(DartPlatform platform)
- : buildExtensions = {
- moduleExtension(platform): [linkedSummaryExtension(platform)]
- };
-
- @override
- final Map<String, List<String>> buildExtensions;
-
- @override
- Future build(BuildStep buildStep) async {
- var module = Module.fromJson(
- json.decode(await buildStep.readAsString(buildStep.inputId))
- as Map<String, dynamic>);
- try {
- await _createLinkedSummary(module, buildStep);
- } on AnalyzerSummaryException catch (e, s) {
- log.warning('Error creating ${module.linkedSummaryId}:\n$e\n$s');
- } on MissingModulesException catch (e) {
- log.severe('$e');
- }
- }
-}
-
-/// Creates an unlinked summary for [module].
-Future _createUnlinkedSummary(Module module, BuildStep buildStep,
- {bool isRoot = false}) async {
- var scratchSpace = await buildStep.fetchResource(scratchSpaceResource);
- await scratchSpace.ensureAssets(module.sources, buildStep);
-
- var summaryOutputFile = scratchSpace.fileFor(module.unlinkedSummaryId);
- var request = WorkRequest();
- request.arguments.addAll([
- '--build-summary-only',
- '--build-summary-only-unlinked',
- '--build-summary-output-semantic=${summaryOutputFile.path}',
- '--strong',
- ]);
-
- // Add the default analysis_options.
- await scratchSpace.ensureAssets([defaultAnalysisOptionsId], buildStep);
- request.arguments.add(defaultAnalysisOptionsArg(scratchSpace));
-
- // Add all the files to include in the unlinked summary bundle.
- request.arguments.addAll(_analyzerSourceArgsForModule(module, scratchSpace));
-
- var analyzer = await buildStep.fetchResource(analyzerDriverResource);
- var response = await analyzer.doWork(request,
- trackWork: (response) =>
- buildStep.trackStage('Summarize', () => response, isExternal: true));
- if (response.exitCode == EXIT_CODE_ERROR) {
- throw AnalyzerSummaryException(module.unlinkedSummaryId, response.output);
- }
-
- // Copy the output back using the buildStep.
- await scratchSpace.copyOutput(module.unlinkedSummaryId, buildStep);
-}
-
-/// Creates a linked summary for [module].
-Future _createLinkedSummary(Module module, BuildStep buildStep,
- {bool isRoot = false}) async {
- var transitiveDeps = await module.computeTransitiveDependencies(buildStep);
- var transitiveUnlinkedSummaryDeps = <AssetId>[];
- var transitiveLinkedSummaryDeps = <AssetId>[];
-
- // Provide linked summaries where possible (if created in a previous phase),
- // otherwise provide unlinked summaries.
- await Future.wait(transitiveDeps.map((module) async {
- if (await buildStep.canRead(module.linkedSummaryId)) {
- transitiveLinkedSummaryDeps.add(module.linkedSummaryId);
- } else {
- transitiveUnlinkedSummaryDeps.add(module.unlinkedSummaryId);
- }
- }));
-
- var scratchSpace = await buildStep.fetchResource(scratchSpaceResource);
-
- var allAssetIds = Set<AssetId>()
- // TODO: Why can't we just add the unlinked summary?
- // That would help invalidation.
- ..addAll(module.sources)
- ..addAll(transitiveLinkedSummaryDeps)
- ..addAll(transitiveUnlinkedSummaryDeps);
- await scratchSpace.ensureAssets(allAssetIds, buildStep);
- var summaryOutputFile = scratchSpace.fileFor(module.linkedSummaryId);
- var request = WorkRequest();
- request.arguments.addAll([
- '--build-summary-only',
- '--build-summary-output-semantic=${summaryOutputFile.path}',
- '--strong',
- ]);
-
- // Add the default analysis_options.
- await scratchSpace.ensureAssets([defaultAnalysisOptionsId], buildStep);
- request.arguments.add(defaultAnalysisOptionsArg(scratchSpace));
-
- // Add all the unlinked and linked summaries as build summary inputs.
- request.arguments.addAll(transitiveUnlinkedSummaryDeps.map((id) =>
- '--build-summary-unlinked-input=${scratchSpace.fileFor(id).path}'));
- request.arguments.addAll(transitiveLinkedSummaryDeps
- .map((id) => '--build-summary-input=${scratchSpace.fileFor(id).path}'));
-
- // Add all the files to include in the linked summary bundle.
- request.arguments.addAll(_analyzerSourceArgsForModule(module, scratchSpace));
-
- // Add the [Input]s with `Digest`s.
- await Future.wait(allAssetIds.map((input) {
- return buildStep.digest(input).then((digest) {
- request.inputs.add(Input()
- ..digest = digest.bytes
- ..path = scratchSpace.fileFor(input).path);
- });
- }));
-
- var analyzer = await buildStep.fetchResource(analyzerDriverResource);
- var response = await analyzer.doWork(request);
- var summaryFile = scratchSpace.fileFor(module.linkedSummaryId);
- if (response.exitCode == EXIT_CODE_ERROR || !await summaryFile.exists()) {
- throw AnalyzerSummaryException(module.linkedSummaryId, response.output);
- }
-
- // Copy the output back using the buildStep.
- await scratchSpace.copyOutput(module.linkedSummaryId, buildStep);
-}
-
-Iterable<String> _analyzerSourceArgsForModule(
- Module module, ScratchSpace scratchSpace) {
- return module.sources.map((id) {
- var uri = canonicalUriFor(id);
- var file = scratchSpace.fileFor(id);
- if (!uri.startsWith('package:')) {
- uri = Uri.file('/${id.path}').toString();
- }
- return '$uri|${file.path}';
- });
-}
diff --git a/build_modules/lib/src/workers.dart b/build_modules/lib/src/workers.dart
index bda1199..9438484 100644
--- a/build_modules/lib/src/workers.dart
+++ b/build_modules/lib/src/workers.dart
@@ -22,30 +22,20 @@
? ProcessStartMode.normal
: ProcessStartMode.detachedWithStdio;
-/// Completes once the analyzer workers have been shut down.
-Future<Null> get analyzerWorkersAreDone =>
- _analyzerWorkersAreDoneCompleter?.future ?? Future.value(null);
-Completer<Null> _analyzerWorkersAreDoneCompleter;
-
-/// Completes once the dartdevc workers have been shut down.
-Future<Null> get dartdevcWorkersAreDone =>
- _dartdevcWorkersAreDoneCompleter?.future ?? Future.value(null);
-Completer<Null> _dartdevcWorkersAreDoneCompleter;
-
/// Completes once the dartdevk workers have been shut down.
-Future<Null> get dartdevkWorkersAreDone =>
- _dartdevkWorkersAreDoneCompleter?.future ?? Future.value(null);
-Completer<Null> _dartdevkWorkersAreDoneCompleter;
+Future<void> get dartdevkWorkersAreDone =>
+ _dartdevkWorkersAreDoneCompleter?.future ?? Future.value();
+Completer<void> _dartdevkWorkersAreDoneCompleter;
/// Completes once the dart2js workers have been shut down.
-Future<Null> get dart2jsWorkersAreDone =>
- _dart2jsWorkersAreDoneCompleter?.future ?? Future.value(null);
-Completer<Null> _dart2jsWorkersAreDoneCompleter;
+Future<void> get dart2jsWorkersAreDone =>
+ _dart2jsWorkersAreDoneCompleter?.future ?? Future.value();
+Completer<void> _dart2jsWorkersAreDoneCompleter;
/// Completes once the common frontend workers have been shut down.
-Future<Null> get frontendWorkersAreDone =>
- _frontendWorkersAreDoneCompleter?.future ?? Future.value(null);
-Completer<Null> _frontendWorkersAreDoneCompleter;
+Future<void> get frontendWorkersAreDone =>
+ _frontendWorkersAreDoneCompleter?.future ?? Future.value();
+Completer<void> _frontendWorkersAreDoneCompleter;
final int _defaultMaxWorkers = min((Platform.numberOfProcessors / 2).ceil(), 4);
@@ -64,64 +54,9 @@
return parsed;
}();
-/// Manages a shared set of persistent analyzer workers.
-BazelWorkerDriver get _analyzerDriver {
- _analyzerWorkersAreDoneCompleter ??= Completer<Null>();
- return __analyzerDriver ??= BazelWorkerDriver(
- () => Process.start(
- p.join(sdkDir, 'bin', 'dart'),
- [
- p.join(sdkDir, 'bin', 'snapshots', 'dartanalyzer.dart.snapshot'),
- '--dart-sdk=$sdkDir',
- '--build-mode',
- '--persistent_worker'
- ],
- mode: _processMode,
- workingDirectory: scratchSpace.tempDir.path),
- maxWorkers: _maxWorkersPerTask);
-}
-
-BazelWorkerDriver __analyzerDriver;
-
-/// Resource for fetching the current [BazelWorkerDriver] for dartanalyzer.
-final analyzerDriverResource =
- Resource<BazelWorkerDriver>(() => _analyzerDriver, beforeExit: () async {
- await _analyzerDriver?.terminateWorkers();
- _analyzerWorkersAreDoneCompleter.complete();
- _analyzerWorkersAreDoneCompleter = null;
- __analyzerDriver = null;
-});
-
-/// Manages a shared set of persistent dartdevc workers.
-BazelWorkerDriver get _dartdevcDriver {
- _dartdevcWorkersAreDoneCompleter ??= Completer<Null>();
- return __dartdevcDriver ??= BazelWorkerDriver(
- () => Process.start(
- p.join(sdkDir, 'bin', 'dart'),
- [
- p.join(sdkDir, 'bin', 'snapshots', 'dartdevc.dart.snapshot'),
- '--dart-sdk=$sdkDir',
- '--persistent_worker'
- ],
- mode: _processMode,
- workingDirectory: scratchSpace.tempDir.path),
- maxWorkers: _maxWorkersPerTask);
-}
-
-BazelWorkerDriver __dartdevcDriver;
-
-/// Resource for fetching the current [BazelWorkerDriver] for dartdevc.
-final dartdevcDriverResource =
- Resource<BazelWorkerDriver>(() => _dartdevcDriver, beforeExit: () async {
- await _dartdevcDriver?.terminateWorkers();
- _dartdevcWorkersAreDoneCompleter.complete();
- _dartdevcWorkersAreDoneCompleter = null;
- __dartdevcDriver = null;
-});
-
/// Manages a shared set of persistent dartdevk workers.
BazelWorkerDriver get _dartdevkDriver {
- _dartdevkWorkersAreDoneCompleter ??= Completer<Null>();
+ _dartdevkWorkersAreDoneCompleter ??= Completer<void>();
return __dartdevkDriver ??= BazelWorkerDriver(
() => Process.start(
p.join(sdkDir, 'bin', 'dart'),
@@ -148,7 +83,7 @@
/// Manages a shared set of persistent common frontend workers.
BazelWorkerDriver get _frontendDriver {
- _frontendWorkersAreDoneCompleter ??= Completer<Null>();
+ _frontendWorkersAreDoneCompleter ??= Completer<void>();
return __frontendDriver ??= BazelWorkerDriver(
() => Process.start(
p.join(sdkDir, 'bin', 'dart'),
@@ -174,7 +109,7 @@
/// Manages a shared set of persistent dart2js workers.
Dart2JsBatchWorkerPool get _dart2jsWorkerPool {
- _dart2jsWorkersAreDoneCompleter ??= Completer<Null>();
+ _dart2jsWorkersAreDoneCompleter ??= Completer<void>();
var librariesSpec = p.joinAll([sdkDir, 'lib', 'libraries.json']);
return __dart2jsWorkerPool ??= Dart2JsBatchWorkerPool(() => Process.start(
p.join(sdkDir, 'bin', 'dart'),
@@ -250,7 +185,7 @@
}();
}
- Future<Null> terminateWorkers() async {
+ Future<void> terminateWorkers() async {
var allWorkers = _allWorkers.toList();
_allWorkers.clear();
_availableWorkers.clear();
diff --git a/build_modules/mono_pkg.yaml b/build_modules/mono_pkg.yaml
index 76acc9e..86a9810 100644
--- a/build_modules/mono_pkg.yaml
+++ b/build_modules/mono_pkg.yaml
@@ -6,6 +6,9 @@
- group:
- dartfmt: sdk
- dartanalyzer: --fatal-infos --fatal-warnings .
+ - dartanalyzer: --fatal-warnings .
+ dart:
+ - 2.3.0-dev.0.1
- unit_test:
# Run the script directly - running from snapshot has issues for packages
# that are depended on by build_runner itself.
diff --git a/build_modules/pubspec.yaml b/build_modules/pubspec.yaml
index 5289402..30732e8 100644
--- a/build_modules/pubspec.yaml
+++ b/build_modules/pubspec.yaml
@@ -1,21 +1,23 @@
name: build_modules
-version: 1.0.9
+version: 2.1.2
description: Builders for Dart modules
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_modules
environment:
- sdk: ">=2.1.1-dev <3.0.0"
+ sdk: ">=2.3.0-dev.0.1 <3.0.0"
dependencies:
- analyzer: '>0.30.0 <0.36.0'
- async: '>=1.13.3 <3.0.0'
+ analyzer: ">0.30.0 <0.37.0"
+ async: ^2.0.0
bazel_worker: ^0.1.20
- build: '>=0.12.3 <2.0.0'
- build_config: '>=0.2.1 <0.4.0'
+ build: ">=0.12.3 <2.0.0"
+ build_config: ">=0.3.0 <0.5.0"
+ collection: ^1.0.0
+ crypto: ^2.0.0
glob: ^1.0.0
graphs: ^0.2.0
- json_annotation: '>=1.2.0 <3.0.0'
+ json_annotation: ">=1.2.0 <3.0.0"
logging: ^0.11.2
meta: ^1.1.0
path: ^1.4.2
@@ -25,10 +27,9 @@
dev_dependencies:
build_runner: ^1.0.0
build_test: ^0.10.0
- build_vm_compilers: ^0.1.0
+ build_vm_compilers: ^1.0.0
json_serializable: ^2.0.0
- source_gen: ^0.9.0
- test: ^1.3.3
+ test: ^1.6.0
a:
path: test/fixtures/a
b:
diff --git a/build_runner/BUILD.gn b/build_runner/BUILD.gn
index 57add8a..90ec95a 100644
--- a/build_runner/BUILD.gn
+++ b/build_runner/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_runner-1.3.3
+# This file is generated by importer.py for build_runner-1.4.0
import("//build/dart/dart_library.gni")
diff --git a/build_runner/CHANGELOG.md b/build_runner/CHANGELOG.md
index 266d269..2f04094 100644
--- a/build_runner/CHANGELOG.md
+++ b/build_runner/CHANGELOG.md
@@ -1,3 +1,15 @@
+## 1.4.0
+
+- Add a `run` command to execute VM entrypoints with generated sources.
+
+## 1.3.5
+
+- Use the latest `build_daemon`.
+
+## 1.3.4
+
+- Use the latest `build_config`.
+
## 1.3.3
- Use `HttpMultiServer.loopback` for the daemon asset server.
diff --git a/build_runner/README.md b/build_runner/README.md
index 7910a5a..0e17336 100644
--- a/build_runner/README.md
+++ b/build_runner/README.md
@@ -1,5 +1,3 @@
-# build_runner
-
<p align="center">
Standalone generator and watcher for Dart using <a href="https://pub.dartlang.org/packages/build"><code>package:build</code></a>.
<br>
diff --git a/build_runner/bin/build_runner.dart b/build_runner/bin/build_runner.dart
index eb1e0af..7c35683 100644
--- a/build_runner/bin/build_runner.dart
+++ b/build_runner/bin/build_runner.dart
@@ -10,19 +10,22 @@
import 'package:io/ansi.dart';
import 'package:io/io.dart';
import 'package:logging/logging.dart';
-import 'package:path/path.dart' as p;
-import 'package:build_runner/src/build_script_generate/build_script_generate.dart';
import 'package:build_runner/src/build_script_generate/bootstrap.dart';
import 'package:build_runner/src/entrypoint/runner.dart';
import 'package:build_runner/src/logging/std_io_logging.dart';
-Future<Null> main(List<String> args) async {
+import 'src/commands/clean.dart';
+import 'src/commands/generate_build_script.dart';
+
+Future<void> main(List<String> args) async {
// Use the actual command runner to parse the args and immediately print the
// usage information if there is no command provided or the help command was
// explicitly invoked.
- var commandRunner = BuildCommandRunner([])
- ..addCommand(_GenerateBuildScript());
+ var commandRunner = BuildCommandRunner([]);
+ var localCommands = [CleanCommand(), GenerateBuildScript()];
+ var localCommandNames = localCommands.map((c) => c.name).toSet();
+ localCommands.forEach(commandRunner.addCommand);
ArgResults parsedArgs;
try {
@@ -51,37 +54,11 @@
return;
}
- StreamSubscription logListener;
- if (commandName == _generateCommand) {
+ final logListener = Logger.root.onRecord.listen(stdIOLogListener());
+ if (localCommandNames.contains(commandName)) {
exitCode = await commandRunner.runCommand(parsedArgs);
- return;
+ } else {
+ while ((exitCode = await generateAndRun(args)) == ExitCode.tempFail.code) {}
}
- logListener = Logger.root.onRecord.listen(stdIOLogListener());
-
- while ((exitCode = await generateAndRun(args)) == ExitCode.tempFail.code) {}
await logListener?.cancel();
}
-
-const _generateCommand = 'generate-build-script';
-
-class _GenerateBuildScript extends Command<int> {
- @override
- final description = 'Generate a script to run builds and print the file path '
- 'with no other logging. Useful for wrapping builds with other tools.';
-
- @override
- final name = _generateCommand;
-
- @override
- bool get hidden => true;
-
- @override
- Future<int> run() async {
- var buildScript = await generateBuildScript();
- File(scriptLocation)
- ..createSync(recursive: true)
- ..writeAsStringSync(buildScript);
- print(p.absolute(scriptLocation));
- return 0;
- }
-}
diff --git a/build_runner/bin/graph_inspector.dart b/build_runner/bin/graph_inspector.dart
index b32ad5a..267109c 100644
--- a/build_runner/bin/graph_inspector.dart
+++ b/build_runner/bin/graph_inspector.dart
@@ -5,9 +5,11 @@
import 'dart:async';
import 'dart:io';
+import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:build/build.dart';
import 'package:glob/glob.dart';
+import 'package:logging/logging.dart';
import 'package:path/path.dart' as p;
import 'package:build_runner_core/build_runner_core.dart';
@@ -17,57 +19,76 @@
AssetGraph assetGraph;
PackageGraph packageGraph;
-Future main(List<String> args) async {
- stdout.writeln(
+final logger = Logger('graph_inspector');
+
+Future<void> main(List<String> args) async {
+ final logSubscription =
+ Logger.root.onRecord.listen((record) => print(record.message));
+ logger.warning(
'Warning: this tool is unsupported and usage may change at any time, '
'use at your own risk.');
- if (args.length != 1) {
+ final argParser = ArgParser()
+ ..addOption('graph-file',
+ abbr: 'g', help: 'Specify the asset_graph.json file to inspect.')
+ ..addOption('build-script',
+ abbr: 'b',
+ help: 'Specify the build script to find the asset graph for.',
+ defaultsTo: '.dart_tool/build/entrypoint/build.dart');
+
+ final results = argParser.parse(args);
+
+ if (results.wasParsed('graph-file') && results.wasParsed('build-script')) {
throw ArgumentError(
- 'Expected exactly one argument, the path to a build script to '
- 'analyze.');
- }
- var scriptPath = args.first;
- var scriptFile = File(scriptPath);
- if (!scriptFile.existsSync()) {
- throw ArgumentError(
- 'Expected a build script at $scriptPath but didn\'t find one.');
+ 'Expected exactly one of `--graph-file` or `--build-script`.');
}
- var assetGraphFile =
- File(assetGraphPathFor(p.url.joinAll(p.split(scriptPath))));
+ var assetGraphFile = File(_findAssetGraph(results));
if (!assetGraphFile.existsSync()) {
- throw ArgumentError(
- 'Unable to find AssetGraph for $scriptPath at ${assetGraphFile.path}');
+ throw ArgumentError('Unable to find AssetGraph.');
}
stdout.writeln('Loading asset graph at ${assetGraphFile.path}...');
assetGraph = AssetGraph.deserialize(assetGraphFile.readAsBytesSync());
packageGraph = PackageGraph.forThisPackage();
- var commandRunner =
- CommandRunner('', 'A tool for inspecting the AssetGraph for your build')
- ..addCommand(InspectNodeCommand())
- ..addCommand(GraphCommand());
+ var commandRunner = CommandRunner<bool>(
+ '', 'A tool for inspecting the AssetGraph for your build')
+ ..addCommand(InspectNodeCommand())
+ ..addCommand(GraphCommand())
+ ..addCommand(QuitCommand());
stdout.writeln('Ready, please type in a command:');
- while (true) {
+ var shouldExit = false;
+ while (!shouldExit) {
stdout
..writeln('')
..write('> ');
var nextCommand = stdin.readLineSync();
stdout.writeln('');
try {
- await commandRunner.run(nextCommand.split(' '));
+ shouldExit = await commandRunner.run(nextCommand.split(' '));
} on UsageException {
stdout.writeln('Unrecognized option');
await commandRunner.run(['help']);
}
}
+ await logSubscription.cancel();
}
-class InspectNodeCommand extends Command {
+String _findAssetGraph(ArgResults results) {
+ if (results.wasParsed('graph-file')) return results['graph-file'] as String;
+ final scriptPath = results['build-script'] as String;
+ final scriptFile = File(scriptPath);
+ if (!scriptFile.existsSync()) {
+ throw ArgumentError(
+ 'Expected a build script at $scriptPath but didn\'t find one.');
+ }
+ return assetGraphPathFor(p.url.joinAll(p.split(scriptPath)));
+}
+
+class InspectNodeCommand extends Command<bool> {
@override
String get name => 'inspect';
@@ -83,7 +104,7 @@
}
@override
- run() {
+ bool run() {
var stringUris = argResults.rest;
if (stringUris.isEmpty) {
stderr.writeln('Expected at least one uri for a node to inspect.');
@@ -121,7 +142,7 @@
description.writeln(' secondary outputs:');
node.outputs.difference(node.primaryOutputs).forEach(_printAsset);
- if (node is GeneratedAssetNode) {
+ if (node is NodeWithInputs) {
description.writeln(' inputs:');
assetGraph.allNodes
.where((n) => n.outputs.contains(node.id))
@@ -132,11 +153,11 @@
stdout.write(description);
}
- return null;
+ return false;
}
}
-class GraphCommand extends Command {
+class GraphCommand extends Command<bool> {
@override
String get name => 'graph';
@@ -160,7 +181,7 @@
}
@override
- run() {
+ bool run() {
var showGenerated = argResults['generated'] as bool;
var showSources = argResults['original'] as bool;
Iterable<AssetId> assets;
@@ -186,10 +207,21 @@
for (var id in assets) {
_listAsset(id, stdout, indentation: ' ');
}
- return null;
+ return false;
}
}
+class QuitCommand extends Command<bool> {
+ @override
+ String get name => 'quit';
+
+ @override
+ String get description => 'Exit the inspector';
+
+ @override
+ bool run() => true;
+}
+
AssetId _idFromString(String stringUri) {
var uri = Uri.parse(stringUri);
if (uri.scheme == 'package') {
diff --git a/build_runner/bin/src/commands/clean.dart b/build_runner/bin/src/commands/clean.dart
new file mode 100644
index 0000000..70b0113
--- /dev/null
+++ b/build_runner/bin/src/commands/clean.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:args/args.dart';
+import 'package:args/command_runner.dart';
+import 'package:build_runner_core/build_runner_core.dart';
+import 'package:logging/logging.dart';
+
+import 'package:build_runner/src/build_script_generate/build_script_generate.dart';
+import 'package:build_runner/src/entrypoint/base_command.dart' show lineLength;
+import 'package:build_runner/src/entrypoint/clean.dart' show cleanFor;
+
+class CleanCommand extends Command<int> {
+ @override
+ final argParser = ArgParser(usageLineLength: lineLength);
+
+ @override
+ String get name => 'clean';
+ final logger = Logger('clean');
+
+ @override
+ String get description =>
+ 'Cleans up output from previous builds. Does not clean up --output '
+ 'directories.';
+
+ @override
+ Future<int> run() async {
+ await cleanFor(assetGraphPathFor(scriptLocation), logger);
+ return 0;
+ }
+}
diff --git a/build_runner/bin/src/commands/generate_build_script.dart b/build_runner/bin/src/commands/generate_build_script.dart
new file mode 100644
index 0000000..002abc8
--- /dev/null
+++ b/build_runner/bin/src/commands/generate_build_script.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:args/args.dart';
+import 'package:args/command_runner.dart';
+import 'package:logging/logging.dart';
+import 'package:path/path.dart' as p;
+
+import 'package:build_runner/src/build_script_generate/build_script_generate.dart';
+import 'package:build_runner/src/entrypoint/base_command.dart' show lineLength;
+
+class GenerateBuildScript extends Command<int> {
+ @override
+ final argParser = ArgParser(usageLineLength: lineLength);
+
+ @override
+ String get description =>
+ 'Generate a script to run builds and print the file path '
+ 'with no other logging. Useful for wrapping builds with other tools.';
+
+ @override
+ String get name => 'generate-build-script';
+
+ @override
+ bool get hidden => true;
+
+ @override
+ Future<int> run() async {
+ Logger.root.clearListeners();
+ var buildScript = await generateBuildScript();
+ File(scriptLocation)
+ ..createSync(recursive: true)
+ ..writeAsStringSync(buildScript);
+ print(p.absolute(scriptLocation));
+ return 0;
+ }
+}
diff --git a/build_runner/build.yaml b/build_runner/build.yaml
new file mode 100644
index 0000000..d1e3e0f
--- /dev/null
+++ b/build_runner/build.yaml
@@ -0,0 +1,25 @@
+targets:
+ $default:
+ builders:
+ build_web_compilers:entrypoint:
+ options:
+ compiler: dart2js
+ dart2js_args:
+ - -O4
+ generate_for:
+ - web/graph_viz_main.dart
+ - web/hot_reload_client.dart
+ build_runner:client_js_copy_builder:
+ enabled: true
+builders:
+ client_js_copy_builder:
+ import: "tool/builders.dart"
+ builder_factories:
+ - copyCompiledJs
+ build_extensions:
+ web/graph_viz_main.dart.js:
+ - lib/src/server/graph_viz_main.dart.js
+ web/hot_reload_client.dart.js:
+ - lib/src/server/build_updates_client/hot_reload_client.dart.js
+ auto_apply: none
+ build_to: source
diff --git a/build_runner/lib/src/build_script_generate/build_script_generate.dart b/build_runner/lib/src/build_script_generate/build_script_generate.dart
index 0157cad..ffc4861 100644
--- a/build_runner/lib/src/build_script_generate/build_script_generate.dart
+++ b/build_runner/lib/src/build_script_generate/build_script_generate.dart
@@ -151,15 +151,15 @@
refer('InputSet', 'package:build_config/build_config.dart')
.constInstance([], inputSetArgs);
}
- if (!identical(definition.defaults?.options, BuilderOptions.empty)) {
+ if (definition.defaults?.options?.isNotEmpty ?? false) {
namedArgs['defaultOptions'] =
_constructBuilderOptions(definition.defaults.options);
}
- if (!identical(definition.defaults?.devOptions, BuilderOptions.empty)) {
+ if (definition.defaults?.devOptions?.isNotEmpty ?? false) {
namedArgs['defaultDevOptions'] =
_constructBuilderOptions(definition.defaults.devOptions);
}
- if (!identical(definition.defaults?.releaseOptions, BuilderOptions.empty)) {
+ if (definition.defaults?.releaseOptions?.isNotEmpty ?? false) {
namedArgs['defaultReleaseOptions'] =
_constructBuilderOptions(definition.defaults.releaseOptions);
}
@@ -190,15 +190,15 @@
inputSetArgs['exclude'] =
literalConstList(definition.defaults.generateFor.exclude);
}
- if (!identical(definition.defaults?.options, BuilderOptions.empty)) {
+ if (definition.defaults?.options?.isNotEmpty ?? false) {
namedArgs['defaultOptions'] =
_constructBuilderOptions(definition.defaults.options);
}
- if (!identical(definition.defaults?.devOptions, BuilderOptions.empty)) {
+ if (definition.defaults?.devOptions?.isNotEmpty ?? false) {
namedArgs['defaultDevOptions'] =
_constructBuilderOptions(definition.defaults.devOptions);
}
- if (!identical(definition.defaults?.releaseOptions, BuilderOptions.empty)) {
+ if (definition.defaults?.releaseOptions?.isNotEmpty ?? false) {
namedArgs['defaultReleaseOptions'] =
_constructBuilderOptions(definition.defaults.releaseOptions);
}
@@ -252,6 +252,6 @@
}
/// An expression creating a [BuilderOptions] from a json string.
-Expression _constructBuilderOptions(BuilderOptions options) =>
+Expression _constructBuilderOptions(Map<String, dynamic> options) =>
refer('BuilderOptions', 'package:build/build.dart')
- .newInstance([literalMap(options.config)]);
+ .newInstance([literalMap(options)]);
diff --git a/build_runner/lib/src/entrypoint/base_command.dart b/build_runner/lib/src/entrypoint/base_command.dart
index b48afaa..1fae9d4 100644
--- a/build_runner/lib/src/entrypoint/base_command.dart
+++ b/build_runner/lib/src/entrypoint/base_command.dart
@@ -2,13 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:io';
+
+import 'package:args/args.dart';
import 'package:args/command_runner.dart';
-import 'package:logging/logging.dart';
import 'package:build_runner_core/build_runner_core.dart';
+import 'package:logging/logging.dart';
import 'options.dart';
import 'runner.dart';
+final lineLength = stdout.hasTerminal ? stdout.terminalColumns : 80;
+
abstract class BuildRunnerCommand extends Command<int> {
Logger get logger => Logger(name);
@@ -21,6 +26,9 @@
_addBaseFlags(symlinksDefault ?? false);
}
+ @override
+ final argParser = ArgParser(usageLineLength: lineLength);
+
void _addBaseFlags(bool symlinksDefault) {
argParser
..addFlag(deleteFilesByDefaultOption,
diff --git a/build_runner/lib/src/entrypoint/clean.dart b/build_runner/lib/src/entrypoint/clean.dart
index f9c3f8c..9aa4fba 100644
--- a/build_runner/lib/src/entrypoint/clean.dart
+++ b/build_runner/lib/src/entrypoint/clean.dart
@@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:io';
+import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:build_runner_core/build_runner_core.dart';
import 'package:build_runner_core/src/asset_graph/graph.dart';
@@ -12,9 +13,13 @@
import 'package:logging/logging.dart';
import '../logging/std_io_logging.dart';
+import 'base_command.dart';
class CleanCommand extends Command<int> {
@override
+ final argParser = ArgParser(usageLineLength: lineLength);
+
+ @override
String get name => 'clean';
@override
@@ -27,43 +32,44 @@
@override
Future<int> run() async {
var logSubscription = Logger.root.onRecord.listen(stdIOLogListener());
-
- logger.warning('Deleting cache and generated source files.\n'
- 'This shouldn\'t be necessary for most applications, unless you have '
- 'made intentional edits to generated files (i.e. for testing). '
- 'Consider filing a bug at '
- 'https://github.com/dart-lang/build/issues/new if you are using this '
- 'to work around an apparent (and reproducible) bug.');
-
- await logTimedAsync(logger, 'Cleaning up source outputs', () async {
- var assetGraphFile = File(assetGraphPath);
- if (!assetGraphFile.existsSync()) {
- logger.warning('No asset graph found. '
- 'Skipping cleanup of generated files in source directories.');
- return;
- }
- AssetGraph assetGraph;
- try {
- assetGraph = AssetGraph.deserialize(await assetGraphFile.readAsBytes());
- } catch (_) {
- logger.warning('Failed to deserialize AssetGraph. '
- 'Skipping cleanup of generated files in source directories.');
- return;
- }
- var packageGraph = PackageGraph.forThisPackage();
- await cleanUpSourceOutputs(assetGraph, packageGraph);
- });
-
- await logTimedAsync(
- logger, 'Cleaning up cache directory', cleanUpGeneratedDirectory);
-
+ await cleanFor(assetGraphPath, logger);
await logSubscription.cancel();
-
return 0;
}
}
-Future<void> cleanUpSourceOutputs(
+Future<void> cleanFor(String assetGraphPath, Logger logger) async {
+ logger.warning('Deleting cache and generated source files.\n'
+ 'This shouldn\'t be necessary for most applications, unless you have '
+ 'made intentional edits to generated files (i.e. for testing). '
+ 'Consider filing a bug at '
+ 'https://github.com/dart-lang/build/issues/new if you are using this '
+ 'to work around an apparent (and reproducible) bug.');
+
+ await logTimedAsync(logger, 'Cleaning up source outputs', () async {
+ var assetGraphFile = File(assetGraphPath);
+ if (!assetGraphFile.existsSync()) {
+ logger.warning('No asset graph found. '
+ 'Skipping cleanup of generated files in source directories.');
+ return;
+ }
+ AssetGraph assetGraph;
+ try {
+ assetGraph = AssetGraph.deserialize(await assetGraphFile.readAsBytes());
+ } catch (_) {
+ logger.warning('Failed to deserialize AssetGraph. '
+ 'Skipping cleanup of generated files in source directories.');
+ return;
+ }
+ var packageGraph = PackageGraph.forThisPackage();
+ await _cleanUpSourceOutputs(assetGraph, packageGraph);
+ });
+
+ await logTimedAsync(
+ logger, 'Cleaning up cache directory', _cleanUpGeneratedDirectory);
+}
+
+Future<void> _cleanUpSourceOutputs(
AssetGraph assetGraph, PackageGraph packageGraph) async {
var writer = FileBasedAssetWriter(packageGraph);
for (var id in assetGraph.outputs) {
@@ -79,7 +85,7 @@
}
}
-Future<void> cleanUpGeneratedDirectory() async {
+Future<void> _cleanUpGeneratedDirectory() async {
var generatedDir = Directory(cacheDir);
if (await generatedDir.exists()) {
await generatedDir.delete(recursive: true);
diff --git a/build_runner/lib/src/entrypoint/daemon.dart b/build_runner/lib/src/entrypoint/daemon.dart
index 41f954c..c918ca4 100644
--- a/build_runner/lib/src/entrypoint/daemon.dart
+++ b/build_runner/lib/src/entrypoint/daemon.dart
@@ -32,8 +32,8 @@
var daemon = Daemon(workingDirectory);
var requestedOptions = argResults.arguments.toSet();
if (!daemon.tryGetLock()) {
- var runningOptions = currentOptions(workingDirectory);
- var version = runningVersion(workingDirectory);
+ var runningOptions = await currentOptions(workingDirectory);
+ var version = await runningVersion(workingDirectory);
if (version != currentVersion) {
stdout
..writeln('Running Version: $version')
diff --git a/build_runner/lib/src/entrypoint/run.dart b/build_runner/lib/src/entrypoint/run.dart
index 3d76725..ceba164 100644
--- a/build_runner/lib/src/entrypoint/run.dart
+++ b/build_runner/lib/src/entrypoint/run.dart
@@ -10,6 +10,7 @@
import 'package:io/ansi.dart' as ansi;
import 'package:io/io.dart' show ExitCode;
+import 'clean.dart';
import 'runner.dart';
/// A common entry point to parse command line arguments and build or serve with
@@ -18,7 +19,7 @@
/// Returns the exit code that should be set when the calling process exits. `0`
/// implies success.
Future<int> run(List<String> args, List<BuilderApplication> builders) async {
- var runner = BuildCommandRunner(builders);
+ var runner = BuildCommandRunner(builders)..addCommand(CleanCommand());
try {
var result = await runner.run(args);
return result ?? 0;
diff --git a/build_runner/lib/src/entrypoint/run_script.dart b/build_runner/lib/src/entrypoint/run_script.dart
new file mode 100644
index 0000000..3c0412a
--- /dev/null
+++ b/build_runner/lib/src/entrypoint/run_script.dart
@@ -0,0 +1,186 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+
+import 'package:args/command_runner.dart';
+import 'package:build_runner/src/logging/std_io_logging.dart';
+import 'package:build_runner_core/build_runner_core.dart';
+import 'package:io/io.dart';
+import 'package:logging/logging.dart';
+import 'package:path/path.dart' as p;
+
+import '../generate/build.dart';
+import 'base_command.dart';
+import 'options.dart';
+
+class RunCommand extends BuildRunnerCommand {
+ @override
+ String get name => 'run';
+
+ @override
+ String get description => 'Performs a single build, and executes '
+ 'a Dart script with the given arguments.';
+
+ @override
+ String get invocation =>
+ '${super.invocation.replaceFirst('[arguments]', '[build-arguments]')} '
+ '<executable> [-- [script-arguments]]';
+
+ @override
+ SharedOptions readOptions() {
+ // Here we validate that [argResults.rest] is exactly equal to all the
+ // arguments after the `--`.
+
+ var separatorPos = argResults.arguments.indexOf('--');
+
+ if (separatorPos >= 0) {
+ void throwUsageException() {
+ throw UsageException(
+ 'The `run` command does not support positional args before the '
+ '`--` separator which should separate build args from script args.',
+ usage);
+ }
+
+ var expectedRest = argResults.arguments.skip(separatorPos + 1).toList();
+
+ // Since we expect the first argument to be the name of a script,
+ // we should skip it when comparing extra arguments.
+ var effectiveRest = argResults.rest.skip(1).toList();
+
+ if (effectiveRest.length != expectedRest.length) {
+ throwUsageException();
+ }
+
+ for (var i = 0; i < effectiveRest.length; i++) {
+ if (expectedRest[i] != effectiveRest[i]) {
+ throwUsageException();
+ }
+ }
+ }
+
+ return SharedOptions.fromParsedArgs(
+ argResults, [], packageGraph.root.name, this);
+ }
+
+ @override
+ FutureOr<int> run() async {
+ var options = readOptions();
+ var logSubscription =
+ Logger.root.onRecord.listen(stdIOLogListener(verbose: options.verbose));
+
+ try {
+ // Ensure that the user passed the name of a file to run.
+ if (argResults.rest.isEmpty) {
+ logger..severe('Must specify an executable to run.')..severe(usage);
+ return ExitCode.usage.code;
+ }
+
+ var scriptName = argResults.rest[0];
+ var passedArgs = argResults.rest.skip(1).toList();
+
+ // Ensure the extension is .dart.
+ if (p.extension(scriptName) != '.dart') {
+ logger.severe('$scriptName is not a valid Dart file '
+ 'and cannot be run in the VM.');
+ return ExitCode.usage.code;
+ }
+
+ // Create a temporary directory in which to execute the script.
+ var tempPath = Directory.systemTemp
+ .createTempSync('build_runner_run_script')
+ .absolute
+ .uri
+ .toFilePath();
+
+ // Create two ReceivePorts, so that we can quit when the isolate is done.
+ //
+ // Define these before starting the isolate, so that we can close
+ // them if there is a spawn exception.
+ ReceivePort onExit, onError;
+
+ // Use a completer to determine the exit code.
+ var exitCodeCompleter = Completer<int>();
+
+ try {
+ var buildDirs = (options.buildDirs ?? Set<BuildDirectory>())
+ ..add(BuildDirectory('',
+ outputLocation: OutputLocation(tempPath,
+ useSymlinks: options.outputSymlinksOnly, hoist: false)));
+ var result = await build(
+ builderApplications,
+ deleteFilesByDefault: options.deleteFilesByDefault,
+ enableLowResourcesMode: options.enableLowResourcesMode,
+ configKey: options.configKey,
+ buildDirs: buildDirs,
+ packageGraph: packageGraph,
+ verbose: options.verbose,
+ builderConfigOverrides: options.builderConfigOverrides,
+ isReleaseBuild: options.isReleaseBuild,
+ trackPerformance: options.trackPerformance,
+ skipBuildScriptCheck: options.skipBuildScriptCheck,
+ logPerformanceDir: options.logPerformanceDir,
+ );
+
+ if (result.status == BuildStatus.failure) {
+ logger.warning('Skipping script run due to build failure');
+ return result.failureType.exitCode;
+ }
+
+ // Find the path of the script to run.
+ var scriptPath = p.join(tempPath, scriptName);
+ var packageConfigPath = p.join(tempPath, '.packages');
+
+ onExit = ReceivePort();
+ onError = ReceivePort();
+
+ // Cleanup after exit.
+ onExit.listen((_) {
+ // If no error was thrown, return 0.
+ if (!exitCodeCompleter.isCompleted) exitCodeCompleter.complete(0);
+ });
+
+ // On an error, kill the isolate, and log the error.
+ onError.listen((e) {
+ onExit.close();
+ onError.close();
+ logger.severe('Unhandled error from script: $scriptName', e[0],
+ StackTrace.fromString(e[1].toString()));
+ if (!exitCodeCompleter.isCompleted) exitCodeCompleter.complete(1);
+ });
+
+ await Isolate.spawnUri(
+ p.toUri(scriptPath),
+ passedArgs,
+ null,
+ errorsAreFatal: true,
+ onExit: onExit.sendPort,
+ onError: onError.sendPort,
+ packageConfig: p.toUri(packageConfigPath),
+ );
+
+ return await exitCodeCompleter.future;
+ } on IsolateSpawnException catch (e) {
+ logger.severe(
+ 'Could not spawn isolate. Ensure that your file is in a valid directory (i.e. "bin", "benchmark", "example", "test", "tool").',
+ e);
+ return ExitCode.ioError.code;
+ } finally {
+ // Clean up the output dir.
+ var dir = Directory(tempPath);
+ if (await dir.exists()) await dir.delete(recursive: true);
+
+ onExit?.close();
+ onError?.close();
+ if (!exitCodeCompleter.isCompleted) {
+ exitCodeCompleter.complete(ExitCode.success.code);
+ }
+ }
+ } finally {
+ await logSubscription.cancel();
+ }
+ }
+}
diff --git a/build_runner/lib/src/entrypoint/runner.dart b/build_runner/lib/src/entrypoint/runner.dart
index ae7acfe..4cb309f 100644
--- a/build_runner/lib/src/entrypoint/runner.dart
+++ b/build_runner/lib/src/entrypoint/runner.dart
@@ -4,19 +4,24 @@
import 'dart:convert';
+import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:build_runner_core/build_runner_core.dart';
+import 'base_command.dart' show lineLength;
import 'build.dart';
-import 'clean.dart';
import 'daemon.dart';
import 'doctor.dart';
+import 'run_script.dart';
import 'serve.dart';
import 'test.dart';
import 'watch.dart';
/// Unified command runner for all build_runner commands.
class BuildCommandRunner extends CommandRunner<int> {
+ @override
+ final argParser = ArgParser(usageLineLength: lineLength);
+
final List<BuilderApplication> builderApplications;
final packageGraph = PackageGraph.forThisPackage();
@@ -25,9 +30,9 @@
: builderApplications = List.unmodifiable(builderApplications),
super('build_runner', 'Unified interface for running Dart builds.') {
addCommand(BuildCommand());
- addCommand(CleanCommand());
addCommand(DaemonCommand());
addCommand(DoctorCommand());
+ addCommand(RunCommand());
addCommand(ServeCommand());
addCommand(TestCommand(packageGraph));
addCommand(WatchCommand());
diff --git a/build_runner/lib/src/generate/watch_impl.dart b/build_runner/lib/src/generate/watch_impl.dart
index 7f5f553..69e574f 100644
--- a/build_runner/lib/src/generate/watch_impl.dart
+++ b/build_runner/lib/src/generate/watch_impl.dart
@@ -129,8 +129,8 @@
AssetGraph get assetGraph => _build?.assetGraph;
- final _readyCompleter = Completer<Null>();
- Future<Null> get ready => _readyCompleter.future;
+ final _readyCompleter = Completer<void>();
+ Future<void> get ready => _readyCompleter.future;
final String _configKey; // may be null
@@ -321,7 +321,7 @@
}
_reader = _build?.finalizedReader;
- _readyCompleter.complete(null);
+ _readyCompleter.complete();
// It is possible this is already closed if the user kills the process
// early, which results in an exception without this check.
if (!controller.isClosed) controller.add(firstBuild);
diff --git a/build_runner/lib/src/logging/std_io_logging.dart b/build_runner/lib/src/logging/std_io_logging.dart
index 1d96e4c..96231b6 100644
--- a/build_runner/lib/src/logging/std_io_logging.dart
+++ b/build_runner/lib/src/logging/std_io_logging.dart
@@ -26,7 +26,7 @@
final level = color.wrap('[${record.level}]');
final eraseLine = ansiOutputEnabled && !verbose ? '\x1b[2K\r' : '';
var lines = <Object>[
- '$eraseLine$level ${_loggerName(record, verbose)}${record.message}'
+ '$eraseLine$level ${_recordHeader(record, verbose)}${record.message}'
];
if (record.error != null) {
@@ -57,34 +57,11 @@
void _stdIOLogListener(LogRecord record, {bool verbose}) =>
stdout.write(colorLog(record, verbose: verbose));
-/// Filter out the Logger names known to come from `build_runner` and splits the
-/// header for levels >= WARNING.
-String _loggerName(LogRecord record, bool verbose) {
- var knownNames = const [
- 'ApplyBuilders',
- 'Bootstrap',
- 'Build',
- 'BuildConfigOverrides',
- 'BuildDefinition',
- 'BuildOptions',
- 'BuildScriptUpdates',
- 'CreateOutputDir',
- 'Entrypoint',
- 'Heartbeat',
- 'IOEnvironment',
- 'Serve',
- 'Watch',
- 'build_runner',
- // commands
- 'build',
- 'clean',
- 'doctor',
- 'serve',
- 'test',
- 'watch',
- ];
+/// Filter out the Logger names which aren't coming from specific builders and
+/// splits the header for levels >= WARNING.
+String _recordHeader(LogRecord record, bool verbose) {
var maybeSplit = record.level >= Level.WARNING ? '\n' : '';
- return verbose || !knownNames.contains(record.loggerName)
+ return verbose || record.loggerName.contains(' ')
? '${record.loggerName}:$maybeSplit'
: '';
}
diff --git a/build_runner/lib/src/server/build_updates_client/hot_reload_client.dart.js.map b/build_runner/lib/src/server/build_updates_client/hot_reload_client.dart.js.map
deleted file mode 100644
index 6fc8649..0000000
--- a/build_runner/lib/src/server/build_updates_client/hot_reload_client.dart.js.map
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "version": 3,
- "engine": "v2",
- "file": "hot_reload_client.dart.js",
- "sourceRoot": "",
- "sources": ["org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/interceptors.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_array.dart","org-dartlang-sdk:///sdk/lib/collection/list.dart","org-dartlang-sdk:///sdk/lib/core/comparable.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_number.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_string.dart","org-dartlang-sdk:///sdk/lib/internal/iterable.dart","org-dartlang-sdk:///sdk/lib/core/errors.dart","org-dartlang-sdk:///sdk/lib/internal/sort.dart","org-dartlang-sdk:///sdk/lib/internal/cast.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/internal_patch.dart","org-dartlang-sdk:///sdk/lib/internal/symbol.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/constant_map.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_rti.dart","org-dartlang-sdk:///sdk/lib/core/exceptions.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/core_patch.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/string_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_names.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_primitives.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_typed_data.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/async_patch.dart","org-dartlang-sdk:///sdk/lib/async/future_impl.dart","org-dartlang-sdk:///sdk/lib/async/schedule_microtask.dart","org-dartlang-sdk:///sdk/lib/async/zone.dart","org-dartlang-sdk:///sdk/lib/async/stream.dart","org-dartlang-sdk:///sdk/lib/async/stream_impl.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/collection_patch.dart","org-dartlang-sdk:///sdk/lib/collection/hash_map.dart","org-dartlang-sdk:///sdk/lib/collection/iterable.dart","org-dartlang-sdk:///sdk/lib/collection/maps.dart","org-dartlang-sdk:///sdk/lib/collection/splay_tree.dart","org-dartlang-sdk:///sdk/lib/collection/queue.dart","org-dartlang-sdk:///sdk/lib/collection/set.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/convert_patch.dart","org-dartlang-sdk:///sdk/lib/convert/json.dart","org-dartlang-sdk:///sdk/lib/core/map.dart","org-dartlang-sdk:///sdk/lib/core/print.dart","org-dartlang-sdk:///sdk/lib/core/date_time.dart","org-dartlang-sdk:///sdk/lib/core/iterable.dart","org-dartlang-sdk:///sdk/lib/core/null.dart","org-dartlang-sdk:///sdk/lib/core/string_buffer.dart","org-dartlang-sdk:///sdk/lib/html/dart2js/html_dart2js.dart","org-dartlang-sdk:///sdk/lib/html/html_common/conversions_dart2js.dart","org-dartlang-sdk:///sdk/lib/html/html_common/conversions.dart","org-dartlang-sdk:///sdk/lib/js/dart2js/js_dart2js.dart","hot_reload_client.dart","org-dartlang-sdk:///sdk/lib/collection/linked_hash_map.dart","module.dart","reloading_manager.dart","reload_handler.dart","../../../../graphs/src/strongly_connected_components.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/math_patch.dart","org-dartlang-sdk:///sdk/lib/async/future.dart"],
- "names": ["makeDispatchRecord","getNativeInterceptor","Interceptor.==","Interceptor.hashCode","Interceptor.toString","Interceptor.noSuchMethod","JSBool.toString","JSBool.hashCode","JSNull.==","JSNull.toString","JSNull.hashCode","JSNull.noSuchMethod","JavaScriptObject.hashCode","JavaScriptObject.toString","JavaScriptFunction.toString","JSArray.add","JSArray.addAll","JSArray.elementAt","JSArray.setRange","JSArray.setRange[function-entry$3]","JSArray.sort","JSArray.isEmpty","JSArray.isNotEmpty","JSArray.toString","JSArray.iterator","JSArray.hashCode","JSArray.length","JSArray.[]","JSArray.[]=","JSArray.+","JSArray.markFixed","JSArray.markFixedList","JSArray._compareAny","ArrayIterator.current","ArrayIterator.moveNext","JSNumber.compareTo","JSNumber.isNegative","JSNumber.toString","JSNumber.hashCode","JSNumber.+","JSNumber._tdivFast","JSNumber._tdivSlow","JSNumber._shrOtherPositive","JSNumber._shrBothPositive","JSNumber.>","JSString._codeUnitAt","JSString.+","JSString.substring","JSString.substring[function-entry$1]","JSString.isEmpty","JSString.compareTo","JSString.toString","JSString.hashCode","JSString.length","IterableElementError.noElement","IterableElementError.tooFew","Sort.sort","Sort._doSort","Sort._insertionSort","Sort._dualPivotQuicksort","_CastIterableBase.iterator","_CastIterableBase.length","_CastIterableBase.isEmpty","_CastIterableBase.contains","_CastIterableBase.toString","CastIterator.moveNext","CastIterator.current","CastIterable","CastMap.cast","CastMap.containsKey","CastMap.[]","CastMap.[]=","CastMap.forEach","CastMap.keys","CastMap.length","CastMap.isEmpty","CastMap.forEach.<anonymous function>","CastMap_forEach_closure","ListIterable.iterator","ListIterable.isEmpty","ListIterable.contains","ListIterable.toList","ListIterable.toList[function-entry$0]","ListIterator.current","ListIterator.moveNext","MappedListIterable.length","MappedListIterable.elementAt","Symbol.hashCode","Symbol.toString","Symbol.==","ConstantMap._throwUnmodifiable","unminifyOrTag","getType","isJsIndexable","S","Primitives.objectHashCode","Primitives.objectTypeName","Primitives._objectClassName","Primitives.stringFromCharCode","Primitives.lazyAsJsDate","Primitives.getYear","Primitives.getMonth","Primitives.getDay","Primitives.getHours","Primitives.getMinutes","Primitives.getSeconds","Primitives.getMilliseconds","Primitives.functionNoSuchMethod","createUnmangledInvocationMirror","Primitives.applyFunctionWithPositionalArguments","Primitives._genericApplyFunctionWithPositionalArguments","ioore","diagnoseIndexError","argumentErrorValue","checkNum","wrapException","toStringWrapper","throwExpression","throwConcurrentModificationError","unwrapException","getTraceFromException","invokeClosure","Exception","convertDartClosureToJS","Closure.fromTearOff","Closure.cspForwardCall","Closure.forwardCallTo","Closure.cspForwardInterceptedCall","Closure.forwardInterceptedCallTo","closureFromTearOff","stringTypeCast","propertyTypeCastError","interceptedTypeCast","extractFunctionTypeObjectFromInternal","functionTypeTest","_typeDescription","throwCyclicInit","getIsolateAffinityTag","setRuntimeTypeInfo","getRuntimeTypeInfo","getRuntimeTypeArguments","getRuntimeTypeArgumentIntercepted","getRuntimeTypeArgument","getTypeArgumentByIndex","runtimeTypeToString","_runtimeTypeToString","_functionRtiToString","_joinArguments","StringBuffer.write","substitute","checkSubtype","subtypeCast","Primitives.formatType","areSubtypes","computeSignature","isSupertypeOfNullRecursive","checkSubtypeOfRuntimeType","subtypeOfRuntimeTypeCast","_isSubtype","_isFunctionSubtype","namedParametersSubtypeCheck","defineProperty","lookupAndCacheInterceptor","patchProto","patchInteriorProto","makeLeafDispatchRecord","makeDefaultDispatchRecord","initNativeDispatch","initNativeDispatchContinue","initHooks","applyHooksTransformer","stringReplaceFirstUnchecked","stringReplaceRangeUnchecked","ConstantMap.cast","ConstantMap.isEmpty","ConstantMap.toString","ConstantMap.[]=","ConstantStringMap.length","ConstantStringMap.containsKey","ConstantStringMap.[]","ConstantStringMap._fetch","ConstantStringMap.forEach","ConstantStringMap.keys","_ConstantMapKeyIterable.iterator","_ConstantMapKeyIterable.length","JSInvocationMirror.memberName","JSInvocationMirror.positionalArguments","JSInvocationMirror.namedArguments","JsLinkedHashMap.es6","ReflectionInfo.defaultValue","ReflectionInfo","Primitives.functionNoSuchMethod.<anonymous function>","TypeErrorDecoder.matchTypeError","TypeErrorDecoder.extractPattern","TypeErrorDecoder.provokeCallErrorOn","TypeErrorDecoder.provokePropertyErrorOn","NullError.toString","NullError","JsNoSuchMethodError.toString","JsNoSuchMethodError","UnknownJsTypeError.toString","unwrapException.saveStackTrace","_StackTrace.toString","Closure.toString","StaticClosure.toString","BoundClosure.==","BoundClosure.hashCode","BoundClosure.toString","BoundClosure.selfOf","BoundClosure.receiverOf","BoundClosure.computeFieldNamed","CastErrorImplementation.toString","CastErrorImplementation","RuntimeError.toString","RuntimeError","JsLinkedHashMap.length","JsLinkedHashMap.isEmpty","JsLinkedHashMap.keys","JsLinkedHashMap.containsKey","JsLinkedHashMap.internalContainsKey","JsLinkedHashMap.[]","JsLinkedHashMap.internalGet","JsLinkedHashMap.[]=","JsLinkedHashMap.internalSet","JsLinkedHashMap.clear","JsLinkedHashMap.forEach","JsLinkedHashMap._addHashTableEntry","JsLinkedHashMap._modified","JsLinkedHashMap._newLinkedCell","JsLinkedHashMap.internalComputeHashCode","JsLinkedHashMap.internalFindBucketIndex","JsLinkedHashMap.toString","JsLinkedHashMap._getTableCell","JsLinkedHashMap._getTableBucket","JsLinkedHashMap._setTableEntry","JsLinkedHashMap._deleteTableEntry","JsLinkedHashMap._containsTableEntry","JsLinkedHashMap._newHashTable","LinkedHashMapKeyIterable.length","LinkedHashMapKeyIterable.isEmpty","LinkedHashMapKeyIterable.iterator","LinkedHashMapKeyIterator","LinkedHashMapKeyIterable.contains","LinkedHashMapKeyIterator.current","LinkedHashMapKeyIterator.moveNext","initHooks.<anonymous function>","extractKeys","printString","_checkValidIndex","NativeTypedArray.length","NativeTypedArrayOfDouble.[]","NativeTypedArrayOfDouble.[]=","NativeTypedArrayOfInt.[]=","NativeInt16List.[]","NativeInt32List.[]","NativeInt8List.[]","NativeUint16List.[]","NativeUint32List.[]","NativeUint8ClampedList.length","NativeUint8ClampedList.[]","NativeUint8List.length","NativeUint8List.[]","_AsyncRun._initializeScheduleImmediate","_AsyncRun._scheduleImmediateJsOverride","_AsyncRun._scheduleImmediateWithSetImmediate","_AsyncRun._scheduleImmediateWithTimer","_makeAsyncAwaitCompleter","Completer.sync","_Completer.future","_asyncStartSync","_asyncAwait","_asyncReturn","_asyncRethrow","_awaitOnObject","_wrapJsFunctionForAsync","_registerErrorHandler","_microtaskLoop","_startMicrotaskLoop","_scheduleAsyncCallback","_schedulePriorityAsyncCallback","scheduleMicrotask","StreamIterator","_rootHandleUncaughtError","_rootRun","_rootRunUnary","_rootRunBinary","_rootScheduleMicrotask","_AsyncRun._initializeScheduleImmediate.internalCallback","_AsyncRun._initializeScheduleImmediate.<anonymous function>","_AsyncRun._scheduleImmediateJsOverride.internalCallback","_AsyncRun._scheduleImmediateWithSetImmediate.internalCallback","_TimerImpl","_TimerImpl.internalCallback","_AsyncAwaitCompleter.complete","_AsyncAwaitCompleter.completeError","_AsyncAwaitCompleter.complete.<anonymous function>","_AsyncAwaitCompleter.completeError.<anonymous function>","_awaitOnObject.<anonymous function>","_wrapJsFunctionForAsync.<anonymous function>","_Completer.completeError","_nonNullError","_Completer.completeError[function-entry$1]","_AsyncCompleter.complete","_AsyncCompleter.complete[function-entry$0]","_AsyncCompleter._completeError","_SyncCompleter.complete","_SyncCompleter.complete[function-entry$0]","_SyncCompleter._completeError","_FutureListener.matchesErrorTest","_FutureListener.handleError","_Future.then","_Future.then[function-entry$1]","_Future._thenNoZoneRegistration","_Future._addListener","_Future._prependListeners","_Future._removeListeners","_Future._reverseListeners","_Future._complete","_Future._completeError","_Future._setError","_Future._asyncComplete","_Future._chainFuture","_Future._asyncCompleteError","_Future._chainForeignFuture","_Future._chainCoreFuture","_Future._propagateToListeners","_Future._addListener.<anonymous function>","_Future._prependListeners.<anonymous function>","_Future._chainForeignFuture.<anonymous function>","_Future._chainForeignFuture[function-entry$1].<anonymous function>","_Future._asyncComplete.<anonymous function>","_Future._completeWithValue","_Future._chainFuture.<anonymous function>","_Future._asyncCompleteError.<anonymous function>","_Future._propagateToListeners.handleWhenCompleteCallback","_Future._propagateToListeners.handleWhenCompleteCallback.<anonymous function>","_Future._propagateToListeners.handleValueCallback","_Future._propagateToListeners.handleError","AsyncError.toString","_rootHandleUncaughtError.<anonymous function>","_RootZone.runGuarded","_RootZone.runUnaryGuarded","_RootZone.runUnaryGuarded[function-entry$2]","_RootZone.bindCallback","_RootZone.bindCallback[function-entry$1]","_RootZone.bindCallbackGuarded","_RootZone.bindUnaryCallbackGuarded","_RootZone.run","_RootZone.run[function-entry$1]","_RootZone.runUnary","_RootZone.runUnary[function-entry$2]","_RootZone.runBinary","_RootZone.runBinary[function-entry$3]","_RootZone.registerBinaryCallback","_RootZone.registerBinaryCallback[function-entry$1]","_RootZone.bindCallback.<anonymous function>","_RootZone.bindCallbackGuarded.<anonymous function>","_RootZone.bindUnaryCallbackGuarded.<anonymous function>","_RootZone_bindUnaryCallbackGuarded_closure","HashMap","LinkedHashMap","LinkedHashMap._empty","LinkedHashMap._makeEmpty","HashSet","_defaultHashCode","IterableBase.iterableToShortString","IterableBase.iterableToFullString","_isToStringVisiting","_iterablePartsToStrings","MapBase.mapToString","MapBase._fillMapWithIterables","_HashMap.length","_HashMap.isEmpty","_HashMap.keys","_HashMap.containsKey","_HashMap._containsKey","_HashMap.[]","_HashMap._get","_HashMap.[]=","_HashMap._set","_HashMap.forEach","_HashMap._computeKeys","_HashMap._addHashTableEntry","_HashMap._computeHashCode","_HashMap._getBucket","_HashMap._findBucketIndex","_HashMap._getTableEntry","_HashMap._setTableEntry","_HashMap._newHashTable","_CustomHashMap.[]","_CustomHashMap.[]=","_CustomHashMap.containsKey","_CustomHashMap._computeHashCode","_CustomHashMap._findBucketIndex","_CustomHashMap","_CustomHashMap.<anonymous function>","_HashMapKeyIterable.length","_HashMapKeyIterable.isEmpty","_HashMapKeyIterable.iterator","_HashMapKeyIterable.contains","_HashMapKeyIterator.current","_HashMapKeyIterator.moveNext","_HashSet.iterator","_HashSet.length","_HashSet.isEmpty","_HashSet.contains","_HashSet._contains","_HashSet.add","_HashSet._add","_HashSet.remove","_HashSet._remove","_HashSet._computeElements","_HashSet._addHashTableEntry","_HashSet._removeHashTableEntry","_HashSet._computeHashCode","_HashSet._getBucket","_HashSet._findBucketIndex","_HashSet._newHashTable","_CustomHashSet._findBucketIndex","_CustomHashSet._computeHashCode","_CustomHashSet.add","_CustomHashSet.contains","_CustomHashSet.remove","_CustomHashSet","_CustomHashSet.<anonymous function>","_HashSetIterator.current","_HashSetIterator.moveNext","IterableMixin.length","SplayTreeSet.iterator","_SplayTreeIterator","IterableMixin.isEmpty","IterableMixin.toString","ListMixin.iterator","ListMixin.elementAt","ListMixin.isEmpty","ListMixin.isNotEmpty","ListMixin.sort","ListMixin.+","ListMixin.toString","MapBase.mapToString.<anonymous function>","MapMixin.cast","MapMixin.forEach","MapMixin.containsKey","MapMixin.length","MapMixin.isEmpty","MapMixin.toString","_UnmodifiableMapMixin.[]=","MapView.cast","MapView.[]","MapView.containsKey","MapView.forEach","MapView.isEmpty","MapView.length","MapView.keys","MapView.toString","UnmodifiableMapView.cast","ListQueue.iterator","ListQueue.isEmpty","ListQueue.length","ListQueue.elementAt","ListQueue.toString","_ListQueueIterator.current","_ListQueueIterator.moveNext","SetMixin.isEmpty","SetMixin.toString","_SplayTree._splay","_SplayTree._splayMin","_SplayTree._splayMax","_SplayTree._remove","_SplayTree._addNewRoot","_SplayTree._first","_SplayTreeIterator.current","_SplayTreeIterator._findLeftMostDescendent","_SplayTreeIterator.moveNext","_SplayTreeIterator._rebuildWorkList","SplayTreeSet.length","SplayTreeSet.isEmpty","SplayTreeSet.add","SplayTreeSet.remove","SplayTreeSet.addAll","SplayTreeSet.toString","SplayTreeSet","SplayTreeSet._dummy","SplayTreeSet.<anonymous function>","_parseJson","_convertJsonToDartLazy","_defaultToEncodable","_JsonMap.[]","_JsonMap.length","_JsonMap.isEmpty","_JsonMap.keys","_JsonMap.[]=","_JsonMap.containsKey","_JsonMap.forEach","_JsonMap._computeKeys","_JsonMap._upgrade","_JsonMap._process","_JsonMapKeyIterable.length","_JsonMapKeyIterable.elementAt","_JsonMapKeyIterable.iterator","_JsonMapKeyIterable.contains","JsonUnsupportedObjectError.toString","JsonUnsupportedObjectError","JsonCyclicError.toString","JsonCodec.decode","JsonCodec.decode[function-entry$1]","JsonCodec.encode","JsonCodec.encode[function-entry$1]","JsonCodec.encoder","JsonCodec.decoder","_JsonStringifier.writeStringContent","StringBuffer.writeCharCode","_JsonStringStringifier.writeString","_JsonStringifier._checkCycle","_JsonStringifier.writeObject","_JsonStringifier.writeJsonValue","_JsonStringifier.writeList","_JsonStringifier.writeMap","_JsonStringifier.writeMap.<anonymous function>","_JsonStringStringifier._partialResult","_JsonStringStringifier.stringify","_JsonStringStringifier.printOn","_JsonStringStringifier","Error._objectToString","List.from","StackTrace.current","Error.safeToString","Map.castFrom","print","NoSuchMethodError.toString.<anonymous function>","DateTime.==","DateTime.compareTo","DateTime.hashCode","DateTime.toString","DateTime._fourDigits","DateTime._threeDigits","DateTime._twoDigits","NullThrownError.toString","ArgumentError._errorName","ArgumentError._errorExplanation","ArgumentError.toString","ArgumentError","ArgumentError.value","RangeError._errorName","RangeError._errorExplanation","RangeError.value","RangeError.range","RangeError.checkValidRange","IndexError._errorName","IndexError._errorExplanation","IndexError","NoSuchMethodError.toString","NoSuchMethodError","UnsupportedError.toString","UnsupportedError","UnimplementedError.toString","UnimplementedError","StateError.toString","StateError","ConcurrentModificationError.toString","ConcurrentModificationError","StackOverflowError.toString","CyclicInitializationError.toString","_Exception.toString","FormatException.toString","Iterable.contains","Iterable.length","Iterable.isEmpty","Iterable.elementAt","Iterable.toString","Null.hashCode","Null.toString","Object.==","Object.hashCode","Object.toString","Object.noSuchMethod","StringBuffer.length","StringBuffer.toString","StringBuffer.isEmpty","StringBuffer._writeAll","HttpRequest.request","Completer","WebSocket","_convertNativeToDart_XHR_Response","convertNativeToDart_AcceptStructuredClone","convertNativeToDart_SerializedScriptValue","_wrapZone","DomException.toString","EventTarget._addEventListener","HttpRequest.open","HttpRequest.open[function-entry$2$async]","HttpRequest.request.<anonymous function>","Location.origin","Location.toString","Node.toString","_EventStreamSubscription._tryResume","_EventStreamSubscription","_EventStreamSubscription.<anonymous function>","convertNativePromiseToDartFuture","_AcceptStructuredClone.findSlot","_AcceptStructuredClone.walk","DateTime._withValue","convertNativeToDart_DateTime","_AcceptStructuredClone.convertNativeToDart_AcceptStructuredClone","_AcceptStructuredClone.walk.<anonymous function>","_AcceptStructuredCloneDart2Js.forEachJsField","convertNativePromiseToDartFuture.<anonymous function>","_convertDartFunctionFast","_callDartFunctionFast","Function._apply1","allowInterop","keys","_moduleLibraries","JSArray.map","_reloadModule","_reloadPage","main","ReloadingManager","LibraryWrapper.onDestroy","LibraryWrapper.onSelfUpdate","LibraryWrapper.onChildUpdate","_moduleLibraries.<anonymous function>","_reloadModule.<anonymous function>","main.<anonymous function>","Module.onDestroy","Module.onSelfUpdate","Module.onChildUpdate","ReloadHandler.listener","HotReloadFailedException.toString","HotReloadFailedException","ReloadingManager.moduleTopologicalCompare","ReloadingManager.updateGraph","ReloadingManager.reload","_Completer.isCompleted","stronglyConnectedComponents","ListQueue","_defaultEquals","stronglyConnectedComponents.strongConnect","ListQueue.addLast","ListQueue._add","stronglyConnectedComponents_strongConnect","DART_CLOSURE_PROPERTY_NAME","JS_INTEROP_INTERCEPTOR_TAG","TypeErrorDecoder.noSuchMethodPattern","TypeErrorDecoder.notClosurePattern","TypeErrorDecoder.nullCallPattern","TypeErrorDecoder.nullLiteralCallPattern","TypeErrorDecoder.undefinedCallPattern","TypeErrorDecoder.undefinedLiteralCallPattern","TypeErrorDecoder.nullPropertyPattern","TypeErrorDecoder.nullLiteralPropertyPattern","TypeErrorDecoder.undefinedPropertyPattern","TypeErrorDecoder.undefinedLiteralPropertyPattern","_AsyncRun._scheduleImmediateClosure","_toStringVisiting","_hasErrorStackProperty","String","MappedListIterable","main_closure","request","Map","_AsyncCompleter","_Future","_current","int","_empty","","ReloadHandler","stringify","StringBuffer","unwrapException_saveStackTrace","ExceptionAndStackTrace","UnknownJsTypeError","StackOverflowError","Error","extractPattern","TypeErrorDecoder","CyclicInitializationError","provokePropertyErrorOn","provokeCallErrorOn","_SplayTreeKeyIterator","_SplayTreeNode","range","RangeError","ListIterator","value","NullThrownError","safeToString","_objectToString","Closure","objectTypeName","_objectClassName","Object","markFixed","markFixedList","UnknownJavaScriptObject","iterableToShortString","_writeAll","ArrayIterator","iterableToFullString","JsonCyclicError","List","_JsonStringifier_writeMap_closure","Null","stringFromCharCode","_AcceptStructuredCloneDart2Js","BoundClosure","FormatException","_JsonMap","mapToString","MapBase_mapToString_closure","MapMixin","castFrom","CastMap","CastIterator","Function","Future","EfficientLengthIterable","_EfficientLengthCastIterable","_JsonMapKeyIterable","noElement","sort","_doSort","_insertionSort","_dualPivotQuicksort","checkValidRange","tooFew","ListMixin","_Future__asyncComplete_closure","_propagateToListeners","_Future__propagateToListeners_handleWhenCompleteCallback","_Future__propagateToListeners_handleValueCallback","_Future__propagateToListeners_handleError","_chainCoreFuture","AsyncError","_StackTrace","StackTrace","_Future__propagateToListeners_handleWhenCompleteCallback_closure","_FutureListener","_Future__addListener_closure","_Future__prependListeners_closure","_rootHandleUncaughtError_closure","_nextCallback","_lastPriorityCallback","_lastCallback","_AsyncCallbackEntry","_isInCallbackLoop","_initializeScheduleImmediate","_AsyncRun__initializeScheduleImmediate_internalCallback","_AsyncRun__initializeScheduleImmediate_closure","_TimerImpl_internalCallback","_AsyncRun__scheduleImmediateWithSetImmediate_internalCallback","_Exception","_AsyncRun__scheduleImmediateJsOverride_internalCallback","_RootZone_bindCallback_closure","_RootZone_bindCallbackGuarded_closure","_Future__chainFuture_closure","_chainForeignFuture","_Future__chainForeignFuture_closure","_ListQueueIterator","_HashSet","objectHashCode","_newHashTable","_HashSetIterator","_CustomHashSet_closure","bool","_HashMap","_setTableEntry","_getTableEntry","_HashMapKeyIterable","_HashMapKeyIterator","_CustomHashMap_closure","DateTime","_makeEmpty","_AcceptStructuredClone_walk_closure","getYear","_fourDigits","getMonth","_twoDigits","getDay","getHours","getMinutes","getSeconds","getMilliseconds","_threeDigits","lazyAsJsDate","JsLinkedHashMap","LinkedHashMapCell","LinkedHashMapKeyIterable","convertNativePromiseToDartFuture_closure","_Future__asyncCompleteError_closure","ListIterable","_wrapJsFunctionForAsync_closure","_StreamIterator","_awaitOnObject_closure","initNativeDispatchFlag","getTagFunction","dispatchRecordsForInstanceTags","interceptorsForUncacheableTags","alternateTagFunction","JavaScriptIndexingBehavior","prototypeForTagFunction","initHooks_closure","_AsyncAwaitCompleter","_SyncCompleter","_AsyncAwaitCompleter_completeError_closure","_AsyncAwaitCompleter_complete_closure","_EventStreamSubscription_closure","Event","SplayTreeSet_closure","from","HotReloadableLibrary","Library","_moduleLibraries_closure","LibraryWrapper","_fillMapWithIterables","Module","fromTearOff","receiverOf","selfOf","StaticClosure","functionCounter","forwardCallTo","forwardInterceptedCallTo","cspForwardCall","selfFieldNameCache","computeFieldNamed","receiverFieldNameCache","cspForwardInterceptedCall","current","_reloadModule_closure","applyFunctionWithPositionalArguments","_genericApplyFunctionWithPositionalArguments","functionNoSuchMethod","Primitives_functionNoSuchMethod_closure","JSInvocationMirror","Symbol","NoSuchMethodError_toString_closure","ConstantMapView","_throwUnmodifiable","_ConstantMapKeyIterable","UnmodifiableMapView","Document","HttpRequest","HttpRequest_request_closure","JS_CONST","Interceptor","JSBool","JSNull","JavaScriptObject","PlainJavaScriptObject","JavaScriptFunction","JSArray","JSUnmodifiableArray","num","JSNumber","JSInt","JSDouble","JSString","Iterable","_CastIterableBase","FixedLengthListMixin","ConstantMap","ConstantStringMap","noSuchMethodPattern","notClosurePattern","nullCallPattern","nullLiteralCallPattern","undefinedCallPattern","undefinedLiteralCallPattern","nullPropertyPattern","nullLiteralPropertyPattern","undefinedPropertyPattern","undefinedLiteralPropertyPattern","TearOffClosure","NativeTypedData","NativeTypedArray","double","NativeTypedArrayOfDouble","NativeTypedArrayOfInt","NativeInt16List","NativeInt32List","NativeInt8List","NativeUint16List","NativeUint32List","NativeUint8ClampedList","NativeUint8List","_Completer","StreamSubscription","StreamTransformerBase","_Zone","_RootZone","_HashSetBase","IterableMixin","MapBase","_UnmodifiableMapMixin","MapView","SetMixin","SetBase","_SplayTree","Codec","Converter","JsonCodec","JsonEncoder","JsonDecoder","_JsonStringifier","DomException","EventTarget","HttpRequestEventTarget","Location","MessageEvent","Node","ProgressEvent","_AcceptStructuredClone","JsMap","JsError","DartLoader","_NativeTypedArrayOfDouble&NativeTypedArray&ListMixin","_NativeTypedArrayOfDouble&NativeTypedArray&ListMixin&FixedLengthListMixin","_NativeTypedArrayOfInt&NativeTypedArray&ListMixin","_NativeTypedArrayOfInt&NativeTypedArray&ListMixin&FixedLengthListMixin","_SplayTreeSet&_SplayTree&IterableMixin","_SplayTreeSet&_SplayTree&IterableMixin&SetMixin","_UnmodifiableMapView&MapView&_UnmodifiableMapMixin","_compareAny","_scheduleImmediateJsOverride","_scheduleImmediateWithSetImmediate","_scheduleImmediateWithTimer","_scheduleImmediateClosure","$intercepted$get$urlToModuleId$x","getInterceptor$x","hot_reload_client___reloadModule$closure","hot_reload_client___moduleLibraries$closure","hot_reload_client___reloadPage$closure","convert___defaultToEncodable$closure","getInterceptor$","$intercepted$get$length$asx","getInterceptor$asx","$intercepted$elementAt1$ax","getInterceptor$ax","$intercepted$toString0$IJavaScriptFunctionJavaScriptObjectabnsux","$intercepted$get$iterator$ax","$intercepted$get$isNotEmpty$ax","getInterceptor$s","$intercepted$$eq$Iu","$intercepted$$add$ansx","getInterceptor$ansx","$intercepted$get$isEmpty$asx","$intercepted$sort1$ax","_interceptors_JSArray__compareAny$closure","$intercepted$$gt$n","getInterceptor$n","$intercepted$compareTo1$ns","getInterceptor$ns","async___startMicrotaskLoop$closure","async__AsyncRun__scheduleImmediateJsOverride$closure","async__AsyncRun__scheduleImmediateWithSetImmediate$closure","async__AsyncRun__scheduleImmediateWithTimer$closure","strongly_connected_components___defaultEquals$closure","collection___defaultHashCode$closure","$intercepted$get$hashCode$IJavaScriptObjectabnsu","$intercepted$[]=$ax","$intercepted$get1$x","$intercepted$get$moduleParentsGraph$x","$intercepted$_addEventListener3$x","$intercepted$getModuleLibraries1$x","$intercepted$hot$onChildUpdate3$x","$intercepted$hot$onSelfUpdate1$x","$intercepted$hot$onDestroy0$x","$intercepted$forceLoadModule3$x","$intercepted$get$message$x","$intercepted$noSuchMethod1$Iu","$intercepted$keys0$x","functionThatReturnsNull","makeConstantList","_containsKey","reload","_add","_set","toString","_contains","noSuchMethod","_get","_remove","listener","isEmpty","dart.collection#_addNewRoot","encode","runBinary","moduleTopologicalCompare","open","call","remove","getModuleLibraries","registerBinaryCallback","contains","dart.async#_asyncCompleteError","writeMap","dart.collection#_splayMax","onSelfUpdate","dart.async#_thenNoZoneRegistration","_js_helper#_modified","dart.collection#_get","moveNext","iterator","_js_helper#_deleteTableEntry","run","dart.async#_removeListeners","complete","handleError","internalFindBucketIndex","setRange","dart.async#_reverseListeners","walk","internalComputeHashCode","get","updateGraph","compareTo","dart.collection#_contains","namedArguments","dart.collection#_removeHashTableEntry","dart.collection#_getBucket","_js_helper#_getTableBucket","forceLoadModule","dart.collection#_first","isNegative","moduleParentsGraph","runUnary","toJson","_interceptors#_codeUnitAt","addAll","writeList","dart.collection#_containsKey","dart.collection#_addHashTableEntry","completeError","dart.async#_addListener","_js_helper#_newLinkedCell","_js_helper#_getTableCell","cast","dart.convert#_process","urlToModuleId","decoder","bindCallback","dart.convert#_upgrade","_interceptors#_tdivSlow","matchesErrorTest","positionalArguments","dart.convert#_partialResult","dart.core#_errorName","dart.async#_asyncComplete","forEach","bindUnaryCallbackGuarded","dart.convert#_computeKeys","internalGet","dart.async#_complete","dart.collection#_computeHashCode","then","dart.collection#_splayMin","_js_helper#_newHashTable","_interceptors#_shrBothPositive","dart.collection#_remove","encoder","dart.async#_state","dart.collection#_computeKeys","dart.collection#_findBucketIndex","runUnaryGuarded","internalSet","onChildUpdate","writeJsonValue","hashCode","clear","message","dart.dom.html#_addEventListener","decode","dart.collection#_findLeftMostDescendent","_js_helper#_fetch","matchTypeError","runGuarded","dart.dom.html#_tryResume","containsKey","dart.collection#_add","substring","memberName","bindCallbackGuarded","origin","dart.collection#_computeElements","isNotEmpty","hot$onDestroy","hot$onSelfUpdate","length=","dart.async#_chainFuture","writeObject","_interceptors#_tdivFast","_js_helper#_addHashTableEntry","toList","dart.async#_resultOrListeners","defaultValue","dart.collection#_splay","add","forEachJsField","writeStringContent","dart.core#_errorExplanation","dart.collection#_set","dart.async#_completeError","internalContainsKey","dart.async#_prependListeners","dart.core#_contents=","onDestroy","dart.convert#_checkCycle","findSlot","_interceptors#_shrOtherPositive","_js_helper#_containsTableEntry","hot$onChildUpdate","elementAt","_js_helper#_setTableEntry","$indexSet","$index","$eq","$ge","$gt","$lt","$add","lookupInterceptorByConstructor","cacheInterceptorOnConstructor","objectToHumanReadableString","checkGrowable","checkMutable","listToString","compare","_","joinArguments","selfFieldName","receiverFieldName","extractFunctionTypeObjectFrom","isFunctionSubtype","_getRuntimeTypeAsString","write","_writeString","checkArguments","computeTypeName","formatType","isSupertypeOfNull","isSubtype","isJsArray","setDispatchProperty","markUnmodifiableList","es6","unvalidated","internal","_getBucket","_createTimer","_completer","sync","_AsyncAwaitCompleter._completer","future","_setValue","_scheduleImmediate","inSameErrorZone","_zone","_mayAddListener","_chainSource","_isComplete","_cloneResult","_setError","_setErrorObject","_setPendingComplete","_setChained","_hasError","_error","handleUncaughtError","handlesValue","handlesComplete","_removeListeners","_clearPendingComplete","_completeWithValue","handleWhenComplete","handleValue","_rethrow","writeAll","_workList","checkValidIndex","_checkModification","_compare","_rebuildWorkList","_dummy","_isUpgraded","_setProperty","convert","writeStringSlice","writeCharCode","_JsonStringStringifier.writeCharCode","fromCharCode","writeString","_removeSeen","writeNumber","printOn","printToConsole","year","month","day","hour","minute","second","millisecond","checkNotNegative","_writeOne","listen","addEventListener","fromMillisecondsSinceEpoch","_withValue","isJavaScriptSimpleObject","readSlot","writeSlot","apply","_apply1","Function.apply","applyFunction","fromIterables","map","response","_running","_moduleOrdering","replaceFirst","data","MessageEvent.data","isCompleted","_mayComplete","first","addLast","_grow","min","removeLast","provokeCallErrorOnNull","provokeCallErrorOnUndefined","provokePropertyErrorOnNull","provokePropertyErrorOnUndefined"],
- "mappings": "A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFAA,kBA6BEA,uBAEFA,C;GAWAC,YACMA;AAEAA;AAAJA,WACEA,eACEA;+BAKJA,YAEeA;AAAbA,UAAoBA,UAuDxBA;AAtDIA,UAAmBA,QAsDvBA;AApDqCA;AAAjCA,SACEA,UAmDNA;AA/CIA,WAKEA,UAAUA,+BAA4CA,cAOTA;AA2CfA;AA1ClCA,WAAyBA,QAkC3BA;AA9BgBA;AACdA,WAAyBA,QA6B3BA;AAvBEA,wBAIEA,UAmBJA;AAhB8BA;AAA5BA,WAEEA,UAcJA;AAXEA,wBAIEA,UAOJA;AALEA,iDAiB4BA;AAf1BA,UAGJA,CADEA,UACFA,C;;EAsIgBC,cAAaA,YAAsBA,C;GAEzCC,YAAYA,OAAWA,OAAoBA,C;QAE5CC,YAAcA,sBCuZLA,WDvZiDA,C;SAgBzDC,cACNA,UAAUA,OAAmCA,QAC9BA,QAAgCA,cACjDA,C;;;EAYOC,YAAcA,gBAAgCA,C;GAU7CC,YAAYA,sBAAwCA,C;;;EAe9CC,cAAaA,cAAsBA,C;EAG1CC,YAAcA,YAAMA,C;GAEnBC,YAAYA,QAACA,C;GAObC,cAAuCA,OAAMA,YAAwBA,C;;;GAsCrEC,YAAYA,QAACA,C;QAOdC,YAAcA,gBAA+BA,C;;;;;;;;;;;;;;;;;EA8B7CC,YACiCA;AACtCA,WAAyBA,OAAaA,UAExCA;AADEA,iCAAkCA,YACpCA,C;;;EEvWKC,cANHA,oBACEA,IAAUA;SAQdA,C;GA2GKC,cACCA;AArHJA,oBACEA,IAAUA;AAsHZA,kCAKFA,C;EA4HEC,cACWA;AAAXA,WACFA,C;GAiDKC,oBAAQA;AAjTXA,sBACEA,IAAUA;AAmTDA;AACEA;AACbA,SAAiBA,MAiCnBA;AApBsCA,cAClCA,UAA2BA;AAE7BA,OAIEA,oBAIwBA;AAAVA,8BAASA;AAATA,iBAIdA,iBACwBA;AAAVA,8BAASA;AAATA,YAIlBA,C;EAtCKC,4C;GAsGAC,cAvZHA,sBACEA,IAAUA;AAwZPA,eAAsBA,SAC7BA,C;GA8DSC,YAAWA,mBAAWA,C;IAEtBC,YAAcA,mBAAQA,C;EAExBC,YAAcA,OC3iBJA,eD2iB+BA,C;GAchCC,YAAYA,OA0G5BA,sBA1GsDA,C;GAE9CC,YAAYA,OAAWA,OAAoBA,C;GAE3CC,YAAUA,eAAiCA,C;GAE/CA,cA1eFA,oBACEA,IAAUA;AA+eZA,OACEA,UAAUA;UAKdA,C;EAEWC,cAETA,oBAAkCA,UAAMA;AACxCA,WACFA,C;EAEcC,gBApgBZA,sBACEA,IAAUA;AAqgBZA,0CAAmBA,UAAMA;AACzBA,oBAAkCA,UAAMA;MAE1CA,C;EAWiBC,cACXA;AAAmBA,iBAAeA;AAC5BA;AACNA;AACFA;AACAA;AAHFA,QAIFA,C;;;;GAljBQC,cACJA,YAA0CA,WAA8BA,C;GAKhEC;AAKVA,QACFA,C;IAwaWC,cAGTA,OEjbgDA,SFkblDA,C;;;GAyLMC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAASA;AAAUA;AAKvBA,cACEA,UAAMA;AAGJA;AAAJA,SACEA;AACAA,QAKJA,CAHEA;AACAA;AACAA,QACFA,C;;GGxsBIC,cACFA;uBAAeA,UAAMA;AACrBA,OACEA,QAmBJA;KAlBSA,OACLA,QAiBJA;KAhBSA,UACLA,UACuBA;AACjBA,mBAA2BA,QAarCA;AAZUA,eAAYA,QAYtBA;AAXMA,QAWNA,CATIA,QASJA,+BANMA,QAMNA;AAJIA,QAIJA,MAFIA,QAEJA,C;IAESC,YAAcA,sBAAuCA,C;EAiMvDC,YACLA,gBACEA,YAIJA;KAFIA,UAEJA,C;GAEQC,YAAYA,mBAAiCA,C;EAInCC,cAEhBA,UACFA,C;GA2CIC,cAEFA,sBAEMA,YACRA,C;GAEIC,cACEA;AACJA,iCAEEA,UAgBJA;AAdEA,QAGEA,WACEA,oBAUNA,MARSA,UAELA,mBAMJA;AAFEA,UAAUA,wCAC6BA,YAA0BA,iBACnEA,C;GA4BIC,cACFA;OACMA;;WADNA,QAOFA,C;GAOIC,cACFA,mBASFA,C;EAsBcC,cACZA,uBAAmBA,UAAMA;AACzBA,UACFA,C;;;;;GCxXIC,cACFA,eAAqBA,UAAMA;AAC3BA,sBACFA,C;EAyBgBC,cACdA,uBAAsBA,UAAUA;AAChCA,UACFA,C;EAqGOC,gBAELA,WAAiCA;AAGjCA,OAA2BA,UAAUA;AACrCA,cAAuBA,UAAUA;AACjCA,uBACFA,C;GAROC,sC;GAuREC,YAAWA,mBAAWA,C;GAI3BC,cACFA;uBAAsBA,UAAMA;;;AAC5BA,QACFA,C;EAGOC,YAAcA,QAAIA,C;GAQjBC,YAGFA;AACJA;AAEoBA;QAGFA;AAEGA;AAArBA,kCACFA,C;GAIQC,YAAUA,eAA4BA,C;;GCua5BC,WAAeA,OCvWjCA,sBDuW6DA,C;GAI3CC,WAAYA,OC3W9BA,4BD2WgEA,C;GE/1BpDC,cACVA,SAAgBA,WAClBA,C;GAqBYC,kBAEVA,WACEA;KAEAA,aAEJA,C;GAEYC,kBAEVA;AAOEA,oBAPFA,UACWA;AAEDA;AAARA,UAA6BA,cAAPA,KAAQA;AACnBA;AAATA,QAAOA;AADDA,IAIRA,WAEJA,C;GAEYC,oBAAsBA;AAKNA;AACbA;AACAA;AACMA;AACNA;AACAA;AAEHA;;AACAA;AACAA;AACAA;AACAA;AAGCA,OAAPA,eAUQA;AAKAA;IAVDA,OAAPA,eAeaA;AAUAA;IApBNA,OAAPA,eAUQA;AALKA;IAANA,OAAPA,eAeQA;AALAA;IALDA,OAAPA,eA+BQA;AA1BKA;IAANA,OAAPA,eAUaA;AAKLA;IAVDA,OAAPA,eAKQA;AAKKA;IALNA,OAAPA,eAWSA;AAMDA;IAZDA,OAAPA,eAOSA;AAMDA;IAFZA;AACAA;AACAA;AAEYA,mCAACA;AAAbA;AACYA,sCAACA;AAAbA;AAEWA;AACCA;AAEoBA,OAAPA,eAiBvBA,kBACWA,8BAACA;AAADA;AACEA;AACXA,SAAeA;AACXA,mCAAKA;AAATA,QACEA,UACSA,8BAACA;AAARA;AACAA,WAEFA,mBAYiBA,mCAACA;AAATA;AACHA,mCAAKA;AAATA,QACEA;AAGAA,cAUOA;;AATFA,QAEEA,uBAACA;AAARA;AACMA;AAAMA,8BAACA;AAAbA;AACAA;;;AACAA,WAGOA,uBAACA;AAARA;AACAA;;AAGAA,SAmFNA,UA5DFA,kBACWA,8BAACA;AAADA;AACSA;AACdA,mCAAYA;AAAhBA,QACEA,UACSA,8BAACA;AAARA;AACAA,WAEFA,SAEkBA;AACdA,mCAAYA;AAAhBA,iBAEuBA,mCAACA;AAATA;AACPA,mCAAKA;AAATA,QACEA;AACAA,OAAeA;AAGfA,cAGeA,8BAACA;AAATA;AACHA,mCAAKA;AAQAA;;AARTA,QAESA,uBAACA;AAARA;AACMA;AAAMA,8BAACA;AAAbA;AACAA;SAGOA,uBAACA;AAARA;AACAA;AAEFA,SA2BRA,KAdQA;AAAFA,8BAACA;AAAXA;AACAA;AACaA;AAAFA,mCAACA;AAAZA;AACAA;AAQAA;AACAA;AAEAA,KAGEA,MAqFJA;AA9EEA,aACEA,UAAeA,8BAACA;AAAFA,QAAPA,uBACLA,IAEFA,UAAeA,mCAACA;AAAFA,QAAPA,uBACLA,IAmBFA,kBACWA,8BAACA;AAADA;AACSA,mBAEhBA,UACSA,8BAACA;AAARA;AACAA,WAEFA,SAEkBA,4BAGKA,mCAACA;AAATA,sBAETA;AACAA,OAAeA;AAGfA,cAGeA,8BAACA;AAATA;AACHA,mCAAKA;AAQAA;;AARTA,QAESA,uBAACA;AAARA;AACMA;AAAMA,8BAACA;AAAbA;AACAA;SAGOA,uBAACA;AAARA;AACAA;AAEFA,QAYVA,oBAOAA,cAEJA,C;;GCpXgBC,YAAYA;OAgD5BA,SAhD2DA,iBAASA,C;GAuB5DC,YAAUA;OAAQA,OAAMA,C;GACvBC,YAAWA;OAAQA,OAAOA,C;EAW9BC,cAA0BA,oBAAuBA,C;EAQ/CC,YAAcA,kBAAkBA,C;;;EAMlCC,WAAcA,iBAAkBA,C;GAC/BC,WAAWA,OAAgBA,KAARA,wBAAYA,C;;GAQ7BC,gBACKA,0BACTA,OAUJA,iBAPAA;AADEA,OANFA,iBAOAA,C;;;;EAwLYC,gBAAkBA,OAF9BA,iBAEkCA,6BAAgCA,C;EAI7DC,YAA2BA,kBAAwBA,C;EAE7CC,cAAkBA,OAAaA,KAAbA,0BAAiBA,C;EAEhCC,gBACZA,WAAYA,oBAAeA,oBAC7BA,C;EAeKC,cACHA,WAAgBA,iBAGlBA,C;GAEgBC,YAAQA;OAAIA,KAA4BA,QAA5BA,wBAAiCA,C;GAIrDC,YAAUA;OAAQA,OAAMA,C;GAEvBC,YAAWA;OAAQA,OAAOA,C;;;;GAXjBC;AACdA,UAAMA,iBAAYA,iBACnBA,C;GAFeC;gD;;;GH3PFC,YAAYA,OAqS5BA,cAEyBA,gBAvS4BA,C;GAY5CC,YAAWA,wBAAWA,C;EAkB1BC,cACCA;AAAcA;AAClBA,iBACMA,sBAAyBA,QAMjCA;AALuBA,qBACjBA,UAAUA,WAGdA,QACFA,C;GA0IQC,cACEA;AAEMA;AAAIA,SAASA;AAI3BA,QAAoBA,gBAApBA,KACcA;AAAZA,8BAAMA;AAANA,OAEFA,QACFA,C;GAXQC,iC;;GAyHFC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAASA;AAAUA;;AACvBA,cACEA,UAAUA;AAERA;AAAJA,SACEA;AACAA,QAKJA,CAHaA;AAEXA,QACFA,C;;GAmEQC,YAAUA,OAAQA,WAAMA,C;EAC9BC,cAAwBA,iBAAGA,eAAyBA,C;;;;;;GI5Y9CC,YACFA;AACJA,WAAkBA,QAKpBA;AAH8CA;;AAE5CA,QACFA,C;EAGAC,YAAcA,iBAAUA,gBAAQA,C;ECoFlBC,cAAEA,mBAAkDA;AAAvCA,qCAAuCA,C;;GCvDtDC,WACVA,UAAUA,sCACZA,C;GZ0DKC,YACEA;AACPA,uBAAyBA,QAG3BA;;AAF+BA,QAE/BA,C;IAmGAC,YACEA,oBAEFA,C;GAOKC,cACHA;YAEMA;AAAJA,WAAoBA,QAGxBA,CADEA,QAAcA,WAChBA,C;EAEOC,YACLA;uBAAqBA,QAgBvBA;AAfEA,wBACEA,SAEEA,UAYNA,MAVSA,UACLA,YASJA;KARSA,UACLA,aAOJA;KANSA,WACLA,YAKJA;AAHYA;AACVA,uBAAoBA,UAAMA;AAC1BA,QACFA,C;GA8RaC,YACLA;AACJA;kBAIAA,QACFA,C;GAuHcC,YAGZA,OAFmBA,Qa7UdA,Kb8U4BA,cAEnCA,C;GAEcC,YACRA;AAAcA;AASuBA;AAAzCA,yBAEMA;kCAKFA;;AAAJA,yBAkBWA;;AACTA,iBAK2CA;AAAzCA,qCAGuBA;AACjBA;6CAMRA,QAaJA,CAJMA;AAGJA,OAAOA,iBAH0BA,iBACxBA,cAGXA,C;EA6GcC,YACZA;AACEA,YACEA,6BAYNA;AATIA,eACaA;AAGXA,kCADqBA,+BAM3BA,CADEA,UAAUA,4BACZA,C;EAyFOC,YACLA;AAIAA,aACFA,C;GAmBOC,YAEwCA;AAD7CA,QAGFA,C;GAKOC,YAEwCA;AAD7CA,QAGFA,C;GAKOC,YAEyCA;AAD9CA,QAGFA,C;GAKOC,YAE0CA;AAD/CA,QAGFA,C;GAKOC,YAE4CA;AADjDA,QAGFA,C;GAKOC,YAE4CA;AADjDA,QAGFA,C;GAKOC,YAGgDA;AAFrDA,QAIFA,C;GAkCOC,gBAEDA;AAFCA;AAEDA;AAMFA;AAqBEA;AAvBJA,YACuCA;AACrCA,YAGKA;AACuCA,qBAC5CA,MAAuBA;AAWzBA,OAAOA,OA3vBTC,qCAkwBAD,C;GAwNOE,cAEAA;AAELA,WAIoBA;;AAMNA;AAAdA,UAEEA,UACEA,aAiCNA,MA/BSA,UAELA,UACEA,iBA4BNA,MA1BSA,UAELA,UACEA,sBAuBNA,MApBSA,UAELA,UACEA,2BAiBNA,MAdSA,UAELA,UACEA,gCAWNA,MARSA,SAELA,UACEA,qCAKNA;AADEA,OAAOA,SACTA,C;GAEOC,cAEDA;AAA0BA;AAI1BA;AAAJA,YACoBA;AAIlBA,WACEA,OAAOA,cAoBbA;AAlB8BA;AACOA;AAE7BA;AACJA,iBAGEA,OAAOA,cAWbA;AAToBA;AAChBA,gBACEA,sBAA0BA,UAM9BA,mBACFA,C;EAwGFC,cACEA,WAA+BA;AAC/BA,UAAMA,UACRA,C;GAOMC,cACJA;0CAAmBA,OOv0CnBA,0BPg1CFA;AARyBA;AAGvBA,aACEA,OAAWA,wBAIfA;AADEA,OAAWA,oBACbA,C;GA+BcC,YACZA,OOh3CAA,uBPi3CFA,C;GAQAC,YACEA,uBAAmBA,UAAMA;AACzBA,QACFA,C;EAwBAC,YACEA;WOj8CAA;APo8CkCA;;AAElCA;;AAcAA,QACFA,C;IAGAC,WAGEA,OAAOA,wBACTA,C;EAQAC,kBACwBA,MACxBA,C;GAmCAC,YACEA,UAAUA,OACZA,C;EAuYAC,YAIEA;AAAcA;AAYdA,WAAgBA,MAkHlBA;AAjHEA,qBACEA,OAAOA,SAgHXA;AA9GEA,uBAA6CA,QA8G/CA;AA5GEA,wBACEA,OAAOA,qBA2GXA;KA1GSA,qBACLA,QAyGJA;AAhFwCA;AAhBtCA,6CAOoBA;;AACMA,4BAKtBA,mBAEIA,OAAOA,KACCA,KAAsBA,8BAgFxCA;mBA7EUA,OAAOA,KACCA,KAAYA,8BA4E9BA,EAvEEA,2BAI8BA;AACMA;AACFA;AACOA;AACNA;AACOA;AACJA;AACOA;AACNA;AACOA;AAC/BA;AAAbA,WACEA,OAAOA,KAAmBA,UAwDhCA;KAvDwBA;AAAbA;AAMLA,OAAOA,KAAmBA,UAiDhCA,MAhDwBA;AAAbA,YACMA;AADNA,YAEMA;AAFNA,YAGMA;AAHNA,YAIMA;AAJNA,YAKMA;AALNA,YAMMA;AANNA,YAOMA;AAPNA;KAQLA,OAAOA,KAAmBA,UAwChCA,EAlCIA,OAAOA,KAtHTA,mCAwJFA,CA9BEA,iFAEIA,OOxjDEA,UPolDRA;yDApBQA;AAGJA,OAAOA,KO1+DTA,4EP2/DFA,CAbEA,gEAIEA,iDACEA,OO5kDEA,UPolDRA;AADEA,QACFA,C;EAuBWC,YACTA;qBACEA,UAOJA;AALEA,WAAuBA,OAUvBA,WALFA;AAHMA;AAAJA,WAAmBA,QAGrBA;AADEA,sBAMAA,WALFA,C;IA4CAC,sBAEEA,iBAEIA,OAAOA,MAWbA;OATMA,OAAOA,OASbA;OAPMA,OAAOA,SAObA;OALMA,OAAOA,WAKbA;OAHMA,OAAOA,aAGbA,CADEA,Uc1sEAC,gEd2sEFD,C;EAMAE,cACEA;WAAqBA,MAkBvBA;AAhByBA;AAAvBA,OAAkCA,QAgBpCA;kEAF0CA;;AACxCA,QACFA,C;GAmDSC,wBAAWA;AAoBgCA;AAwHlBA;AAhHXA;AAESA,iBAuEWA;kBA2VrCA,gDA0BJA;;;KAzYcA;AACeA;;;;;AAU3BA,OACeA;;AA8COA,IAtCtBA;KAeOA,wBACLA;KAcMA;4FAGNA;;;AAOFA,4BACaA;AAGPA;AAAJA,YAC2BA;OAG3BA;;;;AAaFA,QACFA,C;GAEOC,kBAEDA;AAGJA,sBAEIA,iEAsENA;OA5DMA,mEA4DNA;OAlDMA,uEAkDNA;OAxCMA,2EAwCNA;OA9BMA,+EA8BNA;OApBMA,mFAoBNA;QAVMA,+EAUNA,E;GAIOC,gBACLA;KAAmBA,OAAOA,SAmC5BA;AAhCkDA;AAOpBA;AAFYA;AAApBA;AAEPA;AAAbA,KACEA,OAAOA,cAwBXA;AArBEA,UAE2BA;AAAeA;;AAK9BA;;AA+PRA;AAAJA,YACuBA;OApQrBA,8CAKuBA,gBAa3BA;AAPkBA;AAAeA;;AAA/BA;;AAwPIA;AAAJA,YACuBA;OAxPvBA,iCAIkDA,qBAEpDA,C;GAEOC,kBAEDA;AAkBIA;AACAA;AAfRA,sBAIIA,UAAUA;OAEVA,4EA+ENA;OApEMA,+EAoENA;OAzDMA,mFAyDNA;OA9CMA,uFA8CNA;OAnCMA,2FAmCNA;OAxBMA,+FAwBNA;QAbMA;;kCAaNA,E;GAEOC,cACEA;AAiJHA;AAAJA,YACuBA;OAQnBA;AAAJA,YAC2BA;OAtJqBA;AAOpBA;AAFYA;AAApBA;AAEPA;AAAbA,KACEA,OAAOA,cAuBXA;AArBEA,UAKoBA,8CAAWA,gBAAeA;AACrCA;AAAeA;;AALtBA,8BAoBJA,wDA3IEF,AAuIsBE;AACJA,mDAAWA,gBAAeA;AACrCA;AAAeA;;AALtBA,8BAOFA,C;GAmBFC,wBAEEA,OAAeA,uBAQjBA,C;GAmOAC,YACEA,gCAAsCA,QAExCA;AADEA,UAAUA,iBACZA,C;GAmDKC,cAGHA,UAAUA,OAA+BA,KAAcA,iBACzDA,C;GA2CAC,cACEA;WAG2BA;KAH3BA;KAIEA,QAGJA;AADEA,SACFA,C;GA8GAC,YACMA;AACJA,cAEyCA;AAAvCA,sBACEA,oBAMNA;KAJMA,aAINA,CADEA,MACFA,C;GAEAC,cACEA;WAAmBA,QAcrBA;AAbEA,wBAQEA,QAKJA;AA/BSA,OADWA;AA8BlBA,WAAgCA,QAElCA;AADEA,Oa95EOA,mBb+5ETA,C;GAkFOC,YACLA;AAAUA;AAAVA,YAlHOA;AAoHLA,WACEA,OAAOA,OAKbA;AAHIA,eAGJA,CADEA,OAAkBA,OACpBA,C;GAmDKC,YACHA,UO/wFAA,YPgxFFA,C;GAuDOC,YAELA,4BACFA,C;Ea/yGOC;AAILA,QACFA,C;EAMAC,YACEA,WAAoBA,MAGtBA;AADEA,YACFA,C;GAGAC,gBAGEA,OAAOA,WAD2CA,QAClBA,OAClCA,C;GASAC,kBAVSA,iBAD2CA,QAClBA;AAchCA,wBACFA,C;GASAC,gBAxBSA,iBAD2CA,QAClBA;AA0BhCA,wBACFA,C;EAQAC,cACYA;AACVA,wBACFA,C;GAoBOC,YACLA,OAAOA,WACTA,C;EAEOC,cACLA;WACEA,eAiCJA;AA/BEA,UACEA,YA8BJA;AA5BEA,wDAEEA,OArBiBA,uBACCA,WA8CtBA;AAxBEA,wBAEEA,OAAOA,mBAsBXA;AApBEA,UACEA,eAmBJA;AAjBEA,wBAEEA,6BACEA,kCAAmCA,MAczCA;AAZ4CA;AAAOA;AAArCA,4BAAcA;AAAxBA,OAAUA,SAYdA,CAVEA,eAEEA,OAAOA,SAQXA;AANEA,mBAEEA,kBAAmBA,kCAIvBA;AADEA,4BACFA,C;GAaOC,cACEA;AAIPA,kBAQeA;AANbA,YAC2BA;YAEWA;AAEVA;AAC5BA,2BACEA;AAKFA,mCACEA;AACgDA;AAAOA;AAArCA,sBAAcA;AAAhCA;AAEeA;AACfA,oBAEoBA,wBAGtBA,YAoEQA;OA1DSA;AAQnBA,gBAEuBA;AAArBA;AAEmBA,qBAUnBA;AAAmBA,KAFrBA,eAIuBA;AAFrBA;AAEAA;AAEmBA,eAGnBA,OAMFA,iBAIkCA;AAFhCA;AAEoBA,kCAApBA;AAEmBA,uBAEGA,QAGtBA,OAGFA;AASAA,wBACFA,C;GAWOC,gBACLA;WAAmBA,QAerBA;AEqMEA;AF/MAA,8CEiPEC;AF7OID;AAAJA;AAGaA,gBAEfA,UAAUA,UACZA,C;EAyDAE,cACEA,WAA0BA,QAiB5BA;AAbMA;AAAJA,WAA0BA,MAa5BA;AAZEA,wDAKEA,QAOJA;AALEA,wBAEEA,sBAGJA;AADEA,QACFA,C;EAcKC,kBACHA;WAAoBA,QAYtBA;AAXkBA;AAIEA;AAGlBA,cAAwBA,QAI1BA;AADEA,OAmDOA,KAAYA,wBAlDrBA,C;GAaOC,kBACLA,WAAoBA,QAItBA;AAHMA,gBAAgDA,QAGtDA;AADEA,UAAUA,+EAAgCA,CARtCA,qBAlIGC,yCA2ITD,C;GA+CKE,kBAEHA;WAAeA,QAsBjBA;AArBEA;AAEEA,gBACOA,0BACHA,QAiBRA;AAdIA,QAcJA;AANEA,gBACOA,uBACHA,QAINA;AADEA,QACFA,C;GAMAC,gBAIEA,iBApbOA,IAibWA,YAlbgCA,QAClBA,QAqblCA,C;GAsCKC,YACHA;uBAGEA,QAQJA;AANEA,oBAGiCA;AAD/BA,0EACIA,OAGRA,CADEA,QACFA,C;GAsBKC,cACHA;WAAeA,0EAzDuBA,OA0FxCA;AAhCEA,gDAAkBA,QAgCpBA;AA/BEA,uBACEA,mBAUMA,mCAA6CA,QAoBvDA;AAjBIA,eACEA,OAAOA,SAgBbA,CAZoBA;AAERA;AACVA,YAK8BA;;AAGbA,IAAjBA,OAsCOA,kBArCTA,C;GAGOC,cACkBA,uBACrBA,UAAUA,OAAgCA;AAE5CA,QACFA,C;EAgCKC,kBAEHA;SAAuBA,QAmGzBA;AAhGEA,gDAAkBA,QAgGpBA;AA9FEA,UAAuCA,QA8FzCA;AA3FEA,iDACEA,uBAGEA,QAuFNA;AArFIA,mBAGEA,OAAOA,kCAkFbA;AAhFIA,QAgFJA,CA1EEA,uBAEEA,QAwEJA;AAtEEA,uBAAuCA,QAsEzCA;AApEEA,uBAAmBA,QAoErBA;AAlEEA,eACEA,OAAOA,aAiEXA;AA9DEA,eAGEA,2BA2DJA;AA8TeA;AArWaA;AAb1BA,oBAM2CA;AAHzCA,mBAGEA,OAAOA,kCA8CbA;KA7CeA,gBAETA,QA2CNA;KAvCMA,8BAEEA,QAqCRA;AAhCuCA;AAAXA;AAItBA,OAAOA,yEA4BbA,EA8TeA;AA/UMA;AAAnBA,UAEiCA;AAA/BA,4BACEA,QAcNA;2BADMA;AALJA,MACEA,QAKJA;;;AAFEA,OAvSOA,KAAYA,eAySrBA,C;GAQKC,kBAAkBA;AAErBA,kBAA4BA,QA2F9BA;AApFEA,kBACEA,oBAAqCA,QAmFzCA;AAhFuCA;AACAA;AACnCA,uBAA8CA,QA8ElDA,MAxESA,iBACLA,QAuEJA;AAlEOA,yBAAkDA,QAkEzDA;AAtDuBA;AACAA;AAGjBA;AAEAA;AAEAA;AAAiBA;AAIAA;AACAA;AALrBA,OAEEA,QA4CJA;AA1CEA,WAGEA,QAuCJA;AAlCEA,gBACOA,uBAEHA,QA+BNA;AAxBEA,wBACOA,uBAEHA,QAqBNA;AAfEA,oBACOA,uBAEHA,QAYNA;AAHMA;AADAA;AAAJA,WAA8BA,QAIhCA;AAHEA,WAA8BA,QAGhCA;AAFEA,OAAOA,aAETA,C;GAEKC,kBAA2BA;;AAO9BA,4BACaA;oCAETA,QAONA;AAHSA,uBAAsCA,QAG/CA,CADEA,QACFA,C;GG70BKC,qGAQLA,C;GA8EAC,YAAyBA;AAEVA;AAKTA;AAAJA;AAAoBA,UAkEtBA,CAhEMA;AAAJA,WAAyBA,QAgE3BA;AA3DMA;AAAJA,YACQA;AACNA,YAGMA;AAAJA;AAAoBA,UAsD1BA,CApDUA;AAAJA,WAAyBA,QAoD/BA;6BA9CEA,WAQEA,MAsCJA;AA9BoCA;AAD9BA;AAAJA,YACWA;;;AAETA,UA4BJA,CAzBEA;AAEEA,QAuBJA,CApBEA,YACyBA;sBjBzIrBC;AiByIFD,UAmBJA,CAhBEA,WACEA,OAAOA,SAeXA;AAZEA,WAEEA,UAAUA;AAKZA,4BACyBA;sBjBxJrBC;AiBwJFD,UAIJA,MAFIA,OAAOA,SAEXA,C;GAYAE,cAE+CA;yDAAhCA;AAEbA,QACFA,C;GAEAC,YAGEA,OAAOA,wBACTA,C;GAEAC,gBACMA;AAEJA,2BACEA,OAAOA,OAIXA;KAFIA,OAAOA,mBAEXA,C;GAiBKC,WACHA,aAAoCA,MAGtCA;;AADEA,MACFA,C;GAGKC,WAA0BA;;;AAI7BA;AAMiEA;;AAEjEA;;AAGEA,wBACYA;AACEA;AACZA,YAEeA;AACbA;iBAYNA,wBAEyCA;yBAEQA;;;;;YAOnDA,C;GAqCKC,WAECA;AAKgEA;AAY5DA,UAJAA,QAFAA,QADAA,QADAA,QADAA,QAHAA,IAAsBA;AAoB9BA,2DAE2CA;AAAzCA,wBAGyCA;AAAzCA,wBACEA,wBAE2CA;AAAzCA,wBAoBkBA;;;AATPA;AAEbA;AAEAA,gBACNA,C;EAEAC,cAEEA,OAAwBA,OAC1BA,C;GCvLAC,kBAGQA;AAAJA,OAAeA,QAcnBA;AAZIA,OAAOA,sBAYXA,C;GAcOC,kBAEDA;AAEKA;AAAmBA;AAA5BA,YACFA,C;;;EL3OcC,gBAAkBA,OAAIA,sCAA4BA,C;GACrDC,YAAWA,wBAAWA,C;EAIxBC,YAAcA,OAAQA,UAAiBA,C;EAMhCC,gBAAqBA,aAAoBA,C;;;GAgD/CC,YAAUA,aAA4BA,C;EAOzCC,YACHA,uBAAoBA,QAGtBA;AAFEA,mBAAwBA,QAE1BA;AADEA,+BACFA,C;EAEWC,cACJA,cAAkBA,MAEzBA;AADEA,iBACFA,C;GAGAC,YAAeA,gBAAgCA,C;EAE1CC,cAICA;;AACJA,4BACYA;AACVA,OAAOA,YAEXA,C;GAEgBC,YACdA,OA4BFA,eA5BaA,aACbA,C;;GA6BgBC,YAAYA;OXuhB5B/J,sBWvhBoD+J,C;GAE5CC,YAAUA,sBAAsBA,C;;IZ+J7BC,WACyBA;AAAPA,QAE7BA,C;IAiBSC,WACPA;cAAcA,UAShBA;AAPMA;AAAkBA;AACtBA,SAAwBA,UAM1BA;AClQwCA;AD8PtCA,iBACWA,8BAAUA;AAAnBA;;AAEFA,QACFA,C;IAEyBC,WACvBA;cAAgBA,UAWlBA;AAV2BA;AAAoBA;AAEzCA;AAAkBA;AACtBA,SAA6BA,UAO/BA;AANgBA;AkBxUhBC;AlByUED,iBACyCA,8BAAmBA;AAAnBA;AACxBA;AAAXA,mCAAUA;AADdA,MW1QEA,kBX6QJA,OY/WFA,oBZgXAA,C;;GA2FIE,YACFA;AAAIA,mCAAUA;AAAdA,OAAwCA,MAG1CA;AAFEA,oBAEFA,C;;GApDQC,YACDA;AACDA;AAAJA,WAAkBA,MAsBpBA;AArBiBA;AAIkCA;AAKAA;AAIjDA,OAzBFA,gDAiCAA,C;;GA8nB2BC;AACHA;AAClBA;AACAA,oBAEDA,C;;EA6qBLC,YACMA;qBAEAA;AAAJA,WAAmBA,MAmBrBA;AAhBqCA;AAD/BA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAIAA,QACFA,C;;EAwBOC,YAAcA;AAcYA,qCAMoCA;AAC/DA;AAAJA,WAA2BA;AA2BvBA;AAAWA;AAAeA;AAAMA;AAAQA;AAD5CA,OArHFA,mRAsHwDA,4EACxDA,C;GAMcC,YAmDZA,OAA8BA;mEAChCA,C;GAkCcC,YASZA,OAA8BA,mEAChCA,C;;EAsCOC,YACLA;WAAqBA,4BAA4BA,WAEnDA;AADEA,4DACFA,C;;GANAC,sDACgEA,C;;EAkBzDC,YACLA;AAAIA;AAAJA,WAAqBA,4BAA4BA,WAMnDA;AALMA;AAAJA,WACEA,uDAA0DA,eAI9DA;AAFEA,kEACoDA,eACtDA,C;;GAZAC,cAAmBA;AACHA;;AADhBA,sCAGuEA,C;;EAiBhEC,YAAcA;uCAA+CA,C;;;GAwBpEC,YACYA,gBAERA,0BAC6CA;AAG/CA,QACFA,C;;EA6JOC,YACLA;AAAIA;AAAJA,WAAoBA,QAQtBA;AAL+BA;AAIZA;;AAAVA;AAAPA,QACFA,C;;;EA+hBOC,YAILA,kBAHyBA,WAGPA,UACpBA,C;;;;;EAoBOC,YACEA;AAEPA,WAAkBA,wCAEpBA;AADEA,kBAAmBA,WACrBA,C;;EAsBcC,cAAEA,mBAMhBA;AALEA,YAA4BA,QAK9BA;AAJEA,wBAA4BA,QAI9BA;AAHEA,+CAGFA,C;GAEQC,YACFA;AACAA;AAAJA,WAGgCA;KAIDA,6BAICA;AAEhCA,SAAqCA,iBACvCA,C;EAEAC,YACMA;WAA+BA;AAGnCA,kBAAkBA,qCAvkEJA,YAykEhBA,C;;GAGOC,YAAgCA,UAAaA,C;GAK7CC,YAAoCA,UAAiBA,C;GAwB9CC,YACRA;AAnENA;AAoEsBA;AAEpBA,4BACaA;AACXA,YACEA,QAGNA,E;;EA8bOC,YAAcA,aAAOA,C;;GAJ5BC,4CACoCA,kBACtBA,6CAFdA,AAEyEA,C;;EA2ElEC,YAAcA,uBAAgBA,WAAQA,C;;GAD7CC,8BAA0BA,C;;GkB1yGlBC,YAAUA,aAAOA,C;GAChBC,YAAWA,iBAAYA,C;GAGhBC,YACdA,OAwUFA,eAxUaA,aACbA,C;EAMKC,YACHA;wBACgBA;AACdA,WAAqBA,QASzBA;AARIA,OAAOA,YAQXA,MAFWA;AAAPA,QAEJA,E;GAEKC,YACCA;AACJA,WAAkBA,QAGpBA;AADEA,OAAOA,QAgNAA,UADIA,iBA9MbA,C;EAYWC,cACTA;wBACgBA;AACdA,WAAqBA,MAWzBA;AAV6BA;;AACzBA,QASJA,MARSA,2CACMA;AACXA,WAAkBA,MAMtBA;AAL6BA;;AACzBA,QAIJA,MAFIA,OAAOA,UAEXA,C;GAEEC,YACIA;AAAOA;AACXA,WAAkBA,MAMpBA;AA2KSA,YADIA;AA9KCA;AACZA,OAAeA,MAGjBA;AADEA,aACFA,C;EAEcC,gBACZA;wBACgBA;AACdA,YAA0CA;AAArBA,SACrBA,oBACKA,2CACMA;AACXA,YAAiCA;AAAfA,SAClBA,oBAEAA,YAEJA,C;GAEKC,cACCA;AAAOA;AACXA,YAAiCA;AAAfA,SACPA;AACEA;AACbA,WAEEA,aADyBA;KAGbA;AACZA,QAEOA;YAEoBA,cAI/BA,C;GAkCKC,YACHA,aACsCA;AAATA;AAARA;AAARA;AAAXA;AACAA;AACAA,UAEJA,C;EAEKC,cACeA;AAAOA;AACLA;KACpBA,UAGEA;AACAA,cACEA,UAAUA;AAEAA,MAEhBA,C;GAEKC,gBACsBA;AACzBA,WACEA,YAA2BA;KAEtBA,KAETA,C;GAWKC,WAKHA,wBACFA,C;GAGkBC,cACEA;AA+IpBA;AA9IEA,iBACWA;AAATA,cAEyBA;AACpBA;AACQA;AAAbA;AAGFA;AACAA,QACFA,C;GAiCIC,YAIFA,OAAsCA,gBACxCA,C;GAOIC,cACFA;WAAoBA,QAOtBA;;AALEA,gBAEWA,iBAAuBA,QAGpCA;AADEA,QACFA,C;EAEOC,YAAcA,OAAQA,UAAiBA,C;EAE5BC,cAChBA,WACFA,C;GAEwBC,cACtBA,WACFA,C;GAEKC,sBAGLA,C;GAEKC,yBAELA,C;GAEKC,cAEHA,OADyBA,iBAE3BA,C;GAEAC,WAQiBA;AAAfA;AACAA;AACAA,QACFA,C;;;GAiDQC,YAAUA,eAAYA,C;GACrBC,YAAWA,mBAAiBA,C;GAErBC,YACdA;AAAuCA;AA0BzCA;AACEC;AA3BAD,QACFA,C;EAEKE,cACHA,OAAOA,WACTA,C;;GAyBMC,WAAWA,aAAQA,C;EAEpBC,WACmBA;AAAtBA,gBACEA,UAAUA;KACDA;AAAJA,YACLA;AACAA,QAMJA,MAJIA;AACAA;AACAA,QAEJA,G;;GFbiBC,YAAOA,gBAAoCA,C;;GAExDA,cAAmBA,kBAAmDA,C;;GAEtEA,YAAgBA,gBAAoCA,C;GGjSrDC,YAEHA,OAAWA,8BACbA,C;GCxHKC,YACHA;AAGEA,MAyBJA,CArBEA;AAGEA,MAkBJA,CAdEA,2BACEA,MAaJA;AATEA;AAEEA,MAOJA,4C;ECkyDKC,gBACHA,mBACEA,UAAMA,UAEVA,C;;;GA7mCUC,YAAUA,eAAgCA,C;;;;EA2BlCC,cACdA;AACAA,WACFA,C;EAEcC,gBACZA;MAEFA,C;;;;;;;;EAkBcC,gBACZA;MAEFA,C;;;;;;;EAiGaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;GAoCQC,YAAUA,eAAgCA,C;EAErCC,cACXA;AACAA,WACFA,C;;;GA4CQC,YAAUA,eAAgCA,C;EAErCC,cACXA;AACAA,WACFA,C;;;;;;GCtlCgBC,WAA4BA;AAA5BA;AAEdA,gCACEA,OAAOA,MAiCXA;AA/BEA,qDAewDA;;;AAAVA,0BADxCA,IAPYA;AAUhBA,OAAOA,eAcXA,MALSA,2BACLA,OAAOA,MAIXA;AADEA,OAAOA,MACTA,C;IAEYC,mCAMNA,IALYA,eAMlBA,C;IAEYC,8BAMNA,IALYA,eAMlBA,C;IAEYC,YAoBCA,SAlBbA,C;GAwIWC,YACXA,OAhCAA,SCrJIC,SA8JJC,+BDwBFF,C;GAiBQG,cAENA;AACUA;AACVA,YACFA,C;GAsBQC,cACNA,SACFA,C;GAQQC,cACNA,MACFA,C;GAOQC,cAENA,IACIA,OAAyBA,OAC/BA,C;GASKC,cACMA;AACLA;AAEqBA;AAMdA;AAAXA,WAGEA;KACKA,WACLA;KCnHFA;AAkGEA;AACAA;ADsBAA,kBAEJA,C;GAIkBC;;;AAwBhBA,OAAYA,OAA+BA,YAG7CA,C;GCgZSC,cACUA,mCACfA,OAAOA,OAWXA;AARmBA,gCACRA;AAAPA,QAOJA,CALEA,UAAUA,kIAKZA,C;GCluBKC,WACHA;;AAGwBA;;AACtBA;AACOA,SAEXA,C;IAEKC;IAKDA;;AAIAA,aF3BAA,OAAyBA,GE4BMA,QAGnCA,C;GAQKC,YAtDHA;AAwDAA;;AAEEA,SF3CAA,OAAyBA,GE4CMA,aAGjBA;OAGlBA,C;GAUKC,YACHA;AAAIA;AAAJA,YACEA;AACwBA;AACxBA,MAcJA,CA7FEA;AAkFIA;AAAJA,YACQA;;WAGAA;AACgBA;;AAEtBA,oBAIJA,C;GA2BKC,YACGA;AACNA,YAGEA;AACAA,MAUJA,CAR6CA;AC2uCzCA,gBDpuCkCA,QACtCA,C;GEm6DUC,YAIJA,OCjnCJA,cDinCkCA,C;GDv+B/BC,oBAAwBA;;AAE3BA,KAA+BA,cAKjCA,C;GAIEC,kBACAA;AAASA;AAATA,SAA2BA,OAAOA,MAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;GAEEC,oBAEAA;AAASA;AAATA,SAA2BA,OAAOA,OAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;GAEEC,sBAEAA;AAASA;AAATA,SAA2BA,OAAOA,SAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;EAqBKC,kBAEHA;MAjWEA,MACmCA;AADnCA;AAoWMA,aAEAA,QAKRA,OACFA,C;;IHpnCMC,YACMA;;AAAIA;AACRA;AACAA,MACFA,C;;GAMOC;AAELA;AAI4DA;AACxDA;8CACLA,C;;IASHC,WACEA,WACFA,C;;IAOAC,WACEA,WACFA,C;;GA2CFC,cACEA,gDAQMA,IAPiBA;KASrBA,UAAUA,iCAEdA,C;;GAbAA;;QAaAA,C;;IAXIC,WACEA;;AACKA;AACLA,WACFA,C;;EAkECC,YACHA;UACEA;KACeA,gCACJA;AAAXA,KAAsBA,QAA8BA,iBAEpDA,KAAkBA,iBAItBA,C;EAEKC,cACHA,UACEA;KAEAA,KAAkBA,mBAItBA,C;;GAdsBC,WAChBA,kBACDA,C;;GAQiBC,WAChBA,yBACDA,C;;GA2FDC,YAAYA,qBAA+CA,C;;IAEtCA,cAGvBA,YtBssDFA,csBrsDCA,C;;GA2C0CC,yBAE1CA,C;;;GCpVIC,yBhBqGLC;AgBnGED,gBAA0BA,UAAUA;AACNA;AAK9BA,WACFA,C,CATKE,kC;;EAmBAC,YACHA;WAA0BA,UAAUA;AACpCA,MACFA,C;GAHKC,+B;EAKAC,cACHA,cACFA,C;;GAIKC,YACHA;WAA0BA,UAAUA;AACpCA,OACFA,C,CAHKC,+B;EAKAC,cACHA,aACFA,C;;GAyEKC,YACHA,cAAmBA,QAErBA;AADEA,OAAOA,uBACTA,C;GAEYC,YAAWA;AAEIA;AA1CFA;AA6CLA,mCAChBA,OAAOA,eAMXA;KAFIA,OAAOA,WAEXA,C;;GA4FUC,gBACHA;AACLA,YACMA;AACJA,WAIYA,YAGdA,OAAOA,cACTA,C;GAZUC,uC;GAeAC,gBA/CVA;AAkDEA,QA/KFA;AAgLEA,QACFA,C;GAsEKC,YAAYA;AArGWA;AAuG1BA,SACWA;AACTA,cAEAA,UApCKA;AArEeA;AA8GlBA,QACEA;AACAA,MAURA,CA3BEA;AACAA,WAsBEA;;AE4hCFA,gBF5hC0BA,kBAI5BA,C;GAEKC,YACHA;AADGA;;AACHA,WAAuBA,MA6BzBA;AA5J4BA;AAgI1BA,SACsCA;AACpCA;AACAA,YAEEA,2BAGOA,YAGTA,UApEKA;AArEeA;AA8IlBA,QACEA;AACAA,MAURA,CA3DEA;AACAA,WAqDcA;AACZA;;AE4/BFA,gBF5/B0BA,kBAI5BA,C;EAEgBC,WAIYA;AAC1BA;AACAA,OAAOA,SACTA,C;EAEgBC,YACEA;AAEhBA,gCACiCA;AACvBA,MAIVA,QACFA,C;GA0DKC,YAASA;;AAEFA,wBACEA,uBACRA;KAEAA;KAG0BA;AAvK9BA;AACAA;AAwKEA,YAEJA,C;EAWKC,cAGyBA;AAnL5BC;AE1QFA;AF+bED,WACFA,C;EAEKE,YAAcA;AAaPA,gCACRA;AACAA,MAMJA,CAxOEA;AAqOAA;;AEu3BAA,gBFv3BwBA,iBAG1BA,C;GAEKC,YACHA;AAAUA,+BACRA,YA5OFA;AA+OIA;;AE62BJA,gBF72B4BA,uBAIxBA;AAEFA,MAIJA,CADEA,YACFA,C;GAEKC,cAAmBA;AA3PtBA;AA+PAA;;AE61BAA,gBF71BwBA,mBAG1BA,C;;;GAnIYC,cAAmBA;AA/H7BA;IAsIEA,KAAYA,YAYCA,2BAnBcA;AAuB3BA;AAKAA,KAAkBA,iBAItBA,C;GAIYC,cAAgBA;KAE1BA,aAtJOA;AAyJPA,SAC8BA;AAhI9BA;AACAA;AAiIEA,cAEmCA;AA9NrCA;AACAA;AA+NEA,QAEJA,C;EAuFYC,cACVA;AADUA;;AACVA;AA9ToBA;AAiUlBA,YACEA,MAnQGA;AAqQMA;AAC6BA;AAAkBA;AAD/CA;AE4yBbA,sBFzyBIA,MA2JNA,MAtJIA,mBAGWA;AACTA,WAGmBA;AAAOA;AAQvBA;AACDA;AAKJA;MAvesBA;AAueGA,wBAuGLA;AAvGpBA,MAzecA;AAAOA;AA2enBA,MAAwBA;;AE6OrBA;AAAPA,MACmCA;KFzIbA;AArGlBA;MAGSA;AAC6BA;AAAkBA;AAD/CA;AE0wBbA;AFxwBMA,MA0HRA,CEpa2BA;AF8SrBA;KAmFIA;AAlkBmBA;AAqjBvBA,SA/D+BA,kBAgEHA;KACrBA,MACLA,aA9BsBA,gBA+BDA,UAGrBA,aAzBcA,gBA0BDA;AAKfA;AAIIA;AAAqBA,iBAMrBA,WA1SkBA;AAC1BA;AACOA;AAnEPA;AACAA;AA6WUA;AACAA,cAEAA;AAKJA,MAcRA,EAX8BA;AAxTFA;AAC1BA;AACOA;AAwTAA;AACcA;AADnBA,OA/YFA;AACAA,WAKAA;AACAA,MA+YEA;IAEJA,C;;GA7W4BC,WACtBA,kBACDA,C;;GA8BuBC,WACtBA,oBACDA,C;;GAoCWC;AAjIdA;AAuIIA,OACDA,C;;IAKYA,cAEXA,aACDA,C,CAHYC,mC;;GASKD,WAChBA,uBACDA,C;;GAwEqBE;AACtBA;AAhC0BA;AAjL5BC;AACAA;AAkLAD,QA+BCA,C;;GAQ2BE,WACtBA,mBACDA,C;;GAcmBC,WACtBA,uBACDA,C;;GA6DGC,WAA+BA;;IAQVA;AA3clBA,yBAmc4BA;AAS3BA;AACAA,WAAwCA;AAAOA;AAA/BA;AAAhBA;;KACEA;KExjBZA;AF4jBUA;AACAA,MAkBJA,CAhBqBA,iBAtYHA,iCACFA;AA+DbA;AA0UKA,OAGFA,MASNA,CAJyBA;;AACEA,SAAoBA;AAC3CA,OAEJA,C;;GAH+CC,YAAOA,aAAcA,C;;GAKpEC,WAAwBA;IAEGA;AAjgBxBA,uCA+fqBA;AAGpBA;;AEplBVA;AFslBUA,OAEJA,C;;GAEAC,WAAgBA;IAEDA;AACPA;;AAEqBA;AACvBA,iBANUA;AAQZA;AAzWDA;AA0W6BA;AAAOA;;AAAnCA,yBACEA;KEpmBZA;AFwmBUA,OAEJA,C;;;;;;EExmBCC,YAAcA,OAAEA,WAAMA,C;;;;GAwiCEC;;AAC7BA;YlB/9BFA;AkB+9BEA;;AACIA;AAAJA,WAAwBA;AHzYlBA;AACyBA;OG0YhCA,C;;GAyLIC,YAAUA;IAEXA,cACEA;AACAA,MAMNA,CAJIA,gCANWA;AAOXA;AA4DFA,yBAzDFA,C;GAEKC,cAAkBA;IAEnBA,cACEA;AACAA,MAMNA,CAJIA,kCANmBA;AAOnBA;AAgDFA,yBA7CFA,C;GAVKC,uC;GAwBWC,YACdA,OAAOA,gBACTA,C;GAFgBC,mC;GAaAC,YACdA,OAAOA,gBACTA,C;GAEiBC,cACfA,OAAOA,kBACTA,C;GAmBEC,YACAA,aAAyCA,OAAOA,MAElDA;AADEA,OAAOA,sBACTA,C;GAHEC,mC;GAKAC,cACAA,aAAyCA,OAAOA,OAElDA;AADEA,OAAOA,wBACTA,C;GAHEC,4C;GAKAC,gBACAA,aAAyCA,OAAOA,SAElDA;AADEA,OAAOA,0BACTA,C;GAHEC,qD;GAS4BC,YAE1BA,QAACA,C;GAFyBC,6C;;GAxDrBC,WAAMA,OAAKA,iBAASA,C;;GAapBC,WAAMA,OAAKA,iBAAaA,C;;IAIxBC,YAASA,OAAKA,mBAAuBA,C;GAArCC,+C;GG9yCDC,oBAMFA,WACEA,OAgDRA,iBA3BAA;AAnBiBA;AAkBfA,OAAWA,eACbA,C;GA6bQC,oBAOAA,OVhdR5K,mBUqeA4K,C;GAeQC,cACNA,OVrfF7K,mBUsfA6K,C;GAOOC,WAAgBA,OV7fvBA,yBU6f4CA,C;GAuPpCC,kBAMFA,WACEA,OAiDRA,eA5BAA;AAnBiBA;AAkBfA,OAAWA,aACbA,C;ICjzBEC,YAAuBA,OAAEA,MAAQA,C;GC8NrBC,gBAEZA;AAAIA,YACFA,oBAEEA,aAgBNA;AAdIA,gBAcJA,CAZ+BA;AAC7BA;;IAEEA,kBAGAA,+BAAkBA;AAAlBA,QfkUUA;AehUZA,6BAIFA,C;GAccC,gBAEZA;AAAIA,WACFA,gBAYJA;Af8QAA;AevREA;;IAEEA;AfsSFA,KAAYA,KAAUA,wBenSpBA,+BAAkBA;AAAlBA,QAEFA;AfkTA1N,KAA6CA;AAHD0N;Ae9S5CA,6BACFA,C;GAOGC,YACHA;QAAoBA,oBAApBA,IACEA,YAAwCA,QAG5CA;AADEA,QACFA,C;GAKKC,cAOOA;AAkBaA;AAGhBA;AAAwBA;AAA/BA;AACOA,UAAeA,MAoFxBA;AAnFwBA;AACpBA;AACAA,cACAA,IAUGA,WACHA,QAAoCA,MAqExCA;AApEqBA,+BAAMA;AAANA;AACGA,+BAAMA;AAANA,eAEHA,SACjBA;AACKA,WACHA,SACEA,OAAYA;AACZA,MA4DRA,CA1DyBA;AACCA,+BAAMA;AAANA;AACpBA,mBAEcA,SACdA;KAGOA,MAAPA,SAEgBA,SACdA;AACAA,UAQEA;AAEYA,+BAAMA;AAANA,oBACVA,IAEFA;AACAA,MAgCVA,EA7B4BA;AACHA;AACnBA,wBAOJA,iBAEEA;;AAMFA;AACYA,+BAAMA;AAANA;AACVA,YAEEA;SAGJA,WACEA;AAEFA;AACAA,SACFA,C;GCpYgBC,YAEZA;AAFYA;AAERA,WACFA,aAwBJA;AhBqfAA;IgBxgBIA,OAAkBA;AAClBA;AhByiBF7N,KAA6CA;AgBxiBtC6N;AACLA,MAAUA;AASVA;AhB8hBF7N,KAA6CA,oBgB3hB3C6N;+BAAkBA;AAAlBA,QhBwhB0CA;AgBrhB5CA,6BACFA,C;GA0BYC,gBACDA;A9BqnBX1V;AK5XAsD,aAEyBA;AyBxPLoS;AACEA;AAEpBA;AACEA;AACaA;AACEA,QAGjBA,QACEA,UAAUA,2CAEdA,C;;GHTQC,YAAUA,aAAOA,C;GAChBC,YAAWA,iBAAYA,C;GAGhBC,YACdA,OAmWFA,eAnWaA,aACbA,C;EAMKC,YACHA;yCACgBA;AACdA,4BAOJA,MANSA,2CACMA;AACXA,4BAIJA,MAFIA,OAAOA,UAEXA,C;SAEKC,YACCA;AACJA,WAAkBA,QAGpBA;AADEA,OAAOA,OADMA,iBAEfA,C;EAYWC,cACTA;yCACgBA;AAC8BA;AAA5CA,QAOJA,MANSA,2CACMA;AAC8BA;AAAzCA,QAIJA,MAFIA,OAAOA,UAEXA,C;SAEEC,YACIA;AAAOA;AACXA,WAAkBA,MAIpBA;AAHeA;AACDA;AACZA,sBACFA,C;EAEcC,gBACZA;yCACgBA;AACdA,YAA0CA;AAArBA,SACrBA,oBACKA,2CACMA;AACXA,YAAiCA;AAAfA,SAClBA,oBAEAA,YAEJA,C;SAEKC,cACCA;AAAOA;AACXA,YAAiCA;AAAfA,SACPA;AAEPA;AAAJA,YACEA;AAEAA,iBAEYA;AACZA;;AAKEA,aAGNA,C;EAyCKC,cACEA;AAAOA;AACZA,4BAESA;AAAPA,OAAgBA;AAChBA,cACEA,UAAUA,WAGhBA,C;GAEKC,WACHA;AAAIA;AAAJA,WAAmBA,QAgDrBA;AA/CoBA;;AAIJA;AACdA,YAEsCA;;AACpCA,qBAEwCA,UACtCA;AAKOA;AACXA,YAEsCA;;AACpCA,iBAIwCA,WACtCA,KAKOA;AACXA,YAEsCA;;AACpCA,iBAGqCA;;AACnCA,kBAEwCA,UACtCA,MAKCA;AAAPA,QACFA,C;GAEKC,gBACHA;AAEEA,YAEFA,WACFA,C;EAyBIC,YAIFA,OAAsCA,gBACxCA,C;EAmCKC,cAEHA,SADWA,UAEbA,C;EAEIC,cACFA;WAAoBA,QAMtBA;;AAJEA,iBACMA,eAAqCA,QAG7CA;AADEA,QACFA,C;;GArCOC,cACDA;AAGJA,mBACFA,C;GAEYC,gBAIVA;WAQFA,C;GAoBOC,WAQUA;AAAfA;;AAEAA,QACFA,C;;EA6BWC,cACJA,iBAAgBA,MAEvBA;AADEA,OAAaA,UACfA,C;EAEcC,gBACNA,YACRA,C;EAEKC,YACEA,iBAAgBA,QAEvBA;AADEA,OAAaA,UACfA,C;EAOIC,YAIFA,OAAkCA,sBACpCA,C;EAEIC,cACFA;WAAoBA,QAMtBA;;AAJEA,0BACMA,gBAA4CA,QAGpDA;AADEA,QACFA,C;;GApCAC,wCACmDA,oBADnDA,AACiEA,C;;GAAdC,YAAOA,OAAEA,cAAIA,C;;GA0CxDC,YAAUA,eAAYA,C;GACrBC,YAAWA,mBAAiBA,C;GAErBC,YACdA;OAwBFA,WAxB0CA,SAC1CA,C;EAEKC,cACHA,OAAOA,WACTA,C;;GAqBMC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAAOA;AACEA;AACmBA;AAAhCA,WACEA,UAAUA;KACLA,gBACLA;AACAA,QASJA,MAPIA;AAIAA;AACAA,QAEJA,E;;GA+WgBC,YACdA,OAgUFA,cAhUuCA,YACvCA,C;GAEQC,YAAUA,aAAOA,C;GAChBC,YAAWA,iBAAYA,C;EAG3BC,cACHA;yCACgBA;AACdA,4BAOJA,MANSA,2CACMA;AACXA,4BAIJA,MAFIA,OAAOA,UAEXA,C;SAEKC,YACCA;AACJA,WAAkBA,QAGpBA;AADEA,OAAOA,OADMA,iBAEfA,C;EAmBKC,cACHA;yCACgBA;AACdA,YAA0CA;AAArBA,SACrBA,OAAOA,YAQXA,MAPSA,2CACMA;AACXA,YAAiCA;AAAfA,SAClBA,OAAOA,YAIXA,MAFIA,OAAOA,UAEXA,C;SAEKC,YACCA;AAAOA;AACXA,YAAiCA;AAAfA,SACPA;AAEPA;AAAJA,WAsJmCA;KAnJrBA,kBACIA,QAMpBA;;AAFEA;AACAA,QACFA,C;GAQKC,cACHA,wCACEA,OAAOA,iBAMXA;KALSA,0CACLA,OAAOA,iBAIXA;KAFIA,OAAOA,UAEXA,C;SAEKC,YACCA;AAAOA;AACXA,WAAkBA,QAYpBA;AAXeA;AACDA;AACZA,OAAeA,QASjBA;AALEA;;AAIAA,QACFA,C;GASKC,WACHA;AAAIA;AAAJA,WAAuBA,QA+CzBA;AA9CoBA;;AAIJA;AACdA,YAEsCA;;AACpCA,qBAEwCA,UACtCA;AAKOA;AACXA,YAEsCA;;AACpCA,iBAIwCA,WACtCA,KAKOA;AACXA,YAEsCA;;AACpCA,iBAGqCA;;AACnCA,2BAEEA,MAKCA;AAAPA,QACFA,C;GAEKC,cACHA,cAAoCA,QAKtCA;AA2CqCA;AA7CnCA;AACAA,QACFA,C;GAEKC,cACHA;AAGEA;AACAA,QAIJA,MAFIA,QAEJA,C;EAcIC,YAKFA,OAA0CA,gBAC5CA,C;EAmBKC,cAEHA,SADWA,UAEbA,C;EAEIC,cACFA;WAAoBA,QAMtBA;;AAJEA,gBACMA,eAAyCA,QAGjDA;AADEA,QACFA,C;;GAEOC,WAQUA;;;AAEfA,QACFA,C;;EAkCIC,cACFA;WAAoBA,QAMtBA;;AAJEA;AACMA,kBAAkDA,QAG1DA,CADEA,QACFA,C;EAEIC,YAKFA,OAAkCA,sBACpCA,C;EAEKC,cAAiBA,OAAMA,UAAYA,C;EAEnCC,cACEA,iBAAmBA,QAE1BA;AADEA,OAAaA,UACfA,C;GAOKC,cACEA,iBAAmBA,QAE1BA;AADEA,OAAaA,UACfA,C;;GAtCAC,sCACmDA,kBADnDA,AACiEA,C;;GAAdC,YAAOA,OAAEA,cAAIA,C;;GAiD1DC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAAWA;AACFA;AACuBA;AAApCA,WACEA,UAAUA;KACLA,gBACLA;AACAA,QASJA,MAPIA;AAIAA;AACAA,QAEJA,E;;;GE1kCQC,YAAOA;AE4pBiBA;AArHhCC,gBA7H6DC;AA2B3DA;AFjcAF,QAAOA,OACLA;AAEFA,QACFA,C;GAESG,YEkpBuBA;AArHhCF,gBA7H6DC;AA2B3DA;AF3bkBC,OAACA,KAAmBA,C;EAkGjCC,YAAcA,OAAaA,kBAAqCA,C;;G5B1JvDC,YAAYA,OI6Q5BA,WAEyBA,aJ/Q4BA,C;EAEnDC,cAAwBA,OAAIA,WAAOA,C;GAe5BC,YAAWA,qBAAWA,C;IAEtBC,YAAcA,OAFHA,cAEWA,C;GAqQ1BC,cACEA,SACPA,C;EAwBiBC,cACXA;AAAYA;AAAIA,SAAeA,iBAAeA;AAC1BA;AAAxBA;AACAA;AACAA,QACFA,C;EAyKOC,YAAcA,OAAaA,eAAoCA,C;;;G6BvfxDC,cACRA;;QhB2gBWA;AgBxgBXA;AACAA;AhBugBWA;AA2BfnS;AA3BemS,WgBpgBZA,C;;EA8EOC,gBAAkBA,OAAIA,kDAA4BA,C;EACzDC,cACHA;AAAcA,sBAAdA;AACEA,OAAgBA,aAEpBA,C;EAmEKC,YAA2BA,qBAAKA,MAAaA,C;GAC1CC,YAAUA;OAAKA,OAAMA,C;GACpBC,YAAWA;OAAKA,OAAOA,C;EAGzBC,YAAcA,OAAQA,UAAiBA,C;;;EA8EhCC,gBACZA,UAAUA,sCACZA,C;;EAuDYC,gBAAkBA,sBAAmBA,C;EACtCC,cAAkBA,oBAASA,C;EAcjCC,YAA2BA,kBAAqBA,C;EAEhDC,cACHA,aACFA,C;GAESC,YAAWA;OAAKA,OAAOA,C;GAExBC,YAAUA;OAAKA,OAAMA,C;GACbC,YAAQA;OAAKA,OAAIA,C;EAE1BC,YAAcA,kBAAeA,C;;;EAmCxBC,gBACRA,OAHJA,SAGoCA,sBAAoBA,C;;GEmPxCC,YAAYA,OAiT5BA,mCAjT2DA,C;GAUlDC,YAAWA,sBAAcA,C;GAE1BC,YAAUA,yCAAqCA,C;EAkBrDC,cAASA;A1BlXYA;AAErBA,aAEEA,IAAUA;A0BgXLA;AAAiCA;AAAnBA;AAAdA,4BAAMA;AAAbA,WACFA,C;EA0GOC,YAAcA,OAAaA,kBAAoCA,C;;GA4KhEC,WAAWA,aAAQA,C;EAEpBC,WAAQA;AACXA;AAlHAA,gBACEA,IAAUA;AAkHRA;AAAJA,eACEA;AACAA,QAKJA,CAHoBA;;uBAAMA;AAAxBA;AACAA;AACAA,QACFA,C;;GCl5BSC,YAAWA,wBAAWA,C;EA6FxBC,YAAcA,OAAaA,kBAAoCA,C;;;;;GFrDlEC,YACFA;AAAIA;AAAJA,WAAmBA,QAyDrBA;AAnDcA;AAIZA,wBAC0BA;;AA8pBAA;AA7pBpBA,mCAAKA;AAATA,QACcA;AAAZA,YA2CGA;AA3CuBA,MA4pBJA;AA1pBlBA,mCAAKA;AAATA,QAEkCA;AACxBA;AACJA;AAEJA,cAmCCA;AATMA;AA1BmBA,MAGfA,IAAPA;AAEYA;;;SACbA,QACOA;AAAZA,YA4BGA;AA5BwBA,MA6oBLA;AA3oBlBA,mCAAKA;AAATA,QAEqBA;AACXA;AACJA;AAEJA,cAoBCA;AATMA;AAXoBA,MAGhBA,IAARA;AAEaA,WAefA;AAbHA;;KAICA;AACCA;AACEA;AACAA;AACRA;AAEOA;AACAA;AAEPA,QACFA,C;GAMKC,YACEA;AACLA,2BAEUA;AACHA,MAGPA,QACFA,C;GAOKC,YACEA;AACLA,2BAEUA;AACFA,MAGRA,QACFA,C;GAEKC,YACHA;gBAAmBA,MAkBrBA;AAjBaA,kBACIA,MAgBjBA;AAfgBA;AAGJA;AAAVA,WACEA;KAEmBA;AAEXA;AAARA;AAGMA;AAGRA,QACFA,C;GAQKC,cAAWA;AAGVA;AAAJA,YACEA;AACAA,MAaJA,CAVMA,mCAAKA;AAATA,QACOA;AACAA;AACCA,cAEDA;AACAA;AACCA,SAERA,QACFA,C;IAESC,WACHA;AAAJA,WAAmBA,MAGrBA;AAFUA;AAARA;AACAA,QACFA,C;;GA0VMC,WACAA;AAAJA,WAA0BA,MAE5BA;AADEA,UACFA,C;EAEKC,YACHA;uBACEA;AACYA,MAEhBA,C;EAsBKC,WACHA;AAA0BA;AAA1BA,gBACEA,UAAUA;AAORA;AAAJA,iBACEA;AACAA,QAQJA,CANEA,+BACmBA;A/BxXnBC;A+BiWAD,WACEA;KAEAA;AACAA,eAqBaA,+BAAUA;AAAVA;AAAfA;AACAA;AACAA,QACFA,C;;;;GAmJgB7C,YArHhBA,oBA7H6DC,cAkP7BD;AAvN9BC;AAuN0BD,QAAkCA,C;GAEtD+C,YAAUA,aAAMA,C;GACfC,YAAWA,mBAAaA,C;EAwB5BC,cACWA;AACdA,SAAkBA,QAGpBA;AAFEA,QAhxBFA;AAixBEA,QACFA,C;GAEKC,cACEA,iBAAmBA,QAE1BA;AADEA,OAAOA,gBACTA,C;GAEKC,cACHA;;AACgBA;AACdA,SACEA,QA7xBNA,eAgyBAA,C;EA+EOC,YAAcA,OAAaA,kBAAoCA,C;;;GA7KtEC,gCAlsBAC,iBAosBiCD,sBAFjCA,AAE+CA,C;;GAAdE,YAAOA,OAAEA,cAAIA,C;;;;GGvrBhDC,cACEA;uBAAuBA,UAAMA;ArB8CvBA;6BqB/CEA;ArB+CFA;AqBvCJA,UrBuCIA,uBqBnCGA;AAAPA,QAIJA,C;GAmDAC,YAEEA;WAAoBA,MAyBtBA;AAtBEA,sBACEA,QAqBJA;8CAdIA,OA8BFA,+BAhBFA;AAVEA,uBAO8BA;AAE9BA,QACFA,C;IC8XQC,YAAuCA,aAAeA,C;;ED5WnDC,cACPA;AAuHsBA;AAvHtBA,WACEA,OAAOA,aAQXA;KAPSA,uBACLA,MAMJA;KAHuBA;AACnBA,6BADqCA,YAGzCA,E;GAEQC,YAAUA;;AAA2BA,eAASA;AAApCA,QAAyDA,C;GAElEC,YAAWA,wBAAWA,C;GAGVC,YACnBA;;AAAiBA,OAAoBA,OAEvCA,CADEA,OA8KFA,cA7KAA,C;EAOSC,gBACPA;gBACEA;KACSA,cACOA;;AAEDA;AACfA,yBAoJ8BA,eAhJ9BA,UAAUA,QAEdA,C;EAkBKC,YACHA,gBAAiBA,OAAOA,WAG1BA;AAFEA,uBAAoBA,QAEtBA;AADEA,qDACFA,C;EA6BKC,cACHA;gBAAiBA,OAAOA,aAsB1BA;AArBsBA;AACpBA,wBACeA;AAKMA;AAAnBA,0BACUA;YAKVA;AAIAA,cACEA,UAAUA,WAGhBA,C;EAgBaC,WAECA;AACZA,YACqBA;AAAZA,SAETA,QACFA,C;GAEqBC,WACnBA;gBAAiBA,aA0BnBA;AAtBgCA;AACVA;AACpBA,4BACeA;AACbA,QAAkBA,aAMpBA,SACEA;KlCtDFA;AkC6DYA;AAAZA;AACAA;AAEAA,QACFA,C;GAEAC,YACEA;mDAAmCA,MAGrCA;AAFeA;AACbA,kBACFA,C;;;;GAuBQC,YAAUA;OAAQA,OAAMA,C;EAEzBC,cACLA;aACcA,UAAKA;KACbA;AAAQA,mCAAcA;AAAdA,OAFdA,QAGFA,C;GAKqBC,YACnBA;cACcA;AAAKA,eACbA;AlCmWR3d,yBkCrWE2d,QAGFA,C;EAIKC,cAAwBA,kBAAwBA,C;;;;;;;ECvU9CC,YACkBA;AAOvBA,qIACFA,C;;GAZAC,sCACqCA,C;;EAsB9BC,YAAcA,sCAAgCA,C;;GAiG7CC,cAwVyBA,aAtVHA;AAAPA,QAEvBA,C;GAJQC,mC;GAeDC,cAE2BA;AAyFPA;AAzFAA,QAE3BA,C;GAJOC,mC;IAMSC,WACYA,UAE5BA,C;IAEgBC,WACQA,UAExBA,C;;;;GA6XKC,YACCA;AACaA;AAEAA,+BADjBA,SACiBA;AACfA,QAA0BA;AAC1BA,SACEA,OA0RQA;AAzRCA;ArB1FKC;AqB4FdD,iBrB5FcC;AqB+FVD;OrB/FUC;AqBkGVD;QrBlGUC;AqBqGVD;QrBrGUC;AqBwGVD;QrBxGUC;AqB2GVD;QrB3GUC;;;AqBgHuBD;ArBhHvBC;AqBiHaD;ArBjHbC;AqBkHVD,YAECA,mBACLA,OA8PQA;AA7PCA;ArBtHKC;aqB2HlBD,SrBvCeE;KqByCRF,OAsPKA,eAnPdA,C;GAMKG,YACHA;qCACwBA;AAAtBA,yBACEA,UAnjBNA,uBAsjBEA,SACFA,C;GAgBKC,YAIHA;AAAIA,cAAwBA,MAY9BA;AAXEA;IAEmBA;AACZA,gBACGA,cAAkDA;AAAxDA,aAhBJA;+BAAMA;AAANA,iBAOcA;AAaNA,WACuBA;AAD7BA,aAGJA,C;GAMKC,YACHA;wCACwBA,QA+B1BA;AAuJcA;AApLVA,QA6BJA,MA5BSA,WAuLKA;AArLVA,QA0BJA,MAzBSA,WAoLKA;AAlLVA,QAuBJA,MAtBSA,YAiLKA;AA/KVA,QAoBJA,MAnBSA,wBA8KPA;AAAYA;AA5KVA;AA4KUA;AA1KVA,QAeJA,MAdoBA;AAAXA,YACLA;AACAA;AAlDFA;+BAAMA;AAANA;AAoDEA,QAUJA,MATSA,YACLA;AAEcA;AAxDhBA;+BAAMA;AAANA;AA0DEA,QAIJA,MAFIA,QAEJA,E;GAGKC,YAASA;AAwJZA;AAAYA;AAtJHA,YACKA,8BAAIA;AAAhBA;AACAA,wBAoJUA;AAlJRA,eAkJQA,QA9IdA,C;GAGKC,YACHA;AADGA;AACKA,YA0IIA;AAxIVA,QAwBJA,CAtB8BA;AAATA;;AACfA;AACAA;AACJA,MAAYA;AAOZA,QAAoBA,QAYtBA;AAgHEA;AAAYA;AAzHZA;AAGEA;AAsHUA;AApHeA;AAAbA,uBAAYA;AAAxBA,cAoHUA;AAjHZA,QACFA,C;;GAnBcC,cACVA;uBACEA;AAEFA;;AAAaA;AAACA;AAADA;;AAAbA,uBAAYA;AAAZA;AACaA;AAAbA,uBAAYA;AAAZA,MACDA,C;;IAsHQC,WrB5PmCA;AqB4PjBA,6BAA+CA,C;;GApB9DC,gBACRA;ArBxQNA;AqB2PAC,gBA1QoCC;AAuSlCF;ArBzP4CA;AqB2O5CA,6BACFA,C;GrBhlBcG,YAEZA,oBAAuBA,OAAOA,MAEhCA;AADEA,sBfggBcA,We/fhBA,C;GA0MQC,gBACEA;AAAUA;AAClBA,oBACEA,OADFA;AAGcA,QAEhBA,C;GA0TsBC,WACpBA;AAAIA,UACFA,OAAOA,gBASXA;IAJIA,uBAP0BA;AAQ1BA;AACAA,QAEJA,E;ERhrBcC,YACZA,sDACEA,OAAOA,OAMXA;AAJEA,uBACEA,wBAGJA;AADEA,OAAOA,OACTA,C;G8BuFmBC,oBACfA,O5BoFJA,qB4BpFqCA,C;GCrKlCC,Y5B8BHA,O4BvBFA,C;;GvBunB8BC;AACtBA;;AAASA;AAxFEA;AA2Bf7X;AAgEmB6X;AACfA,QACDA,C;;;;EAhRSC,cAAEA,mBAGQA;AAFpBA,0CAEoBA,C;GAapBC,cACAA,yBAA8CA,C;GwBwF1CC,YAAYA;SAAWA,wBAA2BA,C;EA2EnDC,YACEA;AAAIA,OxBhNcA;AwBiNdA,OxB9MeA;AwB+MfA,OxB5MaA;AwB6MbA,OxB1McA;AwB2MZA,OxBxMcA;AwByMdA,OxBtMcA;AwBuMfA,OxBpMoBA;;AwBuM9BA,QAIJA,C;;GArDcC,YACRA;AAAOA;AAGgBA;AAD3BA,WAAkBA,UAIpBA;AAHEA,UAAiBA,cAGnBA;AAFEA,SAAgBA,eAElBA;AADEA,gBACFA,C;GAUcC,YACZA,UAAcA,UAGhBA;AAFEA,SAAaA,WAEfA;AADEA,YACFA,C;GAEcC,YACZA,SAAaA,UAEfA;AADEA,WACFA,C;;;;;EhC1aOC,YAAcA,sBAAgBA,C;;IAgE1BC,WAAcA,2CAA4CA,C;IAC1DC,WAAqBA,QAAEA,C;EAE3BC,YACEA;AACHA;AAIyBA;AADTA;AAAkCA;AACpCA;AAClBA,WAAgBA,QAKlBA;AAHuBA;AACKA;AAC1BA,iBACFA,C;;GAvDAC,0CAGiBA,C;GAgBjBC,wCAEsBA,C;;IAuLXC,WAAcA,kBAAYA,C;IAC1BC,WAAkBA;AAGvBA;AAAJA,YACMA;AAC0CA,wDAGrCA;AAAJA,WAC0CA;KAC1CA,OAC0BA,gCAAQA;KAKDA,qEAExCA,QACFA,C;;GA3IAC,sEAI0EA,C;GAiB1EC,+DAK4EA,C;GAkEjEC,sBAITA,YAEEA,UAAUA;AAGVA,YAEEA,UAAUA;AAEZA,QAGJA,C;;IAmEWC,WAAcA,kBAAYA,C;IAC1BC,WAAkBA;AAEHA;AACpBA,mCAAaA;AAAjBA,OACEA,oCAMJA;AAJMA;AAAJA,SACEA,8BAGJA;AADEA,sCACFA,C;;GAtBAC,oBAGwCA;AAHxCA,gDAK6DA,C;;EQ4OtDC,YACQA;AADRA;AAnFPA;AAqFSA;AAELA;AArDFnZ;AAuDmBmZ;AACfA,SAIFA,WAAwBA;AASEA;AACAA;AAEqBA;AAA/CA,QAWJA,C;;GA5CAC,8CAOoDA,C;;ERjI7CC,YAAcA,sCAAiCA,C;;EADtDC,8BAA8BA,C;;EAiBvBC,YAAcA;4DAEMA,C;;GAH3BC,8BAAkCA,C;;EAe3BC,YAAcA,0BAAqBA,C;;GAD1CC,8BAAwBA,C;;EAiBjBC,YACLA;WACEA,iDAIJA;AAFEA,mDACaA,UACfA,C;;EARAC,8BAAkDA,C;;EAsB3CC,YAAcA,sBAAgBA,C;;;EAgB9BC,YAAcA;8HAEoDA,C;;EO7iBlEC,YAELA,0BACFA,C;;EA8DOC,YACEA;AACsBA;AAehBA;AA8DXA,QAEJA,C;;;;E0ByFKC,cACHA;2BACMA,OADNA,UACoBA,QAGtBA;AADEA,QACFA,C;GAqJQC,YAAOA;AAGCA;AACdA,QAAOA,OACLA;AAEFA,QACFA,C;GAOSC,YAAWA,OAACA,cAASA,GAAUA,C;EA8MtCC,cAASA;AjCtSTA,OAAeA,IAAUA;AiC0SzBA;AACEA,SAA2BA,QAI/BA,CAHIA,IAEFA,UAAUA,4BACZA,C;EAkBOC,YAAcA,OAAaA,kBAAqCA,C;;;;GzBjlB/DC,YAAYA,OAAMA,gCAAQA,C;E0BnD3BC,YAAcA,YAAMA,C;;;;;E1B8BbC,cAAaA,eAAsBA,C;GAGzCC,YAAYA,OAAWA,UAAoBA,C;EAG5CC,YAAcA,sBf2qBLA,ce3qBiDA,C;GAGzDC,cACNA,UAAUA,UAAmCA,QAC9BA,QAAgCA,cACjDA,C;;;;;;GA0eQC,YAAUA,oBAAgBA,C;EA4B3BC,YAAcA;6BAAmCA,C;G2B9iB/CC,YAAWA,wBAAWA,C;;G3BojBjBC,gBACgBA;AACvBA,UAAqBA,QAa5BA;AAZEA,oBAekDA,OAbVA;MAC7BA,YAYuCA,OAVZA;KAC7BA,OASyCA,UAPVA,QAGxCA,QACFA,C;;G4BkvgB2BC,0BAQrBA;AAAgBA;ApBxohBtBxT;AAzKIyT;AoBuzhBFD;;AAOMA;AA2sjBKA,cA1rjBOA;AA0rjBPA,eAxqjBkBA;AAG3BA;AAKFA,QACFA,C;GA+6YQE;AAEJA,QAGJA,C;GAqhQFC,YACQA,iBACJA,QAGJA;AADEA,OC9xqCIC,mBATGC,QDwyqCTF,C;GA0rBiBG,cAEfA;WAA+BA,QAGjCA;AADEA,OAAYA,SACdA,C;;;EA5r4BSC,YAAcA,gBAA+BA,C;;;;GAgzJ/CC,kBAAiBA,wCACZA,C;;;GA24ELC,sBAAIA,kBAC6CA,C;GADjDC,uC;;;;GAxKeC,YACZA;AAAWA;AAAIA;oCAAOA;AAAtBA;AAQAA;AAEJA;AACEA;AADFA,KACEA;KAEAA,OAEHA,C;;;IAy6DQC,YACTA,iBACEA,eAGJA;AADEA,OAAeA,qBAAkBA,WACnCA,C;EAEOC,YAAcA,gBAA+BA,C;;;;EAsrF7CC,YACEA;AACPA,eAA6BA,YAC/BA,C;;;;GAstaKC,WACHA;AAAIA;AAAJA;iBACEA;;AA1koBFA,KACEA,oBA2koBJA,C;;GA1DAC,kBAIYA,WAAiBA;AAJ7BA;AAKEA;AALFA,QAMAA,C;;IAF6BC,YAAOA,OAAQA,YAAcA,C;GCzjlCrDC,YACDA;ArBqHJ1U;AAzKIyT;OqBqDOiB,IAAuBA,yBAE9BA,IAAuBA;AAE3BA,QACFA,C;;GCuFMC,YACEA;AAASA;AAAOA;AACpBA,iBACoBA;AAAlBA,yBAAqCA,QAKzCA,CAHEA;AACAA;AACAA,QACFA,C;GAiBAC,YACEA;AADFA;AACEA,WAAeA,QAoDjBA;AAnDEA,wBAAeA,QAmDjBA;AAlDEA,uBAAcA,QAkDhBA;AAjDEA,uBAAiBA,QAiDnBA;AA/CEA,sBD7K6CA;ALqVzCC,uBAAJA;KxBrHuDC;AwBqHvDD,KAGEA,IAAUA;AM1KVD,O9B+CJE,c8BDAF,CA3CEA,uBAEEA,UAAUA;AAGZA,qDACEA,OAAOA,OAqCXA;ADrL4CA;ACmJ1CA,mCAGaA;AAlCIA;;uBAAMA;AAANA;AAmCXA;AACJA,WAAkBA,QA6BtBA;AA5BWA;AAAPA;AAnCFA,uBAAMA;AAANA;AAsCEA,UAAkBA;AAClBA,UAwBJA,CArBEA,uBAEsBA;AAATA;AA9CIA;8BAAMA;AAgDjBA;AAAJA,WAAkBA,QAiBtBA;AAfmBA;;AAhDjBA,8BAAMA;AAANA;AAuDIA,kBADFA,SACiBA,8BAACA;AAAhBA,QAAUA,eAEZA,QAMJA,CADEA,QACFA,C;GAEAG,cACOA;AAELA,OADWA,UAEbA,C;;GA/BsBC,cAAgBA;;AAAYA;AAARA;AAAJA,QAAuBA,C;;GDxKxDC,cACHA;;AACEA,aAEJA,C;;IAmBkCC,YAAYA,kBAA0BA,C;;IAE7CA,YAAYA,mBAA+BA,C;GEmjBxEC,YACMA;AACAA;AAAJA,WAAsBA,QAexBA;sFAHoBA;AAAKA;;AAEvBA,QACFA,C;IAqBAC,c9C0mBUC;A8CzmBRD,QACFA,C;GAMEE,YACAA,wBAEEA,QAIJA;KAFIA,OAAOA,OAEXA,C;GCjjBQC,gBACwBA;AAA9BA,OAAYA,6BACdA,C;IAEOC,YACDA;AAAYA;AAChBA,WACEA,UAAMA,8BAAiDA;AAG1CA;;AACEA;AClBeA;AACtBA,S1C8QVC,WyC3PuCD,Y9CmG1BA;A8ClGbA,OE9IAA,WF+IFA,C;IAEeE,YACTA;AAAYA;AxByChB1V;AAzKIyT;AwBiIwBiC;AAC5BA,wBAAqCA,KAAaA,eAG9CA,KAAaA;AAEjBA,QACFA,C;IAEKC,WACIA,wBACTA,C;GAEAC,WACMA;mBADNA,cACMA;;AAAmCA;;AACrBA,OAAgBA;;;AAKpBA;YAAkBA,mDAFVA,+B9C2ETA,a8C5ERA,uBAGSA;OAEkBA,OJ67hBRA,wBI77hBgBA;;;AG9JFC;WHiKlCD,OACAA,OACAA,6BGrKqCC;AA0BvBA,SAAaA;APw/kClBD,KIr2kCTA,aAAkCA,0BAAQA;AAEhDA;AAvBMA,wBAuBNA,C;;;GAlISE,WACDA;AAAJA,iCACEA,OAAOA,OAGXA;AADEA,MACFA,C;GAGKC,YACHA;oCACEA,OAAOA,SAIXA;AADEA,MACFA,C;GAGKC,gBACHA;qCACEA,OAAOA,eAKXA;AADEA,MACFA,C;;;;;IA+DuCC,YAAOA,OA1F9CA,WA0F+DA,C;;IAObC,WAChDA,SAAmBA,aACpBA,C;;IACgBA,YAAOA,gBG7JxBA,SH8JmCA,gBAAqBA,C;;IAW/CC,Y1CtG6CA;A0CsGpCA,O1CrGTA,mB0CqG4CA,C;;GAYjDA,YAAYA,OAAWA,8BAA8BA,C;;GACrDA,WAAMA,YAAgBA,qCAAmBA,C;;IAGzCA,YAAUA,OAAWA,4BAAkBA,gBAAqBA,C;;GAIrCA,YAAWA,iBAA4BA,KH5I9DvC,mBATGC,eGqJqEsC,C;GEpLxDC,WACdA;AAAuBA;AACDA,yBAA1BA;AACEA,QAAYA,SAAeA,MAE7BA,QACFA,C;GAKKC,YACCA;AACsBA,yBAA1BA;AACgBA,WAAeA,GAAaA;AAC1CA,UACEA,QAMNA;KALWA,eAITA,QACFA,C;GAKKC,gBACCA;AAQ4BA,yBAAhCA,UzCwIMvjB,AAsDEA,AA8FAA,AwBrPRsZ,GiBvCAiK;AACuCA,sBAArCA;AACgBA,WACTA,KAA8BA,SAAqBA;AACxDA,UACEA,QAORA;KANaA,gBAKXA,QACFA,C;GEpDKC,YACCA,iBAgBNA,C;GAjBKA,YACCA;mBADDA,cACCA;;AAAwCA,OAAlBA;AACMA;AACKA,gBAArCA;AACcA,OAARA,SAAkBA,UACpBA;AAEaA;AACXA,mBACFA;AAEFA,QAA2CA,KAA1BA;AAEnBA;;AACEA;AACAA;YAAMA,mBAANA;cAfCA;AACCA,wBADDA,C;EDFEC,YAAcA,oCAA6BA,eAAIA,C;;GAHtDC,8BAAiCA,C;IAmB7BC,cACEA;AACmBA;A/C2DyBA,O+C3DzBA,SAA0BA;AAGjDA,eAAwCA,SAC1CA,C;GAEKC,WACCA;AAEAA,OAFaA;AAGjBA;;AACAA,uBACEA,mEACEA,aAGNA,C;EAOaC,cAAmCA,mBA4DhDA,C;GA5DaA,cAAmCA;kBAAnCA,gBAAmCA;6CAC9CA;;;AAKAA;OAAkCA;;OAAPA;;;;;A3BkKMC;;A2BjIdD;+BA3BjBA;iBlBssBeA,IAA2BA;AACrCA;AkBrsBHA;AACEA;AAEaA;AACJA;AAEMA;YAAMA,iBAANA;;AACHA;AACVA,cAAiBA;MACjBA,cxC1CVxG,gBwC2CwBwG;AAEhBA;;W3B5CoBA,IAAUA;AACpCA;A2B6CMA;MAGcA;AACmBA,qBxCnDzCxG;AwCsDQwG;;W3BrDoBA,IAAUA;AACpCA;A2BsDMA;MAEFA;AACAA;AACqBA;AACTA;AACNA,aAAiBA;AACjBA,cxC/DZxG,gBwCgE0BwG;AAEhBA;;W3BjEkBA,IAAUA;AACpCA;A2BkEQA;mBAEFA,WAvCJA;;QA0CAA,KAAQA;;;;;;AAtDoCA;;AAwD5CA,gEAAgEA;AAChEA,cAzD4CA;;;;;OA2D9CA;OA3DWA;;AAAmCA,uBAAnCA,C;GEzBDE,oBAMNA;AANMA;;AAMYA;AACPA;;AACDA;AACAA;AAELA;AAEPA;AnBmhBJA;AASeC;;;AmBzhBGD;AA2BlBA;AACOA,WAA2BA,QAElCA,QACFA,C;IAEKE,cAAwBA,eAAMA,C;;GAjCjCC,YAA2BA;AACzBA;;;AACAA;;AAEAA;AnByxBAC;AAAOA;;AAAPA,uBAAMA;AAANA;AACeA;AAAfA;AACAA,YA8CuBC;;;AACXA;AAAgBA;AAATA;AACnBA;AACAA;AACAA;AACAA;AACAA;AmB90BAF;;AAEqBA;AAArBA;;AACOA,YACHA;AACqBA;AAAgBA;AAArCA,iBC5CJA,QACAA,eD4CaA,aACYA;AAAgBA;AAArCA,iBC9CJA,QACAA,WDgDYA,OAARA,SAAkBA,WACCA;GnBkuBnBA;AAASA;AAAbA,SAAoBA,IAA2BA;AAExBA;AAAOA;AAAfA;AAAfA;AACWA,4BAAMA;AAANA;AACXA;AmBluBIA;AACAA,gBACQA;AACVA,eAEJA,C;GAzBAG,WAAkBA,mCAAlBA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BrDaWC,kBACTA,0BADSA,C,WA2IPC,kBAA6BA,iBAA7BA,C,WC49C0BC,kBAC1BA,IAAeA;0CADWA,C,WAKAC,kBAC1BA,IAAeA;0CADWA,C,WAKAC,kBAC1BA,IAAeA,WADWA,C,WAKAC,kBAC1BA,IA+N2BA;iEAhODA,C,WAKAC,kBAC1BA,IAAeA,aADWA,C,WAKAC,kBAC1BA,IAoO2BA;qEArODA,C,WAKAC,kBAC1BA,IAAeA,WADWA,C,WAKAC,kBAC1BA,IAsP2BA,2DAvPDA,C,WAKAC,kBAC1BA,IAAeA,aADWA,C,WAKAC,kBAC1BA,IA0P2BA,+DA3PDA,C,WsBlrDRC,kBAClBA,MADkBA,C,WQ+PbC,oB,Wf8cNC,4C",
- "x_org_dartlang_dart2js": {
- "minified_names": {
- "global": "h,656,cA,611,bY,657,hi,658,i,143,dt,659,fB,583,J,660,he,132,at,661,r,662,f,663,eg,617,hj,658,hk,658,t,664,b3,665,en,666,d,94,l,138,ex,666,hl,658,ef,667,hm,658,bc,666,ay,616,bj,269,aK,270,bi,271,bh,272,bo,274,bn,266,fd,668,ar,669,fc,522,bV,666,b,115,c,111,z,119,hx,670,aX,671,b2,666,c_,666,ev,672,c5,673,O,541,n,674,M,139,Y,149,C,675,et,676,dk,677,c8,678,aI,679,e_,197,dE,199,af,112,bg,680,ab,681,x,666,D,666,p,117,ap,682,c1,683,ew,554,df,560,b4,684,b_,666,dv,550,E,248,b8,685,cG,116,b7,686,P,687,dn,688,e,689,a8,690,e2,691,bm,147,L,145,ai,91,fC,146,a,692,fZ,246,dy,693,b0,694,bE,685,as,695,cx,137,bR,696,bl,367,fE,368,c6,697,aB,698,aT,118,al,699,bU,502,dG,700,F,701,ff,702,j,703,v,704,ca,705,cF,130,hv,151,aV,706,fI,484,ae,113,dp,707,aL,485,fa,708,b5,709,dS,710,ao,711,bs,142,bX,712,bI,713,d7,666,d8,714,ah,157,av,156,cE,144,aE,666,d6,212,fP,135,cw,133,cz,155,aP,134,w,158,hB,715,q,716,cn,159,ct,153,ho,160,m,717,W,150,eQ,718,bH,67,d9,77,fb,719,bS,720,aS,247,a9,666,cC,528,aY,629,c4,721,aq,722,el,723,ek,724,ed,725,dw,726,b9,558,am,727,h3,141,eX,728,U,286,S,729,aM,282,f4,730,f3,731,f2,732,aJ,733,H,120,aC,734,cm,735,G,736,f5,737,fJ,275,fN,285,cp,284,co,283,eU,738,eV,739,f1,740,fM,741,fO,279,T,742,cq,278,ad,743,ac,744,cb,745,bk,746,fF,276,eD,747,eF,748,X,123,eE,749,fr,666,fq,291,fs,750,eH,751,hf,121,eT,752,eG,753,fj,754,fi,755,f0,756,cd,757,eY,758,eZ,758,f_,758,bw,280,hs,634,bP,666,dq,666,dP,635,ht,640,aN,114,fg,759,cg,760,eO,666,a7,761,bf,762,f9,763,eN,423,eP,764,au,765,ce,766,eL,666,bd,762,be,767,cf,768,f6,769,f7,770,eK,394,eM,771,bD,666,bL,772,bb,666,fV,598,dO,773,ez,774,eb,775,dl,776,e9,777,ak,778,e5,779,e6,780,e8,781,ea,782,e7,783,dm,784,R,785,aG,786,dK,787,dL,788,dM,241,fW,789,fX,789,eW,790,eu,556,a5,791,hq,171,hr,172,fQ,792,fo,793,fw,273,fx,794,fy,794,bt,795,hc,167,hh,162,cy,796,aO,797,aQ,798,cs,799,aR,165,cB,164,bu,0,b1,800,hd,168,h8,169,cD,801,hn,166,V,170,h9,802,ha,802,hb,802,eA,803,fp,804,eB,805,eC,806,eS,807,aF,808,fR,586,eR,596,fk,358,em,481,eo,809,dr,666,an,810,bQ,811,dJ,812,dN,666,fH,813,bW,814,dR,815,a6,816,dd,817,h4,92,bG,818,aW,819,c2,666,eq,820,B,821,bJ,822,dc,823,da,824,a_,825,aD,826,bF,827,db,828,ei,666,eh,214,ee,190,ep,829,fK,830,cr,610,fL,830,fG,612,fA,607,fz,608,e3,831,e1,832,c0,833,e4,834,dB,835,ba,836,bZ,666,dY,837,aa,836,dX,552,dh,838,di,839,eJ,840,c9,841,bM,842,aZ,843,du,844,hp,131,hE,845,u,846,dz,847,dC,848,Q,849,e0,850,a4,851,a1,852,hD,853,bv,854,a2,855,bT,856,dA,857,a3,858,a0,859,eI,860,bO,861,dg,862,dj,863,hP,864,hQ,865,hR,866,hS,867,hV,868,hW,869,hU,870,hT,871,hY,872,hX,873,c7,874,dW,875,b6,876,bq,877,dV,878,K,879,hH,880,hI,881,hJ,882,hK,883,hL,884,hM,885,hN,886,cc,887,er,888,es,889,fv,890,fh,891,f8,892,dx,893,aH,894,ft,895,dT,896,c3,897,ej,898,fl,899,cl,429,de,900,bK,901,dF,902,dI,903,dH,904,fe,905,hA,906,bN,907,ds,908,dQ,909,dU,910,dZ,911,ec,912,ey,913,hG,914,dD,915,hz,916,ch,917,ci,918,cj,919,ck,920,fm,921,fn,922,fu,923,ax,1,hC,924,hg,93,bp,129,hw,136,ic,140,ia,154,ib,161,i_,925,i0,926,i1,927,i8,277,hO,666,i3,364,i4,486,i6,614,i7,615,i2,636,hy,641,hF,642,hZ,928,i9,654,i5,655,cH,864,cI,865,cJ,866,cK,867,cN,868,cO,869,cM,870,cL,871,cQ,872,cP,873,bx,641,aj,654,bz,928,by,642,cR,655,bB,929,y,930,h6,931,h5,932,h7,933,fY,934,k,935,I,936,aw,937,cV,938,ag,939,aA,940,N,941,cY,942,h2,943,o,944,cS,945,h_,946,cX,947,d5,948,fD,949,A,950,h0,951,aU,952,h1,953,cu,954,fS,955,fT,956,fU,957,hu,958,cv,959,Z,960,cT,961,bC,962,bA,963,cU,964,d_,965,d0,966,d2,967,d1,968,cW,969,cZ,970,d4,971,d3,972,br,973,az,974",
- "instance": "b1,975,bV,976,b4,977,b3,978,b_,979,b5,980,b7,666,aZ,981,b0,979,b2,982,b6,983,bO,984,p,985,h,979,aw,986,bB,987,bY,988,ca,989,bS,990,aV,991,a2,992,aX,993,ar,721,bU,994,D,995,ba,996,c8,997,bn,998,ao,999,af,1000,aB,1001,bi,1002,l,1003,q,1004,bg,1005,aS,1006,Y,1007,al,981,C,1008,bG,1009,aj,1010,U,1011,Z,1012,aq,1013,ai,1014,aW,1015,c5,1016,a0,1017,bW,1006,bd,1018,aP,1019,aE,1020,ah,1008,S,1021,a9,1022,bF,1023,bh,1024,ak,1025,bR,1026,ap,1027,cc,1028,T,976,ax,1029,ag,1030,c7,1031,be,1032,at,1033,aI,1034,av,1035,ab,1036,X,1037,K,1038,bj,1039,c6,1040,a5,1011,bz,1041,bt,1042,br,1043,bp,1044,bP,1045,cb,990,a1,984,aQ,1046,aC,1047,a8,1048,W,1049,w,1050,bu,1051,bN,611,R,1052,bL,1053,az,1054,J,1055,a3,1056,bo,1057,aa,1058,bC,987,c_,1027,bm,1059,ac,1060,bD,1061,aF,1062,ay,1063,n,829,G,1064,c0,1065,bM,1066,am,1067,aT,1068,A,1069,bv,1070,P,1034,bQ,1071,b9,1072,by,1073,aK,584,au,1033,N,1074,aA,1075,F,1076,aO,989,bZ,1077,bq,1078,u,1079,b8,1080,V,1081,aN,1082,aH,1083,bT,1084,bc,1085,bs,1042,aM,1086,bI,1087,bJ,1088,j,1089,bb,1090,a4,1091,aJ,1034,aG,1092,as,1093,c3,1094,c2,1056,bk,1095,bA,1096,a_,1097,O,1098,aY,1081,bw,1008,bE,1099,aU,1100,t,611,a7,1101,bl,1102,I,1103,bK,1104,aD,1105,B,1106,an,1107,a6,1108,aL,1109,bx,1073,c1,1065,ae,1110,bf,1111,bH,1112,E,1113,aR,994,ad,1114,c4,1094,bX,988,i,1115,k,1116,L,1117,c9,1118,M,1119,H,1120,v,1121"
- },
- "frames": "uhUAiKoBkmCyB;0NA+BhBCqE;8IA8I8BCW;iuCEnN9BC6C;0BA+GAAuC;wIAsLAC2C;+SAsGAAuC;2HAoE4BCe;yBAcE7csB;qFAO9B2c2C;wJAoBAC8C;mYAtGkBES;s/DK6WiB9csB;wBAIHA4B;qlGGn3BFAS;6YA4DjBAiB;QAEF+ciB;2GAyLqB/ciB;usBHjOFA8B;oxDN4nBXgdK;+uCAuaU9/BAAxzBpB8iBqC,A;2yBA8tCmBmB0B;2GAyCnBAuB;sGAqCcnBa;ovCAkjBfAmC;yFAKKAU;0EAWaA4E;yHASbAU;kFAmCmBAW;4DAGtBAW;0KA4DFAAcjtE8BAgE,A;8Wd81E1BAgD;AAEAA4I;qgDA0M+BidyC;6NAYXAyC;s5BAkGAAyC;AACIC6C;w/BAuhBbCe;2BAElBCmB;+CAqFoBDU;oFA2DjBndY;+MaltGN9gBiC;8CAYYAiC;gQA8CPm+BkC;4rCAyJiBrde;8CAExBsdAEqNACQ,A;iWFvGKC6B;+JAiBWCqBARACAboMCVyC,A,A;iPa1Gf99BI;YAAAAgB;iTA2EkBy+BO;iQAgCfCkB;+hBAwFOCuD;qUAgCAAuD;mKAoBPLoB;4pDGvkBE/8BAA2BTq9B+G,A;iIAZSr9BAAYTq9B+G,A;uwCAsKgB98B4D;g1BJ9QHgfe;0EA8B+BkVAX6aZlVsB,A;6ND/Of+dK;8PASDCAkBjUJheyB,A;uGlBmUAiekB;OAGCjeoB;yOA4DAkegD;ivBAq5CAlemR;i7DAq+BO0cY;4FAkCC1c8C;gfkBtxFRAe;4MAwBEme2B;8TAiCAAwB;21BA2HgBnegB;2sBA0JlBAkBA0BbAAAAAAQ,A,A;qoFIvUQoeS;0CA0IGpeSAnCYqeAAAACAgC4oBSteS/B9xB5BAAAjC0BweAAAAxe+B,A,A,A,A,A,A;oRDoTPAwB;AACrByeY;glBE7QYCU;2CAYqB1ekB;oCAIrB0eU;oGAsBkB1ec;mKAsD3BlYgB;iCEw6DGkYc;sbDn6BkB2egC;8lBHzhC1B3eU;2jBAyLUAc;kJCpSA9WA+B+4BuC8Wa,A;iqB/BvxBtC4eW;sRAmHe5eyB;QACPsY6B;kCA0EbuGS;4CAQiBCS;AACLCM;uBAIZCoB;oBAIFl3BgB;iFAQE+2BS;wFAeiBCS;AACLCM;uBAIZCoB;kCAIFl3BgB;6RA6FA22BkB;8CAkBFQAA/KACS,AAAoBlfqB,A;oFAoMpBmfS;oBACAr3BgB;oFASIq3BS;oBACAr3BgB;iFAeJq3BS;oBACAr3BgB;4DA3HAq3BU;kIAkCkBLM;iBAIhBEgB;oBAIAIY;sFA6FuBCU;kBAGYCM;6BACxBCsB;sFA6BcCM;mCACFZY;uBACGD6B;uDAGfYsB;OAMWpVM;0BAsEPsVM;uKAwBKCwB;AACZVgB;4CAaIUwB;mBAEVjBiB;AAGASY;wKA7RASM;2PA2FFCQA/BFnBiB,Q;+LA+HyBoByB;wHAKY7fkB;+BAMmB+eiC;AAC3BMyB;AACqBCY;oLAiBnBQuC;2BAEI9fkB;yKAcNsfa;uDAGQtfkB;gOEqcvBAa;oDAEd+f+B;8HAkMERyB;mHAYAAyB;0+BGrwCevfiB;iEAydAgeAVzcPhemB,A;2BU8eCgeAV9eDhemB,A;wBUsfeAyB;0CA8PRAe;gRE5iBXggBmB;yFAsBoBhgBc;2BAGxBggBkC;4CAKF1CAfuRACe,A;AetRO9JS;68BC3PUzTmB;mBAGfsdAhB8gBFCiB,A;gCgBngBEDAhBmgBFCyB,A;iDgB7fO9JS;+DA4BqByBA9B2gBElVyB,A;A8B1gBEkVAzB7CFlVwB,A;kQsBuDnBAe;6vFAyWAAW;8TA4ZAAc;ouBA+DTqGc;i5BAsGFAgB;iqCEx5Bc6OcEypBgBlVgBArH8BAAA7HDigBsC,A,AAuB7DjgBAAsGAAY,A,A,A;6CF7hBqBkVkBEkpBWlVgBArH8BAAA7HDigBsC,A,AAuB7DjgBAAsGAAY,A,A,A;iG9BrlBgCAwB;sGAmBR+Tc;4S6BxChBuJe;gBAGFAc;AACAAAhBsgBJCW,A;AgBrgBIDW;q1BAiWEtdS;2EEmPwBAmC;kIA+BnBkgB8D;qNA2RXC4B;wZDt1BSCY;wEAGEAc;iKAeAAc;ykCAwfTCAAxBFjHY,qD;wLAgL8BpZoBArH8BAAA7HDigBc,A,A;uCAkP7BjgBAA3NhCAAAsGAAY,A,A;0IAmJkBAe;+MAaIAe;2FAxHesgBAAAAtgBiB,A;wOGhpBzBAoC;SAAAAY;UAAAAuB;gJAwECA+B;oJAiCPugBS;sUAkBOvgBc;kIAgBPwgBe;ioBA0HFpHY;8eAoD2BlEAlCyPClVyB,A;qgBmCpcFygBa;mGAeIAkB;+RAgZZCkB;MAEhBCAA4RJAArB9RiBEa,A,A;iBqBKTFAAyRRAArB9RiBEa,A,A;aqBQTFAAsRRAArB9RiBEc,A,A;cqBWTFAAmRRAArB9RiBEc,A,A;cqBcTFAAgRRAArB9RiBEc,A,A;cqBiBTFAA6QRAArB9RiBEc,A,A;cqBoBTFAA0QRAArB9RiBEc,A,A;AqBqBTFAAyQRAArB9RiBEa,A,A;AqBsBTFAAwQRAArB9RiBEa,A,A;WqBuBTFAAuQRAArB9RiBEyB,A,A;OqBwBTFAAsQRAArB9RiBEyB,A,A;sCqB4BGHkB;MAEhBCAAgQJAArB9RiBEa,A,A;AqB+BbFAA+PJAArB9RiBEa,A,A;SqBmCfCAAmPFxDiB,A;OAjPEoDe;6GAWQ1gBuB;iJA+BR+gBwC;CAAAAiB;wHAcACmB;yBAGAFiB;yBAGAAkB;0BAGAAiB;sCAGAAkB;WAAAAS;yDAOACwC;CAAAAQ;kDAMAAwC;CAAAAQ;iDASFDkB;iFAIIAS;eAIJAQ;qDAMEAe;4GAcFAkB;oDAMEAU;4CAGFAS;4PA2GmDrNe;iEAnBtCzTe;AACbihBAAWgBjhBgBAxBZAQ,A,Q;AAcGyTM;6HrB5kBWiJW;2XsBzDZ1cqB;kBClKNkhBO;6EvB6nBI5DgB;AACAAAA1FJCW,A;0SwBEuB4DY;OACDCY;OACACY;OACACY;OACECY;OACACY;OACCCwD;m0DxBqEHzhBe;oEAIlBsdAAjFJCQ,A;i8CyBmFWmEwC;kbzBvkBmBhFc;qYAuhBjBiFO;0BAGFAO;oBAGEAU;wG4B8vgBO3hBAW5jgBKAA/BrvBvBAAAtB0BweAAAAxeqB,A,A,kB,A;yDoBq2hBxB4hBc;kBAkBAAe;sIAs9oBC7mBAEtzqCADADcDkFmB,Q,A;+hFDiplCF6hByB;gFAxDJ7hBAAAAAO,A;2ICpjlCoBAAUisBOAA/BrvBvBAAAtB0BweAAAAxewB,A,A,4B,A;iZsBuMnBhEcD9KA8lBALoVXCAxBvHAAiC,A,KwBuHAAAxBvHAAsD,A,A,A;O8B/CW/lBAD9KA8lBc,A;0IC0LLE2B;gDAISC2C;CAAAAO;yCAIXCuB;CAAAAO;+EAQkDDuC;6DAOlDC8B;CAAAAO;yzBC6bYCA/BhmBRCAAKYEgB,A,A;uhBgCsEFCuC;AADICA9CmGTxiBW,A;Y8CnGSwiBiB;OACfxiBW;0DAISAAOqnBWAA/BrvBvBAAAtB0BweAAAAxeqB,A,A,kB,A;uewBsKZwiBa;sCAOKCwB;iDAETziBAGhKa0iBkB,A;2CHgKb1iBAGlK2B2iBe,AAwBzC3iBAAAAAyB,A,A;AHsJU4hBK;ukBA1CoC5hBW;wKAWtCAS;gFAWU4iBS;OAAAAmB;iWAoB2CCAJ+pnBzC9nBAEn0nBbDADcDkFmB,e,A,A;m0CMlBW8cO;onBA6BDiGA3B7BgBCQ,A;iF2BoCGCwB;4IAW3B3rBAZtEN4pBgB,A;4FYyEM5LgD;yCAMAheAZ/EN4pBoF,A;4BYkFM5LgD;8GASEheAZ3FR4pBgB,A;4FY8FQ5LgD;2iBE3DQtVsBnBkhBlBAAAAAAmD,A,A;iSmB5gBEkjBAnB0tBA3P8C,A;CmB1tBA2PAnB0tBA3PyCAiEoB4P8J,A,A;0ImBrxBCCuB;oDAEAAmB;iDAOVC0G;CAAAAiB;24QpDinDMC0G;qFAUAC8G;mFAUACuD;qFAUAC2D;"
- }
-}
diff --git a/build_runner/lib/src/server/graph_viz_main.dart.js.map b/build_runner/lib/src/server/graph_viz_main.dart.js.map
deleted file mode 100644
index 3e09cad..0000000
--- a/build_runner/lib/src/server/graph_viz_main.dart.js.map
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "version": 3,
- "engine": "v2",
- "file": "graph_viz_main.dart.js",
- "sourceRoot": "",
- "sources": ["org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/interceptors.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_array.dart","org-dartlang-sdk:///sdk/lib/internal/iterable.dart","org-dartlang-sdk:///sdk/lib/collection/list.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_number.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_string.dart","org-dartlang-sdk:///sdk/lib/core/errors.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/internal_patch.dart","org-dartlang-sdk:///sdk/lib/internal/symbol.dart","org-dartlang-sdk:///sdk/lib/js/_js_client.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_rti.dart","org-dartlang-sdk:///sdk/lib/core/exceptions.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/core_patch.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/constant_map.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/regexp_helper.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_names.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_typed_data.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/async_patch.dart","org-dartlang-sdk:///sdk/lib/async/future_impl.dart","org-dartlang-sdk:///sdk/lib/async/schedule_microtask.dart","org-dartlang-sdk:///sdk/lib/async/zone.dart","org-dartlang-sdk:///sdk/lib/async/stream.dart","org-dartlang-sdk:///sdk/lib/async/stream_impl.dart","org-dartlang-sdk:///sdk/lib/html/dart2js/html_dart2js.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/collection_patch.dart","org-dartlang-sdk:///sdk/lib/collection/iterable.dart","org-dartlang-sdk:///sdk/lib/collection/linked_hash_set.dart","org-dartlang-sdk:///sdk/lib/collection/maps.dart","org-dartlang-sdk:///sdk/lib/collection/set.dart","org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/convert_patch.dart","org-dartlang-sdk:///sdk/lib/convert/json.dart","org-dartlang-sdk:///sdk/lib/convert/utf.dart","org-dartlang-sdk:///sdk/lib/core/date_time.dart","org-dartlang-sdk:///sdk/lib/core/iterable.dart","org-dartlang-sdk:///sdk/lib/core/null.dart","org-dartlang-sdk:///sdk/lib/core/uri.dart","org-dartlang-sdk:///sdk/lib/convert/codec.dart","org-dartlang-sdk:///sdk/lib/js/dart2js/js_dart2js.dart","org-dartlang-sdk:///sdk/lib/svg/dart2js/svg_dart2js.dart","graph_viz_main.dart","org-dartlang-sdk:///sdk/lib/async/future.dart"],
- "names": ["makeDispatchRecord","getNativeInterceptor","Interceptor.==","Interceptor.hashCode","Interceptor.toString","Interceptor.noSuchMethod","JSBool.toString","JSBool.hashCode","JSNull.==","JSNull.toString","JSNull.hashCode","JSNull.noSuchMethod","JavaScriptObject.hashCode","JavaScriptObject.toString","JavaScriptFunction.toString","JSArray.add","JSArray.addAll","JSArray.map","JSArray.join","JSArray.elementAt","JSArray.last","JSArray.any","JSArray.contains","JSArray.toString","JSArray.iterator","JSArray.hashCode","JSArray.length","JSArray.[]","JSArray.markFixed","JSArray.markFixedList","ArrayIterator.current","ArrayIterator.moveNext","JSNumber.toInt","JSNumber.toString","JSNumber.hashCode","JSNumber.<<","JSNumber._shrOtherPositive","JSNumber._shrBothPositive","JSNumber.<=","JSString.codeUnitAt","JSString._codeUnitAt","JSString.+","JSString.startsWith","JSString.startsWith[function-entry$1]","JSString.substring","JSString.substring[function-entry$1]","JSString.toLowerCase","JSString.trim","JSString.*","JSString.indexOf","JSString.indexOf[function-entry$1]","JSString.toString","JSString.hashCode","JSString.length","JSString.[]","JSString._isWhitespace","JSString._skipLeadingWhitespace","JSString._skipTrailingWhitespace","IterableElementError.noElement","IterableElementError.tooMany","ListIterable.iterator","ListIterable.where","ListIterable.map","ListIterator.current","ListIterator.moveNext","MappedIterable.iterator","MappedIterable.length","MappedIterable","MappedIterator.moveNext","MappedIterator.current","MappedListIterable.length","MappedListIterable.elementAt","WhereIterable.iterator","WhereIterable.map","WhereIterator.moveNext","WhereIterator.current","Symbol.hashCode","Symbol.toString","Symbol.==","isBrowserObject","unminifyOrTag","getType","isJsIndexable","S","Primitives.objectHashCode","Primitives.objectTypeName","Primitives._objectClassName","Primitives.stringFromCharCode","Primitives.lazyAsJsDate","Primitives.getYear","Primitives.getMonth","Primitives.getDay","Primitives.getHours","Primitives.getMinutes","Primitives.getSeconds","Primitives.getMilliseconds","Primitives.functionNoSuchMethod","createUnmangledInvocationMirror","Primitives.applyFunctionWithPositionalArguments","Primitives._genericApplyFunctionWithPositionalArguments","iae","ioore","diagnoseIndexError","diagnoseRangeError","argumentErrorValue","wrapException","toStringWrapper","throwExpression","throwConcurrentModificationError","unwrapException","getTraceFromException","objectHashCode","fillLiteralMap","invokeClosure","Exception","convertDartClosureToJS","Closure.fromTearOff","Closure.cspForwardCall","Closure.forwardCallTo","Closure.cspForwardInterceptedCall","Closure.forwardInterceptedCallTo","closureFromTearOff","propertyTypeCastError","interceptedTypeCast","extractFunctionTypeObjectFromInternal","functionTypeTest","_typeDescription","throwCyclicInit","getIsolateAffinityTag","setRuntimeTypeInfo","getRuntimeTypeInfo","getRuntimeTypeArguments","getRuntimeTypeArgumentIntercepted","getRuntimeTypeArgument","getTypeArgumentByIndex","runtimeTypeToString","_runtimeTypeToString","_functionRtiToString","_joinArguments","StringBuffer.write","substitute","checkSubtype","subtypeCast","Primitives.formatType","areSubtypes","computeSignature","_isSubtype","_isFunctionSubtype","namedParametersSubtypeCheck","defineProperty","lookupAndCacheInterceptor","patchProto","patchInteriorProto","makeLeafDispatchRecord","makeDefaultDispatchRecord","initNativeDispatch","initNativeDispatchContinue","initHooks","applyHooksTransformer","ConstantMap.toString","ConstantStringMap.length","ConstantStringMap.containsKey","ConstantStringMap.[]","ConstantStringMap._fetch","ConstantStringMap.forEach","ConstantStringMap.keys","_ConstantMapKeyIterable.iterator","_ConstantMapKeyIterable.length","JSInvocationMirror.memberName","JSInvocationMirror.positionalArguments","JSInvocationMirror.namedArguments","JsLinkedHashMap.es6","ReflectionInfo.defaultValue","ReflectionInfo","Primitives.functionNoSuchMethod.<anonymous function>","TypeErrorDecoder.matchTypeError","TypeErrorDecoder.extractPattern","TypeErrorDecoder.provokeCallErrorOn","TypeErrorDecoder.provokePropertyErrorOn","NullError.toString","NullError","JsNoSuchMethodError.toString","JsNoSuchMethodError","UnknownJsTypeError.toString","unwrapException.saveStackTrace","_StackTrace.toString","Closure.toString","StaticClosure.toString","BoundClosure.==","BoundClosure.hashCode","BoundClosure.toString","BoundClosure.selfOf","BoundClosure.receiverOf","BoundClosure.computeFieldNamed","CastErrorImplementation.toString","CastErrorImplementation","RuntimeError.toString","RuntimeError","JsLinkedHashMap.length","JsLinkedHashMap.keys","JsLinkedHashMap.[]","JsLinkedHashMap.internalGet","JsLinkedHashMap._getBucket","JsLinkedHashMap.[]=","JsLinkedHashMap.internalSet","JsLinkedHashMap.forEach","JsLinkedHashMap._addHashTableEntry","JsLinkedHashMap._modified","JsLinkedHashMap._newLinkedCell","JsLinkedHashMap.internalFindBucketIndex","JsLinkedHashMap.toString","JsLinkedHashMap._getTableCell","JsLinkedHashMap._getTableBucket","JsLinkedHashMap._setTableEntry","JsLinkedHashMap._deleteTableEntry","JsLinkedHashMap._newHashTable","LinkedHashMapKeyIterable.length","LinkedHashMapKeyIterable.iterator","LinkedHashMapKeyIterator","LinkedHashMapKeyIterator.current","LinkedHashMapKeyIterator.moveNext","initHooks.<anonymous function>","JSSyntaxRegExp.toString","JSSyntaxRegExp.makeNative","extractKeys","_checkValidIndex","_checkValidRange","NativeTypedArray.length","NativeTypedArrayOfDouble.[]","NativeInt16List.[]","NativeInt32List.[]","NativeInt8List.[]","NativeUint16List.[]","NativeUint32List.[]","NativeUint8ClampedList.length","NativeUint8ClampedList.[]","NativeUint8List.length","NativeUint8List.[]","_AsyncRun._initializeScheduleImmediate","_AsyncRun._scheduleImmediateJsOverride","_AsyncRun._scheduleImmediateWithSetImmediate","_AsyncRun._scheduleImmediateWithTimer","_makeAsyncAwaitCompleter","Completer.sync","_Completer.future","_asyncStartSync","_asyncAwait","_asyncReturn","_asyncRethrow","_awaitOnObject","_wrapJsFunctionForAsync","_registerErrorHandler","_microtaskLoop","_startMicrotaskLoop","_scheduleAsyncCallback","_schedulePriorityAsyncCallback","scheduleMicrotask","StreamIterator","_rootHandleUncaughtError","_rootRun","_rootRunUnary","_rootRunBinary","_rootScheduleMicrotask","_AsyncRun._initializeScheduleImmediate.internalCallback","_AsyncRun._initializeScheduleImmediate.<anonymous function>","_AsyncRun._scheduleImmediateJsOverride.internalCallback","_AsyncRun._scheduleImmediateWithSetImmediate.internalCallback","_TimerImpl","_TimerImpl.internalCallback","_AsyncAwaitCompleter.complete","_AsyncAwaitCompleter.completeError","_AsyncAwaitCompleter.complete.<anonymous function>","_AsyncAwaitCompleter.completeError.<anonymous function>","_awaitOnObject.<anonymous function>","_wrapJsFunctionForAsync.<anonymous function>","_Completer.completeError","_nonNullError","_Completer.completeError[function-entry$1]","_AsyncCompleter.complete","_AsyncCompleter._completeError","_SyncCompleter.complete","_SyncCompleter.complete[function-entry$0]","_SyncCompleter._completeError","_FutureListener.matchesErrorTest","_FutureListener.handleError","_Future.then","_Future.then[function-entry$1]","_Future._thenNoZoneRegistration","_Future._addListener","_Future._prependListeners","_Future._removeListeners","_Future._reverseListeners","_Future._complete","_Future._completeError","_Future._setError","_Future._asyncComplete","_Future._chainFuture","_Future._asyncCompleteError","_Future._chainForeignFuture","_Future._chainCoreFuture","_Future._propagateToListeners","_Future._addListener.<anonymous function>","_Future._prependListeners.<anonymous function>","_Future._chainForeignFuture.<anonymous function>","_Future._chainForeignFuture[function-entry$1].<anonymous function>","_Future._asyncComplete.<anonymous function>","_Future._completeWithValue","_Future._chainFuture.<anonymous function>","_Future._asyncCompleteError.<anonymous function>","_Future._propagateToListeners.handleWhenCompleteCallback","_Future._propagateToListeners.handleWhenCompleteCallback.<anonymous function>","_Future._propagateToListeners.handleValueCallback","_Future._propagateToListeners.handleError","Stream.length","_Future","Stream.length.<anonymous function>","Stream_length_closure","AsyncError.toString","_rootHandleUncaughtError.<anonymous function>","_RootZone.runGuarded","_RootZone.runUnaryGuarded","_RootZone.runUnaryGuarded[function-entry$2]","_RootZone.bindCallback","_RootZone.bindCallback[function-entry$1]","_RootZone.bindCallbackGuarded","_RootZone.bindUnaryCallbackGuarded","_RootZone.[]","_RootZone.run","_RootZone.run[function-entry$1]","_RootZone.runUnary","_RootZone.runUnary[function-entry$2]","_RootZone.runBinary","_RootZone.runBinary[function-entry$3]","_RootZone.registerBinaryCallback","_RootZone.registerBinaryCallback[function-entry$1]","_RootZone.bindCallback.<anonymous function>","_RootZone.bindCallbackGuarded.<anonymous function>","_RootZone.bindUnaryCallbackGuarded.<anonymous function>","_RootZone_bindUnaryCallbackGuarded_closure","_HashMap._getTableEntry","_HashMap._setTableEntry","_HashMap._newHashTable","LinkedHashMap._literal","LinkedHashMap._empty","LinkedHashSet","IterableBase.iterableToShortString","IterableBase.iterableToFullString","_isToStringVisiting","_iterablePartsToStrings","LinkedHashSet.from","MapBase.mapToString","_HashMap.length","_HashMap.keys","_HashMap.containsKey","_HashMap._containsKey","_HashMap.[]","_HashMap._get","_HashMap.[]=","_IdentityHashMap._computeHashCode","_HashMap.forEach","_HashMap._computeKeys","_HashMap._getBucket","_IdentityHashMap._findBucketIndex","_HashMapKeyIterable.length","_HashMapKeyIterable.iterator","_HashMapKeyIterator.current","_HashMapKeyIterator.moveNext","_LinkedHashSet.iterator","_LinkedHashSetIterator","_LinkedHashSet.length","_LinkedHashSet.contains","_LinkedHashSet._contains","_LinkedHashSet.add","_LinkedHashSet._add","_LinkedHashSet._addHashTableEntry","_LinkedHashSet._newLinkedCell","_LinkedHashSet._computeHashCode","_LinkedHashSet._findBucketIndex","_LinkedHashSet._newHashTable","_LinkedHashSetIterator.current","_LinkedHashSetIterator.moveNext","ListMixin.iterator","ListMixin.elementAt","ListMixin.map","ListMixin.toString","MapBase.mapToString.<anonymous function>","MapMixin.forEach","MapMixin.length","MapMixin.toString","MapView.[]","MapView.forEach","MapView.length","MapView.keys","MapView.toString","SetMixin.addAll","SetMixin.map","SetMixin.toString","_parseJson","_convertJsonToDartLazy","_JsonMap.[]","_JsonMap.length","_JsonMap.keys","_JsonMap.forEach","_JsonMap._computeKeys","_JsonMap._process","_JsonMapKeyIterable.length","_JsonMapKeyIterable.elementAt","_JsonMapKeyIterable.iterator","JsonCodec.decode","JsonCodec.decode[function-entry$1]","JsonCodec.decoder","Utf8Codec.encoder","Utf8Encoder.convert","Utf8Encoder.convert[function-entry$1]","_Utf8Encoder._writeSurrogate","_Utf8Encoder._fillBuffer","Error._objectToString","List.from","RegExp","Error.safeToString","NoSuchMethodError.toString.<anonymous function>","DateTime.==","DateTime.hashCode","DateTime.toString","DateTime._fourDigits","DateTime._threeDigits","DateTime._twoDigits","NullThrownError.toString","ArgumentError._errorName","ArgumentError._errorExplanation","ArgumentError.toString","ArgumentError","ArgumentError.value","RangeError._errorName","RangeError._errorExplanation","RangeError.value","RangeError.range","RangeError.checkValidRange","IndexError._errorName","IndexError._errorExplanation","IndexError","NoSuchMethodError.toString","NoSuchMethodError","UnsupportedError.toString","UnsupportedError","UnimplementedError.toString","UnimplementedError","StateError.toString","StateError","ConcurrentModificationError.toString","ConcurrentModificationError","OutOfMemoryError.toString","StackOverflowError.toString","CyclicInitializationError.toString","_Exception.toString","FormatException.toString","FormatException","Iterable.map","Iterable.where","Iterable.join","Iterable.length","Iterable.single","Iterable.elementAt","Iterable.toString","Null.hashCode","Null.toString","Object.==","Object.hashCode","Object.toString","Object.noSuchMethod","StringBuffer.length","StringBuffer.toString","StringBuffer._writeAll","_Uri.host","_Uri.port","_Uri.toString","_Uri._initializeText","_Uri.==","_Uri.hashCode","_Uri._uriEncode","JSSyntaxRegExp.hasMatch","StringBuffer.writeCharCode","_Uri._defaultPort","_Uri._fail","_Uri._makePort","_Uri._makeHost","_Uri._makeScheme","_Uri._canonicalizeScheme","_Uri._makeUserInfo","_Uri._makePath","_Uri._makeQuery","_Uri._makeFragment","_Uri._mayContainDotSegments","_Uri._removeDotSegments","JSArray.isNotEmpty","_Uri._normalizeRelativePath","_Uri._escapeScheme","_Uri._isAlphabeticCharacter","_Uri._makeQuery.writeParameter","_Uri._makeQuery.<anonymous function>","document","Element.html","ListMixin.where","Node.nodes","Element._safeTagName","HttpRequest.getString","HttpRequest.request","Completer","_convertNativeToDart_EventTarget","_wrapZone","AnchorElement.toString","AreaElement.toString","DomException.toString","Element.attributes","Element.toString","Element.createFragment","NodeValidatorBuilder.common","NodeValidatorBuilder.allowHtml5","NodeValidatorBuilder.allowTemplating","Element._canBeUsedToCreateContextualFragment","Element.createFragment[function-entry$1$treeSanitizer]","Element.innerHtml","Element.setInnerHtml","Element.setInnerHtml[function-entry$1]","Element.onSubmit","EventStreamProvider.forElement","Element.html.<anonymous function>","EventTarget._addEventListener","HttpRequest.open","HttpRequest.open[function-entry$2$async]","HttpRequest.getString.<anonymous function>","HttpRequest.request.<anonymous function>","Location.toString","_ChildNodeListLazy.single","_ChildNodeListLazy.addAll","_ChildNodeListLazy.iterator","ImmutableListMixin.iterator","_ChildNodeListLazy.length","_ChildNodeListLazy.[]","Node.remove","Node.toString","NodeList.length","NodeList.[]","NodeList.elementAt","TableElement.createFragment","TableRowElement.createFragment","TableSectionElement.createFragment","TemplateElement.setInnerHtml","TemplateElement.setInnerHtml[function-entry$1]","_NamedNodeMap.length","_NamedNodeMap.[]","_NamedNodeMap.elementAt","_AttributeMap.forEach","_AttributeMap.keys","_ElementAttributeMap.[]","_ElementAttributeMap.length","_EventStreamSubscription._tryResume","_EventStreamSubscription","_EventStreamSubscription.<anonymous function>","_Html5NodeValidator","_Html5NodeValidator.allowsElement","_Html5NodeValidator.allowsAttribute","_SameOriginUriPolicy._hiddenAnchor","UriPolicy","_Html5NodeValidator._standardAttributeValidator","_Html5NodeValidator._uriAttributeValidator","NodeValidatorBuilder.allowsElement","NodeValidatorBuilder.allowsAttribute","NodeValidatorBuilder.allowsElement.<anonymous function>","NodeValidatorBuilder.allowsAttribute.<anonymous function>","_SimpleNodeValidator","_SimpleNodeValidator.allowsElement","_SimpleNodeValidator.allowsAttribute","_SimpleNodeValidator.<anonymous function>","_TemplatingNodeValidator.allowsAttribute","_TemplatingNodeValidator","_TemplatingNodeValidator.<anonymous function>","_SvgNodeValidator.allowsElement","_SvgNodeValidator.allowsAttribute","FixedSizeListIterator.moveNext","FixedSizeListIterator.current","_DOMWindowCrossFrame._createSafe","_ValidatingTreeSanitizer.sanitizeTree","_ValidatingTreeSanitizer._removeNode","_ValidatingTreeSanitizer._sanitizeUntrustedElement","_ValidatingTreeSanitizer._sanitizeElement","JSArray.toList","_ValidatingTreeSanitizer.sanitizeTree.walk","_callDartFunction","Function._apply1","_defineProperty","_getOwnProperty","_convertToJS","_getJsProxy","_convertToDart","DateTime._withValue","_wrapToDart","_getDartProxy","JsObject.[]","JsObject.hashCode","JsObject.==","JsObject.toString","JsObject.callMethod","JsObject._convertDataTree","JsObject._convertDataTree._convert","JsArray._checkIndex","JsArray.[]","JsArray.length","_convertToJS.<anonymous function>","_wrapToDart.<anonymous function>","SvgElement.innerHtml","SvgElement.createFragment","NodeValidatorBuilder.allowSvg","NodeTreeSanitizer","SvgElement.onSubmit","main","_error","JSArray.where","_focus","_focus[function-entry$1]","main.<anonymous function>","_error.<anonymous function>","DART_CLOSURE_PROPERTY_NAME","JS_INTEROP_INTERCEPTOR_TAG","TypeErrorDecoder.noSuchMethodPattern","TypeErrorDecoder.notClosurePattern","TypeErrorDecoder.nullCallPattern","TypeErrorDecoder.nullLiteralCallPattern","TypeErrorDecoder.undefinedCallPattern","TypeErrorDecoder.undefinedLiteralCallPattern","TypeErrorDecoder.nullPropertyPattern","TypeErrorDecoder.nullLiteralPropertyPattern","TypeErrorDecoder.undefinedPropertyPattern","TypeErrorDecoder.undefinedLiteralPropertyPattern","_AsyncRun._scheduleImmediateClosure","_toStringVisiting","_Uri._needsNoEncoding","_Html5NodeValidator._allowedElements","_Html5NodeValidator._attributeValidators","context","_DART_OBJECT_PROPERTY_NAME","_dartProxyCtor","_graphReference","_details","InputElement","main_closure","","Future","String","_ElementEventStreamImpl","Event","_current","_wrapJsFunctionForAsync_closure","_skipLeadingWhitespace","_skipTrailingWhitespace","_isWhitespace","NullThrownError","safeToString","_objectToString","Closure","objectTypeName","_objectClassName","StringBuffer","Object","markFixed","markFixedList","value","int","Null","UnknownJavaScriptObject","RangeError","CyclicInitializationError","iterableToFullString","_writeAll","FixedSizeListIterator","ArrayIterator","ListIterator","_StreamIterator","ExceptionAndStackTrace","_StackTrace","unwrapException_saveStackTrace","UnknownJsTypeError","StackOverflowError","Error","extractPattern","TypeErrorDecoder","provokePropertyErrorOn","provokeCallErrorOn","_awaitOnObject_closure","StackTrace","Function","_FutureListener","_Future__addListener_closure","_propagateToListeners","_Future__propagateToListeners_handleWhenCompleteCallback","_Future__propagateToListeners_handleValueCallback","_Future__propagateToListeners_handleError","_chainCoreFuture","AsyncError","_Future__propagateToListeners_handleWhenCompleteCallback_closure","_Future__prependListeners_closure","_rootHandleUncaughtError_closure","_nextCallback","_lastPriorityCallback","_lastCallback","_AsyncCallbackEntry","_isInCallbackLoop","_initializeScheduleImmediate","_AsyncRun__initializeScheduleImmediate_internalCallback","_AsyncRun__initializeScheduleImmediate_closure","_TimerImpl_internalCallback","_AsyncRun__scheduleImmediateWithSetImmediate_internalCallback","_Exception","_AsyncRun__scheduleImmediateJsOverride_internalCallback","_RootZone_bindCallback_closure","_RootZone_bindCallbackGuarded_closure","initNativeDispatchFlag","getTagFunction","dispatchRecordsForInstanceTags","interceptorsForUncacheableTags","alternateTagFunction","JavaScriptIndexingBehavior","prototypeForTagFunction","initHooks_closure","_AsyncAwaitCompleter","_SyncCompleter","_chainForeignFuture","_Future__chainForeignFuture_closure","_AsyncAwaitCompleter_completeError_closure","_AsyncAwaitCompleter_complete_closure","fromTearOff","receiverOf","selfOf","List","StaticClosure","BoundClosure","functionCounter","forwardCallTo","forwardInterceptedCallTo","cspForwardCall","selfFieldNameCache","computeFieldNamed","receiverFieldNameCache","cspForwardInterceptedCall","_literal","_makeScheme","_makeUserInfo","_makeHost","_makeQuery","_makeFragment","_makePort","_makePath","_normalizeRelativePath","_removeDotSegments","_Uri","getString","Map","ProgressEvent","HttpRequest","_convertDataTree","JsObject","_JsonMap","mapToString","MapBase_mapToString_closure","LinkedHashMapKeyIterable","_JsonMapKeyIterable","iterableToShortString","range","Uri","_defaultPort","MappedListIterable","from","TypedData","DateTime","getYear","_fourDigits","getMonth","_twoDigits","getDay","getHours","getMinutes","getSeconds","getMilliseconds","_threeDigits","lazyAsJsDate","Blob","KeyRange","ImageData","Node","Window","WorkerGlobalScope","_convertToJS_closure","applyFunctionWithPositionalArguments","ListMixin","_genericApplyFunctionWithPositionalArguments","functionNoSuchMethod","Primitives_functionNoSuchMethod_closure","JSInvocationMirror","Symbol","NoSuchMethodError_toString_closure","JsLinkedHashMap","ConstantMapView","NodeValidator","_SvgNodeValidator","_ValidatingTreeSanitizer","NodeValidatorBuilder","_ChildNodeListLazy","_TemplatingNodeValidator_closure","_SimpleNodeValidator_closure","WhereIterable","Iterable","WhereIterator","_LinkedHashSet","_newHashTable","_LinkedHashSetCell","_SameOriginUriPolicy","_empty","html","Element_Element$html_closure","Element","noElement","tooMany","_defaultValidator","_defaultSanitizer","_parseDocument","_parseRange","BodyElement","_ValidatingTreeSanitizer_sanitizeTree_walk","_safeTagName","_ElementAttributeMap","TemplateElement","NodeValidatorBuilder_allowsAttribute_closure","ScriptElement","SvgElement","NodeValidatorBuilder_allowsElement_closure","_wrapToDart_closure","JsArray","JsFunction","JsObject__convertDataTree__convert","_IdentityHashMap","EfficientLengthMappedIterable","MappedIterator","ListIterable","EfficientLengthIterable","_ConstantMapKeyIterable","_setTableEntry","_getTableEntry","_HashMapKeyIterable","_HashMapKeyIterator","_createSafe","EventTarget","_DOMWindowCrossFrame","request","HttpRequest_getString_closure","_AsyncCompleter","HttpRequest_request_closure","_Future__asyncComplete_closure","_Future__chainFuture_closure","_Future__asyncCompleteError_closure","_mayContainDotSegments","_escapeScheme","_isAlphabeticCharacter","_Uri__makeQuery_closure","_Uri__makeQuery_writeParameter","_uriEncode","stringFromCharCode","checkValidRange","_Utf8Encoder","JSSyntaxRegExp","makeNative","_fail","_canonicalizeScheme","LinkedHashMapCell","_error_closure","bool","_EventStreamSubscription_closure","JS_CONST","Interceptor","JSBool","JSNull","JavaScriptObject","PlainJavaScriptObject","JavaScriptFunction","JSArray","JSUnmodifiableArray","num","JSNumber","JSInt","JSDouble","JSString","FixedLengthListMixin","ConstantMap","ConstantStringMap","noSuchMethodPattern","notClosurePattern","nullCallPattern","nullLiteralCallPattern","undefinedCallPattern","undefinedLiteralCallPattern","nullPropertyPattern","nullLiteralPropertyPattern","undefinedPropertyPattern","undefinedLiteralPropertyPattern","TearOffClosure","NativeTypedData","NativeTypedArray","double","NativeTypedArrayOfDouble","NativeTypedArrayOfInt","NativeInt16List","NativeInt32List","NativeInt8List","NativeUint16List","NativeUint32List","NativeUint8ClampedList","NativeUint8List","_Completer","Stream","StreamSubscription","StreamTransformerBase","_Zone","_RootZone","_HashMap","_HashSetBase","ListBase","MapBase","MapMixin","_UnmodifiableMapMixin","MapView","UnmodifiableMapView","SetMixin","SetBase","Codec","Converter","Encoding","JsonCodec","JsonDecoder","Utf8Codec","Utf8Encoder","OutOfMemoryError","Iterator","_needsNoEncoding","HtmlElement","AnchorElement","AreaElement","CharacterData","DomException","FormElement","HttpRequestEventTarget","Location","NodeList","SelectElement","TableElement","TableRowElement","TableSectionElement","_NamedNodeMap","_AttributeMap","_EventStream","_allowedElements","_attributeValidators","ImmutableListMixin","_NativeTypedArrayOfDouble&NativeTypedArray&ListMixin","_NativeTypedArrayOfDouble&NativeTypedArray&ListMixin&FixedLengthListMixin","_NativeTypedArrayOfInt&NativeTypedArray&ListMixin","_NativeTypedArrayOfInt&NativeTypedArray&ListMixin&FixedLengthListMixin","_ListBase&Object&ListMixin","_UnmodifiableMapView&MapView&_UnmodifiableMapMixin","_NodeList&Interceptor&ListMixin","_NodeList&Interceptor&ListMixin&ImmutableListMixin","__NamedNodeMap&Interceptor&ListMixin","__NamedNodeMap&Interceptor&ListMixin&ImmutableListMixin","_JsArray&JsObject&ListMixin","_scheduleImmediateJsOverride","_scheduleImmediateWithSetImmediate","_scheduleImmediateWithTimer","_standardAttributeValidator","_uriAttributeValidator","_scheduleImmediateClosure","$intercepted$get$onSubmit$x","getInterceptor$x","graph_viz_main___focus$closure","$intercepted$trim0$s","getInterceptor$s","$intercepted$toString0$IJavaScriptFunctionJavaScriptObjectabnsux","getInterceptor$","$intercepted$get$length$asx","getInterceptor$asx","$intercepted$get$iterator$ax","getInterceptor$ax","$intercepted$[]$asx","async___startMicrotaskLoop$closure","async__AsyncRun__scheduleImmediateJsOverride$closure","async__AsyncRun__scheduleImmediateWithSetImmediate$closure","async__AsyncRun__scheduleImmediateWithTimer$closure","$intercepted$startsWith1$s","$intercepted$get$_get_target$x","$intercepted$get$status$x","$intercepted$get$statusText$x","$intercepted$get$responseText$x","$intercepted$set$innerHtml$x","$intercepted$get$hashCode$IJavaScriptObjectabnsu","$intercepted$$eq$Iu","js___convertToJS$closure","$intercepted$elementAt1$ax","js___convertToDart$closure","$intercepted$map11$ax","$intercepted$noSuchMethod1$Iu","html__Html5NodeValidator__standardAttributeValidator$closure","html__Html5NodeValidator__uriAttributeValidator$closure","$intercepted$remove0$x","$intercepted$get$previousNode$x","$intercepted$get$attributes$x","$intercepted$toLowerCase0$s","$intercepted$_codeUnitAt1$s","$intercepted$codeUnitAt1$s","$intercepted$_addEventListener3$x","functionThatReturnsNull","makeConstantList","where","[]","toString","noSuchMethod","createFragment","allowsAttribute","status","dart.dom.html#_get_target","last","runBinary","open","call","indexOf","toLowerCase","registerBinaryCallback","contains","dart.async#_asyncCompleteError","allowsUri","dart.async#_thenNoZoneRegistration","responseText","_js_helper#_modified","dart.collection#_get","moveNext","iterator","attributes","_js_helper#_deleteTableEntry","run","dart.async#_removeListeners","complete","handleError","internalFindBucketIndex","dart.async#_reverseListeners","tagName","dart.dom.html#_sanitizeElement","map","dart.collection#_contains","namedArguments","dart.js#_checkIndex","dart.collection#_getBucket","_js_helper#_getTableBucket","host","dart.convert#_writeSurrogate","dart.convert#_fillBuffer","runUnary","_interceptors#_codeUnitAt","addAll","dart.dom.html#_removeNode","dart.collection#_addHashTableEntry","dart.collection#_containsKey","completeError","dart.async#_addListener","_js_helper#_newLinkedCell","_js_helper#_getTableCell","callMethod","dart.convert#_process","startsWith","decoder","bindCallback","matchesErrorTest","positionalArguments","dart.core#_errorName","dart.async#_asyncComplete","forEach","bindUnaryCallbackGuarded","dart.convert#_computeKeys","internalGet","dart.async#_complete","dart.collection#_computeHashCode","dart.collection#_newLinkedCell","then","_js_helper#_newHashTable","allowsElement","_interceptors#_shrBothPositive","encoder","dart.async#_state","dart.collection#_computeKeys","current","sanitizeTree","dart.collection#_findBucketIndex","runUnaryGuarded","single","hashCode","dart.dom.html#_sanitizeUntrustedElement","dart.dom.html#_addEventListener","decode","any","_js_helper#_fetch","matchTypeError","runGuarded","dart.dom.html#_tryResume","join","containsKey","dart.collection#_add","substring","bindCallbackGuarded","memberName","convert","trim","setInnerHtml","remove","length","dart.async#_chainFuture","_js_helper#_addHashTableEntry","dart.async#_resultOrListeners","codeUnitAt","defaultValue","port","add","toInt","keys","dart.core#_errorExplanation","dart.async#_completeError","dart.async#_prependListeners","dart.core#_contents=","innerHtml=","_interceptors#_shrOtherPositive","dart.dom.html#_element","elementAt","statusText","_js_helper#_setTableEntry","previousNode","onSubmit","$indexSet","$le","$index","$eq","$shr","$ge","$and","$lt","$mul","$shl","$add","lookupInterceptorByConstructor","cacheInterceptorOnConstructor","objectToHumanReadableString","checkGrowable","listToString","_codeUnitAt","_","joinArguments","selfFieldName","receiverFieldName","extractFunctionTypeObjectFrom","isFunctionSubtype","_getRuntimeTypeAsString","write","_writeString","checkArguments","computeTypeName","formatType","isJsArray","setDispatchProperty","markUnmodifiableList","es6","unvalidated","internal","_getBucket","internalComputeHashCode","internalSet","_createTimer","_completer","sync","_AsyncAwaitCompleter._completer","future","_setValue","_scheduleImmediate","inSameErrorZone","_zone","_mayAddListener","_chainSource","_isComplete","_cloneResult","_setError","_setErrorObject","_setPendingComplete","_setChained","_hasError","handleUncaughtError","handlesValue","handlesComplete","_removeListeners","_clearPendingComplete","_completeWithValue","handleWhenComplete","handleValue","listen","_rethrow","writeAll","_set","_computeHashCode","_HashMap._set","identityHashCode","_modified","_isUpgraded","withBufferSize","sublist","_combineSurrogatePair","year","month","day","hour","minute","second","millisecond","checkNotNegative","_writeOne","_initializeText","hasAuthority","_writeAuthority","hasQuery","hasFragment","hasMatch","checkString","encode","writeCharCode","fromCharCode","_isSchemeCharacter","isNotEmpty","isEmpty","encodeQueryComponent","nodes","common","_validators","allowHtml5","allowTemplating","_canBeUsedToCreateContextualFragment","_cannotBeUsedToCreateContextualFragment","forElement","addEventListener","_hiddenAnchor","allowedElements","allowedAttributes","allowedUriAttributes","warn","toList","_toListGrowable","sanitizeNode","_removeNode","apply","_apply1","Function.apply","applyFunction","fromMillisecondsSinceEpoch","_withValue","_fromJs","allowSvg","target","jsify","provokeCallErrorOnNull","provokeCallErrorOnUndefined","provokePropertyErrorOnNull","provokePropertyErrorOnUndefined"],
- "mappings": "A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFAA,kBA6BEA,uBAEFA,C;GAWAC,YACMA;AAEAA;AAAJA,WACEA,eACEA;+BAKJA,YAEeA;AAAbA,UAAoBA,UAuDxBA;AAtDIA,UAAmBA,QAsDvBA;AApDqCA;AAAjCA,SACEA,UAmDNA;AA/CIA,WAKEA,UAAUA,+BAA4CA,cAOTA;AA2CfA;AA1ClCA,WAAyBA,QAkC3BA;AA9BgBA;AACdA,WAAyBA,QA6B3BA;AAvBEA,wBAIEA,UAmBJA;AAhB8BA;AAA5BA,WAEEA,UAcJA;AAXEA,wBAIEA,UAOJA;AALEA,iDAiB4BA;AAf1BA,UAGJA,CADEA,UACFA,C;;EAsIgBC,cAAaA,YAAsBA,C;GAEzCC,YAAYA,OAAWA,MAAoBA,C;QAE5CC,YAAcA,sBCuZLA,WDvZiDA,C;SAgBzDC,cACNA,UAAUA,OAAmCA,QAC9BA,QAAgCA,cACjDA,C;;;EAYOC,YAAcA,gBAAgCA,C;GAU7CC,YAAYA,sBAAwCA,C;;;EAe9CC,cAAaA,cAAsBA,C;EAG1CC,YAAcA,YAAMA,C;GAEnBC,YAAYA,QAACA,C;GAObC,cAAuCA,OAAMA,YAAwBA,C;;;GAsCrEC,YAAYA,QAACA,C;QAOdC,YAAcA,gBAA+BA,C;;;;EA8B7CC,YACiCA;AACtCA,WAAyBA,OAAaA,UAExCA;AADEA,iCAAkCA,YACpCA,C;;;;EEvWKC,cANHA,oBACEA,KAAUA;SAQdA,C;EA2GKC,cACCA;AArHJA,oBACEA,KAAUA;AAsHZA,kCAKFA,C;EAiBYC,gBACVA,OCwJFA,cDxJaA,YACbA,C;EAEOC,cACDA;AAAqBA;AAAVA;;AACfA,wBACmBA;AAAjBA,uBAAIA;AAAJA,OAEFA,gBACFA,C;EAiGEC,cACWA;AAAXA,WACFA,C;IA+BMC,YACJA;OAAgBA,aAElBA;AADEA,UAA2BA,OAC7BA,C;GA2FKC,cACCA;AAAWA;AACfA,iBAIMA,cAAeA,QAIvBA;AAHIA,gBAAwBA,UAAUA,QAEpCA,QACFA,C;EA0EKC,cACHA;uBACUA,gBAAcA,QAG1BA;AADEA,QACFA,C;EAMOC,YAAcA,OE3iBJA,eF2iB+BA,C;GAchCC,YAAYA,OA0G5BA,sBA1GsDA,C;GAE9CC,YAAYA,OAAWA,MAAoBA,C;GAE3CC,YAAUA,eAAiCA,C;EAgBxCC,cAETA,oBAAkCA,UAAMA;AACxCA,WACFA,C;;;;;GA1hBQC,cACJA,YAA0CA,WAA8BA,C;GAKhEC;AAKVA,QACFA,C;;;GAqmBMC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAASA;AAAUA;AAKvBA,cACEA,UAAMA;AAGJA;AAAJA,SACEA;AACAA,QAKJA,CAHEA;AACAA;AACAA,QACFA,C;;GGtpBIC,YACFA;iCAEEA,UAOJA;;AAJIA,UAIJA,CADEA,UAAUA,sBACZA,C;EA6JOC,YACLA,gBACEA,YAIJA;KAFIA,UAEJA,C;GAEQC,YAAYA,mBAAiCA,C;GAoFxCC,cAEXA,OAA+BA,UAAMA;AACrCA,sBACFA,C;GAiBIC,cACFA;OACMA;;WADNA,QAOFA,C;GAOIC,cACFA,mBASFA,C;GA2BcC,cACZA,uBAAmBA,UAAMA;AACzBA,WACFA,C;;;;;ECnYIC,cAEFA,OAAeA,UAAMA;AAKrBA,eAAqBA,KAAMA;AAJ3BA,sBACFA,C;EAEIC,cACFA,eAAqBA,UAAMA;AAC3BA,sBACFA,C;EAyBgBC,cACdA,uBAAsBA,UAAUA;AAChCA,UACFA,C;GAsFKC,gBAAUA;AAEbA,cACEA,UAAUA;AAKKA;AACfA,cAAuBA,QAI3BA;AAHIA,2BAGJA,C;EAbKC,oC;EAeEC,gBAELA,WAAiCA;AAEjCA,OAAoBA,UAAUA;AAC9BA,OAA2BA,UAAUA;AACrCA,cAAuBA,UAAUA;AACjCA,uBACFA,C;GAROC,sC;GAUAC,YACLA,sBAEFA,C;GAqGOC,YACKA;AAKNA;AAAOA;AAAXA,SAAwBA,QAiB1BA;AAhBkBA,sBAGDA;AACbA,SAAiCA,QAYrCA,MAFMA;AAJ6BA;AAAlBA,oBAEFA;AAEbA,gBAAkDA,QAEpDA;AADEA,uBACFA,C;GA0DgBC,cACdA;QAAgBA,QAelBA;AAdEA,uBAAoCA,QActCA;AAbEA,aAEEA;AAIFA,kBACEA,aAA6BA;AAEzBA;AAAJA,SAAgBA;AAChBA,KAEFA,QACFA,C;GAkBIC,gBAAOA;AAGTA,cACEA,UAAUA;;AAGVA,QAWJA,C;GAlBIC,oC;EA4DGC,YAAcA,QAAIA,C;GAQjBC,YAGFA;AACJA;AAEoBA;QAGFA;AAEGA;AAArBA,kCACFA,C;GAIQC,YAAUA,eAA4BA,C;EAE9BC,cAEdA,mBAAkCA,UAAMA;AACxCA,WACFA,C;;;GA7RYC,YAGVA,SACEA,2EASIA,QA4BRA;QA1BQA,QA0BRA,CAvBEA,gMAmBIA,QAINA;QAFMA,QAENA,E;GAIWC,cACCA;AAEVA,qBACiBA;AAGVA,4BACHA,MAEFA,IAEFA,QACFA,C;GAIWC,cACCA;KAEVA,SACmCA;AAAlBA;AAGVA,4BACHA,MAIJA,QACFA,C;GHmnBkBC,WAAeA,OIvWjCA,sBJuW6DA,C;GAE3CC,WAAaA,OIzW/BA,6BJyWkEA,C;;;GA31BlDC,YAAYA,OAqS5BA,cAEyBA,gBAvS4BA,C;GA4IzCC,cAA+BA,OAAMA,YAAWA,C;EAEhDC,gBAA0BA,OA2OtCA,iBA3O0CA,qBAAiCA,C;;GA4JrEC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAASA;AAAUA;;AACvBA,cACEA,UAAUA;AAERA;AAAJA,SACEA;AACAA,QAKJA,CAHaA;AAEXA,QACFA,C;;GAkBgBC,YAAYA,OAwB5BA,SAxB+DA,mBAAaA,C;GAGpEC,YAAUA,OAAUA,YAAMA,C;;;GAZ1BC,kBACNA,WACEA,OAsBJA,mBAnBAA;AADEA,OAGFA,mBAFAA,C;;;;EA8BKC,WACCA;UACSA,iBAAaA;AACxBA,QAIJA,CAFEA;AACAA,QACFA,C;GAEMC,WAAWA,aAAQA,C;;GAcjBC,YAAUA,OAAQA,YAAMA,C;EAC9BC,cAAwBA,iBAAGA,eAAyBA,C;;;;;GAWtCC,YAAYA,OAU5BA,SAV2DA,mBAAaA,C;EAG5DC,gBAA0BA,OAlEtCA,iBAkE0CA,eAA+BA,C;;EASpEC,WACHA;sBAAOA,OACDA,QAAaA,QACfA,QAINA;AADEA,QACFA,C;GAEMC,WAAWA,OAAUA,WAAOA,C;;;GK5a1BC,YACFA;AACJA,WAAkBA,QAKpBA;AAH8CA;;AAE5CA,QACFA,C;EAGAC,YAAcA,iBAAUA,gBAAQA,C;ECoFlBC,cAAEA,mBAAkDA;AAAvCA,qCAAuCA,C;;GCrG/DC,YACCA;AAAFA,yEAMsBA,C;GTmGnBC,YACEA;AACPA,uBAAyBA,QAG3BA;;AAF+BA,QAE/BA,C;IAmGAC,YACEA,oBAEFA,C;GAOKC,cACHA;YAEMA;AAAJA,WAAoBA,QAGxBA,CADEA,QAAcA,UAChBA,C;EAEOC,YACLA;uBAAqBA,QAgBvBA;AAfEA,wBACEA,SAEEA,UAYNA,MAVSA,UACLA,YASJA;KARSA,UACLA,aAOJA;KANSA,WACLA,YAKJA;AAHYA;AACVA,uBAAoBA,UAAMA;AAC1BA,QACFA,C;EA8RaC,YACLA;AACJA;kBAIAA,QACFA,C;GAuHcC,YAGZA,OAFmBA,QU7UdA,KV8U4BA,eAEnCA,C;GAEcC,YACRA;AAAcA;AASuBA;AAAzCA,yBAEMA;kCAKFA;;AAAJA,yBAkBWA;;AACTA,iBAK2CA;AAAzCA,qCAGuBA;AACjBA;6CAMRA,QAaJA,CAJMA;AAGJA,OAAOA,iBAH0BA,gBACxBA,cAGXA,C;GA6GcC,YACZA;SACEA,YACEA,6BAYNA;AATIA,eACaA;AAGXA,kCADqBA,+BAM3BA,EADEA,UAAUA,2BACZA,C;EAyFOC,YACLA;AAIAA,aACFA,C;GAmBOC,YAGqCA;AAF1CA,QAGFA,C;GAKOC,YAGqCA;AAF1CA,QAGFA,C;GAKOC,YAGsCA;AAF3CA,QAGFA,C;GAKOC,YAGuCA;AAF5CA,QAGFA,C;GAKOC,YAGyCA;AAF9CA,QAGFA,C;GAKOC,YAGyCA;AAF9CA,QAGFA,C;GAKOC,YAI8CA;AAHnDA,QAIFA,C;GAkCOC,gBAEDA;AAFCA;AAEDA;AAMFA;AAqBEA;AAtBFA;AACAA;AAGKA;AACPA,oBACEA,MAAuBA;AAWzBA,OAAOA,OA3vBTC,qCAkwBAD,C;GAwNOE,cAEAA;AAMeA;AAMNA;AAAdA,UAEEA,UACEA,aAiCNA,MA/BSA,UAELA,UACEA,iBA4BNA,MA1BSA,UAELA,UACEA,sBAuBNA,MApBSA,UAELA,UACEA,2BAiBNA,MAdSA,UAELA,UACEA,gCAWNA,MARSA,SAELA,UACEA,qCAKNA;AADEA,OAAOA,SACTA,C;GAEOC,cAEDA;AAA0BA;AAI1BA;AAAJA,YACoBA;AAIlBA,WACEA,OAAOA,cAoBbA;AAlB8BA;AACOA;AAE7BA;AACJA,iBAGEA,OAAOA,cAWbA;AAToBA;AAChBA,gBACEA,sBAA0BA,YAM9BA,mBACFA,C;GA6FFC,YACEA,UAAMA,QACRA,C;EASAC,cACEA,WAA+BA;AAC/BA,UAAMA,SACRA,C;EAOMC,cACJA;0CAAmBA,OMv0CnBA,0BNg1CFA;AARyBA;AAGvBA,WAAiBA,qCAAMA;AAANA,YAAjBA;KACEA,OAAWA,wBAIfA;AADEA,OAAWA,oBACbA,C;GAOMC,gBAIJA,OACEA,OMrwCFA,0CNixCFA;AAVEA,WAIEA,YACEA,OM5wCJA,wCNixCFA;AADEA,OMv2CAA,wBNw2CFA,C;GAOcC,YACZA,OMh3CAA,uBNi3CFA,C;EAmCAC,YACEA;WMj8CAA;ANo8CkCA;;AAElCA;;AAcAA,QACFA,C;IAGAC,WAGEA,OAAOA,wBACTA,C;GAQAC,kBACwBA,MACxBA,C;GAmCAC,YACEA,UAAUA,OACZA,C;EAuYAC,YAIEA;AAAcA;AAYdA,WAAgBA,MAkHlBA;AAjHEA,qBACEA,OAAOA,SAgHXA;AA9GEA,uBAA6CA,QA8G/CA;AA5GEA,wBACEA,OAAOA,qBA2GXA;KA1GSA,qBACLA,QAyGJA;AAhFwCA;AAhBtCA,6CAOoBA;;AACMA,4BAKtBA,mBAEIA,OAAOA,KACCA,KAAsBA,8BAgFxCA;mBA7EUA,OAAOA,KACCA,KAAYA,8BA4E9BA,EAvEEA,2BAI8BA;AACMA;AACFA;AACOA;AACNA;AACOA;AACJA;AACOA;AACNA;AACOA;AAC/BA;AAAbA,WACEA,OAAOA,KAAmBA,UAwDhCA;KAvDwBA;AAAbA;AAMLA,OAAOA,KAAmBA,UAiDhCA,MAhDwBA;AAAbA,YACMA;AADNA,YAEMA;AAFNA,YAGMA;AAHNA,YAIMA;AAJNA,YAKMA;AALNA,YAMMA;AANNA,YAOMA;AAPNA;KAQLA,OAAOA,KAAmBA,UAwChCA,EAlCIA,OAAOA,KAtHTA,mCAwJFA,CA9BEA,iFAEIA,OMxjDEA,UNolDRA;yDApBQA;AAGJA,OAAOA,KM1+DTA,4EN2/DFA,CAbEA,gEAIEA,iDACEA,OM5kDEA,UNolDRA;AADEA,QACFA,C;EAuBWC,YACTA;qBACEA,UAOJA;AALEA,WAAuBA,OAUvBA,WALFA;AAHMA;AAAJA,WAAmBA,QAGrBA;AADEA,sBAMAA,WALFA,C;GAmBIC,YACFA,+BACEA,OAAcA,OAIlBA;KAFIA,OAAkBA,MAEtBA,C;GAMAC,cAGMA;;AAEJA,iBACyCA;AACEA;AACzCA,iBAEFA,QACFA,C;IAEAC,sBAEEA,iBAEIA,OAAOA,MAWbA;OATMA,OAAOA,OASbA;OAPMA,OAAOA,SAObA;OALMA,OAAOA,WAKbA;OAHMA,OAAOA,aAGbA,CADEA,UW1sEAC,gEX2sEFD,C;GAMAE,cACEA;WAAqBA,MAkBvBA;AAhByBA;AAAvBA,OAAkCA,QAgBpCA;kEAF0CA;;AACxCA,QACFA,C;GAmDSC,wBAAWA;AAoBgCA;AAwHlBA;AAhHXA;AAESA,iBAuEWA;kBA2VrCA,gDA0BJA;;;KAzYcA;AACeA;;;;;AAU3BA,OACeA;;AA8COA,IAtCtBA;KAeOA,wBACLA;KAcMA;4FAGNA;;;AAOFA,4BACaA;AAGPA;AAAJA,YAC2BA;OAG3BA;;;;AAaFA,QACFA,C;GAEOC,kBAEDA;AAGJA,sBAEIA,iEAsENA;OA5DMA,mEA4DNA;OAlDMA,uEAkDNA;OAxCMA,2EAwCNA;OA9BMA,+EA8BNA;OApBMA,mFAoBNA;QAVMA,+EAUNA,E;GAIOC,gBACLA;KAAmBA,OAAOA,SAmC5BA;AAhCkDA;AAOpBA;AAFYA;AAApBA;AAEPA;AAAbA,KACEA,OAAOA,cAwBXA;AArBEA,UAE2BA;AAAeA;;AAK9BA;;AA+PRA;AAAJA,YACuBA;OApQrBA,8CAKuBA,gBAa3BA;AAPkBA;AAAeA;;AAA/BA;;AAwPIA;AAAJA,YACuBA;OAxPvBA,iCAIkDA,qBAEpDA,C;GAEOC,kBAEDA;AAkBIA;AACAA;AAfRA,sBAIIA,UAAUA;OAEVA,4EA+ENA;OApEMA,+EAoENA;OAzDMA,mFAyDNA;OA9CMA,uFA8CNA;OAnCMA,2FAmCNA;OAxBMA,+FAwBNA;QAbMA;;kCAaNA,E;GAEOC,cACEA;AAiJHA;AAAJA,YACuBA;OAQnBA;AAAJA,YAC2BA;OAtJqBA;AAOpBA;AAFYA;AAApBA;AAEPA;AAAbA,KACEA,OAAOA,cAuBXA;AArBEA,UAKoBA,8CAAWA,gBAAeA;AACrCA;AAAeA;;AALtBA,8BAoBJA,wDA3IEF,AAuIsBE;AACJA,mDAAWA,gBAAeA;AACrCA;AAAeA;;AALtBA,8BAOFA,C;GAmBFC,wBAEEA,OAAeA,uBAQjBA,C;GAyRKC,cAGHA,UAAUA,OAA+BA,KAAcA,iBACzDA,C;GA2CAC,cACEA;WAG2BA;KAH3BA;KAIEA,QAGJA;AADEA,SACFA,C;GA8GAC,YACMA;AACJA,cAEyCA;AAAvCA,sBACEA,oBAMNA;KAJMA,aAINA,CADEA,MACFA,C;GAEAC,cACEA;WAAmBA,QAcrBA;AAbEA,wBAQEA,QAKJA;AA/BSA,OADWA;AA8BlBA,WAAgCA,QAElCA;AADEA,OU95EOA,mBV+5ETA,C;GAkFOC,YACLA;AAAUA;AAAVA,YAlHOA;AAoHLA,WACEA,OAAOA,OAKbA;AAHIA,eAGJA,CADEA,OAAkBA,OACpBA,C;GAmDKC,YACHA,UM/wFAA,YNgxFFA,C;GAuDOC,YAELA,4BACFA,C;EU/yGOC;AAILA,QACFA,C;GAMAC,YACEA,WAAoBA,MAGtBA;AADEA,YACFA,C;GAGAC,gBAGEA,OAAOA,YAD2CA,QAClBA,QAClCA,C;GASAC,kBAVSA,kBAD2CA,QAClBA;AAchCA,wBACFA,C;GASAC,gBAxBSA,kBAD2CA,QAClBA;AA0BhCA,wBACFA,C;EAQAC,cACYA;AACVA,wBACFA,C;GAoBOC,YACLA,OAAOA,WACTA,C;EAEOC,cACLA;WACEA,eAiCJA;AA/BEA,UACEA,YA8BJA;AA5BEA,wDAEEA,OArBiBA,uBACCA,WA8CtBA;AAxBEA,wBAEEA,OAAOA,mBAsBXA;AApBEA,UACEA,eAmBJA;AAjBEA,wBAEEA,6BACEA,kCAAmCA,MAczCA;AAZ4CA;AAAOA;AAArCA,4BAAcA;AAAxBA,OAAUA,SAYdA,CAVEA,eAEEA,OAAOA,SAQXA;AANEA,mBAEEA,kBAAmBA,kCAIvBA;AADEA,4BACFA,C;GAaOC,cACEA;AAIPA,kBAQeA;AANbA,YAC2BA;YAEWA;AAEVA;AAC5BA,2BACEA;AAKFA,mCACEA;AACgDA;AAAOA;AAArCA,sBAAcA;AAAhCA;AAEeA;AACfA,oBAEoBA,wBAGtBA,YAoEQA;OA1DSA;AAQnBA,gBAEuBA;AAArBA;AAEmBA,qBAUnBA;AAAmBA,KAFrBA,eAIuBA;AAFrBA;AAEAA;AAEmBA,eAGnBA,OAMFA,iBAIkCA;AAFhCA;AAEoBA,kCAApBA;AAEmBA,uBAEGA,QAGtBA,OAGFA;AASAA,wBACFA,C;GAWOC,gBACLA;WAAmBA,QAerBA;AEqMEA;AF/MAA,8CEiPEC;AF7OID;AAAJA;AAGaA,gBAEfA,UAAUA,UACZA,C;GAyDAE,cACEA,WAA0BA,QAiB5BA;AAbMA;AAAJA,WAA0BA,MAa5BA;AAZEA,wDAKEA,QAOJA;AALEA,wBAEEA,sBAGJA;AADEA,QACFA,C;GAcKC,kBACHA;WAAoBA,QAYtBA;AAXkBA;AAIEA;AAGlBA,cAAwBA,QAI1BA;AADEA,OAmDOA,KAAYA,yBAlDrBA,C;GAaOC,kBACLA,WAAoBA,QAItBA;AAHMA,iBAAgDA,QAGtDA;AADEA,UAAUA,+EAAgCA,CARtCA,qBAlIGC,yCA2ITD,C;GA+CKE,kBAEHA;WAAeA,QAsBjBA;AArBEA;AAEEA,gBACOA,0BACHA,QAiBRA;AAdIA,QAcJA;AANEA,gBACOA,uBACHA,QAINA;AADEA,QACFA,C;GAMAC,gBAIEA,iBApbOA,KAibWA,YAlbgCA,QAClBA,SAqblCA,C;EAkJKC,kBAEHA;SAAuBA,QAmGzBA;AAhGEA,gDAAkBA,QAgGpBA;AA9FEA,UAAuCA,QA8FzCA;AA3FEA,iDACEA,uBAGEA,QAuFNA;AArFIA,mBAGEA,OAAOA,kCAkFbA;AAhFIA,QAgFJA,CA1EEA,uBAEEA,QAwEJA;AAtEEA,uBAAuCA,QAsEzCA;AApEEA,uBAAmBA,QAoErBA;AAlEEA,eACEA,OAAOA,aAiEXA;AA9DEA,eAGEA,2BA2DJA;AA8TeA;AArWaA;AAb1BA,oBAM2CA;AAHzCA,mBAGEA,OAAOA,kCA8CbA;KA7CeA,gBAETA,QA2CNA;KAvCMA,8BAEEA,QAqCRA;AAhCuCA;AAAXA;AAItBA,OAAOA,yEA4BbA,EA8TeA;AA/UMA;AAAnBA,UAEiCA;AAA/BA,4BACEA,QAcNA;2BADMA;AALJA,MACEA,QAKJA;;;AAFEA,OAvSOA,KAAYA,gBAySrBA,C;GAQKC,kBAAkBA;AAErBA,kBAA4BA,QA2F9BA;AApFEA,kBACEA,oBAAqCA,QAmFzCA;AAhFuCA;AACAA;AACnCA,uBAA8CA,QA8ElDA,MAxESA,iBACLA,QAuEJA;AAlEOA,yBAAkDA,QAkEzDA;AAtDuBA;AACAA;AAGjBA;AAEAA;AAEAA;AAAiBA;AAIAA;AACAA;AALrBA,OAEEA,QA4CJA;AA1CEA,WAGEA,QAuCJA;AAlCEA,gBACOA,uBAEHA,QA+BNA;AAxBEA,wBACOA,uBAEHA,QAqBNA;AAfEA,oBACOA,uBAEHA,QAYNA;AAHMA;AADAA;AAAJA,WAA8BA,QAIhCA;AAHEA,WAA8BA,QAGhCA;AAFEA,OAAOA,aAETA,C;GAEKC,kBAA2BA;;AAO9BA,4BACaA;oCAETA,QAONA;AAHSA,uBAAsCA,QAG/CA,CADEA,QACFA,C;GG70BKC,qGAQLA,C;GA8EAC,YAAyBA;AAEVA;AAKTA;AAAJA;AAAoBA,UAkEtBA,CAhEMA;AAAJA,WAAyBA,QAgE3BA;AA3DMA;AAAJA,YACQA;AACNA,YAGMA;AAAJA;AAAoBA,UAsD1BA,CApDUA;AAAJA,WAAyBA,QAoD/BA;6BA9CEA,WAQEA,MAsCJA;AA9BoCA;AAD9BA;AAAJA,YACWA;;;AAETA,UA4BJA,CAzBEA;AAEEA,QAuBJA,CApBEA,YACyBA;sBdzIrBC;AcyIFD,UAmBJA,CAhBEA,WACEA,OAAOA,SAeXA;AAZEA,WAEEA,UAAUA;AAKZA,4BACyBA;sBdxJrBC;AcwJFD,UAIJA,MAFIA,OAAOA,SAEXA,C;GAYAE,cAE+CA;yDAAhCA;AAEbA,QACFA,C;GAEAC,YAGEA,OAAOA,uBACTA,C;GAEAC,gBACMA;AAEJA,2BACEA,OAAOA,OAIXA;KAFIA,OAAOA,mBAEXA,C;GAiBKC,WACHA,aAAoCA,MAGtCA;;AADEA,MACFA,C;GAGKC,WAA0BA;;;AAI7BA;AAMiEA;;AAEjEA;;AAGEA,wBACYA;AACEA;AACZA,YAEeA;AACbA;iBAYNA,wBAEyCA;yBAEQA;;;;;YAOnDA,C;GAqCKC,WAECA;AAKgEA;AAY5DA,UAJAA,QAFAA,QADAA,QADAA,QADAA,QAHAA,IAAsBA;AAoB9BA,2DAE2CA;AAAzCA,wBAGyCA;AAAzCA,wBACEA,wBAE2CA;AAAzCA,wBAoBkBA;;;AATPA;AAEbA;AAEAA,gBACNA,C;EAEAC,cAEEA,OAAwBA,OAC1BA,C;;;ECzXSC,YAAcA,OAAQA,UAAiBA,C;;;GAsDtCC,YAAUA,aAA4BA,C;GAOzCC,YACHA,uBAAoBA,QAGtBA;AAFEA,mBAAwBA,QAE1BA;AADEA,+BACFA,C;EAEWC,cACJA,eAAkBA,MAEzBA;AADEA,iBACFA,C;GAGAC,YAAeA,gBAAgCA,C;EAE1CC,cAICA;;AACJA,4BACYA;AACVA,OAAOA,YAEXA,C;GAEgBC,WACdA,OA4BFA,eA5BaA,aACbA,C;;GA6BgBC,YAAYA;ObuhB5B9I,sBavhBoD8I,C;GAE5CC,YAAUA,sBAAsBA,C;;Id+J7BC,WACyBA;AAAPA,QAE7BA,C;IAiBSC,WACPA;cAAcA,UAShBA;AAPMA;AAAkBA;AACtBA,SAAwBA,UAM1BA;AClQwCA;AD8PtCA,iBACWA,8BAAUA;AAAnBA;;AAEFA,QACFA,C;IAEyBC,WACvBA;cAAgBA,UAWlBA;AAV2BA;AAAoBA;AAEzCA;AAAkBA;AACtBA,SAA6BA,UAO/BA;AANgBA;AexUhBC;AfyUED,iBACyCA,8BAAmBA;AAAnBA;AACxBA;AAAXA,mCAAUA;AADdA,MQ1QEA,kBR6QJA,Oc/WFA,oBdgXAA,C;;GA2FIE,cACFA;AAAIA,oCAAUA;AAAdA,OAAwCA,MAG1CA;AAFEA,oBAEFA,C;;GApDQC,YACDA;AACDA;AAAJA,WAAkBA,MAsBpBA;AArBiBA;AAIkCA;AAKAA;AAIjDA,OAzBFA,gDAiCAA,C;;GA8nB2BC;AACHA;AAClBA;AACAA,oBAEDA,C;;EA6qBLC,YACMA;qBAEAA;AAAJA,WAAmBA,MAmBrBA;AAhBqCA;AAD/BA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAGIA;AAAJA;AAIAA,QACFA,C;;EAwBOC,YAAcA;AAcYA,qCAMoCA;AAC/DA;AAAJA,WAA2BA;AA2BvBA;AAAWA;AAAeA;AAAMA;AAAQA;AAD5CA,OArHFA,mRAsHwDA,4EACxDA,C;GAMcC,YAmDZA,OAA8BA;mEAChCA,C;GAkCcC,YASZA,OAA8BA,mEAChCA,C;;EAsCOC,YACLA;WAAqBA,4BAA4BA,WAEnDA;AADEA,4DACFA,C;;GANAC,sDACgEA,C;;EAkBzDC,YACLA;AAAIA;AAAJA,WAAqBA,4BAA4BA,WAMnDA;AALMA;AAAJA,WACEA,uDAA0DA,eAI9DA;AAFEA,kEACoDA,eACtDA,C;;GAZAC,cAAmBA;AACHA;;AADhBA,sCAGuEA,C;;EAiBhEC,YAAcA;uCAA+CA,C;;;GAwBpEC,YACYA,gBAERA,0BAC6CA;AAG/CA,QACFA,C;;EA6JOC,YACLA;AAAIA;AAAJA,WAAoBA,QAQtBA;AAL+BA;AAIZA;;AAAVA;AAAPA,QACFA,C;;;EA+hBOC,YAILA,kBAHyBA,WAGPA,UACpBA,C;;;;;;EAoBOC,YACEA;AAEPA,WAAkBA,wCAEpBA;AADEA,kBAAmBA,WACrBA,C;;EAsBcC,cAAEA,mBAMhBA;AALEA,YAA4BA,QAK9BA;AAJEA,wBAA4BA,QAI9BA;AAHEA,+CAGFA,C;GAEQC,YACFA;AACAA;AAAJA,WAGgCA;KAIDA,8BAICA;AAEhCA,SAAqCA,gBACvCA,C;EAEAC,YACMA;WAA+BA;AAGnCA,kBAAkBA,qCAvkEJA,YAykEhBA,C;;GAGOC,YAAgCA,UAAaA,C;GAK7CC,YAAoCA,UAAiBA,C;GAwB9CC,YACRA;AAnENA;AAoEsBA;AAEpBA,4BACaA;AACXA,YACEA,QAGNA,E;;EA8bOC,YAAcA,aAAOA,C;;GAJ5BC,4CACoCA,mBACtBA,6CAFdA,AAEyEA,C;;EA2ElEC,YAAcA,uBAAgBA,WAAQA,C;;GAD7CC,8BAA0BA,C;;Ge1yGlBC,YAAUA,aAAOA,C;GAITC,WACdA,OAwUFA,eAxUaA,aACbA,C;EAqCWC,cACTA;wBACgBA;AACdA,WAAqBA,MAWzBA;AAV6BA;;AACzBA,QASJA,MARSA,2CACMA;AACXA,WAAkBA,MAMtBA;AAL6BA;;AACzBA,QAIJA,MAFIA,OAAOA,UAEXA,C;GAEEC,YACIA;AAAOA;AACXA,WAAkBA,MAMpBA;AA2KSA,YAL+BC;AA1K1BD;AACZA,OAAeA,MAGjBA;AADEA,aACFA,C;EAEcE,gBACZA;wBACgBA;AACdA,YAA0CA;AAArBA,SACrBA,oBACKA,2CACMA;AACXA,YAAiCA;AAAfA,SAClBA,oBAOSA;AACXA,YAAiCA;AAAfA,SAoJoBC;AAlJzBD;AACbA,WAEEA,aADyBA;KAGbA;AACZA,QAEOA;YAEoBA,eAhB/BA,C;EA8DKE,cACeA;AAAOA;AACLA;KACpBA,UAGEA;AACAA,cACEA,UAAUA;AAEAA,MAEhBA,C;GAEKC,gBACsBA;AACzBA,WACEA,YAA2BA;KAEtBA,KAETA,C;GAWKC,WAKHA,wBACFA,C;GAGkBC,cACEA;AA+IpBA;AA9IEA,iBACWA;AAATA,cAEyBA;AACpBA;AACQA;AAAbA;AAGFA;AACAA,QACFA,C;GA6CIC,cACFA;WAAoBA,QAOtBA;;AALEA,gBAEWA,kBAAuBA,QAGpCA;AADEA,QACFA,C;EAEOC,YAAcA,OAAQA,UAAiBA,C;GAE5BC,cAChBA,WACFA,C;GAEwBC,cACtBA,WACFA,C;GAEKC,sBAGLA,C;GAEKC,yBAELA,C;GAOAC,WAQiBA;AAAfA;AACAA;AACAA,QACFA,C;;;GAiDQC,YAAUA,eAAYA,C;GAGdC,YACdA;AAAuCA;AA0BzCA;AACEC;AA3BAD,QACFA,C;;GA6BME,WAAWA,aAAQA,C;EAEpBC,WACmBA;AAAtBA,gBACEA,UAAUA;KACDA;AAAJA,YACLA;AACAA,QAMJA,MAJIA;AACAA;AACAA,QAEJA,G;;GFbiBC,YAAOA,gBAAoCA,C;;GAExDA,cAAmBA,kBAAmDA,C;;GAEtEA,YAAgBA,gBAAoCA,C;;EGzXjDC,YAAcA,0BAAkBA,C;;GA4BhCC,kBAAUA;AAmBXA;AACAA;AACAA;8DACkCA;AAAtCA,uBAA+CA,QAKjDA;AADEA,UAAUA,gCAA0CA,sBACtDA,C;GCiCGC,YAEHA,OAAWA,8BACbA,C;ECusDKC,gBACHA,mBACEA,UAAMA,SAEVA,C;GASIC,gBACFA;;;KAIEA,UAAMA;AAGRA,QACFA,C;;;GA/nCUC,YAAUA,eAAgCA,C;;;;EA2BlCC,cACdA;AACAA,WACFA,C;;;;;;;;;;;;;;;;;EA2HaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;EAmCaC,cACXA;AACAA,WACFA,C;;;GAoCQC,YAAUA,eAAgCA,C;EAErCC,cACXA;AACAA,WACFA,C;;;GA4CQC,YAAUA,eAAgCA,C;EAErCC,cACXA;AACAA,WACFA,C;;;;;;GCtlCgBC,WAA4BA;AAA5BA;AAEdA,gCACEA,OAAOA,MAiCXA;AA/BEA,qDAewDA;;;AAAVA,0BADxCA,KAPYA;AAUhBA,OAAOA,eAcXA,MALSA,2BACLA,OAAOA,MAIXA;AADEA,OAAOA,MACTA,C;IAEYC,mCAMNA,KALYA,eAMlBA,C;IAEYC,8BAMNA,KALYA,eAMlBA,C;IAEYC,YAoBCA,SAlBbA,C;GAwIWC,YACXA,OAhCAA,SCrJIC,SA8JJC,+BDwBFF,C;GAiBQG,cAENA;AACUA;AACVA,YACFA,C;GAsBQC,cACNA,SACFA,C;GAQQC,cACNA,QACFA,C;GAOQC,cAENA,IACIA,OAAyBA,OAC/BA,C;GASKC,cACMA;AACLA;AAEqBA;AAMdA;AAAXA,WAGEA;KACKA,WACLA;KCnHFA;AAkGEA;AACAA;ADsBAA,kBAEJA,C;GAIkBC;;;AAwBhBA,OAAYA,OAA+BA,YAG7CA,C;GCgZSC,cACUA,mCACfA,OAAOA,OAWXA;AARmBA,gCACRA;AAAPA,QAOJA,CALEA,UAAUA,kIAKZA,C;GCluBKC,WACHA;;AAGwBA;;AACtBA;AACOA,SAEXA,C;IAEKC;IAKDA;;AAIAA,aF3BAA,OAAyBA,GE4BMA,QAGnCA,C;GAQKC,YAtDHA;AAwDAA;;AAEEA,SF3CAA,OAAyBA,GE4CMA,aAGjBA;OAGlBA,C;GAUKC,YACHA;AAAIA;AAAJA,YACEA;AACwBA;AACxBA,MAcJA,CA7FEA;AAkFIA;AAAJA,YACQA;;WAGAA;AACgBA;;AAEtBA,oBAIJA,C;GA2BKC,YACGA;AACNA,YAGEA;AACAA,MAUJA,CAR6CA;AC2uCzCA,gBDpuCkCA,QACtCA,C;GEm6DUC,YAIJA,OCjnCJA,cDinCkCA,C;GDv+B/BC,oBAAwBA;;AAE3BA,KAA+BA,cAKjCA,C;GAIEC,kBACAA;AAASA;AAATA,SAA2BA,OAAOA,MAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;GAEEC,oBAEAA;AAASA;AAATA,SAA2BA,OAAOA,OAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;GAEEC,sBAEAA;AAASA;AAATA,SAA2BA,OAAOA,SAQpCA;;AANOA;IAEIA;AAAPA,QAIJA,gB;EAqBKC,kBAEHA;MAjWEA,MACmCA;AADnCA;AAoWMA,aAEAA,QAKRA,OACFA,C;;IHpnCMC,YACMA;;AAAIA;AACRA;AACAA,MACFA,C;;GAMOC;AAELA;AAI4DA;AACxDA;8CACLA,C;;IASHC,WACEA,WACFA,C;;IAOAC,WACEA,WACFA,C;;GA2CFC,cACEA,gDAQMA,KAPiBA;KASrBA,UAAUA,kCAEdA,C;;GAbAA;;QAaAA,C;;IAXIC,WACEA;;AACKA;AACLA,WACFA,C;;EAkECC,cACHA;UACEA;KACeA,iCACJA;AAAXA,IAAsBA,SAA8BA,iBAEpDA,KAAkBA,iBAItBA,C;EAEKC,cACHA,UACEA;KAEAA,KAAkBA,mBAItBA,C;;GAdsBC,WAChBA,oBACDA,C;;GAQiBC,WAChBA,yBACDA,C;;GA2FDC,YAAYA,qBAA+CA,C;;IAEtCA,cAGvBA,YnBssDFA,cmBrsDCA,C;;GA2C0CC,yBAE1CA,C;;;GCpVIC,yBdqGLC;AcnGED,gBAA0BA,UAAUA;AACNA;AAK9BA,WACFA,C,CATKE,kC;;EAmBAC,cACHA;WAA0BA,UAAUA;AACpCA,OACFA,C;EAEKC,cACHA,cACFA,C;;GAIKC,cACHA;WAA0BA,UAAUA;AACpCA,OACFA,C,CAHKC,kC;EAKAC,cACHA,aACFA,C;;GAyEKC,YACHA,cAAmBA,QAErBA;AADEA,OAAOA,uBACTA,C;GAEYC,YAAWA;AAEIA;AA1CFA;AA6CLA,mCAChBA,OAAOA,eAMXA;KAFIA,OAAOA,WAEXA,C;;EA4FUC,gBACHA;AACLA,YACMA;AACJA,WAIYA,YAGdA,OAAOA,cACTA,C;GAZUC,sC;GAeAC,gBA/CVA;AAkDEA,QA/KFA;AAgLEA,QACFA,C;GAsEKC,YAAYA;AArGWA;AAuG1BA,SACWA;AACTA,cAEAA,UApCKA;AArEeA;AA8GlBA,QACEA;AACAA,MAURA,CA3BEA;AACAA,WAsBEA;;AE4hCFA,gBF5hC0BA,kBAI5BA,C;GAEKC,YACHA;AADGA;;AACHA,WAAuBA,MA6BzBA;AA5J4BA;AAgI1BA,SACsCA;AACpCA;AACAA,YAEEA,2BAGOA,YAGTA,UApEKA;AArEeA;AA8IlBA,QACEA;AACAA,MAURA,CA3DEA;AACAA,WAqDcA;AACZA;;AE4/BFA,gBF5/B0BA,kBAI5BA,C;EAEgBC,WAIYA;AAC1BA;AACAA,OAAOA,SACTA,C;EAEgBC,YACEA;AAEhBA,gCACiCA;AACvBA,MAIVA,QACFA,C;GA0DKC,YAASA;;AAEFA,yBACEA,wBACRA;KAEAA;KAG0BA;AAvK9BA;AACAA;AAwKEA,YAEJA,C;EAWKC,cAGyBA;AAnL5BC;AE1QFA;AF+bED,WACFA,C;GAEKE,YAAcA;AAaPA,iCACRA;AACAA,MAMJA,CAxOEA;AAqOAA;;AEu3BAA,gBFv3BwBA,iBAG1BA,C;GAEKC,YACHA;AAAUA,gCACRA,YA5OFA;AA+OIA;;AE62BJA,gBF72B4BA,uBAIxBA;AAEFA,MAIJA,CADEA,YACFA,C;GAEKC,cAAmBA;AA3PtBA;AA+PAA;;AE61BAA,gBF71BwBA,mBAG1BA,C;;;GAnIYC,cAAmBA;AA/H7BA;IAsIEA,IAAYA,YAYCA,2BAnBcA;AAuB3BA;AAKAA,KAAkBA,iBAItBA,C;GAIYC,cAAgBA;KAE1BA,aAtJOA;AAyJPA,SAC8BA;AAhI9BA;AACAA;AAiIEA,cAEmCA;AA9NrCA;AACAA;AA+NEA,QAEJA,C;EAuFYC,cACVA;AADUA;;AACVA;AA9ToBA;AAiUlBA,YACEA,MAnQGA;AAqQMA;AAC6BA;AAAkBA;AAD/CA;AE4yBbA,sBFzyBIA,MA2JNA,MAtJIA,mBAGWA;AACTA,WAGmBA;AAAOA;AAQvBA;AACDA;AAKJA;MAvesBA;AAueGA,wBAuGLA;AAvGpBA,MAzecA;AAAOA;AA2enBA,MAAwBA;;AE6OrBA;AAAPA,MACmCA;KFzIbA;AArGlBA;MAGSA;AAC6BA;AAAkBA;AAD/CA;AE0wBbA;AFxwBMA,MA0HRA,CEpa2BA;AF8SrBA;KAmFIA;AAlkBmBA;AAqjBvBA,SA/D+BA,kBAgEHA;KACrBA,MACLA,aA9BsBA,gBA+BDA,UAGrBA,aAzBcA,gBA0BDA;AAKfA;AAIIA;AAAqBA,iBAMrBA,WA1SkBA;AAC1BA;AACOA;AAnEPA;AACAA;AA6WUA;AACAA,cAEAA;AAKJA,MAcRA,EAX8BA;AAxTFA;AAC1BA;AACOA;AAwTAA;AACcA;AADnBA,OA/YFA;AACAA,WAKAA;AACAA,MA+YEA;IAEJA,C;;GA7W4BC,WACtBA,kBACDA,C;;GA8BuBC,WACtBA,oBACDA,C;;GAoCWC;AAjIdA;AAuIIA,OACDA,C;;IAKYA,cAEXA,aACDA,C,CAHYC,mC;;GASKD,WAChBA,uBACDA,C;;GAwEqBE;AACtBA;AAhC0BA;AAjL5BC;AACAA;AAkLAD,QA+BCA,C;;GAQ2BE,WACtBA,mBACDA,C;;GAcmBC,WACtBA,uBACDA,C;;GA6DGC,WAA+BA;;IAQVA;AA3clBA,yBAmc4BA;AAS3BA;AACAA,WAAwCA;AAAOA;AAA/BA;AAAhBA;;KACEA;KExjBZA;AF4jBUA;AACAA,MAkBJA,CAhBqBA,iBAtYHA,iCACFA;AA+DbA;AA0UKA,OAGFA,MASNA,CAJyBA;;AACEA,SAAoBA;AAC3CA,OAEJA,C;;GAH+CC,YAAOA,aAAcA,C;;GAKpEC,WAAwBA;IAEGA;AAjgBxBA,uCA+fqBA;AAGpBA;;AEplBVA;AFslBUA,OAEJA,C;;GAEAC,WAAgBA;IAEDA;AACPA;;AAEqBA;AACvBA,iBANUA;AAQZA;AAzWDA;AA0W6BA;AAAOA;;AAAnCA,yBACEA;KEpmBZA;AFwmBUA,OAEJA,C;;;GGkPUC,YACDA;AADCA;ADpmBWC;ACsmBrBD;AEoqjCOA,mBFlqjCPA;AAQJA,OHtsBFA,kBGusBAA,C;;GATME,sBAECA,C;GAFDC,uD;;;;;ED91BCC,YAAcA,OAAEA,WAAMA,C;;;;GAwiCEC;;AAC7BA;YhB/9BFA;AgB+9BEA;;AACIA;AAAJA,WAAwBA;AHzYlBA;AACyBA;OG0YhCA,C;;GAyLIC,YAAUA;IAEXA,cACEA;AACAA,MAMNA,CAJIA,gCANWA;AAOXA;AA4DFA,yBAzDFA,C;GAEKC,cAAkBA;IAEnBA,cACEA;AACAA,MAMNA,CAJIA,kCANmBA;AAOnBA;AAgDFA,yBA7CFA,C;GAVKC,uC;GAwBWC,YACdA,OAAOA,gBACTA,C;GAFgBC,mC;GAaAC,YACdA,OAAOA,gBACTA,C;GAEiBC,cACfA,OAAOA,kBACTA,C;EAOSC,cAAkBA,MAAIA,C;GAY7BC,YACAA,aAAyCA,OAAOA,MAElDA;AADEA,OAAOA,sBACTA,C;GAHEC,mC;GAKAC,cACAA,aAAyCA,OAAOA,OAElDA;AADEA,OAAOA,wBACTA,C;GAHEC,4C;GAKAC,gBACAA,aAAyCA,OAAOA,SAElDA;AADEA,OAAOA,0BACTA,C;GAHEC,qD;GAS4BC,YAE1BA,QAACA,C;GAFyBC,6C;;GAxDrBC,WAAMA,OAAKA,iBAASA,C;;GAapBC,WAAMA,OAAKA,iBAAaA,C;;IAIxBC,YAASA,OAAKA,mBAAuBA,C;GAArCC,+C;GIlgCFC,cACDA;AAGJA,mBACFA,C;GAEYC,gBAIVA;WAQFA,C;GAoBOC,WAQUA;AAAfA;;AAEAA,QACFA,C;GA8JQC,gBACNA,OAAOA,OX7eT3K,oBW8eA2K,C;GAMQC,cACNA,OXrfF5K,mBWsfA4K,C;GAupBQC,kBAOAA,OAqDRA,iBAhCAA,C;GC5+BcC,gBAEZA;AAAIA,YACFA,oBAEEA,aAgBNA;AAdIA,gBAcJA,CAZ+BA;AAC7BA;;IAEEA,kBAGAA,+BAAkBA;AAAlBA,QfkUUA;AehUZA,6BAIFA,C;GAccC,gBAEZA;AAAIA,WACFA,gBAYJA;Af8QAA;AevREA;;IAEEA;AfsSFA,KAAYA,KAAUA,wBenSpBA,+BAAkBA;AAAlBA,QAEFA;AfkTA/M,KAA6CA;AAHD+M;Ae9S5CA,6BACFA,C;GAOGC,YACHA;QAAoBA,oBAApBA,IACEA,YAAwCA,QAG5CA;AADEA,QACFA,C;GAKKC,cAOOA;AAkBaA;AAGhBA;AAAwBA;AAA/BA;AACOA,UAAeA,MAoFxBA;AAnFwBA;AACpBA;AACAA,cACAA,IAUGA,WACHA,QAAoCA,MAqExCA;AApEqBA,+BAAMA;AAANA;AACGA,+BAAMA;AAANA,eAEHA,SACjBA;AACKA,WACHA,SACEA,OAAYA;AACZA,MA4DRA,CA1DyBA;AACCA,+BAAMA;AAANA;AACpBA,mBAEcA,SACdA;KAGOA,MAAPA,SAEgBA,SACdA;AACAA,UAQEA;AAEYA,+BAAMA;AAANA,oBACVA,IAEFA;AACAA,MAgCVA,EA7B4BA;AACHA;AACnBA,wBAOJA,iBAEEA;;AAMFA;AACYA,+BAAMA;AAANA;AACVA,YAEEA;SAGJA,WACEA;AAEFA;AACAA,SACFA,C;GClTUC,cACWA;AAAaA;AAC9BA,4DACEA;AAEFA,QACFA,C;GCxFcC,YAEZA;AAFYA;AAERA,WACFA,aAwBJA;AjBqfAA;IiBxgBIA,OAAkBA;AAClBA;AjByiBFnN,KAA6CA;AiBxiBtCmN;AACLA,MAAUA;AASVA;AjB8hBFnN,KAA6CA,oBiB3hB3CmN;+BAAkBA;AAAlBA,QjBwhB0CA;AiBrhB5CA,6BACFA,C;;GHiCQC,YAAUA,aAAOA,C;GAITC,WACdA,OAmWFA,eAnWaA,aACbA,C;GAMKC,YACHA;yCACgBA;AACdA,4BAOJA,MANSA,2CACMA;AACXA,4BAIJA,MAFIA,OAAOA,UAEXA,C;GAEKC,YACCA;AACJA,WAAkBA,QAGpBA;AADEA,OAAOA,OADMA,kBAEfA,C;EAYWC,cACTA;yCACgBA;AAC8BA;AAA5CA,QAOJA,MANSA,2CACMA;AAC8BA;AAAzCA,QAIJA,MAFIA,OAAOA,UAEXA,C;GAEEC,YACIA;AAAOA;AACXA,WAAkBA,MAIpBA;AAHeA;AACDA;AACZA,sBACFA,C;EAEcC,gBACZA;AAcWA;AACXA,YAAiCA;AAAfA,SdlHiBC;AcqH/BD;AAAJA,YACEA;AAEAA,iBAEYA;AACZA;;AAKEA,aAlBNA,C;EA8DKE,cACEA;AAAOA;AACZA,4BAESA;AAAPA,OAAgBA;AAChBA,cACEA,UAAUA,WAGhBA,C;GAEKC,WACHA;AAAIA;AAAJA,WAAmBA,QAgDrBA;AA/CoBA;;AAIJA;AACdA,YAEsCA;;AACpCA,qBAEwCA,UACtCA;AAKOA;AACXA,YAEsCA;;AACpCA,iBAIwCA,WACtCA,KAKOA;AACXA,YAEsCA;;AACpCA,iBAGqCA;;AACnCA,kBAEwCA,UACtCA,MAKCA;AAAPA,QACFA,C;GAyEKC,cAEHA,SdnTmCH,kBcoTrCG,C;;EAiCIC,cACFA;WAAoBA,QAMtBA;;AAJEA;AACEA,yBAAkDA,QAGtDA,CADEA,QACFA,C;;GAmDQC,YAAUA,eAAYA,C;GAGdC,YACdA;OAwBFA,WAxB0CA,SAC1CA,C;;GAyBMC,WAAWA,aAAQA,C;EAEpBC,WACCA;AAAOA;AACEA;AACmBA;AAAhCA,WACEA,UAAUA;KACLA,gBACLA;AACAA,QASJA,MAPIA;AAIAA;AACAA,QAEJA,E;;GAgxBgBC,YAyXhBA;AACEC;AAzXAD,QACFA,C;GAEQE,YAAUA,aAAOA,C;EAIpBC,cACHA;yCACgBA;AACdA,WAAqBA,QAWzBA;AATIA,iBASJA,MAFWA;AAAPA,QAEJA,E;GAEKC,YACCA;AACJA,WAAkBA,QAGpBA;AADEA,OAAOA,SA4NIA,iBA3NbA,C;EA0CKC,cACHA;yCACgBA;AACdA,YAA0CA;AAArBA,SACrBA,OAAOA,YAQXA,MAPSA,2CACMA;AACXA,YAAiCA;AAAfA,SAClBA,OAAOA,YAIXA,MAFIA,OAAOA,UAEXA,C;GAEKC,YACCA;AAAOA;AACXA,YAAiCA;AAAfA,SACPA;AAEPA;AAAJA,WAC4BA;KAGdA,kBACIA,QAKpBA;OAJ8BA,YAG5BA,QACFA,C;GAwDKC,cAEHA,cAAkBA,QAGpBA;AAFiCA;AAC/BA,QACFA,C;GAmBmBC,YACEA;AA0LrBA;AAzLEA,iBACWA;AAATA,cAE0BA;AACrBA;AACQA;AAAbA;AAXFA;AAeAA,QACFA,C;GAkCIC,YAKFA,OAA0CA,iBAC5CA,C;EAoBIC,cACFA;WAAoBA,QAOtBA;;AALEA,gBAEWA,kBAAqBA,QAGlCA;AADEA,QACFA,C;;GAEOC,WAQUA;;;AAEfA,QACFA,C;;;GA4GMC,WAAWA,aAAQA,C;EAEpBC,WACmBA;AAAtBA,gBACEA,UAAUA;KACDA;AAAJA,YACLA;AACAA,QAMJA,MAJIA;AACAA;AACAA,QAEJA,G;;;;GvB9kDgBC,YAAYA,OD6Q5BA,WAEyBA,aC/Q4BA,C;EAEnDC,cAAwBA,OAAIA,WAAOA,C;EAwIzBC,gBAA0BA,ODuNtCA,cCvN0CA,sBAAiCA,C;EAsVpEC,YAAcA,OAAaA,eAAoCA,C;;;G0BvfxDC,cACRA;;QjB2gBWA;AiBxgBXA;AACAA;AjBugBWA;AA2BftP;AA3BesP,WiBpgBZA,C;;EA+EAC,cACHA;UAAcA,WAAdA;AACEA,OAAgBA,aAEpBA,C;GAoEQC,YAAUA,OAAKA,KAALA,UAAWA,C;EAItBC,YAAcA,OAAQA,UAAiBA,C;;;;EAwInCC,cAAkBA,oBAASA,C;EAgBjCC,cACHA,aACFA,C;GAIQC,YAAUA,eAAWA,C;GACbC,WAAQA;Od6BxBjM,YAxUaiM,Uc2SoBA,C;EAE1BC,YAAcA,OdvDQA,YcuDOA,C;;;;EC3S/BC,cACHA;oBAA4BA,SAA5BA,OACFA,C;EAkEYC,gBACRA,O5B0PJA,iB4B1PQA,eAA4CA,C;EAU7CC,YAAcA,OAAaA,kBAAoCA,C;;;;;;GC5GxEC,cACEA;uBAAuBA,UAAMA;;6BADrBA;AAQIA;AAAVA,aAIOA;AAAPA,QAIJA,C;GAmDAC,YAEEA;WAAoBA,MAyBtBA;AAtBEA,sBACEA,QAqBJA;8CAdIA,OA8BFA,+BAhBFA;AAVEA,uBAO8BA;AAE9BA,QACFA,C;;EAkBWC,cACPA;AAuHsBA;AAvHtBA,WACEA,OAAOA,aAQXA;KAPSA,uBACLA,MAMJA;KAHuBA;AACnBA,6BADqCA,YAGzCA,E;GAEQC,YAAUA,6BAAoCA,eAAqBA,C;GAKtDC,WACnBA,iBhBvGWA;AgBuGMA,OhBiOnB1M,YAxUa0M,UgByGbA,CADEA,OA8KFA,cA7KAA,C;EAuEKC,cACHA;gBAAiBA,OAAOA,aAsB1BA;AArBsBA;AACpBA,wBACeA;AAKMA;AAAnBA,0BACUA;YAKVA;AAIAA,cACEA,UAAUA,WAGhBA,C;EAgBaC,WAECA;AACZA,YACqBA;AAAZA,SAETA,QACFA,C;GA+BAC,YACEA;mDAAmCA,MAGrCA;AAFeA;AACbA,kBACFA,C;;;;GAuBQC,YAAUA;OAAQA,OAAMA,C;EAEzBC,cACLA;aACcA,SAAKA;KACbA;AAAQA,mCAAcA;AAAdA,OAFdA,QAGFA,C;GAKqBC,YACnBA;cACcA;AAAKA,eACbA;A9BmWR/X,yB8BrWE+X,QAGFA,C;;;;;;;;GC9MQC,gBAwVyBA,aAtVHA;AAAPA,QAEvBA,C;GAJQC,uC;IA0BQC,WACQA,UAExBA,C;;;IClHgBC,WAAWA,UAAmBA,C;;GAgBpCC,gBACJA;AACaA;AACJA;AACbA,SAAiBA,wBAkBnBA;;AA0BAA;AAxCoBA,mBAUEA,KAJCA;AAOrBA,sBf0hCgBA,aAFVA,sBevhCRA,C;GAtBUC,qC;;GA+DLC,cACHA;AAMEA;AAAQA;AAAYA;;AANtBA,sBAsNQA;AAhNEA;AAARA,uBAAOA;AAAPA;AACoBA;AAAZA;AAARA,uBAAOA;AAAPA;AACoBA;AAAZA;AAARA,uBAAOA;AAAPA;AACQA;AAARA,uBAAOA;AAAPA;AACAA,QAYJA,MALYA;AAARA,uBAAOA;AAAPA;AACoBA;AAAZA;AAARA,uBAAOA;AAAPA;AACQA;AAARA,uBAAOA;AAAPA;AACAA,QAEJA,E;GASIC,gBACFA;AAAqCA,sCAGnCA;AAIeA,sCADjBA,SACiBA;AAEfA,WACMA;AAAJA,QAAoCA;AAC5BA;AAARA,YACKA,sBACLA,eAAwCA;AAGNA;AAChBA,aADCA,qBAKnBA,YACMA;;AAAJA,QAAwCA;AAChCA;AAARA,uBAAOA;AAAPA;AACQA;AAARA,mBAGIA;AAAJA,UAAwCA;AACpBA;AAAZA;AAARA,uBAAOA;AAAPA;AACoBA;AAAZA;AAARA,uBAAOA;AAAPA;AACQA;AAARA,uBAAOA;AAAPA,eAINA,QACFA,C;GrBkBcC,YAEZA,oBAAuBA,OAAOA,MAEhCA;AADEA,sBZggBcA,WY/fhBA,C;GA0MQC,gBACEA;AAAUA;AAClBA,oBACEA,OADFA;AAGcA,QAEhBA,C;GA2FQC,gBAEJA,OIleJA,WAIUA,iBJ+diDA,C;GNzc7CC,YACZA,sDACEA,OAAOA,OAMXA;AAJEA,uBACEA,wBAGJA;AADEA,OAAOA,OACTA,C;;GMijB4BC;AACtBA;;AAASA;AAxFEA;AA2BfzR;AAgEmByR;AACfA,QACDA,C;;;;EAhRSC,cAAEA,mBAGQA;AAFpBA,0CAEoBA,C;GsBsGhBC,YAAYA;SAAWA,wBAA2BA,C;EA2EnDC,YACEA;AAAIA,OtBhNcA;AsBiNdA,OtB9MeA;AsB+MfA,OtB5MaA;AsB6MbA,OtB1McA;AsB2MZA,OtBxMcA;AsByMdA,OtBtMcA;AsBuMfA,OtBpMoBA;;AsByM9BA,QAEJA,C;;GArDcC,YACRA;AAAOA;AAGgBA;AAD3BA,WAAkBA,UAIpBA;AAHEA,UAAiBA,cAGnBA;AAFEA,SAAgBA,eAElBA;AADEA,gBACFA,C;GAUcC,YACZA,UAAcA,UAGhBA;AAFEA,SAAaA,WAEfA;AADEA,YACFA,C;GAEcC,YACZA,SAAaA,UAEfA;AADEA,WACFA,C;;;;;E5B1aOC,YAAcA,sBAAgBA,C;;IAgE1BC,WAAcA,2CAA4CA,C;IAC1DC,WAAqBA,QAAEA,C;EAE3BC,YACEA;AACHA;AAIyBA;AADTA;AAAkCA;AACpCA;AAClBA,WAAgBA,QAKlBA;AAHuBA;AACKA;AAC1BA,iBACFA,C;;GAvDAC,0CAGiBA,C;GAgBjBC,wCAEsBA,C;;IAuLXC,WAAcA,kBAAYA,C;IAC1BC,WAAkBA;AAGvBA;AAAJA,YACMA;AAC0CA,wDAGrCA;AAAJA,WAC0CA;KAC1CA,OAC0BA,gCAAQA;KAKDA,qEAExCA,QACFA,C;;GA3IAC,sEAI0EA,C;EAiB1EC,+DAK4EA,C;GAkEjEC,sBAITA,YAEEA,UAAUA;AAEZA,YACEA,YAEEA,UAAUA;AAEZA,QAGJA,CADEA,QACFA,C;;IAmEWC,WAAcA,kBAAYA,C;IAC1BC,WAAkBA;AAEHA;AACpBA,oCAAaA;AAAjBA,OACEA,oCAMJA;AAJMA;AAAJA,SACEA,8BAGJA;AADEA,qCAAqCA,MACvCA,C;;GAtBAC,oBAGwCA;AAHxCA,gDAK6DA,C;;EM4OtDC,YACQA;AADRA;AAnFPA;AAqFSA;AAELA;AArDF9S;AAuDmB8S;AACfA,SAIFA,WAAwBA;AASEA;AACAA;AAEqBA;AAA/CA,QAWJA,C;;GA5CAC,8CAOoDA,C;;ENjI7CC,YAAcA,sCAAiCA,C;;GADtDC,8BAA8BA,C;;EAiBvBC,YAAcA;4DAEMA,C;;GAH3BC,8BAAkCA,C;;EAe3BC,YAAcA,0BAAqBA,C;;GAD1CC,8BAAwBA,C;;EAiBjBC,YACLA;WACEA,iDAIJA;AAFEA,mDACaA,WACfA,C;;EARAC,8BAAkDA,C;;EAc3CC,YAAcA,qBAAeA,C;;;EAQ7BC,YAAcA,sBAAgBA,C;;;EAgB9BC,YAAcA;8HAEoDA,C;;EK7iBlEC,YAELA,0BACFA,C;;EA8DOC,YACEA;AACsBA;AAehBA;AAZKA;AACSA;AAC3BA,wBAEEA;KAPEA;AAOFA,KAIIA;AAAJA,YAEaA;AAEXA,eAgENA,CA3DIA,8BACaA;AACXA,WACEA,aACEA;AAEUA;AA1BdA,UA4BOA,WACLA;AACYA;AA9BlBA,MAuEWA;AAhCYA;AACrBA,iBACaA;AACXA,mBAKWA;AAHTA,OAQJA,UAIEA,WACQA;;;aAEDA,WACGA;;UAIAA;AACFA;qBAI6BA;AAAPA;AACEA;AACLA,KAFdA;AAEfA,oBAA4CA,8BAQhDA,MAFIA,iCAF0BA,aAI9BA,C;;GAlGMC,sCAA8DA,C;;;;;EwBqHxDC,gBAAoBA,OAAIA,+BAA6BA,C;SAgBrDC,cAA+BA,OjCoN3CA,iBiCpN+CA,kBAA4BA,C;EAqJpEC,cACOA;AAAgBA;AACvBA,UAAqBA,QAc5BA;AAZEA,WvB4LkDA;GuB1LrBA;MAClBA,YAEgBA;KAClBA,OAEoBA,kBAG7BA,6BACFA,C;GA2CQC,YAAOA;AAGCA;AACdA,QAAOA,OACLA;AAEFA,QACFA,C;GA2HMC,YACQA;AAAKA;AACZA,UAAeA,UAA2BA;AACjCA;AACVA,SAAeA,UAA2BA;AAC9CA,QACFA,C;EAoFEC,cAASA;A7BtSTA,OAAeA,KAAUA;A6B0SzBA;AACEA,SAA2BA,QAI/BA,CAHIA,IAEFA,UAAUA,4BACZA,C;EAkBOC,YAAcA,OAAaA,kBAAqCA,C;;;;;GvBjlB/DC,YAAYA,OAAMA,gCAAQA,C;EwBnD3BC,YAAcA,YAAMA,C;;;;;ExB8BbC,cAAaA,eAAsBA,C;GAGzCC,YAAYA,OAAWA,SAAoBA,C;QAG5CC,YAAcA,sBZ2qBLA,cY3qBiDA,C;GAGzDC,cACNA,UAAUA,UAAmCA,QAC9BA,QAAgCA,cACjDA,C;;;;;;GA0eQC,YAAUA,oBAAgBA,C;EA4B3BC,YAAcA;6BAAmCA,C;;GAM1CC,gBACgBA;AACvBA,UAAqBA,QAa5BA;AAZEA,oBAekDA,OAbVA;MAC7BA,YAYuCA,OAVZA;KAC7BA,OASyCA,UAPVA,QAGxCA,QACFA,C;;;IyBw7BWC,YACTA;WAAmBA,QAKrBA;AAJMA,gBACFA,OAAOA,qBAGXA;AADEA,QACFA,C;IAEQC,YACoBA;AAAPA,QAErBA,C;EA2mCOC,YACLA;AAAOA;YAMHA;;AAxHmBC;;AAyHvBD;AA7BIC;AAAJA;AAIAA;AzB1kEeA;AyB0mEXD;AAAJA;AACIA;AAAJA;;AAfOA,SAAPA,QACFA,C;EAkBcE,cACZA;AADcA,mBAahBA;AAZEA,YAA4BA,QAY9BA;AAXeA,iBACFA,gBACMA,8BACJA,gBACTA,mBAAcA,SACdA,mBAAcA,SACTA,gBAzIUA;;;;AA0INA;AACHA,iBAzIYA;;;;AA0INA;AACZA,oBADYA,UADNA,UADGA,UADJA;KADAA;KADAA;KADIA;KADIA;KADNA;KADXA;QAWFA,C;GAEQC,YACNA;YAAqCA,SAAXA;AAAnBA,SAAPA,QACFA,C;;;GzBx+DcC,kBAEZA;YAAiCA;AZo2BnCC,uBAAsBA,KAAMA;iBYp2B1BD;KACEA,QAsBJA;A0B3sBqBA,UAAQA;A1B4rB3BA,iCACaA;AACXA,UACqBA;AAAfA,uBAAcA;AADpBA;KAxPgBE;mFAoQlBF,6BACFA,C;GyBk0BWG,YACTA,cAAsBA,SAGxBA;AAFEA,eAAuBA,UAEzBA;AADEA,QACFA,C;GA6CYC,gBACVA,UAAUA,YACZA,C;GAgUWC,cAGTA,QACFA,C;GAacC,kBAEMA,MAqBpBA,C;GAyFcC,gBACZA;SAAkBA,QAkBpBA;AAhBOA,SADqBA,YAExBA;AAGFA,sBACuBA;AAiRhBA,gBAA2BA;AAAbA,oCAAYA;AAAeA,mBAAIA,sBAApDA;AAhREA,MACEA;AAEEA,iBAA6BA,gBAI1BA;AAETA,OAAOA,OADyBA,UAElCA,C;GAKcC,YAKZA,QACFA,C;GAEcC,gBACUA,QAExBA,C;GAEcC,sBAEPA;AACAA;AACqCA,eAoB5CA,C;GAccC,kBAEZA;AAFYA;AzBzjDdA;AyBqkDMA;AAYJA,MAAwBA,SAVLA;AzBxiDyBA;AyB4jD5CA,6BACFA,C;GAEcC,gBACUA,MAGxBA,C;GAwNYC,YACNA,WAAKA,SAAiBA,QAG5BA;AADEA,OADYA,mBAEdA,C;GAOcC,YACZA;AAAKA,YAA8BA,QAsBrCA;AApBwBA;AAECA,uCAAvBA;AAEMA,iBpC7yDYC;AoC8yDdD,UACEA,wBAAOA;AAAPA;AACAA,gBACEA,WANRA,UAUSA,WAVTA;KAaIA;MAGJA,KAAiBA;AACjBA,OAAOA,YACTA,C;GAacE,cAAsBA;AAE7BA,YAEHA,SADyBA,SA2B7BA;AAvBwBA;AAECA,uCAAvBA;AAEEA,YACgCA,oCAC5BA,+BAAOA;AAAPA;AAJNA,UAOMA;UAEGA,WATTA;KAYIA;MpC/1DcA;AoCk2DlBA,mBAA6CA,uBAAMA;AhCv/DjCA,uBgCu/DlBA;KAfAA;AAeAA,KACEA,UAKJA;AAH4BA,wBAAcA;AACxCA,OAA4CA,8BAAMA;AAApBA;AAAZA,8BAAMA;AAANA,OAClBA,OAAOA,YACTA,C;GAGcC,YACZA;AAASA;AAAeA,cAAuBA,WAC7CA,iBACaA;AACXA,UACEA,OAAUA,mBAA0BA,aAS5CA;AAPMA,WACmBA;AAAbA,yBAAYA;AAAYA,8BAD9BA;KAEEA,MAINA,QACFA,C;GA4WYC,YACNA;AACJA,oBACFA,C;;GAhsBEC,cAAmBA;AACjBA;;AAAaA;AACbA;AzBlkDaA,WyB2hBHA;AAyiCVA,0BzBziDFvW;AA3BeuW,SyB2hBHA,oBA6iCZA,C;;GAEwBC,cACtBA;gCACEA;KAGAA,6BACEA,OADFA,OAIHA,C;GZziEYC,WACbA,eAAyEA,C;GAisXnEC,gBAEFA;AAAoBA;AAAKA;AAGbA;AvBz3WlBC,WuBk1pBAC,WAz9S8BF;AAA5BA,OAAiDA,OACnDA,C;GA+iCcG,YACLA;;IAEOA;;AAAZA,uBACmBA,oBAJGA,OAOxBA,QACFA,C;GAq4HsBC,gBAEpBA,OAAOA,qCAEFA,GAAKA,eACZA,C;GA4G2BC,0BAQrBA;AAAgBA;ALxohBtBtQ;AAzKIuQ;AKuzhBFD;;AAktjBWA,cA1rjBOA;AA0rjBPA,eAxqjBkBA;AAK3BA;AAGFA,QACFA,C;GA+6oBUE,YACVA;WACEA,MAcJA;AATEA,uBACoCA;AAEvBA,gBACTA,QAKNA;AAHIA,MAGJA,MADIA,QACJA,C;GAysBiBC,cAEfA;WAA+BA,QAGjCA;AADEA,OAAYA,SACdA,C;;;EAhirCSC,YAAcA,gBAA+BA,C;;;EAigB7CC,YAAcA,gBAA+BA,C;;;;;;EAm2R7CC,YAAcA,gBAA+BA,C;;;IA2oE5BC,YAAcA,OA2wqBtCA,WA3wqBoEA,C;EAoS7DC,YAAcA,kBAASA,C;QAkXbC,kBAEfA;YAEQA;AAAJA,YAy+vBiDC;AAyBvDD;AA6KEE,OAxFQD;AAwFRE,OAVQF;;;AAhqwBFD;AAAJA,YAqmzBJA;;SAlmzBwBA;KAQtBA;AAC4BA;;AACZA;AAIKA;;;AACdA;AACUA,wBAIbA;AAAJA,iBACwBA;;AAAPA,SAKEA;AADnBA,eACkCA;KAEcA;AAA7BA;;AACFA,wBAgCfI,gFA3BAJ;AACWA,wCAEIA;AAEJA;KACXA,wBACEA,iBAGiCA;AAArCA,yBACEA;AAGFA;AAEAA;AAEAA,QACFA,C,CAjEiBK,0C;IA8GbC,cACGA,YACPA,C;GAuBKC,kBAEHA;AAIEA,cAAOA,gBAGXA,C;GATKC,4C;IA8wCoBC,YAAYA,OAwipBrCC,8BAxipBiED,C;;;;GAtvEnCE,YAAOA,QAAEA,WAAUA,C;;;GAg3F5CC,kBAAiBA,yCACZA,C;;;;;GA24ELC,sBAAIA,kBAC6CA,C;GADjDC,uC;;;;GA3TOC,YAAqBA,qBAAgBA,C;;GAmJ7BC,YACZA;AAAWA;AAAIA;oCAAOA;AAAtBA;AAQAA;AAEJA;AACEA;AADFA,KACEA;KAEAA,OAEHA,C;;;;;EAg7DIC,YAAcA,gBAA+BA,C;;;GAm9E3CC,YACHA;AAuIYA;AAAiBA;AAtIjCA,SAAYA,UAAUA;AACtBA,OAAWA,UAAUA;AACrBA,mBACFA,C;EAMKC,cACHA;AAE2BA;AAAOA;AAAhCA,SAEEA,sCACEA;AAGJA,MAKJA,C;GAgFmBC,YAAYA;OAm0f/BC,uBAn0fwDD,C;GA+BhDE,YAAUA,+BAAuBA,C;EAM3BC,cAAiBA;AAAMA,mCAAUA;AAAhBA,WAAuBA,C;;;;;;GA8BjDC,YAGHA;WAEEA,gBAEJA,C;EAgDOC,YACEA;AACPA,eAA6BA,YAC/BA,C;;;;GAmVQC,YAAUA,eAA2BA,C;EAE/BC,cACZA,0BACEA,UAAUA;AACZA,WACFA,C;EAoCKC,cAA4BA;AAAJA,WAAWA,C;;;;;;;;;;;;;;EAw3KvBC,kBAEfA;wDACEA,OAAaA,gBAWjBA;AANkBA;AAnojBYA;AAsojBnBA;AAAmBA;AAp/L9BzC,WAo/LiByC,IAp/LjBzC;AAs/LEyC,QACFA,C;;;EAsEiBC,kBAEfA;wDACEA,OAAaA,gBAajBA;;AA/tjB8BA;AAutjBVA;AAGbA;AAxkMP1C;AAykMO0C;AACaA;AA1kMpB1C;AA0kM0B0C;AACfA;AAAiBA;AA3kM5B1C,WA2kMiB0C,IA3kMjB1C;AA4kME0C,QACFA,C;;;EA+CiBC,kBAEfA;wDACEA,OAAaA,gBAYjBA;;AA7xjB8BA;AAsxjBVA;AAGbA;AAvoMP3C;AAwoMO2C;AACIA;AAAqBA;AAzoMhC3C,WAyoMiB2C,IAzoMjB3C;AA0oME2C,QACFA,C;;;GA+EKC,kBAAYA;AAEfA;AACeA;AAGfA,wBACFA,C;GAPKC,4C;;;;;;GA2jKGC,YAAUA,eAA2BA,C;EAE/BC,cACZA,0BACEA,UAAUA;AACZA,WACFA,C;EAoCKC,cAA4BA;AAAJA,WAAWA,C;;;;;;;;;;;;EAuoBnCC,cACHA;AAAgBA,wCAAhBA;AAEEA,OA2DKA,mBAzDTA,C;GAEqBC,WAEfA;AAAsBA;AACPA;AACnBA,4BACeA,8BAAUA;AAAVA;AACbA,wBACEA,eAGJA,QACFA,C;;;;EA2CgBC,cACdA,OAAOA,sBACTA,C;GAeQC,YACNA,OAAOA,gBACTA,C;;;;GAo7CKC,WACHA;AAAIA;AAAJA;gBAzkoBAA,KACEA,wBA2koBJA,C;;GA1DAC,kBAIYA,WAAiBA;AAJ7BA;AAKEA;AALFA,QAMAA,C;;IAF6BC,YAAOA,OAAQA,YAAcA,C;;GA0mB1DC,YAEEA;AAAIA;AAAJA,YACEA,kBACEA,aAA6BA;AAG/BA,iBACEA,aAA6BA,QAGnCA,C;EAEKC,YACHA,OAAOA,OAAiBA,IAAiBA,QAC3CA,C;EAEKC,gBACCA;AAAkBA;AACNA;QAAuBA;AACvCA,WACcA;AAEdA,WACEA,QAGJA;AADEA,OAAOA,gBACTA,C;;;GA3BAF,YAEEA;AA/ylCkBG;AAuvrChBC;AA18FJJ;;QAWAA,C;IAkBYK,kBAEVA,QACFA,C;IAEYC,kBAEVA;AAAeA;AA26FfA;AAAcA;AAEQA;AAAYA;AAAlCA,sEAI2BA,gBACJA;AALvBA,uBAI2BA;KAJ3BA;;AA76FAA,QACFA,C;;GAQgB7B,YAIdA,OAu4DFA,WAGsBA,cAz4DtBA,C;;EA0gDK8B,YACHA,OAAOA,cAAgBA,YACzBA,C;EAEKC,gBACHA,OAAOA,cACEA,gBACXA,C;;;GANyBC,YAAOA,kBAAwBA,C;;GAK7CC,YAAOA,gCAAgDA,C;;GAkFlEC,kBAAoBA;AAIbA;AAGiBA,SACXA;AACcA,SACdA;AACNA;AACAA;;AACAA,QACPA,C;EAEKC,YACHA,OAAOA,WAAiCA,QAC1CA,C;QAEKC,gBACCA;AAAkBA;AAClBA;SAAgCA,eAClCA,OAAOA,YAaXA;KAZaA,kBACTA,OAAOA,YAWXA;KAVaA;SAA6BA,eACtCA,QASJA;KARaA,kBACTA,QAOJA;KANaA,SAA6BA,cACtCA,QAKJA;KAJaA,iBACTA,QAGJA,CADEA,QACFA,C;;;GA5BaC,YAAOA,OAAqBA,YAA0BA,C;;GAEtDA,YAAOA,OAAoBA,YAA0BA,C;;EA0F7DC,gBACOA,kBACRA,QAWJA;AAREA,0BACEA,QAOJA;AAnwHSA,mCAgwHLA,OAAOA,aAGXA;AADEA,QACFA,C;;GApBAC,WAAwBA;AACGA;;AAEAA;AAH3BA,aA1KwCL,uBACEA,uBACGA;AAwK7CK,UvBjlpCA9iB,auBslpCkC8iB,YxB9upCrBA;AwByupCbA,QAKiEA,C;;IAA/BC,YAAUA,mBAAYA,MAAKA,C;;EAmBxDC,YACSA;AAAZA,YACEA,QAcJA;AARcA;AACAA,gCACVA,QAMJA;AAJEA,KACEA,QAGJA;AADEA,QACFA,C;EAEKC,gBAC0BA,2BAC3BA,QAGJA;AADEA,OAAOA,SACTA,C;;;EA6JKC,WACCA;AAAeA;AACAA;AAAnBA,QACaA;AACXA;AACAA,QAKJA,CAHEA;AACAA;AACAA,QACFA,C;GAEMC,WAAWA,aAAQA,C;;GA+ZPC,YAChBA,cACEA,QAMJA;KAFIA,OARJA,WAUAA,C;;;;GAsoBKC,YACMA,eAuBLA,UACNA,C;EAGKC,cAIHA,WACEA;KAEAA,gBAEJA,C;GAGKC,cAYCA;;;;IAKcA;AA7iKXA,UAASA;;;;;;;;;AAojKdA,wDAxB0BA,OA4BxBA;IAEYA,mBA9BYA,WAiCGA;AAC7BA,gCAlC0BA,yBAsC1BA;KAGAA;;AACiDA;uDAErDA,C;GAKKC,wBAEHA;MACEA;;AAhiCyDA;;AAmiCzDA,MAkCJA,CAhCOA,iBACHA;;AACmDA,mDAAWA;;AAC9DA,MA6BJA,CA1BEA,WACOA,wBACHA;;AAEOA;;AACPA,MAqBNA,CAfmBA;kBxBjxrCXC;AwB4rhCCD,4BAslKPA,UACaA,8BAAIA;AAAJA;AACNA,eACQA,QA1mKRA;AA4mKIA,+CAAKA,gBA5mKTA;;AAQQA;AACfA,sBAwmKYA,iBAEVA,kBAEJA,C;;GAhIEE,cAASA;AACPA;AAmIFA,0BAEIA;AACAA;6BAKAA;QAEAA,SA3IEA;AACJA;IAKsBA,mBALtBA;AAUgBA;AAiBlBA,MA31hBSJ;AAATA,WAEEA,sBA41hBAI;AAnBIA;AACAA,cAEFA,WAAmBA;AACnBA,IAEJA,C;;;;;Ic/osCJC,kBACEA;;AACoBA;AAESA,IAAVA,OAAUA,OAAcA;AvCmqCnCC;AuClqCRD,OAAOA,OACTA,C;GA+YKE,gBAAeA;;AAOdA,QAQNA,WAfoBA,OAclBA,QACFA,C;GAQOC,2DAEHA,WAGJA;AADEA,MACFA,C;IAOQC,YAINA;2EACEA,QAyBJA;AAvBQA;AAANA,WACEA,UAsBJA;AApBMA,WACFA,QAmBJA;AAjBEA,YACEA,QAgBJA;AAdEA,YACEA,OAAkBA,MAatBA;AAXEA,YACEA,OAAOA,0BAA2CA,WAUtDA;AAFEA,OAAOA,yBAC0BA,SAFtBA,QAGbA,C;GAEOC,gBACSA;AACdA,YACYA;AACVA,YAEFA,QACFA,C;IAIOC,YACLA;wEAIEA,QAaJA;KAZkCA,gCAC9BA,QAWJA;KAVoCA,sCAChCA,QASJA;KARSA,sBAE0CA;AL1O3CC,uBtBrHmDD;KsBuH/CC;AAFRA,KAGEA,KAAUA;AKuOZD,O3BlWFA,c2BwWFA,MALkDA,0BAC9CA,UAIJA;KAFIA,OAAOA,OAEXA,C;GAEOE,YACLA,wBACEA,OAAOA,OACAA,OAA4BA,WAQvCA;AANEA,sBACEA,OAAOA,OACAA,OAA4BA,WAIvCA;AAFEA,OAAOA,OACAA,OAA4BA,WACrCA,C;GAEOC,gBACWA;AAQhBA,oCACcA;AACZA,YAEFA,QACFA,C;;QArXmBC,cACfA,4CACEA,UAAUA;AAEZA,OAAOA,eACTA,C;GAeQC,YAAYA,QAACA,C;EAEPC,cAAEA,mBAC0DA;AAAtEA,qCAAsEA,C;EAuCnEC,YAAQA;;AAEXA,QAIJA,UANeA;AAIEA;AAAbA,QAEJA,E;GAQQC,cACNA;AAMIA;AAG0BA,oBrCgDhCzkB,WqChDmDykB,QtCxGtCA;AsCkGXA,OAAOA,qBAOTA,C;;GAxHOC,YAwBLA,OArBQA,SbqINA,yBahHaA,KACjBA,C;;IAtBEC,YACEA;AAAIA;WACFA,OAAOA,QAiBXA;AAfQA;AAANA,YAEyBA;AAAvBA;AACAA,UAAkBA,QAAlBA;AAC6CA,aAASA,UAEtDA,QASJA,MARSA,YAEkBA;AAAvBA;AACAA,QAAqBA;AACrBA,QAIJA,MAFIA,OAAOA,OAEXA,C;;;GAkJFC,YAC6CA;AAA3CA,KACEA,UAAUA,QAA2BA,yBAEzCA,C;EAmBWC,cAGoBA,sCAC3BA;AAEFA,OAAYA,YACdA,C;GAWQC,YAEFA;AAEJA,kCACEA,QAGJA;AADEA,UAAUA,2BACZA,C;;;;;GAuHoDC,+GAGhCA;AAAhBA,OAA4BA;AAC5BA,QACDA,C;;GAI8BA,YAAOA,oBAA2BA,C;;GAqC9BC,YAAOA,OAtP5CA,WAsPqEA,C;;GAIhCA,YAAOA,OA5N5CA,kBA4NkEA,C;;GAG/BA,YAAOA,OA9e1CA,UA8eiEA,C;;ICgwE7DC,cACGA,YACPA,C;EAEiBC,kBAEfA;Af+ujCqD/F;AAsMrDC,OAxFQD;AAwFRE,OAVQF;AAURgG,OA+MEA;AA4uCJC,WAxmDAF;Ae9vjCmCA;;AAApBA;AAAKA;Af8tNUA;Ae1tNRA;Af42kBtB5G;Ae52kB4B4G;KAC1BA,wBACEA;AAEFA,QACFA,C;IAqVyBG,YAAYA,Ofu1+BrCzF,8Bev1+BiEyF,C;;;GC1tGnEC,WACMA;mBADNA,cACMA;;AAA8CA,OAAlCA;AACqCA,OAArCA;AAELA,OADMA;AhB8hlCJA;AgBvhlCbA,OAAgBA,qBAA8BA,KAACA;AACjDA;AAVMA,wBAUNA,C;GAEKC,gBACCA;AAAMA;AvC4YVC,auC5YwCD,YxCuM3BA,WwCvM6CA;AACjDA,KAATA,0BACFA,C;IAEOE,cACLA,gBA0CFA,C,CA3COC,gC;GAAAD,gBACLA;mBADKA,gBACLA;kDACEA;AACAA;MJi8CqBA;;AI77CLA;YACEA;AJ47CTA;AACEA;AACJA;AAGCA;AACGA;AACJA;;;;;;;;AAMAA;;AAEgCA,sBAE9BA;KAEAA;kBAEWA;;;;AI98CGA;YAAkBA,KAAUA,6BAA5BA;OACnBA,QADOA;;;;;;AAXoCA;AAa/CA;AACoCA;AAC9BA,kBhB83ckBA,OAAsCA;AgB53cjDA,iBACHA,eAEMA,iBAAiBA,aACpBA;AAGXA,uBAEAA;AAEFA;;;;;;OAGcA,iBAAUA,wBAA4BA;AACtDA;eAAsCA,KFkL7BA,KAAYA;AEjLHA;AAC2BA;AAApCA,KAATA,+BAA6CA,mDACfA,sDACEA,wDACDA,4DACKA,4DACJA,2DACDA,4DACDA,2DACOA;OA1ChCA;;AACLA,wBADKA,C;;GAdsBE,YAAIA;AAC7BA;AACiBA;AACKA;AADtBA;AAEAA,MACDA,C;;GAKuCC,YAAOA,cAASA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6B1CkC7CC,kBACTA,0BADSA,C,WA2IPC,kBAA6BA,iBAA7BA,C,WC49C0BC,kBAC1BA,IAAeA;0CADWA,C,WAKAC,kBAC1BA,IAAeA;0CADWA,C,WAKAC,kBAC1BA,IAAeA,WADWA,C,WAKAC,kBAC1BA,IA+N2BA;iEAhODA,C,WAKAC,kBAC1BA,IAAeA,aADWA,C,WAKAC,kBAC1BA,IAoO2BA;qEArODA,C,WAKAC,kBAC1BA,IAAeA,WADWA,C,WAKAC,kBAC1BA,IAsP2BA,2DAvPDA,C,WAKAC,kBAC1BA,IAAeA,aADWA,C,WAKAC,kBAC1BA,IA0P2BA,+DA3PDA,C,WmBlrDRC,kBAClBA,MADkBA,C,WQ+PbC,oB,WfiaWC,kBAAuBA,8BPxVzC5kB,MOwVkB4kB,C,WaqrkCKC,kBAAuBA,guBAAvBA,C,WAiYUC,kBAAuBA,cAAvBA,C,Wc/omCtBC,kBAAUA,UAAVA,C,WA+ZFC,kBACTA,yBADSA,C,WAyCPC,mD,WEpiBAC,kBAAqBA,OAAOA,aAA5BA,C,WACAC,kBAAWA,OAASA,yBAApBA,C",
- "x_org_dartlang_dart2js": {
- "minified_names": {
- "global": "b3,644,d5,123,i8,645,aK,646,q,647,f,648,j,129,aT,615,cQ,245,hm,246,cP,247,cO,248,d_,250,cW,242,cx,649,a9,650,i,651,hG,652,ar,618,e5,653,e6,654,ca,655,c,105,Z,102,ah,107,da,106,bf,656,b,83,af,104,F,431,a8,657,dS,658,d,659,ab,660,ew,661,a0,130,bs,138,aq,662,N,136,ai,80,e,101,hx,137,a,663,hQ,224,e1,664,b5,665,bR,666,eS,316,x,314,P,667,t,134,v,668,a1,140,bj,669,aG,666,aF,670,by,128,dM,671,b4,672,br,347,cn,673,c2,674,az,646,dZ,440,aW,675,bE,108,G,646,dI,450,ce,676,M,225,hX,100,fU,677,p,109,O,110,b1,678,cG,679,ig,680,ba,646,ch,646,eW,681,cm,682,o,683,D,684,eU,685,cq,686,aI,687,es,180,e9,182,hn,249,ho,688,hp,688,I,689,hB,251,bw,125,d3,124,cV,147,y,146,ia,148,al,690,d1,144,fk,691,fl,692,X,262,V,693,aN,258,fv,694,fu,695,ft,696,aL,697,aw,698,cY,260,hD,261,fw,699,cX,259,fs,700,hC,701,hE,255,W,702,cZ,254,ae,703,ad,704,cv,705,bq,706,hz,252,f6,707,f8,708,at,115,f7,709,h_,646,fZ,267,h0,710,aJ,646,eY,444,fa,711,i3,113,fj,712,f9,713,fO,714,fN,715,bA,716,i1,155,cs,646,i7,150,d4,717,aO,718,aS,719,d0,720,aU,153,d8,152,bB,0,R,721,eV,446,i2,156,hY,157,d9,722,i9,154,Y,158,hZ,723,i_,723,i0,723,f2,724,fW,725,ac,646,bg,448,ag,141,cy,726,fo,727,fp,727,fq,727,bD,256,f3,728,f4,729,dH,730,hT,81,bU,731,aZ,732,r,733,ck,646,eO,734,aY,735,B,736,bW,737,dG,738,dE,739,a5,740,ax,741,bT,742,dF,743,eL,646,eK,197,eI,173,hw,618,bo,616,cc,744,hd,745,he,746,h7,747,ha,748,h6,749,h9,750,h8,751,hf,752,hg,753,h3,754,dV,755,S,756,id,142,cj,757,hs,508,ay,758,ea,759,bt,596,J,760,hA,397,b2,646,aM,398,fE,761,aE,762,ei,763,bb,764,fF,765,e_,766,hy,348,U,767,ef,218,T,111,eZ,768,h5,769,dT,456,ap,770,aC,771,cR,594,d6,79,cr,772,bQ,646,b_,773,eF,774,dN,775,eD,776,ak,777,ez,778,eA,779,eC,780,eE,781,eB,782,dO,783,L,784,bS,785,cb,786,c3,787,m,788,ct,789,cu,790,ht,791,cT,593,hu,791,hq,588,bn,590,ex,792,cS,592,u,793,hS,132,ev,794,ci,795,ey,796,e4,797,bi,798,cf,646,ep,799,eo,442,aH,798,b9,800,dK,801,cU,591,aa,802,cB,646,cH,646,fV,803,cN,804,cg,805,w,806,cd,771,fX,575,aB,646,fY,807,fS,808,fT,808,bk,809,k,810,bz,133,f1,811,fG,812,bm,813,fH,814,fI,368,fQ,815,bl,559,eg,816,dP,817,dQ,818,a6,819,c5,820,e0,821,c0,822,c_,823,H,824,b0,825,aX,826,hi,827,a7,828,ff,829,cp,830,eq,831,cl,832,bh,833,er,834,hP,500,hH,835,bp,597,hI,835,hJ,835,b7,836,b8,837,eb,838,fC,839,bZ,840,el,841,bd,67,ao,842,ek,646,l,843,fc,844,fA,813,d7,111,cA,845,cz,846,fy,847,fz,848,fe,849,Q,850,fd,851,dX,852,dW,853,f5,854,dY,855,fn,856,fr,857,fm,858,bV,646,dD,195,hF,126,ic,135,cL,859,cI,860,cK,861,hb,862,hc,863,cM,864,eG,865,eH,866,hh,867,hr,226,hO,103,eJ,646,e7,868,e8,869,cJ,870,h4,871,ee,872,hR,112,hv,873,as,874,fi,875,hK,509,fh,557,fP,338,ib,122,ip,876,n,877,e2,878,c8,879,b6,880,eu,881,an,882,am,883,io,884,bC,885,c9,886,c7,887,e3,888,aA,889,c1,890,dJ,891,dL,892,iE,893,iF,894,iG,895,iH,896,iK,897,iL,898,iJ,899,iI,900,iN,901,iM,902,co,903,en,904,be,905,aP,906,em,907,K,908,is,909,it,910,iu,911,iv,912,iw,913,ix,914,iy,915,cw,916,eP,917,eQ,918,eR,919,hj,920,fM,921,fx,922,fB,923,eh,924,aD,925,bc,926,h1,927,ej,928,eX,929,eN,930,eM,931,bX,932,bY,933,dR,934,ec,935,ed,936,f_,937,f0,938,et,939,c6,940,iY,941,C,942,ih,943,ii,944,ij,945,il,946,im,947,dU,948,ir,949,iz,950,iA,951,eT,952,iC,953,iD,954,iX,955,fb,956,fg,957,iT,958,iU,959,c4,960,fR,570,cC,961,cD,962,cE,963,cF,964,fJ,965,h2,966,fK,967,fL,968,hk,969,hl,970,fD,971,aR,1,i4,82,bu,121,ie,127,j6,131,j3,145,j5,149,iP,972,iQ,973,iR,974,j1,253,iB,646,iV,975,iW,976,ik,622,iq,623,iO,977,j2,635,j4,639,iS,640,iZ,641,j0,642,j_,643,bL,642,aV,622,aj,635,db,893,dc,894,dd,895,de,896,dh,897,di,898,dg,899,df,900,dk,901,dj,902,bG,977,bF,623,bK,643,bJ,641,bI,959,dl,958,bH,640,dm,941,dn,639,du,978,z,979,hU,980,dC,981,a_,982,a4,983,h,984,a3,985,aQ,986,E,987,bx,988,av,989,d2,990,hL,991,hM,992,hN,993,bP,994,ds,995,dx,996,dy,997,dw,998,bO,999,a2,1000,au,1001,i6,1002,dr,1003,i5,1004,dz,1005,dA,1006,hV,1007,hW,1008,bN,1009,dv,1010,dt,1011,dB,1012,dq,1013,bM,1014,dp,1015,bv,1016,A,1017",
- "instance": "aV,1018,aX,1019,aU,1020,b1,646,b0,646,aT,1021,a1,1022,aY,1020,aZ,1023,aW,1020,b_,646,bv,1022,aR,1024,h,1020,be,1025,aC,1026,bN,1027,bG,1028,aN,1029,bD,1030,aM,1031,bI,1032,t,1033,b5,1034,bm,1035,aa,1036,bK,1037,bf,1038,bd,1039,l,1040,n,1041,bn,1042,ba,1043,aJ,1044,W,1045,bC,1030,ac,1021,I,1046,bB,1047,aB,1048,X,1049,H,1023,aK,1050,bL,1044,bi,1051,J,1052,b8,1053,aE,1054,b7,1055,bX,1046,aq,1056,ar,1057,bY,1022,az,1058,au,1059,bc,1060,ad,1061,F,1062,u,1063,R,1064,ak,1065,b9,1066,ay,1067,al,1068,a2,1069,a5,1070,ax,1071,bg,1072,U,1073,by,1074,bp,1075,ae,1018,bF,1076,bZ,1028,aH,1077,a4,1078,b4,1079,v,1080,bq,1081,V,1082,bE,1083,an,1084,ao,1085,a7,1086,Z,1087,a6,1088,O,1089,bP,1061,bk,1090,bA,1091,at,1092,am,1093,m,1094,ah,1095,N,1096,bQ,1097,L,1098,p,1099,S,1067,bj,1100,b3,1101,bx,1102,av,1103,ap,1104,B,1105,bO,1106,bl,1107,T,1108,aQ,1073,ab,1109,b2,1110,M,1111,aw,1112,aD,1113,bo,1075,bt,1114,bT,1115,a0,1116,bJ,1117,j,1118,b6,1119,bs,1067,aj,1120,aL,1087,bh,1121,P,1122,bz,1123,bu,1114,aG,1124,Y,1125,ai,1111,bS,1126,br,1046,A,1022,q,1127,a3,1128,G,1129,as,1130,w,1131,aA,1132,bw,1102,bR,1097,a9,1133,bb,1134,C,1135,aI,1032,aS,1136,a8,1137,a_,1116,bH,1138,aF,1139,bM,1027,E,1140,af,1141,i,1142,D,1143,bW,1144,bV,1145,bU,1146,ag,1147,aO,1148,aP,1149,K,1150"
- },
- "frames": "iqTAiKoB+nCyB;0NA+BhBCqE;6IA8I8BCW;swBEnN9BC+C;yBA+GAAyC;8DAwBW5fc;yhBAwUiB6fe;yBAcE7fsB;2lCIrkBvB8f8B;okEHu2B4B9fsB;wBAEFA6B;wDA31BHA8B;mEA8IUAiB;0RA4LVAS;oIAPjBAmB;QAEF+fmB;scAkEmB/fS;+CAGU+fiB;+rCFkPrBCK;wtCAuaUriCAAxzBpBqiBqC,A;6zBA8tCmBoB0B;iLAqBjBqG0C;+BAOEAwC;QAIJrGwB;yBASAAuB;kCAqCcpBa;qvCAkjBfAmC;yFAKKAU;0EAWaA4E;yHASbAU;kFAmCmBAW;4DAGtBAW;6VA4DFAAWjtE8BAgE,A;gXX81E1BAgD;AAEAA4I;qgDA0M+BigByC;6NAYXAyC;s5BAkGAAyC;AACIC6C;k6BAuhBbCe;2BAElBCmB;+CAqFoBDU;oFA2DjBngBY;kNUltGNngBmC;8CAYYAmC;iQA8CPwgCkC;4rCAyJiBrgBe;8CAExBsgBAEqNACQ,A;oWFvGKC8B;gKAiBWCqBARACAVoMCVyC,A,A;iPU1GfngCK;YAAAAiB;idAmMU8gCuD;sUAgCAAuD;mKAoBPHqB;4pDGvkBEv/BAA2BT2/B+G,A;iIAZS3/BAAYT2/B+G,A;swCAsKgBp/B4D;shBC9QHwee;yEA8B+B2YAb6aZ3YsB,A;6ND/Of6gBK;8PASDCAejUJ9gByB,A;uGfmUA+gBkB;OAGC/gBoB;4OA4DAghBgD;+uBAq5CAhhBmR;u7DAq+BO2fY;4FAkCC3f8C;6cetxFRAe;6UAyDEihBYA+KFCmB,A;8QA9JTC0CAOSDoB,sH;gRAmGkBlhBgB;mlBA0JlBAkBA0BbAAAAAAQ,A,A;8sFIvUQohBS;0CA0IGphBSAnCYqhBAAAACAuB4oBSthBStB9xB5BAAAjC0BwhBAAAAxhB+B,A,A,A,A,A,A;qRDoTPAwB;AACrByhBY;glBE7QYCU;4CAYqB1hBkB;oCAIrB0hBU;oGAsBkB1hBc;mKAsD3BtYgB;iCEw6DGsYc;sbDn6BkB2hBgC;gmBHzhC1B3hBU;kkBAyLUAc;gJCpSAlXAsB+4BuCkXa,A;moBtBvxBtC4hBW;oRAmHe5hByB;QACPyb6B;kCA0EboGS;4CAQiBCS;AACLCM;uBAIZCoB;oBAIFt6BgB;iFAQEm6BS;wFAeiBCS;AACLCM;uBAIZCoB;kCAIFt6BgB;+RA6FA+5BkB;8CAkBFQAA/KACS,AAAoBliBqB,A;sFAoMpBmiBS;oBACAz6BgB;qFASIy6BS;oBACAz6BgB;iFAeJy6BS;oBACAz6BgB;4DA3HAy6BU;iIAkCkBLM;iBAIhBEgB;oBAIAIY;sFA6FuBCU;kBAGYnkBM;6BACxBokBsB;sFA6BcCM;mCACFXY;uBACGD6B;uDAGfWsB;OAMWtGM;0BAsEPwGM;uKAwBKCwB;AACZTgB;4CAaISwB;mBAEVhBiB;AAGASY;wKA7RAQM;0PA2FFCQA/BFlBiB,Q;+LA+HyBmByB;wHAKY5iBkB;+BAMmB+hBiC;AAC3BMyB;AACqBnkBY;mLAiBnB2kBuC;2BAEI7iBkB;yKAcN9Ba;uDAGQ8BkB;2EGuPXAAH3rBHgcM,A;MG6rBlB8GmB;4BAFqB9iBkB;gTD8MZAa;oDAEd+iB+B;8HAkMETyB;mHAYAAyB;qtCI/wBuCxBAXte/B9gBoB,A;2BW8eC8gBAX9eD9gBmB,A;+BW6oCOAiB;8LCr8BXgjBmB;yFAsBoBhjBc;2BAGxBgjBkC;4CAKF1CAfuRACe,A;AetROjJS;qlCE3PUtXmB;mBAGfsgBAjB8gBFCiB,A;gCiBngBEDAjBmgBFCyB,A;iDiB7fOjJS;sGHuCItXe;kqBAkETijBuCAOSCAA+NuBEoB,A,mI;4nBAhCvBFAAgCuBEkB,A;2PAiEvBpjBW;uRA6zBAA4BAwXbAAAAAAW,A,A;wPA9VeihBiB;4gBA0JiBjhBc;+EAS9BqjByB;+kBvBl4C8BrjBwB;iEA0IUAc;+I0B/JlCsgBe;gBAGFAc;AACAAAjBsgBJCW,A;AiBrgBIDW;mWA2TuBrCAd3ShBjeY,U;wBc6SQsXY;kICtObtXiB;gcClBKA+B;gGAiCPsjBS;yNAiBiCrFa;OAAAAAhBvG1BjeY,U;QgBwGAAc;6vBA8LkB2YA9ByPC3YyB,A;wL+BpcFoda;8SChEDmGkB;6DAcZCmC;yJA4CFC8B;0jCrBuFK9DW;oHA+SZ3f4B;+NAmHFsgBgB;AACAAAA1FJCW,A;8PsBEuBmDY;OACDCY;OACACY;OACACY;OACECY;OACACY;OACCCoD;61DtBqEHhkBe;oEAIlBsgBAAjFJCQ,A;wnEuB5V6CvgBiB;4FAwJnBAQ;8TAuRfikBwC;4cvBvkBmBtEc;4VAuhBjBuEO;0BAGFAO;oBAGEAU;qRyBmjEICiCAObCmB,4BAIFCuD,AAEF/De,qF;gPAeIgEmB;AAAkBAgB;uCAElBCmB;AAAqBAgB;4SzBh+DQCAIvlBcCsD,A;mBJ8lBnCCgB;wHAKRCAAjKaC8F,A;mXyB2+CVCgE;CAAAA8C;6QA6EU7kBe;sCAuBVsXM;mRAkPQwNApC5yDOCW,A;gcoCg2DXAW;2CAA4CAuB;siBAvTrDzEW;AAAiB0EoB;0BAEf1EAzBrkDJCU,A;AyBskDIDS;AAAiB0EoB;+QZ2qTL5NAtBhmX6BpXW,A;AsBgmX7BilBAAmoTLjlBW,A;mTA7kJSAAiB5jgBKAAtBrvBvBAAAtB0BwhBAAAAxhBqB,A,A,kB,A;4CKq2hBxB8iBc;kBAkBAAe;oyDA35JoC9iBW;6GA2pBVklBAAw+vBuBCiB,cAyBvDDAAAAAAACEEAAoFArHO,Y,AAnFAsHAAiKAtHO,4B,A,A,A;mBA/pwB4B/d8B;yWAmCxBslBAAwBDCgF,A;+eAg1CgCCAAo8oBxBxlB8B,A;+yEAltaEwd+B;2RAwGiC7EAA47bnC3YuB,A;+qCAhkQQAoC;sBACVilBAA10LEjlBW,A;IA00LiBilBAA10LjBjlBY,A;6KA05LQA6B;mDAIdilBAA95LMjlBa,A;qBAg6LOilBAAh6LPjlBa,A;gCAi6LFilBAAj6LEjlBW,A;IAi6LeilBAAj6LfjlBY,A;8KAy9LQA6B;mDAIdilBAA79LMjlBa,A;gCA+9LFilBAA/9LEjlBW,A;IA+9LmBilBAA/9LnBjlBY,A;k8BA8xXOqXmB;keAogDhBoO6B;gFAxDJzlBAAAAAO,A;0cA+mBsDAAA27F3BAAAea0lBAAAA1lB8B,A,8B,A;cA38FxCAQ;4GAoCiBqYqL;2EAaJrYyB;i8BAgtDCqXmC;qHAdRrXAA5KkC2lBuB,AACECuB,AACGC6B,A;AA2E7C7lBU;AAkGcsZAxB9upCDtZa,A;YwB8upCCsZuB;2jBAwnBCtZW;iOAksBFqX4f;+XAmCFyOkH;+WAqBQCAxBrxrCJCW,A;AwBsxrCMxI4B;uEAGgBnG2B;+DAEXA8E;AACpBkGwC;gGAvHF0I8F;+EAaICMAkBJ3IgD,iB;2ScrpsCyB4IA3BvCrBCAAKYEY,A,A;m8B2B4gBPCAL3ObCAtBvHAAuB,A,UsBuHAAAtBvHAAiE,A,A;O2BkWaDc;wvBA5P6BjNAtCxG7BtZW,A;QsCwG6BsZyB;kEAtHZtZyB;46BA6XkBymBW;2CAIAAkB;2CAGFAU;yKCwwExBvBAf6ujCiCCiB,AAyBvDDAAAAAAACEEAAoFArHO,Y,AAnFAsHAAiKAtHO,Q,A,A,A;Aez6jCiD2IAfk2jCjD3IO,AAAQ/dY,A;Aeh2jCcAAfuwmChBAW,A;AezwmCcklBa;4EAUEllB6B;WAEFilBAfshlBTjlBa,A;0Fe5rkBwBwlBAfmv+BxBxlB8B,A;mtDgBz8kCF8iB+B;kMAUD1LAxCuMGpXa,A;YwCvMHoXW;maAaApXa;+CAAAA6V;kNAOS2mBgB;gQAgBgCCwB;o4ZzCqnDhCC0G;qFAUAC8G;mFAUACuD;qFAUAC2D;"
- }
-}
diff --git a/build_runner/lib/src/watcher/graph_watcher.dart b/build_runner/lib/src/watcher/graph_watcher.dart
index 6a1d134..db54ff1 100644
--- a/build_runner/lib/src/watcher/graph_watcher.dart
+++ b/build_runner/lib/src/watcher/graph_watcher.dart
@@ -21,8 +21,8 @@
final PackageNodeWatcher Function(PackageNode) _strategy;
final PackageGraph _graph;
- final _readyCompleter = Completer<Null>();
- Future<Null> get ready => _readyCompleter.future;
+ final _readyCompleter = Completer<void>();
+ Future<void> get ready => _readyCompleter.future;
bool _isWatching = false;
diff --git a/build_runner/mono_pkg.yaml b/build_runner/mono_pkg.yaml
index 2f956d2..cebfcb2 100644
--- a/build_runner/mono_pkg.yaml
+++ b/build_runner/mono_pkg.yaml
@@ -6,9 +6,6 @@
- group:
- dartfmt: sdk
- dartanalyzer: --fatal-infos --fatal-warnings .
- - dartanalyzer: --fatal-warnings .
- dart:
- - 2.1.0
- unit_test:
- test: -x integration
- e2e_test:
diff --git a/build_runner/pubspec.yaml b/build_runner/pubspec.yaml
index 75ea89c..a134c88 100644
--- a/build_runner/pubspec.yaml
+++ b/build_runner/pubspec.yaml
@@ -1,18 +1,18 @@
name: build_runner
-version: 1.3.3
+version: 1.4.0
description: Tools to write binaries that run builders.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_runner
environment:
- sdk: ">=2.0.0 <3.0.0"
+ sdk: ">=2.3.0-dev.0.1 <3.0.0"
dependencies:
args: ">=1.4.0 <2.0.0"
async: ">=1.13.3 <3.0.0"
build: ">=1.0.0 <1.2.0"
- build_config: ^0.3.1
- build_daemon: ^0.5.0
+ build_config: ">=0.4.0 <0.4.1"
+ build_daemon: ^0.6.0
build_resolvers: "^1.0.0"
build_runner_core: ^3.0.0
code_builder: ">2.3.0 <4.0.0"
@@ -43,8 +43,7 @@
dev_dependencies:
build_test: ^0.10.0
- build_modules: '>=0.4.0 <2.0.0'
- build_web_compilers: ^1.0.0
+ build_web_compilers: ^2.0.0
mockito: ^4.0.0
package_resolver: ^1.0.2
stream_channel: ">=1.6.0 <3.0.0"
diff --git a/build_runner/tool/build.dart b/build_runner/tool/build.dart
deleted file mode 100644
index 45bcdc3..0000000
--- a/build_runner/tool/build.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:build/build.dart';
-import 'package:build_config/build_config.dart';
-import 'package:build_modules/builders.dart';
-import 'package:build_runner/build_runner.dart';
-import 'package:build_runner_core/build_runner_core.dart';
-import 'package:build_web_compilers/builders.dart';
-
-main(List<String> args) async {
- await run(args, [
- apply(
- 'build_modules|dart2js',
- [
- moduleLibraryBuilder,
- metaModuleBuilderFactoryForPlatform('dart2js'),
- metaModuleCleanBuilderFactoryForPlatform('dart2js'),
- moduleBuilderFactoryForPlatform('dart2js'),
- ],
- toAllPackages(),
- isOptional: true,
- hideOutput: true),
- apply(
- 'build_web_compilers|entrypoint',
- [
- (_) => webEntrypointBuilder(BuilderOptions({
- 'compiler': 'dart2js',
- 'dart2js_args': ['--minify', '--omit-implicit-checks']
- }))
- ],
- toAllPackages(),
- isOptional: false,
- hideOutput: false,
- defaultGenerateFor: InputSet(include: [
- 'lib/src/server/graph_viz_main.dart',
- 'lib/src/server/build_updates_client/hot_reload_client.dart',
- ])),
- ]);
-}
diff --git a/build_runner/tool/builders.dart b/build_runner/tool/builders.dart
new file mode 100644
index 0000000..65cfe03
--- /dev/null
+++ b/build_runner/tool/builders.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2019, 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:build/build.dart';
+
+Builder copyCompiledJs(_) => _CopyBuilder();
+
+/// A Builder to copy compiled dart2js output to source.
+class _CopyBuilder extends Builder {
+ @override
+ final buildExtensions = {
+ 'web/graph_viz_main.dart.js': ['lib/src/server/graph_viz_main.dart.js'],
+ 'web/hot_reload_client.dart.js': [
+ 'lib/src/server/build_updates_client/hot_reload_client.dart.js'
+ ]
+ };
+
+ @override
+ void build(BuildStep buildStep) {
+ if (!buildExtensions.containsKey(buildStep.inputId.path)) {
+ throw StateError('Unexpected input for `CopyBuilder` '
+ 'expected only ${buildExtensions.keys}');
+ }
+ buildStep.writeAsString(
+ AssetId(buildStep.inputId.package,
+ buildExtensions[buildStep.inputId.path].single),
+ buildStep.readAsString(buildStep.inputId));
+ }
+}
diff --git a/build_runner/lib/src/server/graph_viz_main.dart b/build_runner/web/graph_viz_main.dart
similarity index 100%
rename from build_runner/lib/src/server/graph_viz_main.dart
rename to build_runner/web/graph_viz_main.dart
diff --git a/build_runner/lib/src/server/build_updates_client/hot_reload_client.dart b/build_runner/web/hot_reload_client.dart
similarity index 95%
rename from build_runner/lib/src/server/build_updates_client/hot_reload_client.dart
rename to build_runner/web/hot_reload_client.dart
index a2b6e8b..79b89ff 100644
--- a/build_runner/lib/src/server/build_updates_client/hot_reload_client.dart
+++ b/build_runner/web/hot_reload_client.dart
@@ -12,9 +12,9 @@
import 'package:js/js.dart';
import 'package:js/js_util.dart';
-import 'module.dart';
-import 'reload_handler.dart';
-import 'reloading_manager.dart';
+import 'package:build_runner/src/server/build_updates_client/module.dart';
+import 'package:build_runner/src/server/build_updates_client/reload_handler.dart';
+import 'package:build_runner/src/server/build_updates_client/reloading_manager.dart';
final _assetsDigestPath = r'$assetDigests';
final _buildUpdatesProtocol = r'$buildUpdates';
diff --git a/build_runner_core/BUILD.gn b/build_runner_core/BUILD.gn
index 85a1411..49b2465 100644
--- a/build_runner_core/BUILD.gn
+++ b/build_runner_core/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_runner_core-3.0.3
+# This file is generated by importer.py for build_runner_core-3.0.4
import("//build/dart/dart_library.gni")
diff --git a/build_runner_core/CHANGELOG.md b/build_runner_core/CHANGELOG.md
index 103798b..2b43001 100644
--- a/build_runner_core/CHANGELOG.md
+++ b/build_runner_core/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 3.0.4
+
+- Add additional error details and a fallback for
+ https://github.com/dart-lang/build/issues/1804
+
## 3.0.3
- Share an asset graph when building regardless of whether the build script was
diff --git a/build_runner_core/lib/src/asset_graph/graph.dart b/build_runner_core/lib/src/asset_graph/graph.dart
index a5d7dba..db95a57 100644
--- a/build_runner_core/lib/src/asset_graph/graph.dart
+++ b/build_runner_core/lib/src/asset_graph/graph.dart
@@ -150,7 +150,7 @@
/// Uses [digestReader] to compute the [Digest] for [nodes] and set the
/// `lastKnownDigest` field.
- Future<Null> _setLastKnownDigests(
+ Future<void> _setLastKnownDigests(
Iterable<AssetNode> nodes, AssetReader digestReader) async {
await Future.wait(nodes.map((node) async {
node.lastKnownDigest = await digestReader.digest(node.id);
diff --git a/build_runner_core/lib/src/asset_graph/serialization.dart b/build_runner_core/lib/src/asset_graph/serialization.dart
index d6c0c00..dbc8bb6 100644
--- a/build_runner_core/lib/src/asset_graph/serialization.dart
+++ b/build_runner_core/lib/src/asset_graph/serialization.dart
@@ -62,8 +62,21 @@
if (node is BuilderOptionsAssetNode) continue;
for (var output in node.outputs) {
+ if (output == null) {
+ log.severe('Found a null output from ${node.id} which is a '
+ '${node.runtimeType}. If you encounter this error please copy '
+ 'the details from this message and add them to '
+ 'https://github.com/dart-lang/build/issues/1804.');
+ throw AssetGraphCorruptedException();
+ }
var inputsNode = graph.get(output) as NodeWithInputs;
- assert(inputsNode != null, 'Asset Graph is missing $output');
+ if (inputsNode == null) {
+ log.severe('Failed to locate $output referenced from ${node.id} '
+ 'which is a ${node.runtimeType}. If you encounter this error '
+ 'please copy the details from this message and add them to '
+ 'https://github.com/dart-lang/build/issues/1804.');
+ throw AssetGraphCorruptedException();
+ }
inputsNode.inputs ??= HashSet<AssetId>();
inputsNode.inputs.add(node.id);
}
@@ -220,6 +233,19 @@
return _WrappedAssetNode(node, this);
}
}
+
+ int findAssetIndex(AssetId id,
+ {@required AssetId from, @required String field}) {
+ final index = _assetIdToId[id];
+ if (index == null) {
+ log.severe('The $field field in $from references a non-existent asset '
+ '$id and will corrupt the asset graph. '
+ 'If you encounter this error please copy '
+ 'the details from this message and add them to '
+ 'https://github.com/dart-lang/build/issues/1804.');
+ }
+ return index;
+ }
}
/// Used to serialize the type of a node using an int.
@@ -315,20 +341,23 @@
}
break;
case _AssetField.Id:
- return serializer._assetIdToId[node.id];
+ return serializer.findAssetIndex(node.id, from: node.id, field: 'id');
case _AssetField.Outputs:
return node.outputs
- .map((id) => serializer._assetIdToId[id])
+ .map((id) =>
+ serializer.findAssetIndex(id, from: node.id, field: 'outputs'))
.toList(growable: false);
case _AssetField.PrimaryOutputs:
return node.primaryOutputs
- .map((id) => serializer._assetIdToId[id])
+ .map((id) => serializer.findAssetIndex(id,
+ from: node.id, field: 'primaryOutputs'))
.toList(growable: false);
case _AssetField.Digest:
return _serializeDigest(node.lastKnownDigest);
case _AssetField.DeletedBy:
return node.deletedBy
- .map((id) => serializer._assetIdToId[id])
+ .map((id) => serializer.findAssetIndex(id,
+ from: node.id, field: 'deletedBy'))
.toList(growable: false);
default:
throw RangeError.index(index, this);
@@ -367,7 +396,8 @@
switch (fieldId) {
case _GeneratedField.PrimaryInput:
return generatedNode.primaryInput != null
- ? serializer._assetIdToId[generatedNode.primaryInput]
+ ? serializer.findAssetIndex(generatedNode.primaryInput,
+ from: generatedNode.id, field: 'primaryInput')
: null;
case _GeneratedField.WasOutput:
return _serializeBool(generatedNode.wasOutput);
@@ -380,7 +410,8 @@
case _GeneratedField.PreviousInputsDigest:
return _serializeDigest(generatedNode.previousInputsDigest);
case _GeneratedField.BuilderOptions:
- return serializer._assetIdToId[generatedNode.builderOptionsId];
+ return serializer.findAssetIndex(generatedNode.builderOptionsId,
+ from: generatedNode.id, field: 'builderOptions');
case _GeneratedField.IsHidden:
return _serializeBool(generatedNode.isHidden);
default:
@@ -421,7 +452,8 @@
return globNode.glob.pattern;
case _GlobField.Results:
return globNode.results
- .map((id) => serializer._assetIdToId[id])
+ .map((id) => serializer.findAssetIndex(id,
+ from: globNode.id, field: 'results'))
.toList(growable: false);
default:
throw RangeError.index(index, this);
@@ -457,12 +489,14 @@
case _PostAnchorField.ActionNumber:
return wrappedNode.actionNumber;
case _PostAnchorField.BuilderOptions:
- return serializer._assetIdToId[wrappedNode.builderOptionsId];
+ return serializer.findAssetIndex(wrappedNode.builderOptionsId,
+ from: wrappedNode.id, field: 'builderOptions');
case _PostAnchorField.PreviousInputsDigest:
return _serializeDigest(wrappedNode.previousInputsDigest);
case _PostAnchorField.PrimaryInput:
return wrappedNode.primaryInput != null
- ? serializer._assetIdToId[wrappedNode.primaryInput]
+ ? serializer.findAssetIndex(wrappedNode.primaryInput,
+ from: wrappedNode.id, field: 'primaryInput')
: null;
default:
throw RangeError.index(index, this);
diff --git a/build_runner_core/lib/src/generate/build_definition.dart b/build_runner_core/lib/src/generate/build_definition.dart
index 6d45c48..ea7e6fa 100644
--- a/build_runner_core/lib/src/generate/build_definition.dart
+++ b/build_runner_core/lib/src/generate/build_definition.dart
@@ -439,7 +439,7 @@
/// Handles cleanup of pre-existing outputs for initial builds (where there is
/// no cached graph).
- Future<Null> _initialBuildCleanup(
+ Future<void> _initialBuildCleanup(
Set<AssetId> conflictingAssets, RunnerAssetWriter writer) async {
if (conflictingAssets.isEmpty) return;
diff --git a/build_runner_core/lib/src/generate/build_impl.dart b/build_runner_core/lib/src/generate/build_impl.dart
index 0a9254d..2cf9736 100644
--- a/build_runner_core/lib/src/generate/build_impl.dart
+++ b/build_runner_core/lib/src/generate/build_impl.dart
@@ -72,7 +72,7 @@
final BuildEnvironment _environment;
final String _logPerformanceDir;
- Future<Null> beforeExit() => _resourceManager.beforeExit();
+ Future<void> beforeExit() => _resourceManager.beforeExit();
BuildImpl._(BuildDefinition buildDefinition, BuildOptions options,
this._buildPhases, this._finalizedReader)
@@ -149,7 +149,7 @@
final List<Pool> _buildPhasePool;
final BuildEnvironment _environment;
final _lazyPhases = <String, Future<Iterable<AssetId>>>{};
- final _lazyGlobs = <AssetId, Future<Null>>{};
+ final _lazyGlobs = <AssetId, Future<void>>{};
final PackageGraph _packageGraph;
final BuildPerformanceTracker _performanceTracker;
final AssetReader _reader;
@@ -234,7 +234,7 @@
return result;
}
- Future<Null> _updateAssetGraph(Map<AssetId, ChangeType> updates) async {
+ Future<void> _updateAssetGraph(Map<AssetId, ChangeType> updates) async {
await logTimedAsync(_logger, 'Updating asset graph', () async {
var invalidated = await _assetGraph.updateAndInvalidate(
_buildPhases, updates, _packageGraph.root.name, _delete, _reader);
@@ -764,7 +764,7 @@
/// - Setting the `lastKnownDigest` on each output based on the new contents.
/// - Setting the `previousInputsDigest` on each output based on the inputs.
/// - Storing the error message with the [_failureReporter].
- Future<Null> _setOutputsState(
+ Future<void> _setOutputsState(
Iterable<AssetId> outputs,
SingleStepReader reader,
AssetWriterSpy writer,
diff --git a/build_runner_core/lib/src/generate/build_runner.dart b/build_runner_core/lib/src/generate/build_runner.dart
index d9838cc..e0b3a18 100644
--- a/build_runner_core/lib/src/generate/build_runner.dart
+++ b/build_runner_core/lib/src/generate/build_runner.dart
@@ -18,7 +18,7 @@
final BuildImpl _build;
BuildRunner._(this._build);
- Future<Null> beforeExit() => _build.beforeExit();
+ Future<void> beforeExit() => _build.beforeExit();
Future<BuildResult> run(Map<AssetId, ChangeType> updates,
{Set<BuildDirectory> buildDirs}) =>
diff --git a/build_runner_core/lib/src/package_graph/apply_builders.dart b/build_runner_core/lib/src/package_graph/apply_builders.dart
index 57ef24f..2003a65 100644
--- a/build_runner_core/lib/src/package_graph/apply_builders.dart
+++ b/build_runner_core/lib/src/package_graph/apply_builders.dart
@@ -260,8 +260,9 @@
final globalOptions = targetGraph.rootPackageConfig.globalOptions.map(
(key, config) => MapEntry(
key,
- (config?.options ?? BuilderOptions.empty).overrideWith(
- isReleaseMode ? config?.releaseOptions : config?.devOptions)));
+ _options(config?.options).overrideWith(isReleaseMode
+ ? _options(config?.releaseOptions)
+ : _options(config?.devOptions))));
for (final key in builderConfigOverrides.keys) {
final overrides = BuilderOptions(builderConfigOverrides[key]);
globalOptions[key] =
@@ -340,10 +341,10 @@
builderApplication, targetNode, applyWith, allBuilders))
.map((node) {
final builderConfig = targetConfig(node);
- final options = (builderConfig?.options ?? BuilderOptions.empty)
+ final options = _options(builderConfig?.options)
.overrideWith(isReleaseMode
- ? builderConfig?.releaseOptions
- : builderConfig?.devOptions)
+ ? _options(builderConfig?.releaseOptions)
+ : _options(builderConfig?.devOptions))
.overrideWith(globalOptionOverrides);
return createPhase(node.package, options, node.target.sources,
builderConfig?.generateFor, isReleaseMode);
@@ -403,3 +404,6 @@
String _factoryFailure(String packageName, BuilderOptions options) =>
'Failed to instantiate builder for $packageName with configuration:\n'
'${JsonEncoder.withIndent(' ').convert(options.config)}';
+
+BuilderOptions _options(Map<String, dynamic> options) =>
+ options?.isEmpty ?? true ? BuilderOptions.empty : BuilderOptions(options);
diff --git a/build_runner_core/pubspec.yaml b/build_runner_core/pubspec.yaml
index 3ebbf5a..59cd4d0 100644
--- a/build_runner_core/pubspec.yaml
+++ b/build_runner_core/pubspec.yaml
@@ -1,5 +1,5 @@
name: build_runner_core
-version: 3.0.3
+version: 3.0.4
description: Core tools to write binaries that run builders.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_runner_core
@@ -10,7 +10,7 @@
dependencies:
async: ">=1.13.3 <3.0.0"
build: ">=1.1.0 <1.2.0"
- build_config: ^0.3.1
+ build_config: ">=0.4.0 <0.4.1"
build_resolvers: ^1.0.0
collection: ^1.14.0
convert: ^2.0.1
@@ -37,3 +37,7 @@
test_process: ^1.0.0
_test_common:
path: ../_test_common
+
+ #dependency_overrides:
+ # build_config:
+ # path: ../build_config
diff --git a/build_test/BUILD.gn b/build_test/BUILD.gn
index 9546284..f098c96 100644
--- a/build_test/BUILD.gn
+++ b/build_test/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_test-0.10.7+1
+# This file is generated by importer.py for build_test-0.10.7+2
import("//build/dart/dart_library.gni")
diff --git a/build_test/CHANGELOG.md b/build_test/CHANGELOG.md
index 9ef805f..f6287bc 100644
--- a/build_test/CHANGELOG.md
+++ b/build_test/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.10.7+2
+
+- Avoid throwing for missing files from `PackageAssetReader.canRead`.
+
## 0.10.7+1
- Allow `build_config` `0.4.x`.
diff --git a/build_test/README.md b/build_test/README.md
index 1ecba2a..2f0ca5d 100644
--- a/build_test/README.md
+++ b/build_test/README.md
@@ -1,5 +1,3 @@
-# build_test
-
<p align="center">
Testing utilities for users of <a href="https://pub.dartlang.org/packages/build"><code>package:build</code></a>.
<br>
diff --git a/build_test/lib/src/package_reader.dart b/build_test/lib/src/package_reader.dart
index a9024b5..f38d3fc 100644
--- a/build_test/lib/src/package_reader.dart
+++ b/build_test/lib/src/package_reader.dart
@@ -83,7 +83,7 @@
if (id.package == _rootPackage) {
return File(p.canonicalize(p.join(_rootPackagePath, id.path)));
}
- throw UnsupportedError('Unable to resolve $id');
+ return null;
}
String get _rootPackagePath {
@@ -125,29 +125,15 @@
}
@override
- Future<bool> canRead(AssetId id) {
- final file = _resolve(id);
- if (file == null) {
- return Future.value(false);
- }
- return file.exists();
- }
+ Future<bool> canRead(AssetId id) =>
+ _resolve(id)?.exists() ?? Future.value(false);
@override
- Future<List<int>> readAsBytes(AssetId id) {
- final file = _resolve(id);
- if (file == null) {
- throw ArgumentError('Could not read $id.');
- }
- return file.readAsBytes();
- }
+ Future<List<int>> readAsBytes(AssetId id) =>
+ _resolve(id)?.readAsBytes() ?? (throw AssetNotFoundException(id));
@override
- Future<String> readAsString(AssetId id, {Encoding encoding = utf8}) {
- final file = _resolve(id);
- if (file == null) {
- throw ArgumentError('Could not read $id.');
- }
- return file.readAsString(encoding: encoding);
- }
+ Future<String> readAsString(AssetId id, {Encoding encoding = utf8}) =>
+ _resolve(id)?.readAsString(encoding: encoding) ??
+ (throw AssetNotFoundException(id));
}
diff --git a/build_test/pubspec.yaml b/build_test/pubspec.yaml
index e58f811..f08035b 100644
--- a/build_test/pubspec.yaml
+++ b/build_test/pubspec.yaml
@@ -1,6 +1,6 @@
name: build_test
description: Utilities for writing unit tests of Builders.
-version: 0.10.7+1
+version: 0.10.7+2
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_test
@@ -26,7 +26,7 @@
watcher: ^0.9.7
dev_dependencies:
- analyzer: ">=0.27.1 <0.37.0"
- build_runner: ^1.0.0
- build_vm_compilers: ^0.1.0
+ analyzer: ">=0.35.4 <0.37.0"
+ build_runner: ^1.3.3
+ build_vm_compilers: '>=0.1.2 <2.0.0'
collection: ^1.14.0
diff --git a/build_vm_compilers/BUILD.gn b/build_vm_compilers/BUILD.gn
index b88faf7..ef3dd62 100644
--- a/build_vm_compilers/BUILD.gn
+++ b/build_vm_compilers/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for build_vm_compilers-0.1.2
+# This file is generated by importer.py for build_vm_compilers-1.0.0
import("//build/dart/dart_library.gni")
diff --git a/build_vm_compilers/CHANGELOG.md b/build_vm_compilers/CHANGELOG.md
index 9aceb32..de474ed 100644
--- a/build_vm_compilers/CHANGELOG.md
+++ b/build_vm_compilers/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.0.0
+
+- Support build_modules 2.0.0
+ - Define our own `vm` platform and builders explicitly.
+- Skip trying to compile apps that import known incompatible libraries.
+
## 0.1.2
- Increased the upper bound for `package:analyzer` to `<0.37.0`.
diff --git a/build_vm_compilers/build.yaml b/build_vm_compilers/build.yaml
index bb089d0..4b13b98 100644
--- a/build_vm_compilers/build.yaml
+++ b/build_vm_compilers/build.yaml
@@ -1,10 +1,26 @@
builders:
+ modules:
+ import: "package:build_vm_compilers/builders.dart"
+ builder_factories:
+ - metaModuleBuilder
+ - metaModuleCleanBuilder
+ - moduleBuilder
+ build_extensions:
+ $lib$:
+ - .vm.meta_module.raw
+ - .vm.meta_module.clean
+ .dart:
+ - .vm.module
+ is_optional: True
+ auto_apply: none
+ required_inputs: [".dart", ".module.library"]
+ applies_builders: ["build_modules|module_cleanup"]
vm:
import: "package:build_vm_compilers/builders.dart"
builder_factories:
- vmKernelModuleBuilder
build_extensions:
- .dart:
+ .vm.module:
- .vm.dill
is_optional: True
auto_apply: all_packages
@@ -12,7 +28,7 @@
- .dart
- .vm.module
applies_builders:
- - build_modules|vm
+ - build_vm_compilers|modules
entrypoint:
import: "package:build_vm_compilers/builders.dart"
builder_factories:
diff --git a/build_vm_compilers/lib/build_vm_compilers.dart b/build_vm_compilers/lib/build_vm_compilers.dart
index 1d7368b..e0ea675 100644
--- a/build_vm_compilers/lib/build_vm_compilers.dart
+++ b/build_vm_compilers/lib/build_vm_compilers.dart
@@ -2,4 +2,5 @@
// 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.
+export 'src/platform.dart' show vmPlatform;
export 'src/vm_entrypoint_builder.dart' show VmEntrypointBuilder;
diff --git a/build_vm_compilers/lib/builders.dart b/build_vm_compilers/lib/builders.dart
index 47ddd2d..6848a54 100644
--- a/build_vm_compilers/lib/builders.dart
+++ b/build_vm_compilers/lib/builders.dart
@@ -6,16 +6,22 @@
import 'package:build_modules/build_modules.dart';
import 'package:path/path.dart' as p;
+import 'src/platform.dart';
import 'src/vm_entrypoint_builder.dart';
const vmKernelModuleExtension = '.vm.dill';
const vmKernelEntrypointExtension = '.vm.app.dill';
+Builder metaModuleBuilder(BuilderOptions options) =>
+ MetaModuleBuilder.forOptions(vmPlatform, options);
+Builder metaModuleCleanBuilder([_]) => MetaModuleCleanBuilder(vmPlatform);
+Builder moduleBuilder([_]) => ModuleBuilder(vmPlatform);
+
Builder vmKernelModuleBuilder(_) => KernelBuilder(
summaryOnly: false,
sdkKernelPath: p.join('lib', '_internal', 'vm_platform_strong.dill'),
outputExtension: vmKernelModuleExtension,
- platform: DartPlatform.vm,
+ platform: vmPlatform,
);
Builder vmKernelEntrypointBuilder(_) => VmEntrypointBuilder();
diff --git a/build_vm_compilers/lib/src/platform.dart b/build_vm_compilers/lib/src/platform.dart
new file mode 100644
index 0000000..85bdf5c
--- /dev/null
+++ b/build_vm_compilers/lib/src/platform.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2019, 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:build_modules/build_modules.dart';
+
+final vmPlatform = DartPlatform.register('vm', [
+ 'async',
+ 'cli',
+ 'collection',
+ 'convert',
+ 'core',
+ 'developer',
+ 'io',
+ 'isolate',
+ 'math',
+ 'mirrors',
+ 'nativewrappers',
+ 'profiler',
+ 'typed_data',
+ 'vmservice_io',
+ '_internal',
+]);
diff --git a/build_vm_compilers/lib/src/vm_entrypoint_builder.dart b/build_vm_compilers/lib/src/vm_entrypoint_builder.dart
index 2025997..a97302e 100644
--- a/build_vm_compilers/lib/src/vm_entrypoint_builder.dart
+++ b/build_vm_compilers/lib/src/vm_entrypoint_builder.dart
@@ -12,6 +12,7 @@
import 'package:pool/pool.dart';
import '../builders.dart';
+import 'platform.dart';
/// Because we hold bytes in memory we don't want to compile to many app entry
/// points at once.
@@ -29,19 +30,38 @@
};
@override
- Future<Null> build(BuildStep buildStep) async {
+ Future<void> build(BuildStep buildStep) async {
await _buildPool.withResource(() async {
var dartEntrypointId = buildStep.inputId;
var isAppEntrypoint = await _isAppEntryPoint(dartEntrypointId, buildStep);
if (!isAppEntrypoint) return;
var moduleId =
- buildStep.inputId.changeExtension(moduleExtension(DartPlatform.vm));
+ buildStep.inputId.changeExtension(moduleExtension(vmPlatform));
var module = Module.fromJson(
json.decode(await buildStep.readAsString(moduleId))
as Map<String, dynamic>);
- var transitiveModules =
- await module.computeTransitiveDependencies(buildStep);
+
+ List<Module> transitiveModules;
+ try {
+ transitiveModules = await module
+ .computeTransitiveDependencies(buildStep, throwIfUnsupported: true);
+ } on UnsupportedModules catch (e) {
+ var librariesString = (await e.exactLibraries(buildStep).toList())
+ .map((lib) => AssetId(lib.id.package,
+ lib.id.path.replaceFirst(moduleLibraryExtension, '.dart')))
+ .join('\n');
+ log.warning('''
+Skipping compiling ${buildStep.inputId} for the vm because some of its
+transitive libraries have sdk dependencies that not supported on this platform:
+
+$librariesString
+
+https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings
+''');
+ return;
+ }
+
var transitiveKernelModules = [
module.primarySource.changeExtension(vmKernelModuleExtension)
].followedBy(transitiveModules.map(
diff --git a/build_vm_compilers/mono_pkg.yaml b/build_vm_compilers/mono_pkg.yaml
index f077cc7..9bdc26f 100644
--- a/build_vm_compilers/mono_pkg.yaml
+++ b/build_vm_compilers/mono_pkg.yaml
@@ -8,6 +8,6 @@
- dartanalyzer: --fatal-infos --fatal-warnings .
- dartanalyzer: --fatal-warnings .
dart:
- - 2.1.0
+ - 2.3.0-dev.0.1
- unit_test:
- test
diff --git a/build_vm_compilers/pubspec.yaml b/build_vm_compilers/pubspec.yaml
index d4a7208..5a025c0 100644
--- a/build_vm_compilers/pubspec.yaml
+++ b/build_vm_compilers/pubspec.yaml
@@ -1,16 +1,16 @@
name: build_vm_compilers
-version: 0.1.2
+version: 1.0.0
description: Builder implementations wrapping Dart VM compilers.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/build/tree/master/build_vm_compilers
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.3.0-dev.0.1 <3.0.0"
dependencies:
analyzer: ">=0.30.0 <0.37.0"
build: '>=0.12.0 <2.0.0'
- build_modules: '>=0.4.0 <2.0.0'
+ build_modules: ^2.0.0
path: ^1.6.0
pool: ^1.3.0
diff --git a/built_collection/BUILD.gn b/built_collection/BUILD.gn
index 196c4de..d2b96c4 100644
--- a/built_collection/BUILD.gn
+++ b/built_collection/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for built_collection-4.2.0
+# This file is generated by importer.py for built_collection-4.2.1
import("//build/dart/dart_library.gni")
diff --git a/built_collection/CHANGELOG.md b/built_collection/CHANGELOG.md
index 766963f..ca7b6c0 100644
--- a/built_collection/CHANGELOG.md
+++ b/built_collection/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 4.2.1
+
+- Bug fix: `ListBuilder` `first` and `last` setters can no longer modify the
+ underlying collection.
+
## 4.2.0
- Add benchmark for VM and dart2js.
diff --git a/built_collection/lib/src/list/list_builder.dart b/built_collection/lib/src/list/list_builder.dart
index dda3a5c..53d99e9 100644
--- a/built_collection/lib/src/list/list_builder.dart
+++ b/built_collection/lib/src/list/list_builder.dart
@@ -69,7 +69,8 @@
/// As [List.first].
set first(E value) {
- _list.first = value;
+ _checkElement(value);
+ _safeList.first = value;
}
/// As [List.last].
@@ -77,7 +78,8 @@
/// As [List.last].
set last(E value) {
- _list.last = value;
+ _checkElement(value);
+ _safeList.last = value;
}
/// As [List.length].
diff --git a/built_collection/pubspec.yaml b/built_collection/pubspec.yaml
index a18efd0..d02ca23 100644
--- a/built_collection/pubspec.yaml
+++ b/built_collection/pubspec.yaml
@@ -1,7 +1,9 @@
name: built_collection
-version: 4.2.0
+version: 4.2.1
description: >
- Immutable collections using the builder pattern.
+ Immutable collections based on the SDK collections. Each SDK collection class
+ is split into a new immutable collection class and a corresponding mutable
+ builder class.
authors:
- David Morgan <davidmorgan@google.com>
- Matan Lurey <matanl@google.com>
diff --git a/built_value/AUTHORS b/built_value/AUTHORS
index 9f876ac..ea1ad81 100644
--- a/built_value/AUTHORS
+++ b/built_value/AUTHORS
@@ -7,3 +7,4 @@
Resul Alkan/MetGlobal <me@resulalkan.com>
Ivan Inozemtsev/Google Inc. <iinozemtsev@google.com>
Abhijeeth Padarthi <rkinabhi@gmail.com>
+John Dengis <jadengis@gmail.com>
diff --git a/built_value/BUILD.gn b/built_value/BUILD.gn
index 9c39cfb..5b06d6b 100644
--- a/built_value/BUILD.gn
+++ b/built_value/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for built_value-6.4.0
+# This file is generated by importer.py for built_value-6.5.0
import("//build/dart/dart_library.gni")
diff --git a/built_value/CHANGELOG.md b/built_value/CHANGELOG.md
index b605942..fcb6095 100644
--- a/built_value/CHANGELOG.md
+++ b/built_value/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+# 6.5.0
+
+- Add `Iso8601DurationSerializer` for use when you want ISO8601 serialization
+ instead of the default microseconds serialization.
+- Bump versions of `analyzer`, `analyzer_plugin` and `build_config`.
+
# 6.4.0
- Add `@BuiltValue(generateBuilderOnSetField: true)` which provides a way to
diff --git a/built_value/README.md b/built_value/README.md
index 31409a2..0bf40f5 100644
--- a/built_value/README.md
+++ b/built_value/README.md
@@ -30,7 +30,7 @@
- [Flutter + built_value + Reddit Tutorial](https://steemit.com/utopian-io/@tensor/building-immutable-models-with-built-value-and-built-collection-in-dart-s-flutter-framework);
[video](https://www.youtube.com/watch?v=hNbOSSgpneI);
[source code](https://github.com/tensor-programming/built_flutter_tutorial)
-
+
## Tools
- The [Json to Dart built_value class converter](https://charafau.github.io/json2builtvalue/) creates classes for you that correspond to a snippet of JSON
diff --git a/built_value/lib/iso_8601_duration_serializer.dart b/built_value/lib/iso_8601_duration_serializer.dart
new file mode 100644
index 0000000..0b45146
--- /dev/null
+++ b/built_value/lib/iso_8601_duration_serializer.dart
@@ -0,0 +1,103 @@
+// Copyright (c) 2019, Google Inc. 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:built_collection/built_collection.dart';
+import 'package:built_value/serializer.dart';
+
+/// Alternative serializer for [Duration].
+///
+/// Install this to use ISO8601 compatible format instead of the default
+/// (microseconds). Use [SerializersBuilder.add] to install it.
+///
+/// Note that this serializer is not 100% compatible with the ISO8601 format
+/// due to limitations of the [Duration] class, but is designed to produce and
+/// consume reasonable strings that match the standard.
+class Iso8601DurationSerializer extends PrimitiveSerializer<Duration> {
+ @override
+ Duration deserialize(Serializers serializers, Object serialized,
+ {FullType specifiedType = FullType.unspecified}) =>
+ _parseDuration(serialized);
+
+ @override
+ Object serialize(Serializers serializers, Duration object,
+ {FullType specifiedType = FullType.unspecified}) =>
+ _writeIso8601Duration(object);
+
+ @override
+ Iterable<Type> get types => BuiltList(const [Duration]);
+
+ @override
+ String get wireName => 'Duration';
+
+ Duration _parseDuration(String value) {
+ final match = _parseFormat.firstMatch(value);
+ if (match == null) {
+ throw FormatException('Invalid duration format', value);
+ }
+ // Iterate through the capture groups to build the unit mappings.
+ final unitMappings = <String, int>{};
+
+ // Start iterating at 1, because match[0] is the full match.
+ for (var i = 1; i <= match.groupCount; i++) {
+ final group = match[i];
+ if (group == null) continue;
+
+ // Get all but last character in group.
+ // The RegExp ensures this must be an int.
+ final value = int.parse(group.substring(0, group.length - 1));
+ // Get last character.
+ final unit = group.substring(group.length - 1);
+ unitMappings[unit] = value;
+ }
+ return Duration(
+ days: unitMappings[_dayToken] ?? 0,
+ hours: unitMappings[_hourToken] ?? 0,
+ minutes: unitMappings[_minuteToken] ?? 0,
+ seconds: unitMappings[_secondToken] ?? 0,
+ );
+ }
+
+ String _writeIso8601Duration(Duration duration) {
+ if (duration == Duration.zero) {
+ return 'PT0S';
+ }
+ final days = duration.inDays;
+ final hours = (duration - Duration(days: days)).inHours;
+ final minutes = (duration - Duration(days: days, hours: hours)).inMinutes;
+ final seconds =
+ (duration - Duration(days: days, hours: hours, minutes: minutes))
+ .inSeconds;
+ final remainder = duration -
+ Duration(days: days, hours: hours, minutes: minutes, seconds: seconds);
+
+ if (remainder != Duration.zero) {
+ throw ArgumentError.value(duration, 'duration',
+ 'Contains sub-second data which cannot be serialized.');
+ }
+ final buffer = StringBuffer(_durationToken)
+ ..write(days == 0 ? '' : '$days$_dayToken');
+ if (!(hours == 0 && minutes == 0 && seconds == 0)) {
+ buffer
+ ..write(_timeToken)
+ ..write(hours == 0 ? '' : '$hours$_hourToken')
+ ..write(minutes == 0 ? '' : '$minutes$_minuteToken')
+ ..write(seconds == 0 ? '' : '$seconds$_secondToken');
+ }
+ return buffer.toString();
+ }
+
+ // The unit tokens.
+ static const _durationToken = 'P';
+ static const _dayToken = 'D';
+ static const _timeToken = 'T';
+ static const _hourToken = 'H';
+ static const _minuteToken = 'M';
+ static const _secondToken = 'S';
+
+ // The parse format for ISO8601 durations.
+ static final _parseFormat = RegExp(
+ '^P(?!\$)(0D|[1-9][0-9]*D)?'
+ '(?:T(?!\$)(0H|[1-9][0-9]*H)?(0M|[1-9][0-9]*M)?(0S|[1-9][0-9]*S)?)?\$',
+ );
+}
diff --git a/built_value/pubspec.yaml b/built_value/pubspec.yaml
index 2a55674..f85df8b 100644
--- a/built_value/pubspec.yaml
+++ b/built_value/pubspec.yaml
@@ -1,5 +1,5 @@
name: built_value
-version: 6.4.0
+version: 6.5.0
description: >
Value types with builders, Dart classes as enums, and serialization.
This library is the runtime dependency.
diff --git a/dart_style/.travis.yml b/dart_style/.travis.yml
index 8b6048d..2477385 100644
--- a/dart_style/.travis.yml
+++ b/dart_style/.travis.yml
@@ -1,7 +1,9 @@
language: dart
-sudo: false
+
dart:
+ - 2.1.0
- dev
+
dart_task:
- test
- dartfmt
diff --git a/dart_style/BUILD.gn b/dart_style/BUILD.gn
index baf542c..b4dba57 100644
--- a/dart_style/BUILD.gn
+++ b/dart_style/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for dart_style-1.2.4
+# This file is generated by importer.py for dart_style-1.2.7
import("//build/dart/dart_library.gni")
diff --git a/dart_style/CHANGELOG.md b/dart_style/CHANGELOG.md
index 6a26ada..b765aa4 100644
--- a/dart_style/CHANGELOG.md
+++ b/dart_style/CHANGELOG.md
@@ -1,3 +1,32 @@
+# 1.2.7
+
+* Improve indentation of adjacent strings inside `=>` functions.
+
+# 1.2.6
+
+* Properly format trailing commas in assertions.
+* Improve indentation of adjacent strings. This fixes a regression introduced
+ in 1.2.5 and hopefully makes adjacent strings generally look better.
+
+ Adjacent strings in argument lists now format the same regardless of whether
+ the argument list contains a trailing comma. The rule is that if the
+ argument list contains no other strings, then the adjacent strings do not
+ get extra indentation. This keeps them lined up when doing so is unlikely to
+ be confused as showing separate independent string arguments.
+
+ Previously, adjacent strings were never indented in argument lists without a
+ trailing comma and always in argument lists that did. With this change,
+ adjacent strings are still always indented in collection literals because
+ readers are likely to interpret a series of unindented lines there as showing
+ separate collection elements.
+
+# 1.2.5
+
+* Add support for spreads inside collections (#778).
+* Add support for `if` and `for` elements inside collections (#779).
+* Require at least Dart 2.1.0.
+* Require analyzer 0.36.0.
+
# 1.2.4
* Update to latest analyzer package AST API.
diff --git a/dart_style/analysis_options.yaml b/dart_style/analysis_options.yaml
index e4b1b8f..14bcb12 100644
--- a/dart_style/analysis_options.yaml
+++ b/dart_style/analysis_options.yaml
@@ -1,3 +1,9 @@
+include: package:pedantic/analysis_options.yaml
linter:
rules:
+ - prefer_equal_for_default_values
+ - prefer_generic_function_type_aliases
+ - slash_for_doc_comments
- unawaited_futures
+ - unnecessary_const
+ - unnecessary_new
diff --git a/dart_style/benchmark/benchmark.dart b/dart_style/benchmark/benchmark.dart
index ab960f5..117558c 100644
--- a/dart_style/benchmark/benchmark.dart
+++ b/dart_style/benchmark/benchmark.dart
@@ -25,7 +25,7 @@
// Run the benchmark several times. This ensures the VM is warmed up and lets
// us see how much variance there is.
for (var i = 0; i <= NUM_TRIALS; i++) {
- var start = new DateTime.now();
+ var start = DateTime.now();
// For a single benchmark, format the source multiple times.
var result;
@@ -34,7 +34,7 @@
}
var elapsed =
- new DateTime.now().difference(start).inMilliseconds / FORMATS_PER_TRIAL;
+ DateTime.now().difference(start).inMilliseconds / FORMATS_PER_TRIAL;
// Keep track of the best run so far.
if (elapsed >= best) continue;
@@ -58,7 +58,7 @@
String loadFile(String name) {
var path = p.join(p.dirname(p.fromUri(Platform.script)), name);
- return new File(path).readAsStringSync();
+ return File(path).readAsStringSync();
}
void printResult(String label, double time) {
@@ -76,6 +76,6 @@
}
String formatSource() {
- var formatter = new DartFormatter();
+ var formatter = DartFormatter();
return formatter.format(source);
}
diff --git a/dart_style/bin/format.dart b/dart_style/bin/format.dart
index 04e4f0c..5a70dc4 100644
--- a/dart_style/bin/format.dart
+++ b/dart_style/bin/format.dart
@@ -15,10 +15,10 @@
import 'package:dart_style/src/style_fix.dart';
// Note: The following line of code is modified by tool/grind.dart.
-const version = "1.2.4";
+const version = "1.2.7";
void main(List<String> args) {
- var parser = new ArgParser(allowTrailingOptions: true);
+ var parser = ArgParser(allowTrailingOptions: true);
parser.addSeparator("Common options:");
parser.addFlag("help",
@@ -131,11 +131,11 @@
}
if (argResults["profile"]) {
- reporter = new ProfileReporter(reporter);
+ reporter = ProfileReporter(reporter);
}
if (argResults["set-exit-if-changed"]) {
- reporter = new SetExitReporter(reporter);
+ reporter = SetExitReporter(reporter);
}
int pageWidth;
@@ -151,7 +151,7 @@
int indent;
try {
indent = int.parse(argResults["indent"]);
- if (indent < 0 || indent.toInt() != indent) throw new FormatException();
+ if (indent < 0 || indent.toInt() != indent) throw FormatException();
} on FormatException catch (_) {
usageError(
parser,
@@ -173,11 +173,11 @@
}
}
- if (argResults.wasParsed("stdin-name") && !argResults.rest.isEmpty) {
+ if (argResults.wasParsed("stdin-name") && argResults.rest.isNotEmpty) {
usageError(parser, "Cannot pass --stdin-name when not reading from stdin.");
}
- var options = new FormatterOptions(reporter,
+ var options = FormatterOptions(reporter,
indent: indent,
pageWidth: pageWidth,
followLinks: followLinks,
@@ -199,7 +199,7 @@
var coordinates = selection.split(":");
if (coordinates.length != 2) {
- throw new FormatException(
+ throw FormatException(
'Selection should be a colon-separated pair of integers, "123:45".');
}
@@ -216,15 +216,15 @@
selectionLength = selection[1];
}
- var input = new StringBuffer();
- stdin.transform(new Utf8Decoder()).listen(input.write, onDone: () {
- var formatter = new DartFormatter(
+ var input = StringBuffer();
+ stdin.transform(Utf8Decoder()).listen(input.write, onDone: () {
+ var formatter = DartFormatter(
indent: options.indent,
pageWidth: options.pageWidth,
fixes: options.fixes);
try {
options.reporter.beforeFile(null, name);
- var source = new SourceCode(input.toString(),
+ var source = SourceCode(input.toString(),
uri: name,
selectionStart: selectionStart,
selectionLength: selectionLength);
@@ -248,7 +248,7 @@
/// Formats all of the files and directories given by [paths].
void formatPaths(FormatterOptions options, List<String> paths) {
for (var path in paths) {
- var directory = new Directory(path);
+ var directory = Directory(path);
if (directory.existsSync()) {
if (!processDirectory(options, directory)) {
exitCode = 65;
@@ -256,7 +256,7 @@
continue;
}
- var file = new File(path);
+ var file = File(path);
if (file.existsSync()) {
if (!processFile(options, file)) {
exitCode = 65;
diff --git a/dart_style/example/format.dart b/dart_style/example/format.dart
index 6d3ea61..6edbfe0 100644
--- a/dart_style/example/format.dart
+++ b/dart_style/example/format.dart
@@ -35,7 +35,7 @@
void runFormatter(String source, int pageWidth, {bool isCompilationUnit}) {
try {
- var formatter = new DartFormatter(pageWidth: pageWidth);
+ var formatter = DartFormatter(pageWidth: pageWidth);
var result;
if (isCompilationUnit) {
@@ -61,7 +61,7 @@
/// Runs the formatter test starting on [line] at [path] inside the "test"
/// directory.
void runTest(String path, int line) {
- var indentPattern = new RegExp(r"^\(indent (\d+)\)\s*");
+ var indentPattern = RegExp(r"^\(indent (\d+)\)\s*");
// Locate the "test" directory. Use mirrors so that this works with the test
// package, which loads this suite into an isolate.
@@ -72,7 +72,7 @@
.path),
"../test");
- var lines = new File(p.join(testDir, path)).readAsLinesSync();
+ var lines = File(p.join(testDir, path)).readAsLinesSync();
// The first line may have a "|" to indicate the page width.
var pageWidth = 80;
@@ -121,8 +121,7 @@
var expected =
_extractSelection(expectedOutput, isCompilationUnit: isCompilationUnit);
- var formatter =
- new DartFormatter(pageWidth: pageWidth, indent: leadingIndent);
+ var formatter = DartFormatter(pageWidth: pageWidth, indent: leadingIndent);
var actual = formatter.formatSource(inputCode);
@@ -151,14 +150,14 @@
/// Given a source string that contains ‹ and › to indicate a selection, returns
/// a [SourceCode] with the text (with the selection markers removed) and the
/// correct selection range.
-SourceCode _extractSelection(String source, {bool isCompilationUnit: false}) {
+SourceCode _extractSelection(String source, {bool isCompilationUnit = false}) {
var start = source.indexOf("‹");
source = source.replaceAll("‹", "");
var end = source.indexOf("›");
source = source.replaceAll("›", "");
- return new SourceCode(source,
+ return SourceCode(source,
isCompilationUnit: isCompilationUnit,
selectionStart: start == -1 ? null : start,
selectionLength: end == -1 ? null : end - start);
diff --git a/dart_style/lib/src/argument_list_visitor.dart b/dart_style/lib/src/argument_list_visitor.dart
index c71b9f0..25bbb75 100644
--- a/dart_style/lib/src/argument_list_visitor.dart
+++ b/dart_style/lib/src/argument_list_visitor.dart
@@ -57,7 +57,7 @@
_arguments._blocks.isNotEmpty || _functions != null;
factory ArgumentListVisitor(SourceVisitor visitor, ArgumentList node) {
- return new ArgumentListVisitor.forArguments(
+ return ArgumentListVisitor.forArguments(
visitor, node.leftParenthesis, node.rightParenthesis, node.arguments);
}
@@ -147,14 +147,8 @@
if (functionsStart == null) {
// No functions, so there is just a single argument list.
- return new ArgumentListVisitor._(
- visitor,
- leftParenthesis,
- rightParenthesis,
- arguments,
- new ArgumentSublist(arguments, arguments),
- null,
- null);
+ return ArgumentListVisitor._(visitor, leftParenthesis, rightParenthesis,
+ arguments, ArgumentSublist(arguments, arguments), null, null);
}
// Split the arguments into two independent argument lists with the
@@ -163,14 +157,14 @@
var functions = arguments.sublist(functionsStart, functionsEnd);
var argumentsAfter = arguments.skip(functionsEnd).toList();
- return new ArgumentListVisitor._(
+ return ArgumentListVisitor._(
visitor,
leftParenthesis,
rightParenthesis,
arguments,
- new ArgumentSublist(arguments, argumentsBefore),
+ ArgumentSublist(arguments, argumentsBefore),
functions,
- new ArgumentSublist(arguments, argumentsAfter));
+ ArgumentSublist(arguments, argumentsAfter));
}
ArgumentListVisitor._(
@@ -370,7 +364,7 @@
blocks.clear();
}
- return new ArgumentSublist._(
+ return ArgumentSublist._(
allArguments, positional, named, blocks, leadingBlocks, trailingBlocks);
}
@@ -379,7 +373,7 @@
void visit(SourceVisitor visitor) {
if (_blocks.isNotEmpty) {
- _blockRule = new Rule(Cost.splitBlocks);
+ _blockRule = Rule(Cost.splitBlocks);
}
var rule = _visitPositional(visitor);
@@ -394,7 +388,7 @@
// Only count the blocks in the positional rule.
var leadingBlocks = math.min(_leadingBlocks, _positional.length);
var trailingBlocks = math.max(_trailingBlocks - _named.length, 0);
- var rule = new PositionalRule(_blockRule, leadingBlocks, trailingBlocks);
+ var rule = PositionalRule(_blockRule, leadingBlocks, trailingBlocks);
_visitArguments(visitor, _positional, rule);
return rule;
@@ -407,7 +401,7 @@
// Only count the blocks in the named rule.
var leadingBlocks = math.max(_leadingBlocks - _positional.length, 0);
var trailingBlocks = math.min(_trailingBlocks, _named.length);
- var namedRule = new NamedRule(_blockRule, leadingBlocks, trailingBlocks);
+ var namedRule = NamedRule(_blockRule, leadingBlocks, trailingBlocks);
// Let the positional args force the named ones to split.
if (positionalRule != null) {
@@ -453,7 +447,7 @@
rule.disableSplitOnInnerRules();
// Tell it to use the rule we've already created.
- visitor.beforeBlock(_blocks[argument], this);
+ visitor.beforeBlock(_blocks[argument], blockRule, previousSplit);
} else if (_allArguments.length > 1) {
// Edge case: Only bump the nesting if there are multiple arguments. This
// lets us avoid spurious indentation in cases like:
diff --git a/dart_style/lib/src/call_chain_visitor.dart b/dart_style/lib/src/call_chain_visitor.dart
index b7289b0..936beee 100644
--- a/dart_style/lib/src/call_chain_visitor.dart
+++ b/dart_style/lib/src/call_chain_visitor.dart
@@ -157,7 +157,7 @@
// See if this call is a method call whose arguments are block formatted.
var isBlockCall = false;
if (call is MethodInvocation) {
- var args = new ArgumentListVisitor(visitor, call.argumentList);
+ var args = ArgumentListVisitor(visitor, call.argumentList);
isBlockCall = args.hasBlockArguments;
}
@@ -187,7 +187,7 @@
calls.remove(hangingCall);
}
- return new CallChainVisitor._(
+ return CallChainVisitor._(
visitor, target, properties, calls, blockCalls, hangingCall);
}
@@ -214,7 +214,7 @@
if (splitOnTarget) {
if (_properties.length > 1) {
- _propertyRule = new PositionalRule(null, 0, 0);
+ _propertyRule = PositionalRule(null, 0, 0);
_visitor.builder.startLazyRule(_propertyRule);
} else {
_enableRule(lazy: true);
@@ -230,7 +230,7 @@
_writeCall(_properties.single);
} else if (_properties.length > 1) {
if (!splitOnTarget) {
- _propertyRule = new PositionalRule(null, 0, 0);
+ _propertyRule = PositionalRule(null, 0, 0);
_visitor.builder.startRule(_propertyRule);
}
@@ -432,11 +432,11 @@
}
/// Creates a new method chain [Rule] if one is not already active.
- void _enableRule({bool lazy: false}) {
+ void _enableRule({bool lazy = false}) {
if (_ruleEnabled) return;
// If the properties split, force the calls to split too.
- var rule = new Rule();
+ var rule = Rule();
if (_propertyRule != null) _propertyRule.setNamedArgsRule(rule);
if (lazy) {
diff --git a/dart_style/lib/src/chunk.dart b/dart_style/lib/src/chunk.dart
index d1f33ca..5dfe201 100644
--- a/dart_style/lib/src/chunk.dart
+++ b/dart_style/lib/src/chunk.dart
@@ -225,7 +225,7 @@
/// Turns this chunk into one that can contain a block of child chunks.
void makeBlock(Chunk blockArgument) {
assert(_block == null);
- _block = new ChunkBlock(blockArgument);
+ _block = ChunkBlock(blockArgument);
}
/// Returns `true` if the block body owned by this chunk should be expression
diff --git a/dart_style/lib/src/chunk_builder.dart b/dart_style/lib/src/chunk_builder.dart
index c6cb303..20c7505 100644
--- a/dart_style/lib/src/chunk_builder.dart
+++ b/dart_style/lib/src/chunk_builder.dart
@@ -16,14 +16,14 @@
import 'whitespace.dart';
/// Matches if the last character of a string is an identifier character.
-final _trailingIdentifierChar = new RegExp(r"[a-zA-Z0-9_]$");
+final _trailingIdentifierChar = RegExp(r"[a-zA-Z0-9_]$");
/// Matches a JavaDoc-style doc comment that starts with "/**" and ends with
/// "*/" or "**/".
-final _javaDocComment = new RegExp(r"^/\*\*([^*/][\s\S]*?)\*?\*/$");
+final _javaDocComment = RegExp(r"^/\*\*([^*/][\s\S]*?)\*?\*/$");
/// Matches the leading "*" in a line in the middle of a JavaDoc-style comment.
-var _javaDocLine = new RegExp(r"^\s*\*(.*)");
+var _javaDocLine = RegExp(r"^\s*\*(.*)");
/// Takes the incremental serialized output of [SourceVisitor]--the source text
/// along with any comments and preserved whitespace--and produces a coherent
@@ -66,7 +66,7 @@
/// the hard split appears. For example, a hard split in a positional
/// argument list needs to force the named arguments to split too, but we
/// don't create that rule until after the positional arguments are done.
- final _hardSplitRules = new Set<Rule>();
+ final _hardSplitRules = Set<Rule>();
/// The list of rules that are waiting until the next whitespace has been
/// written before they start.
@@ -76,7 +76,7 @@
final _openSpans = <OpenSpan>[];
/// The current state.
- final _nesting = new NestingBuilder();
+ final _nesting = NestingBuilder();
/// The stack of nesting levels where block arguments may start.
///
@@ -438,7 +438,7 @@
///
/// Each call to this needs a later matching call to [endSpan].
void startSpan([int cost = Cost.normal]) {
- _openSpans.add(new OpenSpan(_currentChunkIndex, cost));
+ _openSpans.add(OpenSpan(_currentChunkIndex, cost));
}
/// Ends the innermost span.
@@ -450,7 +450,7 @@
if (openSpan.start == end) return;
// Add the span to every chunk that can split it.
- var span = new Span(openSpan.cost);
+ var span = Span(openSpan.cost);
for (var i = openSpan.start; i < end; i++) {
var chunk = _chunks[i];
if (!chunk.rule.isHardened) chunk.spans.add(span);
@@ -461,7 +461,7 @@
///
/// If omitted, defaults to a new [Rule].
void startRule([Rule rule]) {
- if (rule == null) rule = new Rule();
+ if (rule == null) rule = Rule();
// If there are any pending lazy rules, start them now so that the proper
// stack ordering of rules is maintained.
@@ -489,7 +489,7 @@
///
/// If [rule] is omitted, defaults to a new [Rule].
void startLazyRule([Rule rule]) {
- if (rule == null) rule = new Rule();
+ if (rule == null) rule = Rule();
_lazyRules.add(rule);
}
@@ -580,8 +580,7 @@
var chunk = _chunks.last;
chunk.makeBlock(argumentChunk);
- var builder =
- new ChunkBuilder._(this, _formatter, _source, chunk.block.chunks);
+ var builder = ChunkBuilder._(this, _formatter, _source, chunk.block.chunks);
// A block always starts off indented one level.
builder.indent();
@@ -653,7 +652,7 @@
debug.log();
}
- var writer = new LineWriter(_formatter, _chunks);
+ var writer = LineWriter(_formatter, _chunks);
var result = writer.writeLines(_formatter.indent,
isCompilationUnit: _source.isCompilationUnit);
@@ -671,7 +670,7 @@
selectionLength = selectionEnd - selectionStart;
}
- return new SourceCode(result.text,
+ return SourceCode(result.text,
uri: _source.uri,
isCompilationUnit: _source.isCompilationUnit,
selectionStart: selectionStart,
@@ -822,10 +821,10 @@
/// If [flushLeft] is `true`, then the split will always cause the next line
/// to be at column zero. Otherwise, it uses the normal indentation and
/// nesting behavior.
- void _writeHardSplit({bool isDouble, bool flushLeft, bool nest: false}) {
+ void _writeHardSplit({bool isDouble, bool flushLeft, bool nest = false}) {
// A hard split overrides any other whitespace.
_pendingWhitespace = null;
- _writeSplit(new Rule.hard(),
+ _writeSplit(Rule.hard(),
flushLeft: flushLeft, isDouble: isDouble, nest: nest);
}
@@ -843,8 +842,8 @@
return null;
}
- _chunks.last.applySplit(rule, _nesting.indentation,
- nest ? _nesting.nesting : new NestingLevel(),
+ _chunks.last.applySplit(
+ rule, _nesting.indentation, nest ? _nesting.nesting : NestingLevel(),
flushLeft: flushLeft, isDouble: isDouble, space: space);
if (_chunks.last.rule.isHardened) _handleHardSplit();
@@ -857,7 +856,7 @@
if (_chunks.isNotEmpty && _chunks.last.canAddText) {
_chunks.last.appendText(text);
} else {
- _chunks.add(new Chunk(text));
+ _chunks.add(Chunk(text));
}
}
diff --git a/dart_style/lib/src/dart_formatter.dart b/dart_style/lib/src/dart_formatter.dart
index afd0626..4824302 100644
--- a/dart_style/lib/src/dart_formatter.dart
+++ b/dart_style/lib/src/dart_formatter.dart
@@ -37,7 +37,7 @@
/// The number of characters of indentation to prefix the output lines with.
final int indent;
- final Set<StyleFix> fixes = new Set();
+ final Set<StyleFix> fixes = Set();
/// Creates a new formatter for Dart code.
///
@@ -69,17 +69,16 @@
} else if (uri is String) {
// Do nothing.
} else {
- throw new ArgumentError("uri must be `null`, a Uri, or a String.");
+ throw ArgumentError("uri must be `null`, a Uri, or a String.");
}
- return formatSource(
- new SourceCode(source, uri: uri, isCompilationUnit: true))
+ return formatSource(SourceCode(source, uri: uri, isCompilationUnit: true))
.text;
}
/// Formats the given [source] string containing a single Dart statement.
String formatStatement(String source) {
- return formatSource(new SourceCode(source, isCompilationUnit: false)).text;
+ return formatSource(SourceCode(source, isCompilationUnit: false)).text;
}
/// Formats the given [source].
@@ -87,14 +86,14 @@
/// Returns a new [SourceCode] containing the formatted code and the resulting
/// selection, if any.
SourceCode formatSource(SourceCode source) {
- var errorListener = new ErrorListener();
+ var errorListener = ErrorListener();
// Tokenize the source.
- var reader = new CharSequenceReader(source.text);
- var stringSource = new StringSource(source.text, source.uri);
- var scanner = new Scanner(stringSource, reader, errorListener);
+ var reader = CharSequenceReader(source.text);
+ var stringSource = StringSource(source.text, source.uri);
+ var scanner = Scanner(stringSource, reader, errorListener);
var startToken = scanner.tokenize();
- var lineInfo = new LineInfo(scanner.lineStarts);
+ var lineInfo = LineInfo(scanner.lineStarts);
// Infer the line ending if not given one. Do it here since now we know
// where the lines start.
@@ -112,8 +111,11 @@
errorListener.throwIfErrors();
// Parse it.
- var parser = new Parser(stringSource, errorListener);
+ var parser = Parser(stringSource, errorListener);
parser.enableOptionalNewAndConst = true;
+ parser.enableSetLiterals = true;
+ parser.enableSpreadCollections = true;
+ parser.enableControlFlowCollections = true;
AstNode node;
if (source.isCompilationUnit) {
@@ -124,27 +126,27 @@
// Make sure we consumed all of the source.
var token = node.endToken.next;
if (token.type != TokenType.EOF) {
- var error = new AnalysisError(
+ var error = AnalysisError(
stringSource,
token.offset,
math.max(token.length, 1),
ParserErrorCode.UNEXPECTED_TOKEN,
[token.lexeme]);
- throw new FormatterException([error]);
+ throw FormatterException([error]);
}
}
errorListener.throwIfErrors();
// Format it.
- var visitor = new SourceVisitor(this, lineInfo, source);
+ var visitor = SourceVisitor(this, lineInfo, source);
var output = visitor.run(node);
// Sanity check that only whitespace was changed if that's all we expect.
if (fixes.isEmpty &&
!string_compare.equalIgnoringWhitespace(source.text, output.text)) {
- throw new UnexpectedOutputException(source.text, output.text);
+ throw UnexpectedOutputException(source.text, output.text);
}
return output;
diff --git a/dart_style/lib/src/debug.dart b/dart_style/lib/src/debug.dart
index 67322ce..ea04a41 100644
--- a/dart_style/lib/src/debug.dart
+++ b/dart_style/lib/src/debug.dart
@@ -67,7 +67,7 @@
// Show the spans as vertical bands over their range (unless there are too
// many).
- var spanSet = new Set<Span>();
+ var spanSet = Set<Span>();
addSpans(List<Chunk> chunks) {
for (var chunk in chunks) {
spanSet.addAll(chunk.spans);
@@ -167,14 +167,14 @@
addChunk(chunks, "", i);
}
- var rowWidths = new List.filled(rows.first.length, 0);
+ var rowWidths = List.filled(rows.first.length, 0);
for (var row in rows) {
for (var i = 0; i < row.length; i++) {
rowWidths[i] = math.max(rowWidths[i], row[i].length);
}
}
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
for (var row in rows) {
for (var i = 0; i < row.length; i++) {
var cell = row[i].padRight(rowWidths[i]);
@@ -223,7 +223,7 @@
/// It will determine how best to split it into multiple lines of output and
/// return a single string that may contain one or more newline characters.
void dumpLines(List<Chunk> chunks, int firstLineIndent, SplitSet splits) {
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
writeIndent(indent) => buffer.write(gray("| " * (indent ~/ 2)));
diff --git a/dart_style/lib/src/error_listener.dart b/dart_style/lib/src/error_listener.dart
index 19e4076..bceb91e 100644
--- a/dart_style/lib/src/error_listener.dart
+++ b/dart_style/lib/src/error_listener.dart
@@ -25,6 +25,6 @@
void throwIfErrors() {
if (_errors.isEmpty) return;
- throw new FormatterException(_errors);
+ throw FormatterException(_errors);
}
}
diff --git a/dart_style/lib/src/exceptions.dart b/dart_style/lib/src/exceptions.dart
index 5494183..c517f40 100644
--- a/dart_style/lib/src/exceptions.dart
+++ b/dart_style/lib/src/exceptions.dart
@@ -18,7 +18,7 @@
/// Creates a human-friendly representation of the analysis errors.
String message({bool color}) {
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
buffer.writeln("Could not format because the source could not be parsed:");
// In case we get a huge series of cascaded errors, just show the first few.
@@ -35,7 +35,7 @@
source += " " * (error.offset + error.length - source.length);
}
- var file = new SourceFile.fromString(source, url: error.source.fullName);
+ var file = SourceFile.fromString(source, url: error.source.fullName);
var span = file.span(error.offset, error.offset + error.length);
if (buffer.isNotEmpty) buffer.writeln();
buffer.write(span.message(error.message, color: color));
diff --git a/dart_style/lib/src/formatter_options.dart b/dart_style/lib/src/formatter_options.dart
index 1edb15a..2940b79 100644
--- a/dart_style/lib/src/formatter_options.dart
+++ b/dart_style/lib/src/formatter_options.dart
@@ -29,9 +29,9 @@
final Iterable<StyleFix> fixes;
FormatterOptions(this.reporter,
- {this.indent: 0,
- this.pageWidth: 80,
- this.followLinks: false,
+ {this.indent = 0,
+ this.pageWidth = 80,
+ this.followLinks = false,
this.fixes});
}
@@ -39,17 +39,17 @@
abstract class OutputReporter {
/// Prints only the names of files whose contents are different from their
/// formatted version.
- static final OutputReporter dryRun = new _DryRunReporter();
+ static final OutputReporter dryRun = _DryRunReporter();
/// Prints the formatted results of each file to stdout.
- static final OutputReporter print = new _PrintReporter();
+ static final OutputReporter print = _PrintReporter();
/// Prints the formatted result and selection info of each file to stdout as
/// a JSON map.
- static final OutputReporter printJson = new _PrintJsonReporter();
+ static final OutputReporter printJson = _PrintJsonReporter();
/// Overwrites each file with its formatted result.
- static final OutputReporter overwrite = new _OverwriteReporter();
+ static final OutputReporter overwrite = _OverwriteReporter();
/// Describe the directory whose contents are about to be processed.
void showDirectory(String path) {}
@@ -200,7 +200,7 @@
/// Called when [file] is about to be formatted.
void beforeFile(File file, String label) {
super.beforeFile(file, label);
- _ongoing[label] = new DateTime.now();
+ _ongoing[label] = DateTime.now();
}
/// Describe the processed file at [path] whose formatted result is [output].
@@ -208,7 +208,7 @@
/// If the contents of the file are the same as the formatted output,
/// [changed] will be false.
void afterFile(File file, String label, SourceCode output, {bool changed}) {
- var elapsed = new DateTime.now().difference(_ongoing.remove(label));
+ var elapsed = DateTime.now().difference(_ongoing.remove(label));
if (elapsed.inMilliseconds >= 10) {
_elapsed[label] = elapsed;
} else {
diff --git a/dart_style/lib/src/io.dart b/dart_style/lib/src/io.dart
index 28f1a71..40fc1f7 100644
--- a/dart_style/lib/src/io.dart
+++ b/dart_style/lib/src/io.dart
@@ -22,7 +22,7 @@
options.reporter.showDirectory(directory.path);
var success = true;
- var shownHiddenPaths = new Set<String>();
+ var shownHiddenPaths = Set<String>();
for (var entry in directory.listSync(
recursive: true, followLinks: options.followLinks)) {
@@ -67,12 +67,12 @@
bool processFile(FormatterOptions options, File file, {String label}) {
if (label == null) label = file.path;
- var formatter = new DartFormatter(
+ var formatter = DartFormatter(
indent: options.indent,
pageWidth: options.pageWidth,
fixes: options.fixes);
try {
- var source = new SourceCode(file.readAsStringSync(), uri: file.path);
+ var source = SourceCode(file.readAsStringSync(), uri: file.path);
options.reporter.beforeFile(file, label);
var output = formatter.formatSource(source);
options.reporter
diff --git a/dart_style/lib/src/line_splitting/line_splitter.dart b/dart_style/lib/src/line_splitting/line_splitter.dart
index 420c509..95d545a 100644
--- a/dart_style/lib/src/line_splitting/line_splitter.dart
+++ b/dart_style/lib/src/line_splitting/line_splitter.dart
@@ -119,7 +119,7 @@
/// This is sorted lowest-cost first. This ensures that as soon as we find a
/// solution that fits in the page, we know it will be the lowest cost one
/// and can stop looking.
- final _queue = new SolveStateQueue();
+ final _queue = SolveStateQueue();
/// The lowest cost solution found so far.
SolveState _bestSolution;
@@ -128,7 +128,7 @@
/// page width.
LineSplitter(this.writer, List<Chunk> chunks, int blockIndentation,
int firstLineIndent,
- {bool flushLeft: false})
+ {bool flushLeft = false})
: chunks = chunks,
// Collect the set of rules that we need to select values for.
rules = chunks
@@ -163,7 +163,7 @@
/// first line of output with.
SplitSet apply() {
// Start with a completely unbound, unsplit solution.
- _queue.add(new SolveState(this, new RuleSet(rules.length)));
+ _queue.add(SolveState(this, RuleSet(rules.length)));
var attempts = 0;
while (_queue.isNotEmpty) {
diff --git a/dart_style/lib/src/line_splitting/rule_set.dart b/dart_style/lib/src/line_splitting/rule_set.dart
index 714875d..7011393 100644
--- a/dart_style/lib/src/line_splitting/rule_set.dart
+++ b/dart_style/lib/src/line_splitting/rule_set.dart
@@ -18,7 +18,7 @@
class RuleSet {
List<int> _values;
- RuleSet(int numRules) : this._(new List(numRules));
+ RuleSet(int numRules) : this._(List(numRules));
RuleSet._(this._values);
@@ -53,7 +53,7 @@
}
/// Creates a new [RuleSet] with the same bound rule values as this one.
- RuleSet clone() => new RuleSet._(_values.toList(growable: false));
+ RuleSet clone() => RuleSet._(_values.toList(growable: false));
/// Binds [rule] to [value] then checks to see if that violates any
/// constraints.
@@ -137,7 +137,7 @@
int _cost;
/// Creates a new empty split set for a line with [numChunks].
- SplitSet(int numChunks) : _columns = new List(numChunks - 1);
+ SplitSet(int numChunks) : _columns = List(numChunks - 1);
/// Marks the line after chunk [index] as starting at [column].
void add(int index, int column) {
diff --git a/dart_style/lib/src/line_splitting/solve_state.dart b/dart_style/lib/src/line_splitting/solve_state.dart
index f77fe13..0ae7a70 100644
--- a/dart_style/lib/src/line_splitting/solve_state.dart
+++ b/dart_style/lib/src/line_splitting/solve_state.dart
@@ -63,7 +63,7 @@
/// There is one other set of rules that go in here. Sometimes a bound rule
/// in the solve state constrains some other unbound rule to split. In that
/// case, we also consider that active so we know to not leave it at zero.
- final _liveRules = new Set<Rule>();
+ final _liveRules = Set<Rule>();
/// The set of splits chosen for this state.
SplitSet get splits => _splits;
@@ -205,7 +205,7 @@
// Make sure we don't violate the constraints of the bound rules.
if (!valid) continue;
- var state = new SolveState(_splitter, boundRules);
+ var state = SolveState(_splitter, boundRules);
// If some unbound rules are constrained to split, remember that.
if (mustSplitRules != null) {
@@ -281,7 +281,7 @@
void _calculateSplits() {
// Figure out which expression nesting levels got split and need to be
// assigned columns.
- var usedNestingLevels = new Set<NestingLevel>();
+ var usedNestingLevels = Set<NestingLevel>();
for (var i = 0; i < _splitter.chunks.length - 1; i++) {
var chunk = _splitter.chunks[i];
if (chunk.rule.isSplit(getValue(chunk.rule), chunk)) {
@@ -294,7 +294,7 @@
nesting.refreshTotalUsedIndent(usedNestingLevels);
}
- _splits = new SplitSet(_splitter.chunks.length);
+ _splits = SplitSet(_splitter.chunks.length);
for (var i = 0; i < _splitter.chunks.length - 1; i++) {
var chunk = _splitter.chunks[i];
if (chunk.rule.isSplit(getValue(chunk.rule), chunk)) {
@@ -354,7 +354,7 @@
// The set of spans that contain chunks that ended up splitting. We store
// these in a set so a span's cost doesn't get double-counted if more than
// one split occurs in it.
- var splitSpans = new Set();
+ var splitSpans = Set();
// The nesting level of the chunk that ended the previous line.
var previousNesting;
@@ -454,9 +454,9 @@
void _ensureBoundRulesInUnboundLines() {
if (_boundRulesInUnboundLines != null) return;
- _boundRulesInUnboundLines = new Set<Rule>();
+ _boundRulesInUnboundLines = Set<Rule>();
- var boundInLine = new Set<Rule>();
+ var boundInLine = Set<Rule>();
var hasUnbound = false;
for (var i = 0; i < _splitter.chunks.length - 1; i++) {
@@ -488,8 +488,8 @@
void _ensureConstraints() {
if (_constraints != null) return;
- _unboundRules = new Set();
- _boundRules = new Set();
+ _unboundRules = Set();
+ _boundRules = Set();
for (var rule in _splitter.rules) {
if (_ruleValues.contains(rule)) {
@@ -553,7 +553,7 @@
}
if (disallowedValues == null) {
- disallowedValues = new Set<int>();
+ disallowedValues = Set<int>();
_unboundConstraints[unbound] = disallowedValues;
}
@@ -564,7 +564,7 @@
}
String toString() {
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
buffer.writeAll(_splitter.rules.map((rule) {
var valueLength = "${rule.fullySplitValue}".length;
diff --git a/dart_style/lib/src/line_splitting/solve_state_queue.dart b/dart_style/lib/src/line_splitting/solve_state_queue.dart
index 2247cb3..a22731a 100644
--- a/dart_style/lib/src/line_splitting/solve_state_queue.dart
+++ b/dart_style/lib/src/line_splitting/solve_state_queue.dart
@@ -25,7 +25,7 @@
LineSplitter _splitter;
/// List implementation of a heap.
- List<SolveState> _queue = new List<SolveState>(_INITIAL_CAPACITY);
+ List<SolveState> _queue = List<SolveState>(_INITIAL_CAPACITY);
/// Number of elements in queue.
/// The heap is implemented in the first [_length] entries of [_queue].
@@ -50,7 +50,7 @@
var newCapacity = _queue.length * 2 + 1;
if (newCapacity < _INITIAL_CAPACITY) newCapacity = _INITIAL_CAPACITY;
- var newQueue = new List<SolveState>(newCapacity);
+ var newQueue = List<SolveState>(newCapacity);
newQueue.setRange(0, _length, _queue);
_queue = newQueue;
}
diff --git a/dart_style/lib/src/line_writer.dart b/dart_style/lib/src/line_writer.dart
index 9fb5d39..2c6d103 100644
--- a/dart_style/lib/src/line_writer.dart
+++ b/dart_style/lib/src/line_writer.dart
@@ -13,7 +13,7 @@
/// Given a series of chunks, splits them into lines and writes the result to
/// a buffer.
class LineWriter {
- final _buffer = new StringBuffer();
+ final _buffer = StringBuffer();
final List<Chunk> _chunks;
@@ -75,13 +75,13 @@
///
/// When we format the anonymous lambda, [column] will be 2, not 4.
FormatResult formatBlock(Chunk chunk, int column) {
- var key = new _BlockKey(chunk, column);
+ var key = _BlockKey(chunk, column);
// Use the cached one if we have it.
var cached = _blockCache[key];
if (cached != null) return cached;
- var writer = new LineWriter._(
+ var writer = LineWriter._(
chunk.block.chunks, _lineEnding, pageWidth, column, _blockCache);
// TODO(rnystrom): Passing in an initial indent here is hacky. The
@@ -97,7 +97,7 @@
/// Since this is linear and line splitting is worse it's good to feed the
/// line splitter smaller lists of chunks when possible.
FormatResult writeLines(int firstLineIndent,
- {bool isCompilationUnit: false, bool flushLeft: false}) {
+ {bool isCompilationUnit = false, bool flushLeft = false}) {
// Now that we know what hard splits there will be, break the chunks into
// independently splittable lines.
var newlines = 0;
@@ -127,7 +127,7 @@
// Be a good citizen, end with a newline.
if (isCompilationUnit) _buffer.write(_lineEnding);
- return new FormatResult(
+ return FormatResult(
_buffer.toString(), totalCost, _selectionStart, _selectionEnd);
}
@@ -149,7 +149,7 @@
}
// Run the line splitter.
- var splitter = new LineSplitter(this, chunks, _blockIndentation, indent,
+ var splitter = LineSplitter(this, chunks, _blockIndentation, indent,
flushLeft: flushLeft);
var splits = splitter.apply();
diff --git a/dart_style/lib/src/nesting_builder.dart b/dart_style/lib/src/nesting_builder.dart
index 2efebb3..bbae652 100644
--- a/dart_style/lib/src/nesting_builder.dart
+++ b/dart_style/lib/src/nesting_builder.dart
@@ -58,28 +58,17 @@
/// The current nesting, ignoring any pending nesting.
NestingLevel get nesting => _nesting;
- NestingLevel _nesting = new NestingLevel();
+ NestingLevel _nesting = NestingLevel();
/// The current nesting, including any pending nesting.
NestingLevel get currentNesting =>
_pendingNesting != null ? _pendingNesting : _nesting;
- /// The top "nesting level" that represents no expression nesting for the
- /// current block.
- NestingLevel get blockNesting {
- // Walk the nesting levels until we bottom out.
- var result = _nesting;
- while (result.parent != null) {
- result = result.parent;
- }
- return result;
- }
-
/// Creates a new indentation level [spaces] deeper than the current one.
///
/// If omitted, [spaces] defaults to [Indent.block].
void indent([int spaces]) {
- if (spaces == null) spaces = Indent.block;
+ spaces ??= Indent.block;
// Indentation should only change outside of nesting.
assert(_pendingNesting == null);
diff --git a/dart_style/lib/src/nesting_level.dart b/dart_style/lib/src/nesting_level.dart
index 4e74983..3be1a83 100644
--- a/dart_style/lib/src/nesting_level.dart
+++ b/dart_style/lib/src/nesting_level.dart
@@ -48,7 +48,7 @@
/// Creates a new deeper level of nesting indented [spaces] more characters
/// that the outer level.
- NestingLevel nest(int spaces) => new NestingLevel._(this, spaces);
+ NestingLevel nest(int spaces) => NestingLevel._(this, spaces);
/// Clears the previously calculated total indent of this nesting level.
void clearTotalUsedIndent() {
diff --git a/dart_style/lib/src/rule/combinator.dart b/dart_style/lib/src/rule/combinator.dart
index 1d73031..29b2550 100644
--- a/dart_style/lib/src/rule/combinator.dart
+++ b/dart_style/lib/src/rule/combinator.dart
@@ -46,7 +46,7 @@
/// the beginning of the line.
class CombinatorRule extends Rule {
/// The set of chunks before the combinators.
- final Set<Chunk> _combinators = new Set();
+ final Set<Chunk> _combinators = Set();
/// A list of sets of chunks prior to each name in a combinator.
///
@@ -72,7 +72,7 @@
/// This must be called before adding any names.
void addCombinator(Chunk chunk) {
_combinators.add(chunk);
- _names.add(new Set());
+ _names.add(Set());
}
/// Adds a chunk prior to a name to the current combinator.
diff --git a/dart_style/lib/src/rule/rule.dart b/dart_style/lib/src/rule/rule.dart
index fdda621..acca87f 100644
--- a/dart_style/lib/src/rule/rule.dart
+++ b/dart_style/lib/src/rule/rule.dart
@@ -59,7 +59,7 @@
///
/// This contains all direct as well as transitive relationships. If A
/// contains B which contains C, C's outerRules contains both B and A.
- final Set<Rule> _implied = new Set<Rule>();
+ final Set<Rule> _implied = Set<Rule>();
/// Marks [other] as implied by this one.
///
@@ -172,7 +172,7 @@
rule.constrainedRules.forEach(visit);
}
- _allConstrainedRules = new Set();
+ _allConstrainedRules = Set();
visit(this);
}
diff --git a/dart_style/lib/src/source_code.dart b/dart_style/lib/src/source_code.dart
index a79c220..061a0f3 100644
--- a/dart_style/lib/src/source_code.dart
+++ b/dart_style/lib/src/source_code.dart
@@ -51,32 +51,32 @@
SourceCode(this.text,
{this.uri,
- this.isCompilationUnit: true,
+ this.isCompilationUnit = true,
this.selectionStart,
this.selectionLength}) {
// Must either provide both selection bounds or neither.
if ((selectionStart == null) != (selectionLength == null)) {
- throw new ArgumentError(
+ throw ArgumentError(
"Is selectionStart is provided, selectionLength must be too.");
}
if (selectionStart != null) {
if (selectionStart < 0) {
- throw new ArgumentError("selectionStart must be non-negative.");
+ throw ArgumentError("selectionStart must be non-negative.");
}
if (selectionStart > text.length) {
- throw new ArgumentError("selectionStart must be within text.");
+ throw ArgumentError("selectionStart must be within text.");
}
}
if (selectionLength != null) {
if (selectionLength < 0) {
- throw new ArgumentError("selectionLength must be non-negative.");
+ throw ArgumentError("selectionLength must be non-negative.");
}
if (selectionStart + selectionLength > text.length) {
- throw new ArgumentError("selectionLength must end within text.");
+ throw ArgumentError("selectionLength must end within text.");
}
}
}
diff --git a/dart_style/lib/src/source_visitor.dart b/dart_style/lib/src/source_visitor.dart
index 6aa452a..8d649c0 100644
--- a/dart_style/lib/src/source_visitor.dart
+++ b/dart_style/lib/src/source_visitor.dart
@@ -23,7 +23,7 @@
import 'style_fix.dart';
import 'whitespace.dart';
-final _capitalPattern = new RegExp(r"^_?[A-Z].*[a-z]");
+final _capitalPattern = RegExp(r"^_?[A-Z].*[a-z]");
/// Visits every token of the AST and passes all of the relevant bits to a
/// [ChunkBuilder].
@@ -153,12 +153,17 @@
/// Before a block argument is visited, [ArgumentSublist] binds itself to the
/// beginning token of each block it controls. When we later visit that
/// literal, we use the token to find that association.
- final Map<Token, ArgumentSublist> _blockArgumentLists = {};
+ ///
+ /// This mapping is also used for spread collection literals that appear
+ /// inside control flow elements to ensure that when a "then" collection
+ /// splits, the corresponding "else" one does too.
+ final Map<Token, Rule> _blockRules = {};
+ final Map<Token, Chunk> _blockPreviousChunks = {};
/// Initialize a newly created visitor to write source code representing
/// the visited nodes to the given [writer].
SourceVisitor(this._formatter, this._lineInfo, this._source) {
- builder = new ChunkBuilder(_formatter, _source);
+ builder = ChunkBuilder(_formatter, _source);
}
/// Runs the visitor on [node], formatting its contents.
@@ -181,9 +186,70 @@
}
visitAdjacentStrings(AdjacentStrings node) {
+ // We generally want to indent adjacent strings because it can be confusing
+ // otherwise when they appear in a list of expressions, like:
+ //
+ // [
+ // "one",
+ // "two"
+ // "three",
+ // "four"
+ // ]
+ //
+ // Especially when these stings are longer, it can be hard to tell that
+ // "three" is a continuation of the previous argument.
+ //
+ // However, the indentation is distracting in argument lists that don't
+ // suffer from this ambiguity:
+ //
+ // test(
+ // "A very long test description..."
+ // "this indentation looks bad.", () { ... });
+ //
+ // To balance these, we omit the indentation when an adjacent string
+ // expression is the only string in an argument list.
+ var shouldNest = true;
+
+ var parent = node.parent;
+ if (parent is ArgumentList) {
+ shouldNest = false;
+
+ for (var argument in parent.arguments) {
+ if (argument == node) continue;
+ if (argument is StringLiteral) {
+ shouldNest = true;
+ break;
+ }
+ }
+ } else if (parent is Assertion) {
+ // Treat asserts like argument lists.
+ shouldNest = false;
+ if (parent.condition != node && parent.condition is StringLiteral) {
+ shouldNest = true;
+ }
+
+ if (parent.message != node && parent.message is StringLiteral) {
+ shouldNest = true;
+ }
+ } else if (parent is VariableDeclaration ||
+ parent is AssignmentExpression &&
+ parent.rightHandSide == node &&
+ parent.parent is ExpressionStatement) {
+ // Don't add extra indentation in a variable initializer or assignment:
+ //
+ // var variable =
+ // "no extra"
+ // "indent";
+ shouldNest = false;
+ } else if (parent is NamedExpression || parent is ExpressionFunctionBody) {
+ shouldNest = false;
+ }
+
builder.startSpan();
builder.startRule();
+ if (shouldNest) builder.nestExpression();
visitNodes(node.strings, between: splitOrNewline);
+ if (shouldNest) builder.unnest();
builder.endRule();
builder.endSpan();
}
@@ -211,7 +277,7 @@
/// 4. Split between one or more positional arguments, trying to keep as many
/// on earlier lines as possible.
/// 5. Split the named arguments each onto their own line.
- visitArgumentList(ArgumentList node, {bool nestExpression: true}) {
+ visitArgumentList(ArgumentList node, {bool nestExpression = true}) {
// Corner case: handle empty argument lists.
if (node.arguments.isEmpty) {
token(node.leftParenthesis);
@@ -233,7 +299,7 @@
}
if (nestExpression) builder.nestExpression();
- new ArgumentListVisitor(this, node).visit();
+ ArgumentListVisitor(this, node).visit();
if (nestExpression) builder.unnest();
}
@@ -255,8 +321,17 @@
var arguments = <Expression>[node.condition];
if (node.message != null) arguments.add(node.message);
+ // If the argument list has a trailing comma, format it like a collection
+ // literal where each argument goes on its own line, they are indented +2,
+ // and the ")" ends up on its own line.
+ if (arguments.last.endToken.next.type == TokenType.COMMA) {
+ _visitCollectionLiteral(
+ null, node.leftParenthesis, arguments, node.rightParenthesis);
+ return;
+ }
+
builder.nestExpression();
- var visitor = new ArgumentListVisitor.forArguments(
+ var visitor = ArgumentListVisitor.forArguments(
this, node.leftParenthesis, node.rightParenthesis, arguments);
visitor.visit();
builder.unnest();
@@ -269,7 +344,16 @@
var arguments = [node.condition];
if (node.message != null) arguments.add(node.message);
- var visitor = new ArgumentListVisitor.forArguments(
+ // If the argument list has a trailing comma, format it like a collection
+ // literal where each argument goes on its own line, they are indented +2,
+ // and the ")" ends up on its own line.
+ if (arguments.last.endToken.next.type == TokenType.COMMA) {
+ _visitCollectionLiteral(
+ null, node.leftParenthesis, arguments, node.rightParenthesis);
+ return;
+ }
+
+ var visitor = ArgumentListVisitor.forArguments(
this, node.leftParenthesis, node.rightParenthesis, arguments);
visitor.visit();
});
@@ -434,8 +518,7 @@
// If the cascade sections have consistent names they can be broken
// normally otherwise they always get their own line.
if (splitIfOperandsSplit) {
- builder.startLazyRule(
- _allowInlineCascade(node) ? new Rule() : new Rule.hard());
+ builder.startLazyRule(_allowInlineCascade(node) ? Rule() : Rule.hard());
}
// If the target of the cascade is a method call (or chain of them), we
@@ -458,7 +541,7 @@
// ..cascade()
// ..cascade();
if (node.target is MethodInvocation) {
- new CallChainVisitor(this, node.target).visit(unnest: false);
+ CallChainVisitor(this, node.target).visit(unnest: false);
} else {
visit(node.target);
}
@@ -469,8 +552,7 @@
// If the cascade section shouldn't cause the cascade to split, end the
// rule early so it isn't affected by it.
if (!splitIfOperandsSplit) {
- builder
- .startRule(_allowInlineCascade(node) ? new Rule() : new Rule.hard());
+ builder.startRule(_allowInlineCascade(node) ? Rule() : Rule.hard());
}
zeroSplit();
@@ -593,7 +675,7 @@
visit(node.typeParameters);
visit(node.extendsClause);
- builder.startRule(new CombinatorRule());
+ builder.startRule(CombinatorRule());
visit(node.withClause);
visit(node.implementsClause);
builder.endRule();
@@ -622,7 +704,7 @@
visit(node.superclass);
- builder.startRule(new CombinatorRule());
+ builder.startRule(CombinatorRule());
visit(node.withClause);
visit(node.implementsClause);
builder.endRule();
@@ -972,7 +1054,7 @@
_visitConfigurations(node.configurations);
- builder.startRule(new CombinatorRule());
+ builder.startRule(CombinatorRule());
visitNodes(node.combinators);
builder.endRule();
});
@@ -1049,7 +1131,7 @@
}
visitFormalParameterList(FormalParameterList node,
- {bool nestExpression: true}) {
+ {bool nestExpression = true}) {
// Corner case: empty parameter lists.
if (node.parameters.isEmpty) {
token(node.leftParenthesis);
@@ -1079,11 +1161,11 @@
if (nestExpression) builder.nestExpression();
token(node.leftParenthesis);
- _metadataRules.add(new MetadataRule());
+ _metadataRules.add(MetadataRule());
var rule;
if (requiredParams.isNotEmpty) {
- rule = new PositionalRule(null, 0, 0);
+ rule = PositionalRule(null, 0, 0);
_metadataRules.last.bindPositionalRule(rule);
builder.startRule(rule);
@@ -1115,7 +1197,7 @@
}
if (optionalParams.isNotEmpty) {
- var namedRule = new NamedRule(null, 0, 0);
+ var namedRule = NamedRule(null, 0, 0);
if (rule != null) rule.setNamedArgsRule(namedRule);
_metadataRules.last.bindNamedRule(namedRule);
@@ -1154,7 +1236,46 @@
if (nestExpression) builder.unnest();
}
- visitForStatement2(ForStatement2 node) {
+ void visitForElement(ForElement node) {
+ // Treat a spread of a collection literal like a block in a for statement
+ // and don't split after the for parts.
+ var isSpreadBody = _isSpreadCollection(node.body);
+
+ builder.nestExpression();
+ token(node.awaitKeyword, after: space);
+ token(node.forKeyword);
+ space();
+ token(node.leftParenthesis);
+
+ // Start the body rule so that if the parts split, the body does too.
+ builder.startRule();
+
+ // The rule for the parts.
+ builder.startRule();
+ visit(node.forLoopParts);
+ token(node.rightParenthesis);
+ builder.endRule();
+ builder.unnest();
+
+ builder.nestExpression(indent: 2, now: true);
+
+ if (isSpreadBody) {
+ space();
+ } else {
+ split();
+
+ // If the body is a non-spread collection or lambda, indent it.
+ builder.startBlockArgumentNesting();
+ }
+
+ visit(node.body);
+
+ if (!isSpreadBody) builder.endBlockArgumentNesting();
+ builder.unnest();
+ builder.endRule();
+ }
+
+ visitForStatement(ForStatement node) {
builder.nestExpression();
token(node.awaitKeyword, after: space);
token(node.forKeyword);
@@ -1387,6 +1508,104 @@
_visitCombinator(node.keyword, node.hiddenNames);
}
+ void visitIfElement(IfElement node) {
+ // Wrap the whole thing in a single rule. If a split happens inside the
+ // condition or the then clause, we want the then and else clauses to split.
+ builder.startRule();
+
+ token(node.ifKeyword);
+ space();
+ token(node.leftParenthesis);
+ visit(node.condition);
+ token(node.rightParenthesis);
+
+ // If the body of the then or else branch is a spread of a collection
+ // literal, then we want to format those collections more like blocks than
+ // like standalone objects. In particular, if both the then and else branch
+ // are spread collection literals, we want to ensure that they both split
+ // if either splits. So this:
+ //
+ // [
+ // if (condition) ...[
+ // thenClause
+ // ] else ...[
+ // elseClause
+ // ]
+ // ]
+ //
+ // And not something like this:
+ //
+ // [
+ // if (condition) ...[
+ // thenClause
+ // ] else ...[elseClause]
+ // ]
+ //
+ // To do that, if we see that either clause is a spread collection, we
+ // create a single rule and force both collections to use it.
+ var thenSpreadBracket = _findSpreadCollectionBracket(node.thenElement);
+ var elseSpreadBracket = _findSpreadCollectionBracket(node.elseElement);
+
+ if (thenSpreadBracket != null || elseSpreadBracket != null) {
+ var spreadRule = Rule();
+ if (thenSpreadBracket != null) {
+ beforeBlock(thenSpreadBracket, spreadRule, null);
+ }
+
+ if (elseSpreadBracket != null) {
+ beforeBlock(elseSpreadBracket, spreadRule, null);
+ }
+ }
+
+ builder.nestExpression(indent: 2, now: true);
+
+ // Treat a spread of a collection literal like a block in an if statement
+ // and don't split after the "else".
+ if (thenSpreadBracket != null) {
+ space();
+ } else {
+ split();
+
+ // If the then clause is a non-spread collection or lambda, make sure the
+ // body is indented.
+ builder.startBlockArgumentNesting();
+ }
+
+ visit(node.thenElement);
+
+ if (thenSpreadBracket == null) builder.endBlockArgumentNesting();
+ builder.unnest();
+
+ if (node.elseElement != null) {
+ if (thenSpreadBracket != null) {
+ space();
+ } else {
+ split();
+ }
+
+ token(node.elseKeyword);
+
+ builder.nestExpression(indent: 2, now: true);
+
+ if (elseSpreadBracket != null) {
+ space();
+ } else {
+ split();
+
+ // If the else clause is a non-spread collection or lambda, make sure
+ // the body is indented.
+ builder.startBlockArgumentNesting();
+ }
+
+ visit(node.elseElement);
+
+ if (elseSpreadBracket == null) builder.endBlockArgumentNesting();
+ builder.unnest();
+ }
+
+ builder.endRule();
+ }
+
visitIfStatement(IfStatement node) {
builder.nestExpression();
token(node.ifKeyword);
@@ -1460,7 +1679,7 @@
visit(node.prefix);
}
- builder.startRule(new CombinatorRule());
+ builder.startRule(CombinatorRule());
visitNodes(node.combinators);
builder.endRule();
});
@@ -1604,17 +1823,18 @@
visitListLiteral(ListLiteral node) {
// Corner case: Splitting inside a list looks bad if there's only one
// element, so make those more costly.
- var cost =
- node.elements2.length <= 1 ? Cost.singleElementList : Cost.normal;
+ var cost = node.elements.length <= 1 ? Cost.singleElementList : Cost.normal;
_visitCollectionLiteral(
- node, node.leftBracket, node.elements2, node.rightBracket, cost);
+ node, node.leftBracket, node.elements, node.rightBracket, cost);
}
visitMapLiteralEntry(MapLiteralEntry node) {
+ builder.nestExpression();
visit(node.key);
token(node.separator);
soloSplit();
visit(node.value);
+ builder.unnest();
}
visitMethodDeclaration(MethodDeclaration node) {
@@ -1672,7 +1892,7 @@
return;
}
- new CallChainVisitor(this, node).visit();
+ CallChainVisitor(this, node).visit();
}
visitMixinDeclaration(MixinDeclaration node) {
@@ -1694,7 +1914,7 @@
visit(node.onClause.superclassConstraints.single);
}
- builder.startRule(new CombinatorRule());
+ builder.startRule(CombinatorRule());
// If there are multiple superclass constraints, format them like the
// "implements" clause.
@@ -1779,7 +1999,7 @@
}
visitPrefixedIdentifier(PrefixedIdentifier node) {
- new CallChainVisitor(this, node).visit();
+ CallChainVisitor(this, node).visit();
}
visitPrefixExpression(PrefixExpression node) {
@@ -1803,7 +2023,7 @@
return;
}
- new CallChainVisitor(this, node).visit();
+ CallChainVisitor(this, node).visit();
}
visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
@@ -1839,7 +2059,7 @@
visitSetOrMapLiteral(SetOrMapLiteral node) {
_visitCollectionLiteral(
- node, node.leftBracket, node.elements2, node.rightBracket);
+ node, node.leftBracket, node.elements, node.rightBracket);
}
visitShowCombinator(ShowCombinator node) {
@@ -1882,6 +2102,11 @@
_writeStringLiteral(node.literal);
}
+ visitSpreadElement(SpreadElement node) {
+ token(node.spreadOperator);
+ visit(node.expression);
+ }
+
visitStringInterpolation(StringInterpolation node) {
for (var element in node.elements) {
visit(element);
@@ -2009,7 +2234,7 @@
}
visitTypeParameterList(TypeParameterList node) {
- _metadataRules.add(new MetadataRule());
+ _metadataRules.add(MetadataRule());
_visitGenericList(node.leftBracket, node.rightBracket, node.typeParameters);
@@ -2198,7 +2423,7 @@
/// If [nest] is true, an extra level of expression nesting is added after
/// the "=".
void _visitAssignment(Token equalsOperator, Expression rightHandSide,
- {bool nest: false}) {
+ {bool nest = false}) {
space();
token(equalsOperator);
@@ -2215,7 +2440,7 @@
/// Visits a type parameter or type argument list.
void _visitGenericList(
Token leftBracket, Token rightBracket, List<AstNode> nodes) {
- var rule = new TypeArgumentRule();
+ var rule = TypeArgumentRule();
builder.startLazyRule(rule);
builder.startSpan();
builder.nestExpression();
@@ -2345,7 +2570,7 @@
builder.nestExpression();
// This rule is ended by visitExpressionFunctionBody().
- builder.startLazyRule(new Rule(Cost.arrow));
+ builder.startLazyRule(Rule(Cost.arrow));
}
_visitParameterSignature(typeParameters, parameters);
@@ -2481,13 +2706,13 @@
// on the same line all share an argument-list-like rule that allows
// splitting between zero, one, or all of them. This is faster in long
// lists than using individual splits after each element.
- lineRule = new TypeArgumentRule();
+ lineRule = TypeArgumentRule();
builder.startLazyRule(lineRule);
} else {
// Newlines aren't significant, so use a hard rule to split the elements.
// The parent chunk of the collection will handle the unsplit case, so
// this only comes into play when the collection is split.
- rule = new Rule.hard();
+ rule = Rule.hard();
builder.startRule(rule);
}
@@ -2501,7 +2726,7 @@
// Start a new rule for the new line.
builder.endRule();
- lineRule = new TypeArgumentRule();
+ lineRule = TypeArgumentRule();
builder.startLazyRule(lineRule);
} else {
lineRule.beforeArgument(split());
@@ -2511,15 +2736,12 @@
}
}
- builder.nestExpression();
visit(element);
// The comma after the element.
if (element.endToken.next.type == TokenType.COMMA) {
token(element.endToken.next);
}
-
- builder.unnest();
}
builder.endRule();
@@ -2550,10 +2772,10 @@
// Can't have a trailing comma if there are no parameters.
assert(parameters.parameters.isNotEmpty);
- _metadataRules.add(new MetadataRule());
+ _metadataRules.add(MetadataRule());
// Always split the parameters.
- builder.startRule(new Rule.hard());
+ builder.startRule(Rule.hard());
token(parameters.leftParenthesis);
@@ -2612,7 +2834,7 @@
/// Begins writing a formal parameter of any kind.
void _beginFormalParameter(FormalParameter node) {
- builder.startLazyRule(new Rule(Cost.parameterType));
+ builder.startLazyRule(Rule(Cost.parameterType));
builder.nestExpression();
modifier(node.covariantKeyword);
}
@@ -2678,6 +2900,27 @@
builder.endRule();
}
+ /// Whether [node] is a spread of a collection literal.
+ bool _isSpreadCollection(AstNode node) =>
+ _findSpreadCollectionBracket(node) != null;
+
+ /// If [node] is a spread of a collection literal, then this returns the
+ /// token for the opening bracket of the collection, as in:
+ ///
+ /// [ ...[a, list] ]
+ /// // ^
+ ///
+ /// Otherwise, returns `null`.
+ Token _findSpreadCollectionBracket(AstNode node) {
+ if (node is SpreadElement) {
+ var expression = node.expression;
+ if (expression is ListLiteral) return expression.leftBracket;
+ if (expression is SetOrMapLiteral) return expression.leftBracket;
+ }
+
+ return null;
+ }
+
/// Gets the cost to split at an assignment (or `:` in the case of a named
/// default value) with the given [rightHandSide].
///
@@ -2741,14 +2984,17 @@
void _startLiteralBody(Token leftBracket) {
token(leftBracket);
- // See if this literal is associated with an argument list that wants to
- // handle splitting and indenting it. If not, we'll use a default rule.
- var rule;
- var argumentChunk;
- if (_blockArgumentLists.containsKey(leftBracket)) {
- var argumentList = _blockArgumentLists[leftBracket];
- rule = argumentList.blockRule;
- argumentChunk = argumentList.previousSplit;
+ // See if this literal is associated with an argument list or if element
+ // that wants to handle splitting and indenting it. If not, we'll use a
+ // default rule.
+ Rule rule;
+ if (_blockRules.containsKey(leftBracket)) {
+ rule = _blockRules[leftBracket];
+ }
+
+ Chunk argumentChunk;
+ if (_blockPreviousChunks.containsKey(leftBracket)) {
+ argumentChunk = _blockPreviousChunks[leftBracket];
}
// Create a rule for whether or not to split the block contents.
@@ -2844,17 +3090,20 @@
}
/// Marks the block that starts with [token] as being controlled by
- /// [argumentList].
+ /// [rule] and following [previousChunk].
///
- /// When the block is visited, [argumentList] will determine the
- /// indentation and splitting rule for the block.
- void beforeBlock(Token token, ArgumentSublist argumentList) {
- _blockArgumentLists[token] = argumentList;
+ /// When the block is visited, these will determine the indentation and
+ /// splitting rule for the block. These are used for handling block-like
+ /// expressions inside argument lists and spread collections inside if
+ /// elements.
+ void beforeBlock(Token token, Rule rule, [Chunk previousChunk]) {
+ _blockRules[token] = rule;
+ if (previousChunk != null) _blockPreviousChunks[token] = previousChunk;
}
/// Writes the beginning of a brace-delimited body and handles indenting and
/// starting the rule used to split the contents.
- void _beginBody(Token leftBracket, {bool space: false}) {
+ void _beginBody(Token leftBracket, {bool space = false}) {
token(leftBracket);
// Indent the body.
@@ -2866,7 +3115,7 @@
}
/// Finishes the body started by a call to [_beginBody].
- void _endBody(Token rightBracket, {bool space: false}) {
+ void _endBody(Token rightBracket, {bool space = false}) {
token(rightBracket, before: () {
// Split before the closing bracket character.
builder.unindent();
@@ -2960,7 +3209,7 @@
/// Writes a single space split with its own rule.
Rule soloSplit([int cost]) {
- var rule = new Rule(cost);
+ var rule = Rule(cost);
builder.startRule(rule);
split();
builder.endRule();
@@ -3037,7 +3286,7 @@
if (comment == token.precedingComments) linesBefore = 2;
}
- var sourceComment = new SourceComment(text, linesBefore,
+ var sourceComment = SourceComment(text, linesBefore,
isLineComment: comment.type == TokenType.SINGLE_LINE_COMMENT,
flushLeft: flushLeft);
diff --git a/dart_style/lib/src/style_fix.dart b/dart_style/lib/src/style_fix.dart
index f15d7f6..b23f3b8 100644
--- a/dart_style/lib/src/style_fix.dart
+++ b/dart_style/lib/src/style_fix.dart
@@ -6,23 +6,22 @@
/// Enum-like class for the different syntactic fixes that can be applied while
/// formatting.
class StyleFix {
- static const docComments = const StyleFix._(
+ static const docComments = StyleFix._(
"doc-comments", 'Use triple slash for documentation comments.');
- static const functionTypedefs = const StyleFix._(
+ static const functionTypedefs = StyleFix._(
"function-typedefs", 'Use new syntax for function type typedefs.');
- static const namedDefaultSeparator = const StyleFix._(
- "named-default-separator",
+ static const namedDefaultSeparator = StyleFix._("named-default-separator",
'Use "=" as the separator before named parameter default values.');
- static const optionalConst = const StyleFix._(
+ static const optionalConst = StyleFix._(
"optional-const", 'Remove "const" keyword inside constant context.');
static const optionalNew =
- const StyleFix._("optional-new", 'Remove "new" keyword.');
+ StyleFix._("optional-new", 'Remove "new" keyword.');
- static const all = const [
+ static const all = [
docComments,
functionTypedefs,
namedDefaultSeparator,
diff --git a/dart_style/lib/src/whitespace.dart b/dart_style/lib/src/whitespace.dart
index c405063..aff33c1 100644
--- a/dart_style/lib/src/whitespace.dart
+++ b/dart_style/lib/src/whitespace.dart
@@ -26,33 +26,33 @@
/// encountered to avoid trailing whitespace.
class Whitespace {
/// No whitespace.
- static const none = const Whitespace._("none");
+ static const none = Whitespace._("none");
/// A single non-breaking space.
- static const space = const Whitespace._("space");
+ static const space = Whitespace._("space");
/// A single newline.
- static const newline = const Whitespace._("newline");
+ static const newline = Whitespace._("newline");
/// A single newline that takes into account the current expression nesting
/// for the next line.
- static const nestedNewline = const Whitespace._("nestedNewline");
+ static const nestedNewline = Whitespace._("nestedNewline");
/// A single newline with all indentation eliminated at the beginning of the
/// next line.
///
/// Used for subsequent lines in a multiline string.
- static const newlineFlushLeft = const Whitespace._("newlineFlushLeft");
+ static const newlineFlushLeft = Whitespace._("newlineFlushLeft");
/// Two newlines, a single blank line of separation.
- static const twoNewlines = const Whitespace._("twoNewlines");
+ static const twoNewlines = Whitespace._("twoNewlines");
/// A split or newline should be output based on whether the current token is
/// on the same line as the previous one or not.
///
/// In general, we like to avoid using this because it makes the formatter
/// less prescriptive over the user's whitespace.
- static const splitOrNewline = const Whitespace._("splitOrNewline");
+ static const splitOrNewline = Whitespace._("splitOrNewline");
/// A split or blank line (two newlines) should be output based on whether
/// the current token is on the same line as the previous one or not.
@@ -62,14 +62,14 @@
///
/// In general, we like to avoid using this because it makes the formatter
/// less prescriptive over the user's whitespace.
- static const splitOrTwoNewlines = const Whitespace._("splitOrTwoNewlines");
+ static const splitOrTwoNewlines = Whitespace._("splitOrTwoNewlines");
/// One or two newlines should be output based on how many newlines are
/// present between the next token and the previous one.
///
/// In general, we like to avoid using this because it makes the formatter
/// less prescriptive over the user's whitespace.
- static const oneOrTwoNewlines = const Whitespace._("oneOrTwoNewlines");
+ static const oneOrTwoNewlines = Whitespace._("oneOrTwoNewlines");
final String name;
diff --git a/dart_style/pubspec.yaml b/dart_style/pubspec.yaml
index 386d163..fec1a76 100644
--- a/dart_style/pubspec.yaml
+++ b/dart_style/pubspec.yaml
@@ -1,26 +1,26 @@
name: dart_style
# Note: See tool/grind.dart for how to bump the version.
-version: 1.2.4
+version: 1.2.7
author: Dart Team <misc@dartlang.org>
-description: Opinionated, automatic Dart source code formatter.
+description: >-
+ Opinionated, automatic Dart source code formatter.
+ Provides an API and a CLI tool.
homepage: https://github.com/dart-lang/dart_style
environment:
- sdk: '>=2.0.0 <3.0.0'
+ sdk: '>=2.1.0 <3.0.0'
dependencies:
- analyzer: '>=0.35.3 <0.36.0'
+ analyzer: '>=0.36.0 <0.37.0'
args: '>=0.12.1 <2.0.0'
path: ^1.0.0
source_span: ^1.4.0
dev_dependencies:
- async: '>=1.0.0 <=3.0.0'
grinder: ^0.8.0
- js: ^0.6.0
- node_preamble: ^1.0.0
+ pedantic: ^1.0.0
pub_semver: ^1.2.3
- test: ^1.2.0
+ test: ^1.6.0
test_descriptor: ^1.0.0
test_process: ^1.0.0
yaml: ^2.0.0
diff --git a/dart_style/tool/grind.dart b/dart_style/tool/grind.dart
index 31938d1..d5d794d 100644
--- a/dart_style/tool/grind.dart
+++ b/dart_style/tool/grind.dart
@@ -2,16 +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:convert';
-import 'dart:io';
-
import 'package:grinder/grinder.dart';
-import "package:node_preamble/preamble.dart" as preamble;
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart' as yaml;
/// Matches the version line in dart_style's pubspec.
-final _versionPattern = new RegExp(r"^version: .*$", multiLine: true);
+final _versionPattern = RegExp(r"^version: .*$", multiLine: true);
main(List<String> args) => grind(args);
@@ -19,7 +15,7 @@
@Task()
validate() async {
// Test it.
- await new TestRunner().testAsync();
+ await TestRunner().testAsync();
// Make sure it's warning clean.
Analyzer.analyze("bin/format.dart", fatalWarnings: true);
@@ -28,41 +24,6 @@
Dart.run("bin/format.dart", arguments: ["-w", "."]);
}
-@Task('Publish to npm')
-npm() {
- var out = 'dist';
-
- var pubspec = yaml.loadYaml(getFile("pubspec.yaml").readAsStringSync());
- var homepage = pubspec["homepage"];
- var fileName = 'index.js';
-
- // Generate modified dart2js output suitable to run on node.
- var tempFile = new File('${Directory.systemTemp.path}/temp.js');
-
- Dart2js.compile(new File('tool/node_format_service.dart'),
- outFile: tempFile, categories: 'all');
- var dart2jsOutput = tempFile.readAsStringSync();
- new File('$out/$fileName').writeAsStringSync('''${preamble.getPreamble()}
-self.exports = exports; // Temporary hack for Dart-JS Interop under node.
-$dart2jsOutput''');
-
- new File('$out/package.json')
- .writeAsStringSync(const JsonEncoder.withIndent(' ').convert({
- "name": "dart-style",
- "version": pubspec["version"],
- "description": pubspec["description"],
- "main": fileName,
- "typings": "dart-style.d.ts",
- "scripts": {"test": "echo \"Error: no test specified\" && exit 1"},
- "repository": {"type": "git", "url": "git+$homepage"},
- "author": pubspec["author"],
- "license": "BSD",
- "bugs": {"url": "$homepage/issues"},
- "homepage": homepage
- }));
- run('npm', arguments: ['publish', out]);
-}
-
/// Gets ready to publish a new version of the package.
///
/// To publish a version, you need to:
@@ -99,7 +60,7 @@
// Read the version from the pubspec.
var pubspecFile = getFile("pubspec.yaml");
var pubspec = pubspecFile.readAsStringSync();
- var version = new Version.parse(yaml.loadYaml(pubspec)["version"]);
+ var version = Version.parse(yaml.loadYaml(pubspec)["version"]);
// Require a "-dev" version since we don't otherwise know what to bump it to.
if (!version.isPreRelease) throw "Cannot publish non-dev version $version.";
@@ -108,7 +69,7 @@
// user intended the "+4" to be discarded or not.
if (version.build.isNotEmpty) throw "Cannot publish build version $version.";
- var bumped = new Version(version.major, version.minor, version.patch);
+ var bumped = Version(version.major, version.minor, version.patch);
// Update the version in the pubspec.
pubspec = pubspec.replaceAll(_versionPattern, "version: $bumped");
@@ -117,7 +78,7 @@
// Update the version constant in bin/format.dart.
var binFormatFile = getFile("bin/format.dart");
var binFormat = binFormatFile.readAsStringSync().replaceAll(
- new RegExp(r'const version = "[^"]+";'), 'const version = "$bumped";');
+ RegExp(r'const version = "[^"]+";'), 'const version = "$bumped";');
binFormatFile.writeAsStringSync(binFormat);
// Update the version in the CHANGELOG.
diff --git a/dart_style/tool/node_format_service.dart b/dart_style/tool/node_format_service.dart
deleted file mode 100644
index d063a3d..0000000
--- a/dart_style/tool/node_format_service.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:math' as math;
-
-import 'package:js/js.dart';
-
-import 'package:dart_style/dart_style.dart';
-
-@JS()
-@anonymous
-class FormatResult {
- external factory FormatResult({String code, String error});
- external String get code;
- external String get error;
-}
-
-@JS('exports.formatCode')
-external set formatCode(Function formatter);
-
-void main() {
- formatCode = allowInterop((String source) {
- var formatter = new DartFormatter();
-
- var exception;
- try {
- return new FormatResult(code: new DartFormatter().format(source));
- } on FormatterException catch (err) {
- // Couldn't parse it as a compilation unit.
- exception = err;
- }
-
- // Maybe it's a statement.
- try {
- return new FormatResult(code: formatter.formatStatement(source));
- } on FormatterException catch (err) {
- // There is an error when parsing it both as a compilation unit and a
- // statement, so we aren't sure which one the user intended. As a
- // heuristic, we'll choose that whichever one we managed to parse more of
- // before hitting an error is probably the right one.
- if (_firstOffset(exception) < _firstOffset(err)) {
- exception = err;
- }
- }
-
- // If we get here, it couldn't be parsed at all.
- return new FormatResult(code: source, error: "$exception");
- });
-}
-
-/// Returns the offset of the error nearest the beginning of the file out of
-/// all the errors in [exception].
-int _firstOffset(FormatterException exception) =>
- exception.errors.map((error) => error.offset).reduce(math.min);
diff --git a/front_end/BUILD.gn b/front_end/BUILD.gn
index 8e3e7e4..8d49d8f 100644
--- a/front_end/BUILD.gn
+++ b/front_end/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for front_end-0.1.14
+# This file is generated by importer.py for front_end-0.1.18
import("//build/dart/dart_library.gni")
@@ -13,13 +13,8 @@
deps = [
"//third_party/dart-pkg/pub/kernel",
- "//third_party/dart-pkg/pub/convert",
- "//third_party/dart-pkg/pub/package_config",
- "//third_party/dart-pkg/pub/crypto",
- "//third_party/dart-pkg/pub/yaml",
- "//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/path",
- "//third_party/dart-pkg/pub/source_span",
- "//third_party/dart-pkg/pub/charcode",
+ "//third_party/dart-pkg/pub/package_config",
+ "//third_party/dart-pkg/pub/yaml",
]
}
diff --git a/front_end/lib/src/api_prototype/compiler_options.dart b/front_end/lib/src/api_prototype/compiler_options.dart
index a1c0ef4..1d75bc5 100644
--- a/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/front_end/lib/src/api_prototype/compiler_options.dart
@@ -8,7 +8,8 @@
import 'diagnostic_message.dart' show DiagnosticMessageHandler;
-import 'experimental_flags.dart' show ExperimentalFlag, parseExperimentalFlag;
+import 'experimental_flags.dart'
+ show defaultExperimentalFlags, ExperimentalFlag, parseExperimentalFlag;
import 'file_system.dart' show FileSystem;
@@ -133,6 +134,11 @@
/// unevaluated and can be evaluated by a constant evaluator later.
Map<String, String> environmentDefines = null;
+ /// Report an error if a constant could not be evaluated (either because it
+ /// is an environment constant and no environment was specified, or because
+ /// it refers to a constructor or variable initializer that is not available).
+ bool errorOnUnevaluatedConstant = false;
+
/// The target platform that will consume the compiled code.
///
/// Used to provide platform-specific details to the compiler like:
@@ -209,30 +215,38 @@
/// Parse experimental flags from a list of strings, each of which is either a
/// flag name or a flag name prefixed by 'no-'. Return a map of flags to their
-/// values that can be passed to [experimentalFlags].
+/// values that can be passed to [experimentalFlags]. The returned map is
+/// normalized to contain default values for unmentioned flags.
///
/// If an unknown flag is mentioned, or a flag is mentioned more than once,
/// the supplied error handler is called with an error message.
Map<ExperimentalFlag, bool> parseExperimentalFlags(
Iterable<String> experiments, void onError(String message)) {
Map<ExperimentalFlag, bool> flags = <ExperimentalFlag, bool>{};
- if (experiments == null) return flags;
- for (String experiment in experiments) {
- bool value = true;
- if (experiment.startsWith("no-")) {
- value = false;
- experiment = experiment.substring(3);
- }
- ExperimentalFlag flag = parseExperimentalFlag(experiment);
- if (flag == null) {
- onError("Unknown experiment: " + experiment);
- } else if (flags.containsKey(flag)) {
- if (flags[flag] != value) {
- onError("Experiment specified with conflicting values: " + experiment);
+ if (experiments != null) {
+ for (String experiment in experiments) {
+ bool value = true;
+ if (experiment.startsWith("no-")) {
+ value = false;
+ experiment = experiment.substring(3);
}
- } else {
- flags[flag] = value;
+ ExperimentalFlag flag = parseExperimentalFlag(experiment);
+ if (flag == null) {
+ onError("Unknown experiment: " + experiment);
+ } else if (flags.containsKey(flag)) {
+ if (flags[flag] != value) {
+ onError(
+ "Experiment specified with conflicting values: " + experiment);
+ }
+ } else {
+ flags[flag] = value;
+ }
}
}
+ for (ExperimentalFlag flag in ExperimentalFlag.values) {
+ assert(defaultExperimentalFlags.containsKey(flag),
+ "No default value for $flag.");
+ flags[flag] ??= defaultExperimentalFlags[flag];
+ }
return flags;
}
diff --git a/front_end/lib/src/api_prototype/constant_evaluator.dart b/front_end/lib/src/api_prototype/constant_evaluator.dart
new file mode 100644
index 0000000..5eeb2a6
--- /dev/null
+++ b/front_end/lib/src/api_prototype/constant_evaluator.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2019, 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 front_end.constant_evaluator;
+
+export '../fasta/kernel/constant_evaluator.dart'
+ show
+ ConstantEvaluator,
+ ConstantsTransformer,
+ ErrorReporter,
+ EvaluationEnvironment,
+ SimpleErrorReporter,
+ transformComponent,
+ transformLibraries;
diff --git a/front_end/lib/src/api_prototype/experimental_flags.dart b/front_end/lib/src/api_prototype/experimental_flags.dart
index a9b772d..d0615fd 100644
--- a/front_end/lib/src/api_prototype/experimental_flags.dart
+++ b/front_end/lib/src/api_prototype/experimental_flags.dart
@@ -24,3 +24,10 @@
}
return null;
}
+
+const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
+ ExperimentalFlag.constantUpdate2018: false,
+ ExperimentalFlag.controlFlowCollections: true,
+ ExperimentalFlag.setLiterals: true,
+ ExperimentalFlag.spreadCollections: true,
+};
diff --git a/front_end/lib/src/api_unstable/bazel_worker.dart b/front_end/lib/src/api_unstable/bazel_worker.dart
index 5555840..89d8a56 100644
--- a/front_end/lib/src/api_unstable/bazel_worker.dart
+++ b/front_end/lib/src/api_unstable/bazel_worker.dart
@@ -7,6 +7,8 @@
import 'dart:async' show Future;
+import 'package:kernel/kernel.dart' show Component, CanonicalName;
+
import 'package:kernel/target/targets.dart' show Target;
import '../api_prototype/compiler_options.dart' show CompilerOptions;
@@ -17,11 +19,16 @@
import '../base/processed_options.dart' show ProcessedOptions;
+import '../fasta/compiler_context.dart' show CompilerContext;
+
+import '../fasta/incremental_compiler.dart' show IncrementalCompiler;
+
import '../fasta/kernel/utils.dart' show serializeComponent;
import '../kernel_generator_impl.dart' show generateKernel;
-import 'compiler_state.dart' show InitializedCompilerState;
+import 'compiler_state.dart'
+ show InitializedCompilerState, WorkerInputComponent, digestsEqual;
export '../api_prototype/diagnostic_message.dart' show DiagnosticMessage;
@@ -30,10 +37,133 @@
export '../api_prototype/terminal_color_support.dart'
show printDiagnosticMessage;
+export '../fasta/kernel/utils.dart' show serializeComponent;
+
export '../fasta/severity.dart' show Severity;
export 'compiler_state.dart' show InitializedCompilerState;
+/// Initializes the compiler for a modular build.
+///
+/// Re-uses cached components from [_workerInputCache], and reloads them
+/// as necessary based on [workerInputDigests].
+Future<InitializedCompilerState> initializeIncrementalCompiler(
+ InitializedCompilerState oldState,
+ Uri sdkSummary,
+ Uri packagesFile,
+ Uri librariesSpecificationUri,
+ List<Uri> summaryInputs,
+ Map<Uri, List<int>> workerInputDigests,
+ Target target,
+ FileSystem fileSystem,
+ bool outlineOnly) async {
+ List<int> sdkDigest = workerInputDigests[sdkSummary];
+ IncrementalCompiler incrementalCompiler;
+ CompilerOptions options;
+ ProcessedOptions processedOpts;
+ WorkerInputComponent cachedSdkInput;
+ Map<Uri, WorkerInputComponent> workerInputCache =
+ oldState?.workerInputCache ?? new Map<Uri, WorkerInputComponent>();
+ bool startOver = false;
+
+ if (oldState == null ||
+ oldState.incrementalCompiler == null ||
+ oldState.incrementalCompiler.outlineOnly != outlineOnly) {
+ // No previous state.
+ startOver = true;
+ } else {
+ // We do have a previous state.
+ cachedSdkInput = workerInputCache[sdkSummary];
+ if (cachedSdkInput == null ||
+ !digestsEqual(cachedSdkInput.digest, workerInputDigests[sdkSummary])) {
+ // The sdk is out of date.
+ startOver = true;
+ }
+ }
+
+ if (startOver) {
+ // The sdk was either not cached or it has changed.
+ options = new CompilerOptions()
+ ..sdkSummary = sdkSummary
+ ..packagesFileUri = packagesFile
+ ..librariesSpecificationUri = librariesSpecificationUri
+ ..target = target
+ ..fileSystem = fileSystem
+ ..omitPlatform = true
+ ..environmentDefines = const {};
+
+ processedOpts = new ProcessedOptions(options: options);
+ cachedSdkInput = WorkerInputComponent(
+ sdkDigest, await processedOpts.loadSdkSummary(null));
+ workerInputCache[sdkSummary] = cachedSdkInput;
+
+ incrementalCompiler = new IncrementalCompiler.fromComponent(
+ new CompilerContext(processedOpts),
+ cachedSdkInput.component,
+ outlineOnly);
+ } else {
+ options = oldState.options;
+ processedOpts = oldState.processedOpts;
+
+ var sdkComponent = cachedSdkInput.component;
+ // Reset the state of the component.
+ for (var lib in sdkComponent.libraries) {
+ lib.isExternal = cachedSdkInput.externalLibs.contains(lib.importUri);
+ }
+ sdkComponent.adoptChildren();
+ for (WorkerInputComponent cachedInput in workerInputCache.values) {
+ cachedInput.component.adoptChildren();
+ }
+
+ // Reuse the incremental compiler, but reset as needed.
+ incrementalCompiler = oldState.incrementalCompiler;
+ incrementalCompiler.invalidateAllSources();
+ options.packagesFileUri = packagesFile;
+ options.fileSystem = fileSystem;
+ }
+
+ // Then read all the input summary components.
+ CanonicalName nameRoot = cachedSdkInput.component.root;
+ final inputSummaries = <Component>[];
+ List<Uri> loadFromDill = new List<Uri>();
+ for (Uri summary in summaryInputs) {
+ var cachedInput = workerInputCache[summary];
+ var summaryDigest = workerInputDigests[summary];
+ if (cachedInput == null ||
+ cachedInput.component.root != nameRoot ||
+ !digestsEqual(cachedInput.digest, summaryDigest)) {
+ loadFromDill.add(summary);
+ } else {
+ // Need to reset cached components so they are usable again.
+ var component = cachedInput.component;
+ for (var lib in component.libraries) {
+ lib.isExternal = cachedInput.externalLibs.contains(lib.importUri);
+ }
+ component.adoptChildren();
+ component.computeCanonicalNames();
+ inputSummaries.add(component);
+ }
+ }
+
+ for (int i = 0; i < loadFromDill.length; i++) {
+ Uri summary = loadFromDill[i];
+ var summaryDigest = workerInputDigests[summary];
+ WorkerInputComponent cachedInput = WorkerInputComponent(
+ summaryDigest,
+ await processedOpts.loadComponent(
+ await fileSystem.entityForUri(summary).readAsBytes(), nameRoot,
+ alwaysCreateNewNamedNodes: true));
+ workerInputCache[summary] = cachedInput;
+ inputSummaries.add(cachedInput.component);
+ }
+
+ incrementalCompiler.setModulesToLoadOnNextComputeDelta(inputSummaries);
+
+ return new InitializedCompilerState(options, processedOpts,
+ workerInputCache: workerInputCache,
+ incrementalCompiler: incrementalCompiler);
+}
+
Future<InitializedCompilerState> initializeCompiler(
InitializedCompilerState oldState,
Uri sdkSummary,
@@ -55,7 +185,8 @@
..inputSummaries = summaryInputs
..linkedDependencies = linkedInputs
..target = target
- ..fileSystem = fileSystem;
+ ..fileSystem = fileSystem
+ ..environmentDefines = const {};
ProcessedOptions processedOpts = new ProcessedOptions(options: options);
diff --git a/front_end/lib/src/api_unstable/compiler_state.dart b/front_end/lib/src/api_unstable/compiler_state.dart
index 13d1327..dc80525 100644
--- a/front_end/lib/src/api_unstable/compiler_state.dart
+++ b/front_end/lib/src/api_unstable/compiler_state.dart
@@ -6,9 +6,41 @@
import '../base/processed_options.dart' show ProcessedOptions;
+import 'package:front_end/src/fasta/incremental_compiler.dart'
+ show IncrementalCompiler;
+
+import 'package:kernel/kernel.dart' show Component;
+
class InitializedCompilerState {
final CompilerOptions options;
final ProcessedOptions processedOpts;
+ final Map<Uri, WorkerInputComponent> workerInputCache;
+ final IncrementalCompiler incrementalCompiler;
- InitializedCompilerState(this.options, this.processedOpts);
+ InitializedCompilerState(this.options, this.processedOpts,
+ {this.workerInputCache, this.incrementalCompiler});
+}
+
+/// A cached [Component] for a summary input file.
+///
+/// Tracks the originally marked "external" libs so that they can be restored,
+/// since the kernel generator mutates the state.
+class WorkerInputComponent {
+ final List<int> digest;
+ final Component component;
+ final Set<Uri> externalLibs;
+ WorkerInputComponent(this.digest, this.component)
+ : externalLibs = component.libraries
+ .where((lib) => lib.isExternal)
+ .map((lib) => lib.importUri)
+ .toSet();
+}
+
+bool digestsEqual(List<int> a, List<int> b) {
+ if (a == null || b == null) return false;
+ if (a.length != b.length) return false;
+ for (int i = 0; i < a.length; i++) {
+ if (a[i] != b[i]) return false;
+ }
+ return true;
}
diff --git a/front_end/lib/src/api_unstable/dart2js.dart b/front_end/lib/src/api_unstable/dart2js.dart
index d716845..8ec174d 100644
--- a/front_end/lib/src/api_unstable/dart2js.dart
+++ b/front_end/lib/src/api_unstable/dart2js.dart
@@ -44,7 +44,8 @@
getMessageRelatedInformation,
getMessageUri;
-export '../api_prototype/experimental_flags.dart' show ExperimentalFlag;
+export '../api_prototype/experimental_flags.dart'
+ show defaultExperimentalFlags, ExperimentalFlag;
export '../api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
@@ -56,6 +57,8 @@
export '../compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
+export '../fasta/fasta_codes.dart' show LocatedMessage;
+
export '../fasta/kernel/redirecting_factory_body.dart'
show RedirectingFactoryBody;
@@ -107,9 +110,12 @@
InitializedCompilerState oldState,
Target target,
Uri librariesSpecificationUri,
- Uri sdkPlatformUri,
+ List<Uri> linkedDependencies,
Uri packagesFileUri,
- {Map<ExperimentalFlag, bool> experimentalFlags}) {
+ {List<Uri> dependencies,
+ Map<ExperimentalFlag, bool> experimentalFlags,
+ bool verify: false,
+ bool enableAsserts: false}) {
bool mapEqual(Map<ExperimentalFlag, bool> a, Map<ExperimentalFlag, bool> b) {
if (a == null || b == null) return a == b;
if (a.length != b.length) return false;
@@ -119,10 +125,20 @@
return true;
}
+ bool listEqual(List<Uri> a, List<Uri> b) {
+ if (a.length != b.length) return false;
+ for (int i = 0; i < a.length; ++i) {
+ if (a[i] != b[i]) return false;
+ }
+ return true;
+ }
+
+ linkedDependencies.sort((a, b) => a.toString().compareTo(b.toString()));
+
if (oldState != null &&
oldState.options.packagesFileUri == packagesFileUri &&
oldState.options.librariesSpecificationUri == librariesSpecificationUri &&
- oldState.options.linkedDependencies[0] == sdkPlatformUri &&
+ listEqual(oldState.options.linkedDependencies, linkedDependencies) &&
mapEqual(oldState.options.experimentalFlags, experimentalFlags)) {
return oldState;
}
@@ -130,10 +146,12 @@
CompilerOptions options = new CompilerOptions()
..target = target
..legacyMode = target.legacyMode
- ..linkedDependencies = [sdkPlatformUri]
+ ..linkedDependencies = linkedDependencies
..librariesSpecificationUri = librariesSpecificationUri
..packagesFileUri = packagesFileUri
- ..experimentalFlags = experimentalFlags;
+ ..experimentalFlags = experimentalFlags
+ ..verify = verify
+ ..enableAsserts = enableAsserts;
ProcessedOptions processedOpts = new ProcessedOptions(options: options);
diff --git a/front_end/lib/src/api_unstable/ddc.dart b/front_end/lib/src/api_unstable/ddc.dart
index 0a129d8..ef61212 100644
--- a/front_end/lib/src/api_unstable/ddc.dart
+++ b/front_end/lib/src/api_unstable/ddc.dart
@@ -4,7 +4,7 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show Component;
+import 'package:kernel/kernel.dart' show Component, CanonicalName;
import 'package:kernel/target/targets.dart' show Target;
@@ -20,9 +20,14 @@
import '../base/processed_options.dart' show ProcessedOptions;
+import '../fasta/compiler_context.dart' show CompilerContext;
+
+import '../fasta/incremental_compiler.dart' show IncrementalCompiler;
+
import '../kernel_generator_impl.dart' show generateKernel;
-import 'compiler_state.dart' show InitializedCompilerState;
+import 'compiler_state.dart'
+ show InitializedCompilerState, WorkerInputComponent, digestsEqual;
export '../api_prototype/compiler_options.dart' show CompilerOptions;
@@ -40,6 +45,12 @@
export '../api_prototype/terminal_color_support.dart'
show printDiagnosticMessage;
+export '../base/processed_options.dart' show ProcessedOptions;
+
+export '../fasta/compiler_context.dart' show CompilerContext;
+
+export '../fasta/incremental_compiler.dart' show IncrementalCompiler;
+
export '../fasta/kernel/redirecting_factory_body.dart'
show RedirectingFactoryBody;
@@ -48,7 +59,8 @@
export '../fasta/type_inference/type_schema_environment.dart'
show TypeSchemaEnvironment;
-export 'compiler_state.dart' show InitializedCompilerState;
+export 'compiler_state.dart'
+ show InitializedCompilerState, WorkerInputComponent, digestsEqual;
class DdcResult {
final Component component;
@@ -119,6 +131,117 @@
return new InitializedCompilerState(options, processedOpts);
}
+Future<InitializedCompilerState> initializeIncrementalCompiler(
+ InitializedCompilerState oldState,
+ List<Component> doneInputSummaries,
+ Uri sdkSummary,
+ Uri packagesFile,
+ Uri librariesSpecificationUri,
+ List<Uri> inputSummaries,
+ Target target,
+ {FileSystem fileSystem,
+ Map<ExperimentalFlag, bool> experiments}) async {
+ inputSummaries.sort((a, b) => a.toString().compareTo(b.toString()));
+
+ IncrementalCompiler incrementalCompiler;
+ WorkerInputComponent cachedSdkInput;
+ CompilerOptions options;
+ ProcessedOptions processedOpts;
+
+ Map<Uri, WorkerInputComponent> workerInputCache =
+ oldState?.workerInputCache ?? new Map<Uri, WorkerInputComponent>();
+ cachedSdkInput = workerInputCache[sdkSummary];
+
+ if (oldState == null ||
+ oldState.incrementalCompiler == null ||
+ cachedSdkInput == null) {
+ // No previous state.
+ options = new CompilerOptions()
+ ..sdkSummary = sdkSummary
+ ..packagesFileUri = packagesFile
+ ..inputSummaries = inputSummaries
+ ..librariesSpecificationUri = librariesSpecificationUri
+ ..target = target
+ ..fileSystem = fileSystem ?? StandardFileSystem.instance;
+ if (experiments != null) options.experimentalFlags = experiments;
+
+ processedOpts = new ProcessedOptions(options: options);
+
+ cachedSdkInput = new WorkerInputComponent(null /* not compared anyway */,
+ await processedOpts.loadSdkSummary(null));
+ workerInputCache[sdkSummary] = cachedSdkInput;
+ incrementalCompiler = new IncrementalCompiler.fromComponent(
+ new CompilerContext(processedOpts), cachedSdkInput.component);
+ } else {
+ options = oldState.options;
+ options.inputSummaries = inputSummaries;
+ processedOpts = oldState.processedOpts;
+
+ for (var lib in cachedSdkInput.component.libraries) {
+ lib.isExternal = false;
+ }
+ cachedSdkInput.component.adoptChildren();
+ for (WorkerInputComponent cachedInput in workerInputCache.values) {
+ cachedInput.component.adoptChildren();
+ }
+
+ // Reuse the incremental compiler, but reset as needed.
+ incrementalCompiler = oldState.incrementalCompiler;
+ incrementalCompiler.invalidateAllSources();
+ options.packagesFileUri = packagesFile;
+ options.fileSystem = fileSystem;
+ }
+ InitializedCompilerState compilerState = new InitializedCompilerState(
+ options, processedOpts,
+ workerInputCache: workerInputCache,
+ incrementalCompiler: incrementalCompiler);
+
+ CanonicalName nameRoot = cachedSdkInput.component.root;
+ List<int> loadFromDillIndexes = new List<int>();
+
+ // Notice that the ordering of the input summaries matter, so we need to
+ // keep them in order.
+ if (doneInputSummaries.length != inputSummaries.length) {
+ throw new ArgumentError("Invalid length.");
+ }
+ for (int i = 0; i < inputSummaries.length; i++) {
+ Uri inputSummary = inputSummaries[i];
+ WorkerInputComponent cachedInput = workerInputCache[inputSummary];
+ if (cachedInput == null ||
+ cachedInput.component.root != nameRoot ||
+ !digestsEqual(await fileSystem.entityForUri(inputSummary).readAsBytes(),
+ cachedInput.digest)) {
+ loadFromDillIndexes.add(i);
+ } else {
+ // Need to reset cached components so they are usable again.
+ var component = cachedInput.component;
+ for (var lib in component.libraries) {
+ lib.isExternal = cachedInput.externalLibs.contains(lib.importUri);
+ }
+ component.computeCanonicalNames();
+ doneInputSummaries[i] = component;
+ }
+ }
+
+ for (int i = 0; i < loadFromDillIndexes.length; i++) {
+ int index = loadFromDillIndexes[i];
+ Uri summary = inputSummaries[index];
+ List<int> data = await fileSystem.entityForUri(summary).readAsBytes();
+ WorkerInputComponent cachedInput = WorkerInputComponent(
+ data,
+ await compilerState.processedOpts
+ .loadComponent(data, nameRoot, alwaysCreateNewNamedNodes: true));
+ workerInputCache[summary] = cachedInput;
+ doneInputSummaries[index] = cachedInput.component;
+ }
+
+ incrementalCompiler.setModulesToLoadOnNextComputeDelta(doneInputSummaries);
+
+ return new InitializedCompilerState(options, processedOpts,
+ workerInputCache: workerInputCache,
+ incrementalCompiler: incrementalCompiler);
+}
+
Future<DdcResult> compile(InitializedCompilerState compilerState,
List<Uri> inputs, DiagnosticMessageHandler diagnosticMessageHandler) async {
CompilerOptions options = compilerState.options;
diff --git a/front_end/lib/src/api_unstable/vm.dart b/front_end/lib/src/api_unstable/vm.dart
index e3ef443..20ad6ad 100644
--- a/front_end/lib/src/api_unstable/vm.dart
+++ b/front_end/lib/src/api_unstable/vm.dart
@@ -34,25 +34,6 @@
export '../fasta/fasta_codes.dart'
show
LocatedMessage,
- Message,
- messageConstEvalCircularity,
- messageConstEvalContext,
- messageConstEvalFailedAssertion,
- noLength,
- templateConstEvalFreeTypeParameter,
- templateConstEvalDeferredLibrary,
- templateConstEvalDuplicateKey,
- templateConstEvalFailedAssertionWithMessage,
- templateConstEvalInvalidBinaryOperandType,
- templateConstEvalInvalidMethodInvocation,
- templateConstEvalInvalidStaticInvocation,
- templateConstEvalInvalidStringInterpolationOperand,
- templateConstEvalInvalidSymbolName,
- templateConstEvalInvalidType,
- templateConstEvalNegativeShift,
- templateConstEvalNonConstantLiteral,
- templateConstEvalNonConstantVariableGet,
- templateConstEvalZeroDivisor,
templateFfiFieldAnnotation,
templateFfiStructAnnotation,
templateFfiNotStatic,
diff --git a/front_end/lib/src/base/errors.dart b/front_end/lib/src/base/errors.dart
index 1f01f89..2fbd323 100644
--- a/front_end/lib/src/base/errors.dart
+++ b/front_end/lib/src/base/errors.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -26,6 +26,12 @@
final String correction;
/**
+ * The URL of a page containing documentation for errors with this code, or
+ * `null` if there is no known documentation.
+ */
+ final String url;
+
+ /**
* Whether this error is caused by an unresolved identifier.
*/
final bool isUnresolvedIdentifier;
@@ -36,7 +42,7 @@
* template. The correction associated with the error will be created from the
* given [correction] template.
*/
- const ErrorCode(this.name, this.message, [this.correction])
+ const ErrorCode(this.name, this.message, [this.correction, this.url])
: isUnresolvedIdentifier = false;
/**
@@ -46,7 +52,7 @@
* given [correction] template.
*/
const ErrorCode.temporary(this.name, this.message,
- {this.correction, this.isUnresolvedIdentifier: false});
+ {this.correction, this.isUnresolvedIdentifier: false, this.url});
/**
* The severity of the error.
diff --git a/front_end/lib/src/base/instrumentation.dart b/front_end/lib/src/base/instrumentation.dart
index ab62b21..5c16ee9 100644
--- a/front_end/lib/src/base/instrumentation.dart
+++ b/front_end/lib/src/base/instrumentation.dart
@@ -2,9 +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:kernel/ast.dart';
-
-import '../fasta/problems.dart';
+import 'package:kernel/ast.dart' show DartType, Member;
/// Convert '→' to '->' because '→' doesn't show up in some terminals.
/// Remove prefixes that are used very often in tests.
@@ -36,94 +34,6 @@
bool matches(String description) => description == toString();
}
-/// Instance of [InstrumentationValue] describing a forwarding stub.
-class InstrumentationValueForForwardingStub extends InstrumentationValue {
- final Procedure procedure;
-
- InstrumentationValueForForwardingStub(this.procedure);
-
- @override
- String toString() {
- var buffer = new StringBuffer();
- void writeParameter(VariableDeclaration parameter) {
- var covariances = <String>[];
- if (parameter.isGenericCovariantImpl) {
- covariances.add('genericImpl');
- }
- if (parameter.isCovariant) {
- covariances.add('explicit');
- }
- buffer.write('covariance=(${covariances.join(', ')}) ');
- buffer.write(parameter.type);
- buffer.write(' ');
- buffer.write(parameter.name);
- }
-
- if (procedure.isAbstract) {
- buffer.write('abstract ');
- }
- var function = procedure.function;
- buffer.write(function.returnType);
- buffer.write(' ');
- switch (procedure.kind) {
- case ProcedureKind.Operator:
- buffer.write('operator');
- break;
- case ProcedureKind.Method:
- break;
- case ProcedureKind.Setter:
- buffer.write('set ');
- break;
- case ProcedureKind.Getter:
- buffer.write('get ');
- break;
- default:
- unhandled('${procedure.kind}', 'InstrumentationValueForForwardingStub',
- -1, null);
- break;
- }
- buffer.write(procedure.name.name);
- if (function.typeParameters.isNotEmpty) {
- buffer.write('<');
- for (int i = 0; i < function.typeParameters.length; i++) {
- if (i != 0) buffer.write(', ');
- var typeParameter = function.typeParameters[i];
- var covariances = <String>[];
- if (typeParameter.isGenericCovariantImpl) {
- covariances.add('genericImpl');
- }
- buffer.write('covariance=(${covariances.join(', ')}) ');
- buffer.write(typeParameter.name);
- buffer.write(' extends ');
- buffer.write(
- new InstrumentationValueForType(typeParameter.bound).toString());
- }
- buffer.write('>');
- }
- buffer.write('(');
- for (int i = 0; i < function.positionalParameters.length; i++) {
- if (i != 0) buffer.write(', ');
- if (i == function.requiredParameterCount) buffer.write('[');
- writeParameter(function.positionalParameters[i]);
- }
- if (function.requiredParameterCount <
- function.positionalParameters.length) {
- buffer.write(']');
- }
- if (function.namedParameters.isNotEmpty) {
- if (function.positionalParameters.length != 0) buffer.write(', ');
- buffer.write('{');
- for (int i = 0; i < function.namedParameters.length; i++) {
- if (i != 0) buffer.write(', ');
- writeParameter(function.namedParameters[i]);
- }
- buffer.write('}');
- }
- buffer.write(')');
- return _shortenInstrumentationString(buffer.toString());
- }
-}
-
/// Instance of [InstrumentationValue] describing a [Member].
class InstrumentationValueForMember extends InstrumentationValue {
final Member member;
diff --git a/front_end/lib/src/base/processed_options.dart b/front_end/lib/src/base/processed_options.dart
index e56f20f..3746481 100644
--- a/front_end/lib/src/base/processed_options.dart
+++ b/front_end/lib/src/base/processed_options.dart
@@ -24,7 +24,8 @@
import '../api_prototype/compiler_options.dart'
show CompilerOptions, DiagnosticMessage;
-import '../api_prototype/experimental_flags.dart' show ExperimentalFlag;
+import '../api_prototype/experimental_flags.dart'
+ show defaultExperimentalFlags, ExperimentalFlag;
import '../api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
@@ -183,6 +184,8 @@
final Map<String, String> environmentDefines;
+ bool get errorOnUnevaluatedConstant => _raw.errorOnUnevaluatedConstant;
+
/// Initializes a [ProcessedOptions] object wrapping the given [rawOptions].
ProcessedOptions({CompilerOptions options, List<Uri> inputs, this.output})
: this._raw = options ?? new CompilerOptions(),
@@ -310,9 +313,11 @@
_raw.target ?? new NoneTarget(new TargetFlags(legacyMode: legacyMode));
bool isExperimentEnabled(ExperimentalFlag flag) {
+ assert(defaultExperimentalFlags.containsKey(flag),
+ "No default value for $flag.");
// TODO(askesc): Determine default flag value from specification file.
if (flag == ExperimentalFlag.setLiterals) return true;
- return _raw.experimentalFlags[flag] ?? false;
+ return _raw.experimentalFlags[flag] ?? defaultExperimentalFlags[flag];
}
/// Get an outline component that summarizes the SDK, if any.
@@ -374,12 +379,16 @@
}
/// Helper to load a .dill file from [uri] using the existing [nameRoot].
- Component loadComponent(List<int> bytes, CanonicalName nameRoot) {
+ Component loadComponent(List<int> bytes, CanonicalName nameRoot,
+ {bool alwaysCreateNewNamedNodes}) {
Component component =
target.configureComponent(new Component(nameRoot: nameRoot));
// TODO(ahe): Pass file name to BinaryBuilder.
// TODO(ahe): Control lazy loading via an option.
- new BinaryBuilder(bytes, filename: null, disableLazyReading: false)
+ new BinaryBuilder(bytes,
+ filename: null,
+ disableLazyReading: false,
+ alwaysCreateNewNamedNodes: alwaysCreateNewNamedNodes)
.readComponent(component);
return component;
}
diff --git a/front_end/lib/src/compute_platform_binaries_location.dart b/front_end/lib/src/compute_platform_binaries_location.dart
index 9ac1f54..ad98f28 100644
--- a/front_end/lib/src/compute_platform_binaries_location.dart
+++ b/front_end/lib/src/compute_platform_binaries_location.dart
@@ -69,8 +69,11 @@
Map<Uri, Source> uriToSource = CompilerContext.current.uriToSource;
Source source = uriToSource[uri];
if (source.source.isEmpty) {
- uriToSource[uri] = new Source(source.lineStarts,
- new File.fromUri(candidate).readAsBytesSync());
+ uriToSource[uri] = new Source(
+ source.lineStarts,
+ new File.fromUri(candidate).readAsBytesSync(),
+ source.importUri,
+ source.fileUri);
}
}
return candidate;
diff --git a/front_end/lib/src/fasta/builder/declaration.dart b/front_end/lib/src/fasta/builder/declaration.dart
index 392b3e6..4b3d601 100644
--- a/front_end/lib/src/fasta/builder/declaration.dart
+++ b/front_end/lib/src/fasta/builder/declaration.dart
@@ -83,6 +83,4 @@
/// Resolve constructors (lookup names in scope) recorded in this builder and
/// return the number of constructors resolved.
int resolveConstructors(covariant Declaration parent) => 0;
-
- void instrumentTopLevelInference(covariant instrumentation) {}
}
diff --git a/front_end/lib/src/fasta/command_line_reporting.dart b/front_end/lib/src/fasta/command_line_reporting.dart
index fbfd9df..1577804 100644
--- a/front_end/lib/src/fasta/command_line_reporting.dart
+++ b/front_end/lib/src/fasta/command_line_reporting.dart
@@ -12,7 +12,7 @@
import 'dart:typed_data' show Uint8List;
-import 'package:kernel/ast.dart' show Location;
+import 'package:kernel/ast.dart' show Location, TreeNode;
import '../compute_platform_binaries_location.dart' show translateSdk;
@@ -77,6 +77,9 @@
String path = relativizeUri(translateSdk(message.uri));
int offset = message.charOffset;
location ??= (offset == -1 ? null : getLocation(message.uri, offset));
+ if (location?.line == TreeNode.noOffset) {
+ location = null;
+ }
String sourceLine = getSourceLine(location);
if (sourceLine == null) {
sourceLine = "";
@@ -110,7 +113,7 @@
sourceLine = "\n$sourceLine\n$pointer";
}
String position =
- location == null ? ":1" : ":${location.line}:${location.column}";
+ location == null ? "" : ":${location.line}:${location.column}";
return "$path$position: $text$sourceLine";
} else {
return text;
diff --git a/front_end/lib/src/fasta/dill/dill_library_builder.dart b/front_end/lib/src/fasta/dill/dill_library_builder.dart
index 610dcea..c76a2bc 100644
--- a/front_end/lib/src/fasta/dill/dill_library_builder.dart
+++ b/front_end/lib/src/fasta/dill/dill_library_builder.dart
@@ -53,7 +53,7 @@
class DillLibraryBuilder extends LibraryBuilder<KernelTypeBuilder, Library> {
final Library library;
- final DillLoader loader;
+ DillLoader loader;
/// Exports that can't be serialized.
///
diff --git a/front_end/lib/src/fasta/dill/dill_member_builder.dart b/front_end/lib/src/fasta/dill/dill_member_builder.dart
index cfd35fb..a648190 100644
--- a/front_end/lib/src/fasta/dill/dill_member_builder.dart
+++ b/front_end/lib/src/fasta/dill/dill_member_builder.dart
@@ -57,10 +57,8 @@
}
bool get isSynthetic {
- // TODO(ahe): Kernel should eventually support a synthetic bit.
- return isConstructor &&
- name == "" &&
- (charOffset == parent.charOffset || charOffset == -1);
+ final Member member = this.member;
+ return member is Constructor && member.isSynthetic;
}
bool get isField => member is Field;
diff --git a/front_end/lib/src/fasta/dill/dill_target.dart b/front_end/lib/src/fasta/dill/dill_target.dart
index 4771d2c..59386d9 100644
--- a/front_end/lib/src/fasta/dill/dill_target.dart
+++ b/front_end/lib/src/fasta/dill/dill_target.dart
@@ -39,7 +39,7 @@
@override
void addSourceInformation(
- Uri uri, List<int> lineStarts, List<int> sourceCode) {
+ Uri importUri, Uri fileUri, List<int> lineStarts, List<int> sourceCode) {
unsupported("addSourceInformation", -1, null);
}
diff --git a/front_end/lib/src/fasta/fasta_codes_generated.dart b/front_end/lib/src/fasta/fasta_codes_generated.dart
index 574152c..0c4177b 100644
--- a/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -639,6 +639,30 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(Token token)>
+ templateCantUseControlFlowOrSpreadAsConstant =
+ const Template<Message Function(Token token)>(
+ messageTemplate:
+ r"""'#lexeme' is not supported in constant expressions.""",
+ withArguments: _withArgumentsCantUseControlFlowOrSpreadAsConstant);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Token token)>
+ codeCantUseControlFlowOrSpreadAsConstant =
+ const Code<Message Function(Token token)>(
+ "CantUseControlFlowOrSpreadAsConstant",
+ templateCantUseControlFlowOrSpreadAsConstant,
+ analyzerCodes: <String>["NOT_CONSTANT_EXPRESSION"]);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsCantUseControlFlowOrSpreadAsConstant(Token token) {
+ String lexeme = token.lexeme;
+ return new Message(codeCantUseControlFlowOrSpreadAsConstant,
+ message: """'${lexeme}' is not supported in constant expressions.""",
+ arguments: {'token': token});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
Token
@@ -733,6 +757,36 @@
tip: r"""Try replacing the colon with the keyword 'in'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String string,
+ String
+ string2)> templateConflictingModifiers = const Template<
+ Message Function(String string, String string2)>(
+ messageTemplate:
+ r"""Members can't be declared to be both '#string' and '#string2'.""",
+ tipTemplate: r"""Try removing one of the keywords.""",
+ withArguments: _withArgumentsConflictingModifiers);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, String string2)>
+ codeConflictingModifiers =
+ const Code<Message Function(String string, String string2)>(
+ "ConflictingModifiers", templateConflictingModifiers,
+ index: 59);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConflictingModifiers(String string, String string2) {
+ if (string.isEmpty) throw 'No string provided';
+ if (string2.isEmpty) throw 'No string provided';
+ return new Message(codeConflictingModifiers,
+ message:
+ """Members can't be declared to be both '${string}' and '${string2}'.""",
+ tip: """Try removing one of the keywords.""",
+ arguments: {'string': string, 'string2': string2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateConflictsWithConstructor =
const Template<Message Function(String name)>(
messageTemplate: r"""Conflicts with constructor '#name'.""",
@@ -896,28 +950,6 @@
message: r"""This is the type variable.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeConstAfterFactory = messageConstAfterFactory;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageConstAfterFactory = const MessageCode(
- "ConstAfterFactory",
- index: 56,
- message:
- r"""The modifier 'const' should be before the modifier 'factory'.""",
- tip: r"""Try re-ordering the modifiers.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeConstAndCovariant = messageConstAndCovariant;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageConstAndCovariant = const MessageCode(
- "ConstAndCovariant",
- index: 57,
- message:
- r"""Members can't be declared to be both 'const' and 'covariant'.""",
- tip: r"""Try removing either the 'const' or 'covariant' keyword.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeConstAndFinal = messageConstAndFinal;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -927,15 +959,6 @@
tip: r"""Try removing either the 'const' or 'final' keyword.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeConstAndVar = messageConstAndVar;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageConstAndVar = const MessageCode("ConstAndVar",
- index: 59,
- message: r"""Members can't be declared to be both 'const' and 'var'.""",
- tip: r"""Try removing either the 'const' or 'var' keyword.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeConstClass = messageConstClass;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1049,6 +1072,34 @@
const Template<
Message Function(
Constant
+ _constant)> templateConstEvalDuplicateElement = const Template<
+ Message Function(Constant _constant)>(
+ messageTemplate:
+ r"""The element '#constant' conflicts with another existing element in the set.""",
+ withArguments: _withArgumentsConstEvalDuplicateElement);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Constant _constant)> codeConstEvalDuplicateElement =
+ const Code<Message Function(Constant _constant)>(
+ "ConstEvalDuplicateElement", templateConstEvalDuplicateElement,
+ analyzerCodes: <String>["EQUAL_ELEMENTS_IN_CONST_SET"]);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalDuplicateElement(Constant _constant) {
+ TypeLabeler labeler = new TypeLabeler();
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ String constant = constantParts.join();
+ return new Message(codeConstEvalDuplicateElement,
+ message:
+ """The element '${constant}' conflicts with another existing element in the set.""" +
+ labeler.originMessages,
+ arguments: {'constant': _constant});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ Constant
_constant)> templateConstEvalDuplicateKey = const Template<
Message Function(Constant _constant)>(
messageTemplate:
@@ -1059,7 +1110,7 @@
const Code<Message Function(Constant _constant)> codeConstEvalDuplicateKey =
const Code<Message Function(Constant _constant)>(
"ConstEvalDuplicateKey", templateConstEvalDuplicateKey,
- analyzerCodes: <String>["EQUAL_KEYS_IN_MAP"]);
+ analyzerCodes: <String>["EQUAL_KEYS_IN_CONST_MAP"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsConstEvalDuplicateKey(Constant _constant) {
@@ -1074,6 +1125,36 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ Constant
+ _constant)> templateConstEvalElementImplementsEqual = const Template<
+ Message Function(Constant _constant)>(
+ messageTemplate:
+ r"""The element '#constant' does not have a primitive operator '=='.""",
+ withArguments: _withArgumentsConstEvalElementImplementsEqual);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Constant _constant)>
+ codeConstEvalElementImplementsEqual =
+ const Code<Message Function(Constant _constant)>(
+ "ConstEvalElementImplementsEqual",
+ templateConstEvalElementImplementsEqual,
+ analyzerCodes: <String>["CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS"]);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalElementImplementsEqual(Constant _constant) {
+ TypeLabeler labeler = new TypeLabeler();
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ String constant = constantParts.join();
+ return new Message(codeConstEvalElementImplementsEqual,
+ message:
+ """The element '${constant}' does not have a primitive operator '=='.""" +
+ labeler.originMessages,
+ arguments: {'constant': _constant});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeConstEvalFailedAssertion = messageConstEvalFailedAssertion;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1184,6 +1265,40 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
+ Constant _constant,
+ DartType
+ _type)> templateConstEvalInvalidEqualsOperandType = const Template<
+ Message Function(Constant _constant, DartType _type)>(
+ messageTemplate:
+ r"""Binary operator '==' requires receiver constant '#constant' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type '#type'.""",
+ withArguments: _withArgumentsConstEvalInvalidEqualsOperandType);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Constant _constant, DartType _type)>
+ codeConstEvalInvalidEqualsOperandType =
+ const Code<Message Function(Constant _constant, DartType _type)>(
+ "ConstEvalInvalidEqualsOperandType",
+ templateConstEvalInvalidEqualsOperandType,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalInvalidEqualsOperandType(
+ Constant _constant, DartType _type) {
+ TypeLabeler labeler = new TypeLabeler();
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ List<Object> typeParts = labeler.labelType(_type);
+ String constant = constantParts.join();
+ String type = typeParts.join();
+ return new Message(codeConstEvalInvalidEqualsOperandType,
+ message:
+ """Binary operator '==' requires receiver constant '${constant}' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type '${type}'.""" +
+ labeler.originMessages,
+ arguments: {'constant': _constant, 'type': _type});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
String string,
Constant
_constant)> templateConstEvalInvalidMethodInvocation = const Template<
@@ -1217,6 +1332,38 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
+ String string,
+ Constant
+ _constant)> templateConstEvalInvalidPropertyGet = const Template<
+ Message Function(String string, Constant _constant)>(
+ messageTemplate:
+ r"""The property '#string' can't be accessed on '#constant' within a const context.""",
+ withArguments: _withArgumentsConstEvalInvalidPropertyGet);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, Constant _constant)>
+ codeConstEvalInvalidPropertyGet =
+ const Code<Message Function(String string, Constant _constant)>(
+ "ConstEvalInvalidPropertyGet", templateConstEvalInvalidPropertyGet,
+ analyzerCodes: <String>["CONST_EVAL_THROWS_EXCEPTION"]);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalInvalidPropertyGet(
+ String string, Constant _constant) {
+ if (string.isEmpty) throw 'No string provided';
+ TypeLabeler labeler = new TypeLabeler();
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ String constant = constantParts.join();
+ return new Message(codeConstEvalInvalidPropertyGet,
+ message:
+ """The property '${string}' can't be accessed on '${constant}' within a const context.""" +
+ labeler.originMessages,
+ arguments: {'string': string, 'constant': _constant});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
String
name)> templateConstEvalInvalidStaticInvocation = const Template<
Message Function(String name)>(
@@ -1339,6 +1486,65 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalIterationInConstList =
+ messageConstEvalIterationInConstList;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalIterationInConstList = const MessageCode(
+ "ConstEvalIterationInConstList",
+ analyzerCodes: <String>["NON_CONSTANT_LIST_ELEMENT"],
+ message: r"""Iteration can't be used in a constant list.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalIterationInConstMap =
+ messageConstEvalIterationInConstMap;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalIterationInConstMap = const MessageCode(
+ "ConstEvalIterationInConstMap",
+ analyzerCodes: <String>["NON_CONSTANT_MAP_ELEMENT"],
+ message: r"""Iteration can't be used in a constant map.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalIterationInConstSet =
+ messageConstEvalIterationInConstSet;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalIterationInConstSet = const MessageCode(
+ "ConstEvalIterationInConstSet",
+ analyzerCodes: <String>["NON_CONSTANT_SET_ELEMENT"],
+ message: r"""Iteration can't be used in a constant set.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(Constant _constant)>
+ templateConstEvalKeyImplementsEqual =
+ const Template<Message Function(Constant _constant)>(
+ messageTemplate:
+ r"""The key '#constant' does not have a primitive operator '=='.""",
+ withArguments: _withArgumentsConstEvalKeyImplementsEqual);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Constant _constant)>
+ codeConstEvalKeyImplementsEqual =
+ const Code<Message Function(Constant _constant)>(
+ "ConstEvalKeyImplementsEqual", templateConstEvalKeyImplementsEqual,
+ analyzerCodes: <String>[
+ "CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS"
+ ]);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalKeyImplementsEqual(Constant _constant) {
+ TypeLabeler labeler = new TypeLabeler();
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ String constant = constantParts.join();
+ return new Message(codeConstEvalKeyImplementsEqual,
+ message:
+ """The key '${constant}' does not have a primitive operator '=='.""" +
+ labeler.originMessages,
+ arguments: {'constant': _constant});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String string,
@@ -1423,6 +1629,43 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalNotListOrSetInSpread =
+ messageConstEvalNotListOrSetInSpread;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalNotListOrSetInSpread = const MessageCode(
+ "ConstEvalNotListOrSetInSpread",
+ analyzerCodes: <String>["CONST_SPREAD_EXPECTED_LIST_OR_SET"],
+ message:
+ r"""Only lists and sets can be used in spreads in constant lists and sets.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalNotMapInSpread = messageConstEvalNotMapInSpread;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalNotMapInSpread = const MessageCode(
+ "ConstEvalNotMapInSpread",
+ analyzerCodes: <String>["CONST_SPREAD_EXPECTED_MAP"],
+ message: r"""Only maps can be used in spreads in constant maps.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalNullValue = messageConstEvalNullValue;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalNullValue = const MessageCode(
+ "ConstEvalNullValue",
+ analyzerCodes: <String>["CONST_EVAL_THROWS_EXCEPTION"],
+ message: r"""Null value during constant evaluation.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstEvalUnevaluated = messageConstEvalUnevaluated;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstEvalUnevaluated = const MessageCode(
+ "ConstEvalUnevaluated",
+ message: r"""Could not evaluate constant expression.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String string,
@@ -1712,17 +1955,6 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeCovariantAfterFinal = messageCovariantAfterFinal;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageCovariantAfterFinal = const MessageCode(
- "CovariantAfterFinal",
- index: 65,
- message:
- r"""The modifier 'covariant' should be before the modifier 'final'.""",
- tip: r"""Try re-ordering the modifiers.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeCovariantAfterVar = messageCovariantAfterVar;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2420,7 +2652,7 @@
const Template<Message Function(Token token)> templateDuplicatedModifier =
const Template<Message Function(Token token)>(
messageTemplate: r"""The modifier '#lexeme' was already specified.""",
- tipTemplate: r"""Try removing all but one occurance of the modifier.""",
+ tipTemplate: r"""Try removing all but one occurence of the modifier.""",
withArguments: _withArgumentsDuplicatedModifier);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2434,7 +2666,7 @@
String lexeme = token.lexeme;
return new Message(codeDuplicatedModifier,
message: """The modifier '${lexeme}' was already specified.""",
- tip: """Try removing all but one occurance of the modifier.""",
+ tip: """Try removing all but one occurence of the modifier.""",
arguments: {'token': token});
}
@@ -3013,7 +3245,7 @@
string)> templateExperimentNotEnabled = const Template<
Message Function(String string)>(
messageTemplate:
- r"""This requires the --#string experiment to be enabled.""",
+ r"""This requires the '#string' experiment to be enabled.""",
tipTemplate:
r"""Try enabling this experiment by adding it to the command line when compiling and running.""",
withArguments: _withArgumentsExperimentNotEnabled);
@@ -3028,7 +3260,7 @@
Message _withArgumentsExperimentNotEnabled(String string) {
if (string.isEmpty) throw 'No string provided';
return new Message(codeExperimentNotEnabled,
- message: """This requires the --${string} experiment to be enabled.""",
+ message: """This requires the '${string}' experiment to be enabled.""",
tip:
"""Try enabling this experiment by adding it to the command line when compiling and running.""",
arguments: {'string': string});
@@ -3040,7 +3272,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageExportAfterPart = const MessageCode("ExportAfterPart",
index: 75,
- message: r"""Export directives must preceed part directives.""",
+ message: r"""Export directives must precede part directives.""",
tip: r"""Try moving the export directives before the part directives.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -4296,7 +4528,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageImportAfterPart = const MessageCode("ImportAfterPart",
index: 10,
- message: r"""Import directives must preceed part directives.""",
+ message: r"""Import directives must precede part directives.""",
tip: r"""Try moving the import directives before the part directives.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6107,6 +6339,17 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeInvalidSuperInInitializer =
+ messageInvalidSuperInInitializer;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageInvalidSuperInInitializer = const MessageCode(
+ "InvalidSuperInInitializer",
+ index: 95,
+ message:
+ r"""Can only use 'super' in an initializer for calling the superclass constructor (e.g. 'super()' or 'super.namedConstructor()')""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeInvalidSyncModifier = messageInvalidSyncModifier;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6117,6 +6360,16 @@
tip: r"""Try replacing 'sync' with 'sync*'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeInvalidThisInInitializer = messageInvalidThisInInitializer;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageInvalidThisInInitializer = const MessageCode(
+ "InvalidThisInInitializer",
+ index: 65,
+ message:
+ r"""Can only use 'this' in an initializer for field initialization (e.g. 'this.x = something') and constructor redirection (e.g. 'this()' or 'this.namedConstructor())""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeInvalidUnicodeEscape = messageInvalidUnicodeEscape;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6553,7 +6806,7 @@
"MissingOperatorKeyword",
index: 31,
message:
- r"""Operator declarations must be preceeded by the keyword 'operator'.""",
+ r"""Operator declarations must be preceded by the keyword 'operator'.""",
tip: r"""Try adding the keyword 'operator'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6671,6 +6924,36 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String string,
+ String
+ string2)> templateModifierOutOfOrder = const Template<
+ Message Function(String string, String string2)>(
+ messageTemplate:
+ r"""The modifier '#string' should be before the modifier '#string2'.""",
+ tipTemplate: r"""Try re-ordering the modifiers.""",
+ withArguments: _withArgumentsModifierOutOfOrder);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, String string2)>
+ codeModifierOutOfOrder =
+ const Code<Message Function(String string, String string2)>(
+ "ModifierOutOfOrder", templateModifierOutOfOrder,
+ index: 56);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsModifierOutOfOrder(String string, String string2) {
+ if (string.isEmpty) throw 'No string provided';
+ if (string2.isEmpty) throw 'No string provided';
+ return new Message(codeModifierOutOfOrder,
+ message:
+ """The modifier '${string}' should be before the modifier '${string2}'.""",
+ tip: """Try re-ordering the modifiers.""",
+ arguments: {'string': string, 'string2': string2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeMoreThanOneSuperOrThisInitializer =
messageMoreThanOneSuperOrThisInitializer;
@@ -7068,6 +7351,27 @@
message: r"""Can't assign to this.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(Token token)> templateNotBinaryOperator =
+ const Template<Message Function(Token token)>(
+ messageTemplate: r"""'#lexeme' isn't a binary operator.""",
+ withArguments: _withArgumentsNotBinaryOperator);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Token token)> codeNotBinaryOperator =
+ const Code<Message Function(Token token)>(
+ "NotBinaryOperator",
+ templateNotBinaryOperator,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsNotBinaryOperator(Token token) {
+ String lexeme = token.lexeme;
+ return new Message(codeNotBinaryOperator,
+ message: """'${lexeme}' isn't a binary operator.""",
+ arguments: {'token': token});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String string)> templateNotConstantExpression =
const Template<Message Function(String string)>(
messageTemplate: r"""#string is not a constant expression.""",
@@ -8871,7 +9175,7 @@
const Code<Message Function(String name)> codeThisAccessInFieldInitializer =
const Code<Message Function(String name)>(
"ThisAccessInFieldInitializer", templateThisAccessInFieldInitializer,
- analyzerCodes: <String>["THIS_ACCESS_FROM_INITIALIZER"]);
+ analyzerCodes: <String>["THIS_ACCESS_FROM_FIELD_INITIALIZER"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsThisAccessInFieldInitializer(String name) {
@@ -9050,6 +9354,16 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeTypeBeforeFactory = messageTypeBeforeFactory;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageTypeBeforeFactory = const MessageCode(
+ "TypeBeforeFactory",
+ index: 57,
+ message: r"""Factory constructors cannot have a return type.""",
+ tip: r"""Try removing the type appearing before 'factory'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateTypeNotFound =
const Template<Message Function(String name)>(
messageTemplate: r"""Type '#name' not found.""",
diff --git a/front_end/lib/src/fasta/incremental_compiler.dart b/front_end/lib/src/fasta/incremental_compiler.dart
index e938d69..52264f2 100644
--- a/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/front_end/lib/src/fasta/incremental_compiler.dart
@@ -27,6 +27,7 @@
Procedure,
ProcedureKind,
ReturnStatement,
+ Source,
TreeNode,
TypeParameter;
@@ -210,6 +211,8 @@
Set<Uri> invalidatedUris = this.invalidatedUris.toSet();
+ invalidateNotKeptUserBuilders(invalidatedUris);
+
ClassHierarchy hierarchy = userCode?.loader?.hierarchy;
Set<LibraryBuilder> notReusedLibraries = new Set<LibraryBuilder>();
List<LibraryBuilder> reusedLibraries = computeReusedLibraries(
@@ -219,14 +222,36 @@
new Set<Uri>.from(reusedLibraries.map((b) => b.uri));
for (Uri uri in new Set<Uri>.from(dillLoadedData.loader.builders.keys)
..removeAll(reusedLibraryUris)) {
- dillLoadedData.loader.builders.remove(uri);
+ LibraryBuilder builder = dillLoadedData.loader.builders.remove(uri);
userBuilders?.remove(uri);
+ CompilerContext.current.uriToSource.remove(builder.fileUri);
}
- // Remove component problems for libraries we don't reuse.
- if (remainingComponentProblems.isNotEmpty) {
- for (LibraryBuilder builder in notReusedLibraries) {
- Library lib = builder.target;
+ if (hasToCheckPackageUris) {
+ // The package file was changed.
+ // Make sure the dill loader is on the same page.
+ DillTarget oldDillLoadedData = dillLoadedData;
+ dillLoadedData =
+ new DillTarget(ticker, uriTranslator, c.options.target);
+ for (DillLibraryBuilder library
+ in oldDillLoadedData.loader.builders.values) {
+ library.loader = dillLoadedData.loader;
+ dillLoadedData.loader.builders[library.uri] = library;
+ if (library.uri.scheme == "dart" && library.uri.path == "core") {
+ dillLoadedData.loader.coreLibrary = library;
+ }
+ }
+ dillLoadedData.loader.first = oldDillLoadedData.loader.first;
+ dillLoadedData.loader.libraries
+ .addAll(oldDillLoadedData.loader.libraries);
+ }
+
+ for (LibraryBuilder builder in notReusedLibraries) {
+ Library lib = builder.target;
+ CompilerContext.current.uriToSource.remove(builder.fileUri);
+
+ // Remove component problems for libraries we don't reuse.
+ if (remainingComponentProblems.isNotEmpty) {
removeLibraryFromRemainingComponentProblems(lib, uriTranslator);
}
}
@@ -246,6 +271,8 @@
" of ${userCode.loader.builders.length} libraries");
}
+ await loadEnsureLoadedComponents(reusedLibraryUris, reusedLibraries);
+
KernelTarget userCodeOld = userCode;
userCode = new KernelTarget(
new HybridFileSystem(
@@ -269,12 +296,20 @@
userCode.loader.builders[entryPoints.first] != null) {
userCode.loader.first = userCode.loader.builders[entryPoints.first];
}
- await userCode.buildOutlines();
+ Component componentWithDill = await userCode.buildOutlines();
- // This is not the full component. It is the component including all
- // libraries loaded from .dill files.
- Component componentWithDill =
- await userCode.buildComponent(verify: c.options.verify);
+ // This is not the full component. It is the component consisting of all
+ // newly compiled libraries and all libraries loaded from .dill files or
+ // directly from components.
+ // Technically, it's the combination of userCode.loader.libraries and
+ // dillLoadedData.loader.libraries.
+ if (!outlineOnly) {
+ componentWithDill =
+ await userCode.buildComponent(verify: c.options.verify);
+ }
+
+ recordNonFullComponentForTesting(componentWithDill);
+
if (componentWithDill != null) {
this.invalidatedUris.clear();
hasToCheckPackageUris = false;
@@ -291,9 +326,15 @@
List<Library> outputLibraries;
Set<Library> allLibraries;
+ Map<Uri, Source> uriToSource = componentWithDill?.uriToSource;
if (data.component != null || fullComponent) {
- outputLibraries = computeTransitiveClosure(compiledLibraries,
- entryPoints, reusedLibraries, hierarchy, uriTranslator);
+ outputLibraries = computeTransitiveClosure(
+ compiledLibraries,
+ entryPoints,
+ reusedLibraries,
+ hierarchy,
+ uriTranslator,
+ uriToSource);
allLibraries = outputLibraries.toSet();
if (!c.options.omitPlatform) {
for (int i = 0; i < platformBuilders.length; i++) {
@@ -303,8 +344,14 @@
}
} else {
outputLibraries = new List<Library>();
- allLibraries = computeTransitiveClosure(compiledLibraries, entryPoints,
- reusedLibraries, hierarchy, uriTranslator, outputLibraries)
+ allLibraries = computeTransitiveClosure(
+ compiledLibraries,
+ entryPoints,
+ reusedLibraries,
+ hierarchy,
+ uriTranslator,
+ uriToSource,
+ outputLibraries)
.toSet();
}
@@ -317,9 +364,8 @@
}
// This is the incremental component.
- return context.options.target.configureComponent(new Component(
- libraries: outputLibraries,
- uriToSource: componentWithDill?.uriToSource))
+ return context.options.target.configureComponent(
+ new Component(libraries: outputLibraries, uriToSource: uriToSource))
..mainMethod = mainMethod
..problemsAsJson = problemsAsJson;
});
@@ -327,13 +373,57 @@
/// Internal method.
void invalidateNotKeptUserBuilders(Set<Uri> invalidatedUris) {
- throw UnimplementedError("Not implemented yet.");
+ if (modulesToLoad != null && userBuilders != null) {
+ Set<Library> loadedNotKept = new Set<Library>();
+ for (LibraryBuilder builder in userBuilders.values) {
+ loadedNotKept.add(builder.target);
+ }
+ for (Component module in modulesToLoad) {
+ loadedNotKept.removeAll(module.libraries);
+ }
+ for (Library lib in loadedNotKept) {
+ invalidatedUris.add(lib.importUri);
+ }
+ }
}
/// Internal method.
Future loadEnsureLoadedComponents(
Set<Uri> reusedLibraryUris, List<LibraryBuilder> reusedLibraries) async {
- throw UnimplementedError("Not implemented yet.");
+ if (modulesToLoad != null) {
+ bool loadedAnything = false;
+ for (Component module in modulesToLoad) {
+ bool usedComponent = false;
+ for (Library lib in module.libraries) {
+ if (!reusedLibraryUris.contains(lib.importUri)) {
+ dillLoadedData.loader.libraries.add(lib);
+ dillLoadedData.addLibrary(lib);
+ reusedLibraries.add(dillLoadedData.loader.read(lib.importUri, -1));
+ usedComponent = true;
+ }
+ }
+ if (usedComponent) {
+ dillLoadedData.uriToSource.addAll(module.uriToSource);
+ loadedAnything = true;
+ }
+ }
+ if (loadedAnything) {
+ await dillLoadedData.buildOutlines();
+ userBuilders = <Uri, LibraryBuilder>{};
+ platformBuilders = <LibraryBuilder>[];
+ dillLoadedData.loader.builders.forEach((uri, builder) {
+ if (builder.uri.scheme == "dart") {
+ platformBuilders.add(builder);
+ } else {
+ userBuilders[uri] = builder;
+ }
+ });
+ if (userBuilders.isEmpty) {
+ userBuilders = null;
+ }
+ }
+ modulesToLoad = null;
+ }
}
/// Internal method.
@@ -415,6 +505,7 @@
List<LibraryBuilder> reusedLibraries,
ClassHierarchy hierarchy,
UriTranslator uriTranslator,
+ Map<Uri, Source> uriToSource,
[List<Library> inputLibrariesFiltered]) {
List<Library> result = new List<Library>();
Map<Uri, Library> libraryMap = <Uri, Library>{};
@@ -468,6 +559,8 @@
Library lib = builder.target;
removedLibraries.add(lib);
dillLoadedData.loader.builders.remove(uri);
+ CompilerContext.current.uriToSource.remove(uri);
+ uriToSource.remove(uri);
userBuilders?.remove(uri);
removeLibraryFromRemainingComponentProblems(lib, uriTranslator);
}
@@ -515,7 +608,7 @@
c.options.fileSystem.entityForUri(initializeFromDillUri);
if (await entity.exists()) {
List<int> initializationBytes = await entity.readAsBytes();
- if (initializationBytes != null) {
+ if (initializationBytes != null && initializationBytes.isNotEmpty) {
ticker.logMs("Read $initializeFromDillUri");
data.initializationBytes = initializationBytes;
@@ -637,8 +730,7 @@
debugExprUri,
userCode.loader,
null,
- library.scope.createNestedScope("expression"),
- library.target);
+ library.scope.createNestedScope("expression"));
if (library is DillLibraryBuilder) {
for (LibraryDependency dependency in library.target.dependencies) {
@@ -699,6 +791,10 @@
userCode.uriToSource.remove(debugExprUri);
userCode.loader.sourceBytes.remove(debugExprUri);
+ // Make sure the library has a canonical name.
+ Component c = new Component(libraries: [debugLibrary.target]);
+ c.computeCanonicalNames();
+
userCode.runProcedureTransformations(procedure);
return procedure;
@@ -831,15 +927,22 @@
@override
void invalidateAllSources() {
- throw UnimplementedError("Not implemented yet.");
+ if (userCode != null) {
+ Set<Uri> uris = new Set<Uri>.from(userCode.loader.builders.keys);
+ uris.removeAll(dillLoadedData.loader.builders.keys);
+ invalidatedUris.addAll(uris);
+ }
}
@override
void setModulesToLoadOnNextComputeDelta(List<Component> components) {
- throw UnimplementedError("Not implemented yet.");
+ modulesToLoad = components.toList();
}
/// Internal method.
+ void recordNonFullComponentForTesting(Component component) {}
+
+ /// Internal method.
void recordInvalidatedImportUrisForTesting(List<Uri> uris) {}
/// Internal method.
diff --git a/front_end/lib/src/fasta/kernel/body_builder.dart b/front_end/lib/src/fasta/kernel/body_builder.dart
index 7655108..cbd139f 100644
--- a/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -45,7 +45,8 @@
import '../scanner.dart' show Token;
-import '../scanner/token.dart' show isBinaryOperator, isMinusOperator;
+import '../scanner/token.dart'
+ show isBinaryOperator, isMinusOperator, isUserDefinableOperator;
import '../scope.dart' show ProblemBuilder;
@@ -65,7 +66,12 @@
import '../type_inference/type_promotion.dart'
show TypePromoter, TypePromotionFact, TypePromotionScope;
-import 'collections.dart' show SpreadElement, SpreadMapEntry;
+import 'collections.dart'
+ show
+ SpreadElement,
+ SpreadMapEntry,
+ convertToMapEntry,
+ isConvertibleToMapEntry;
import 'constness.dart' show Constness;
@@ -525,16 +531,26 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
debugEvent("TopLevelFields");
+ // TODO(danrubel): handle NNBD 'late' modifier
+ reportNonNullableModifierError(lateToken);
push(count);
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
debugEvent("Fields");
+ // TODO(danrubel): handle NNBD 'late' modifier
+ reportNonNullableModifierError(lateToken);
push(count);
}
@@ -585,7 +601,9 @@
buildDartType(pop()); // Type.
}
List<Expression> annotations = pop();
- if (annotations != null) {
+ // Fields with duplicate names are sorted out in the else branch of the
+ // `declaration.next == null` above.
+ if (annotations != null && fields.isNotEmpty) {
inferAnnotations(annotations);
Field field = fields.first.target;
// The first (and often only field) will not get a clone.
@@ -904,10 +922,22 @@
void resolveRedirectingFactoryTargets() {
for (StaticInvocation invocation in redirectingFactoryInvocations) {
- // If the invocation was invalid, it has already been desugared into
- // an exception throwing expression. There is nothing to resolve anymore.
- if (invocation.parent == null) {
- continue;
+ // If the invocation was invalid, it or its parent has already been
+ // desugared into an exception throwing expression. There is nothing to
+ // resolve anymore. Note that in the case where the invocation's parent
+ // was invalid, type inference won't reach the invocation node and won't
+ // set its inferredType field. If type inference is disabled, reach to
+ // the outtermost parent to check if the node is a dead code.
+ if (invocation.parent == null) continue;
+ if (_typeInferrer != null) {
+ if (invocation is FactoryConstructorInvocationJudgment &&
+ invocation.inferredType == null) {
+ continue;
+ }
+ } else {
+ TreeNode parent = invocation.parent;
+ while (parent is! Component && parent != null) parent = parent.parent;
+ if (parent == null) continue;
}
Procedure initialTarget = invocation.target;
@@ -1374,8 +1404,15 @@
negate = true;
}
if (!isBinaryOperator(operator) && !isMinusOperator(operator)) {
- return buildProblem(fasta.templateInvalidOperator.withArguments(token),
- token.charOffset, token.length);
+ if (isUserDefinableOperator(operator)) {
+ return buildProblem(
+ fasta.templateNotBinaryOperator.withArguments(token),
+ token.charOffset,
+ token.length);
+ } else {
+ return buildProblem(fasta.templateInvalidOperator.withArguments(token),
+ token.charOffset, token.length);
+ }
} else {
Expression result = buildMethodInvocation(a, new Name(operator),
forest.arguments(<Expression>[b], noLocation), token.charOffset,
@@ -1464,7 +1501,7 @@
int offset = candidate.fileOffset;
Message contextMessage;
int length = noLength;
- if (offset == -1 && candidate is Constructor) {
+ if (candidate is Constructor && candidate.isSynthetic) {
offset = candidate.enclosingClass.fileOffset;
contextMessage = fasta.templateCandidateFoundIsDefaultConstructor
.withArguments(candidate.enclosingClass.name);
@@ -2105,8 +2142,11 @@
}
@override
- void beginVariablesDeclaration(Token token, Token varFinalOrConst) {
+ void beginVariablesDeclaration(
+ Token token, Token lateToken, Token varFinalOrConst) {
debugEvent("beginVariablesDeclaration");
+ // TODO(danrubel): handle NNBD 'late' modifier
+ reportNonNullableModifierError(lateToken);
UnresolvedType<KernelTypeBuilder> type = pop();
int modifiers = Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme);
super.push(currentLocalVariableModifiers);
@@ -2270,22 +2310,18 @@
@override
void endForControlFlow(Token token) {
- debugEvent("endForControlFlow");
- // TODO(danrubel) implement control flow support
-
+ debugEvent("ForControlFlow");
var entry = pop();
int updateExpressionCount = pop();
pop(); // left separator
pop(); // left parenthesis
Token forToken = pop();
-
- popListForEffect(updateExpressionCount); // updates
- popStatement(); // condition
+ List<Expression> updates = popListForEffect(updateExpressionCount);
+ Statement conditionStatement = popStatement(); // condition
Object variableOrExpression = pop();
+ exitLocalScope();
- if (entry != invalidCollectionElement) {
- // TODO(danrubel): Replace with control flow structures
- buildVariableDeclarations(variableOrExpression); // variables
+ if (!library.loader.target.enableControlFlowCollections) {
// TODO(danrubel): Report a more user friendly error message
// when an experiment is not enabled
handleRecoverableError(
@@ -2293,9 +2329,35 @@
forToken,
forToken);
push(invalidCollectionElement);
- } else {
- // TODO(danrubel): Remove once unified collections enabled by default
+ return;
+ }
+
+ if (constantContext != ConstantContext.none &&
+ !library.loader.target.enableConstantUpdate2018) {
+ handleRecoverableError(
+ fasta.templateCantUseControlFlowOrSpreadAsConstant
+ .withArguments(forToken),
+ forToken,
+ forToken);
push(invalidCollectionElement);
+ return;
+ }
+
+ transformCollections = true;
+ List<VariableDeclaration> variables =
+ buildVariableDeclarations(variableOrExpression);
+ Expression condition;
+ if (forest.isExpressionStatement(conditionStatement)) {
+ condition =
+ forest.getExpressionFromExpressionStatement(conditionStatement);
+ } else {
+ assert(forest.isEmptyStatement(conditionStatement));
+ }
+ if (entry is MapEntry) {
+ push(forest.forMapEntry(variables, condition, updates, entry, forToken));
+ } else {
+ push(forest.forElement(
+ variables, condition, updates, toValue(entry), forToken));
}
}
@@ -2431,7 +2493,7 @@
if (entry is MapEntry) {
// TODO(danrubel): report the error on the colon
addProblem(fasta.templateExpectedButGot.withArguments(','),
- entry.value.fileOffset - 1, 1);
+ entry.fileOffset, 1);
} else {
// TODO(danrubel): Revise once control flow and spread
// collection entries are supported.
@@ -2493,6 +2555,13 @@
final typeArgCount = typeArguments?.length;
bool isSet = typeArgCount == 1 ? true : typeArgCount != null ? false : null;
+ for (int i = 0; i < setOrMapEntries.length; ++i) {
+ if (setOrMapEntries[i] is! MapEntry &&
+ !isConvertibleToMapEntry(setOrMapEntries[i])) {
+ hasSetEntry = true;
+ }
+ }
+
// TODO(danrubel): If the type arguments are not known (null) then
// defer set/map determination until after type resolution as per the
// unified collection spec: https://github.com/dart-lang/language/pull/200
@@ -2502,7 +2571,15 @@
if (isSet) {
buildLiteralSet(typeArguments, constKeyword, leftBrace, setOrMapEntries);
} else {
- buildLiteralMap(typeArguments, constKeyword, leftBrace, setOrMapEntries);
+ List<MapEntry> mapEntries = new List<MapEntry>(setOrMapEntries.length);
+ for (int i = 0; i < setOrMapEntries.length; ++i) {
+ if (setOrMapEntries[i] is MapEntry) {
+ mapEntries[i] = setOrMapEntries[i];
+ } else {
+ mapEntries[i] = convertToMapEntry(setOrMapEntries[i], this);
+ }
+ }
+ buildLiteralMap(typeArguments, constKeyword, leftBrace, mapEntries);
}
}
@@ -2527,7 +2604,7 @@
}
void buildLiteralMap(List<UnresolvedType<KernelTypeBuilder>> typeArguments,
- Token constKeyword, Token leftBrace, List<dynamic> setOrMapEntries) {
+ Token constKeyword, Token leftBrace, List<MapEntry> entries) {
DartType keyType;
DartType valueType;
if (typeArguments != null) {
@@ -2548,24 +2625,6 @@
valueType = implicitTypeArgument;
}
- List<MapEntry> entries = <MapEntry>[];
- if (setOrMapEntries != null) {
- for (var entry in setOrMapEntries) {
- if (entry is MapEntry) {
- entries.add(entry);
- } else if (entry is SpreadElement) {
- entries.add(new SpreadMapEntry(entry.expression, entry.isNullAware));
- } else {
- addProblem(
- fasta.templateExpectedAfterButGot.withArguments(':'),
- (entry as Expression).fileOffset,
- // TODO(danrubel): what is the length of the expression?
- 1,
- );
- }
- }
- }
-
Expression node = forest.literalMap(
constKeyword,
constKeyword != null || constantContext == ConstantContext.inferred,
@@ -2740,7 +2799,8 @@
DartType type = buildDartType(pop());
library.checkBoundsInType(type, typeEnvironment, operator.charOffset);
Expression expression = popForValue();
- if (constantContext != ConstantContext.none) {
+ if (!library.loader.target.enableConstantUpdate2018 &&
+ constantContext != ConstantContext.none) {
push(desugarSyntheticExpression(buildProblem(
fasta.templateNotConstantExpression.withArguments('As expression'),
operator.charOffset,
@@ -2764,7 +2824,8 @@
typePromoter?.handleIsCheck(isExpression, isInverted, operand.variable,
type, functionNestingLevel);
}
- if (constantContext != ConstantContext.none) {
+ if (!library.loader.target.enableConstantUpdate2018 &&
+ constantContext != ConstantContext.none) {
push(desugarSyntheticExpression(buildProblem(
fasta.templateNotConstantExpression.withArguments('Is expression'),
isOperator.charOffset,
@@ -2816,8 +2877,10 @@
}
@override
- void beginFormalParameter(Token token, MemberKind kind, Token covariantToken,
- Token varFinalOrConst) {
+ void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
+ Token covariantToken, Token varFinalOrConst) {
+ // TODO(danrubel): handle required token
+ reportNonNullableModifierError(requiredToken);
push((covariantToken != null ? covariantMask : 0) |
Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme));
}
@@ -3646,6 +3709,7 @@
token.next, token.offset, Constness.explicitConst);
}
+ @override
void beginIfControlFlow(Token ifToken) {
// TODO(danrubel): consider removing this when control flow support is added
// if the ifToken is not needed for error reporting
@@ -3653,11 +3717,26 @@
}
@override
+ void beginThenControlFlow(Token token) {
+ Expression condition = popForValue();
+ enterThenForTypePromotion(condition);
+ push(condition);
+ super.beginThenControlFlow(token);
+ }
+
+ @override
+ void handleElseControlFlow(Token elseToken) {
+ typePromoter?.enterElse();
+ }
+
+ @override
void endIfControlFlow(Token token) {
debugEvent("endIfControlFlow");
var entry = pop();
var condition = pop(); // parenthesized expression
Token ifToken = pop();
+ typePromoter?.enterElse();
+ typePromoter?.exitConditional();
if (!library.loader.target.enableControlFlowCollections) {
// TODO(danrubel): Report a more user friendly error message
// when an experiment is not enabled
@@ -3668,10 +3747,18 @@
push(invalidCollectionElement);
return;
}
- if (entry == invalidCollectionElement) {
+
+ if (constantContext != ConstantContext.none &&
+ !library.loader.target.enableConstantUpdate2018) {
+ handleRecoverableError(
+ fasta.templateCantUseControlFlowOrSpreadAsConstant
+ .withArguments(ifToken),
+ ifToken,
+ ifToken);
push(invalidCollectionElement);
return;
}
+
transformCollections = true;
if (entry is MapEntry) {
push(forest.ifMapEntry(toValue(condition), entry, null, ifToken));
@@ -3687,6 +3774,7 @@
var thenEntry = pop(); // then entry
var condition = pop(); // parenthesized expression
Token ifToken = pop();
+ typePromoter?.exitConditional();
if (!library.loader.target.enableControlFlowCollections) {
// TODO(danrubel): Report a more user friendly error message
// when an experiment is not enabled
@@ -3697,11 +3785,18 @@
push(invalidCollectionElement);
return;
}
- if (thenEntry == invalidCollectionElement ||
- elseEntry == invalidCollectionElement) {
+
+ if (constantContext != ConstantContext.none &&
+ !library.loader.target.enableConstantUpdate2018) {
+ handleRecoverableError(
+ fasta.templateCantUseControlFlowOrSpreadAsConstant
+ .withArguments(ifToken),
+ ifToken,
+ ifToken);
push(invalidCollectionElement);
return;
}
+
transformCollections = true;
if (thenEntry is MapEntry) {
if (elseEntry is MapEntry) {
@@ -3714,7 +3809,16 @@
new SpreadMapEntry(elseEntry.expression, elseEntry.isNullAware),
ifToken));
} else {
- push(invalidCollectionElement);
+ int offset = elseEntry is Expression
+ ? elseEntry.fileOffset
+ : offsetForToken(ifToken);
+ push(new MapEntry(
+ desugarSyntheticExpression(buildProblem(
+ fasta.templateExpectedAfterButGot.withArguments(':'),
+ offset,
+ 1)),
+ new NullLiteral())
+ ..fileOffset = offsetForToken(ifToken));
}
} else if (elseEntry is MapEntry) {
if (thenEntry is SpreadElement) {
@@ -3724,7 +3828,16 @@
elseEntry,
ifToken));
} else {
- push(invalidCollectionElement);
+ int offset = thenEntry is Expression
+ ? thenEntry.fileOffset
+ : offsetForToken(ifToken);
+ push(new MapEntry(
+ desugarSyntheticExpression(buildProblem(
+ fasta.templateExpectedAfterButGot.withArguments(':'),
+ offset,
+ 1)),
+ new NullLiteral())
+ ..fileOffset = offsetForToken(ifToken));
}
} else {
push(forest.ifElement(
@@ -3744,6 +3857,18 @@
push(invalidCollectionElement);
return;
}
+
+ if (constantContext != ConstantContext.none &&
+ !library.loader.target.enableConstantUpdate2018) {
+ handleRecoverableError(
+ fasta.templateCantUseControlFlowOrSpreadAsConstant
+ .withArguments(spreadToken),
+ spreadToken,
+ spreadToken);
+ push(invalidCollectionElement);
+ return;
+ }
+
transformCollections = true;
push(forest.spreadElement(toValue(expression), spreadToken));
}
@@ -4036,18 +4161,16 @@
@override
void endForInControlFlow(Token token) {
- debugEvent("endForInControlFlow");
- // TODO(danrubel) implement control flow support
-
+ debugEvent("ForInControlFlow");
var entry = pop();
- pop(); // `in` keyword
+ Token inToken = pop();
Token forToken = pop();
- pop(NullValue.AwaitToken); // await token
- popForValue(); // expression
- pop(); // lvalue
+ Token awaitToken = pop(NullValue.AwaitToken);
+ Expression iterable = popForValue();
+ Object lvalue = pop(); // lvalue
+ exitLocalScope();
- if (entry != invalidCollectionElement) {
- // TODO(danrubel): Replace this with control flow element
+ if (!library.loader.target.enableControlFlowCollections) {
// TODO(danrubel): Report a more user friendly error message
// when an experiment is not enabled
handleRecoverableError(
@@ -4055,10 +4178,106 @@
forToken,
forToken);
push(invalidCollectionElement);
- } else {
- // TODO(danrubel): Remove once unified collections enabled by default
- push(invalidCollectionElement);
+ return;
}
+
+ if (constantContext != ConstantContext.none &&
+ !library.loader.target.enableConstantUpdate2018) {
+ handleRecoverableError(
+ fasta.templateCantUseControlFlowOrSpreadAsConstant
+ .withArguments(forToken),
+ forToken,
+ forToken);
+ push(invalidCollectionElement);
+ return;
+ }
+
+ transformCollections = true;
+ VariableDeclaration variable = buildForInVariable(lvalue);
+ Expression problem = checkForInVariable(lvalue, variable, forToken);
+ Statement prologue = buildForInBody(lvalue, variable, forToken, inToken);
+ if (entry is MapEntry) {
+ push(forest.forInMapEntry(
+ variable, iterable, prologue, entry, problem, forToken,
+ isAsync: awaitToken != null));
+ } else {
+ push(forest.forInElement(
+ variable, iterable, prologue, toValue(entry), problem, forToken,
+ isAsync: awaitToken != null));
+ }
+ }
+
+ VariableDeclaration buildForInVariable(Object lvalue) {
+ if (lvalue is VariableDeclaration) return lvalue;
+ return new VariableDeclarationJudgment.forValue(null, functionNestingLevel);
+ }
+
+ Expression checkForInVariable(
+ Object lvalue, VariableDeclaration variable, Token forToken) {
+ if (lvalue is VariableDeclaration) {
+ if (variable.isConst) {
+ return buildProblem(fasta.messageForInLoopWithConstVariable,
+ variable.fileOffset, variable.name.length);
+ }
+ } else if (lvalue is! Generator) {
+ Message message = forest.isVariablesDeclaration(lvalue)
+ ? fasta.messageForInLoopExactlyOneVariable
+ : fasta.messageForInLoopNotAssignable;
+ Token token = forToken.next.next;
+ return buildProblem(
+ message, offsetForToken(token), lengthForToken(token));
+ }
+ return null;
+ }
+
+ Statement buildForInBody(Object lvalue, VariableDeclaration variable,
+ Token forToken, Token inKeyword) {
+ if (lvalue is VariableDeclaration) return null;
+ if (lvalue is Generator) {
+ /// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
+ ///
+ /// for (lvalue in expression) body
+ ///
+ /// This is normalized to:
+ ///
+ /// for (final #t in expression) {
+ /// lvalue = #t;
+ /// body;
+ /// }
+ TypePromotionFact fact =
+ typePromoter?.getFactForAccess(variable, functionNestingLevel);
+ TypePromotionScope scope = typePromoter?.currentScope;
+ Expression syntheticAssignment = lvalue.buildAssignment(
+ new VariableGetJudgment(variable, fact, scope)
+ ..fileOffset = inKeyword.offset,
+ voidContext: true);
+ if (syntheticAssignment is shadow.SyntheticExpressionJudgment) {
+ syntheticAssignment = wrapSyntheticExpression(
+ desugarSyntheticExpression(syntheticAssignment),
+ offsetForToken(lvalue.token));
+ }
+ return forest.expressionStatement(syntheticAssignment, null);
+ }
+ Message message = forest.isVariablesDeclaration(lvalue)
+ ? fasta.messageForInLoopExactlyOneVariable
+ : fasta.messageForInLoopNotAssignable;
+ Token token = forToken.next.next;
+ Statement body;
+ if (forest.isVariablesDeclaration(lvalue)) {
+ body = forest.block(
+ null,
+ // New list because the declarations are not a growable list.
+ new List<Statement>.from(
+ forest.variablesDeclarationExtractDeclarations(lvalue)),
+ null);
+ } else {
+ body = forest.expressionStatement(lvalue, null);
+ }
+ return combineStatements(
+ forest.expressionStatement(
+ buildProblem(message, offsetForToken(token), lengthForToken(token)),
+ null),
+ body);
}
@override
@@ -4079,67 +4298,22 @@
body = forest.syntheticLabeledStatement(body);
continueTarget.resolveContinues(forest, body);
}
- VariableDeclaration variable;
- Expression problem;
- if (lvalue is VariableDeclaration) {
- variable = lvalue;
- if (variable.isConst) {
- problem = buildProblem(fasta.messageForInLoopWithConstVariable,
- variable.fileOffset, variable.name.length);
- }
- } else if (lvalue is Generator) {
- /// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
- ///
- /// for (lvalue in expression) body
- ///
- /// This is normalized to:
- ///
- /// for (final #t in expression) {
- /// lvalue = #t;
- /// body;
- /// }
- variable =
- new VariableDeclarationJudgment.forValue(null, functionNestingLevel);
- TypePromotionFact fact =
- typePromoter?.getFactForAccess(variable, functionNestingLevel);
- TypePromotionScope scope = typePromoter?.currentScope;
- Expression syntheticAssignment = lvalue.buildAssignment(
- new VariableGetJudgment(variable, fact, scope)
- ..fileOffset = inKeyword.offset,
- voidContext: true);
- if (syntheticAssignment is shadow.SyntheticExpressionJudgment) {
- syntheticAssignment = wrapSyntheticExpression(
- desugarSyntheticExpression(syntheticAssignment),
- offsetForToken(lvalue.token));
- }
- body = combineStatements(
- forest.expressionStatement(syntheticAssignment, null), body);
- } else {
- Message message = forest.isVariablesDeclaration(lvalue)
- ? fasta.messageForInLoopExactlyOneVariable
- : fasta.messageForInLoopNotAssignable;
- Token token = forToken.next.next;
- variable =
- new VariableDeclarationJudgment.forValue(null, functionNestingLevel);
- problem =
- buildProblem(message, offsetForToken(token), lengthForToken(token));
- if (forest.isVariablesDeclaration(lvalue)) {
- body = forest.block(
- null,
- <Statement>[]
- ..addAll(forest.variablesDeclarationExtractDeclarations(lvalue))
- ..add(body),
- null);
+ VariableDeclaration variable = buildForInVariable(lvalue);
+ Expression problem = checkForInVariable(lvalue, variable, forToken);
+ Statement prologue = buildForInBody(lvalue, variable, forToken, inKeyword);
+ if (prologue != null) {
+ if (prologue is Block) {
+ if (body is Block) {
+ for (Statement statement in body.statements) {
+ prologue.addStatement(statement);
+ }
+ } else {
+ prologue.addStatement(body);
+ }
+ body = prologue;
} else {
- body =
- combineStatements(forest.expressionStatement(lvalue, null), body);
+ body = combineStatements(prologue, body);
}
- body = combineStatements(
- forest.expressionStatement(
- buildProblem(
- message, offsetForToken(token), lengthForToken(token)),
- null),
- body);
}
Statement result = new ForInStatement(variable, expression, body,
isAsync: awaitToken != null)
diff --git a/front_end/lib/src/fasta/kernel/collections.dart b/front_end/lib/src/fasta/kernel/collections.dart
index 74f6789..a943ece 100644
--- a/front_end/lib/src/fasta/kernel/collections.dart
+++ b/front_end/lib/src/fasta/kernel/collections.dart
@@ -10,10 +10,12 @@
DartType,
Expression,
MapEntry,
- setParents,
- transformList,
+ NullLiteral,
+ Statement,
TreeNode,
VariableDeclaration,
+ setParents,
+ transformList,
visitList;
import 'package:kernel/type_environment.dart' show TypeEnvironment;
@@ -26,12 +28,20 @@
TreeVisitor,
Visitor;
+import '../messages.dart'
+ show templateExpectedAfterButGot, templateExpectedButGot;
+
import '../problems.dart' show getFileUri, unsupported;
+import '../type_inference/inference_helper.dart' show InferenceHelper;
+
+/// Mixin for spread and control-flow elements.
+///
/// Spread and control-flow elements are not truly expressions and they cannot
/// appear in arbitrary expression contexts in the Kernel program. They can
-/// only appear as elements in list or set literals.
-mixin _FakeExpressionMixin on Expression {
+/// only appear as elements in list or set literals. They are translated into
+/// a lower-level representation and never serialized to .dill files.
+mixin ControlFlowElement on Expression {
/// Spread and contol-flow elements are not expressions and do not have a
/// static type.
@override
@@ -48,10 +58,16 @@
}
/// A spread element in a list or set literal.
-class SpreadElement extends Expression with _FakeExpressionMixin {
+class SpreadElement extends Expression with ControlFlowElement {
Expression expression;
bool isNullAware;
+ /// The type of the elements of the collection that [expression] evaluates to.
+ ///
+ /// It is set during type inference and is used to add appropriate type casts
+ /// during the desugaring.
+ DartType elementType;
+
SpreadElement(this.expression, this.isNullAware) {
expression?.parent = this;
}
@@ -71,7 +87,7 @@
}
/// An 'if' element in a list or set literal.
-class IfElement extends Expression with _FakeExpressionMixin {
+class IfElement extends Expression with ControlFlowElement {
Expression condition;
Expression then;
Expression otherwise;
@@ -107,7 +123,7 @@
}
/// A 'for' element in a list or set literal.
-class ForElement extends Expression with _FakeExpressionMixin {
+class ForElement extends Expression with ControlFlowElement {
final List<VariableDeclaration> variables; // May be empty, but not null.
Expression condition; // May be null.
final List<Expression> updates; // May be empty, but not null.
@@ -144,22 +160,30 @@
}
/// A 'for-in' element in a list or set literal.
-class ForInElement extends Expression with _FakeExpressionMixin {
+class ForInElement extends Expression with ControlFlowElement {
VariableDeclaration variable; // Has no initializer.
Expression iterable;
+ Statement prologue; // May be null.
Expression body;
+ Expression problem; // May be null.
bool isAsync; // True if this is an 'await for' loop.
- ForInElement(this.variable, this.iterable, this.body, {this.isAsync: false}) {
+ ForInElement(
+ this.variable, this.iterable, this.prologue, this.body, this.problem,
+ {this.isAsync: false}) {
variable?.parent = this;
iterable?.parent = this;
+ prologue?.parent = this;
body?.parent = this;
+ problem?.parent = this;
}
visitChildren(Visitor<Object> v) {
variable?.accept(v);
iterable?.accept(v);
+ prologue?.accept(v);
body?.accept(v);
+ problem?.accept(v);
}
transformChildren(Transformer v) {
@@ -171,47 +195,61 @@
iterable = iterable.accept(v);
iterable?.parent = this;
}
+ if (prologue != null) {
+ prologue = prologue.accept(v);
+ prologue?.parent = this;
+ }
if (body != null) {
body = body.accept(v);
body?.parent = this;
}
+ if (problem != null) {
+ problem = problem.accept(v);
+ problem?.parent = this;
+ }
}
}
-mixin _FakeMapEntryMixin implements MapEntry {
+mixin ControlFlowMapEntry implements MapEntry {
@override
- Expression get key => throw UnsupportedError('SpreadMapEntry.key getter');
+ Expression get key {
+ throw UnsupportedError('ControlFlowMapEntry.key getter');
+ }
@override
void set key(Expression expr) {
- throw UnsupportedError('SpreadMapEntry.key setter');
+ throw UnsupportedError('ControlFlowMapEntry.key setter');
}
@override
- Expression get value => throw UnsupportedError('SpreadMapEntry.value getter');
+ Expression get value {
+ throw UnsupportedError('ControlFlowMapEntry.value getter');
+ }
@override
void set value(Expression expr) {
- throw UnsupportedError('SpreadMapEntry.value setter');
+ throw UnsupportedError('ControlFlowMapEntry.value setter');
}
@override
- accept(TreeVisitor<Object> v) {
- throw UnsupportedError('SpreadMapEntry.accept');
- }
+ accept(TreeVisitor<Object> v) => v.defaultTreeNode(this);
}
/// A spread element in a map literal.
-class SpreadMapEntry extends TreeNode with _FakeMapEntryMixin {
+class SpreadMapEntry extends TreeNode with ControlFlowMapEntry {
Expression expression;
bool isNullAware;
+ /// The type of the map entries of the map that [expression] evaluates to.
+ ///
+ /// It is set during type inference and is used to add appropriate type casts
+ /// during the desugaring.
+ DartType entryType;
+
SpreadMapEntry(this.expression, this.isNullAware) {
expression?.parent = this;
}
- accept(TreeVisitor<Object> v) => v.defaultTreeNode(this);
-
@override
visitChildren(Visitor<Object> v) {
expression?.accept(v);
@@ -227,7 +265,7 @@
}
/// An 'if' element in a map literal.
-class IfMapEntry extends TreeNode with _FakeMapEntryMixin {
+class IfMapEntry extends TreeNode with ControlFlowMapEntry {
Expression condition;
MapEntry then;
MapEntry otherwise;
@@ -263,7 +301,7 @@
}
/// A 'for' element in a map literal.
-class ForMapEntry extends TreeNode with _FakeMapEntryMixin {
+class ForMapEntry extends TreeNode with ControlFlowMapEntry {
final List<VariableDeclaration> variables; // May be empty, but not null.
Expression condition; // May be null.
final List<Expression> updates; // May be empty, but not null.
@@ -300,23 +338,30 @@
}
/// A 'for-in' element in a map literal.
-class ForInMapEntry extends TreeNode with _FakeMapEntryMixin {
+class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
VariableDeclaration variable; // Has no initializer.
Expression iterable;
+ Statement prologue; // May be null.
MapEntry body;
+ Expression problem; // May be null.
bool isAsync; // True if this is an 'await for' loop.
- ForInMapEntry(this.variable, this.iterable, this.body,
+ ForInMapEntry(
+ this.variable, this.iterable, this.prologue, this.body, this.problem,
{this.isAsync: false}) {
variable?.parent = this;
iterable?.parent = this;
+ prologue?.parent = this;
body?.parent = this;
+ problem?.parent = this;
}
visitChildren(Visitor<Object> v) {
variable?.accept(v);
iterable?.accept(v);
+ prologue?.accept(v);
body?.accept(v);
+ problem?.accept(v);
}
transformChildren(Transformer v) {
@@ -328,9 +373,104 @@
iterable = iterable.accept(v);
iterable?.parent = this;
}
+ if (prologue != null) {
+ prologue = prologue.accept(v);
+ prologue?.parent = this;
+ }
if (body != null) {
body = body.accept(v);
body?.parent = this;
}
+ if (problem != null) {
+ problem = problem.accept(v);
+ problem?.parent = this;
+ }
}
}
+
+Expression convertToElement(MapEntry entry, InferenceHelper helper) {
+ if (entry is SpreadMapEntry) {
+ return new SpreadElement(entry.expression, entry.isNullAware)
+ ..fileOffset = entry.expression.fileOffset;
+ }
+ if (entry is IfMapEntry) {
+ return new IfElement(
+ entry.condition,
+ convertToElement(entry.then, helper),
+ entry.otherwise == null
+ ? null
+ : convertToElement(entry.otherwise, helper))
+ ..fileOffset = entry.fileOffset;
+ }
+ if (entry is ForMapEntry) {
+ return new ForElement(entry.variables, entry.condition, entry.updates,
+ convertToElement(entry.body, helper))
+ ..fileOffset = entry.fileOffset;
+ }
+ if (entry is ForInMapEntry) {
+ return new ForInElement(entry.variable, entry.iterable, entry.prologue,
+ convertToElement(entry.body, helper), entry.problem,
+ isAsync: entry.isAsync)
+ ..fileOffset = entry.fileOffset;
+ }
+ return helper.desugarSyntheticExpression(helper.buildProblem(
+ templateExpectedButGot.withArguments(','),
+ entry.fileOffset,
+ 1,
+ ));
+}
+
+bool isConvertibleToMapEntry(Expression element) {
+ if (element is SpreadElement) return true;
+ if (element is IfElement) {
+ return isConvertibleToMapEntry(element.then) &&
+ (element.otherwise == null ||
+ isConvertibleToMapEntry(element.otherwise));
+ }
+ if (element is ForElement) {
+ return isConvertibleToMapEntry(element.body);
+ }
+ if (element is ForInElement) {
+ return isConvertibleToMapEntry(element.body);
+ }
+ return false;
+}
+
+MapEntry convertToMapEntry(Expression element, InferenceHelper helper) {
+ if (element is SpreadElement) {
+ return new SpreadMapEntry(element.expression, element.isNullAware)
+ ..fileOffset = element.expression.fileOffset;
+ }
+ if (element is IfElement) {
+ return new IfMapEntry(
+ element.condition,
+ convertToMapEntry(element.then, helper),
+ element.otherwise == null
+ ? null
+ : convertToMapEntry(element.otherwise, helper))
+ ..fileOffset = element.fileOffset;
+ }
+ if (element is ForElement) {
+ return new ForMapEntry(element.variables, element.condition,
+ element.updates, convertToMapEntry(element.body, helper))
+ ..fileOffset = element.fileOffset;
+ }
+ if (element is ForInElement) {
+ return new ForInMapEntry(
+ element.variable,
+ element.iterable,
+ element.prologue,
+ convertToMapEntry(element.body, helper),
+ element.problem,
+ isAsync: element.isAsync)
+ ..fileOffset = element.fileOffset;
+ }
+ return new MapEntry(
+ helper.desugarSyntheticExpression(helper.buildProblem(
+ templateExpectedAfterButGot.withArguments(':'),
+ element.fileOffset,
+ // TODO(danrubel): what is the length of the expression?
+ 1,
+ )),
+ new NullLiteral());
+}
diff --git a/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/front_end/lib/src/fasta/kernel/constant_evaluator.dart
new file mode 100644
index 0000000..510b60b
--- /dev/null
+++ b/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -0,0 +1,2612 @@
+// 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 library implements a kernel2kernel constant evaluation transformation.
+///
+/// Even though it is expected that the frontend does not emit kernel AST which
+/// contains compile-time errors, this transformation still performs some
+/// valiation and throws a [ConstantEvaluationError] if there was a compile-time
+/// errors.
+///
+/// Due to the lack information which is is only available in the front-end,
+/// this validation is incomplete (e.g. whether an integer literal used the
+/// hexadecimal syntax or not).
+///
+/// Furthermore due to the lowering of certain constructs in the front-end
+/// (e.g. '??') we need to support a super-set of the normal constant expression
+/// language. Issue(http://dartbug.com/31799)
+library fasta.constant_evaluator;
+
+import 'dart:core' hide MapEntry;
+
+import 'dart:io' as io;
+
+import 'package:kernel/ast.dart';
+import 'package:kernel/class_hierarchy.dart';
+import 'package:kernel/clone.dart';
+import 'package:kernel/core_types.dart';
+import 'package:kernel/kernel.dart';
+import 'package:kernel/type_algebra.dart';
+import 'package:kernel/type_environment.dart';
+
+import 'package:kernel/target/targets.dart';
+
+import '../fasta_codes.dart'
+ show
+ LocatedMessage,
+ Message,
+ messageConstEvalCircularity,
+ messageConstEvalContext,
+ messageConstEvalFailedAssertion,
+ messageConstEvalIterationInConstList,
+ messageConstEvalIterationInConstSet,
+ messageConstEvalIterationInConstMap,
+ messageConstEvalNotListOrSetInSpread,
+ messageConstEvalNotMapInSpread,
+ messageConstEvalNullValue,
+ messageConstEvalUnevaluated,
+ noLength,
+ templateConstEvalDeferredLibrary,
+ templateConstEvalDuplicateElement,
+ templateConstEvalDuplicateKey,
+ templateConstEvalElementImplementsEqual,
+ templateConstEvalFailedAssertionWithMessage,
+ templateConstEvalFreeTypeParameter,
+ templateConstEvalInvalidType,
+ templateConstEvalInvalidBinaryOperandType,
+ templateConstEvalInvalidEqualsOperandType,
+ templateConstEvalInvalidMethodInvocation,
+ templateConstEvalInvalidPropertyGet,
+ templateConstEvalInvalidStaticInvocation,
+ templateConstEvalInvalidStringInterpolationOperand,
+ templateConstEvalInvalidSymbolName,
+ templateConstEvalKeyImplementsEqual,
+ templateConstEvalNegativeShift,
+ templateConstEvalNonConstantLiteral,
+ templateConstEvalNonConstantVariableGet,
+ templateConstEvalZeroDivisor;
+
+import 'collections.dart'
+ show
+ ForElement,
+ ForInElement,
+ IfElement,
+ SpreadElement,
+ ForMapEntry,
+ ForInMapEntry,
+ IfMapEntry,
+ SpreadMapEntry;
+
+Component transformComponent(Component component, ConstantsBackend backend,
+ Map<String, String> environmentDefines, ErrorReporter errorReporter,
+ {bool keepFields: true,
+ bool enableAsserts: false,
+ bool evaluateAnnotations: true,
+ bool desugarSets: false,
+ bool errorOnUnevaluatedConstant: false,
+ CoreTypes coreTypes,
+ ClassHierarchy hierarchy}) {
+ coreTypes ??= new CoreTypes(component);
+ hierarchy ??= new ClassHierarchy(component);
+
+ final typeEnvironment = new TypeEnvironment(coreTypes, hierarchy);
+
+ transformLibraries(component.libraries, backend, environmentDefines,
+ typeEnvironment, errorReporter,
+ keepFields: keepFields,
+ enableAsserts: enableAsserts,
+ desugarSets: desugarSets,
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
+ evaluateAnnotations: evaluateAnnotations);
+ return component;
+}
+
+void transformLibraries(
+ List<Library> libraries,
+ ConstantsBackend backend,
+ Map<String, String> environmentDefines,
+ TypeEnvironment typeEnvironment,
+ ErrorReporter errorReporter,
+ {bool keepFields: true,
+ bool keepVariables: false,
+ bool evaluateAnnotations: true,
+ bool desugarSets: false,
+ bool errorOnUnevaluatedConstant: false,
+ bool enableAsserts: false}) {
+ final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
+ backend,
+ environmentDefines,
+ keepFields,
+ keepVariables,
+ evaluateAnnotations,
+ desugarSets,
+ errorOnUnevaluatedConstant,
+ typeEnvironment,
+ enableAsserts,
+ errorReporter);
+ for (final Library library in libraries) {
+ constantsTransformer.convertLibrary(library);
+ }
+}
+
+class JavaScriptIntConstant extends DoubleConstant {
+ final BigInt bigIntValue;
+ JavaScriptIntConstant(int value) : this.fromBigInt(BigInt.from(value));
+ JavaScriptIntConstant.fromDouble(double value)
+ : bigIntValue = BigInt.from(value),
+ super(value);
+ JavaScriptIntConstant.fromBigInt(this.bigIntValue)
+ : super(bigIntValue.toDouble());
+ JavaScriptIntConstant.fromUInt64(int value)
+ : this.fromBigInt(BigInt.from(value).toUnsigned(64));
+
+ DartType getType(TypeEnvironment types) => types.intType;
+
+ String toString() => '$bigIntValue';
+}
+
+class ConstantsTransformer extends Transformer {
+ final ConstantEvaluator constantEvaluator;
+ final TypeEnvironment typeEnvironment;
+
+ /// Whether to preserve constant [Field]s. All use-sites will be rewritten.
+ final bool keepFields;
+ final bool keepVariables;
+ final bool evaluateAnnotations;
+ final bool desugarSets;
+ final bool errorOnUnevaluatedConstant;
+
+ ConstantsTransformer(
+ ConstantsBackend backend,
+ Map<String, String> environmentDefines,
+ this.keepFields,
+ this.keepVariables,
+ this.evaluateAnnotations,
+ this.desugarSets,
+ this.errorOnUnevaluatedConstant,
+ this.typeEnvironment,
+ bool enableAsserts,
+ ErrorReporter errorReporter)
+ : constantEvaluator = new ConstantEvaluator(backend, environmentDefines,
+ typeEnvironment, enableAsserts, errorReporter,
+ desugarSets: desugarSets,
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
+
+ // Transform the library/class members:
+
+ void convertLibrary(Library library) {
+ transformAnnotations(library.annotations, library);
+
+ transformList(library.dependencies, this, library);
+ transformList(library.parts, this, library);
+ transformList(library.typedefs, this, library);
+ transformList(library.classes, this, library);
+ transformList(library.procedures, this, library);
+ transformList(library.fields, this, library);
+
+ if (!keepFields) {
+ // The transformer API does not iterate over `Library.additionalExports`,
+ // so we manually delete the references to shaken nodes.
+ library.additionalExports.removeWhere((Reference reference) {
+ return reference.node is Field && reference.canonicalName == null;
+ });
+ }
+ }
+
+ visitLibraryPart(LibraryPart node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ });
+ return node;
+ }
+
+ visitLibraryDependency(LibraryDependency node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ });
+ return node;
+ }
+
+ visitClass(Class node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.fields, this, node);
+ transformList(node.typeParameters, this, node);
+ transformList(node.constructors, this, node);
+ transformList(node.procedures, this, node);
+ transformList(node.redirectingFactoryConstructors, this, node);
+ });
+ return node;
+ }
+
+ visitProcedure(Procedure node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ node.function = node.function.accept(this)..parent = node;
+ });
+ return node;
+ }
+
+ visitConstructor(Constructor node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.initializers, this, node);
+ node.function = node.function.accept(this)..parent = node;
+ });
+ return node;
+ }
+
+ visitTypedef(Typedef node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.typeParameters, this, node);
+ transformList(node.typeParametersOfFunctionType, this, node);
+ transformList(node.positionalParameters, this, node);
+ transformList(node.namedParameters, this, node);
+ });
+ return node;
+ }
+
+ visitRedirectingFactoryConstructor(RedirectingFactoryConstructor node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.typeParameters, this, node);
+ transformList(node.positionalParameters, this, node);
+ transformList(node.namedParameters, this, node);
+ });
+ return node;
+ }
+
+ visitTypeParameter(TypeParameter node) {
+ transformAnnotations(node.annotations, node);
+ return node;
+ }
+
+ void transformAnnotations(List<Expression> nodes, TreeNode parent) {
+ if (evaluateAnnotations && nodes.length > 0) {
+ transformExpressions(nodes, parent);
+ }
+ }
+
+ void transformExpressions(List<Expression> nodes, TreeNode parent) {
+ constantEvaluator.withNewEnvironment(() {
+ for (int i = 0; i < nodes.length; ++i) {
+ nodes[i] = evaluateAndTransformWithContext(parent, nodes[i])
+ ..parent = parent;
+ }
+ });
+ }
+
+ // Handle definition of constants:
+
+ visitFunctionNode(FunctionNode node) {
+ final positionalParameterCount = node.positionalParameters.length;
+ for (int i = 0; i < positionalParameterCount; ++i) {
+ final VariableDeclaration variable = node.positionalParameters[i];
+ transformAnnotations(variable.annotations, variable);
+ if (variable.initializer != null) {
+ variable.initializer =
+ evaluateAndTransformWithContext(variable, variable.initializer)
+ ..parent = variable;
+ }
+ }
+ for (final VariableDeclaration variable in node.namedParameters) {
+ transformAnnotations(variable.annotations, variable);
+ if (variable.initializer != null) {
+ variable.initializer =
+ evaluateAndTransformWithContext(variable, variable.initializer)
+ ..parent = variable;
+ }
+ }
+ if (node.body != null) {
+ node.body = node.body.accept(this)..parent = node;
+ }
+ return node;
+ }
+
+ visitVariableDeclaration(VariableDeclaration node) {
+ transformAnnotations(node.annotations, node);
+
+ if (node.initializer != null) {
+ if (node.isConst) {
+ final Constant constant = evaluateWithContext(node, node.initializer);
+ constantEvaluator.env.addVariableValue(node, constant);
+
+ if (keepVariables) {
+ // So the value of the variable is still available for debugging
+ // purposes we convert the constant variable to be a final variable
+ // initialized to the evaluated constant expression.
+ node.initializer = makeConstantExpression(constant, node.initializer)
+ ..parent = node;
+ node.isFinal = true;
+ node.isConst = false;
+ } else {
+ // Since we convert all use-sites of constants, the constant
+ // [VariableDeclaration] is unused and we'll therefore remove it.
+ return null;
+ }
+ } else {
+ node.initializer = node.initializer.accept(this)..parent = node;
+ }
+ }
+ return node;
+ }
+
+ visitField(Field node) {
+ return constantEvaluator.withNewEnvironment(() {
+ if (node.isConst) {
+ // Since we convert all use-sites of constants, the constant [Field]
+ // cannot be referenced anymore. We therefore get rid of it if
+ // [keepFields] was not specified.
+ if (!keepFields) {
+ return null;
+ }
+
+ // Otherwise we keep the constant [Field] and convert it's initializer.
+ transformAnnotations(node.annotations, node);
+ if (node.initializer != null) {
+ node.initializer =
+ evaluateAndTransformWithContext(node, node.initializer)
+ ..parent = node;
+ }
+ } else {
+ transformAnnotations(node.annotations, node);
+ if (node.initializer != null) {
+ node.initializer = node.initializer.accept(this)..parent = node;
+ }
+ }
+ return node;
+ });
+ }
+
+ // Handle use-sites of constants (and "inline" constant expressions):
+
+ visitSymbolLiteral(SymbolLiteral node) {
+ return makeConstantExpression(constantEvaluator.evaluate(node), node);
+ }
+
+ visitStaticGet(StaticGet node) {
+ final Member target = node.target;
+ if (target is Field && target.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ } else if (target is Procedure && target.kind == ProcedureKind.Method) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitStaticGet(node);
+ }
+
+ visitSwitchCase(SwitchCase node) {
+ transformExpressions(node.expressions, node);
+ return super.visitSwitchCase(node);
+ }
+
+ visitVariableGet(VariableGet node) {
+ if (node.variable.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitVariableGet(node);
+ }
+
+ visitListLiteral(ListLiteral node) {
+ if (node.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitListLiteral(node);
+ }
+
+ visitSetLiteral(SetLiteral node) {
+ if (node.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitSetLiteral(node);
+ }
+
+ visitMapLiteral(MapLiteral node) {
+ if (node.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitMapLiteral(node);
+ }
+
+ visitConstructorInvocation(ConstructorInvocation node) {
+ if (node.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitConstructorInvocation(node);
+ }
+
+ visitStaticInvocation(StaticInvocation node) {
+ if (node.isConst) {
+ return evaluateAndTransformWithContext(node, node);
+ }
+ return super.visitStaticInvocation(node);
+ }
+
+ visitConstantExpression(ConstantExpression node) {
+ Constant constant = node.constant;
+ if (constant is UnevaluatedConstant) {
+ Expression expression = constant.expression;
+ return evaluateAndTransformWithContext(expression, expression);
+ } else {
+ node.constant = constantEvaluator.canonicalize(constant);
+ return node;
+ }
+ }
+
+ evaluateAndTransformWithContext(TreeNode treeContext, Expression node) {
+ return makeConstantExpression(evaluateWithContext(treeContext, node), node);
+ }
+
+ evaluateWithContext(TreeNode treeContext, Expression node) {
+ if (treeContext == node) {
+ return constantEvaluator.evaluate(node);
+ }
+
+ return constantEvaluator.runInsideContext(treeContext, () {
+ return constantEvaluator.evaluate(node);
+ });
+ }
+
+ Expression makeConstantExpression(Constant constant, Expression node) {
+ if (constant is UnevaluatedConstant &&
+ constant.expression is InvalidExpression) {
+ return constant.expression;
+ }
+ return new ConstantExpression(constant, node.getStaticType(typeEnvironment))
+ ..fileOffset = node.fileOffset;
+ }
+}
+
+class ConstantEvaluator extends RecursiveVisitor<Constant> {
+ final ConstantsBackend backend;
+ final NumberSemantics numberSemantics;
+ Map<String, String> environmentDefines;
+ final bool errorOnUnevaluatedConstant;
+ final CoreTypes coreTypes;
+ final TypeEnvironment typeEnvironment;
+ final bool enableAsserts;
+ final ErrorReporter errorReporter;
+
+ final bool desugarSets;
+ final Field unmodifiableSetMap;
+
+ final isInstantiated = new IsInstantiatedVisitor().isInstantiated;
+
+ final Map<Constant, Constant> canonicalizationCache;
+ final Map<Node, Object> nodeCache;
+ final CloneVisitor cloner = new CloneVisitor();
+
+ Map<Class, bool> primitiveEqualCache;
+
+ final NullConstant nullConstant = new NullConstant();
+ final BoolConstant trueConstant = new BoolConstant(true);
+ final BoolConstant falseConstant = new BoolConstant(false);
+
+ final List<TreeNode> contextChain = [];
+
+ InstanceBuilder instanceBuilder;
+ EvaluationEnvironment env;
+ Set<Expression> replacementNodes = new Set<Expression>.identity();
+ Map<Constant, Constant> lowered = new Map<Constant, Constant>.identity();
+
+ bool seenUnevaluatedChild; // Any children that were left unevaluated?
+ int lazyDepth; // Current nesting depth of lazy regions.
+
+ bool get shouldBeUnevaluated => seenUnevaluatedChild || lazyDepth != 0;
+
+ bool get targetingJavaScript => numberSemantics == NumberSemantics.js;
+
+ ConstantEvaluator(this.backend, this.environmentDefines, this.typeEnvironment,
+ this.enableAsserts, this.errorReporter,
+ {this.desugarSets = false, this.errorOnUnevaluatedConstant = false})
+ : numberSemantics = backend.numberSemantics,
+ coreTypes = typeEnvironment.coreTypes,
+ canonicalizationCache = <Constant, Constant>{},
+ nodeCache = <Node, Constant>{},
+ env = new EvaluationEnvironment(),
+ unmodifiableSetMap = desugarSets
+ ? typeEnvironment.coreTypes.index
+ .getMember('dart:collection', '_UnmodifiableSet', '_map')
+ : null {
+ primitiveEqualCache = <Class, bool>{
+ coreTypes.boolClass: true,
+ coreTypes.doubleClass: false,
+ coreTypes.intClass: true,
+ coreTypes.internalSymbolClass: true,
+ coreTypes.listClass: true,
+ coreTypes.mapClass: true,
+ coreTypes.nullClass: true,
+ coreTypes.objectClass: true,
+ coreTypes.setClass: true,
+ coreTypes.stringClass: true,
+ coreTypes.symbolClass: true,
+ coreTypes.typeClass: true,
+ };
+ }
+
+ Uri getFileUri(TreeNode node) {
+ while (node != null && node is! FileUriNode) {
+ node = node.parent;
+ }
+ return (node as FileUriNode)?.fileUri;
+ }
+
+ int getFileOffset(Uri uri, TreeNode node) {
+ if (uri == null) return TreeNode.noOffset;
+ while (node != null && node.fileOffset == TreeNode.noOffset) {
+ node = node.parent;
+ }
+ return node == null ? TreeNode.noOffset : node.fileOffset;
+ }
+
+ /// Evaluate [node] and possibly cache the evaluation result.
+ /// Returns UnevaluatedConstant if the constant could not be evaluated.
+ /// If the expression in the UnevaluatedConstant is an InvalidExpression,
+ /// an error occurred during constant evaluation.
+ Constant evaluate(Expression node) {
+ seenUnevaluatedChild = false;
+ lazyDepth = 0;
+ try {
+ Constant result = _evaluateSubexpression(node);
+ if (errorOnUnevaluatedConstant && result is UnevaluatedConstant) {
+ return report(node, messageConstEvalUnevaluated);
+ }
+ return result;
+ } on _AbortDueToError catch (e) {
+ final Uri uri = getFileUri(e.node);
+ final int fileOffset = getFileOffset(uri, e.node);
+ final locatedMessage = e.message.withLocation(uri, fileOffset, noLength);
+
+ final contextMessages = <LocatedMessage>[];
+ if (e.context != null) contextMessages.addAll(e.context);
+ for (final TreeNode node in contextChain) {
+ final Uri uri = getFileUri(node);
+ final int fileOffset = getFileOffset(uri, node);
+ contextMessages.add(
+ messageConstEvalContext.withLocation(uri, fileOffset, noLength));
+ }
+ errorReporter.report(locatedMessage, contextMessages);
+ return new UnevaluatedConstant(new InvalidExpression(e.message.message));
+ } on _AbortDueToInvalidExpression catch (e) {
+ // TODO(askesc): Copy position from erroneous node.
+ // Currently not possible, as it might be in a different file.
+ // Can be done if we add an explicit URI to InvalidExpression.
+ InvalidExpression invalid = new InvalidExpression(e.message);
+ if (invalid.fileOffset == TreeNode.noOffset) {
+ invalid.fileOffset = node.fileOffset;
+ }
+ errorReporter.reportInvalidExpression(invalid);
+ return new UnevaluatedConstant(invalid);
+ }
+ }
+
+ /// Report an error that has been detected during constant evaluation.
+ Null report(TreeNode node, Message message, {List<LocatedMessage> context}) {
+ throw new _AbortDueToError(node, message, context: context);
+ }
+
+ /// Report a construct that should not occur inside a potentially constant
+ /// expression. It is assumed that an error has already been reported.
+ Null reportInvalid(TreeNode node, String message) {
+ throw new _AbortDueToInvalidExpression(node, message);
+ }
+
+ /// Produce an unevaluated constant node for an expression.
+ Constant unevaluated(Expression original, Expression replacement) {
+ replacement.fileOffset = original.fileOffset;
+ // TODO(askesc,johnniwinther): Preserve fileUri on [replacement].
+ return new UnevaluatedConstant(replacement);
+ }
+
+ /// Extract an expression from a (possibly unevaluated) constant to become
+ /// part of the expression tree of another unevaluated constant.
+ /// Makes sure a particular expression occurs only once in the tree by
+ /// cloning further instances.
+ Expression extract(Constant constant) {
+ Expression expression = constant.asExpression();
+ if (!replacementNodes.add(expression)) {
+ expression = cloner.clone(expression);
+ replacementNodes.add(expression);
+ }
+ return expression;
+ }
+
+ /// Enter a region of lazy evaluation. All leaf nodes are evaluated normally
+ /// (to ensure inlining of referenced local variables), but composite nodes
+ /// always treat their children as unevaluated, resulting in a partially
+ /// evaluated clone of the original expression tree.
+ /// Lazy evaluation is used for the subtrees of lazy operations with
+ /// unevaluated conditions to ensure no errors are reported for problems
+ /// in the subtree as long as the subtree is potentially constant.
+ void enterLazy() => lazyDepth++;
+
+ /// Leave a (possibly nested) region of lazy evaluation.
+ void leaveLazy() => lazyDepth--;
+
+ Constant lower(Constant original, Constant replacement) {
+ if (!identical(original, replacement)) {
+ original = canonicalize(original);
+ replacement = canonicalize(replacement);
+ lowered[replacement] = original;
+ return replacement;
+ }
+ return canonicalize(replacement);
+ }
+
+ Constant unlower(Constant constant) {
+ return lowered[constant] ?? constant;
+ }
+
+ Constant lowerListConstant(ListConstant constant) {
+ if (shouldBeUnevaluated) return constant;
+ return lower(constant, backend.lowerListConstant(constant));
+ }
+
+ Constant lowerSetConstant(SetConstant constant) {
+ if (shouldBeUnevaluated) return constant;
+ return lower(constant, backend.lowerSetConstant(constant));
+ }
+
+ Constant lowerMapConstant(MapConstant constant) {
+ if (shouldBeUnevaluated) return constant;
+ return lower(constant, backend.lowerMapConstant(constant));
+ }
+
+ /// Evaluate [node] and possibly cache the evaluation result.
+ /// @throws _AbortDueToError or _AbortDueToInvalidExpression if expression
+ /// can't be evaluated.
+ Constant _evaluateSubexpression(Expression node) {
+ if (node == null) return nullConstant;
+ bool wasUnevaluated = seenUnevaluatedChild;
+ seenUnevaluatedChild = false;
+ Constant result;
+ if (env.isEmpty) {
+ // We only try to evaluate the same [node] *once* within an empty
+ // environment.
+ if (nodeCache.containsKey(node)) {
+ result = nodeCache[node] ?? report(node, messageConstEvalCircularity);
+ } else {
+ nodeCache[node] = null;
+ try {
+ result = nodeCache[node] = node.accept(this);
+ } catch (e) {
+ nodeCache.remove(node);
+ rethrow;
+ }
+ }
+ } else {
+ result = node.accept(this);
+ }
+ seenUnevaluatedChild = wasUnevaluated || result is UnevaluatedConstant;
+ return result;
+ }
+
+ Constant runInsideContext(TreeNode node, Constant fun()) {
+ try {
+ pushContext(node);
+ return fun();
+ } finally {
+ popContext(node);
+ }
+ }
+
+ Constant runInsideContextIfNoContext(TreeNode node, Constant fun()) {
+ if (contextChain.isEmpty) {
+ return runInsideContext(node, fun);
+ } else {
+ return fun();
+ }
+ }
+
+ pushContext(TreeNode contextNode) {
+ contextChain.add(contextNode);
+ }
+
+ popContext(TreeNode contextNode) {
+ assert(contextChain.last == contextNode);
+ contextChain.length = contextChain.length - 1;
+ }
+
+ defaultTreeNode(Node node) {
+ // Only a subset of the expression language is valid for constant
+ // evaluation.
+ return reportInvalid(
+ node, 'Constant evaluation has no support for ${node.runtimeType}!');
+ }
+
+ visitNullLiteral(NullLiteral node) => nullConstant;
+
+ visitBoolLiteral(BoolLiteral node) {
+ return makeBoolConstant(node.value);
+ }
+
+ visitIntLiteral(IntLiteral node) {
+ // The frontend ensures that integer literals are valid according to the
+ // target representation.
+ return targetingJavaScript
+ ? canonicalize(new JavaScriptIntConstant.fromUInt64(node.value))
+ : canonicalize(new IntConstant(node.value));
+ }
+
+ visitDoubleLiteral(DoubleLiteral node) {
+ return canonicalize(makeDoubleConstant(node.value));
+ }
+
+ visitStringLiteral(StringLiteral node) {
+ return canonicalize(new StringConstant(node.value));
+ }
+
+ visitTypeLiteral(TypeLiteral node) {
+ final DartType type = evaluateDartType(node, node.type);
+ return canonicalize(new TypeLiteralConstant(type));
+ }
+
+ visitConstantExpression(ConstantExpression node) {
+ Constant constant = node.constant;
+ Constant result = constant;
+ if (constant is UnevaluatedConstant) {
+ result = runInsideContext(constant.expression, () {
+ return _evaluateSubexpression(constant.expression);
+ });
+ } else if (targetingJavaScript) {
+ if (constant is DoubleConstant) {
+ double value = constant.value;
+ // TODO(askesc, fishythefish): Handle infinite integers.
+ if (value.isFinite && value.truncateToDouble() == value) {
+ result = new JavaScriptIntConstant.fromDouble(value);
+ }
+ }
+ }
+ // If there were already constants in the AST then we make sure we
+ // re-canonicalize them. After running the transformer we will therefore
+ // have a fully-canonicalized constant DAG with roots coming from the
+ // [ConstantExpression] nodes in the AST.
+ return canonicalize(result);
+ }
+
+ /// Add an element (which is possibly a spread or an if element) to a
+ /// constant list or set represented as a list of (possibly unevaluated)
+ /// lists or sets to be concatenated.
+ /// Each element of [parts] is either a `List<Constant>` (containing fully
+ /// evaluated constants) or a `Constant` (potentially unevaluated).
+ /// Pass an identity set as [seen] for sets and omit it for lists.
+ void addToListOrSetConstant(
+ List<Object> parts, Expression element, DartType elementType,
+ [Set<Constant> seen]) {
+ bool isSet = seen != null;
+ if (element is SpreadElement) {
+ Constant spread = unlower(_evaluateSubexpression(element.expression));
+ if (shouldBeUnevaluated) {
+ // Unevaluated spread
+ if (element.isNullAware) {
+ VariableDeclaration temp =
+ new VariableDeclaration(null, initializer: extract(spread));
+ parts.add(unevaluated(
+ element.expression,
+ new Let(
+ temp,
+ new ConditionalExpression(
+ new MethodInvocation(new VariableGet(temp),
+ new Name('=='), new Arguments([new NullLiteral()])),
+ new ListLiteral([], isConst: true),
+ new VariableGet(temp),
+ const DynamicType()))));
+ } else {
+ parts.add(spread);
+ }
+ } else if (spread == nullConstant) {
+ // Null spread
+ if (!element.isNullAware) {
+ report(element.expression, messageConstEvalNullValue);
+ }
+ } else {
+ // Fully evaluated spread
+ List<Constant> entries;
+ if (spread is ListConstant) {
+ entries = spread.entries;
+ } else if (spread is SetConstant) {
+ entries = spread.entries;
+ } else {
+ // Not list or set in spread
+ return report(
+ element.expression, messageConstEvalNotListOrSetInSpread);
+ }
+ for (Constant entry in entries) {
+ addToListOrSetConstant(
+ parts, new ConstantExpression(entry), elementType, seen);
+ }
+ }
+ } else if (element is IfElement) {
+ Constant condition = _evaluateSubexpression(element.condition);
+ if (shouldBeUnevaluated) {
+ // Unevaluated if
+ enterLazy();
+ Constant then = _evaluateSubexpression(isSet
+ ? new SetLiteral([cloner.clone(element.then)], isConst: true)
+ : new ListLiteral([cloner.clone(element.then)], isConst: true));
+ Constant otherwise;
+ if (element.otherwise != null) {
+ otherwise = _evaluateSubexpression(isSet
+ ? new SetLiteral([cloner.clone(element.otherwise)], isConst: true)
+ : new ListLiteral([cloner.clone(element.otherwise)],
+ isConst: true));
+ } else {
+ otherwise = isSet
+ ? new SetConstant(const DynamicType(), [])
+ : new ListConstant(const DynamicType(), []);
+ }
+ leaveLazy();
+ parts.add(unevaluated(
+ element.condition,
+ new ConditionalExpression(extract(condition), extract(then),
+ extract(otherwise), const DynamicType())));
+ } else {
+ // Fully evaluated if
+ if (condition == trueConstant) {
+ addToListOrSetConstant(parts, element.then, elementType, seen);
+ } else if (condition == falseConstant) {
+ if (element.otherwise != null) {
+ addToListOrSetConstant(parts, element.otherwise, elementType, seen);
+ }
+ } else if (condition == nullConstant) {
+ report(element.condition, messageConstEvalNullValue);
+ } else {
+ report(
+ element.condition,
+ templateConstEvalInvalidType.withArguments(
+ condition,
+ typeEnvironment.boolType,
+ condition.getType(typeEnvironment)));
+ }
+ }
+ } else if (element is ForElement || element is ForInElement) {
+ // For or for-in
+ report(
+ element,
+ isSet
+ ? messageConstEvalIterationInConstSet
+ : messageConstEvalIterationInConstList);
+ } else {
+ // Ordinary expresion element
+ Constant constant = _evaluateSubexpression(element);
+ if (shouldBeUnevaluated) {
+ parts.add(unevaluated(
+ element,
+ isSet
+ ? new SetLiteral([extract(constant)],
+ typeArgument: elementType, isConst: true)
+ : new ListLiteral([extract(constant)],
+ typeArgument: elementType, isConst: true)));
+ } else {
+ List<Constant> listOrSet;
+ if (parts.last is List<Constant>) {
+ listOrSet = parts.last;
+ } else {
+ parts.add(listOrSet = <Constant>[]);
+ }
+ if (isSet) {
+ if (!hasPrimitiveEqual(constant)) {
+ report(
+ element,
+ templateConstEvalElementImplementsEqual
+ .withArguments(constant));
+ }
+ if (!seen.add(constant)) {
+ report(element,
+ templateConstEvalDuplicateElement.withArguments(constant));
+ }
+ }
+ listOrSet.add(ensureIsSubtype(constant, elementType, element));
+ }
+ }
+ }
+
+ Constant makeListConstantFromParts(
+ List<Object> parts, Expression node, DartType elementType) {
+ if (parts.length == 1) {
+ // Fully evaluated
+ return lowerListConstant(new ListConstant(elementType, parts.single));
+ }
+ List<Expression> lists = <Expression>[];
+ for (Object part in parts) {
+ if (part is List<Constant>) {
+ lists.add(new ConstantExpression(new ListConstant(elementType, part)));
+ } else if (part is Constant) {
+ lists.add(extract(part));
+ } else {
+ throw 'Non-constant in constant list';
+ }
+ }
+ return unevaluated(
+ node, new ListConcatenation(lists, typeArgument: elementType));
+ }
+
+ visitListLiteral(ListLiteral node) {
+ if (!node.isConst) {
+ return report(
+ node, templateConstEvalNonConstantLiteral.withArguments('List'));
+ }
+ final List<Object> parts = <Object>[<Constant>[]];
+ for (Expression element in node.expressions) {
+ addToListOrSetConstant(parts, element, node.typeArgument);
+ }
+ return makeListConstantFromParts(parts, node, node.typeArgument);
+ }
+
+ visitListConcatenation(ListConcatenation node) {
+ final List<Object> parts = <Object>[<Constant>[]];
+ for (Expression list in node.lists) {
+ addToListOrSetConstant(parts,
+ new SpreadElement(cloner.clone(list), false), node.typeArgument);
+ }
+ return makeListConstantFromParts(parts, node, node.typeArgument);
+ }
+
+ Constant makeSetConstantFromParts(
+ List<Object> parts, Expression node, DartType elementType) {
+ if (parts.length == 1) {
+ // Fully evaluated
+ List<Constant> entries = parts.single;
+ SetConstant result = new SetConstant(elementType, entries);
+ if (desugarSets) {
+ final List<ConstantMapEntry> mapEntries =
+ new List<ConstantMapEntry>(entries.length);
+ for (int i = 0; i < entries.length; ++i) {
+ mapEntries[i] = new ConstantMapEntry(entries[i], nullConstant);
+ }
+ Constant map = lowerMapConstant(
+ new MapConstant(elementType, typeEnvironment.nullType, mapEntries));
+ return lower(
+ result,
+ new InstanceConstant(
+ unmodifiableSetMap.enclosingClass.reference,
+ [elementType],
+ <Reference, Constant>{unmodifiableSetMap.reference: map}));
+ } else {
+ return lowerSetConstant(result);
+ }
+ }
+ List<Expression> sets = <Expression>[];
+ for (Object part in parts) {
+ if (part is List<Constant>) {
+ sets.add(new ConstantExpression(new SetConstant(elementType, part)));
+ } else if (part is Constant) {
+ sets.add(extract(part));
+ } else {
+ throw 'Non-constant in constant set';
+ }
+ }
+ return unevaluated(
+ node, new SetConcatenation(sets, typeArgument: elementType));
+ }
+
+ visitSetLiteral(SetLiteral node) {
+ if (!node.isConst) {
+ return report(
+ node, templateConstEvalNonConstantLiteral.withArguments('Set'));
+ }
+ final Set<Constant> seen = new Set<Constant>.identity();
+ final List<Object> parts = <Object>[<Constant>[]];
+ for (Expression element in node.expressions) {
+ addToListOrSetConstant(parts, element, node.typeArgument, seen);
+ }
+ return makeSetConstantFromParts(parts, node, node.typeArgument);
+ }
+
+ visitSetConcatenation(SetConcatenation node) {
+ final Set<Constant> seen = new Set<Constant>.identity();
+ final List<Object> parts = <Object>[<Constant>[]];
+ for (Expression set_ in node.sets) {
+ addToListOrSetConstant(
+ parts,
+ new SpreadElement(cloner.clone(set_), false),
+ node.typeArgument,
+ seen);
+ }
+ return makeSetConstantFromParts(parts, node, node.typeArgument);
+ }
+
+ /// Add a map entry (which is possibly a spread or an if map entry) to a
+ /// constant map represented as a list of (possibly unevaluated)
+ /// maps to be concatenated.
+ /// Each element of [parts] is either a `List<ConstantMapEntry>` (containing
+ /// fully evaluated map entries) or a `Constant` (potentially unevaluated).
+ void addToMapConstant(List<Object> parts, MapEntry element, DartType keyType,
+ DartType valueType, Set<Constant> seenKeys) {
+ if (element is SpreadMapEntry) {
+ Constant spread = unlower(_evaluateSubexpression(element.expression));
+ if (shouldBeUnevaluated) {
+ // Unevaluated spread
+ if (element.isNullAware) {
+ VariableDeclaration temp =
+ new VariableDeclaration(null, initializer: extract(spread));
+ parts.add(unevaluated(
+ element.expression,
+ new Let(
+ temp,
+ new ConditionalExpression(
+ new MethodInvocation(new VariableGet(temp),
+ new Name('=='), new Arguments([new NullLiteral()])),
+ new MapLiteral([], isConst: true),
+ new VariableGet(temp),
+ const DynamicType()))));
+ } else {
+ parts.add(spread);
+ }
+ } else if (spread == nullConstant) {
+ // Null spread
+ if (!element.isNullAware) {
+ report(element.expression, messageConstEvalNullValue);
+ }
+ } else {
+ // Fully evaluated spread
+ if (spread is MapConstant) {
+ for (ConstantMapEntry entry in spread.entries) {
+ addToMapConstant(
+ parts,
+ new MapEntry(new ConstantExpression(entry.key),
+ new ConstantExpression(entry.value)),
+ keyType,
+ valueType,
+ seenKeys);
+ }
+ } else {
+ // Not map in spread
+ return report(element.expression, messageConstEvalNotMapInSpread);
+ }
+ }
+ } else if (element is IfMapEntry) {
+ Constant condition = _evaluateSubexpression(element.condition);
+ if (shouldBeUnevaluated) {
+ // Unevaluated if
+ enterLazy();
+ Constant then = _evaluateSubexpression(
+ new MapLiteral([cloner.clone(element.then)], isConst: true));
+ Constant otherwise;
+ if (element.otherwise != null) {
+ otherwise = _evaluateSubexpression(
+ new MapLiteral([cloner.clone(element.otherwise)], isConst: true));
+ } else {
+ otherwise =
+ new MapConstant(const DynamicType(), const DynamicType(), []);
+ }
+ leaveLazy();
+ parts.add(unevaluated(
+ element.condition,
+ new ConditionalExpression(extract(condition), extract(then),
+ extract(otherwise), const DynamicType())));
+ } else {
+ // Fully evaluated if
+ if (condition == trueConstant) {
+ addToMapConstant(parts, element.then, keyType, valueType, seenKeys);
+ } else if (condition == falseConstant) {
+ if (element.otherwise != null) {
+ addToMapConstant(
+ parts, element.otherwise, keyType, valueType, seenKeys);
+ }
+ } else if (condition == nullConstant) {
+ report(element.condition, messageConstEvalNullValue);
+ } else {
+ report(
+ element.condition,
+ templateConstEvalInvalidType.withArguments(
+ condition,
+ typeEnvironment.boolType,
+ condition.getType(typeEnvironment)));
+ }
+ }
+ } else if (element is ForMapEntry || element is ForInMapEntry) {
+ // For or for-in
+ report(element, messageConstEvalIterationInConstMap);
+ } else {
+ // Ordinary map entry
+ Constant key = _evaluateSubexpression(element.key);
+ Constant value = _evaluateSubexpression(element.value);
+ if (shouldBeUnevaluated) {
+ parts.add(unevaluated(
+ element.key,
+ new MapLiteral([new MapEntry(extract(key), extract(value))],
+ isConst: true)));
+ } else {
+ List<ConstantMapEntry> entries;
+ if (parts.last is List<ConstantMapEntry>) {
+ entries = parts.last;
+ } else {
+ parts.add(entries = <ConstantMapEntry>[]);
+ }
+ if (!hasPrimitiveEqual(key)) {
+ report(
+ element, templateConstEvalKeyImplementsEqual.withArguments(key));
+ }
+ if (!seenKeys.add(key)) {
+ report(element.key, templateConstEvalDuplicateKey.withArguments(key));
+ }
+ entries.add(new ConstantMapEntry(
+ ensureIsSubtype(key, keyType, element.key),
+ ensureIsSubtype(value, valueType, element.value)));
+ }
+ }
+ }
+
+ Constant makeMapConstantFromParts(List<Object> parts, Expression node,
+ DartType keyType, DartType valueType) {
+ if (parts.length == 1) {
+ // Fully evaluated
+ return lowerMapConstant(
+ new MapConstant(keyType, valueType, parts.single));
+ }
+ List<Expression> maps = <Expression>[];
+ for (Object part in parts) {
+ if (part is List<ConstantMapEntry>) {
+ maps.add(
+ new ConstantExpression(new MapConstant(keyType, valueType, part)));
+ } else if (part is Constant) {
+ maps.add(extract(part));
+ } else {
+ throw 'Non-constant in constant map';
+ }
+ }
+ return unevaluated(node,
+ new MapConcatenation(maps, keyType: keyType, valueType: valueType));
+ }
+
+ visitMapLiteral(MapLiteral node) {
+ if (!node.isConst) {
+ return report(
+ node, templateConstEvalNonConstantLiteral.withArguments('Map'));
+ }
+ final Set<Constant> seen = new Set<Constant>.identity();
+ final List<Object> parts = <Object>[<ConstantMapEntry>[]];
+ for (MapEntry element in node.entries) {
+ addToMapConstant(parts, element, node.keyType, node.valueType, seen);
+ }
+ return makeMapConstantFromParts(parts, node, node.keyType, node.valueType);
+ }
+
+ visitMapConcatenation(MapConcatenation node) {
+ final Set<Constant> seen = new Set<Constant>.identity();
+ final List<Object> parts = <Object>[<ConstantMapEntry>[]];
+ for (Expression map in node.maps) {
+ addToMapConstant(parts, new SpreadMapEntry(cloner.clone(map), false),
+ node.keyType, node.valueType, seen);
+ }
+ return makeMapConstantFromParts(parts, node, node.keyType, node.valueType);
+ }
+
+ visitFunctionExpression(FunctionExpression node) {
+ return report(
+ node, templateConstEvalNonConstantLiteral.withArguments('Function'));
+ }
+
+ visitConstructorInvocation(ConstructorInvocation node) {
+ final Constructor constructor = node.target;
+ final Class klass = constructor.enclosingClass;
+ bool isSymbol = klass == coreTypes.internalSymbolClass;
+ if (!constructor.isConst) {
+ return reportInvalid(node, 'Non-const constructor invocation.');
+ }
+ if (constructor.function.body != null &&
+ constructor.function.body is! EmptyStatement) {
+ return reportInvalid(
+ node,
+ 'Constructor "$node" has non-trivial body '
+ '"${constructor.function.body.runtimeType}".');
+ }
+ if (klass.isAbstract) {
+ return reportInvalid(
+ node, 'Constructor "$node" belongs to abstract class "${klass}".');
+ }
+
+ final positionals = evaluatePositionalArguments(node.arguments);
+ final named = evaluateNamedArguments(node.arguments);
+
+ // Is the constructor unavailable due to separate compilation?
+ bool isUnavailable = constructor.isInExternalLibrary &&
+ constructor.initializers.isEmpty &&
+ constructor.enclosingClass.supertype != null;
+
+ if (isUnavailable || (isSymbol && shouldBeUnevaluated)) {
+ return unevaluated(
+ node,
+ new ConstructorInvocation(constructor,
+ unevaluatedArguments(positionals, named, node.arguments.types),
+ isConst: true));
+ }
+
+ // Special case the dart:core's Symbol class here and convert it to a
+ // [SymbolConstant]. For invalid values we report a compile-time error.
+ if (isSymbol) {
+ final Constant nameValue = positionals.single;
+
+ if (nameValue is StringConstant && isValidSymbolName(nameValue.value)) {
+ return canonicalize(new SymbolConstant(nameValue.value, null));
+ }
+ return report(node.arguments.positional.first,
+ templateConstEvalInvalidSymbolName.withArguments(nameValue));
+ }
+
+ final typeArguments = evaluateTypeArguments(node, node.arguments);
+
+ // Fill in any missing type arguments with "dynamic".
+ for (int i = typeArguments.length; i < klass.typeParameters.length; i++) {
+ typeArguments.add(const DynamicType());
+ }
+
+ // Start building a new instance.
+ return withNewInstanceBuilder(klass, typeArguments, () {
+ return runInsideContextIfNoContext(node, () {
+ // "Run" the constructor (and any super constructor calls), which will
+ // initialize the fields of the new instance.
+ if (shouldBeUnevaluated) {
+ enterLazy();
+ handleConstructorInvocation(
+ constructor, typeArguments, positionals, named);
+ leaveLazy();
+ return unevaluated(node, instanceBuilder.buildUnevaluatedInstance());
+ }
+ handleConstructorInvocation(
+ constructor, typeArguments, positionals, named);
+ if (shouldBeUnevaluated) {
+ return unevaluated(node, instanceBuilder.buildUnevaluatedInstance());
+ }
+ return canonicalize(instanceBuilder.buildInstance());
+ });
+ });
+ }
+
+ visitInstanceCreation(InstanceCreation node) {
+ return withNewInstanceBuilder(node.classNode, node.typeArguments, () {
+ for (AssertStatement statement in node.asserts) {
+ checkAssert(statement);
+ }
+ node.fieldValues.forEach((Reference fieldRef, Expression value) {
+ instanceBuilder.setFieldValue(
+ fieldRef.asField, _evaluateSubexpression(value));
+ });
+ if (shouldBeUnevaluated) {
+ return unevaluated(node, instanceBuilder.buildUnevaluatedInstance());
+ }
+ return canonicalize(instanceBuilder.buildInstance());
+ });
+ }
+
+ bool isValidSymbolName(String name) {
+ // See https://api.dartlang.org/stable/2.0.0/dart-core/Symbol/Symbol.html:
+ //
+ // A qualified name is a valid name preceded by a public identifier name and
+ // a '.', e.g., foo.bar.baz= is a qualified version of baz=.
+ //
+ // That means that the content of the name String must be either
+ // - a valid public Dart identifier (that is, an identifier not
+ // starting with "_"),
+ // - such an identifier followed by "=" (a setter name),
+ // - the name of a declarable operator,
+ // - any of the above preceded by any number of qualifiers, where a
+ // qualifier is a non-private identifier followed by '.',
+ // - or the empty string (the default name of a library with no library
+ // name declaration).
+
+ const operatorNames = const <String>[
+ '+',
+ '-',
+ '*',
+ '/',
+ '%',
+ '~/',
+ '&',
+ '|',
+ '^',
+ '~',
+ '<<',
+ '>>',
+ '<',
+ '<=',
+ '>',
+ '>=',
+ '==',
+ '[]',
+ '[]=',
+ 'unary-'
+ ];
+
+ if (name == null) return false;
+ if (name == '') return true;
+
+ final parts = name.split('.');
+
+ // Each qualifier must be a public identifier.
+ for (int i = 0; i < parts.length - 1; ++i) {
+ if (!isValidPublicIdentifier(parts[i])) return false;
+ }
+
+ String last = parts.last;
+ if (operatorNames.contains(last)) {
+ return true;
+ }
+ if (last.endsWith('=')) {
+ last = last.substring(0, last.length - 1);
+ }
+ if (!isValidPublicIdentifier(last)) return false;
+
+ return true;
+ }
+
+ /// From the Dart Language specification:
+ ///
+ /// IDENTIFIER:
+ /// IDENTIFIER_START IDENTIFIER_PART*
+ ///
+ /// IDENTIFIER_START:
+ /// IDENTIFIER_START_NO_DOLLAR | ‘$’
+ ///
+ /// IDENTIFIER_PART:
+ /// IDENTIFIER_START | DIGIT
+ ///
+ /// IDENTIFIER_NO_DOLLAR:
+ /// IDENTIFIER_START_NO_DOLLAR IDENTIFIER_PART_NO_DOLLAR*
+ ///
+ /// IDENTIFIER_START_NO_DOLLAR:
+ /// LETTER | '_'
+ ///
+ /// IDENTIFIER_PART_NO_DOLLAR:
+ /// IDENTIFIER_START_NO_DOLLAR | DIGIT
+ ///
+ static final publicIdentifierRegExp =
+ new RegExp(r'^[a-zA-Z$][a-zA-Z0-9_$]*$');
+
+ static const nonUsableKeywords = const <String>[
+ 'assert',
+ 'break',
+ 'case',
+ 'catch',
+ 'class',
+ 'const',
+ 'continue',
+ 'default',
+ 'do',
+ 'else',
+ 'enum',
+ 'extends',
+ 'false',
+ 'final',
+ 'finally',
+ 'for',
+ 'if',
+ 'in',
+ 'is',
+ 'new',
+ 'null',
+ 'rethrow',
+ 'return',
+ 'super',
+ 'switch',
+ 'this',
+ 'throw',
+ 'true',
+ 'try',
+ 'var',
+ 'while',
+ 'with',
+ ];
+
+ bool isValidPublicIdentifier(String name) {
+ return publicIdentifierRegExp.hasMatch(name) &&
+ !nonUsableKeywords.contains(name);
+ }
+
+ handleConstructorInvocation(
+ Constructor constructor,
+ List<DartType> typeArguments,
+ List<Constant> positionalArguments,
+ Map<String, Constant> namedArguments) {
+ return runInsideContext(constructor, () {
+ return withNewEnvironment(() {
+ final Class klass = constructor.enclosingClass;
+ final FunctionNode function = constructor.function;
+
+ // We simulate now the constructor invocation.
+
+ // Step 1) Map type arguments and normal arguments from caller to callee.
+ for (int i = 0; i < klass.typeParameters.length; i++) {
+ env.addTypeParameterValue(klass.typeParameters[i], typeArguments[i]);
+ }
+ for (int i = 0; i < function.positionalParameters.length; i++) {
+ final VariableDeclaration parameter =
+ function.positionalParameters[i];
+ final Constant value = (i < positionalArguments.length)
+ ? positionalArguments[i]
+ : _evaluateSubexpression(parameter.initializer);
+ env.addVariableValue(parameter, value);
+ }
+ for (final VariableDeclaration parameter in function.namedParameters) {
+ final Constant value = namedArguments[parameter.name] ??
+ _evaluateSubexpression(parameter.initializer);
+ env.addVariableValue(parameter, value);
+ }
+
+ // Step 2) Run all initializers (including super calls) with environment setup.
+ for (final Field field in klass.fields) {
+ if (!field.isStatic) {
+ instanceBuilder.setFieldValue(
+ field, _evaluateSubexpression(field.initializer));
+ }
+ }
+ for (final Initializer init in constructor.initializers) {
+ if (init is FieldInitializer) {
+ instanceBuilder.setFieldValue(
+ init.field, _evaluateSubexpression(init.value));
+ } else if (init is LocalInitializer) {
+ final VariableDeclaration variable = init.variable;
+ env.addVariableValue(
+ variable, _evaluateSubexpression(variable.initializer));
+ } else if (init is SuperInitializer) {
+ handleConstructorInvocation(
+ init.target,
+ evaluateSuperTypeArguments(
+ init, constructor.enclosingClass.supertype),
+ evaluatePositionalArguments(init.arguments),
+ evaluateNamedArguments(init.arguments));
+ } else if (init is RedirectingInitializer) {
+ // Since a redirecting constructor targets a constructor of the same
+ // class, we pass the same [typeArguments].
+ handleConstructorInvocation(
+ init.target,
+ typeArguments,
+ evaluatePositionalArguments(init.arguments),
+ evaluateNamedArguments(init.arguments));
+ } else if (init is AssertInitializer) {
+ checkAssert(init.statement);
+ } else {
+ return reportInvalid(
+ constructor,
+ 'No support for handling initializer of type '
+ '"${init.runtimeType}".');
+ }
+ }
+ });
+ });
+ }
+
+ void checkAssert(AssertStatement statement) {
+ if (enableAsserts) {
+ final Constant condition = _evaluateSubexpression(statement.condition);
+
+ if (shouldBeUnevaluated) {
+ Expression message = null;
+ if (statement.message != null) {
+ enterLazy();
+ message = extract(_evaluateSubexpression(statement.message));
+ leaveLazy();
+ }
+ instanceBuilder.asserts.add(new AssertStatement(extract(condition),
+ message: message,
+ conditionStartOffset: statement.conditionStartOffset,
+ conditionEndOffset: statement.conditionEndOffset));
+ } else if (condition is BoolConstant) {
+ if (!condition.value) {
+ if (statement.message == null) {
+ report(statement.condition, messageConstEvalFailedAssertion);
+ }
+ final Constant message = _evaluateSubexpression(statement.message);
+ if (shouldBeUnevaluated) {
+ instanceBuilder.asserts.add(new AssertStatement(extract(condition),
+ message: extract(message),
+ conditionStartOffset: statement.conditionStartOffset,
+ conditionEndOffset: statement.conditionEndOffset));
+ } else if (message is StringConstant) {
+ report(
+ statement.condition,
+ templateConstEvalFailedAssertionWithMessage
+ .withArguments(message.value));
+ } else {
+ report(
+ statement.message,
+ templateConstEvalInvalidType.withArguments(
+ message,
+ typeEnvironment.stringType,
+ message.getType(typeEnvironment)));
+ }
+ }
+ } else {
+ report(
+ statement.condition,
+ templateConstEvalInvalidType.withArguments(condition,
+ typeEnvironment.boolType, condition.getType(typeEnvironment)));
+ }
+ }
+ }
+
+ visitInvalidExpression(InvalidExpression node) {
+ return reportInvalid(node, node.message);
+ }
+
+ visitMethodInvocation(MethodInvocation node) {
+ // We have no support for generic method invocation atm.
+ assert(node.arguments.named.isEmpty);
+
+ final Constant receiver = _evaluateSubexpression(node.receiver);
+ final List<Constant> arguments =
+ evaluatePositionalArguments(node.arguments);
+
+ if (shouldBeUnevaluated) {
+ return unevaluated(
+ node,
+ new MethodInvocation(extract(receiver), node.name,
+ unevaluatedArguments(arguments, {}, node.arguments.types)));
+ }
+
+ // Handle == and != first (it's common between all types). Since `a != b` is
+ // parsed as `!(a == b)` it is handled implicitly through ==.
+ if (arguments.length == 1 && node.name.name == '==') {
+ final right = arguments[0];
+
+ // [DoubleConstant] uses [identical] to determine equality, so we need two
+ // special cases:
+ // Two NaNs are always unequal even if [identical] returns `true`.
+ if (isNaN(receiver) || isNaN(right)) {
+ return falseConstant;
+ }
+
+ // Two zero values are always equal regardless of sign.
+ if (isZero(receiver)) {
+ return makeBoolConstant(isZero(right));
+ }
+
+ if (receiver is NullConstant ||
+ receiver is BoolConstant ||
+ receiver is IntConstant ||
+ receiver is DoubleConstant ||
+ receiver is StringConstant ||
+ right is NullConstant) {
+ return makeBoolConstant(receiver == right);
+ } else {
+ return report(
+ node,
+ templateConstEvalInvalidEqualsOperandType.withArguments(
+ receiver, receiver.getType(typeEnvironment)));
+ }
+ }
+
+ // This is a white-listed set of methods we need to support on constants.
+ if (receiver is StringConstant) {
+ if (arguments.length == 1) {
+ switch (node.name.name) {
+ case '+':
+ final Constant other = arguments[0];
+ if (other is StringConstant) {
+ return canonicalize(
+ new StringConstant(receiver.value + other.value));
+ }
+ return report(
+ node,
+ templateConstEvalInvalidBinaryOperandType.withArguments(
+ '+',
+ receiver,
+ typeEnvironment.stringType,
+ other.getType(typeEnvironment)));
+ }
+ }
+ } else if (receiver is IntConstant || receiver is JavaScriptIntConstant) {
+ if (arguments.length == 0) {
+ switch (node.name.name) {
+ case 'unary-':
+ if (targetingJavaScript) {
+ BigInt value = (receiver as JavaScriptIntConstant).bigIntValue;
+ if (value == BigInt.zero) {
+ return canonicalize(new DoubleConstant(-0.0));
+ }
+ return canonicalize(new JavaScriptIntConstant.fromBigInt(-value));
+ }
+ int value = (receiver as IntConstant).value;
+ return canonicalize(new IntConstant(-value));
+ case '~':
+ if (targetingJavaScript) {
+ BigInt value = (receiver as JavaScriptIntConstant).bigIntValue;
+ return canonicalize(new JavaScriptIntConstant.fromBigInt(
+ (~value).toUnsigned(32)));
+ }
+ int value = (receiver as IntConstant).value;
+ return canonicalize(new IntConstant(~value));
+ }
+ } else if (arguments.length == 1) {
+ final Constant other = arguments[0];
+ final op = node.name.name;
+ if (other is IntConstant || other is JavaScriptIntConstant) {
+ if ((op == '<<' || op == '>>' || op == '>>>')) {
+ var receiverValue = receiver is IntConstant
+ ? receiver.value
+ : (receiver as JavaScriptIntConstant).bigIntValue;
+ int otherValue = other is IntConstant
+ ? other.value
+ : (other as JavaScriptIntConstant).bigIntValue.toInt();
+ if (otherValue < 0) {
+ return report(
+ node.arguments.positional.first,
+ // TODO(askesc): Change argument types in template to constants.
+ templateConstEvalNegativeShift.withArguments(
+ op, '${receiverValue}', '${otherValue}'));
+ }
+ }
+
+ if ((op == '%' || op == '~/')) {
+ var receiverValue = receiver is IntConstant
+ ? receiver.value
+ : (receiver as JavaScriptIntConstant).bigIntValue;
+ int otherValue = other is IntConstant
+ ? other.value
+ : (other as JavaScriptIntConstant).bigIntValue.toInt();
+ if (otherValue == 0) {
+ return report(
+ node.arguments.positional.first,
+ // TODO(askesc): Change argument type in template to constant.
+ templateConstEvalZeroDivisor.withArguments(
+ op, '${receiverValue}'));
+ }
+ }
+
+ switch (op) {
+ case '|':
+ case '&':
+ case '^':
+ int receiverValue = receiver is IntConstant
+ ? receiver.value
+ : (receiver as JavaScriptIntConstant)
+ .bigIntValue
+ .toUnsigned(32)
+ .toInt();
+ int otherValue = other is IntConstant
+ ? other.value
+ : (other as JavaScriptIntConstant)
+ .bigIntValue
+ .toUnsigned(32)
+ .toInt();
+ return evaluateBinaryBitOperation(
+ node.name.name, receiverValue, otherValue, node);
+ case '<<':
+ case '>>':
+ case '>>>':
+ bool negative = false;
+ int receiverValue;
+ if (receiver is IntConstant) {
+ receiverValue = receiver.value;
+ } else {
+ BigInt bigIntValue =
+ (receiver as JavaScriptIntConstant).bigIntValue;
+ receiverValue = bigIntValue.toUnsigned(32).toInt();
+ negative = bigIntValue.isNegative;
+ }
+ int otherValue = other is IntConstant
+ ? other.value
+ : (other as JavaScriptIntConstant).bigIntValue.toInt();
+
+ return evaluateBinaryShiftOperation(
+ node.name.name, receiverValue, otherValue, node,
+ negativeReceiver: negative);
+ default:
+ num receiverValue = receiver is IntConstant
+ ? receiver.value
+ : (receiver as DoubleConstant).value;
+ num otherValue = other is IntConstant
+ ? other.value
+ : (other as DoubleConstant).value;
+ return evaluateBinaryNumericOperation(
+ node.name.name, receiverValue, otherValue, node);
+ }
+ } else if (other is DoubleConstant) {
+ num receiverValue = receiver is IntConstant
+ ? receiver.value
+ : (receiver as DoubleConstant).value;
+ return evaluateBinaryNumericOperation(
+ node.name.name, receiverValue, other.value, node);
+ }
+ return report(
+ node,
+ templateConstEvalInvalidBinaryOperandType.withArguments(
+ node.name.name,
+ receiver,
+ typeEnvironment.numType,
+ other.getType(typeEnvironment)));
+ }
+ } else if (receiver is DoubleConstant) {
+ if (arguments.length == 0) {
+ switch (node.name.name) {
+ case 'unary-':
+ return canonicalize(makeDoubleConstant(-receiver.value));
+ }
+ } else if (arguments.length == 1) {
+ final Constant other = arguments[0];
+
+ if (other is IntConstant || other is DoubleConstant) {
+ final num value = (other is IntConstant)
+ ? other.value
+ : (other as DoubleConstant).value;
+ return evaluateBinaryNumericOperation(
+ node.name.name, receiver.value, value, node);
+ }
+ return report(
+ node,
+ templateConstEvalInvalidBinaryOperandType.withArguments(
+ node.name.name,
+ receiver,
+ typeEnvironment.numType,
+ other.getType(typeEnvironment)));
+ }
+ } else if (receiver is BoolConstant) {
+ if (arguments.length == 1) {
+ final Constant other = arguments[0];
+ if (other is BoolConstant) {
+ switch (node.name.name) {
+ case '|':
+ return canonicalize(
+ new BoolConstant(receiver.value || other.value));
+ case '&':
+ return canonicalize(
+ new BoolConstant(receiver.value && other.value));
+ case '^':
+ return canonicalize(
+ new BoolConstant(receiver.value != other.value));
+ }
+ }
+ }
+ } else if (receiver is NullConstant) {
+ return report(node, messageConstEvalNullValue);
+ }
+
+ return report(
+ node,
+ templateConstEvalInvalidMethodInvocation.withArguments(
+ node.name.name, receiver));
+ }
+
+ visitLogicalExpression(LogicalExpression node) {
+ final Constant left = _evaluateSubexpression(node.left);
+ if (shouldBeUnevaluated) {
+ enterLazy();
+ Constant right = _evaluateSubexpression(node.right);
+ leaveLazy();
+ return unevaluated(node,
+ new LogicalExpression(extract(left), node.operator, extract(right)));
+ }
+ switch (node.operator) {
+ case '||':
+ if (left is BoolConstant) {
+ if (left.value) return trueConstant;
+
+ final Constant right = _evaluateSubexpression(node.right);
+ if (right is BoolConstant || right is UnevaluatedConstant) {
+ return right;
+ }
+
+ return report(
+ node,
+ templateConstEvalInvalidBinaryOperandType.withArguments(
+ node.operator,
+ left,
+ typeEnvironment.boolType,
+ right.getType(typeEnvironment)));
+ }
+ return report(
+ node,
+ templateConstEvalInvalidMethodInvocation.withArguments(
+ node.operator, left));
+ case '&&':
+ if (left is BoolConstant) {
+ if (!left.value) return falseConstant;
+
+ final Constant right = _evaluateSubexpression(node.right);
+ if (right is BoolConstant || right is UnevaluatedConstant) {
+ return right;
+ }
+
+ return report(
+ node,
+ templateConstEvalInvalidBinaryOperandType.withArguments(
+ node.operator,
+ left,
+ typeEnvironment.boolType,
+ right.getType(typeEnvironment)));
+ }
+ return report(
+ node,
+ templateConstEvalInvalidMethodInvocation.withArguments(
+ node.operator, left));
+ case '??':
+ return (left is! NullConstant)
+ ? left
+ : _evaluateSubexpression(node.right);
+ default:
+ return report(
+ node,
+ templateConstEvalInvalidMethodInvocation.withArguments(
+ node.operator, left));
+ }
+ }
+
+ visitConditionalExpression(ConditionalExpression node) {
+ final Constant condition = _evaluateSubexpression(node.condition);
+ if (condition == trueConstant) {
+ return _evaluateSubexpression(node.then);
+ } else if (condition == falseConstant) {
+ return _evaluateSubexpression(node.otherwise);
+ } else if (shouldBeUnevaluated) {
+ enterLazy();
+ Constant then = _evaluateSubexpression(node.then);
+ Constant otherwise = _evaluateSubexpression(node.otherwise);
+ leaveLazy();
+ return unevaluated(
+ node,
+ new ConditionalExpression(extract(condition), extract(then),
+ extract(otherwise), node.staticType));
+ } else {
+ return report(
+ node,
+ templateConstEvalInvalidType.withArguments(condition,
+ typeEnvironment.boolType, condition.getType(typeEnvironment)));
+ }
+ }
+
+ visitPropertyGet(PropertyGet node) {
+ if (node.receiver is ThisExpression) {
+ // Access "this" during instance creation.
+ if (instanceBuilder == null) {
+ return reportInvalid(node, 'Instance field access outside constructor');
+ }
+ for (final Field field in instanceBuilder.fields.keys) {
+ if (field.name == node.name) {
+ return instanceBuilder.fields[field];
+ }
+ }
+ return reportInvalid(node,
+ 'Could not evaluate field get ${node.name} on incomplete instance');
+ }
+
+ final Constant receiver = _evaluateSubexpression(node.receiver);
+ if (receiver is StringConstant && node.name.name == 'length') {
+ if (targetingJavaScript) {
+ return canonicalize(new JavaScriptIntConstant(receiver.value.length));
+ }
+ return canonicalize(new IntConstant(receiver.value.length));
+ } else if (shouldBeUnevaluated) {
+ return unevaluated(node,
+ new PropertyGet(extract(receiver), node.name, node.interfaceTarget));
+ } else if (receiver is NullConstant) {
+ return report(node, messageConstEvalNullValue);
+ }
+ return report(
+ node,
+ templateConstEvalInvalidPropertyGet.withArguments(
+ node.name.name, receiver));
+ }
+
+ visitLet(Let node) {
+ env.addVariableValue(
+ node.variable, _evaluateSubexpression(node.variable.initializer));
+ return _evaluateSubexpression(node.body);
+ }
+
+ visitVariableGet(VariableGet node) {
+ // Not every variable which a [VariableGet] refers to must be marked as
+ // constant. For example function parameters as well as constructs
+ // desugared to [Let] expressions are ok.
+ //
+ // TODO(kustermann): The heuristic of allowing all [VariableGet]s on [Let]
+ // variables might allow more than it should.
+ final VariableDeclaration variable = node.variable;
+ if (variable.parent is Let || _isFormalParameter(variable)) {
+ return env.lookupVariable(node.variable) ??
+ report(
+ node,
+ templateConstEvalNonConstantVariableGet
+ .withArguments(variable.name));
+ }
+ if (variable.isConst) {
+ return _evaluateSubexpression(variable.initializer);
+ }
+ return reportInvalid(node, 'Variable get of a non-const variable.');
+ }
+
+ visitStaticGet(StaticGet node) {
+ return withNewEnvironment(() {
+ final Member target = node.target;
+ if (target is Field) {
+ if (target.isConst) {
+ if (target.isInExternalLibrary && target.initializer == null) {
+ // The variable is unavailable due to separate compilation.
+ return unevaluated(node, new StaticGet(target));
+ }
+ return runInsideContext(target, () {
+ return _evaluateSubexpression(target.initializer);
+ });
+ }
+ return report(
+ node,
+ templateConstEvalInvalidStaticInvocation
+ .withArguments(target.name.name));
+ } else if (target is Procedure) {
+ if (target.kind == ProcedureKind.Method) {
+ return canonicalize(new TearOffConstant(target));
+ }
+ return report(
+ node,
+ templateConstEvalInvalidStaticInvocation
+ .withArguments(target.name.name));
+ } else {
+ reportInvalid(
+ node, 'No support for ${target.runtimeType} in a static-get.');
+ }
+ });
+ }
+
+ visitStringConcatenation(StringConcatenation node) {
+ final List<Object> concatenated = <Object>[new StringBuffer()];
+ for (int i = 0; i < node.expressions.length; i++) {
+ Constant constant = _evaluateSubexpression(node.expressions[i]);
+ if (constant is PrimitiveConstant<Object>) {
+ String value = constant.toString();
+ Object last = concatenated.last;
+ if (last is StringBuffer) {
+ last.write(value);
+ } else {
+ concatenated.add(new StringBuffer(value));
+ }
+ } else if (shouldBeUnevaluated) {
+ // The constant is either unevaluated or a non-primitive in an
+ // unevaluated context. In both cases we defer the evaluation and/or
+ // error reporting till later.
+ concatenated.add(constant);
+ } else {
+ return report(
+ node,
+ templateConstEvalInvalidStringInterpolationOperand
+ .withArguments(constant));
+ }
+ }
+ if (concatenated.length > 1) {
+ final expressions = new List<Expression>(concatenated.length);
+ for (int i = 0; i < concatenated.length; i++) {
+ Object value = concatenated[i];
+ if (value is StringBuffer) {
+ expressions[i] = new ConstantExpression(
+ canonicalize(new StringConstant(value.toString())));
+ } else {
+ // The value is either unevaluated constant or a non-primitive
+ // constant in an unevaluated expression.
+ expressions[i] = extract(value);
+ }
+ }
+ return unevaluated(node, new StringConcatenation(expressions));
+ }
+ return canonicalize(new StringConstant(concatenated.single.toString()));
+ }
+
+ visitStaticInvocation(StaticInvocation node) {
+ final Procedure target = node.target;
+ final Arguments arguments = node.arguments;
+ final positionals = evaluatePositionalArguments(arguments);
+ final named = evaluateNamedArguments(arguments);
+ if (shouldBeUnevaluated) {
+ return unevaluated(
+ node,
+ new StaticInvocation(
+ target, unevaluatedArguments(positionals, named, arguments.types),
+ isConst: true));
+ }
+ if (target.kind == ProcedureKind.Factory) {
+ if (target.isConst &&
+ target.name.name == "fromEnvironment" &&
+ target.enclosingLibrary == coreTypes.coreLibrary &&
+ positionals.length == 1) {
+ if (environmentDefines != null) {
+ // Evaluate environment constant.
+ Constant name = positionals.single;
+ if (name is StringConstant) {
+ String value = environmentDefines[name.value];
+ Constant defaultValue = named["defaultValue"];
+
+ if (target.enclosingClass == coreTypes.boolClass) {
+ Constant boolConstant = value == "true"
+ ? trueConstant
+ : value == "false"
+ ? falseConstant
+ : defaultValue is BoolConstant
+ ? makeBoolConstant(defaultValue.value)
+ : defaultValue is NullConstant
+ ? nullConstant
+ : falseConstant;
+ return boolConstant;
+ } else if (target.enclosingClass == coreTypes.intClass) {
+ int intValue = value != null ? int.tryParse(value) : null;
+ intValue ??= defaultValue is IntConstant
+ ? defaultValue.value
+ : defaultValue is JavaScriptIntConstant
+ ? defaultValue.bigIntValue.toInt()
+ : null;
+ if (intValue == null) return nullConstant;
+ if (targetingJavaScript) {
+ return canonicalize(new JavaScriptIntConstant(intValue));
+ }
+ return canonicalize(new IntConstant(intValue));
+ } else if (target.enclosingClass == coreTypes.stringClass) {
+ value ??=
+ defaultValue is StringConstant ? defaultValue.value : null;
+ if (value == null) return nullConstant;
+ return canonicalize(new StringConstant(value));
+ }
+ } else if (name is NullConstant) {
+ return report(node, messageConstEvalNullValue);
+ }
+ } else {
+ // Leave environment constant unevaluated.
+ return unevaluated(
+ node,
+ new StaticInvocation(target,
+ unevaluatedArguments(positionals, named, arguments.types),
+ isConst: true));
+ }
+ }
+ } else if (target.name.name == 'identical') {
+ // Ensure the "identical()" function comes from dart:core.
+ final parent = target.parent;
+ if (parent is Library && parent == coreTypes.coreLibrary) {
+ final Constant left = positionals[0];
+ final Constant right = positionals[1];
+
+ if (targetingJavaScript) {
+ // In JavaScript, we lower [identical] to `===`, so any comparison
+ // against NaN yields `false`.
+ if (isNaN(left) || isNaN(right)) {
+ return falseConstant;
+ }
+
+ // In JavaScript, `-0.0 === 0.0`.
+ if (isZero(left)) {
+ return makeBoolConstant(isZero(right));
+ }
+ }
+
+ // Since we canonicalize constants during the evaluation, we can use
+ // identical here.
+ return makeBoolConstant(identical(left, right));
+ }
+ }
+
+ // TODO(kmillikin) For an invalid factory invocation we should adopt a
+ // better message. This will show something like:
+ //
+ // "The invocation of 'List' is not allowed within a const context."
+ //
+ // Which is not quite right when the code was "new List()".
+ String name = target.name.name;
+ if (target is Procedure && target.isFactory) {
+ if (name.isEmpty) {
+ name = target.enclosingClass.name;
+ } else {
+ name = '${target.enclosingClass.name}.${name}';
+ }
+ }
+ return report(
+ node, templateConstEvalInvalidStaticInvocation.withArguments(name));
+ }
+
+ visitAsExpression(AsExpression node) {
+ final Constant constant = _evaluateSubexpression(node.operand);
+ if (shouldBeUnevaluated) {
+ return unevaluated(node,
+ new AsExpression(extract(constant), env.subsituteType(node.type)));
+ }
+ return ensureIsSubtype(constant, evaluateDartType(node, node.type), node);
+ }
+
+ visitIsExpression(IsExpression node) {
+ final Constant constant = node.operand.accept(this);
+ if (shouldBeUnevaluated) {
+ return unevaluated(node, new IsExpression(extract(constant), node.type));
+ }
+ if (constant is NullConstant) {
+ return makeBoolConstant(node.type == typeEnvironment.nullType ||
+ node.type == typeEnvironment.objectType ||
+ node.type is DynamicType);
+ }
+ return makeBoolConstant(
+ isSubtype(constant, evaluateDartType(node, node.type)));
+ }
+
+ visitNot(Not node) {
+ final Constant constant = _evaluateSubexpression(node.operand);
+ if (constant is BoolConstant) {
+ return makeBoolConstant(constant != trueConstant);
+ }
+ if (shouldBeUnevaluated) {
+ return unevaluated(node, new Not(extract(constant)));
+ }
+ return report(
+ node,
+ templateConstEvalInvalidType.withArguments(constant,
+ typeEnvironment.boolType, constant.getType(typeEnvironment)));
+ }
+
+ visitSymbolLiteral(SymbolLiteral node) {
+ final libraryReference =
+ node.value.startsWith('_') ? libraryOf(node).reference : null;
+ return canonicalize(new SymbolConstant(node.value, libraryReference));
+ }
+
+ visitInstantiation(Instantiation node) {
+ final Constant constant = _evaluateSubexpression(node.expression);
+ if (shouldBeUnevaluated) {
+ return unevaluated(
+ node,
+ new Instantiation(extract(constant),
+ node.typeArguments.map((t) => env.subsituteType(t)).toList()));
+ }
+ if (constant is TearOffConstant) {
+ if (node.typeArguments.length ==
+ constant.procedure.function.typeParameters.length) {
+ final typeArguments = evaluateDartTypes(node, node.typeArguments);
+ return canonicalize(
+ new PartialInstantiationConstant(constant, typeArguments));
+ }
+ return reportInvalid(
+ node,
+ 'The number of type arguments supplied in the partial instantiation '
+ 'does not match the number of type arguments of the $constant.');
+ }
+ // The inner expression in an instantiation can never be null, since
+ // instantiations are only inferred on direct references to declarations.
+ return reportInvalid(
+ node, 'Only tear-off constants can be partially instantiated.');
+ }
+
+ @override
+ visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) {
+ return report(
+ node, templateConstEvalDeferredLibrary.withArguments(node.import.name));
+ }
+
+ // Helper methods:
+
+ bool isZero(Constant value) =>
+ (value is IntConstant && value.value == 0) ||
+ (value is JavaScriptIntConstant && value.bigIntValue == BigInt.zero) ||
+ (value is DoubleConstant && value.value == 0);
+
+ bool isNaN(Constant value) => value is DoubleConstant && value.value.isNaN;
+
+ bool hasPrimitiveEqual(Constant constant) {
+ // TODO(askesc, fishythefish): Make sure the correct class is inferred
+ // when we clean up JavaScript int constant handling.
+ DartType type = constant.getType(typeEnvironment);
+ return !(type is InterfaceType && !classHasPrimitiveEqual(type.classNode));
+ }
+
+ bool classHasPrimitiveEqual(Class klass) {
+ bool cached = primitiveEqualCache[klass];
+ if (cached != null) return cached;
+ for (Procedure procedure in klass.procedures) {
+ if (procedure.kind == ProcedureKind.Operator &&
+ procedure.name.name == '==' &&
+ !procedure.isAbstract &&
+ !procedure.isForwardingStub) {
+ return primitiveEqualCache[klass] = false;
+ }
+ }
+ if (klass.supertype == null) return true; // To be on the safe side
+ return primitiveEqualCache[klass] =
+ classHasPrimitiveEqual(klass.supertype.classNode);
+ }
+
+ BoolConstant makeBoolConstant(bool value) =>
+ value ? trueConstant : falseConstant;
+
+ DoubleConstant makeDoubleConstant(double value) {
+ if (targetingJavaScript) {
+ // Convert to an integer when possible (matching the runtime behavior
+ // of `is int`).
+ if (value.isFinite && !identical(value, -0.0)) {
+ var i = value.toInt();
+ if (value == i.toDouble()) return new JavaScriptIntConstant(i);
+ }
+ }
+ return new DoubleConstant(value);
+ }
+
+ bool isSubtype(Constant constant, DartType type) {
+ DartType constantType = constant.getType(typeEnvironment);
+ if (targetingJavaScript) {
+ if (constantType == typeEnvironment.intType &&
+ type == typeEnvironment.doubleType) {
+ // With JS semantics, an integer is also a double.
+ return true;
+ }
+
+ if (constantType == typeEnvironment.doubleType &&
+ type == typeEnvironment.intType) {
+ double value = (constant as DoubleConstant).value;
+ if (value.isFinite && value == value.truncateToDouble()) {
+ return true;
+ }
+ }
+ }
+ return typeEnvironment.isSubtypeOf(constantType, type);
+ }
+
+ Constant ensureIsSubtype(Constant constant, DartType type, TreeNode node) {
+ if (!isSubtype(constant, type)) {
+ return report(
+ node,
+ templateConstEvalInvalidType.withArguments(
+ constant, type, constant.getType(typeEnvironment)));
+ }
+ return constant;
+ }
+
+ List<DartType> evaluateTypeArguments(TreeNode node, Arguments arguments) {
+ return evaluateDartTypes(node, arguments.types);
+ }
+
+ List<DartType> evaluateSuperTypeArguments(TreeNode node, Supertype type) {
+ return evaluateDartTypes(node, type.typeArguments);
+ }
+
+ List<DartType> evaluateDartTypes(TreeNode node, List<DartType> types) {
+ // TODO: Once the frontend gurantees that there are no free type variables
+ // left over after stubstitution, we can enable this shortcut again:
+ // if (env.isEmpty) return types;
+ return types.map((t) => evaluateDartType(node, t)).toList();
+ }
+
+ DartType evaluateDartType(TreeNode node, DartType type) {
+ final result = env.subsituteType(type);
+
+ if (!isInstantiated(result)) {
+ return report(
+ node, templateConstEvalFreeTypeParameter.withArguments(type));
+ }
+
+ return result;
+ }
+
+ List<Constant> evaluatePositionalArguments(Arguments arguments) {
+ return arguments.positional.map((Expression node) {
+ return _evaluateSubexpression(node);
+ }).toList();
+ }
+
+ Map<String, Constant> evaluateNamedArguments(Arguments arguments) {
+ if (arguments.named.isEmpty) return const <String, Constant>{};
+
+ final Map<String, Constant> named = {};
+ arguments.named.forEach((NamedExpression pair) {
+ named[pair.name] = _evaluateSubexpression(pair.value);
+ });
+ return named;
+ }
+
+ Arguments unevaluatedArguments(List<Constant> positionalArgs,
+ Map<String, Constant> namedArgs, List<DartType> types) {
+ final positional = new List<Expression>(positionalArgs.length);
+ final named = new List<NamedExpression>(namedArgs.length);
+ for (int i = 0; i < positionalArgs.length; ++i) {
+ positional[i] = extract(positionalArgs[i]);
+ }
+ int i = 0;
+ namedArgs.forEach((String name, Constant value) {
+ named[i++] = new NamedExpression(name, extract(value));
+ });
+ return new Arguments(positional, named: named, types: types);
+ }
+
+ Constant canonicalize(Constant constant) {
+ return canonicalizationCache.putIfAbsent(constant, () => constant);
+ }
+
+ withNewInstanceBuilder(Class klass, List<DartType> typeArguments, fn()) {
+ InstanceBuilder old = instanceBuilder;
+ try {
+ instanceBuilder = new InstanceBuilder(this, klass, typeArguments);
+ return fn();
+ } finally {
+ instanceBuilder = old;
+ }
+ }
+
+ withNewEnvironment(fn()) {
+ final EvaluationEnvironment oldEnv = env;
+ try {
+ env = new EvaluationEnvironment();
+ return fn();
+ } finally {
+ env = oldEnv;
+ }
+ }
+
+ Constant evaluateBinaryBitOperation(String op, int a, int b, TreeNode node) {
+ int result;
+ switch (op) {
+ case '|':
+ result = a | b;
+ break;
+ case '&':
+ result = a & b;
+ break;
+ case '^':
+ result = a ^ b;
+ break;
+ }
+
+ if (targetingJavaScript) {
+ return canonicalize(new JavaScriptIntConstant(result));
+ }
+ return canonicalize(new IntConstant(result));
+ }
+
+ Constant evaluateBinaryShiftOperation(String op, int a, int b, TreeNode node,
+ {negativeReceiver: false}) {
+ int result;
+ switch (op) {
+ case '<<':
+ result = a << b;
+ break;
+ case '>>':
+ if (targetingJavaScript) {
+ if (negativeReceiver) {
+ const signBit = 0x80000000;
+ a -= (a & signBit) << 1;
+ }
+ result = a >> b;
+ } else {
+ result = a >> b;
+ }
+ break;
+ case '>>>':
+ // TODO(fishythefish): Implement JS semantics for `>>>`.
+ result = b >= 64 ? 0 : (a >> b) & ((1 << (64 - b)) - 1);
+ break;
+ }
+
+ if (targetingJavaScript) {
+ return canonicalize(new JavaScriptIntConstant(result.toUnsigned(32)));
+ }
+ return canonicalize(new IntConstant(result));
+ }
+
+ Constant evaluateBinaryNumericOperation(
+ String op, num a, num b, TreeNode node) {
+ num result;
+ switch (op) {
+ case '+':
+ result = a + b;
+ break;
+ case '-':
+ result = a - b;
+ break;
+ case '*':
+ result = a * b;
+ break;
+ case '/':
+ result = a / b;
+ break;
+ case '~/':
+ result = a ~/ b;
+ break;
+ case '%':
+ result = a % b;
+ break;
+ }
+
+ if (result is int) {
+ if (targetingJavaScript) {
+ return canonicalize(new JavaScriptIntConstant(result));
+ }
+ return canonicalize(new IntConstant(result.toSigned(64)));
+ }
+ if (result is double) {
+ return canonicalize(makeDoubleConstant(result));
+ }
+
+ switch (op) {
+ case '<':
+ return makeBoolConstant(a < b);
+ case '<=':
+ return makeBoolConstant(a <= b);
+ case '>=':
+ return makeBoolConstant(a >= b);
+ case '>':
+ return makeBoolConstant(a > b);
+ }
+
+ return reportInvalid(node, "Unexpected binary numeric operation '$op'.");
+ }
+
+ Library libraryOf(TreeNode node) {
+ // The tree structure of the kernel AST ensures we always have an enclosing
+ // library.
+ while (true) {
+ if (node is Library) return node;
+ node = node.parent;
+ }
+ }
+}
+
+/// Holds the necessary information for a constant object, namely
+/// * the [klass] being instantiated
+/// * the [typeArguments] used for the instantiation
+/// * the [fields] the instance will obtain (all fields from the
+/// instantiated [klass] up to the [Object] klass).
+class InstanceBuilder {
+ ConstantEvaluator evaluator;
+
+ /// The class of the new instance.
+ final Class klass;
+
+ /// The values of the type parameters of the new instance.
+ final List<DartType> typeArguments;
+
+ /// The field values of the new instance.
+ final Map<Field, Constant> fields = <Field, Constant>{};
+
+ final List<AssertStatement> asserts = <AssertStatement>[];
+
+ InstanceBuilder(this.evaluator, this.klass, this.typeArguments);
+
+ void setFieldValue(Field field, Constant constant) {
+ fields[field] = constant;
+ }
+
+ InstanceConstant buildInstance() {
+ assert(asserts.isEmpty);
+ final Map<Reference, Constant> fieldValues = <Reference, Constant>{};
+ fields.forEach((Field field, Constant value) {
+ assert(value is! UnevaluatedConstant);
+ fieldValues[field.reference] = value;
+ });
+ return new InstanceConstant(klass.reference, typeArguments, fieldValues);
+ }
+
+ InstanceCreation buildUnevaluatedInstance() {
+ final Map<Reference, Expression> fieldValues = <Reference, Expression>{};
+ fields.forEach((Field field, Constant value) {
+ fieldValues[field.reference] = evaluator.extract(value);
+ });
+ return new InstanceCreation(
+ klass.reference, typeArguments, fieldValues, asserts);
+ }
+}
+
+/// Holds an environment of type parameters, parameters and variables.
+class EvaluationEnvironment {
+ /// The values of the type parameters in scope.
+ final Map<TypeParameter, DartType> _typeVariables =
+ <TypeParameter, DartType>{};
+
+ /// The values of the parameters/variables in scope.
+ final Map<VariableDeclaration, Constant> _variables =
+ <VariableDeclaration, Constant>{};
+
+ /// Whether the current environment is empty.
+ bool get isEmpty => _typeVariables.isEmpty && _variables.isEmpty;
+
+ void addTypeParameterValue(TypeParameter parameter, DartType value) {
+ assert(!_typeVariables.containsKey(parameter));
+ _typeVariables[parameter] = value;
+ }
+
+ void addVariableValue(VariableDeclaration variable, Constant value) {
+ _variables[variable] = value;
+ }
+
+ DartType lookupParameterValue(TypeParameter parameter) {
+ final DartType value = _typeVariables[parameter];
+ assert(value != null);
+ return value;
+ }
+
+ Constant lookupVariable(VariableDeclaration variable) {
+ return _variables[variable];
+ }
+
+ DartType subsituteType(DartType type) {
+ if (_typeVariables.isEmpty) return type;
+ return substitute(type, _typeVariables);
+ }
+}
+
+// Used as control-flow to abort the current evaluation.
+class _AbortDueToError {
+ final TreeNode node;
+ final Message message;
+ final List<LocatedMessage> context;
+
+ _AbortDueToError(this.node, this.message, {this.context});
+}
+
+class _AbortDueToInvalidExpression {
+ final TreeNode node;
+ final String message;
+
+ _AbortDueToInvalidExpression(this.node, this.message);
+}
+
+abstract class ErrorReporter {
+ const ErrorReporter();
+
+ void report(LocatedMessage message, List<LocatedMessage> context);
+
+ void reportInvalidExpression(InvalidExpression node);
+}
+
+class SimpleErrorReporter implements ErrorReporter {
+ const SimpleErrorReporter();
+
+ @override
+ void report(LocatedMessage message, List<LocatedMessage> context) {
+ _report(message);
+ for (LocatedMessage contextMessage in context) {
+ _report(contextMessage);
+ }
+ }
+
+ @override
+ void reportInvalidExpression(InvalidExpression node) {
+ // Ignored
+ }
+
+ void _report(LocatedMessage message) {
+ reportMessage(message.uri, message.charOffset, message.message);
+ }
+
+ void reportMessage(Uri uri, int offset, String message) {
+ io.exitCode = 42;
+ io.stderr.writeln('$uri:$offset Constant evaluation error: $message');
+ }
+}
+
+class IsInstantiatedVisitor extends DartTypeVisitor<bool> {
+ final _availableVariables = new Set<TypeParameter>();
+
+ bool isInstantiated(DartType type) {
+ return type.accept(this);
+ }
+
+ bool defaultDartType(DartType node) {
+ throw 'A visitor method seems to be unimplemented!';
+ }
+
+ bool visitInvalidType(InvalidType node) => true;
+ bool visitDynamicType(DynamicType node) => true;
+ bool visitVoidType(VoidType node) => true;
+ bool visitBottomType(BottomType node) => true;
+
+ bool visitTypeParameterType(TypeParameterType node) {
+ return _availableVariables.contains(node.parameter);
+ }
+
+ bool visitInterfaceType(InterfaceType node) {
+ return node.typeArguments
+ .every((DartType typeArgument) => typeArgument.accept(this));
+ }
+
+ bool visitFunctionType(FunctionType node) {
+ final parameters = node.typeParameters;
+ _availableVariables.addAll(parameters);
+ final bool result = node.returnType.accept(this) &&
+ node.positionalParameters.every((p) => p.accept(this)) &&
+ node.namedParameters.every((p) => p.type.accept(this));
+ _availableVariables.removeAll(parameters);
+ return result;
+ }
+
+ bool visitTypedefType(TypedefType node) {
+ return node.unalias.accept(this);
+ }
+}
+
+bool _isFormalParameter(VariableDeclaration variable) {
+ final parent = variable.parent;
+ if (parent is FunctionNode) {
+ return parent.positionalParameters.contains(variable) ||
+ parent.namedParameters.contains(variable);
+ }
+ return false;
+}
diff --git a/front_end/lib/src/fasta/kernel/expression_generator.dart b/front_end/lib/src/fasta/kernel/expression_generator.dart
index 1434f9f..db33cf1 100644
--- a/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -40,7 +40,8 @@
mustacheName,
percentName,
plusName,
- rightShiftName;
+ rightShiftName,
+ tripleShiftName;
import '../parser.dart' show lengthForToken, lengthOfSpan, offsetForToken;
@@ -956,6 +957,9 @@
} else if (identical(">>=", assignmentOperator)) {
return generator.buildCompoundAssignment(rightShiftName, value,
offset: offsetForToken(token), voidContext: voidContext);
+ } else if (identical(">>>=", assignmentOperator)) {
+ return generator.buildCompoundAssignment(tripleShiftName, value,
+ offset: offsetForToken(token), voidContext: voidContext);
} else if (identical("??=", assignmentOperator)) {
return generator.buildNullAwareAssignment(
value, const DynamicType(), offsetForToken(token),
diff --git a/front_end/lib/src/fasta/kernel/fangorn.dart b/front_end/lib/src/fasta/kernel/fangorn.dart
index 005376d..1616ce7 100644
--- a/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -53,7 +53,15 @@
import 'body_builder.dart' show LabelTarget;
-import 'collections.dart' show IfElement, IfMapEntry, SpreadElement;
+import 'collections.dart'
+ show
+ ForElement,
+ ForInElement,
+ ForInMapEntry,
+ ForMapEntry,
+ IfElement,
+ IfMapEntry,
+ SpreadElement;
import 'kernel_expression_generator.dart'
show
@@ -297,6 +305,46 @@
}
@override
+ Expression forElement(
+ List<VariableDeclaration> variables,
+ Expression condition,
+ List<Expression> updates,
+ Expression body,
+ Token token) {
+ return new ForElement(variables, condition, updates, body)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ MapEntry forMapEntry(
+ List<VariableDeclaration> variables,
+ Expression condition,
+ List<Expression> updates,
+ MapEntry body,
+ Token token) {
+ return new ForMapEntry(variables, condition, updates, body)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ Expression forInElement(VariableDeclaration variable, Expression iterable,
+ Statement prologue, Expression body, Expression problem, Token token,
+ {bool isAsync: false}) {
+ return new ForInElement(variable, iterable, prologue, body, problem,
+ isAsync: isAsync)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ MapEntry forInMapEntry(VariableDeclaration variable, Expression iterable,
+ Statement prologue, MapEntry body, Expression problem, Token token,
+ {bool isAsync: false}) {
+ return new ForInMapEntry(variable, iterable, prologue, body, problem,
+ isAsync: isAsync)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
AssertInitializer assertInitializer(
Token assertKeyword,
Token leftParenthesis,
diff --git a/front_end/lib/src/fasta/kernel/forest.dart b/front_end/lib/src/fasta/kernel/forest.dart
index 8cf916f..818a3b1 100644
--- a/front_end/lib/src/fasta/kernel/forest.dart
+++ b/front_end/lib/src/fasta/kernel/forest.dart
@@ -196,6 +196,28 @@
MapEntry ifMapEntry(
Expression condition, MapEntry then, MapEntry otherwise, Token token);
+ Expression forElement(
+ List<VariableDeclaration> variables,
+ Expression condition,
+ List<Expression> updates,
+ Expression body,
+ Token token);
+
+ MapEntry forMapEntry(
+ List<VariableDeclaration> variables,
+ Expression condition,
+ List<Expression> updates,
+ MapEntry body,
+ Token token);
+
+ Expression forInElement(VariableDeclaration variable, Expression iterable,
+ Statement prologue, Expression body, Expression problem, Token token,
+ {bool isAsync: false});
+
+ MapEntry forInMapEntry(VariableDeclaration variable, Expression iterable,
+ Statement prologue, MapEntry body, Expression problem, Token token,
+ {bool isAsync: false});
+
/// Return a representation of an assert that appears in a constructor's
/// initializer list.
Object assertInitializer(Token assertKeyword, Token leftParenthesis,
diff --git a/front_end/lib/src/fasta/kernel/inference_visitor.dart b/front_end/lib/src/fasta/kernel/inference_visitor.dart
index a678e10..830e13a 100644
--- a/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -7,14 +7,24 @@
class InferenceVisitor extends BodyVisitor1<void, DartType> {
final ShadowTypeInferrer inferrer;
+ Class mapEntryClass;
+
+ // Stores the offset of the map entry found by inferMapEntry.
+ int mapEntryOffset = null;
+
+ // Stores the offset of the map spread found by inferMapEntry.
+ int mapSpreadOffset = null;
+
+ // Stores the offset of the iterable spread found by inferMapEntry.
+ int iterableSpreadOffset = null;
+
+ // Stores the type of the iterable spread found by inferMapEntry.
+ DartType iterableSpreadType = null;
+
InferenceVisitor(this.inferrer);
@override
void defaultExpression(Expression node, DartType typeContext) {
- if (node is IfElement) {
- visitIfElement(node, typeContext);
- return;
- }
unhandled("${node.runtimeType}", "InferenceVisitor", node.fileOffset,
inferrer.helper.uri);
}
@@ -25,11 +35,6 @@
inferrer.helper.uri);
}
- visitIfElement(IfElement node, DartType typeContext) {
- node.parent.replaceChild(node,
- new InvalidExpression('unhandled if element in collection literal'));
- }
-
@override
void visitInvalidExpression(InvalidExpression node, DartType typeContext) {}
@@ -148,10 +153,10 @@
name.length,
node.target.fileUri);
for (var declaration in node.target.function.positionalParameters) {
- declaration.type ??= const DynamicType();
+ declaration.type ??= const InvalidType();
}
for (var declaration in node.target.function.namedParameters) {
- declaration.type ??= const DynamicType();
+ declaration.type ??= const InvalidType();
}
} else if ((library = inferrer.engine.toBeInferred[node.target]) != null) {
inferrer.engine.toBeInferred.remove(node.target);
@@ -253,11 +258,12 @@
node.field.type, initializerType, node.value, node.fileOffset);
}
- void handleForInStatementDeclaringVariable(ForInStatement node) {
+ void handleForInDeclaringVariable(
+ VariableDeclaration variable, Expression iterable, Statement body,
+ {bool isAsync: false}) {
DartType elementType;
bool typeNeeded = false;
bool typeChecksNeeded = !inferrer.isTopLevel;
- final VariableDeclaration variable = node.variable;
if (VariableDeclarationJudgment.isImplicitlyTyped(variable)) {
typeNeeded = true;
elementType = const UnknownType();
@@ -265,45 +271,58 @@
elementType = variable.type;
}
- DartType inferredType =
- inferForInIterable(node, elementType, typeNeeded || typeChecksNeeded);
+ DartType inferredType = inferForInIterable(
+ iterable, elementType, typeNeeded || typeChecksNeeded,
+ isAsync: isAsync);
if (typeNeeded) {
inferrer.instrumentation?.record(inferrer.uri, variable.fileOffset,
'type', new InstrumentationValueForType(inferredType));
variable.type = inferredType;
}
- inferrer.inferStatement(node.body);
+ if (body != null) inferrer.inferStatement(body);
VariableDeclaration tempVar =
new VariableDeclaration(null, type: inferredType, isFinal: true);
VariableGet variableGet = new VariableGet(tempVar)
..fileOffset = variable.fileOffset;
+ TreeNode parent = variable.parent;
Expression implicitDowncast = inferrer.ensureAssignable(
- variable.type, inferredType, variableGet, node.fileOffset,
+ variable.type, inferredType, variableGet, parent.fileOffset,
template: templateForInLoopElementTypeNotAssignable);
if (implicitDowncast != null) {
- node.variable = tempVar..parent = node;
+ parent.replaceChild(variable, tempVar);
variable.initializer = implicitDowncast..parent = variable;
- node.body = combineStatements(variable, node.body)..parent = node;
+ if (body == null) {
+ if (parent is ForInElement) {
+ parent.prologue = variable;
+ } else if (parent is ForInMapEntry) {
+ parent.prologue = variable;
+ } else {
+ unhandled("${parent.runtimeType}", "handleForInDeclaringVariable",
+ variable.fileOffset, variable.location.file);
+ }
+ } else {
+ parent.replaceChild(body, combineStatements(variable, body));
+ }
}
}
DartType inferForInIterable(
- ForInStatement node, DartType elementType, bool typeNeeded) {
- Class iterableClass = node.isAsync
+ Expression iterable, DartType elementType, bool typeNeeded,
+ {bool isAsync: false}) {
+ Class iterableClass = isAsync
? inferrer.coreTypes.streamClass
: inferrer.coreTypes.iterableClass;
DartType context = inferrer.wrapType(elementType, iterableClass);
- Expression iterable = node.iterable;
inferrer.inferExpression(iterable, context, typeNeeded);
DartType inferredExpressionType =
inferrer.resolveTypeParameter(getInferredType(iterable, inferrer));
inferrer.ensureAssignable(
inferrer.wrapType(const DynamicType(), iterableClass),
inferredExpressionType,
- node.iterable,
- node.iterable.fileOffset,
+ iterable,
+ iterable.fileOffset,
template: templateForInLoopTypeNotIterable);
DartType inferredType;
if (typeNeeded) {
@@ -319,15 +338,17 @@
return inferredType;
}
- void handleForInStatementWithoutVariable(ForInStatement node) {
+ void handleForInWithoutVariable(
+ VariableDeclaration variable, Expression iterable, Statement body,
+ {bool isAsync: false}) {
DartType elementType;
bool typeChecksNeeded = !inferrer.isTopLevel;
DartType syntheticWriteType;
Expression syntheticAssignment;
- Block block = node.body;
- ExpressionStatement statement = block.statements[0];
- SyntheticExpressionJudgment judgment = statement.expression;
Expression rhs;
+ ExpressionStatement statement =
+ body is Block ? body.statements.first : body;
+ SyntheticExpressionJudgment judgment = statement.expression;
syntheticAssignment = judgment.desugared;
if (syntheticAssignment is VariableSet) {
syntheticWriteType = elementType = syntheticAssignment.variable.type;
@@ -357,18 +378,19 @@
inferrer.helper.uri);
}
- DartType inferredType =
- inferForInIterable(node, elementType, typeChecksNeeded);
+ DartType inferredType = inferForInIterable(
+ iterable, elementType, typeChecksNeeded,
+ isAsync: isAsync);
if (typeChecksNeeded) {
- node.variable.type = inferredType;
+ variable.type = inferredType;
}
- inferrer.inferStatement(node.body);
+ inferrer.inferStatement(body);
if (syntheticWriteType != null) {
inferrer.ensureAssignable(
greatestClosure(inferrer.coreTypes, syntheticWriteType),
- node.variable.type,
+ variable.type,
rhs,
rhs.fileOffset,
template: templateForInLoopElementTypeNotAssignable,
@@ -379,9 +401,11 @@
@override
void visitForInStatement(ForInStatement node, _) {
if (node.variable.name == null) {
- handleForInStatementWithoutVariable(node);
+ handleForInWithoutVariable(node.variable, node.iterable, node.body,
+ isAsync: node.isAsync);
} else {
- handleForInStatementDeclaringVariable(node);
+ handleForInDeclaringVariable(node.variable, node.iterable, node.body,
+ isAsync: node.isAsync);
}
}
@@ -665,6 +689,170 @@
return null;
}
+ DartType inferElement(
+ Expression element,
+ TreeNode parent,
+ DartType inferredTypeArgument,
+ Map<TreeNode, DartType> inferredSpreadTypes,
+ bool inferenceNeeded,
+ bool typeChecksNeeded) {
+ if (element is SpreadElement) {
+ DartType spreadType = inferrer.inferExpression(
+ element.expression,
+ new InterfaceType(inferrer.coreTypes.iterableClass,
+ <DartType>[inferredTypeArgument]),
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ inferredSpreadTypes[element.expression] = spreadType;
+ if (typeChecksNeeded) {
+ DartType spreadElementType =
+ getSpreadElementType(spreadType, element.isNullAware);
+ if (spreadElementType == null) {
+ if (spreadType is InterfaceType &&
+ spreadType.classNode == inferrer.coreTypes.nullClass &&
+ !element.isNullAware) {
+ parent.replaceChild(
+ element,
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(messageNonNullAwareSpreadIsNull,
+ element.expression.fileOffset, 1)));
+ } else {
+ parent.replaceChild(
+ element,
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(
+ templateSpreadTypeMismatch.withArguments(spreadType),
+ element.expression.fileOffset,
+ 1)));
+ }
+ } else if (spreadType is InterfaceType) {
+ if (!inferrer.isAssignable(inferredTypeArgument, spreadElementType)) {
+ parent.replaceChild(
+ element,
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(
+ templateSpreadElementTypeMismatch.withArguments(
+ spreadElementType, inferredTypeArgument),
+ element.expression.fileOffset,
+ 1)));
+ }
+ }
+ }
+ // Use 'dynamic' for error recovery.
+ return element.elementType =
+ getSpreadElementType(spreadType, element.isNullAware) ??
+ const DynamicType();
+ } else if (element is IfElement) {
+ DartType boolType = inferrer.coreTypes.boolClass.rawType;
+ DartType conditionType = inferrer.inferExpression(
+ element.condition, boolType, typeChecksNeeded,
+ isVoidAllowed: false);
+ inferrer.ensureAssignable(boolType, conditionType, element.condition,
+ element.condition.fileOffset);
+ DartType thenType = inferElement(
+ element.then,
+ element,
+ inferredTypeArgument,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ DartType otherwiseType;
+ if (element.otherwise != null) {
+ otherwiseType = inferElement(
+ element.otherwise,
+ element,
+ inferredTypeArgument,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ }
+ return otherwiseType == null
+ ? thenType
+ : inferrer.typeSchemaEnvironment
+ .getStandardUpperBound(thenType, otherwiseType);
+ } else if (element is ForElement) {
+ for (VariableDeclaration declaration in element.variables) {
+ if (declaration.name == null) {
+ if (declaration.initializer != null) {
+ declaration.type = inferrer.inferExpression(declaration.initializer,
+ declaration.type, inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ } else {
+ inferrer.inferStatement(declaration);
+ }
+ }
+ if (element.condition != null) {
+ inferrer.inferExpression(
+ element.condition,
+ inferrer.coreTypes.boolClass.rawType,
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: false);
+ }
+ for (Expression expression in element.updates) {
+ inferrer.inferExpression(expression, const UnknownType(),
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ return inferElement(element.body, element, inferredTypeArgument,
+ inferredSpreadTypes, inferenceNeeded, typeChecksNeeded);
+ } else if (element is ForInElement) {
+ if (element.variable.name == null) {
+ handleForInWithoutVariable(
+ element.variable, element.iterable, element.prologue,
+ isAsync: element.isAsync);
+ } else {
+ handleForInDeclaringVariable(
+ element.variable, element.iterable, element.prologue,
+ isAsync: element.isAsync);
+ }
+ if (element.problem != null) {
+ inferrer.inferExpression(element.problem, const UnknownType(),
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ return inferElement(element.body, element, inferredTypeArgument,
+ inferredSpreadTypes, inferenceNeeded, typeChecksNeeded);
+ } else {
+ DartType inferredType = inferrer.inferExpression(
+ element, inferredTypeArgument, inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ if (inferredTypeArgument is! UnknownType) {
+ inferrer.ensureAssignable(
+ inferredTypeArgument, inferredType, element, element.fileOffset,
+ isVoidAllowed: inferredTypeArgument is VoidType);
+ }
+ return inferredType;
+ }
+ }
+
+ void checkElement(Expression item, Expression parent, DartType typeArgument,
+ Map<TreeNode, DartType> inferredSpreadTypes) {
+ if (item is SpreadElement) {
+ DartType spreadType = inferredSpreadTypes[item.expression];
+ if (spreadType is DynamicType) {
+ inferrer.ensureAssignable(inferrer.coreTypes.iterableClass.rawType,
+ spreadType, item.expression, item.expression.fileOffset);
+ }
+ } else if (item is IfElement) {
+ checkElement(item.then, item, typeArgument, inferredSpreadTypes);
+ if (item.otherwise != null) {
+ checkElement(item.otherwise, item, typeArgument, inferredSpreadTypes);
+ }
+ } else if (item is ForElement) {
+ if (item.condition != null) {
+ DartType conditionType = getInferredType(item.condition, inferrer);
+ inferrer.ensureAssignable(inferrer.coreTypes.boolClass.rawType,
+ conditionType, item.condition, item.condition.fileOffset);
+ }
+ checkElement(item.body, item, typeArgument, inferredSpreadTypes);
+ } else if (item is ForInElement) {
+ checkElement(item.body, item, typeArgument, inferredSpreadTypes);
+ } else {
+ // Do nothing. Assignability checks are done during type inference.
+ }
+ }
+
void visitListLiteralJudgment(
ListLiteralJudgment node, DartType typeContext) {
var listClass = inferrer.coreTypes.listClass;
@@ -675,9 +863,11 @@
List<DartType> actualTypes;
bool inferenceNeeded = node.typeArgument is ImplicitTypeArgument;
bool typeChecksNeeded = !inferrer.isTopLevel;
+ Map<TreeNode, DartType> inferredSpreadTypes;
if (inferenceNeeded || typeChecksNeeded) {
formalTypes = [];
actualTypes = [];
+ inferredSpreadTypes = new Map<TreeNode, DartType>.identity();
}
if (inferenceNeeded) {
inferredTypes = [const UnknownType()];
@@ -688,36 +878,18 @@
} else {
inferredTypeArgument = node.typeArgument;
}
- List<DartType> spreadTypes =
- typeChecksNeeded ? new List<DartType>(node.expressions.length) : null;
if (inferenceNeeded || typeChecksNeeded) {
for (int i = 0; i < node.expressions.length; ++i) {
- Expression judgment = node.expressions[i];
- if (judgment is SpreadElement) {
- DartType spreadType = inferrer.inferExpression(
- judgment.expression,
- new InterfaceType(inferrer.coreTypes.iterableClass,
- <DartType>[inferredTypeArgument]),
- inferenceNeeded || typeChecksNeeded,
- isVoidAllowed: true);
- if (inferenceNeeded) {
- formalTypes.add(listType.typeArguments[0]);
- }
- if (typeChecksNeeded) {
- spreadTypes[i] = spreadType;
- }
- // Use 'dynamic' for error recovery.
- actualTypes.add(
- getSpreadElementType(spreadType, judgment.isNullAware) ??
- const DynamicType());
- } else {
- inferrer.inferExpression(judgment, inferredTypeArgument,
- inferenceNeeded || typeChecksNeeded,
- isVoidAllowed: true);
- if (inferenceNeeded) {
- formalTypes.add(listType.typeArguments[0]);
- }
- actualTypes.add(getInferredType(judgment, inferrer));
+ DartType type = inferElement(
+ node.expressions[i],
+ node,
+ inferredTypeArgument,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ actualTypes.add(type);
+ if (inferenceNeeded) {
+ formalTypes.add(listType.typeArguments[0]);
}
}
}
@@ -739,49 +911,8 @@
}
if (typeChecksNeeded) {
for (int i = 0; i < node.expressions.length; i++) {
- Expression item = node.expressions[i];
- if (item is SpreadElement) {
- DartType spreadType = spreadTypes[i];
- DartType spreadElementType =
- getSpreadElementType(spreadType, item.isNullAware);
- if (spreadElementType == null) {
- if (spreadType is InterfaceType &&
- spreadType.classNode == inferrer.coreTypes.nullClass &&
- !item.isNullAware) {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(messageNonNullAwareSpreadIsNull,
- item.expression.fileOffset, 1)));
- } else {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(
- templateSpreadTypeMismatch.withArguments(spreadType),
- item.expression.fileOffset,
- 1)));
- }
- } else if (spreadType is DynamicType) {
- inferrer.ensureAssignable(inferrer.coreTypes.iterableClass.rawType,
- spreadType, item.expression, item.expression.fileOffset);
- } else if (spreadType is InterfaceType) {
- if (!inferrer.isAssignable(node.typeArgument, spreadElementType)) {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(
- templateSpreadElementTypeMismatch.withArguments(
- spreadElementType, node.typeArgument),
- item.expression.fileOffset,
- 1)));
- }
- }
- } else {
- inferrer.ensureAssignable(
- node.typeArgument, actualTypes[i], item, item.fileOffset,
- isVoidAllowed: node.typeArgument is VoidType);
- }
+ checkElement(
+ node.expressions[i], node, node.typeArgument, inferredSpreadTypes);
}
}
node.inferredType = new InterfaceType(listClass, [inferredTypeArgument]);
@@ -832,6 +963,308 @@
}
}
+ // Note that inferMapEntry adds exactly two elements to actualTypes -- the
+ // actual types of the key and the value. The same technique is used for
+ // actualTypesForSet, only inferMapEntry adds exactly one element to that
+ // list: the actual type of the iterable spread elements in case the map
+ // literal will be disambiguated as a set literal later.
+ void inferMapEntry(
+ MapEntry entry,
+ TreeNode parent,
+ DartType inferredKeyType,
+ DartType inferredValueType,
+ DartType spreadContext,
+ List<DartType> actualTypes,
+ List<DartType> actualTypesForSet,
+ Map<TreeNode, DartType> inferredSpreadTypes,
+ bool inferenceNeeded,
+ bool typeChecksNeeded) {
+ if (entry is SpreadMapEntry) {
+ DartType spreadType = inferrer.inferExpression(
+ entry.expression, spreadContext, inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ inferredSpreadTypes[entry.expression] = spreadType;
+ int length = actualTypes.length;
+ actualTypes.add(null);
+ actualTypes.add(null);
+ storeSpreadMapEntryElementTypes(
+ spreadType, entry.isNullAware, actualTypes, length);
+ DartType actualKeyType = actualTypes[length];
+ DartType actualValueType = actualTypes[length + 1];
+ DartType actualElementType =
+ getSpreadElementType(spreadType, entry.isNullAware);
+
+ if (typeChecksNeeded) {
+ if (actualKeyType == null) {
+ if (spreadType is InterfaceType &&
+ spreadType.classNode == inferrer.coreTypes.nullClass &&
+ !entry.isNullAware) {
+ parent.replaceChild(
+ entry,
+ new MapEntry(
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(messageNonNullAwareSpreadIsNull,
+ entry.expression.fileOffset, 1)),
+ new NullLiteral())
+ ..fileOffset = entry.fileOffset);
+ } else if (actualElementType != null) {
+ // Don't report the error here, it might be an ambiguous Set. The
+ // error is reported in checkMapEntry if it's disambiguated as map.
+ iterableSpreadType = spreadType;
+ } else {
+ parent.replaceChild(
+ entry,
+ new MapEntry(
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(
+ templateSpreadMapEntryTypeMismatch
+ .withArguments(spreadType),
+ entry.expression.fileOffset,
+ 1)),
+ new NullLiteral())
+ ..fileOffset = entry.fileOffset);
+ }
+ } else if (spreadType is InterfaceType) {
+ Expression keyError;
+ Expression valueError;
+ if (!inferrer.isAssignable(inferredKeyType, actualKeyType)) {
+ keyError = inferrer.helper.desugarSyntheticExpression(
+ inferrer.helper.buildProblem(
+ templateSpreadMapEntryElementKeyTypeMismatch.withArguments(
+ actualKeyType, inferredKeyType),
+ entry.expression.fileOffset,
+ 1));
+ }
+ if (!inferrer.isAssignable(inferredValueType, actualValueType)) {
+ valueError = inferrer.helper.desugarSyntheticExpression(
+ inferrer.helper.buildProblem(
+ templateSpreadMapEntryElementValueTypeMismatch
+ .withArguments(actualValueType, inferredValueType),
+ entry.expression.fileOffset,
+ 1));
+ }
+ if (keyError != null || valueError != null) {
+ keyError ??= new NullLiteral();
+ valueError ??= new NullLiteral();
+ parent.replaceChild(
+ entry,
+ new MapEntry(keyError, valueError)
+ ..fileOffset = entry.fileOffset);
+ }
+ }
+ }
+
+ // Use 'dynamic' for error recovery.
+ if (actualKeyType == null) {
+ actualKeyType = actualTypes[length] = const DynamicType();
+ actualValueType = actualTypes[length + 1] = const DynamicType();
+ }
+ // Store the type in case of an ambiguous Set. Use 'dynamic' for error
+ // recovery.
+ actualTypesForSet.add(actualElementType ?? const DynamicType());
+
+ mapEntryClass ??=
+ inferrer.coreTypes.index.getClass('dart:core', 'MapEntry');
+ // TODO(dmitryas): Handle the case of an ambiguous Set.
+ entry.entryType = new InterfaceType(
+ mapEntryClass, <DartType>[actualKeyType, actualValueType]);
+
+ bool isMap = inferrer.typeSchemaEnvironment
+ .isSubtypeOf(spreadType, inferrer.coreTypes.mapClass.rawType);
+ bool isIterable = inferrer.typeSchemaEnvironment
+ .isSubtypeOf(spreadType, inferrer.coreTypes.iterableClass.rawType);
+ if (isMap && !isIterable) {
+ mapSpreadOffset = entry.fileOffset;
+ }
+ if (!isMap && isIterable) {
+ iterableSpreadOffset = entry.expression.fileOffset;
+ }
+
+ return;
+ } else if (entry is IfMapEntry) {
+ DartType boolType = inferrer.coreTypes.boolClass.rawType;
+ DartType conditionType = inferrer.inferExpression(
+ entry.condition, boolType, typeChecksNeeded,
+ isVoidAllowed: false);
+ inferrer.ensureAssignable(
+ boolType, conditionType, entry.condition, entry.condition.fileOffset);
+ // Note that this recursive invocation of inferMapEntry will add two types
+ // to actualTypes; they are the actual types of the current invocation if
+ // the 'else' branch is empty.
+ inferMapEntry(
+ entry.then,
+ entry,
+ inferredKeyType,
+ inferredValueType,
+ spreadContext,
+ actualTypes,
+ actualTypesForSet,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ if (entry.otherwise != null) {
+ // We need to modify the actual types added in the recursive call to
+ // inferMapEntry.
+ DartType actualValueType = actualTypes.removeLast();
+ DartType actualKeyType = actualTypes.removeLast();
+ DartType actualTypeForSet = actualTypesForSet.removeLast();
+ inferMapEntry(
+ entry.otherwise,
+ entry,
+ inferredKeyType,
+ inferredValueType,
+ spreadContext,
+ actualTypes,
+ actualTypesForSet,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ int length = actualTypes.length;
+ actualTypes[length - 2] = inferrer.typeSchemaEnvironment
+ .getStandardUpperBound(actualKeyType, actualTypes[length - 2]);
+ actualTypes[length - 1] = inferrer.typeSchemaEnvironment
+ .getStandardUpperBound(actualValueType, actualTypes[length - 1]);
+ int lengthForSet = actualTypesForSet.length;
+ actualTypesForSet[lengthForSet - 1] = inferrer.typeSchemaEnvironment
+ .getStandardUpperBound(
+ actualTypeForSet, actualTypesForSet[lengthForSet - 1]);
+ }
+ return;
+ } else if (entry is ForMapEntry) {
+ for (VariableDeclaration declaration in entry.variables) {
+ if (declaration.name == null) {
+ if (declaration.initializer != null) {
+ declaration.type = inferrer.inferExpression(declaration.initializer,
+ declaration.type, inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ } else {
+ inferrer.inferStatement(declaration);
+ }
+ }
+ if (entry.condition != null) {
+ inferrer.inferExpression(
+ entry.condition,
+ inferrer.coreTypes.boolClass.rawType,
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: false);
+ }
+ for (Expression expression in entry.updates) {
+ inferrer.inferExpression(expression, const UnknownType(),
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ // Actual types are added by the recursive call.
+ return inferMapEntry(
+ entry.body,
+ entry,
+ inferredKeyType,
+ inferredValueType,
+ spreadContext,
+ actualTypes,
+ actualTypesForSet,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ } else if (entry is ForInMapEntry) {
+ if (entry.variable.name == null) {
+ handleForInWithoutVariable(
+ entry.variable, entry.iterable, entry.prologue,
+ isAsync: entry.isAsync);
+ } else {
+ handleForInDeclaringVariable(
+ entry.variable, entry.iterable, entry.prologue,
+ isAsync: entry.isAsync);
+ }
+ if (entry.problem != null) {
+ inferrer.inferExpression(entry.problem, const UnknownType(),
+ inferenceNeeded || typeChecksNeeded,
+ isVoidAllowed: true);
+ }
+ // Actual types are added by the recursive call.
+ inferMapEntry(
+ entry.body,
+ entry,
+ inferredKeyType,
+ inferredValueType,
+ spreadContext,
+ actualTypes,
+ actualTypesForSet,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ } else {
+ DartType keyType = inferrer.inferExpression(
+ entry.key, inferredKeyType, true,
+ isVoidAllowed: true);
+ DartType valueType = inferrer.inferExpression(
+ entry.value, inferredValueType, true,
+ isVoidAllowed: true);
+ inferrer.ensureAssignable(
+ inferredKeyType, keyType, entry.key, entry.key.fileOffset,
+ isVoidAllowed: inferredKeyType is VoidType);
+ inferrer.ensureAssignable(
+ inferredValueType, valueType, entry.value, entry.value.fileOffset,
+ isVoidAllowed: inferredValueType is VoidType);
+ actualTypes.add(keyType);
+ actualTypes.add(valueType);
+ // Use 'dynamic' for error recovery.
+ actualTypesForSet.add(const DynamicType());
+ mapEntryOffset = entry.fileOffset;
+ return;
+ }
+ }
+
+ void checkMapEntry(
+ MapEntry entry,
+ TreeNode parent,
+ Expression cachedKey,
+ Expression cachedValue,
+ DartType keyType,
+ DartType valueType,
+ Map<TreeNode, DartType> inferredSpreadTypes) {
+ // It's disambiguated as a map literal.
+ if (iterableSpreadOffset != null) {
+ parent.replaceChild(
+ entry,
+ new MapEntry(
+ inferrer.helper.desugarSyntheticExpression(inferrer.helper
+ .buildProblem(
+ templateSpreadMapEntryTypeMismatch
+ .withArguments(iterableSpreadType),
+ iterableSpreadOffset,
+ 1)),
+ new NullLiteral()));
+ }
+ if (entry is SpreadMapEntry) {
+ DartType spreadType = inferredSpreadTypes[entry.expression];
+ if (spreadType is DynamicType) {
+ inferrer.ensureAssignable(inferrer.coreTypes.mapClass.rawType,
+ spreadType, entry.expression, entry.expression.fileOffset);
+ }
+ } else if (entry is IfMapEntry) {
+ checkMapEntry(entry.then, entry, cachedKey, cachedValue, keyType,
+ valueType, inferredSpreadTypes);
+ if (entry.otherwise != null) {
+ checkMapEntry(entry.otherwise, entry, cachedKey, cachedValue, keyType,
+ valueType, inferredSpreadTypes);
+ }
+ } else if (entry is ForMapEntry) {
+ if (entry.condition != null) {
+ DartType conditionType = getInferredType(entry.condition, inferrer);
+ inferrer.ensureAssignable(inferrer.coreTypes.boolClass.rawType,
+ conditionType, entry.condition, entry.condition.fileOffset);
+ }
+ checkMapEntry(entry.body, entry, cachedKey, cachedValue, keyType,
+ valueType, inferredSpreadTypes);
+ } else if (entry is ForInMapEntry) {
+ checkMapEntry(entry.body, entry, cachedKey, cachedValue, keyType,
+ valueType, inferredSpreadTypes);
+ } else {
+ // Do nothing. Assignability checks are done during type inference.
+ }
+ }
+
void visitMapLiteralJudgment(MapLiteralJudgment node, DartType typeContext) {
var mapClass = inferrer.coreTypes.mapClass;
var mapType = mapClass.thisType;
@@ -840,11 +1273,12 @@
DartType inferredValueType;
List<DartType> formalTypes;
List<DartType> actualTypes;
+ List<DartType> actualTypesForSet;
assert((node.keyType is ImplicitTypeArgument) ==
(node.valueType is ImplicitTypeArgument));
bool inferenceNeeded = node.keyType is ImplicitTypeArgument;
KernelLibraryBuilder library = inferrer.library;
- bool typeContextIsMap = false;
+ bool typeContextIsMap = node.keyType is! ImplicitTypeArgument;
bool typeContextIsIterable = false;
if (!inferrer.isTopLevel) {
if (library.loader.target.enableSetLiterals && inferenceNeeded) {
@@ -852,10 +1286,12 @@
DartType context =
inferrer.typeSchemaEnvironment.unfutureType(typeContext);
if (context is InterfaceType) {
- typeContextIsMap = inferrer.classHierarchy
- .isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
- typeContextIsIterable = inferrer.classHierarchy
- .isSubtypeOf(context.classNode, inferrer.coreTypes.iterableClass);
+ typeContextIsMap = typeContextIsMap ||
+ inferrer.classHierarchy
+ .isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
+ typeContextIsIterable = typeContextIsIterable ||
+ inferrer.classHierarchy.isSubtypeOf(
+ context.classNode, inferrer.coreTypes.iterableClass);
if (node.entries.isEmpty &&
typeContextIsIterable &&
!typeContextIsMap) {
@@ -873,9 +1309,12 @@
}
}
bool typeChecksNeeded = !inferrer.isTopLevel;
+ Map<TreeNode, DartType> inferredSpreadTypes;
if (inferenceNeeded || typeChecksNeeded) {
formalTypes = [];
actualTypes = [];
+ actualTypesForSet = [];
+ inferredSpreadTypes = new Map<TreeNode, DartType>.identity();
}
if (inferenceNeeded) {
inferredTypes = [const UnknownType(), const UnknownType()];
@@ -890,102 +1329,99 @@
}
List<Expression> cachedKeys = new List(node.entries.length);
List<Expression> cachedValues = new List(node.entries.length);
- List<DartType> spreadMapEntryTypes =
- typeChecksNeeded ? new List<DartType>(node.entries.length) : null;
for (int i = 0; i < node.entries.length; i++) {
MapEntry entry = node.entries[i];
- if (entry is! SpreadMapEntry && entry is! IfMapEntry) {
+ if (entry is! ControlFlowMapEntry) {
cachedKeys[i] = node.entries[i].key;
cachedValues[i] = node.entries[i].value;
}
}
- int iterableSpreadOffset = -1;
- int mapSpreadOffset = -1;
- int mapEntryOffset = -1;
+ bool hasMapEntry = false;
+ bool hasMapSpread = false;
+ bool hasIterableSpread = false;
if (inferenceNeeded || typeChecksNeeded) {
+ mapEntryOffset = null;
+ mapSpreadOffset = null;
+ iterableSpreadOffset = null;
+ iterableSpreadType = null;
DartType spreadTypeContext = const UnknownType();
if (typeContextIsIterable && !typeContextIsMap) {
spreadTypeContext = inferrer.typeSchemaEnvironment
.getTypeAsInstanceOf(typeContext, inferrer.coreTypes.iterableClass);
} else if (!typeContextIsIterable && typeContextIsMap) {
- spreadTypeContext =
- new InterfaceType(inferrer.coreTypes.mapClass, inferredTypes);
+ spreadTypeContext = new InterfaceType(inferrer.coreTypes.mapClass,
+ <DartType>[inferredKeyType, inferredValueType]);
}
for (int i = 0; i < node.entries.length; ++i) {
MapEntry entry = node.entries[i];
- if (entry is SpreadMapEntry) {
- DartType spreadMapEntryType = inferrer.inferExpression(
- entry.expression,
- spreadTypeContext,
- inferenceNeeded || typeChecksNeeded,
- isVoidAllowed: true);
- if (inferenceNeeded) {
- formalTypes.add(mapType.typeArguments[0]);
- formalTypes.add(mapType.typeArguments[1]);
- }
- if (typeChecksNeeded) {
- spreadMapEntryTypes[i] = spreadMapEntryType;
- }
-
- bool isMap = inferrer.typeSchemaEnvironment.isSubtypeOf(
- spreadMapEntryType, inferrer.coreTypes.mapClass.rawType);
- bool isSet = inferrer.typeSchemaEnvironment.isSubtypeOf(
- spreadMapEntryType, inferrer.coreTypes.iterableClass.rawType);
-
- if (isMap && !isSet) {
- mapSpreadOffset = entry.expression.fileOffset;
- }
- if (!isMap && isSet) {
- iterableSpreadOffset = entry.expression.fileOffset;
- }
-
- // Use 'dynamic' for error recovery.
- int length = actualTypes.length;
- actualTypes.add(const DynamicType());
- actualTypes.add(const DynamicType());
- storeSpreadMapEntryElementTypes(
- spreadMapEntryType, entry.isNullAware, actualTypes, length);
- } else if (entry is IfMapEntry) {
- node.entries[i] = new MapEntry(
- new InvalidExpression('unimplemented spread entry')
- ..fileOffset = node.fileOffset,
- new NullLiteral());
- actualTypes.add(const DynamicType());
- actualTypes.add(const DynamicType());
- } else {
- Expression key = entry.key;
- inferrer.inferExpression(key, inferredKeyType, true,
- isVoidAllowed: true);
- actualTypes.add(getInferredType(key, inferrer));
- Expression value = entry.value;
- inferrer.inferExpression(value, inferredValueType, true,
- isVoidAllowed: true);
- actualTypes.add(getInferredType(value, inferrer));
- if (inferenceNeeded) {
- formalTypes.addAll(mapType.typeArguments);
- }
-
- mapEntryOffset = entry.fileOffset;
+ inferMapEntry(
+ entry,
+ node,
+ inferredKeyType,
+ inferredValueType,
+ spreadTypeContext,
+ actualTypes,
+ actualTypesForSet,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ if (inferenceNeeded) {
+ formalTypes.add(mapType.typeArguments[0]);
+ formalTypes.add(mapType.typeArguments[1]);
}
}
+ hasMapEntry = mapEntryOffset != null;
+ hasMapSpread = mapSpreadOffset != null;
+ hasIterableSpread = iterableSpreadOffset != null;
}
if (inferenceNeeded) {
- bool canBeSet =
- mapSpreadOffset == -1 && mapEntryOffset == -1 && !typeContextIsMap;
- bool canBeMap = iterableSpreadOffset == -1 && !typeContextIsIterable;
+ bool canBeSet = !hasMapSpread && !hasMapEntry && !typeContextIsMap;
+ bool canBeMap = !hasIterableSpread && !typeContextIsIterable;
if (canBeSet && !canBeMap) {
List<Expression> setElements = <Expression>[];
+ List<DartType> formalTypesForSet = <DartType>[];
+ InterfaceType setType = inferrer.coreTypes.setClass.thisType;
for (int i = 0; i < node.entries.length; ++i) {
- SpreadMapEntry entry = node.entries[i];
- setElements
- .add(new SpreadElement(entry.expression, entry.isNullAware));
+ setElements.add(convertToElement(node.entries[i], inferrer.helper));
+ formalTypesForSet.add(setType.typeArguments[0]);
}
+
+ List<DartType> inferredTypesForSet = <DartType>[const UnknownType()];
+ inferrer.typeSchemaEnvironment.inferGenericFunctionOrType(
+ setType,
+ inferrer.coreTypes.setClass.typeParameters,
+ null,
+ null,
+ typeContext,
+ inferredTypesForSet,
+ isConst: node.isConst);
+ inferrer.typeSchemaEnvironment.inferGenericFunctionOrType(
+ inferrer.coreTypes.setClass.thisType,
+ inferrer.coreTypes.setClass.typeParameters,
+ formalTypesForSet,
+ actualTypesForSet,
+ typeContext,
+ inferredTypesForSet);
+ DartType inferredTypeArgument = inferredTypesForSet[0];
+ inferrer.instrumentation?.record(
+ inferrer.uri,
+ node.fileOffset,
+ 'typeArgs',
+ new InstrumentationValueForTypeArgs([inferredTypeArgument]));
+
SetLiteralJudgment setLiteral = new SetLiteralJudgment(setElements,
- typeArgument: const ImplicitTypeArgument(), isConst: node.isConst)
+ typeArgument: inferredTypeArgument, isConst: node.isConst)
..fileOffset = node.fileOffset;
node.parent.replaceChild(node, setLiteral);
- visitSetLiteralJudgment(setLiteral, typeContext);
- node.inferredType = setLiteral.inferredType;
+ if (typeChecksNeeded) {
+ for (int i = 0; i < setLiteral.expressions.length; i++) {
+ checkElement(setLiteral.expressions[i], setLiteral,
+ setLiteral.typeArgument, inferredSpreadTypes);
+ }
+ }
+
+ node.inferredType = setLiteral.inferredType =
+ new InterfaceType(inferrer.coreTypes.setClass, inferredTypesForSet);
return;
}
if (canBeSet && canBeMap && node.entries.isNotEmpty) {
@@ -999,24 +1435,11 @@
}
if (!canBeSet && !canBeMap) {
if (!inferrer.isTopLevel) {
- LocatedMessage iterableContextMessage = messageSpreadElement
- .withLocation(library.uri, iterableSpreadOffset, 1);
- LocatedMessage mapContextMessage = messageSpreadMapElement
- .withLocation(library.uri, mapSpreadOffset, 1);
- List<LocatedMessage> context = <LocatedMessage>[];
- if (iterableSpreadOffset < mapSpreadOffset) {
- context.add(iterableContextMessage);
- context.add(mapContextMessage);
- } else {
- context.add(mapContextMessage);
- context.add(iterableContextMessage);
- }
node.parent.replaceChild(
node,
inferrer.helper.desugarSyntheticExpression(inferrer.helper
.buildProblem(messageCantDisambiguateAmbiguousInformation,
- node.fileOffset, 1,
- context: context)));
+ node.fileOffset, 1)));
}
node.inferredType = const BottomType();
return;
@@ -1041,85 +1464,8 @@
}
if (typeChecksNeeded) {
for (int i = 0; i < node.entries.length; ++i) {
- MapEntry entry = node.entries[i];
- List<DartType> spreadMapEntryElementTypes = new List<DartType>(2);
- if (entry is SpreadMapEntry) {
- DartType spreadMapEntryType = spreadMapEntryTypes[i];
- spreadMapEntryElementTypes[0] = spreadMapEntryElementTypes[1] = null;
- storeSpreadMapEntryElementTypes(spreadMapEntryType, entry.isNullAware,
- spreadMapEntryElementTypes, 0);
- if (spreadMapEntryElementTypes[0] == null) {
- if (spreadMapEntryType is InterfaceType &&
- spreadMapEntryType.classNode == inferrer.coreTypes.nullClass &&
- !entry.isNullAware) {
- node.replaceChild(
- node.entries[i],
- new MapEntry(
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(messageNonNullAwareSpreadIsNull,
- entry.expression.fileOffset, 1)),
- new NullLiteral()));
- } else {
- node.replaceChild(
- node.entries[i],
- new MapEntry(
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(
- templateSpreadMapEntryTypeMismatch
- .withArguments(spreadMapEntryType),
- entry.expression.fileOffset,
- 1)),
- new NullLiteral()));
- }
- } else if (spreadMapEntryType is DynamicType) {
- inferrer.ensureAssignable(
- inferrer.coreTypes.mapClass.rawType,
- spreadMapEntryType,
- entry.expression,
- entry.expression.fileOffset);
- } else if (spreadMapEntryType is InterfaceType) {
- Expression keyError;
- Expression valueError;
- if (!inferrer.isAssignable(
- node.keyType, spreadMapEntryElementTypes[0])) {
- keyError = inferrer.helper.desugarSyntheticExpression(
- inferrer.helper.buildProblem(
- templateSpreadMapEntryElementKeyTypeMismatch
- .withArguments(
- spreadMapEntryElementTypes[0], node.keyType),
- entry.expression.fileOffset,
- 1));
- }
- if (!inferrer.isAssignable(
- node.valueType, spreadMapEntryElementTypes[1])) {
- valueError = inferrer.helper.desugarSyntheticExpression(
- inferrer.helper.buildProblem(
- templateSpreadMapEntryElementValueTypeMismatch
- .withArguments(
- spreadMapEntryElementTypes[1], node.valueType),
- entry.expression.fileOffset,
- 1));
- }
- if (keyError != null || valueError != null) {
- keyError ??= new NullLiteral();
- valueError ??= new NullLiteral();
- node.replaceChild(
- node.entries[i], new MapEntry(keyError, valueError));
- }
- }
- } else {
- Expression keyJudgment = cachedKeys[i];
- if (keyJudgment != null) {
- inferrer.ensureAssignable(node.keyType, actualTypes[2 * i],
- keyJudgment, keyJudgment.fileOffset,
- isVoidAllowed: node.keyType is VoidType);
-
- Expression valueJudgment = cachedValues[i];
- inferrer.ensureAssignable(node.valueType, actualTypes[2 * i + 1],
- valueJudgment, valueJudgment.fileOffset,
- isVoidAllowed: node.valueType is VoidType);
- }
- }
+ checkMapEntry(node.entries[i], node, cachedKeys[i], cachedValues[i],
+ node.keyType, node.valueType, inferredSpreadTypes);
}
}
node.inferredType =
@@ -1358,9 +1704,11 @@
List<DartType> actualTypes;
bool inferenceNeeded = node.typeArgument is ImplicitTypeArgument;
bool typeChecksNeeded = !inferrer.isTopLevel;
+ Map<TreeNode, DartType> inferredSpreadTypes;
if (inferenceNeeded || typeChecksNeeded) {
formalTypes = [];
actualTypes = [];
+ inferredSpreadTypes = new Map<TreeNode, DartType>.identity();
}
if (inferenceNeeded) {
inferredTypes = [const UnknownType()];
@@ -1371,36 +1719,18 @@
} else {
inferredTypeArgument = node.typeArgument;
}
- List<DartType> spreadTypes =
- typeChecksNeeded ? new List<DartType>(node.expressions.length) : null;
if (inferenceNeeded || typeChecksNeeded) {
for (int i = 0; i < node.expressions.length; ++i) {
- Expression judgment = node.expressions[i];
- if (judgment is SpreadElement) {
- DartType spreadType = inferrer.inferExpression(
- judgment.expression,
- new InterfaceType(inferrer.coreTypes.iterableClass,
- <DartType>[inferredTypeArgument]),
- inferenceNeeded || typeChecksNeeded,
- isVoidAllowed: true);
- if (inferenceNeeded) {
- formalTypes.add(setType.typeArguments[0]);
- }
- if (typeChecksNeeded) {
- spreadTypes[i] = spreadType;
- }
- // Use 'dynamic' for error recovery.
- actualTypes.add(
- getSpreadElementType(spreadType, judgment.isNullAware) ??
- const DynamicType());
- } else {
- inferrer.inferExpression(judgment, inferredTypeArgument,
- inferenceNeeded || typeChecksNeeded,
- isVoidAllowed: true);
- if (inferenceNeeded) {
- formalTypes.add(setType.typeArguments[0]);
- }
- actualTypes.add(getInferredType(judgment, inferrer));
+ DartType type = inferElement(
+ node.expressions[i],
+ node,
+ inferredTypeArgument,
+ inferredSpreadTypes,
+ inferenceNeeded,
+ typeChecksNeeded);
+ actualTypes.add(type);
+ if (inferenceNeeded) {
+ formalTypes.add(setType.typeArguments[0]);
}
}
}
@@ -1422,49 +1752,8 @@
}
if (typeChecksNeeded) {
for (int i = 0; i < node.expressions.length; i++) {
- Expression item = node.expressions[i];
- if (item is SpreadElement) {
- DartType spreadType = spreadTypes[i];
- DartType spreadElementType =
- getSpreadElementType(spreadType, item.isNullAware);
- if (spreadElementType == null) {
- if (spreadType is InterfaceType &&
- spreadType.classNode == inferrer.coreTypes.nullClass &&
- !item.isNullAware) {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(messageNonNullAwareSpreadIsNull,
- item.expression.fileOffset, 1)));
- } else {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(
- templateSpreadTypeMismatch.withArguments(spreadType),
- item.expression.fileOffset,
- 1)));
- }
- } else if (spreadType is DynamicType) {
- inferrer.ensureAssignable(inferrer.coreTypes.iterableClass.rawType,
- spreadType, item.expression, item.expression.fileOffset);
- } else if (spreadType is InterfaceType) {
- if (!inferrer.isAssignable(node.typeArgument, spreadElementType)) {
- node.replaceChild(
- node.expressions[i],
- inferrer.helper.desugarSyntheticExpression(inferrer.helper
- .buildProblem(
- templateSpreadElementTypeMismatch.withArguments(
- spreadElementType, node.typeArgument),
- item.expression.fileOffset,
- 1)));
- }
- }
- } else {
- inferrer.ensureAssignable(node.typeArgument, actualTypes[i],
- node.expressions[i], node.expressions[i].fileOffset,
- isVoidAllowed: node.typeArgument is VoidType);
- }
+ checkElement(
+ node.expressions[i], node, node.typeArgument, inferredSpreadTypes);
}
}
node.inferredType = new InterfaceType(setClass, [inferredTypeArgument]);
diff --git a/front_end/lib/src/fasta/kernel/inferred_type_visitor.dart b/front_end/lib/src/fasta/kernel/inferred_type_visitor.dart
index 91ae51b..05513ad 100644
--- a/front_end/lib/src/fasta/kernel/inferred_type_visitor.dart
+++ b/front_end/lib/src/fasta/kernel/inferred_type_visitor.dart
@@ -28,18 +28,11 @@
@override
DartType defaultExpression(Expression node, TypeInferrerImpl inferrer) {
- if (node is IfElement) {
- return visitIfElement(node, inferrer);
- }
unhandled("${node.runtimeType}", "getInferredType", node.fileOffset,
inferrer.uri);
return const InvalidType();
}
- DartType visitIfElement(IfElement node, TypeInferrerImpl inferrer) {
- return const BottomType();
- }
-
@override
DartType visitIntLiteral(IntLiteral node, TypeInferrerImpl inferrer) {
return inferrer.coreTypes.intClass.rawType;
diff --git a/front_end/lib/src/fasta/kernel/kernel_ast_api.dart b/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
index cded049..bca9db5 100644
--- a/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
@@ -18,6 +18,7 @@
Catch,
CheckLibraryIsLoaded,
Class,
+ Component,
Constructor,
ConstructorInvocation,
ContinueSwitchStatement,
@@ -53,6 +54,7 @@
NamedExpression,
NamedType,
Node,
+ NullLiteral,
Procedure,
ProcedureKind,
PropertyGet,
diff --git a/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 80b38e4..151c074 100644
--- a/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -6,31 +6,32 @@
import 'package:kernel/ast.dart'
show
+ Arguments,
+ AsExpression,
Class,
Constructor,
- ThisExpression,
DartType,
DynamicType,
Expression,
Field,
FunctionNode,
InterfaceType,
- AsExpression,
+ InvalidType,
ListLiteral,
Member,
+ MethodInvocation,
Name,
Procedure,
+ ProcedureKind,
RedirectingFactoryConstructor,
ReturnStatement,
- VoidType,
- MethodInvocation,
- ProcedureKind,
StaticGet,
Supertype,
+ ThisExpression,
TypeParameter,
TypeParameterType,
- Arguments,
- VariableDeclaration;
+ VariableDeclaration,
+ VoidType;
import 'package:kernel/ast.dart' show FunctionType, TypeParameterType;
@@ -1021,6 +1022,9 @@
} else if (isCovariant && typeEnvironment.isSubtypeOf(supertype, subtype)) {
// No problem--the overriding parameter is marked "covariant" and has
// a type which is a subtype of the parameter it overrides.
+ } else if (subtype is InvalidType || supertype is InvalidType) {
+ // Don't report a problem as something else is wrong that has already
+ // been reported.
} else {
// Report an error.
String declaredMemberName =
diff --git a/front_end/lib/src/fasta/kernel/kernel_constants.dart b/front_end/lib/src/fasta/kernel/kernel_constants.dart
index 6cb0a71..5f8b4f5 100644
--- a/front_end/lib/src/fasta/kernel/kernel_constants.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_constants.dart
@@ -4,177 +4,28 @@
library fasta.kernel_constants;
-import 'package:kernel/ast.dart'
- show Constant, DartType, IntConstant, Library, Member, Procedure, TreeNode;
+import 'package:kernel/ast.dart' show InvalidExpression, Library;
-import 'package:kernel/type_environment.dart' show TypeEnvironment;
-
-import 'package:kernel/transformations/constants.dart' show ErrorReporter;
-
-import '../fasta_codes.dart'
- show
- Message,
- noLength,
- messageConstEvalCircularity,
- messageConstEvalFailedAssertion,
- templateConstEvalDeferredLibrary,
- templateConstEvalDuplicateKey,
- templateConstEvalFailedAssertionWithMessage,
- templateConstEvalFreeTypeParameter,
- templateConstEvalInvalidBinaryOperandType,
- templateConstEvalInvalidMethodInvocation,
- templateConstEvalInvalidStaticInvocation,
- templateConstEvalInvalidStringInterpolationOperand,
- templateConstEvalInvalidSymbolName,
- templateConstEvalInvalidType,
- templateConstEvalNegativeShift,
- templateConstEvalNonConstantLiteral,
- templateConstEvalNonConstantVariableGet,
- templateConstEvalZeroDivisor;
+import '../fasta_codes.dart' show LocatedMessage;
import '../loader.dart' show Loader;
+import 'constant_evaluator.dart' show ErrorReporter;
+
class KernelConstantErrorReporter extends ErrorReporter {
final Loader<Library> loader;
- final TypeEnvironment typeEnvironment;
- KernelConstantErrorReporter(this.loader, this.typeEnvironment);
+ KernelConstantErrorReporter(this.loader);
- String addProblem(TreeNode node, Message message) {
- int offset = getFileOffset(node);
- Uri uri = getFileUri(node);
- loader.addProblem(message, offset, noLength, uri);
- return loader.target.context.format(
- message.withLocation(uri, offset, noLength), message.code.severity);
+ @override
+ void report(LocatedMessage message, List<LocatedMessage> context) {
+ loader.addProblem(
+ message.messageObject, message.charOffset, message.length, message.uri,
+ context: context);
}
@override
- String freeTypeParameter(
- List<TreeNode> context, TreeNode node, DartType type) {
- return addProblem(
- node, templateConstEvalFreeTypeParameter.withArguments(type));
- }
-
- @override
- String duplicateKey(List<TreeNode> context, TreeNode node, Constant key) {
- return addProblem(node, templateConstEvalDuplicateKey.withArguments(key));
- }
-
- @override
- String invalidDartType(List<TreeNode> context, TreeNode node,
- Constant receiver, DartType expectedType) {
- return addProblem(
- node,
- templateConstEvalInvalidType.withArguments(
- receiver, expectedType, receiver.getType(typeEnvironment)));
- }
-
- @override
- String invalidBinaryOperandType(
- List<TreeNode> context,
- TreeNode node,
- Constant receiver,
- String op,
- DartType expectedType,
- DartType actualType) {
- return addProblem(
- node,
- templateConstEvalInvalidBinaryOperandType.withArguments(
- op, receiver, expectedType, actualType));
- }
-
- @override
- String invalidMethodInvocation(
- List<TreeNode> context, TreeNode node, Constant receiver, String op) {
- return addProblem(node,
- templateConstEvalInvalidMethodInvocation.withArguments(op, receiver));
- }
-
- @override
- String invalidStaticInvocation(
- List<TreeNode> context, TreeNode node, Member target) {
- // TODO(kmillikin) For an invalid factory invocation we should adopt a
- // better message. This will show something like:
- //
- // "The invocation of 'List' is not allowed within a const context."
- //
- // Which is not quite right when the code was "new List()".
- String name = target.name.toString();
- if (target is Procedure && target.isFactory) {
- if (name.isEmpty) {
- name = target.enclosingClass.name;
- } else {
- name = '${target.enclosingClass.name}.${name}';
- }
- }
- return addProblem(
- node, templateConstEvalInvalidStaticInvocation.withArguments(name));
- }
-
- @override
- String invalidStringInterpolationOperand(
- List<TreeNode> context, TreeNode node, Constant constant) {
- return addProblem(
- node,
- templateConstEvalInvalidStringInterpolationOperand
- .withArguments(constant));
- }
-
- @override
- String invalidSymbolName(
- List<TreeNode> context, TreeNode node, Constant constant) {
- return addProblem(
- node, templateConstEvalInvalidSymbolName.withArguments(constant));
- }
-
- @override
- String zeroDivisor(
- List<TreeNode> context, TreeNode node, IntConstant receiver, String op) {
- return addProblem(node,
- templateConstEvalZeroDivisor.withArguments(op, '${receiver.value}'));
- }
-
- @override
- String negativeShift(List<TreeNode> context, TreeNode node,
- IntConstant receiver, String op, IntConstant argument) {
- return addProblem(
- node,
- templateConstEvalNegativeShift.withArguments(
- op, '${receiver.value}', '${argument.value}'));
- }
-
- @override
- String nonConstLiteral(List<TreeNode> context, TreeNode node, String klass) {
- return addProblem(
- node, templateConstEvalNonConstantLiteral.withArguments(klass));
- }
-
- @override
- String failedAssertion(List<TreeNode> context, TreeNode node, String string) {
- return addProblem(
- node,
- (string == null)
- ? messageConstEvalFailedAssertion
- : templateConstEvalFailedAssertionWithMessage
- .withArguments(string));
- }
-
- @override
- String nonConstantVariableGet(
- List<TreeNode> context, TreeNode node, String variableName) {
- return addProblem(node,
- templateConstEvalNonConstantVariableGet.withArguments(variableName));
- }
-
- @override
- String deferredLibrary(
- List<TreeNode> context, TreeNode node, String importName) {
- return addProblem(
- node, templateConstEvalDeferredLibrary.withArguments(importName));
- }
-
- @override
- String circularity(List<TreeNode> context, TreeNode node) {
- return addProblem(node, messageConstEvalCircularity);
+ void reportInvalidExpression(InvalidExpression node) {
+ // Assumed to be already reported.
}
}
diff --git a/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart b/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
index d34ba34..484c95e 100644
--- a/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
@@ -23,7 +23,6 @@
StringLiteral,
SuperInitializer,
ThisExpression,
- TreeNode,
VariableGet;
import 'kernel_shadow_ast.dart' show ShadowClass;
@@ -94,9 +93,10 @@
this.stringType,
LibraryBuilder parent,
int startCharOffset,
- int charOffset)
+ int charOffset,
+ int charEndOffset)
: super(metadata, 0, name, null, null, null, scope, constructors, parent,
- null, startCharOffset, charOffset, TreeNode.noOffset,
+ null, startCharOffset, charOffset, charEndOffset,
cls: cls);
factory KernelEnumBuilder(
@@ -105,6 +105,7 @@
String name,
List<EnumConstantInfo> enumConstantInfos,
KernelLibraryBuilder parent,
+ int startCharOffset,
int charOffset,
int charEndOffset) {
assert(enumConstantInfos == null || enumConstantInfos.isNotEmpty);
@@ -226,8 +227,8 @@
members[name] = fieldBuilder..next = existing;
}
}
- final int startCharOffset =
- metadata == null ? charOffset : metadata.first.charOffset;
+ final int startCharOffsetComputed =
+ metadata == null ? startCharOffset : metadata.first.charOffset;
KernelEnumBuilder enumBuilder = new KernelEnumBuilder.internal(
metadata,
name,
@@ -241,8 +242,9 @@
objectType,
stringType,
parent,
- startCharOffset,
- charOffset);
+ startCharOffsetComputed,
+ charOffset,
+ charEndOffset);
void setParent(String name, MemberBuilder builder) {
do {
builder.parent = enumBuilder;
diff --git a/front_end/lib/src/fasta/kernel/kernel_field_builder.dart b/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
index 38d5e24..904f47d 100644
--- a/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
@@ -5,22 +5,23 @@
library fasta.kernel_field_builder;
import 'package:kernel/ast.dart'
- show DartType, DynamicType, Expression, Field, Name, NullLiteral;
-
-import '../../base/instrumentation.dart'
- show Instrumentation, InstrumentationValueForType;
+ show Class, DartType, DynamicType, Expression, Field, Name, NullLiteral;
import '../fasta_codes.dart' show messageInternalProblemAlreadyInitialized;
import '../problems.dart' show internalProblem, unsupported;
+import '../type_inference/type_inference_engine.dart'
+ show IncludesTypeParametersCovariantly;
+
import 'kernel_body_builder.dart' show KernelBodyBuilder;
import 'kernel_builder.dart'
show
+ ClassBuilder,
Declaration,
- ImplicitFieldType,
FieldBuilder,
+ ImplicitFieldType,
KernelLibraryBuilder,
KernelTypeBuilder,
MetadataBuilder;
@@ -58,6 +59,22 @@
field.name ??= new Name(name, library.target);
if (type != null) {
field.type = type.build(library);
+
+ if (!isFinal && !isConst) {
+ IncludesTypeParametersCovariantly needsCheckVisitor;
+ if (parent is ClassBuilder) {
+ Class enclosingClass = parent.target;
+ if (enclosingClass.typeParameters.isNotEmpty) {
+ needsCheckVisitor = new IncludesTypeParametersCovariantly(
+ enclosingClass.typeParameters);
+ }
+ }
+ if (needsCheckVisitor != null) {
+ if (field.type.accept(needsCheckVisitor)) {
+ field.isGenericCovariantImpl = true;
+ }
+ }
+ }
}
bool isInstanceMember = !isStatic && !isTopLevel;
field
@@ -96,13 +113,5 @@
}
@override
- void instrumentTopLevelInference(Instrumentation instrumentation) {
- if (isEligibleForInference) {
- instrumentation.record(field.fileUri, field.fileOffset, 'topType',
- new InstrumentationValueForType(field.type));
- }
- }
-
- @override
DartType get builtType => field.type;
}
diff --git a/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index a7fbd0a..c1d8ca8 100644
--- a/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -32,7 +32,6 @@
StaticInvocation,
StringLiteral,
Supertype,
- TreeNode,
Typedef,
TypeParameter,
TypeParameterType,
@@ -303,7 +302,8 @@
modifiers,
className,
typeVariables,
- applyMixins(supertype, charOffset, className, isMixinDeclaration,
+ applyMixins(supertype, startCharOffset, charOffset, charEndOffset,
+ className, isMixinDeclaration,
typeVariables: typeVariables),
interfaces,
classScope,
@@ -379,8 +379,13 @@
return typeVariablesByName;
}
- KernelTypeBuilder applyMixins(KernelTypeBuilder type, int charOffset,
- String subclassName, bool isMixinDeclaration,
+ KernelTypeBuilder applyMixins(
+ KernelTypeBuilder type,
+ int startCharOffset,
+ int charOffset,
+ int charEndOffset,
+ String subclassName,
+ bool isMixinDeclaration,
{String documentationComment,
List<MetadataBuilder> metadata,
String name,
@@ -553,9 +558,9 @@
}
}
}
- final int startCharOffset =
+ final int computedStartCharOffset =
(isNamedMixinApplication ? metadata : null) == null
- ? charOffset
+ ? startCharOffset
: metadata.first.charOffset;
SourceClassBuilder application = new SourceClassBuilder(
isNamedMixinApplication ? metadata : null,
@@ -575,9 +580,9 @@
isModifiable: false),
this,
<ConstructorReferenceBuilder>[],
- startCharOffset,
+ computedStartCharOffset,
charOffset,
- TreeNode.noOffset,
+ charEndOffset,
mixedInType: isMixinDeclaration ? null : mixin);
if (isNamedMixinApplication) {
loader.target.metadataCollector?.setDocumentationComment(
@@ -605,11 +610,13 @@
int modifiers,
KernelTypeBuilder mixinApplication,
List<KernelTypeBuilder> interfaces,
- int charOffset) {
+ int startCharOffset,
+ int charOffset,
+ int charEndOffset) {
// Nested declaration began in `OutlineBuilder.beginNamedMixinApplication`.
endNestedDeclaration(name).resolveTypes(typeVariables, this);
- KernelNamedTypeBuilder supertype = applyMixins(
- mixinApplication, charOffset, name, false,
+ KernelNamedTypeBuilder supertype = applyMixins(mixinApplication,
+ startCharOffset, charOffset, charEndOffset, name, false,
documentationComment: documentationComment,
metadata: metadata,
name: name,
@@ -819,11 +826,19 @@
List<MetadataBuilder> metadata,
String name,
List<EnumConstantInfo> enumConstantInfos,
+ int startCharOffset,
int charOffset,
int charEndOffset) {
MetadataCollector metadataCollector = loader.target.metadataCollector;
- KernelEnumBuilder builder = new KernelEnumBuilder(metadataCollector,
- metadata, name, enumConstantInfos, this, charOffset, charEndOffset);
+ KernelEnumBuilder builder = new KernelEnumBuilder(
+ metadataCollector,
+ metadata,
+ name,
+ enumConstantInfos,
+ this,
+ startCharOffset,
+ charOffset,
+ charEndOffset);
addBuilder(name, builder, charOffset);
metadataCollector?.setDocumentationComment(
builder.target, documentationComment);
@@ -1367,7 +1382,13 @@
unserializableExports ??= <String, String>{};
unserializableExports[name] = member.message.message;
} else {
- library.additionalExports.add(member.target.reference);
+ // Eventually (in #buildBuilder) members aren't added to the
+ // library if the have 'next' pointers, so don't add them as
+ // additionalExports either. Add the last one only (the one that
+ // will eventually be added to the library).
+ Declaration memberLast = member;
+ while (memberLast.next != null) memberLast = memberLast.next;
+ library.additionalExports.add(memberLast.target.reference);
}
}
}
diff --git a/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index 9dec3ab..2434d09 100644
--- a/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -8,6 +8,7 @@
show
Arguments,
AsyncMarker,
+ Class,
Constructor,
ConstructorInvocation,
DartType,
@@ -34,9 +35,6 @@
import 'package:kernel/type_algebra.dart' show containsTypeVariable, substitute;
-import '../../base/instrumentation.dart'
- show Instrumentation, InstrumentationValueForType;
-
import '../loader.dart' show Loader;
import '../messages.dart'
@@ -56,6 +54,9 @@
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
+import '../type_inference/type_inference_engine.dart'
+ show IncludesTypeParametersCovariantly;
+
import 'kernel_builder.dart'
show
ClassBuilder,
@@ -145,15 +146,34 @@
FunctionNode buildFunction(LibraryBuilder library) {
assert(function == null);
FunctionNode result = new FunctionNode(body, asyncMarker: asyncModifier);
+ IncludesTypeParametersCovariantly needsCheckVisitor;
+ if (!isConstructor && !isFactory && parent is ClassBuilder) {
+ Class enclosingClass = parent.target;
+ if (enclosingClass.typeParameters.isNotEmpty) {
+ needsCheckVisitor = new IncludesTypeParametersCovariantly(
+ enclosingClass.typeParameters);
+ }
+ }
if (typeVariables != null) {
for (KernelTypeVariableBuilder t in typeVariables) {
- result.typeParameters.add(t.parameter);
+ TypeParameter parameter = t.parameter;
+ result.typeParameters.add(parameter);
+ if (needsCheckVisitor != null) {
+ if (parameter.bound.accept(needsCheckVisitor)) {
+ parameter.isGenericCovariantImpl = true;
+ }
+ }
}
setParents(result.typeParameters, result);
}
if (formals != null) {
for (KernelFormalParameterBuilder formal in formals) {
VariableDeclaration parameter = formal.build(library, 0);
+ if (needsCheckVisitor != null) {
+ if (parameter.type.accept(needsCheckVisitor)) {
+ parameter.isGenericCovariantImpl = true;
+ }
+ }
if (formal.isNamed) {
result.namedParameters.add(parameter);
} else {
@@ -344,26 +364,6 @@
Procedure get target => origin.procedure;
@override
- void instrumentTopLevelInference(Instrumentation instrumentation) {
- bool isEligibleForTopLevelInference = this.isEligibleForTopLevelInference;
- if ((isEligibleForTopLevelInference || isSetter) && returnType == null) {
- instrumentation.record(procedure.fileUri, procedure.fileOffset, 'topType',
- new InstrumentationValueForType(procedure.function.returnType));
- }
- if (isEligibleForTopLevelInference) {
- if (formals != null) {
- for (var formal in formals) {
- if (formal.type == null) {
- VariableDeclaration formalTarget = formal.target;
- instrumentation.record(procedure.fileUri, formalTarget.fileOffset,
- 'topType', new InstrumentationValueForType(formalTarget.type));
- }
- }
- }
- }
- }
-
- @override
int finishPatch() {
if (!isPatch) return 0;
@@ -566,7 +566,7 @@
origin.constructor.isExternal = constructor.isExternal;
origin.constructor.function = constructor.function;
- origin.constructor.function.parent = constructor.function;
+ origin.constructor.function.parent = origin.constructor;
origin.constructor.initializers = constructor.initializers;
setParents(origin.constructor.initializers, origin.constructor);
return 1;
diff --git a/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 56c6840..e91b0a4 100644
--- a/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -35,12 +35,9 @@
import '../fasta_codes.dart'
show
- LocatedMessage,
messageCantDisambiguateAmbiguousInformation,
messageCantDisambiguateNotEnoughInformation,
messageNonNullAwareSpreadIsNull,
- messageSpreadElement,
- messageSpreadMapElement,
messageSwitchExpressionNotAssignableCause,
messageVoidExpression,
noLength,
@@ -83,7 +80,17 @@
import 'body_builder.dart' show combineStatements;
import 'collections.dart'
- show IfElement, SpreadElement, IfMapEntry, SpreadMapEntry;
+ show
+ ControlFlowMapEntry,
+ ForElement,
+ ForInElement,
+ ForInMapEntry,
+ ForMapEntry,
+ IfElement,
+ IfMapEntry,
+ SpreadElement,
+ SpreadMapEntry,
+ convertToElement;
import 'implicit_type_argument.dart' show ImplicitTypeArgument;
@@ -301,7 +308,6 @@
this, _inferenceInfo.gettersAndMethods, _inferenceInfo.builder.library);
interfaceResolver.finalizeCovariance(
this, _inferenceInfo.setters, _inferenceInfo.builder.library);
- interfaceResolver.recordInstrumentation(this);
}
/// Creates API members for this class.
diff --git a/front_end/lib/src/fasta/kernel/kernel_target.dart b/front_end/lib/src/fasta/kernel/kernel_target.dart
index a766167..4dd4cca 100644
--- a/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -43,9 +43,6 @@
import 'package:kernel/type_environment.dart' show TypeEnvironment;
-import 'package:kernel/transformations/constants.dart' as constants
- show transformLibraries;
-
import '../../api_prototype/file_system.dart' show FileSystem;
import '../compiler_context.dart' show CompilerContext;
@@ -73,7 +70,7 @@
templateMissingImplementationCause,
templateSuperclassHasNoDefaultConstructor;
-import '../problems.dart' show unhandled, unimplemented;
+import '../problems.dart' show unhandled;
import '../scope.dart' show AmbiguousBuilder;
@@ -85,6 +82,8 @@
import '../uri_translator.dart' show UriTranslator;
+import 'constant_evaluator.dart' as constants show transformLibraries;
+
import 'kernel_builder.dart'
show
ClassBuilder,
@@ -137,6 +136,9 @@
final Map<String, String> environmentDefines =
CompilerContext.current.options.environmentDefines;
+ final bool errorOnUnevaluatedConstant =
+ CompilerContext.current.options.errorOnUnevaluatedConstant;
+
final bool enableAsserts = CompilerContext.current.options.enableAsserts;
final List<Object> clonedFormals = <Object>[];
@@ -156,8 +158,9 @@
new SourceLoader(fileSystem, includeComments, this);
void addSourceInformation(
- Uri uri, List<int> lineStarts, List<int> sourceCode) {
- uriToSource[uri] = new Source(lineStarts, sourceCode);
+ Uri importUri, Uri fileUri, List<int> lineStarts, List<int> sourceCode) {
+ uriToSource[fileUri] =
+ new Source(lineStarts, sourceCode, importUri, fileUri);
}
/// Return list of same size as input with possibly translated uris.
@@ -329,8 +332,10 @@
Map<Uri, Source> uriToSource = new Map<Uri, Source>();
void copySource(Uri uri, Source source) {
- uriToSource[uri] =
- excludeSource ? new Source(source.lineStarts, const <int>[]) : source;
+ uriToSource[uri] = excludeSource
+ ? new Source(source.lineStarts, const <int>[], source.importUri,
+ source.fileUri)
+ : source;
}
this.uriToSource.forEach(copySource);
@@ -559,6 +564,10 @@
for (String platformLibrary in const [
"dart:_internal",
"dart:async",
+ // TODO(askesc): When all backends support set literals, we no longer
+ // need to index dart:collection, as it is only needed for desugaring of
+ // const sets. We can remove it from this list at that time.
+ "dart:collection",
"dart:core",
"dart:mirrors"
]) {
@@ -642,10 +651,14 @@
superTarget ??= defaultSuperConstructor(cls);
Initializer initializer;
if (superTarget == null) {
+ int offset = constructor.fileOffset;
+ if (offset == -1 && constructor.isSynthetic) {
+ offset = cls.fileOffset;
+ }
builder.addProblem(
templateSuperclassHasNoDefaultConstructor
.withArguments(cls.superclass.name),
- constructor.fileOffset,
+ offset,
noLength);
initializer = new InvalidInitializer();
} else {
@@ -709,11 +722,21 @@
field.initializer = new NullLiteral()..parent = field;
if (field.isFinal &&
(cls.constructors.isNotEmpty || cls.isMixinDeclaration)) {
- builder.library.addProblem(
- templateFinalFieldNotInitialized.withArguments(field.name.name),
- field.fileOffset,
- field.name.name.length,
- field.fileUri);
+ String uri = '${field.enclosingLibrary.importUri}';
+ String file = field.fileUri.pathSegments.last;
+ if (uri == 'dart:html' ||
+ uri == 'dart:svg' ||
+ uri == 'dart:_native_typed_data' ||
+ uri == 'dart:_interceptors' && file == 'js_string.dart') {
+ // TODO(johnniwinther): Use external getters instead of final
+ // fields. See https://github.com/dart-lang/sdk/issues/33762
+ } else {
+ builder.library.addProblem(
+ templateFinalFieldNotInitialized.withArguments(field.name.name),
+ field.fileOffset,
+ field.name.name.length,
+ field.fileUri);
+ }
}
}
}
@@ -759,8 +782,10 @@
backendTarget.constantsBackend(loader.coreTypes),
environmentDefines,
environment,
- new KernelConstantErrorReporter(loader, environment),
- enableAsserts: enableAsserts);
+ new KernelConstantErrorReporter(loader),
+ enableAsserts: enableAsserts,
+ desugarSets: !backendTarget.supportsSetLiterals,
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
ticker.logMs("Evaluated constants");
}
backendTarget.performModularTransformationsOnLibraries(
@@ -773,10 +798,6 @@
}
void runProcedureTransformations(Procedure procedure) {
- if (loader.target.enableConstantUpdate2018) {
- unimplemented('constant evaluation during expression evaluation',
- procedure.fileOffset, procedure.fileUri);
- }
backendTarget.performTransformationsOnProcedure(
loader.coreTypes, loader.hierarchy, procedure,
logger: (String msg) => ticker.logMs(msg));
diff --git a/front_end/lib/src/fasta/kernel/transform_collections.dart b/front_end/lib/src/fasta/kernel/transform_collections.dart
index 1afd831..bbc7186 100644
--- a/front_end/lib/src/fasta/kernel/transform_collections.dart
+++ b/front_end/lib/src/fasta/kernel/transform_collections.dart
@@ -9,6 +9,7 @@
import 'package:kernel/ast.dart'
show
Arguments,
+ AsExpression,
Block,
BlockExpression,
Class,
@@ -18,9 +19,9 @@
ExpressionStatement,
Field,
ForInStatement,
+ ForStatement,
IfStatement,
InterfaceType,
- InvalidExpression,
ListLiteral,
MapEntry,
MapLiteral,
@@ -33,15 +34,29 @@
SetLiteral,
Statement,
StaticInvocation,
+ transformList,
TreeNode,
VariableDeclaration,
VariableGet;
import 'package:kernel/core_types.dart' show CoreTypes;
+import 'package:kernel/type_environment.dart' show TypeEnvironment;
+
import 'package:kernel/visitor.dart' show Transformer;
-import 'collections.dart' show SpreadElement, SpreadMapEntry;
+import 'collections.dart'
+ show
+ ControlFlowElement,
+ ControlFlowMapEntry,
+ ForElement,
+ ForInElement,
+ ForInMapEntry,
+ ForMapEntry,
+ IfElement,
+ IfMapEntry,
+ SpreadElement,
+ SpreadMapEntry;
import '../source/source_loader.dart' show SourceLoader;
@@ -49,6 +64,7 @@
class CollectionTransformer extends Transformer {
final CoreTypes coreTypes;
+ final TypeEnvironment typeEnvironment;
final Procedure listAdd;
final Procedure setFactory;
final Procedure setAdd;
@@ -67,6 +83,7 @@
CollectionTransformer(SourceLoader loader)
: coreTypes = loader.coreTypes,
+ typeEnvironment = loader.typeInferenceEngine.typeSchemaEnvironment,
listAdd = loader.coreTypes.index.getMember('dart:core', 'List', 'add'),
setFactory = _findSetFactory(loader.coreTypes),
setAdd = loader.coreTypes.index.getMember('dart:core', 'Set', 'add'),
@@ -84,33 +101,17 @@
TreeNode _translateListOrSet(
Expression node, DartType elementType, List<Expression> elements,
- {bool isSet: false, bool isConst: false}) {
- // Translate elements in place up to the first spread if any.
+ {bool isSet: false}) {
+ // Translate elements in place up to the first non-expression, if any.
int i = 0;
for (; i < elements.length; ++i) {
- if (elements[i] is SpreadElement) break;
+ if (elements[i] is ControlFlowElement) break;
elements[i] = elements[i].accept(this)..parent = node;
}
- // If there was no spread, we are done.
+ // If there were only expressions, we are done.
if (i == elements.length) return node;
- if (isConst) {
- // We don't desugar const lists here. Remove spread for now so that they
- // don't leak out.
- for (; i < elements.length; ++i) {
- Expression element = elements[i];
- if (element is SpreadElement) {
- elements[i] = InvalidExpression('unimplemented spread element')
- ..fileOffset = element.fileOffset
- ..parent = node;
- } else {
- elements[i] = element.accept(this)..parent = node;
- }
- }
- return node;
- }
-
// Build a block expression and create an empty list or set.
VariableDeclaration result;
if (isSet) {
@@ -128,165 +129,354 @@
isFinal: true);
}
List<Statement> body = [result];
- // Add the elements up to the first spread.
+ // Add the elements up to the first non-expression.
for (int j = 0; j < i; ++j) {
- body.add(new ExpressionStatement(new MethodInvocation(
- new VariableGet(result),
- new Name('add'),
- new Arguments([elements[j]]),
- isSet ? setAdd : listAdd)));
+ _addExpressionElement(elements[j], isSet, result, body);
}
- // Translate the elements starting with the first spread.
+ // Translate the elements starting with the first non-expression.
for (; i < elements.length; ++i) {
- Expression element = elements[i];
- if (element is SpreadElement) {
- Expression value = element.expression.accept(this);
- // Null-aware spreads require testing the subexpression's value.
- VariableDeclaration temp;
- if (element.isNullAware) {
- temp = new VariableDeclaration.forValue(value,
- type: const DynamicType(), isFinal: true);
- body.add(temp);
- value = new VariableGet(temp);
- }
-
- VariableDeclaration elt =
- new VariableDeclaration(null, type: elementType, isFinal: true);
- Statement statement = new ForInStatement(
- elt,
- value,
- new ExpressionStatement(new MethodInvocation(
- new VariableGet(result),
- new Name('add'),
- new Arguments([new VariableGet(elt)]),
- isSet ? setAdd : listAdd)));
-
- if (element.isNullAware) {
- statement = new IfStatement(
- new Not(new MethodInvocation(
- new VariableGet(temp),
- new Name('=='),
- new Arguments([new NullLiteral()]),
- objectEquals)),
- statement,
- null);
- }
- body.add(statement);
- } else {
- body.add(new ExpressionStatement(new MethodInvocation(
- new VariableGet(result),
- new Name('add'),
- new Arguments([element.accept(this)]),
- isSet ? setAdd : listAdd)));
- }
+ _translateElement(elements[i], elementType, isSet, result, body);
}
return new BlockExpression(new Block(body), new VariableGet(result));
}
+ void _translateElement(Expression element, DartType elementType, bool isSet,
+ VariableDeclaration result, List<Statement> body) {
+ if (element is SpreadElement) {
+ _translateSpreadElement(element, elementType, isSet, result, body);
+ } else if (element is IfElement) {
+ _translateIfElement(element, elementType, isSet, result, body);
+ } else if (element is ForElement) {
+ _translateForElement(element, elementType, isSet, result, body);
+ } else if (element is ForInElement) {
+ _translateForInElement(element, elementType, isSet, result, body);
+ } else {
+ _addExpressionElement(element.accept(this), isSet, result, body);
+ }
+ }
+
+ void _addExpressionElement(Expression element, bool isSet,
+ VariableDeclaration result, List<Statement> body) {
+ body.add(new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('add'),
+ new Arguments([element]),
+ isSet ? setAdd : listAdd)));
+ }
+
+ void _translateIfElement(IfElement element, DartType elementType, bool isSet,
+ VariableDeclaration result, List<Statement> body) {
+ List<Statement> thenStatements = [];
+ _translateElement(element.then, elementType, isSet, result, thenStatements);
+ List<Statement> elseStatements;
+ if (element.otherwise != null) {
+ _translateElement(element.otherwise, elementType, isSet, result,
+ elseStatements = <Statement>[]);
+ }
+ Statement thenBody = thenStatements.length == 1
+ ? thenStatements.first
+ : new Block(thenStatements);
+ Statement elseBody;
+ if (elseStatements != null && elseStatements.isNotEmpty) {
+ elseBody = elseStatements.length == 1
+ ? elseStatements.first
+ : new Block(elseStatements);
+ }
+ body.add(new IfStatement(element.condition.accept(this), thenBody, elseBody)
+ ..fileOffset = element.fileOffset);
+ }
+
+ void _translateForElement(ForElement element, DartType elementType,
+ bool isSet, VariableDeclaration result, List<Statement> body) {
+ List<Statement> statements = <Statement>[];
+ _translateElement(element.body, elementType, isSet, result, statements);
+ Statement loopBody =
+ statements.length == 1 ? statements.first : new Block(statements);
+ ForStatement loop = new ForStatement(element.variables,
+ element.condition?.accept(this), element.updates, loopBody)
+ ..fileOffset = element.fileOffset;
+ transformList(loop.variables, this, loop);
+ transformList(loop.updates, this, loop);
+ body.add(loop);
+ }
+
+ void _translateForInElement(ForInElement element, DartType elementType,
+ bool isSet, VariableDeclaration result, List<Statement> body) {
+ List<Statement> statements;
+ Statement prologue = element.prologue;
+ if (prologue == null) {
+ statements = <Statement>[];
+ } else {
+ prologue = prologue.accept(this);
+ statements =
+ prologue is Block ? prologue.statements : <Statement>[prologue];
+ }
+ _translateElement(element.body, elementType, isSet, result, statements);
+ Statement loopBody =
+ statements.length == 1 ? statements.first : new Block(statements);
+ if (element.problem != null) {
+ body.add(new ExpressionStatement(element.problem.accept(this)));
+ }
+ body.add(new ForInStatement(
+ element.variable, element.iterable.accept(this), loopBody,
+ isAsync: element.isAsync)
+ ..fileOffset = element.fileOffset);
+ }
+
+ void _translateSpreadElement(SpreadElement element, DartType elementType,
+ bool isSet, VariableDeclaration result, List<Statement> body) {
+ Expression value = element.expression.accept(this);
+ // Null-aware spreads require testing the subexpression's value.
+ VariableDeclaration temp;
+ if (element.isNullAware) {
+ temp = new VariableDeclaration.forValue(value,
+ type: const DynamicType(), isFinal: true);
+ body.add(temp);
+ value = new VariableGet(temp);
+ }
+
+ VariableDeclaration elt;
+ Statement loopBody;
+ if (element.elementType == null ||
+ !typeEnvironment.isSubtypeOf(element.elementType, elementType)) {
+ elt = new VariableDeclaration(null,
+ type: const DynamicType(), isFinal: true);
+ VariableDeclaration castedVar = new VariableDeclaration.forValue(
+ new AsExpression(new VariableGet(elt), elementType)
+ ..isTypeError = true
+ ..fileOffset = element.expression.fileOffset,
+ type: elementType);
+ loopBody = new Block(<Statement>[
+ castedVar,
+ new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('add'),
+ new Arguments([new VariableGet(castedVar)]),
+ isSet ? setAdd : listAdd))
+ ]);
+ } else {
+ elt = new VariableDeclaration(null, type: elementType, isFinal: true);
+ loopBody = new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('add'),
+ new Arguments([new VariableGet(elt)]),
+ isSet ? setAdd : listAdd));
+ }
+ Statement statement = new ForInStatement(elt, value, loopBody);
+
+ if (element.isNullAware) {
+ statement = new IfStatement(
+ new Not(new MethodInvocation(new VariableGet(temp), new Name('=='),
+ new Arguments([new NullLiteral()]), objectEquals)),
+ statement,
+ null);
+ }
+ body.add(statement);
+ }
+
@override
TreeNode visitListLiteral(ListLiteral node) {
+ // Const collections are handled by the constant evaluator.
+ if (node.isConst) return node;
+
return _translateListOrSet(node, node.typeArgument, node.expressions,
- isConst: node.isConst, isSet: false);
+ isSet: false);
}
@override
TreeNode visitSetLiteral(SetLiteral node) {
+ // Const collections are handled by the constant evaluator.
+ if (node.isConst) return node;
+
return _translateListOrSet(node, node.typeArgument, node.expressions,
- isConst: node.isConst, isSet: true);
+ isSet: true);
}
@override
TreeNode visitMapLiteral(MapLiteral node) {
+ // Const collections are handled by the constant evaluator.
+ if (node.isConst) return node;
+
+ // Translate entries in place up to the first control-flow entry, if any.
int i = 0;
for (; i < node.entries.length; ++i) {
- if (node.entries[i] is SpreadMapEntry) break;
+ if (node.entries[i] is ControlFlowMapEntry) break;
node.entries[i] = node.entries[i].accept(this)..parent = node;
}
+ // If there were no control-flow entries we are done.
if (i == node.entries.length) return node;
- if (node.isConst) {
- // We don't desugar const maps here. REmove spread for now so that they
- // don't leak out.
- for (; i < node.entries.length; ++i) {
- MapEntry entry = node.entries[i];
- if (entry is SpreadMapEntry) {
- entry.parent.replaceChild(
- entry,
- new MapEntry(
- InvalidExpression('unimplemented spread element')
- ..fileOffset = entry.fileOffset,
- new NullLiteral()));
- }
- }
- }
-
- VariableDeclaration map = new VariableDeclaration.forValue(
+ // Build a block expression and create an empty map.
+ VariableDeclaration result = new VariableDeclaration.forValue(
new MapLiteral([], keyType: node.keyType, valueType: node.valueType),
type: new InterfaceType(
coreTypes.mapClass, [node.keyType, node.valueType]),
isFinal: true);
- List<Statement> body = [map];
+ List<Statement> body = [result];
+ // Add all the entries up to the first control-flow entry.
for (int j = 0; j < i; ++j) {
- body.add(new ExpressionStatement(new MethodInvocation(
- new VariableGet(map),
- new Name('[]='),
- new Arguments([node.entries[j].key, node.entries[j].value]),
- mapPut)));
+ _addNormalEntry(node.entries[j], result, body);
}
- DartType mapEntryType =
- new InterfaceType(mapEntryClass, [node.keyType, node.valueType]);
for (; i < node.entries.length; ++i) {
- MapEntry entry = node.entries[i];
- if (entry is SpreadMapEntry) {
- Expression value = entry.expression.accept(this);
- // Null-aware spreads require testing the subexpression's value.
- VariableDeclaration temp;
- if (entry.isNullAware) {
- temp = new VariableDeclaration.forValue(value,
- type: coreTypes.mapClass.rawType);
- body.add(temp);
- value = new VariableGet(temp);
- }
-
- VariableDeclaration elt =
- new VariableDeclaration(null, type: mapEntryType, isFinal: true);
- Statement statement = new ForInStatement(
- elt,
- new PropertyGet(value, new Name('entries'), mapEntries),
- new ExpressionStatement(new MethodInvocation(
- new VariableGet(map),
- new Name('[]='),
- new Arguments([
- new PropertyGet(
- new VariableGet(elt), new Name('key'), mapEntryKey),
- new PropertyGet(
- new VariableGet(elt), new Name('value'), mapEntryValue)
- ]),
- mapPut)));
-
- if (entry.isNullAware) {
- statement = new IfStatement(
- new Not(new MethodInvocation(
- new VariableGet(temp),
- new Name('=='),
- new Arguments([new NullLiteral()]),
- objectEquals)),
- statement,
- null);
- }
- body.add(statement);
- } else {
- entry = entry.accept(this);
- body.add(new ExpressionStatement(new MethodInvocation(
- new VariableGet(map),
- new Name('[]='),
- new Arguments([entry.key, entry.value]),
- mapPut)));
- }
+ _translateEntry(
+ node.entries[i], node.keyType, node.valueType, result, body);
}
- return new BlockExpression(new Block(body), new VariableGet(map));
+ return new BlockExpression(new Block(body), new VariableGet(result));
+ }
+
+ void _translateEntry(MapEntry entry, DartType keyType, DartType valueType,
+ VariableDeclaration result, List<Statement> body) {
+ if (entry is SpreadMapEntry) {
+ _translateSpreadEntry(entry, keyType, valueType, result, body);
+ } else if (entry is IfMapEntry) {
+ _translateIfEntry(entry, keyType, valueType, result, body);
+ } else if (entry is ForMapEntry) {
+ _translateForEntry(entry, keyType, valueType, result, body);
+ } else if (entry is ForInMapEntry) {
+ _translateForInEntry(entry, keyType, valueType, result, body);
+ } else {
+ _addNormalEntry(entry.accept(this), result, body);
+ }
+ }
+
+ void _addNormalEntry(
+ MapEntry entry, VariableDeclaration result, List<Statement> body) {
+ body.add(new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('[]='),
+ new Arguments([entry.key, entry.value]),
+ mapPut)));
+ }
+
+ void _translateIfEntry(IfMapEntry entry, DartType keyType, DartType valueType,
+ VariableDeclaration result, List<Statement> body) {
+ List<Statement> thenBody = [];
+ _translateEntry(entry.then, keyType, valueType, result, thenBody);
+ List<Statement> elseBody;
+ if (entry.otherwise != null) {
+ _translateEntry(entry.otherwise, keyType, valueType, result,
+ elseBody = <Statement>[]);
+ }
+ Statement thenStatement =
+ thenBody.length == 1 ? thenBody.first : new Block(thenBody);
+ Statement elseStatement;
+ if (elseBody != null && elseBody.isNotEmpty) {
+ elseStatement =
+ elseBody.length == 1 ? elseBody.first : new Block(elseBody);
+ }
+ body.add(new IfStatement(
+ entry.condition.accept(this), thenStatement, elseStatement));
+ }
+
+ void _translateForEntry(ForMapEntry entry, DartType keyType,
+ DartType valueType, VariableDeclaration result, List<Statement> body) {
+ List<Statement> statements = <Statement>[];
+ _translateEntry(entry.body, keyType, valueType, result, statements);
+ Statement loopBody =
+ statements.length == 1 ? statements.first : new Block(statements);
+ ForStatement loop = new ForStatement(
+ entry.variables, entry.condition?.accept(this), entry.updates, loopBody)
+ ..fileOffset = entry.fileOffset;
+ transformList(loop.variables, this, loop);
+ transformList(loop.updates, this, loop);
+ body.add(loop);
+ }
+
+ void _translateForInEntry(ForInMapEntry entry, DartType keyType,
+ DartType valueType, VariableDeclaration result, List<Statement> body) {
+ List<Statement> statements;
+ Statement prologue = entry.prologue;
+ if (prologue == null) {
+ statements = <Statement>[];
+ } else {
+ prologue = prologue.accept(this);
+ statements =
+ prologue is Block ? prologue.statements : <Statement>[prologue];
+ }
+ _translateEntry(entry.body, keyType, valueType, result, statements);
+ Statement loopBody =
+ statements.length == 1 ? statements.first : new Block(statements);
+ if (entry.problem != null) {
+ body.add(new ExpressionStatement(entry.problem.accept(this)));
+ }
+ body.add(new ForInStatement(
+ entry.variable, entry.iterable.accept(this), loopBody,
+ isAsync: entry.isAsync)
+ ..fileOffset = entry.fileOffset);
+ }
+
+ void _translateSpreadEntry(SpreadMapEntry entry, DartType keyType,
+ DartType valueType, VariableDeclaration result, List<Statement> body) {
+ Expression value = entry.expression.accept(this);
+ // Null-aware spreads require testing the subexpression's value.
+ VariableDeclaration temp;
+ if (entry.isNullAware) {
+ temp = new VariableDeclaration.forValue(value,
+ type: coreTypes.mapClass.rawType);
+ body.add(temp);
+ value = new VariableGet(temp);
+ }
+
+ DartType entryType =
+ new InterfaceType(mapEntryClass, <DartType>[keyType, valueType]);
+ VariableDeclaration elt;
+ Statement loopBody;
+ if (entry.entryType == null ||
+ !typeEnvironment.isSubtypeOf(entry.entryType, entryType)) {
+ elt = new VariableDeclaration(null,
+ type: new InterfaceType(mapEntryClass,
+ <DartType>[const DynamicType(), const DynamicType()]),
+ isFinal: true);
+ VariableDeclaration keyVar = new VariableDeclaration.forValue(
+ new AsExpression(
+ new PropertyGet(
+ new VariableGet(elt), new Name('key'), mapEntryKey),
+ keyType)
+ ..isTypeError = true
+ ..fileOffset = entry.expression.fileOffset,
+ type: keyType);
+ VariableDeclaration valueVar = new VariableDeclaration.forValue(
+ new AsExpression(
+ new PropertyGet(
+ new VariableGet(elt), new Name('value'), mapEntryValue),
+ valueType)
+ ..isTypeError = true
+ ..fileOffset = entry.expression.fileOffset,
+ type: valueType);
+ loopBody = new Block(<Statement>[
+ keyVar,
+ valueVar,
+ new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('[]='),
+ new Arguments([new VariableGet(keyVar), new VariableGet(valueVar)]),
+ mapPut))
+ ]);
+ } else {
+ elt = new VariableDeclaration(null, type: entryType, isFinal: true);
+ loopBody = new ExpressionStatement(new MethodInvocation(
+ new VariableGet(result),
+ new Name('[]='),
+ new Arguments([
+ new PropertyGet(new VariableGet(elt), new Name('key'), mapEntryKey),
+ new PropertyGet(
+ new VariableGet(elt), new Name('value'), mapEntryValue)
+ ]),
+ mapPut));
+ }
+ Statement statement = new ForInStatement(
+ elt, new PropertyGet(value, new Name('entries'), mapEntries), loopBody);
+
+ if (entry.isNullAware) {
+ statement = new IfStatement(
+ new Not(new MethodInvocation(new VariableGet(temp), new Name('=='),
+ new Arguments([new NullLiteral()]), objectEquals)),
+ statement,
+ null);
+ }
+ body.add(statement);
}
}
diff --git a/front_end/lib/src/fasta/kernel/transform_set_literals.dart b/front_end/lib/src/fasta/kernel/transform_set_literals.dart
index abc2f4d..3480b2b 100644
--- a/front_end/lib/src/fasta/kernel/transform_set_literals.dart
+++ b/front_end/lib/src/fasta/kernel/transform_set_literals.dart
@@ -44,6 +44,7 @@
final Procedure setFactory;
final Procedure addMethod;
final Constructor unmodifiableSetConstructor;
+ final bool transformConst;
static Procedure _findSetFactory(CoreTypes coreTypes) {
Procedure factory = coreTypes.index.getMember('dart:core', 'Set', '');
@@ -76,7 +77,7 @@
return null;
}
- SetLiteralTransformer(SourceLoader loader)
+ SetLiteralTransformer(SourceLoader loader, {this.transformConst: true})
: coreTypes = loader.coreTypes,
nullType = new InterfaceType(loader.coreTypes.nullClass, []),
setFactory = _findSetFactory(loader.coreTypes),
@@ -85,6 +86,7 @@
TreeNode visitSetLiteral(SetLiteral node) {
if (node.isConst) {
+ if (!transformConst) return node;
List<MapEntry> entries = new List<MapEntry>(node.expressions.length);
for (int i = 0; i < node.expressions.length; i++) {
// expression_i: null
diff --git a/front_end/lib/src/fasta/kernel/type_labeler.dart b/front_end/lib/src/fasta/kernel/type_labeler.dart
index 43815bf..7b329bf 100644
--- a/front_end/lib/src/fasta/kernel/type_labeler.dart
+++ b/front_end/lib/src/fasta/kernel/type_labeler.dart
@@ -20,6 +20,7 @@
InstanceConstant,
IntConstant,
InterfaceType,
+ Library,
ListConstant,
MapConstant,
NullConstant,
@@ -29,6 +30,7 @@
StringConstant,
SymbolConstant,
TearOffConstant,
+ TreeNode,
TypedefType,
TypeLiteralConstant,
TypeParameter,
@@ -50,9 +52,8 @@
/// distinguish different types with the same name. This is used in diagnostic
/// messages to indicate the origins of types occurring in the message.
class TypeLabeler implements DartTypeVisitor<void>, ConstantVisitor<void> {
- List<LabeledClassName> names = <LabeledClassName>[];
- Map<String, List<LabeledClassName>> nameMap =
- <String, List<LabeledClassName>>{};
+ List<LabeledNode> names = <LabeledNode>[];
+ Map<String, List<LabeledNode>> nameMap = <String, List<LabeledNode>>{};
List<Object> result;
@@ -84,7 +85,7 @@
/// types and constants that have been pretty-printed using this labeler.
String get originMessages {
StringBuffer messages = new StringBuffer();
- for (LabeledClassName name in names) {
+ for (LabeledNode name in names) {
messages.write(name.originMessage);
}
return messages.toString();
@@ -99,25 +100,28 @@
return false;
}
- LabeledClassName nameForClass(Class classNode) {
- List<LabeledClassName> classesForName = nameMap[classNode.name];
- if (classesForName == null) {
- // First encountered class with this name
- LabeledClassName name = new LabeledClassName(classNode, this);
+ LabeledNode nameForEntity(
+ TreeNode node, String nodeName, Uri importUri, Uri fileUri) {
+ List<LabeledNode> labelsForName = nameMap[nodeName];
+ if (labelsForName == null) {
+ // First encountered entity with this name
+ LabeledNode name =
+ new LabeledNode(node, nodeName, importUri, fileUri, this);
names.add(name);
- nameMap[classNode.name] = [name];
+ nameMap[nodeName] = [name];
return name;
} else {
- for (LabeledClassName classForName in classesForName) {
- if (classForName.classNode == classNode) {
- // Previously encountered class
- return classForName;
+ for (LabeledNode entityForName in labelsForName) {
+ if (entityForName.node == node) {
+ // Previously encountered entity
+ return entityForName;
}
}
- // New class with name that was previously encountered
- LabeledClassName name = new LabeledClassName(classNode, this);
+ // New entity with name that was previously encountered
+ LabeledNode name =
+ new LabeledNode(node, nodeName, importUri, fileUri, this);
names.add(name);
- classesForName.add(name);
+ labelsForName.add(name);
return name;
}
}
@@ -144,7 +148,19 @@
}
void visitTypeParameterType(TypeParameterType node) {
- result.add(node.parameter.name);
+ TreeNode parent = node.parameter;
+ while (parent is! Library && parent != null) {
+ parent = parent.parent;
+ }
+ // Note that this can be null if, for instance, the errornious code is not
+ // actually in the tree - then we don't know where it comes from!
+ Library enclosingLibrary = parent;
+
+ result.add(nameForEntity(
+ node.parameter,
+ node.parameter.name,
+ enclosingLibrary == null ? unknownUri : enclosingLibrary.importUri,
+ enclosingLibrary == null ? unknownUri : enclosingLibrary.fileUri));
}
void visitFunctionType(FunctionType node) {
@@ -201,7 +217,12 @@
}
void visitInterfaceType(InterfaceType node) {
- result.add(nameForClass(node.classNode));
+ Class classNode = node.classNode;
+ result.add(nameForEntity(
+ classNode,
+ classNode.name,
+ classNode.enclosingLibrary.importUri,
+ classNode.enclosingLibrary.fileUri));
if (node.typeArguments.isNotEmpty) {
result.add("<");
bool first = true;
@@ -301,7 +322,11 @@
Procedure procedure = node.procedure;
Class classNode = procedure.enclosingClass;
if (classNode != null) {
- result.add(nameForClass(classNode));
+ result.add(nameForEntity(
+ classNode,
+ classNode.name,
+ classNode.enclosingLibrary.importUri,
+ classNode.enclosingLibrary.fileUri));
result.add(".");
}
result.add(procedure.name.name);
@@ -330,34 +355,44 @@
}
}
-class LabeledClassName {
- Class classNode;
- TypeLabeler typeLabeler;
+final Uri unknownUri = Uri.parse("unknown");
- LabeledClassName(this.classNode, this.typeLabeler);
+class LabeledNode {
+ final TreeNode node;
+ final TypeLabeler typeLabeler;
+ final String name;
+ final Uri importUri;
+ final Uri fileUri;
+
+ LabeledNode(
+ this.node, this.name, this.importUri, this.fileUri, this.typeLabeler);
String toString() {
- String name = classNode.name;
- List<LabeledClassName> classesForName = typeLabeler.nameMap[name];
- if (classesForName.length == 1) {
+ List<LabeledNode> entityForName = typeLabeler.nameMap[name];
+ if (entityForName.length == 1) {
return name;
}
- return "$name/*${classesForName.indexOf(this) + 1}*/";
+ return "$name/*${entityForName.indexOf(this) + 1}*/";
}
String get originMessage {
- Uri importUri = classNode.enclosingLibrary.importUri;
if (importUri.scheme == 'dart' && importUri.path == 'core') {
- String name = classNode.name;
- if (blacklistedCoreClasses.contains(name)) {
+ if (node is Class && blacklistedCoreClasses.contains(name)) {
// Blacklisted core class. Only print if ambiguous.
- List<LabeledClassName> classesForName = typeLabeler.nameMap[name];
- if (classesForName.length == 1) {
+ List<LabeledNode> entityForName = typeLabeler.nameMap[name];
+ if (entityForName.length == 1) {
return "";
}
}
}
- Uri fileUri = classNode.enclosingLibrary.fileUri;
+ if (importUri == unknownUri || node is! Class) {
+ // We don't know where it comes from and/or it's not a class.
+ // Only print if ambiguous.
+ List<LabeledNode> entityForName = typeLabeler.nameMap[name];
+ if (entityForName.length == 1) {
+ return "";
+ }
+ }
Message message = (importUri == fileUri || importUri.scheme == 'dart')
? templateTypeOrigin.withArguments(toString(), importUri)
: templateTypeOriginWithFileUri.withArguments(
diff --git a/front_end/lib/src/fasta/kernel/utils.dart b/front_end/lib/src/fasta/kernel/utils.dart
index ac98334..1b96164 100644
--- a/front_end/lib/src/fasta/kernel/utils.dart
+++ b/front_end/lib/src/fasta/kernel/utils.dart
@@ -60,12 +60,12 @@
/// Serialize the libraries in [component] that match [filter].
List<int> serializeComponent(Component component,
- {bool filter(Library library), bool excludeUriToSource: false}) {
+ {bool filter(Library library), bool includeSources: true}) {
ByteSink byteSink = new ByteSink();
- BinaryPrinter printer = filter == null && !excludeUriToSource
- ? new BinaryPrinter(byteSink)
+ BinaryPrinter printer = filter == null
+ ? new BinaryPrinter(byteSink, includeSources: includeSources)
: new LimitedBinaryPrinter(
- byteSink, filter ?? (_) => true, excludeUriToSource);
+ byteSink, filter ?? (_) => true, !includeSources);
printer.writeComponentFile(component);
return byteSink.builder.takeBytes();
}
diff --git a/front_end/lib/src/fasta/kernel/verifier.dart b/front_end/lib/src/fasta/kernel/verifier.dart
index 67ce675..26d6421 100644
--- a/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/front_end/lib/src/fasta/kernel/verifier.dart
@@ -11,7 +11,6 @@
Component,
ExpressionStatement,
Field,
- InvalidInitializer,
Let,
Library,
Member,
@@ -175,11 +174,6 @@
}
@override
- visitInvalidInitializer(InvalidInitializer node) {
- problem(node, "Invalid initializer.");
- }
-
- @override
visitUnknownType(UnknownType node) {
// Note: we can't pass [node] to [problem] because it's not a [TreeNode].
problem(null, "Unexpected appearance of the unknown type.");
diff --git a/front_end/lib/src/fasta/loader.dart b/front_end/lib/src/fasta/loader.dart
index da5a124..67b5cb2 100644
--- a/front_end/lib/src/fasta/loader.dart
+++ b/front_end/lib/src/fasta/loader.dart
@@ -170,6 +170,10 @@
void ensureCoreLibrary() {
if (coreLibrary == null) {
read(Uri.parse("dart:core"), 0, accessor: first);
+ // TODO(askesc): When all backends support set literals, we no longer
+ // need to index dart:collection, as it is only needed for desugaring of
+ // const sets. We can remove it from this list at that time.
+ read(Uri.parse("dart:collection"), 0, accessor: first);
assert(coreLibrary != null);
}
}
@@ -275,8 +279,6 @@
target.context.report(
message.withLocation(fileUri, charOffset, length), severity,
context: context);
- recordMessage(severity, message, charOffset, length, fileUri,
- context: context);
if (severity == Severity.error) {
(wasHandled ? handledErrors : unhandledErrors)
.add(message.withLocation(fileUri, charOffset, length));
@@ -301,10 +303,6 @@
Declaration getNativeAnnotation() => target.getNativeAnnotation(this);
- void recordMessage(Severity severity, Message message, int charOffset,
- int length, Uri fileUri,
- {List<LocatedMessage> context}) {}
-
ClassBuilder<TypeBuilder, Object> computeClassBuilderFromTargetClass(
covariant Object cls);
diff --git a/front_end/lib/src/fasta/names.dart b/front_end/lib/src/fasta/names.dart
index ab5b774..421d4be 100644
--- a/front_end/lib/src/fasta/names.dart
+++ b/front_end/lib/src/fasta/names.dart
@@ -60,6 +60,8 @@
final Name rightShiftName = new Name(">>");
+final Name tripleShiftName = new Name(">>>");
+
final Name tildeName = new Name("~");
final Name unaryMinusName = new Name("unary-");
diff --git a/front_end/lib/src/fasta/operator.dart b/front_end/lib/src/fasta/operator.dart
index dad4440..1617a5a 100644
--- a/front_end/lib/src/fasta/operator.dart
+++ b/front_end/lib/src/fasta/operator.dart
@@ -25,6 +25,7 @@
modulo,
multiply,
rightShift,
+ tripleShift,
subtract,
truncatingDivide,
unaryMinus,
@@ -48,6 +49,7 @@
if (identical("%", string)) return Operator.modulo;
if (identical("*", string)) return Operator.multiply;
if (identical(">>", string)) return Operator.rightShift;
+ if (identical(">>>", string)) return Operator.tripleShift;
if (identical("-", string)) return Operator.subtract;
if (identical("~/", string)) return Operator.truncatingDivide;
if (identical("unary-", string)) return Operator.unaryMinus;
@@ -90,6 +92,8 @@
return "*";
case Operator.rightShift:
return ">>";
+ case Operator.tripleShift:
+ return ">>>";
case Operator.subtract:
return "-";
case Operator.truncatingDivide:
@@ -121,6 +125,7 @@
case Operator.modulo:
case Operator.multiply:
case Operator.rightShift:
+ case Operator.tripleShift:
case Operator.subtract:
case Operator.truncatingDivide:
return 1;
diff --git a/front_end/lib/src/fasta/parser/forwarding_listener.dart b/front_end/lib/src/fasta/parser/forwarding_listener.dart
index 10f0a20..bb60229 100644
--- a/front_end/lib/src/fasta/parser/forwarding_listener.dart
+++ b/front_end/lib/src/fasta/parser/forwarding_listener.dart
@@ -172,10 +172,10 @@
}
@override
- void beginFormalParameter(Token token, MemberKind kind, Token covariantToken,
- Token varFinalOrConst) {
+ void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
+ Token covariantToken, Token varFinalOrConst) {
listener?.beginFormalParameter(
- token, kind, covariantToken, varFinalOrConst);
+ token, kind, requiredToken, covariantToken, varFinalOrConst);
}
@override
@@ -224,6 +224,11 @@
}
@override
+ void beginThenControlFlow(Token token) {
+ listener?.beginThenControlFlow(token);
+ }
+
+ @override
void beginIfStatement(Token token) {
listener?.beginIfStatement(token);
}
@@ -407,8 +412,9 @@
}
@override
- void beginVariablesDeclaration(Token token, Token varFinalOrConst) {
- listener?.beginVariablesDeclaration(token, varFinalOrConst);
+ void beginVariablesDeclaration(
+ Token token, Token lateToken, Token varFinalOrConst) {
+ listener?.beginVariablesDeclaration(token, lateToken, varFinalOrConst);
}
@override
@@ -562,10 +568,10 @@
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
- listener?.endFields(staticToken, covariantToken, varFinalOrConst, count,
- beginToken, endToken);
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ listener?.endFields(staticToken, covariantToken, lateToken, varFinalOrConst,
+ count, beginToken, endToken);
}
@override
@@ -841,10 +847,16 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
- listener?.endTopLevelFields(staticToken, covariantToken, varFinalOrConst,
- count, beginToken, endToken);
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
+ listener?.endTopLevelFields(staticToken, covariantToken, lateToken,
+ varFinalOrConst, count, beginToken, endToken);
}
@override
@@ -1027,6 +1039,11 @@
}
@override
+ void handleErrorToken(ErrorToken token) {
+ listener?.handleErrorToken(token);
+ }
+
+ @override
void handleExpressionFunctionBody(Token arrowToken, Token endToken) {
listener?.handleExpressionFunctionBody(arrowToken, endToken);
}
@@ -1456,6 +1473,11 @@
}
@override
+ void reportNonNullableModifierError(Token modifierToken) {
+ listener?.reportNonNullableModifierError(modifierToken);
+ }
+
+ @override
set suppressParseErrors(bool value) {
listener?.suppressParseErrors = value;
}
diff --git a/front_end/lib/src/fasta/parser/identifier_context_impl.dart b/front_end/lib/src/fasta/parser/identifier_context_impl.dart
index c59f7ea..0dd6638 100644
--- a/front_end/lib/src/fasta/parser/identifier_context_impl.dart
+++ b/front_end/lib/src/fasta/parser/identifier_context_impl.dart
@@ -6,7 +6,7 @@
import '../fasta_codes.dart' as fasta;
-import '../scanner/token_constants.dart' show IDENTIFIER_TOKEN;
+import '../scanner/token_constants.dart' show IDENTIFIER_TOKEN, STRING_TOKEN;
import 'identifier_context.dart';
@@ -624,7 +624,8 @@
// Recovery
if (isOneOfOrEof(identifier, const [';', '=', ',', '{', '}']) ||
- looksLikeStatementStart(identifier)) {
+ looksLikeStatementStart(identifier) ||
+ identifier.kind == STRING_TOKEN) {
identifier = parser.insertSyntheticIdentifier(token, this,
message: fasta.templateExpectedIdentifier.withArguments(identifier));
} else {
diff --git a/front_end/lib/src/fasta/parser/listener.dart b/front_end/lib/src/fasta/parser/listener.dart
index 5dc7b63..5239ab9 100644
--- a/front_end/lib/src/fasta/parser/listener.dart
+++ b/front_end/lib/src/fasta/parser/listener.dart
@@ -10,6 +10,8 @@
import '../quote.dart' show UnescapeErrorListener;
+import '../scanner/error_token.dart' show ErrorToken;
+
import 'assert.dart' show Assert;
import 'formal_parameter_kind.dart' show FormalParameterKind;
@@ -270,8 +272,8 @@
logEvent("FactoryMethod");
}
- void beginFormalParameter(Token token, MemberKind kind, Token covariantToken,
- Token varFinalOrConst) {}
+ void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
+ Token covariantToken, Token varFinalOrConst) {}
void endFormalParameter(Token thisKeyword, Token periodAfterThis,
Token nameToken, FormalParameterKind kind, MemberKind memberKind) {
@@ -296,8 +298,8 @@
/// - Variable declarations (count times)
///
/// Doesn't have a corresponding begin event, use [beginMember] instead.
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
logEvent("Fields");
}
@@ -899,8 +901,14 @@
/// - Field initializer
/// Doesn't have a corresponding begin event.
/// Use [beginTopLevelMember] instead.
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
logEvent("TopLevelFields");
}
@@ -966,6 +974,17 @@
}
// TODO(danrubel): Remove this once all listeners have been updated
+ // to properly handle nullable types
+ void reportNonNullableModifierError(Token modifierToken) {
+ if (modifierToken != null) {
+ handleRecoverableError(
+ templateExperimentNotEnabled.withArguments('non-nullable'),
+ modifierToken,
+ modifierToken);
+ }
+ }
+
+ // TODO(danrubel): Remove this once all listeners have been updated
// to properly handle non-null assert expressions
void reportNonNullAssertExpressionNotEnabled(Token bang) {
handleRecoverableError(
@@ -1048,7 +1067,8 @@
/// Handle the start of a variables declaration. Substructures:
/// - Metadata
/// - Type
- void beginVariablesDeclaration(Token token, Token varFinalOrConst) {}
+ void beginVariablesDeclaration(
+ Token token, Token lateToken, Token varFinalOrConst) {}
void endVariablesDeclaration(int count, Token endToken) {
logEvent("VariablesDeclaration");
@@ -1113,9 +1133,15 @@
/// Called before parsing an `if` control flow list, set, or map entry.
void beginIfControlFlow(Token ifToken) {}
+ /// Called before parsing the `then` portion of an `if` control flow list,
+ /// set, or map entry.
+ void beginThenControlFlow(Token token) {}
+
/// Called before parsing the `else` portion of an `if` control flow list,
/// set, or map entry.
- void handleElseControlFlow(Token elseToken) {}
+ void handleElseControlFlow(Token elseToken) {
+ logEvent("ElseControlFlow");
+ }
/// Called after parsing an `if` control flow list, set, or map entry.
/// Substructures:
@@ -1371,6 +1397,14 @@
void handleRecoverableError(
Message message, Token startToken, Token endToken) {}
+ /// The parser encountered an [ErrorToken] representing an error
+ /// from the scanner but recovered from it. By default, the error is reported
+ /// by calling [handleRecoverableError] with the message associated
+ /// with the error [token].
+ void handleErrorToken(ErrorToken token) {
+ handleRecoverableError(token.assertionMessage, token, token);
+ }
+
@override
void handleUnescapeError(
Message message, Token location, int stringOffset, int length) {
diff --git a/front_end/lib/src/fasta/parser/literal_entry_info_impl.dart b/front_end/lib/src/fasta/parser/literal_entry_info_impl.dart
index 1ea0bf7..f5e4b8b 100644
--- a/front_end/lib/src/fasta/parser/literal_entry_info_impl.dart
+++ b/front_end/lib/src/fasta/parser/literal_entry_info_impl.dart
@@ -144,7 +144,9 @@
final ifToken = token.next;
assert(optional('if', ifToken));
parser.listener.beginIfControlFlow(ifToken);
- return parser.ensureParenthesizedCondition(ifToken);
+ Token result = parser.ensureParenthesizedCondition(ifToken);
+ parser.listener.beginThenControlFlow(result);
+ return result;
}
@override
diff --git a/front_end/lib/src/fasta/parser/modifier_context.dart b/front_end/lib/src/fasta/parser/modifier_context.dart
index 83d9a8d..0c49fb1 100644
--- a/front_end/lib/src/fasta/parser/modifier_context.dart
+++ b/front_end/lib/src/fasta/parser/modifier_context.dart
@@ -2,8 +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 '../../scanner/token.dart' show Token;
+import '../../scanner/token.dart' show Keyword, Token;
import '../messages.dart' as fasta;
+import 'formal_parameter_kind.dart';
import 'member_kind.dart' show MemberKind;
import 'parser.dart' show Parser;
import 'util.dart' show optional;
@@ -11,17 +12,20 @@
bool isModifier(Token token) {
if (!token.isModifier) {
return false;
- }
- if (token.type.isBuiltIn) {
- // A built-in identifier can only be a modifier as long as it is
- // followed by another modifier or an identifier. Otherwise, it is the
+ } else if (token.type.isBuiltIn) {
+ // A built-in keyword can only be a modifier as long as it is
+ // followed by another keyword or an identifier. Otherwise, it is the
// identifier.
//
// For example, `external` is a modifier in this declaration:
// external Foo foo();
// but is the identifier in this declaration
// external() => true;
- if (!token.next.type.isKeyword && !token.next.isIdentifier) {
+ // and in
+ // for (final external in list) { }
+ Token next = token.next;
+ Keyword keyword = next.keyword;
+ if (keyword == null && !next.isIdentifier || keyword == Keyword.IN) {
return false;
}
}
@@ -37,8 +41,9 @@
Token covariantToken;
Token externalToken;
Token finalToken;
+ Token lateToken;
+ Token requiredToken;
Token staticToken;
- Token varFinalOrConst;
Token varToken;
// Set `true` when parsing modifiers after the `factory` token.
@@ -49,31 +54,65 @@
ModifierRecoveryContext(this.parser);
- /// Parse modifiers for class methods and fields.
- Token parseClassMemberModifiers(Token token,
- {Token externalToken,
- Token staticToken,
- Token covariantToken,
- Token varFinalOrConst}) {
- token = parseModifiers(token,
- externalToken: externalToken,
- staticToken: staticToken,
- covariantToken: covariantToken,
- varFinalOrConst: varFinalOrConst);
+ set staticOrCovariant(Token staticOrCovariant) {
+ if (staticOrCovariant == null) {
+ covariantToken = null;
+ staticToken = null;
+ } else if (optional('covariant', staticOrCovariant)) {
+ covariantToken = staticOrCovariant;
+ staticToken = null;
+ } else if (optional('static', staticOrCovariant)) {
+ covariantToken = null;
+ staticToken = staticOrCovariant;
+ } else {
+ throw "Internal error: "
+ "Unexpected staticOrCovariant '$staticOrCovariant'.";
+ }
+ }
+ Token get varFinalOrConst => varToken ?? finalToken ?? constToken;
+
+ set varFinalOrConst(Token varFinalOrConst) {
+ if (varFinalOrConst == null) {
+ varToken = null;
+ finalToken = null;
+ constToken = null;
+ } else if (optional('var', varFinalOrConst)) {
+ varToken = varFinalOrConst;
+ finalToken = null;
+ constToken = null;
+ } else if (optional('final', varFinalOrConst)) {
+ varToken = null;
+ finalToken = varFinalOrConst;
+ constToken = null;
+ } else if (optional('const', varFinalOrConst)) {
+ varToken = null;
+ finalToken = null;
+ constToken = varFinalOrConst;
+ } else {
+ throw "Internal error: Unexpected varFinalOrConst '$varFinalOrConst'.";
+ }
+ }
+
+ /// Parse modifiers for class methods and fields.
+ Token parseClassMemberModifiers(Token token) {
+ token = parseModifiers(token);
if (abstractToken != null) {
parser.reportRecoverableError(
abstractToken, fasta.messageAbstractClassMember);
}
+ reportExtraneousModifier(requiredToken);
return token;
}
/// Parse modifiers for formal parameters.
- Token parseFormalParameterModifiers(Token token, MemberKind memberKind,
- {Token covariantToken, Token varFinalOrConst}) {
- token = parseModifiers(token,
- covariantToken: covariantToken, varFinalOrConst: varFinalOrConst);
+ Token parseFormalParameterModifiers(
+ Token token, FormalParameterKind parameterKind, MemberKind memberKind) {
+ token = parseModifiers(token);
+ if (parameterKind != FormalParameterKind.optionalNamed) {
+ reportExtraneousModifier(requiredToken);
+ }
if (memberKind == MemberKind.StaticMethod ||
memberKind == MemberKind.TopLevelMethod) {
reportExtraneousModifier(this.covariantToken);
@@ -81,58 +120,49 @@
}
if (constToken != null) {
reportExtraneousModifier(constToken);
- varFinalOrConst = null;
} else if (memberKind == MemberKind.GeneralizedFunctionType) {
if (varFinalOrConst != null) {
parser.reportRecoverableError(
varFinalOrConst, fasta.messageFunctionTypedParameterVar);
- varFinalOrConst = null;
- finalToken = null;
- varToken = null;
}
}
reportExtraneousModifier(abstractToken);
reportExtraneousModifier(externalToken);
+ reportExtraneousModifier(lateToken);
reportExtraneousModifier(staticToken);
return token;
}
/// Parse modifiers after the `factory` token.
- Token parseModifiersAfterFactory(Token token,
- {Token externalToken, Token staticOrCovariant, Token varFinalOrConst}) {
+ Token parseModifiersAfterFactory(Token token) {
afterFactory = true;
- token = parseModifiers(token,
- externalToken: externalToken,
- staticOrCovariant: staticOrCovariant,
- varFinalOrConst: varFinalOrConst);
-
+ token = parseModifiers(token);
if (abstractToken != null) {
parser.reportRecoverableError(
abstractToken, fasta.messageAbstractClassMember);
}
+ reportExtraneousModifier(lateToken);
+ reportExtraneousModifier(requiredToken);
return token;
}
/// Parse modifiers for top level functions and fields.
- Token parseTopLevelModifiers(Token token,
- {Token externalToken, Token varFinalOrConst}) {
- token = parseModifiers(token,
- externalToken: externalToken, varFinalOrConst: varFinalOrConst);
-
+ Token parseTopLevelModifiers(Token token) {
+ token = parseModifiers(token);
reportExtraneousModifier(abstractToken);
reportExtraneousModifier(covariantToken);
+ reportExtraneousModifier(requiredToken);
reportExtraneousModifier(staticToken);
return token;
}
/// Parse modifiers for variable declarations.
- Token parseVariableDeclarationModifiers(Token token,
- {Token varFinalOrConst}) {
- token = parseModifiers(token, varFinalOrConst: varFinalOrConst);
-
+ Token parseVariableDeclarationModifiers(Token token) {
+ token = parseModifiers(token);
reportExtraneousModifier(abstractToken);
reportExtraneousModifier(covariantToken);
reportExtraneousModifier(externalToken);
+ reportExtraneousModifier(requiredToken);
reportExtraneousModifier(staticToken);
return token;
}
@@ -148,42 +178,7 @@
/// `static` or `covariant`. The first non-null parameter of
/// [staticOrCovariant], [staticToken], or [covariantToken] will be used,
/// in that order, and the others ignored.
- Token parseModifiers(Token token,
- {Token externalToken,
- Token staticToken,
- Token staticOrCovariant,
- Token covariantToken,
- Token varFinalOrConst}) {
- if (externalToken != null) {
- this.externalToken = externalToken;
- }
- if (staticOrCovariant != null) {
- if (optional('static', staticOrCovariant)) {
- this.staticToken = staticOrCovariant;
- } else if (optional('covariant', staticOrCovariant)) {
- this.covariantToken = staticOrCovariant;
- } else {
- throw "Internal error: "
- "Unexpected staticOrCovariant '$staticOrCovariant'.";
- }
- } else if (staticToken != null) {
- this.staticToken = staticToken;
- } else if (covariantToken != null) {
- this.covariantToken = covariantToken;
- }
- if (varFinalOrConst != null) {
- this.varFinalOrConst = varFinalOrConst;
- if (optional('var', varFinalOrConst)) {
- varToken = varFinalOrConst;
- } else if (optional('final', varFinalOrConst)) {
- finalToken = varFinalOrConst;
- } else if (optional('const', varFinalOrConst)) {
- constToken = varFinalOrConst;
- } else {
- throw "Internal error: Unexpected varFinalOrConst '$varFinalOrConst'.";
- }
- }
-
+ Token parseModifiers(Token token) {
// Process invalid and out-of-order modifiers
Token next = token.next;
while (true) {
@@ -199,6 +194,10 @@
token = parseExternal(token);
} else if (identical('final', value)) {
token = parseFinal(token);
+ } else if (identical('late', value)) {
+ token = parseLate(token);
+ } else if (identical('required', value)) {
+ token = parseRequired(token);
} else if (identical('static', value)) {
token = parseStatic(token);
} else if (identical('var', value)) {
@@ -215,7 +214,6 @@
}
next = token.next;
}
-
return token;
}
@@ -237,10 +235,12 @@
Token next = token.next;
assert(optional('const', next));
if (varFinalOrConst == null && covariantToken == null) {
- varFinalOrConst = constToken = next;
+ constToken = next;
if (afterFactory) {
- parser.reportRecoverableError(next, fasta.messageConstAfterFactory);
+ reportModifierOutOfOrder(next, 'factory');
+ } else if (lateToken != null) {
+ reportConflictingModifiers(next, lateToken);
}
return next;
}
@@ -250,11 +250,11 @@
parser.reportRecoverableErrorWithToken(
next, fasta.templateDuplicatedModifier);
} else if (covariantToken != null) {
- parser.reportRecoverableError(next, fasta.messageConstAndCovariant);
+ reportConflictingModifiers(next, covariantToken);
} else if (finalToken != null) {
parser.reportRecoverableError(next, fasta.messageConstAndFinal);
} else if (varToken != null) {
- parser.reportRecoverableError(next, fasta.messageConstAndVar);
+ reportConflictingModifiers(next, varToken);
} else {
throw 'Internal Error: Unexpected varFinalOrConst: $varFinalOrConst';
}
@@ -273,7 +273,9 @@
if (varToken != null) {
parser.reportRecoverableError(next, fasta.messageCovariantAfterVar);
} else if (finalToken != null) {
- parser.reportRecoverableError(next, fasta.messageCovariantAfterFinal);
+ reportModifierOutOfOrder(next, finalToken.lexeme);
+ } else if (lateToken != null) {
+ reportModifierOutOfOrder(next, lateToken.lexeme);
}
return next;
}
@@ -285,7 +287,7 @@
} else if (afterFactory) {
reportExtraneousModifier(next);
} else if (constToken != null) {
- parser.reportRecoverableError(next, fasta.messageConstAndCovariant);
+ reportConflictingModifiers(next, constToken);
} else if (staticToken != null) {
parser.reportRecoverableError(next, fasta.messageCovariantAndStatic);
} else {
@@ -306,6 +308,8 @@
parser.reportRecoverableError(next, fasta.messageExternalAfterConst);
} else if (staticToken != null) {
parser.reportRecoverableError(next, fasta.messageExternalAfterStatic);
+ } else if (lateToken != null) {
+ reportModifierOutOfOrder(next, lateToken.lexeme);
}
return next;
}
@@ -320,7 +324,7 @@
Token next = token.next;
assert(optional('final', next));
if (varFinalOrConst == null && !afterFactory) {
- varFinalOrConst = finalToken = next;
+ finalToken = next;
return next;
}
@@ -334,12 +338,60 @@
parser.reportRecoverableError(next, fasta.messageConstAndFinal);
} else if (varToken != null) {
parser.reportRecoverableError(next, fasta.messageFinalAndVar);
+ } else if (lateToken != null) {
+ reportModifierOutOfOrder(next, lateToken.lexeme);
} else {
throw 'Internal Error: Unexpected varFinalOrConst: $varFinalOrConst';
}
return next;
}
+ Token parseLate(Token token) {
+ Token next = token.next;
+ assert(optional('late', next));
+ if (lateToken == null) {
+ lateToken = next;
+
+ if (constToken != null) {
+ reportConflictingModifiers(next, constToken);
+ } else if (varToken != null) {
+ reportConflictingModifiers(next, varToken);
+ } else if (finalToken != null) {
+ reportModifierOutOfOrder(next, finalToken.lexeme);
+ }
+ return next;
+ }
+
+ // Recovery
+ parser.reportRecoverableErrorWithToken(
+ next, fasta.templateDuplicatedModifier);
+ return next;
+ }
+
+ Token parseRequired(Token token) {
+ Token next = token.next;
+ assert(optional('required', next));
+ if (requiredToken == null) {
+ requiredToken = next;
+
+ if (constToken != null) {
+ reportModifierOutOfOrder(requiredToken, constToken.lexeme);
+ } else if (covariantToken != null) {
+ reportModifierOutOfOrder(requiredToken, covariantToken.lexeme);
+ } else if (finalToken != null) {
+ reportModifierOutOfOrder(requiredToken, finalToken.lexeme);
+ } else if (varToken != null) {
+ reportModifierOutOfOrder(requiredToken, varToken.lexeme);
+ }
+ return next;
+ }
+
+ // Recovery
+ parser.reportRecoverableErrorWithToken(
+ next, fasta.templateDuplicatedModifier);
+ return next;
+ }
+
Token parseStatic(Token token) {
Token next = token.next;
assert(optional('static', next));
@@ -352,6 +404,8 @@
parser.reportRecoverableError(next, fasta.messageStaticAfterFinal);
} else if (varToken != null) {
parser.reportRecoverableError(next, fasta.messageStaticAfterVar);
+ } else if (lateToken != null) {
+ reportModifierOutOfOrder(next, lateToken.lexeme);
}
return next;
}
@@ -374,7 +428,11 @@
Token next = token.next;
assert(optional('var', next));
if (varFinalOrConst == null && !afterFactory) {
- varFinalOrConst = varToken = next;
+ varToken = next;
+
+ if (lateToken != null) {
+ reportConflictingModifiers(next, lateToken);
+ }
return next;
}
@@ -385,7 +443,7 @@
} else if (afterFactory) {
reportExtraneousModifier(next);
} else if (constToken != null) {
- parser.reportRecoverableError(next, fasta.messageConstAndVar);
+ reportConflictingModifiers(next, constToken);
} else if (finalToken != null) {
parser.reportRecoverableError(next, fasta.messageFinalAndVar);
} else {
@@ -394,10 +452,24 @@
return next;
}
- void reportExtraneousModifier(Token token) {
- if (token != null) {
+ void reportConflictingModifiers(Token modifier, Token earlierModifier) {
+ parser.reportRecoverableError(
+ modifier,
+ fasta.templateConflictingModifiers
+ .withArguments(modifier.lexeme, earlierModifier.lexeme));
+ }
+
+ void reportExtraneousModifier(Token modifier) {
+ if (modifier != null) {
parser.reportRecoverableErrorWithToken(
- token, fasta.templateExtraneousModifier);
+ modifier, fasta.templateExtraneousModifier);
}
}
+
+ void reportModifierOutOfOrder(Token modifier, String beforeModifier) {
+ parser.reportRecoverableError(
+ modifier,
+ fasta.templateModifierOutOfOrder
+ .withArguments(modifier.lexeme, beforeModifier));
+ }
}
diff --git a/front_end/lib/src/fasta/parser/parser.dart b/front_end/lib/src/fasta/parser/parser.dart
index 774daef..51b32e6 100644
--- a/front_end/lib/src/fasta/parser/parser.dart
+++ b/front_end/lib/src/fasta/parser/parser.dart
@@ -18,7 +18,6 @@
EQUALITY_PRECEDENCE,
Keyword,
POSTFIX_PRECEDENCE,
- PREFIX_PRECEDENCE,
RELATIONAL_PRECEDENCE,
SELECTOR_PRECEDENCE,
SyntheticBeginToken,
@@ -258,11 +257,6 @@
/// doesn't matter how we got there, only that we've identified that it's
/// easier if the parser reports as many errors it can, but informs the
/// listener if the error is recoverable or not.
-///
-/// Currently, the parser is particularly lax when it comes to the order of
-/// modifiers such as `abstract`, `final`, `static`, etc. Historically, dart2js
-/// would handle such errors in later phases. We hope that these cases will go
-/// away as Fasta matures.
class Parser {
Listener listener;
@@ -469,6 +463,7 @@
// Skip modifiers to find a top level keyword or identifier
if (next.isModifier) {
if (optional('var', next) ||
+ optional('late', next) ||
((optional('const', next) || optional('final', next)) &&
// Ignore `const class` and `final class` so that it is reported
// below as an invalid modifier on a class.
@@ -1313,42 +1308,60 @@
final bool inFunctionType =
memberKind == MemberKind.GeneralizedFunctionType;
+ Token requiredToken;
Token covariantToken;
Token varFinalOrConst;
if (isModifier(next)) {
- if (optional('covariant', next)) {
- if (memberKind != MemberKind.StaticMethod &&
- memberKind != MemberKind.TopLevelMethod) {
- covariantToken = token = next;
+ if (optional('required', next)) {
+ if (parameterKind == FormalParameterKind.optionalNamed) {
+ requiredToken = token = next;
next = token.next;
}
}
if (isModifier(next)) {
- if (!inFunctionType) {
- if (optional('var', next)) {
- varFinalOrConst = token = next;
- next = token.next;
- } else if (optional('final', next)) {
- varFinalOrConst = token = next;
+ if (optional('covariant', next)) {
+ if (memberKind != MemberKind.StaticMethod &&
+ memberKind != MemberKind.TopLevelMethod) {
+ covariantToken = token = next;
next = token.next;
}
}
if (isModifier(next)) {
- // Recovery
- ModifierRecoveryContext context = new ModifierRecoveryContext(this);
- token = context.parseFormalParameterModifiers(token, memberKind,
- covariantToken: covariantToken, varFinalOrConst: varFinalOrConst);
- covariantToken = context.covariantToken;
- varFinalOrConst = context.varFinalOrConst;
- context = null;
+ if (!inFunctionType) {
+ if (optional('var', next)) {
+ varFinalOrConst = token = next;
+ next = token.next;
+ } else if (optional('final', next)) {
+ varFinalOrConst = token = next;
+ next = token.next;
+ }
+ }
+
+ if (isModifier(next)) {
+ // Recovery
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this)
+ ..covariantToken = covariantToken
+ ..requiredToken = requiredToken
+ ..varFinalOrConst = varFinalOrConst;
+
+ token = context.parseFormalParameterModifiers(
+ token, parameterKind, memberKind);
+ next = token.next;
+
+ covariantToken = context.covariantToken;
+ requiredToken = context.requiredToken;
+ varFinalOrConst = context.varFinalOrConst;
+
+ context = null;
+ }
}
}
}
listener.beginFormalParameter(
- start, memberKind, covariantToken, varFinalOrConst);
+ start, memberKind, requiredToken, covariantToken, varFinalOrConst);
// Type is required in a generalized function type, but optional otherwise.
final Token beforeType = token;
@@ -2113,6 +2126,7 @@
listener.beginTopLevelMember(next);
Token externalToken;
+ Token lateToken;
Token varFinalOrConst;
if (isModifier(next)) {
@@ -2130,6 +2144,13 @@
} else if (optional('const', next)) {
varFinalOrConst = token = next;
next = token.next;
+ } else if (optional('late', next)) {
+ lateToken = token = next;
+ next = token.next;
+ if (isModifier(next) && optional('final', next)) {
+ varFinalOrConst = token = next;
+ next = token.next;
+ }
}
if (isModifier(next)) {
// Recovery
@@ -2140,13 +2161,18 @@
// If another `var`, `final`, or `const` then fall through
// to parse that as part of the next top level declaration.
} else {
- ModifierRecoveryContext context = new ModifierRecoveryContext(this);
- token = context.parseTopLevelModifiers(token,
- externalToken: externalToken, varFinalOrConst: varFinalOrConst);
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this)
+ ..externalToken = externalToken
+ ..lateToken = lateToken
+ ..varFinalOrConst = varFinalOrConst;
+
+ token = context.parseTopLevelModifiers(token);
next = token.next;
externalToken = context.externalToken;
+ lateToken = context.lateToken;
varFinalOrConst = context.varFinalOrConst;
+
context = null;
}
}
@@ -2238,6 +2264,9 @@
reportRecoverableErrorWithToken(
varFinalOrConst, fasta.templateExtraneousModifier);
}
+ } else if (lateToken != null) {
+ reportRecoverableErrorWithToken(
+ lateToken, fasta.templateExtraneousModifier);
}
return parseTopLevelMethod(beforeStart, externalToken, beforeType,
typeInfo, getOrSet, token.next);
@@ -2247,8 +2276,8 @@
reportRecoverableErrorWithToken(
getOrSet, fasta.templateExtraneousModifier);
}
- return parseFields(beforeStart, externalToken, null, null, varFinalOrConst,
- beforeType, typeInfo, token.next, true);
+ return parseFields(beforeStart, externalToken, null, null, lateToken,
+ varFinalOrConst, beforeType, typeInfo, token.next, true);
}
Token parseFields(
@@ -2256,6 +2285,7 @@
Token externalToken,
Token staticToken,
Token covariantToken,
+ Token lateToken,
Token varFinalOrConst,
Token beforeType,
TypeInfo typeInfo,
@@ -2271,7 +2301,7 @@
}
}
if (typeInfo == noType) {
- if (varFinalOrConst == null) {
+ if (varFinalOrConst == null && lateToken == null) {
reportRecoverableError(name, fasta.messageMissingConstFinalVarOrType);
}
} else {
@@ -2289,19 +2319,21 @@
name = ensureIdentifier(token, context);
int fieldCount = 1;
- token = parseFieldInitializerOpt(name, name, varFinalOrConst, isTopLevel);
+ token = parseFieldInitializerOpt(
+ name, name, lateToken, varFinalOrConst, isTopLevel);
while (optional(',', token.next)) {
name = ensureIdentifier(token.next, context);
- token = parseFieldInitializerOpt(name, name, varFinalOrConst, isTopLevel);
+ token = parseFieldInitializerOpt(
+ name, name, lateToken, varFinalOrConst, isTopLevel);
++fieldCount;
}
token = ensureSemicolon(token);
if (isTopLevel) {
- listener.endTopLevelFields(staticToken, covariantToken, varFinalOrConst,
- fieldCount, beforeStart.next, token);
+ listener.endTopLevelFields(staticToken, covariantToken, lateToken,
+ varFinalOrConst, fieldCount, beforeStart.next, token);
} else {
- listener.endFields(staticToken, covariantToken, varFinalOrConst,
- fieldCount, beforeStart.next, token);
+ listener.endFields(staticToken, covariantToken, lateToken,
+ varFinalOrConst, fieldCount, beforeStart.next, token);
}
return token;
}
@@ -2356,8 +2388,8 @@
return token;
}
- Token parseFieldInitializerOpt(
- Token token, Token name, Token varFinalOrConst, bool isTopLevel) {
+ Token parseFieldInitializerOpt(Token token, Token name, Token lateToken,
+ Token varFinalOrConst, bool isTopLevel) {
Token next = token.next;
if (optional('=', next)) {
Token assignment = next;
@@ -2371,7 +2403,9 @@
name,
fasta.templateConstFieldWithoutInitializer
.withArguments(name.lexeme));
- } else if (isTopLevel && optional("final", varFinalOrConst)) {
+ } else if (isTopLevel &&
+ optional("final", varFinalOrConst) &&
+ lateToken == null) {
reportRecoverableError(
name,
fasta.templateFinalFieldWithoutInitializer
@@ -2816,6 +2850,7 @@
Token covariantToken;
Token externalToken;
+ Token lateToken;
Token staticToken;
Token varFinalOrConst;
@@ -2843,18 +2878,28 @@
} else if (optional('const', next) && covariantToken == null) {
varFinalOrConst = token = next;
next = token.next;
+ } else if (optional('late', next)) {
+ lateToken = token = next;
+ next = token.next;
+ if (isModifier(next) && optional('final', next)) {
+ varFinalOrConst = token = next;
+ next = token.next;
+ }
}
if (isModifier(next)) {
- ModifierRecoveryContext context = new ModifierRecoveryContext(this);
- token = context.parseClassMemberModifiers(token,
- externalToken: externalToken,
- staticToken: staticToken,
- covariantToken: covariantToken,
- varFinalOrConst: varFinalOrConst);
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this)
+ ..covariantToken = covariantToken
+ ..externalToken = externalToken
+ ..lateToken = lateToken
+ ..staticToken = staticToken
+ ..varFinalOrConst = varFinalOrConst;
+
+ token = context.parseClassMemberModifiers(token);
next = token.next;
covariantToken = context.covariantToken;
externalToken = context.externalToken;
+ lateToken = context.lateToken;
staticToken = context.staticToken;
varFinalOrConst = context.varFinalOrConst;
@@ -2883,6 +2928,9 @@
} else if (identical(value, 'factory')) {
Token next2 = next.next;
if (next2.isIdentifier || next2.isModifier) {
+ if (beforeType != token) {
+ reportRecoverableError(token, fasta.messageTypeBeforeFactory);
+ }
token = parseFactoryMethod(token, beforeStart, externalToken,
staticToken ?? covariantToken, varFinalOrConst);
listener.endMember();
@@ -2900,6 +2948,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -2913,8 +2962,14 @@
!optional('=', next2) &&
!optional('<', next2))) {
// Recovery: Invalid operator
- return parseInvalidOperatorDeclaration(beforeStart, externalToken,
- staticToken, covariantToken, varFinalOrConst, beforeType);
+ return parseInvalidOperatorDeclaration(
+ beforeStart,
+ externalToken,
+ staticToken,
+ covariantToken,
+ lateToken,
+ varFinalOrConst,
+ beforeType);
} else if (isUnaryMinus(next2)) {
// Recovery
token = parseMethod(
@@ -2922,6 +2977,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -2942,6 +2998,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -2955,8 +3012,14 @@
identical(value, '{') ||
identical(value, '=>')) {
// Recovery: Missing `operator` keyword
- return parseInvalidOperatorDeclaration(beforeStart, externalToken,
- staticToken, covariantToken, varFinalOrConst, beforeType);
+ return parseInvalidOperatorDeclaration(
+ beforeStart,
+ externalToken,
+ staticToken,
+ covariantToken,
+ lateToken,
+ varFinalOrConst,
+ beforeType);
}
}
}
@@ -2975,6 +3038,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -2990,6 +3054,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -3005,11 +3070,16 @@
Token externalToken,
Token staticToken,
Token covariantToken,
+ Token lateToken,
Token varFinalOrConst,
Token beforeType,
TypeInfo typeInfo,
Token getOrSet,
Token name) {
+ if (lateToken != null) {
+ reportRecoverableErrorWithToken(
+ lateToken, fasta.templateExtraneousModifier);
+ }
bool isOperator = false;
if (getOrSet == null && optional('operator', name)) {
Token operator = name.next;
@@ -3115,15 +3185,18 @@
if (!isValidTypeReference(token.next)) {
// Recovery
- ModifierRecoveryContext context = new ModifierRecoveryContext(this);
- token = context.parseModifiersAfterFactory(token,
- externalToken: externalToken,
- staticOrCovariant: staticOrCovariant,
- varFinalOrConst: varFinalOrConst);
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this)
+ ..externalToken = externalToken
+ ..staticOrCovariant = staticOrCovariant
+ ..varFinalOrConst = varFinalOrConst;
+
+ token = context.parseModifiersAfterFactory(token);
externalToken = context.externalToken;
staticOrCovariant = context.staticToken ?? context.covariantToken;
varFinalOrConst = context.varFinalOrConst;
+
+ context = null;
}
if (staticOrCovariant != null) {
@@ -3553,7 +3626,8 @@
if (optional(':', token.next.next)) {
return parseLabeledStatement(token);
}
- return parseExpressionStatementOrDeclarationAfterModifiers(token, token);
+ return parseExpressionStatementOrDeclarationAfterModifiers(
+ token, token, null, null, null, false);
}
final value = token.next.stringValue;
if (identical(value, '{')) {
@@ -3562,12 +3636,18 @@
return parseReturnStatement(token);
} else if (identical(value, 'var') || identical(value, 'final')) {
Token varOrFinal = token.next;
- if (isModifier(varOrFinal.next)) {
- return parseExpressionStatementOrDeclaration(token);
- } else {
+ if (!isModifier(varOrFinal.next)) {
return parseExpressionStatementOrDeclarationAfterModifiers(
- varOrFinal, token, varOrFinal);
+ varOrFinal, token, null, varOrFinal, null, false);
}
+ return parseExpressionStatementOrDeclaration(token);
+ } else if (identical(value, 'late')) {
+ Token lateToken = token.next;
+ if (!isModifier(lateToken.next)) {
+ return parseExpressionStatementOrDeclarationAfterModifiers(
+ lateToken, token, lateToken, null, null, false);
+ }
+ return parseExpressionStatementOrDeclaration(token);
} else if (identical(value, 'if')) {
return parseIfStatement(token);
} else if (identical(value, 'await') && optional('for', token.next.next)) {
@@ -3800,7 +3880,7 @@
}
Token next = token.next;
TokenType type = next.type;
- int tokenLevel = type.precedence;
+ int tokenLevel = _computePrecedence(type);
for (int level = tokenLevel; level >= precedence; --level) {
int lastBinaryExpressionLevel = -1;
while (identical(tokenLevel, level)) {
@@ -3823,11 +3903,7 @@
(identical(type, TokenType.MINUS_MINUS))) {
listener.handleUnaryPostfixAssignmentExpression(token.next);
token = next;
- }
- } else if (identical(tokenLevel, PREFIX_PRECEDENCE)) {
- // The '!' has prefix precedence but here it's being used as a
- // postfix operator to assert the expression has a non-null value.
- if ((identical(type, TokenType.BANG))) {
+ } else if (identical(type, TokenType.BANG)) {
listener.handleNonNullAssertExpression(token.next);
token = next;
}
@@ -3885,12 +3961,22 @@
}
next = token.next;
type = next.type;
- tokenLevel = type.precedence;
+ tokenLevel = _computePrecedence(type);
}
}
return token;
}
+ int _computePrecedence(TokenType type) {
+ if (identical(type, TokenType.BANG)) {
+ // The '!' has prefix precedence but here it's being used as a
+ // postfix operator to assert the expression has a non-null value.
+ return POSTFIX_PRECEDENCE;
+ } else {
+ return type.precedence;
+ }
+ }
+
Token parseCascadeExpression(Token token) {
Token cascadeOperator = token = token.next;
assert(optional('..', cascadeOperator));
@@ -4977,7 +5063,7 @@
}
}
return parseExpressionStatementOrDeclarationAfterModifiers(
- constToken, start, constToken, typeInfo);
+ constToken, start, null, constToken, typeInfo, false);
}
return parseExpressionStatementOrDeclaration(start);
}
@@ -5003,50 +5089,71 @@
next = token.next;
}
+ Token lateToken;
Token varFinalOrConst;
+
if (isModifier(next)) {
- if (optional('var', next)) {
+ if (optional('var', next) ||
+ optional('final', next) ||
+ optional('const', next)) {
varFinalOrConst = token = token.next;
next = token.next;
- } else if (optional('final', next) || optional('const', next)) {
- varFinalOrConst = token = token.next;
+ } else if (optional('late', next)) {
+ lateToken = token = next;
next = token.next;
+ if (isModifier(next) && optional('final', next)) {
+ varFinalOrConst = token = next;
+ next = token.next;
+ }
}
if (isModifier(next)) {
// Recovery
- ModifierRecoveryContext modifierContext =
- new ModifierRecoveryContext(this);
- token = modifierContext.parseVariableDeclarationModifiers(token,
- varFinalOrConst: varFinalOrConst);
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this)
+ ..lateToken = lateToken
+ ..varFinalOrConst = varFinalOrConst;
+
+ token = context.parseVariableDeclarationModifiers(token);
next = token.next;
- varFinalOrConst = modifierContext.varFinalOrConst;
- modifierContext = null;
+ lateToken = context.lateToken;
+ varFinalOrConst = context.varFinalOrConst;
+
+ context = null;
}
}
- return parseExpressionStatementOrDeclarationAfterModifiers(
- token, start, varFinalOrConst, null, onlyParseVariableDeclarationStart);
+ return parseExpressionStatementOrDeclarationAfterModifiers(token, start,
+ lateToken, varFinalOrConst, null, onlyParseVariableDeclarationStart);
}
/// See [parseExpressionStatementOrDeclaration]
Token parseExpressionStatementOrDeclarationAfterModifiers(
- final Token beforeType, final Token start,
- [Token varFinalOrConst = null,
+ final Token beforeType,
+ final Token start,
+ final Token lateToken,
+ Token varFinalOrConst,
TypeInfo typeInfo,
- bool onlyParseVariableDeclarationStart = false]) {
+ bool onlyParseVariableDeclarationStart) {
typeInfo ??= computeType(beforeType, false);
Token token = typeInfo.skipType(beforeType);
Token next = token.next;
- if (!onlyParseVariableDeclarationStart) {
+ if (onlyParseVariableDeclarationStart) {
+ if (lateToken != null) {
+ reportRecoverableErrorWithToken(
+ lateToken, fasta.templateExtraneousModifier);
+ }
+ } else {
if (looksLikeLocalFunction(next)) {
// Parse a local function declaration.
if (varFinalOrConst != null) {
reportRecoverableErrorWithToken(
varFinalOrConst, fasta.templateExtraneousModifier);
+ } else if (lateToken != null) {
+ reportRecoverableErrorWithToken(
+ lateToken, fasta.templateExtraneousModifier);
}
if (!optional('@', start.next)) {
listener.beginMetadataStar(start.next);
@@ -5135,7 +5242,7 @@
// identifier, then allow ensureIdentifier to report an error
// and don't report errors here.
if (varFinalOrConst == null) {
- if (typeInfo == noType) {
+ if (typeInfo == noType && lateToken == null) {
reportRecoverableError(next, fasta.messageMissingConstFinalVarOrType);
}
} else if (optional('var', varFinalOrConst)) {
@@ -5151,7 +5258,7 @@
}
token = typeInfo.parseType(beforeType, this);
next = token.next;
- listener.beginVariablesDeclaration(next, varFinalOrConst);
+ listener.beginVariablesDeclaration(next, lateToken, varFinalOrConst);
if (!onlyParseVariableDeclarationStart) {
token = parseVariablesDeclarationRest(token, true);
}
@@ -6043,6 +6150,7 @@
Token externalToken,
Token staticToken,
Token covariantToken,
+ Token lateToken,
Token varFinalOrConst,
Token beforeType) {
TypeInfo typeInfo = computeType(beforeType, true, true);
@@ -6067,6 +6175,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -6085,6 +6194,7 @@
Token externalToken,
Token staticToken,
Token covariantToken,
+ Token lateToken,
Token varFinalOrConst,
Token beforeType,
TypeInfo typeInfo,
@@ -6100,7 +6210,7 @@
return reportAndSkipTypedefInClass(next);
} else if (next.isOperator && next.endGroup == null) {
return parseInvalidOperatorDeclaration(beforeStart, externalToken,
- staticToken, covariantToken, varFinalOrConst, beforeType);
+ staticToken, covariantToken, lateToken, varFinalOrConst, beforeType);
}
if (getOrSet != null ||
@@ -6112,6 +6222,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -6131,6 +6242,7 @@
externalToken,
staticToken,
covariantToken,
+ lateToken,
varFinalOrConst,
beforeType,
typeInfo,
@@ -6182,7 +6294,7 @@
}
void reportErrorToken(ErrorToken token) {
- listener.handleRecoverableError(token.assertionMessage, token, token);
+ listener.handleErrorToken(token);
}
Token parseInvalidTopLevelDeclaration(Token token) {
diff --git a/front_end/lib/src/fasta/parser/type_info.dart b/front_end/lib/src/fasta/parser/type_info.dart
index 8214825..cf59846 100644
--- a/front_end/lib/src/fasta/parser/type_info.dart
+++ b/front_end/lib/src/fasta/parser/type_info.dart
@@ -34,26 +34,26 @@
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the type, inserting a synthetic type reference if
/// necessary. This may modify the token stream when parsing `>>` or `>>>`
- /// in valid code or during recovery.
+ /// or `>>>=` in valid code or during recovery.
Token ensureTypeNotVoid(Token token, Parser parser);
/// Call this function when the token after [token] must be a type or void.
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the type, inserting a synthetic type reference if
/// necessary. This may modify the token stream when parsing `>>` or `>>>`
- /// in valid code or during recovery.
+ /// or `>>>=` in valid code or during recovery.
Token ensureTypeOrVoid(Token token, Parser parser);
/// Call this function to parse an optional type (not void) after [token].
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the type. This may modify the token stream
- /// when parsing `>>` or `>>>` in valid code or during recovery.
+ /// when parsing `>>` or `>>>` or `>>>=` in valid code or during recovery.
Token parseTypeNotVoid(Token token, Parser parser);
/// Call this function to parse an optional type or void after [token].
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the type. This may modify the token stream
- /// when parsing `>>` or `>>>` in valid code or during recovery.
+ /// when parsing `>>` or `>>>` or `>>>=` in valid code or during recovery.
Token parseType(Token token, Parser parser);
/// Call this function with the [token] before the type to obtain
@@ -83,14 +83,14 @@
/// Call this function to parse optional type arguments after [token].
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the arguments. This may modify the token stream
- /// when parsing `>>` or `>>>` in valid code or during recovery.
+ /// when parsing `>>` or `>>>` or `>>>=` in valid code or during recovery.
Token parseArguments(Token token, Parser parser);
/// Call this function to parse optional type parameters
/// (also known as type variables) after [token].
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the parameters. This may modify the token stream
- /// when parsing `>>` or `>>>` in valid code or during recovery.
+ /// when parsing `>>` or `>>>` or `>>>=` in valid code or during recovery.
Token parseVariables(Token token, Parser parser);
/// Call this function with the [token] before the type var to obtain
diff --git a/front_end/lib/src/fasta/parser/type_info_impl.dart b/front_end/lib/src/fasta/parser/type_info_impl.dart
index 6d670a1..b6d698e 100644
--- a/front_end/lib/src/fasta/parser/type_info_impl.dart
+++ b/front_end/lib/src/fasta/parser/type_info_impl.dart
@@ -31,6 +31,7 @@
splitGtEq,
splitGtFromGtGtEq,
splitGtFromGtGtGt,
+ splitGtFromGtGtGtEq,
splitGtGt,
syntheticGt;
@@ -1163,17 +1164,18 @@
}
}
-/// Return `true` if [token] is one of `>`, `>>`, `>=`, `>>>`, or `>>=`.
+/// Return `true` if [token] is one of `>`, `>>`, `>>>`, `>=`, `>>=`, or `>>>=`.
bool isCloser(Token token) {
final value = token.stringValue;
return identical(value, '>') ||
identical(value, '>>') ||
identical(value, '>=') ||
identical(value, '>>>') ||
- identical(value, '>>=');
+ identical(value, '>>=') ||
+ identical(value, '>>>=');
}
-/// If [beforeCloser].next is one of `>`, `>>`, `>=`, `>>>`, or `>>=`,
+/// If [beforeCloser].next is one of `>`, `>>`, `>>>`, `>=`, `>>=`, or `>>>=`
/// then update the token stream and return `true`.
bool parseCloser(Token beforeCloser) {
Token unsplit = beforeCloser.next;
@@ -1189,8 +1191,8 @@
}
/// If [closer] is `>` then return it.
-/// If [closer] is one of `>>`, `>=`, `>>>`, or `>>=` then split then token
-/// and return the leading `>` without updating the token stream.
+/// If [closer] is one of `>>`, `>>>`, `>=`, `>>=`, or `>>>=` then split
+/// the token and return the leading `>` without updating the token stream.
/// If [closer] is none of the above, then return null;
Token splitCloser(Token closer) {
String value = closer.stringValue;
@@ -1204,6 +1206,8 @@
return splitGtFromGtGtGt(closer);
} else if (identical(value, '>>=')) {
return splitGtFromGtGtEq(closer);
+ } else if (identical(value, '>>>=')) {
+ return splitGtFromGtGtGtEq(closer);
}
return null;
}
diff --git a/front_end/lib/src/fasta/parser/util.dart b/front_end/lib/src/fasta/parser/util.dart
index e02385f..2e7b441 100644
--- a/front_end/lib/src/fasta/parser/util.dart
+++ b/front_end/lib/src/fasta/parser/util.dart
@@ -190,6 +190,18 @@
..next = token.next);
}
+/// Split `>>>=` into two separate tokens... `>` followed by `>>=`.
+/// Call [Token.setNext] to add the token to the stream.
+Token splitGtFromGtGtGtEq(Token token) {
+ assert(optional('>>>=', token));
+ return new SimpleToken(
+ TokenType.GT, token.charOffset, token.precedingComments)
+ ..setNext(new SimpleToken(TokenType.GT_GT_EQ, token.charOffset + 1)
+ // Set next rather than calling Token.setNext
+ // so that the previous token is not set.
+ ..next = token.next);
+}
+
/// Return a synthetic `<` followed by [next].
/// Call [Token.setNext] to add the token to the stream.
Token syntheticGt(Token next) {
diff --git a/front_end/lib/src/fasta/rewrite_severity.dart b/front_end/lib/src/fasta/rewrite_severity.dart
index 5d521bb..40f5b8c 100644
--- a/front_end/lib/src/fasta/rewrite_severity.dart
+++ b/front_end/lib/src/fasta/rewrite_severity.dart
@@ -9,20 +9,6 @@
Severity rewriteSeverity(
Severity severity, msg.Code<Object> code, Uri fileUri) {
if (severity != Severity.ignored) {
- if (code == msg.codeFinalFieldNotInitialized) {
- // TODO(johnniwinther): Use external getters instead of final fields.
- // See https://github.com/dart-lang/sdk/issues/33762
- for (String path in [
- "/pkg/dev_compiler/tool/input_sdk/private/js_string.dart",
- "/sdk/lib/html/dart2js/html_dart2js.dart",
- "/sdk/lib/svg/dart2js/svg_dart2js.dart",
- "/sdk/lib/_internal/js_runtime/lib/native_typed_data.dart"
- ]) {
- if (fileUri.path.endsWith(path)) {
- return Severity.ignored;
- }
- }
- }
return severity;
}
diff --git a/front_end/lib/src/fasta/scanner.dart b/front_end/lib/src/fasta/scanner.dart
index f276eda..7df276f 100644
--- a/front_end/lib/src/fasta/scanner.dart
+++ b/front_end/lib/src/fasta/scanner.dart
@@ -6,18 +6,23 @@
import 'dart:convert' show unicodeReplacementCharacterRune, utf8;
-import 'fasta_codes.dart' show LocatedMessage;
-
import '../scanner/token.dart' show Token;
+import 'scanner/abstract_scanner.dart'
+ show LanguageVersionChanged, ScannerConfiguration;
+
import 'scanner/string_scanner.dart' show StringScanner;
import 'scanner/utf8_bytes_scanner.dart' show Utf8BytesScanner;
import 'scanner/recover.dart' show defaultRecoveryStrategy;
+export 'scanner/abstract_scanner.dart'
+ show LanguageVersionChanged, ScannerConfiguration;
+
export 'scanner/token.dart'
show
+ LanguageVersionToken,
StringToken,
isBinaryOperator,
isMinusOperator,
@@ -28,6 +33,8 @@
export 'scanner/error_token.dart'
show ErrorToken, buildUnexpectedCharacterToken;
+export 'scanner/token.dart' show LanguageVersionToken;
+
export 'scanner/token_constants.dart' show EOF_TOKEN;
export 'scanner/utf8_bytes_scanner.dart' show Utf8BytesScanner;
@@ -41,19 +48,14 @@
typedef Token Recover(List<int> bytes, Token tokens, List<int> lineStarts);
abstract class Scanner {
- /// A list of errors that occured during [tokenize] or `null` if none.
- List<LocatedMessage> errors;
-
- /// Set true if errors should be reported via the [errors] list.
- // TODO(danrubel): Remove this once all scanner clients can process
- // errors reported via the [errors] list.
- bool reportErrors;
-
/// Returns true if an error occured during [tokenize].
bool get hasErrors;
List<int> get lineStarts;
+ /// Configure which tokens are produced.
+ set configuration(ScannerConfiguration config);
+
Token tokenize();
}
@@ -62,37 +64,39 @@
final List<int> lineStarts;
final bool hasErrors;
- /// Returns a list of errors that occured during [tokenize] or `null` if none.
- final List<LocatedMessage> errors;
-
- ScannerResult(this.tokens, this.lineStarts, this.hasErrors, this.errors);
+ ScannerResult(this.tokens, this.lineStarts, this.hasErrors);
}
/// Scan/tokenize the given UTF8 [bytes].
/// If [recover] is null, then the [defaultRecoveryStrategy] is used.
ScannerResult scan(List<int> bytes,
- {bool includeComments: false, Recover recover}) {
+ {ScannerConfiguration configuration,
+ bool includeComments: false,
+ LanguageVersionChanged languageVersionChanged,
+ Recover recover}) {
if (bytes.last != 0) {
throw new ArgumentError("[bytes]: the last byte must be null.");
}
- Scanner scanner =
- new Utf8BytesScanner(bytes, includeComments: includeComments);
+ Scanner scanner = new Utf8BytesScanner(bytes,
+ configuration: configuration,
+ includeComments: includeComments,
+ languageVersionChanged: languageVersionChanged);
return _tokenizeAndRecover(scanner, recover, bytes: bytes);
}
/// Scan/tokenize the given [source].
/// If [recover] is null, then the [defaultRecoveryStrategy] is used.
ScannerResult scanString(String source,
- {bool enableGtGtGt: false,
+ {ScannerConfiguration configuration,
bool includeComments: false,
+ LanguageVersionChanged languageVersionChanged,
bool scanLazyAssignmentOperators: false,
Recover recover}) {
- // TODO(brianwilkerson): Remove the parameter `enableGtGtGt` after the feature
- // has been anabled by default.
assert(source != null, 'source must not be null');
- StringScanner scanner =
- new StringScanner(source, includeComments: includeComments);
- scanner.enableGtGtGt = enableGtGtGt;
+ StringScanner scanner = new StringScanner(source,
+ configuration: configuration,
+ includeComments: includeComments,
+ languageVersionChanged: languageVersionChanged);
return _tokenizeAndRecover(scanner, recover, source: source);
}
@@ -104,6 +108,5 @@
recover ??= defaultRecoveryStrategy;
tokens = recover(bytes, tokens, scanner.lineStarts);
}
- return new ScannerResult(
- tokens, scanner.lineStarts, scanner.hasErrors, scanner.errors);
+ return new ScannerResult(tokens, scanner.lineStarts, scanner.hasErrors);
}
diff --git a/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/front_end/lib/src/fasta/scanner/abstract_scanner.dart
index 3377316..3c18577 100644
--- a/front_end/lib/src/fasta/scanner/abstract_scanner.dart
+++ b/front_end/lib/src/fasta/scanner/abstract_scanner.dart
@@ -16,8 +16,7 @@
messageExpectedHexDigit,
messageMissingExponent,
messageUnexpectedDollarInString,
- messageUnterminatedComment,
- templateUnterminatedString;
+ messageUnterminatedComment;
import '../scanner.dart'
show ErrorToken, Keyword, Scanner, buildUnexpectedCharacterToken;
@@ -27,12 +26,15 @@
import 'keyword_state.dart' show KeywordState;
-import 'token.dart' show CommentToken, DartDocToken;
+import 'token.dart' show CommentToken, DartDocToken, LanguageVersionToken;
import 'token_constants.dart';
import 'characters.dart';
+typedef void LanguageVersionChanged(
+ Scanner scanner, LanguageVersionToken languageVersion);
+
abstract class AbstractScanner implements Scanner {
/**
* A flag indicating whether character sequences `&&=` and `||=`
@@ -44,10 +46,24 @@
final bool includeComments;
- /// Experimental flag for enabling parsing of `>>>`.
+ /// Called when the scanner detects a language version comment
+ /// so that the listener can update the scanner configuration
+ /// based upon the specified language version.
+ final LanguageVersionChanged languageVersionChanged;
+
+ /// Experimental flag for enabling scanning of `>>>`.
/// See https://github.com/dart-lang/language/issues/61
/// and https://github.com/dart-lang/language/issues/60
- bool enableGtGtGt = false;
+ bool _enableGtGtGt = false;
+
+ /// Experimental flag for enabling scanning of `>>>=`.
+ /// See https://github.com/dart-lang/language/issues/61
+ /// and https://github.com/dart-lang/language/issues/60
+ bool _enableGtGtGtEq = false;
+
+ /// Experimental flag for enabling scanning of NNBD tokens
+ /// such as 'required' and 'late'.
+ bool _enableNonNullable = false;
/**
* The string offset for the next token that will be created.
@@ -86,9 +102,21 @@
final List<int> lineStarts;
- AbstractScanner(this.includeComments, {int numberOfBytesHint})
+ AbstractScanner(ScannerConfiguration config, this.includeComments,
+ this.languageVersionChanged,
+ {int numberOfBytesHint})
: lineStarts = new LineStarts(numberOfBytesHint) {
this.tail = this.tokens;
+ this.configuration = config;
+ }
+
+ @override
+ set configuration(ScannerConfiguration config) {
+ if (config != null) {
+ _enableNonNullable = config.enableNonNullable;
+ _enableGtGtGt = config.enableGtGtGt;
+ _enableGtGtGtEq = config.enableGtGtGtEq;
+ }
}
/**
@@ -245,6 +273,13 @@
DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly,
[int extraOffset = 0]);
+ /**
+ * Returns a new language version token from the scan offset [start]
+ * to the current [scanOffset] similar to createCommentToken.
+ */
+ LanguageVersionToken createLanguageVersionToken(
+ int start, int major, int minor);
+
/** Documentation in subclass [ArrayBasedScanner]. */
void discardOpenLt();
@@ -257,6 +292,21 @@
Token tokenize() {
while (!atEndOfFile()) {
int next = advance();
+
+ // Scan the header looking for a language version
+ if (!identical(next, $EOF)) {
+ Token oldTail = tail;
+ next = bigHeaderSwitch(next);
+ if (!identical(next, $EOF) && tail.kind == SCRIPT_TOKEN) {
+ oldTail = tail;
+ next = bigHeaderSwitch(next);
+ }
+ while (!identical(next, $EOF) && tail == oldTail) {
+ next = bigHeaderSwitch(next);
+ }
+ next = next;
+ }
+
while (!identical(next, $EOF)) {
next = bigSwitch(next);
}
@@ -273,6 +323,17 @@
return firstToken();
}
+ int bigHeaderSwitch(int next) {
+ if (!identical(next, $SLASH)) {
+ return bigSwitch(next);
+ }
+ beginToken();
+ if (!identical($SLASH, peek())) {
+ return tokenizeSlashOrComment(next);
+ }
+ return tokenizeLanguageVersionOrSingleLineComment(next);
+ }
+
int bigSwitch(int next) {
beginToken();
if (identical(next, $SPACE) ||
@@ -643,7 +704,7 @@
}
int tokenizeGreaterThan(int next) {
- // > >= >> >>= >>>
+ // > >= >> >>= >>> >>>=
next = advance();
if (identical($EQ, next)) {
appendPrecedenceToken(TokenType.GT_EQ);
@@ -653,9 +714,14 @@
if (identical($EQ, next)) {
appendPrecedenceToken(TokenType.GT_GT_EQ);
return advance();
- } else if (enableGtGtGt && identical($GT, next)) {
+ } else if (_enableGtGtGt && identical($GT, next)) {
+ next = advance();
+ if (_enableGtGtGtEq && identical($EQ, next)) {
+ appendPrecedenceToken(TokenType.GT_GT_GT_EQ);
+ return advance();
+ }
appendPrecedenceToken(TokenType.GT_GT_GT);
- return advance();
+ return next;
} else {
appendGtGt(TokenType.GT_GT);
return next;
@@ -826,11 +892,111 @@
}
}
- int tokenizeSingleLineComment(int next, int start) {
- bool asciiOnly = true;
- bool dartdoc = identical($SLASH, peek());
- while (true) {
+ int tokenizeLanguageVersionOrSingleLineComment(int next) {
+ int start = scanOffset;
+ next = advance();
+
+ // Dart doc
+ if (identical($SLASH, peek())) {
+ return tokenizeSingleLineComment(next, start);
+ }
+
+ // "@dart"
+ next = advance();
+ while (identical($SPACE, next)) {
next = advance();
+ }
+ if (!identical($AT, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+ if (!identical($d, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+ if (!identical($a, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+ if (!identical($r, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+ if (!identical($t, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+
+ // "="
+ while (identical($SPACE, next)) {
+ next = advance();
+ }
+ if (!identical($EQ, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+
+ // major
+ while (identical($SPACE, next)) {
+ next = advance();
+ }
+ int major = 0;
+ int majorStart = scanOffset;
+ while (isDigit(next)) {
+ major = major * 10 + next - $0;
+ next = advance();
+ }
+ if (scanOffset == majorStart) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+
+ // minor
+ if (!identical($PERIOD, next)) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+ next = advance();
+ int minor = 0;
+ int minorStart = scanOffset;
+ while (isDigit(next)) {
+ minor = minor * 10 + next - $0;
+ next = advance();
+ }
+ if (scanOffset == minorStart) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+
+ // trailing spaces
+ while (identical($SPACE, next)) {
+ next = advance();
+ }
+ if (next != $LF && next != $CR && next != $EOF) {
+ return tokenizeSingleLineCommentRest(next, start, false);
+ }
+
+ var languageVersion = createLanguageVersionToken(start, major, minor);
+ if (languageVersionChanged != null) {
+ // TODO(danrubel): make this required and remove the languageVersion field
+ languageVersionChanged(this, languageVersion);
+ } else {
+ // TODO(danrubel): remove this hack and require listener to update
+ // the scanner's configuration.
+ configuration = ScannerConfiguration.classic;
+ }
+ if (includeComments) {
+ _appendToCommentStream(languageVersion);
+ }
+ return next;
+ }
+
+ int tokenizeSingleLineComment(int next, int start) {
+ bool dartdoc = identical($SLASH, peek());
+ next = advance();
+ return tokenizeSingleLineCommentRest(next, start, dartdoc);
+ }
+
+ int tokenizeSingleLineCommentRest(int next, int start, bool dartdoc) {
+ bool asciiOnly = true;
+ while (true) {
if (next > 127) asciiOnly = false;
if (identical($LF, next) ||
identical($CR, next) ||
@@ -843,6 +1009,7 @@
}
return next;
}
+ next = advance();
}
}
@@ -974,6 +1141,10 @@
if (state == null || state.keyword == null) {
return tokenizeIdentifier(next, start, allowDollar);
}
+ if (!_enableNonNullable &&
+ (state.keyword == Keyword.LATE || state.keyword == Keyword.REQUIRED)) {
+ return tokenizeIdentifier(next, start, allowDollar);
+ }
if (($A <= next && next <= $Z) ||
($0 <= next && next <= $9) ||
identical(next, $_) ||
@@ -1262,17 +1433,9 @@
appendSyntheticSubstringToken(TokenType.STRING, start, asciiOnly, suffix);
// Ensure that the error is reported on a visible token
int errorStart = tokenStart < stringOffset ? tokenStart : quoteStart;
- if (reportErrors) {
- addError(errorStart, stringOffset - errorStart,
- templateUnterminatedString.withArguments(prefix, suffix));
- } else {
- appendErrorToken(
- new UnterminatedString(prefix, errorStart, stringOffset));
- }
+ appendErrorToken(new UnterminatedString(prefix, errorStart, stringOffset));
}
- void addError(int charOffset, int length, Message message);
-
int advanceAfterError(bool shouldAdvance) {
if (atEndOfFile()) return $EOF;
if (shouldAdvance) {
@@ -1369,3 +1532,32 @@
array = newArray;
}
}
+
+/// [ScannerConfiguration] contains information for configuring which tokens
+/// the scanner produces based upon the Dart language level.
+class ScannerConfiguration {
+ static const classic = ScannerConfiguration();
+ static const nonNullable = ScannerConfiguration(enableNonNullable: true);
+
+ /// Experimental flag for enabling scanning of NNBD tokens
+ /// such as 'required' and 'late'
+ final bool enableNonNullable;
+
+ /// Experimental flag for enabling scanning of `>>>`.
+ /// See https://github.com/dart-lang/language/issues/61
+ /// and https://github.com/dart-lang/language/issues/60
+ final bool enableGtGtGt;
+
+ /// Experimental flag for enabling scanning of `>>>=`.
+ /// See https://github.com/dart-lang/language/issues/61
+ /// and https://github.com/dart-lang/language/issues/60
+ final bool enableGtGtGtEq;
+
+ const ScannerConfiguration({
+ bool enableGtGtGt,
+ bool enableGtGtGtEq,
+ bool enableNonNullable,
+ }) : this.enableGtGtGt = enableGtGtGt ?? false,
+ this.enableGtGtGtEq = enableGtGtGtEq ?? false,
+ this.enableNonNullable = enableNonNullable ?? false;
+}
diff --git a/front_end/lib/src/fasta/scanner/array_based_scanner.dart b/front_end/lib/src/fasta/scanner/array_based_scanner.dart
index 39fba7f..22df483 100644
--- a/front_end/lib/src/fasta/scanner/array_based_scanner.dart
+++ b/front_end/lib/src/fasta/scanner/array_based_scanner.dart
@@ -6,8 +6,6 @@
import 'error_token.dart' show ErrorToken, UnmatchedToken;
-import '../fasta_codes.dart' show LocatedMessage, Message;
-
import '../../scanner/token.dart'
show BeginToken, Keyword, KeywordToken, SyntheticToken, Token, TokenType;
@@ -22,17 +20,22 @@
import 'characters.dart' show $LF, $STX;
-import 'abstract_scanner.dart' show AbstractScanner, closeBraceInfoFor;
+import 'abstract_scanner.dart'
+ show
+ AbstractScanner,
+ LanguageVersionChanged,
+ ScannerConfiguration,
+ closeBraceInfoFor;
import '../util/link.dart' show Link;
abstract class ArrayBasedScanner extends AbstractScanner {
- List<LocatedMessage> errors;
- bool reportErrors = false;
bool hasErrors = false;
- ArrayBasedScanner(bool includeComments, {int numberOfBytesHint})
- : super(includeComments, numberOfBytesHint: numberOfBytesHint);
+ ArrayBasedScanner(ScannerConfiguration config, bool includeComments,
+ LanguageVersionChanged languageVersionChanged, {int numberOfBytesHint})
+ : super(config, includeComments, languageVersionChanged,
+ numberOfBytesHint: numberOfBytesHint);
/**
* The stack of open groups, e.g [: { ... ( .. :]
@@ -367,10 +370,4 @@
begin.endGroup = tail;
appendErrorToken(new UnmatchedToken(begin));
}
-
- void addError(int charOffset, int length, Message message) {
- hasErrors = true;
- (errors ??= <LocatedMessage>[])
- .add(new LocatedMessage(null, charOffset, length, message));
- }
}
diff --git a/front_end/lib/src/fasta/scanner/characters.dart b/front_end/lib/src/fasta/scanner/characters.dart
index e9f1e6f..21edbe7 100644
--- a/front_end/lib/src/fasta/scanner/characters.dart
+++ b/front_end/lib/src/fasta/scanner/characters.dart
@@ -116,6 +116,10 @@
const int $LAST_SURROGATE = 0xdfff;
const int $LAST_CODE_POINT = 0x10ffff;
+bool isDigit(int characterCode) {
+ return $0 <= characterCode && characterCode <= $9;
+}
+
bool isHexDigit(int characterCode) {
if (characterCode <= $9) return $0 <= characterCode;
characterCode |= $a ^ $A;
diff --git a/front_end/lib/src/fasta/scanner/scanner_main.dart b/front_end/lib/src/fasta/scanner/scanner_main.dart
index 848b65d..fd3c030 100644
--- a/front_end/lib/src/fasta/scanner/scanner_main.dart
+++ b/front_end/lib/src/fasta/scanner/scanner_main.dart
@@ -8,22 +8,18 @@
import '../scanner.dart' show ErrorToken, Token, scan;
-scanAll(Map<Uri, List<int>> files) {
+scanAll(Map<Uri, List<int>> files, {bool verbose: false, bool verify: false}) {
Stopwatch sw = new Stopwatch()..start();
int byteCount = 0;
files.forEach((Uri uri, List<int> bytes) {
var token = scan(bytes).tokens;
- if (const bool.fromEnvironment("printTokens")) {
- printTokens(token);
- }
- if (const bool.fromEnvironment('verifyErrorTokens')) {
- verifyErrorTokens(token, uri);
- }
+ if (verbose) printTokens(token);
+ if (verify) verifyErrorTokens(token, uri);
byteCount += bytes.length - 1;
});
sw.stop();
print("Scanning files took: ${sw.elapsed}");
- print("Bytes/ms: ${byteCount/sw.elapsedMilliseconds}");
+ print("Bytes/ms: ${byteCount / sw.elapsedMilliseconds}");
}
void printTokens(Token token) {
@@ -78,12 +74,25 @@
mainEntryPoint(List<String> arguments) {
Map<Uri, List<int>> files = <Uri, List<int>>{};
Stopwatch sw = new Stopwatch()..start();
- for (String name in arguments) {
- Uri uri = Uri.base.resolve(name);
+ bool verbose = const bool.fromEnvironment("printTokens");
+ bool verify = const bool.fromEnvironment('verifyErrorTokens');
+ for (String arg in arguments) {
+ if (arg.startsWith('--')) {
+ if (arg == '--print-tokens') {
+ verbose = true;
+ } else if (arg == '--verify-error-tokens') {
+ verify = true;
+ } else {
+ print('Unrecognized option: $arg');
+ }
+ continue;
+ }
+
+ Uri uri = Uri.base.resolve(arg);
List<int> bytes = readBytesFromFileSync(uri);
files[uri] = bytes;
}
sw.stop();
print("Reading files took: ${sw.elapsed}");
- scanAll(files);
+ scanAll(files, verbose: verbose, verify: verify);
}
diff --git a/front_end/lib/src/fasta/scanner/string_scanner.dart b/front_end/lib/src/fasta/scanner/string_scanner.dart
index b5cb240..7fa5203 100644
--- a/front_end/lib/src/fasta/scanner/string_scanner.dart
+++ b/front_end/lib/src/fasta/scanner/string_scanner.dart
@@ -8,9 +8,13 @@
import '../../scanner/token.dart' as analyzer show StringToken;
+import 'abstract_scanner.dart'
+ show LanguageVersionChanged, ScannerConfiguration;
+
import 'array_based_scanner.dart' show ArrayBasedScanner;
-import 'token.dart' show CommentToken, DartDocToken, StringToken;
+import 'token.dart'
+ show CommentToken, DartDocToken, LanguageVersionToken, StringToken;
import 'error_token.dart' show ErrorToken;
@@ -26,9 +30,11 @@
int scanOffset = -1;
StringScanner(String string,
- {bool includeComments: false, bool scanLazyAssignmentOperators: false})
+ {ScannerConfiguration configuration,
+ bool includeComments: false,
+ LanguageVersionChanged languageVersionChanged})
: string = ensureZeroTermination(string),
- super(includeComments);
+ super(configuration, includeComments, languageVersionChanged);
static String ensureZeroTermination(String string) {
return (string.isEmpty || string.codeUnitAt(string.length - 1) != 0)
@@ -85,5 +91,13 @@
canonicalize: true);
}
+ @override
+ LanguageVersionToken createLanguageVersionToken(
+ int start, int major, int minor) {
+ return new LanguageVersionToken.fromSubstring(
+ string, start, scanOffset, tokenStart, major, minor,
+ canonicalize: true);
+ }
+
bool atEndOfFile() => scanOffset >= string.length - 1;
}
diff --git a/front_end/lib/src/fasta/scanner/token.dart b/front_end/lib/src/fasta/scanner/token.dart
index f10081d..e347dc2 100644
--- a/front_end/lib/src/fasta/scanner/token.dart
+++ b/front_end/lib/src/fasta/scanner/token.dart
@@ -187,6 +187,41 @@
}
}
+/**
+ * A specialized comment token representing a language version
+ * (e.g. '// @dart = 2.1').
+ */
+class LanguageVersionToken extends CommentToken {
+ /**
+ * The major language version.
+ */
+ int major;
+
+ /**
+ * The minor language version.
+ */
+ int minor;
+
+ LanguageVersionToken.from(String text, int offset, this.major, this.minor)
+ : super.fromString(TokenType.SINGLE_LINE_COMMENT, text, offset);
+
+ LanguageVersionToken.fromSubstring(
+ String string, int start, int end, int tokenStart, this.major, this.minor,
+ {bool canonicalize})
+ : super.fromSubstring(
+ TokenType.SINGLE_LINE_COMMENT, string, start, end, tokenStart,
+ canonicalize: canonicalize);
+
+ LanguageVersionToken.fromUtf8Bytes(List<int> bytes, int start, int end,
+ int tokenStart, this.major, this.minor)
+ : super.fromUtf8Bytes(
+ TokenType.SINGLE_LINE_COMMENT, bytes, start, end, true, tokenStart);
+
+ @override
+ LanguageVersionToken copy() =>
+ new LanguageVersionToken.from(lexeme, offset, major, minor);
+}
+
class DartDocToken extends CommentToken
implements analyzer.DocumentationCommentToken {
/**
@@ -299,6 +334,7 @@
identical(value, "+") ||
identical(value, "<<") ||
identical(value, ">>") ||
+ identical(value, ">>>") ||
identical(value, ">=") ||
identical(value, ">") ||
identical(value, "<=") ||
diff --git a/front_end/lib/src/fasta/scanner/token_constants.dart b/front_end/lib/src/fasta/scanner/token_constants.dart
index f29765c..fff742e 100644
--- a/front_end/lib/src/fasta/scanner/token_constants.dart
+++ b/front_end/lib/src/fasta/scanner/token_constants.dart
@@ -88,3 +88,4 @@
const int GENERIC_METHOD_TYPE_LIST_TOKEN = GENERIC_METHOD_TYPE_ASSIGN_TOKEN + 1;
const int GT_GT_GT_TOKEN = GENERIC_METHOD_TYPE_LIST_TOKEN + 1;
const int PERIOD_PERIOD_PERIOD_QUESTION_TOKEN = GT_GT_GT_TOKEN + 1;
+const int GT_GT_GT_EQ_TOKEN = PERIOD_PERIOD_PERIOD_QUESTION_TOKEN + 1;
diff --git a/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart b/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart
index eec14d4..e847390 100644
--- a/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart
+++ b/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart
@@ -12,7 +12,11 @@
import '../scanner.dart' show unicodeReplacementCharacter;
-import 'token.dart' show CommentToken, DartDocToken, StringToken;
+import 'abstract_scanner.dart'
+ show LanguageVersionChanged, ScannerConfiguration;
+
+import 'token.dart'
+ show CommentToken, DartDocToken, LanguageVersionToken, StringToken;
import 'array_based_scanner.dart' show ArrayBasedScanner;
@@ -81,8 +85,12 @@
* array whose last element is '0' to signal the end of the file. If this
* is not the case, the entire array is copied before scanning.
*/
- Utf8BytesScanner(this.bytes, {bool includeComments: false})
- : super(includeComments, numberOfBytesHint: bytes.length) {
+ Utf8BytesScanner(this.bytes,
+ {ScannerConfiguration configuration,
+ bool includeComments: false,
+ LanguageVersionChanged languageVersionChanged})
+ : super(configuration, includeComments, languageVersionChanged,
+ numberOfBytesHint: bytes.length) {
assert(bytes.last == 0);
// Skip a leading BOM.
if (containsBomAt(0)) byteOffset += 3;
@@ -232,5 +240,12 @@
type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
}
+ @override
+ LanguageVersionToken createLanguageVersionToken(
+ int start, int major, int minor) {
+ return new LanguageVersionToken.fromUtf8Bytes(
+ bytes, start, byteOffset, tokenStart, major, minor);
+ }
+
bool atEndOfFile() => byteOffset >= bytes.length - 1;
}
diff --git a/front_end/lib/src/fasta/source/diet_listener.dart b/front_end/lib/src/fasta/source/diet_listener.dart
index 88edaba..1125c14 100644
--- a/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/front_end/lib/src/fasta/source/diet_listener.dart
@@ -287,8 +287,8 @@
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
debugEvent("Fields");
buildFields(count, beginToken, false);
}
@@ -318,8 +318,14 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
debugEvent("TopLevelFields");
buildFields(count, beginToken, true);
}
diff --git a/front_end/lib/src/fasta/source/outline_builder.dart b/front_end/lib/src/fasta/source/outline_builder.dart
index 32a7071..24d3a08 100644
--- a/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/front_end/lib/src/fasta/source/outline_builder.dart
@@ -944,8 +944,20 @@
library.endNestedDeclaration("<syntax-error>");
return;
}
- library.addNamedMixinApplication(documentationComment, metadata, name,
- typeVariables, modifiers, mixinApplication, interfaces, charOffset);
+
+ int startCharOffset = beginToken.charOffset;
+ int charEndOffset = endToken.charOffset;
+ library.addNamedMixinApplication(
+ documentationComment,
+ metadata,
+ name,
+ typeVariables,
+ modifiers,
+ mixinApplication,
+ interfaces,
+ startCharOffset,
+ charOffset,
+ charEndOffset);
}
@override
@@ -1005,8 +1017,10 @@
}
@override
- void beginFormalParameter(Token token, MemberKind kind, Token covariantToken,
- Token varFinalOrConst) {
+ void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
+ Token covariantToken, Token varFinalOrConst) {
+ // TODO(danrubel): handle required token
+ reportNonNullableModifierError(requiredToken);
push((covariantToken != null ? covariantMask : 0) |
Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme));
}
@@ -1168,13 +1182,14 @@
String documentationComment = getDocumentationComment(enumKeyword);
List<EnumConstantInfo> enumConstantInfos =
const FixedNullableList<EnumConstantInfo>().pop(stack, count);
- int charOffset = pop();
+ int charOffset = pop(); // identifier char offset.
+ int startCharOffset = enumKeyword.charOffset;
Object name = pop();
List<MetadataBuilder<KernelTypeBuilder>> metadata = pop();
checkEmpty(enumKeyword.charOffset);
if (name is ParserRecovery) return;
library.addEnum(documentationComment, metadata, name, enumConstantInfos,
- charOffset, leftBrace?.endGroup?.charOffset);
+ startCharOffset, charOffset, leftBrace?.endGroup?.charOffset);
}
@override
@@ -1274,9 +1289,17 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
debugEvent("endTopLevelFields");
+ // TODO(danrubel): handle NNBD 'late' modifier
+ reportNonNullableModifierError(lateToken);
List<FieldInfo> fieldInfos = popFieldInfos(count);
TypeBuilder type = nullIfParserRecovery(pop());
int modifiers = (staticToken != null ? staticMask : 0) |
@@ -1291,9 +1314,11 @@
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
debugEvent("Fields");
+ // TODO(danrubel): handle NNBD 'late' modifier
+ reportNonNullableModifierError(lateToken);
List<FieldInfo> fieldInfos = popFieldInfos(count);
TypeBuilder type = pop();
int modifiers = (staticToken != null ? staticMask : 0) |
diff --git a/front_end/lib/src/fasta/source/scope_listener.dart b/front_end/lib/src/fasta/source/scope_listener.dart
index c49ce08..80db65e 100644
--- a/front_end/lib/src/fasta/source/scope_listener.dart
+++ b/front_end/lib/src/fasta/source/scope_listener.dart
@@ -94,6 +94,12 @@
}
@override
+ void beginForControlFlow(Token awaitToken, Token forToken) {
+ debugEvent("beginForControlFlow");
+ enterLocalScope("for in a collection");
+ }
+
+ @override
void beginBlock(Token token) {
debugEvent("beginBlock");
enterLocalScope("block");
@@ -102,7 +108,7 @@
@override
void beginSwitchBlock(Token token) {
debugEvent("beginSwitchBlock");
- enterLocalScope("swithc block");
+ enterLocalScope("switch block");
enterBreakTarget(token.charOffset);
}
diff --git a/front_end/lib/src/fasta/source/source_class_builder.dart b/front_end/lib/src/fasta/source/source_class_builder.dart
index bfcb069..be97aab 100644
--- a/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -7,8 +7,6 @@
import 'package:kernel/ast.dart'
show Class, Constructor, Member, Supertype, TreeNode;
-import '../../base/instrumentation.dart' show Instrumentation;
-
import '../dill/dill_member_builder.dart' show DillMemberBuilder;
import '../fasta_codes.dart'
@@ -259,13 +257,6 @@
}
@override
- void instrumentTopLevelInference(Instrumentation instrumentation) {
- scope.forEach((name, declaration) {
- declaration.instrumentTopLevelInference(instrumentation);
- });
- }
-
- @override
int finishPatch() {
if (!isPatch) return 0;
diff --git a/front_end/lib/src/fasta/source/source_library_builder.dart b/front_end/lib/src/fasta/source/source_library_builder.dart
index 3d178d3..07d9eb6 100644
--- a/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -8,8 +8,6 @@
import '../../base/resolve_relative_uri.dart' show resolveRelativeUri;
-import '../../base/instrumentation.dart' show Instrumentation;
-
import '../../scanner/token.dart' show Token;
import '../builder/builder.dart'
@@ -380,7 +378,9 @@
int modifiers,
T mixinApplication,
List<T> interfaces,
- int charOffset);
+ int startCharOffset,
+ int charOffset,
+ int charEndOffset);
void addField(
String documentationComment,
@@ -455,6 +455,7 @@
List<MetadataBuilder> metadata,
String name,
List<EnumConstantInfo> enumConstantInfos,
+ int startCharOffset,
int charOffset,
int charEndOffset);
@@ -643,7 +644,7 @@
// If [library] is null, we have already reported a problem that this
// part is orphaned.
List<LocatedMessage> context = <LocatedMessage>[
- messagePartInPartLibraryContext.withLocation(library.fileUri, 0, 1),
+ messagePartInPartLibraryContext.withLocation(library.fileUri, -1, 1),
];
for (int offset in partOffsets) {
addProblem(messagePartInPart, offset, noLength, fileUri,
@@ -657,7 +658,7 @@
parts.clear();
if (exporters.isNotEmpty) {
List<LocatedMessage> context = <LocatedMessage>[
- messagePartExportContext.withLocation(fileUri, 0, 1),
+ messagePartExportContext.withLocation(fileUri, -1, 1),
];
for (Export export in exporters) {
export.exporter.addProblem(
@@ -881,14 +882,6 @@
}
@override
- void instrumentTopLevelInference(Instrumentation instrumentation) {
- Iterator<Declaration> iterator = this.iterator;
- while (iterator.moveNext()) {
- iterator.current.instrumentTopLevelInference(instrumentation);
- }
- }
-
- @override
void recordAccess(int charOffset, int length, Uri fileUri) {
accessors.add(fileUri);
accessors.add(charOffset);
diff --git a/front_end/lib/src/fasta/source/source_loader.dart b/front_end/lib/src/fasta/source/source_loader.dart
index dee067a..4c3b6c9 100644
--- a/front_end/lib/src/fasta/source/source_loader.dart
+++ b/front_end/lib/src/fasta/source/source_loader.dart
@@ -33,8 +33,7 @@
import '../../api_prototype/file_system.dart';
-import '../../base/instrumentation.dart'
- show Instrumentation, InstrumentationValueLiteral;
+import '../../base/instrumentation.dart' show Instrumentation;
import '../blacklisted_classes.dart' show blacklistedCoreClasses;
@@ -69,8 +68,6 @@
templateSourceOutlineSummary,
templateUntranslatableUri;
-import '../fasta_codes.dart' as fasta_codes;
-
import '../kernel/kernel_shadow_ast.dart'
show ShadowClass, ShadowTypeInferenceEngine;
@@ -104,12 +101,10 @@
import '../parser.dart' show Parser, lengthForToken, offsetForToken;
-import '../problems.dart' show internalProblem, unhandled;
+import '../problems.dart' show internalProblem;
import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan;
-import '../severity.dart' show Severity;
-
import '../type_inference/interface_resolver.dart' show InterfaceResolver;
import 'diet_listener.dart' show DietListener;
@@ -208,7 +203,22 @@
Token token = result.tokens;
if (!suppressLexicalErrors) {
List<int> source = getSource(bytes);
- target.addSourceInformation(library.fileUri, result.lineStarts, source);
+ Uri importUri = library.uri;
+ if (library.isPatch) {
+ // For patch files we create a "fake" import uri.
+ // We cannot use the import uri from the patched libarary because
+ // several different files would then have the same import uri,
+ // and the VM does not support that. Also, what would, for instance,
+ // setting a breakpoint on line 42 of some import uri mean, if the uri
+ // represented several files?
+ List<String> newPathSegments =
+ new List<String>.from(importUri.pathSegments);
+ newPathSegments.add(library.fileUri.pathSegments.last);
+ newPathSegments[0] = "${newPathSegments[0]}-patch";
+ importUri = importUri.replace(pathSegments: newPathSegments);
+ }
+ target.addSourceInformation(
+ importUri, library.fileUri, result.lineStarts, source);
}
while (token is ErrorToken) {
if (!suppressLexicalErrors) {
@@ -229,6 +239,12 @@
case "dart:async":
return utf8.encode(defaultDartAsyncSource);
+ case "dart:collection":
+ return utf8.encode(defaultDartCollectionSource);
+
+ case "dart:_internal":
+ return utf8.encode(defaultDartInternalSource);
+
default:
return utf8.encode(message == null ? "" : "/* ${message.message} */");
}
@@ -998,13 +1014,6 @@
}
typeInferenceEngine.finishTopLevelInitializingFormals();
- if (instrumentation != null) {
- builders.forEach((Uri uri, LibraryBuilder library) {
- if (library.loader == this) {
- library.instrumentTopLevelInference(instrumentation);
- }
- });
- }
interfaceResolver = null;
// Since finalization of covariance may have added forwarding stubs, we need
// to recompute the class hierarchy so that method compilation will properly
@@ -1020,15 +1029,17 @@
node.accept(collectionTransformer ??= new CollectionTransformer(this));
}
if (transformSetLiterals) {
- node.accept(setLiteralTransformer ??= new SetLiteralTransformer(this));
+ node.accept(setLiteralTransformer ??= new SetLiteralTransformer(this,
+ transformConst: !target.enableConstantUpdate2018));
}
}
void transformListPostInference(List<TreeNode> list,
bool transformSetLiterals, bool transformCollections) {
if (transformSetLiterals) {
- SetLiteralTransformer transformer =
- setLiteralTransformer ??= new SetLiteralTransformer(this);
+ SetLiteralTransformer transformer = setLiteralTransformer ??=
+ new SetLiteralTransformer(this,
+ transformConst: !target.enableConstantUpdate2018);
for (int i = 0; i < list.length; ++i) {
list[i] = list[i].accept(transformer);
}
@@ -1074,67 +1085,6 @@
isTopLevel: isTopLevel);
}
- void recordMessage(Severity severity, Message message, int charOffset,
- int length, Uri fileUri,
- {List<LocatedMessage> context}) {
- if (instrumentation == null) return;
-
- if (charOffset == -1 &&
- (message.code == fasta_codes.codeConstConstructorWithBody ||
- message.code == fasta_codes.codeConstructorNotFound ||
- message.code == fasta_codes.codeSuperclassHasNoDefaultConstructor ||
- message.code == fasta_codes.codeTypeArgumentsOnTypeVariable ||
- message.code == fasta_codes.codeUnspecified)) {
- // TODO(ahe): All warnings should have a charOffset, but currently, some
- // warnings lack them.
- return;
- }
-
- String severityString;
- switch (severity) {
- case Severity.error:
- severityString = "error";
- break;
-
- case Severity.internalProblem:
- severityString = "internal problem";
- break;
-
- case Severity.warning:
- severityString = "warning";
- break;
-
- case Severity.errorLegacyWarning:
- // Should have been resolved to either error or warning at this point.
- // Use a property name expressing that, in case it slips through.
- severityString = "unresolved severity";
- break;
-
- case Severity.context:
- severityString = "context";
- break;
-
- case Severity.ignored:
- unhandled("IGNORED", "recordMessage", charOffset, fileUri);
- return;
- }
- instrumentation.record(
- fileUri,
- charOffset,
- severityString,
- // TODO(ahe): Should I add an InstrumentationValue for Message?
- new InstrumentationValueLiteral(message.code.name));
- if (context != null) {
- for (LocatedMessage contextMessage in context) {
- instrumentation.record(
- contextMessage.uri,
- contextMessage.charOffset,
- "context",
- new InstrumentationValueLiteral(contextMessage.code.name));
- }
- }
- }
-
void releaseAncillaryResources() {
hierarchy = null;
typeInferenceEngine = null;
@@ -1192,6 +1142,8 @@
class Symbol {}
+class Set {}
+
class Type {}
class _InvocationMirror {
@@ -1277,3 +1229,20 @@
cancel() {}
}
""";
+
+/// A minimal implementation of dart:collection that is sufficient to create an
+/// instance of [CoreTypes] and compile program.
+const String defaultDartCollectionSource = """
+class _UnmodifiableSet {
+ final Map _map;
+ const _UnmodifiableSet(this._map);
+}
+""";
+
+/// A minimal implementation of dart:_internel that is sufficient to create an
+/// instance of [CoreTypes] and compile program.
+const String defaultDartInternalSource = """
+class Symbol {
+ const Symbol(String name);
+}
+""";
diff --git a/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart b/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart
index c818a43..6c48edf 100644
--- a/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart
+++ b/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart
@@ -139,6 +139,10 @@
Uri get uri => state.uri;
+ void logEvent(String name) {
+ throw new UnimplementedError(name);
+ }
+
void debugEvent(String name, Token token) {
// state.trace(name, token);
}
@@ -389,15 +393,21 @@
}
@override
+ void handleElseControlFlow(Token token) {}
+
+ @override
void endIfControlFlow(Token token) {
- // TODO(danrubel) add support for if control flow collection entries
- // but for now this is ignored and an error reported in the body builder.
+ state.pop(); // Element.
+ state.pop(); // Condition.
+ state.pushNull("%IfControlFlow%", token);
}
@override
void endIfElseControlFlow(Token token) {
- // TODO(danrubel) add support for if control flow collection entries
- // but for now this is ignored and an error reported in the body builder.
+ state.pop(); // Else element.
+ state.pop(); // Then element.
+ state.pop(); // Condition.
+ state.pushNull("%IfElseControlFlow%", token);
}
@override
@@ -540,8 +550,8 @@
}
@override
- void endFields(Token staticToken, Token covariantToken, Token varFinalOrConst,
- int count, Token beginToken, Token endToken) {
+ void endFields(Token staticToken, Token covariantToken, Token lateToken,
+ Token varFinalOrConst, int count, Token beginToken, Token endToken) {
debugEvent("Fields", staticToken);
state.discard(count); // Field names.
state.checkEmpty(endToken);
@@ -1228,8 +1238,14 @@
}
@override
- void endTopLevelFields(Token staticToken, Token covariantToken,
- Token varFinalOrConst, int count, Token beginToken, Token endToken) {
+ void endTopLevelFields(
+ Token staticToken,
+ Token covariantToken,
+ Token lateToken,
+ Token varFinalOrConst,
+ int count,
+ Token beginToken,
+ Token endToken) {
debugEvent("TopLevelFields", staticToken);
state.discard(count); // Field names.
state.checkEmpty(endToken);
diff --git a/front_end/lib/src/fasta/target_implementation.dart b/front_end/lib/src/fasta/target_implementation.dart
index 037e74e..6e82a7d 100644
--- a/front_end/lib/src/fasta/target_implementation.dart
+++ b/front_end/lib/src/fasta/target_implementation.dart
@@ -131,7 +131,7 @@
}
void addSourceInformation(
- Uri uri, List<int> lineStarts, List<int> sourceCode);
+ Uri importUri, Uri fileUri, List<int> lineStarts, List<int> sourceCode);
void readPatchFiles(covariant LibraryBuilder library) {}
diff --git a/front_end/lib/src/fasta/testing/validating_instrumentation.dart b/front_end/lib/src/fasta/testing/validating_instrumentation.dart
index b721d4e..5547c5f 100644
--- a/front_end/lib/src/fasta/testing/validating_instrumentation.dart
+++ b/front_end/lib/src/fasta/testing/validating_instrumentation.dart
@@ -30,7 +30,6 @@
/// Map from feature names to the property names they are short for.
static const _FEATURES = const {
'inference': const [
- 'topType',
'typeArg',
'typeArgs',
'promotedType',
@@ -39,10 +38,8 @@
'target',
],
'checks': const [
- 'covariance',
'checkGetterReturn',
'checkReturn',
- 'forwardingStub',
'genericContravariant',
],
};
diff --git a/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 65db7c3..5c8dbfa 100644
--- a/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -12,6 +12,7 @@
Field,
FunctionNode,
FunctionType,
+ InvalidType,
Member,
Name,
NamedExpression,
@@ -37,10 +38,7 @@
show HierarchyBasedTypeEnvironment;
import '../../base/instrumentation.dart'
- show
- Instrumentation,
- InstrumentationValueForForwardingStub,
- InstrumentationValueLiteral;
+ show Instrumentation, InstrumentationValueLiteral;
import '../builder/builder.dart' show LibraryBuilder;
@@ -119,23 +117,26 @@
var declaredMethod = _declaredMethod;
var kind = declaredMethod.kind;
var overriddenTypes = _computeAccessorOverriddenTypes();
+ DartType inferredType;
if (isCircular) {
+ inferredType = const InvalidType();
_library.addProblem(
templateCantInferTypeDueToCircularity.withArguments(_name),
_offset,
noLength,
_fileUri);
} else {
- var inferredType = _interfaceResolver.matchTypes(
+ inferredType = _interfaceResolver.matchTypes(
overriddenTypes, _library, _name, _fileUri, _offset);
- if (declaredMethod is SyntheticAccessor) {
- declaredMethod._field.type = inferredType;
+ }
+ if (declaredMethod is SyntheticAccessor) {
+ declaredMethod._field.type = inferredType;
+ declaredMethod._field.initializer = null;
+ } else {
+ if (kind == ProcedureKind.Getter) {
+ declaredMethod.function.returnType = inferredType;
} else {
- if (kind == ProcedureKind.Getter) {
- declaredMethod.function.returnType = inferredType;
- } else {
- declaredMethod.function.positionalParameters[0].type = inferredType;
- }
+ declaredMethod.function.positionalParameters[0].type = inferredType;
}
}
}
@@ -374,8 +375,7 @@
}
for (int i = 0; i < interfaceTypeParameters.length; i++) {
var typeParameter = interfaceTypeParameters[i];
- var isGenericCovariantImpl = typeParameter.isGenericCovariantImpl ||
- needsCheck(typeParameter.bound);
+ var isGenericCovariantImpl = typeParameter.isGenericCovariantImpl;
var superTypeParameter = typeParameter;
for (int j = _start; j < _end; j++) {
var otherMember = _finalizedCandidate(j);
@@ -946,11 +946,6 @@
resolution.isSyntheticForwarder &&
identical(resolution.enclosingClass, class_)) {
class_.addMember(resolution);
- _instrumentation?.record(
- class_.location.file,
- class_.fileOffset,
- 'forwardingStub',
- new InstrumentationValueForForwardingStub(resolution));
}
}
}
@@ -977,14 +972,6 @@
return candidates;
}
- /// If instrumentation is enabled, records the covariance bits for the given
- /// [class_] to [_instrumentation].
- void recordInstrumentation(Class class_) {
- if (_instrumentation != null) {
- _recordInstrumentation(class_);
- }
- }
-
/// Creates the appropriate [InferenceNode] for inferring [procedure] in the
/// context of [class_].
///
@@ -1081,51 +1068,6 @@
return result;
}
- /// Records the covariance bits for the given [class_] to [_instrumentation].
- ///
- /// Caller is responsible for checking whether [_instrumentation] is `null`.
- void _recordInstrumentation(Class class_) {
- var uri = class_.fileUri;
- void recordCovariance(int fileOffset, bool isExplicitlyCovariant,
- bool isGenericCovariantImpl) {
- var covariance = <String>[];
- if (isExplicitlyCovariant) covariance.add('explicit');
- if (!isExplicitlyCovariant && isGenericCovariantImpl) {
- covariance.add('genericImpl');
- }
- if (covariance.isNotEmpty) {
- _instrumentation.record(uri, fileOffset, 'covariance',
- new InstrumentationValueLiteral(covariance.join(', ')));
- }
- }
-
- for (var procedure in class_.procedures) {
- if (procedure.isStatic) continue;
- // Forwarding stubs are annotated separately
- if (procedure.isSyntheticForwarder) {
- continue;
- }
- void recordFormalAnnotations(VariableDeclaration formal) {
- recordCovariance(formal.fileOffset, formal.isCovariant,
- formal.isGenericCovariantImpl);
- }
-
- void recordTypeParameterAnnotations(TypeParameter typeParameter) {
- recordCovariance(typeParameter.fileOffset, false,
- typeParameter.isGenericCovariantImpl);
- }
-
- procedure.function.positionalParameters.forEach(recordFormalAnnotations);
- procedure.function.namedParameters.forEach(recordFormalAnnotations);
- procedure.function.typeParameters.forEach(recordTypeParameterAnnotations);
- }
- for (var field in class_.fields) {
- if (field.isStatic) continue;
- recordCovariance(
- field.fileOffset, field.isCovariant, field.isGenericCovariantImpl);
- }
- }
-
/// Determines the appropriate substitution to translate type parameters
/// mentioned in the given [candidate] to type parameters on [class_].
Substitution _substitutionFor(Procedure candidate, Class class_) {
diff --git a/front_end/lib/src/fasta/type_inference/standard_bounds.dart b/front_end/lib/src/fasta/type_inference/standard_bounds.dart
index 2d5cb3a..2a97c19 100644
--- a/front_end/lib/src/fasta/type_inference/standard_bounds.dart
+++ b/front_end/lib/src/fasta/type_inference/standard_bounds.dart
@@ -12,6 +12,7 @@
DynamicType,
FunctionType,
InterfaceType,
+ InvalidType,
NamedType,
TypeParameterType,
VoidType;
@@ -177,8 +178,12 @@
return _functionStandardUpperBound(type1, type2);
}
+ if (type1 is InvalidType || type2 is InvalidType) {
+ return const InvalidType();
+ }
+
// Should never happen. As a defensive measure, return the dynamic type.
- assert(false);
+ assert(false, "type1 = $type1; type2 = $type2");
return const DynamicType();
}
diff --git a/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index a3251d6..bbf090a 100644
--- a/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -11,6 +11,7 @@
Field,
FunctionType,
InterfaceType,
+ InvalidType,
Member,
TypeParameter,
TypeParameterType,
@@ -64,7 +65,7 @@
field.fileOffset,
noLength,
field.fileUri);
- inferredType = const DynamicType();
+ inferredType = const InvalidType();
}
field.setInferredType(
_typeInferenceEngine, typeInferrer.uri, inferredType);
diff --git a/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 98cbf73..05052a6 100644
--- a/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -22,6 +22,7 @@
FunctionType,
Instantiation,
InterfaceType,
+ InvalidType,
InvocationExpression,
Let,
ListLiteral,
@@ -677,21 +678,22 @@
if (!typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
// Error: not assignable. Perform error recovery.
var parent = expression.parent;
- var errorNode = helper.wrapInProblem(
- new AsExpression(
- expression,
- // TODO(ahe): The outline phase doesn't correctly remove invalid
- // uses of type variables, for example, on static members. Once
- // that has been fixed, we should always be able to use
- // [expectedType] directly here.
- hasAnyTypeVariables(expectedType)
- ? const BottomType()
- : expectedType)
- ..isTypeError = true
- ..fileOffset = expression.fileOffset,
- (template ?? templateInvalidAssignment)
- .withArguments(actualType, expectedType),
- noLength);
+ Expression errorNode = new AsExpression(
+ expression,
+ // TODO(ahe): The outline phase doesn't correctly remove invalid
+ // uses of type variables, for example, on static members. Once
+ // that has been fixed, we should always be able to use
+ // [expectedType] directly here.
+ hasAnyTypeVariables(expectedType) ? const BottomType() : expectedType)
+ ..isTypeError = true
+ ..fileOffset = expression.fileOffset;
+ if (expectedType is! InvalidType && actualType is! InvalidType) {
+ errorNode = helper.wrapInProblem(
+ errorNode,
+ (template ?? templateInvalidAssignment)
+ .withArguments(actualType, expectedType),
+ noLength);
+ }
parent?.replaceChild(expression, errorNode);
return errorNode;
} else {
@@ -759,6 +761,7 @@
if (!isTopLevel &&
interfaceMember == null &&
receiverType is! DynamicType &&
+ receiverType is! InvalidType &&
!(receiverType == coreTypes.functionClass.rawType &&
name.name == 'call') &&
errorTemplate != null) {
diff --git a/front_end/lib/src/kernel_generator_impl.dart b/front_end/lib/src/kernel_generator_impl.dart
index 61d49fb..0a4fad1 100644
--- a/front_end/lib/src/kernel_generator_impl.dart
+++ b/front_end/lib/src/kernel_generator_impl.dart
@@ -117,7 +117,7 @@
libraryFilter: kernelTarget.isSourceLibrary);
}
- // Copy the component to exclude the uriToSource map from the summary.
+ // Create the requested component ("truncating" or not).
//
// Note: we don't pass the library argument to the constructor to
// preserve the the libraries parent pointer (it should continue to point
@@ -128,6 +128,7 @@
? kernelTarget.loader.libraries
: summaryComponent.libraries);
trimmedSummaryComponent.metadata.addAll(summaryComponent.metadata);
+ trimmedSummaryComponent.uriToSource.addAll(summaryComponent.uriToSource);
// As documented, we only run outline transformations when we are building
// summaries without building a full component (at this time, that's
@@ -136,7 +137,9 @@
options.target.performOutlineTransformations(trimmedSummaryComponent);
options.ticker.logMs("Transformed outline");
}
- summary = serializeComponent(trimmedSummaryComponent);
+ // Don't include source (but do add it above to include importUris).
+ summary =
+ serializeComponent(trimmedSummaryComponent, includeSources: false);
options.ticker.logMs("Generated outline");
}
diff --git a/front_end/lib/src/scanner/errors.dart b/front_end/lib/src/scanner/errors.dart
index 9e54680..4a7bb1d 100644
--- a/front_end/lib/src/scanner/errors.dart
+++ b/front_end/lib/src/scanner/errors.dart
@@ -63,7 +63,7 @@
const ScannerErrorCode(
'UNTERMINATED_MULTI_LINE_COMMENT', "Unterminated multi-line comment.",
correction: "Try terminating the comment with '*/', or "
- "removing any unbalanced occurances of '/*'"
+ "removing any unbalanced occurrences of '/*'"
" (because comments nest in Dart).");
static const ScannerErrorCode UNTERMINATED_STRING_LITERAL =
@@ -174,22 +174,6 @@
}
}
-void translateScanError(
- Code errorCode, int charOffset, int length, ReportError reportError) {
- switch (errorCode.analyzerCodes?.first) {
- case "UNTERMINATED_STRING_LITERAL":
- // TODO(paulberry,ahe): Fasta reports the error location as the entire
- // string; analyzer expects the end of the string.
- reportError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- charOffset + length - 1, null);
- break;
-
- default:
- throw new UnimplementedError(
- '$errorCode "${errorCode.analyzerCodes?.first}"');
- }
-}
-
/**
* Determines whether the given [charOffset], which came from the non-EOF token
* [token], represents the end of the input.
diff --git a/front_end/lib/src/scanner/token.dart b/front_end/lib/src/scanner/token.dart
index 5a78cd2..0ffd35b 100644
--- a/front_end/lib/src/scanner/token.dart
+++ b/front_end/lib/src/scanner/token.dart
@@ -211,6 +211,8 @@
static const Keyword IS =
const Keyword("is", "IS", precedence: RELATIONAL_PRECEDENCE);
+ static const Keyword LATE = const Keyword("late", "LATE", isModifier: true);
+
static const Keyword LIBRARY = const Keyword("library", "LIBRARY",
isBuiltIn: true, isTopLevelKeyword: true);
@@ -236,6 +238,9 @@
static const Keyword PATCH = const Keyword("patch", "PATCH", isPseudo: true);
+ static const Keyword REQUIRED =
+ const Keyword("required", "REQUIRED", isBuiltIn: true, isModifier: true);
+
static const Keyword RETHROW = const Keyword("rethrow", "RETHROW");
static const Keyword RETURN = const Keyword("return", "RETURN");
@@ -313,6 +318,7 @@
IN,
INTERFACE,
IS,
+ LATE,
LIBRARY,
MIXIN,
NATIVE,
@@ -323,6 +329,7 @@
OPERATOR,
PART,
PATCH,
+ REQUIRED,
RETHROW,
RETURN,
SET,
@@ -1279,6 +1286,10 @@
'>>>', 'GT_GT_GT', SHIFT_PRECEDENCE, GT_GT_GT_TOKEN,
isOperator: true, isUserDefinableOperator: true);
+ static const TokenType GT_GT_GT_EQ = const TokenType(
+ '>>>=', 'GT_GT_GT_EQ', ASSIGNMENT_PRECEDENCE, GT_GT_GT_EQ_TOKEN,
+ isOperator: true);
+
static const TokenType HASH =
const TokenType('#', 'HASH', NO_PRECEDENCE, HASH_TOKEN);
diff --git a/front_end/messages.status b/front_end/messages.status
index cfa04f1..0229457 100644
--- a/front_end/messages.status
+++ b/front_end/messages.status
@@ -31,18 +31,18 @@
CannotReadSdkSpecification/example: Fail
CantDetermineConstness/analyzerCode: Fail
CantDisambiguateAmbiguousInformation/analyzerCode: Fail # There's no analyzer code for that error yet.
-CantDisambiguateAmbiguousInformation/script: Fail # Can't be tested until 'spread-collections' flag is on.
CantDisambiguateNotEnoughInformation/analyzerCode: Fail # There's no analyzer code for that error yet.
-CantDisambiguateNotEnoughInformation/script: Fail # Can't be tested until 'spread-collections' flag is on.
CantInferPackagesFromManyInputs/analyzerCode: Fail
CantInferPackagesFromManyInputs/example: Fail
CantInferPackagesFromPackageUri/analyzerCode: Fail
CantInferPackagesFromPackageUri/example: Fail
CantInferTypeDueToCircularity/example: Fail
CantInferTypeDueToInconsistentOverrides/example: Fail
+CantUseControlFlowOrSpreadAsConstant/example: Fail
CantUseSuperBoundedTypeForInstanceCreation/analyzerCode: Fail
CantUseSuperBoundedTypeForInstanceCreation/example: Fail
ColonInPlaceOfIn/example: Fail
+ConflictingModifiers/script1: Fail
ConflictsWithConstructor/example: Fail
ConflictsWithFactory/analyzerCode: Fail
ConflictsWithFactory/example: Fail
@@ -51,11 +51,8 @@
ConflictsWithSetter/example: Fail
ConflictsWithSetterWarning/example: Fail
ConflictsWithTypeVariable/example: Fail
-ConstAfterFactory/script1: Fail
-ConstAndCovariant/script2: Fail
ConstAndFinal/declaration3: Fail
ConstAndFinal/declaration4: Fail
-ConstAndVar/script1: Fail
ConstConstructorInSubclassOfMixinApplication/example: Fail
ConstConstructorNonFinalField/example: Fail
ConstConstructorRedirectionToNonConst/analyzerCode: Fail # The analyzer doesn't report this error.
@@ -64,23 +61,37 @@
ConstEvalContext/analyzerCode: Fail # This is just used for displaying the context.
ConstEvalContext/example: Fail # This is just used for displaying the context.
ConstEvalDeferredLibrary/example: Fail
+ConstEvalDuplicateElement/example: Fail
ConstEvalDuplicateKey/example: Fail
+ConstEvalElementImplementsEqual/example: Fail
ConstEvalFailedAssertion/example: Fail
ConstEvalFailedAssertionWithMessage/example: Fail
ConstEvalFreeTypeParameter/analyzerCode: Fail
ConstEvalFreeTypeParameter/example: Fail
ConstEvalInvalidBinaryOperandType/analyzerCode: Fail # CONST_EVAL_TYPE_NUM / CONST_EVAL_TYPE_BOOL
ConstEvalInvalidBinaryOperandType/example: Fail
+ConstEvalInvalidEqualsOperandType/analyzerCode: Fail
+ConstEvalInvalidEqualsOperandType/example: Fail
ConstEvalInvalidMethodInvocation/example: Fail
+ConstEvalInvalidPropertyGet/example: Fail
ConstEvalInvalidStaticInvocation/example: Fail
ConstEvalInvalidStringInterpolationOperand/example: Fail
ConstEvalInvalidSymbolName/example: Fail
ConstEvalInvalidType/analyzerCode: Fail # CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH / CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH / CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH / ...
ConstEvalInvalidType/example: Fail
+ConstEvalIterationInConstList/example: Fail
+ConstEvalIterationInConstMap/example: Fail
+ConstEvalIterationInConstSet/example: Fail
+ConstEvalKeyImplementsEqual/example: Fail
ConstEvalNegativeShift/analyzerCode: Fail # http://dartbug.com/33481
ConstEvalNegativeShift/example: Fail
ConstEvalNonConstantLiteral/example: Fail
ConstEvalNonConstantVariableGet/example: Fail
+ConstEvalNotListOrSetInSpread/example: Fail
+ConstEvalNotMapInSpread/example: Fail
+ConstEvalNullValue/example: Fail
+ConstEvalUnevaluated/analyzerCode: Fail
+ConstEvalUnevaluated/example: Fail
ConstEvalZeroDivisor/example: Fail
ConstFieldWithoutInitializer/example: Fail
ConstructorNotFound/example: Fail
@@ -90,7 +101,6 @@
ContinueWithoutLabelInCase/script1: Fail
CouldNotParseUri/analyzerCode: Fail
CouldNotParseUri/example: Fail
-CovariantAfterFinal/script1: Fail
CovariantAfterVar/script1: Fail
CovariantAndStatic/script1: Fail
CovariantAndStatic/script2: Fail
@@ -239,6 +249,8 @@
InvalidInitializer/example: Fail
InvalidPackageUri/analyzerCode: Fail
InvalidPackageUri/example: Fail
+InvalidSuperInInitializer/example: Fail
+InvalidThisInInitializer/example: Fail
InvalidUseOfNullAwareAccess/example: Fail
InvalidVoid/script1: Fail
InvalidVoid/script2: Fail
@@ -261,6 +273,7 @@
MissingMain/example: Fail
MissingPrefixInDeferredImport/example: Fail
MixinInferenceNoMatchingClass/example: Fail
+ModifierOutOfOrder/script1: Fail
MultipleExtends/script: Fail
MultipleImplements/script: Fail
MultipleLibraryDirectives/example: Fail
@@ -277,11 +290,11 @@
NonConstFactory/example: Fail
NonInstanceTypeVariableUse/example: Fail
NonNullAwareSpreadIsNull/analyzerCode: Fail # There's no analyzer code for that error yet.
-NonNullAwareSpreadIsNull/script: Fail # Can't be tested until 'spread-collections' flag is on.
NonPartOfDirectiveInPart/script1: Fail
NotAConstantExpression/example: Fail
NotAType/example: Fail
NotAnLvalue/example: Fail
+NotBinaryOperator/analyzerCode: Fail
NotConstantExpression/example: Fail
OperatorMinusParameterMismatch/example: Fail
OperatorParameterMismatch0/analyzerCode: Fail
@@ -343,15 +356,8 @@
SourceBodySummary/example: Fail
SourceOutlineSummary/analyzerCode: Fail
SourceOutlineSummary/example: Fail
-SpreadElementTypeMismatch/script: Fail # Can't be tested until 'spread-collections' flag is on.
-SpreadMapEntryElementKeyTypeMismatch/script: Fail # Can't be tested until 'spread-collections' flag is on.
-SpreadMapEntryElementValueTypeMismatch/script: Fail # Can't be tested until 'spread-collections' flag is on.
SpreadMapEntryTypeMismatch/analyzerCode: Fail # There's no analyzer code for that error yet.
-SpreadMapEntryTypeMismatch/script1: Fail # Can't be tested until 'spread-collections' flag is on.
-SpreadMapEntryTypeMismatch/script2: Fail # Can't be tested until 'spread-collections' flag is on.
SpreadTypeMismatch/analyzerCode: Fail # There's no analyzer code for that error yet.
-SpreadTypeMismatch/script1: Fail # Can't be tested until 'spread-collections' flag is on.
-SpreadTypeMismatch/script2: Fail # Can't be tested until 'spread-collections' flag is on.
StackOverflow/example: Fail
StaticAfterConst/script1: Fail
SuperAsExpression/example: Fail
diff --git a/front_end/messages.yaml b/front_end/messages.yaml
index 195f967..53c901f 100644
--- a/front_end/messages.yaml
+++ b/front_end/messages.yaml
@@ -85,9 +85,21 @@
ConstEvalContext:
template: "While analyzing:"
+ConstEvalDuplicateElement:
+ template: "The element '#constant' conflicts with another existing element in the set."
+ analyzerCode: EQUAL_ELEMENTS_IN_CONST_SET
+
ConstEvalDuplicateKey:
template: "The key '#constant' conflicts with another existing key in the map."
- analyzerCode: EQUAL_KEYS_IN_MAP
+ analyzerCode: EQUAL_KEYS_IN_CONST_MAP
+
+ConstEvalElementImplementsEqual:
+ template: "The element '#constant' does not have a primitive operator '=='."
+ analyzerCode: CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS
+
+ConstEvalKeyImplementsEqual:
+ template: "The key '#constant' does not have a primitive operator '=='."
+ analyzerCode: CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS
ConstEvalNonConstantLiteral:
template: "Can't have a non-constant #string literal within a const context."
@@ -99,6 +111,9 @@
ConstEvalInvalidBinaryOperandType:
template: "Binary operator '#string' on '#constant' requires operand of type '#type', but was of type '#type2'."
+ConstEvalInvalidEqualsOperandType:
+ template: "Binary operator '==' requires receiver constant '#constant' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type '#type'."
+
ConstEvalZeroDivisor:
template: "Binary operator '#string' on '#string2' requires non-zero divisor, but divisor was '0'."
analyzerCode: CONST_EVAL_THROWS_IDBZE
@@ -110,6 +125,10 @@
template: "The method '#string' can't be invoked on '#constant' within a const context."
analyzerCode: UNDEFINED_OPERATOR
+ConstEvalInvalidPropertyGet:
+ template: "The property '#string' can't be accessed on '#constant' within a const context."
+ analyzerCode: CONST_EVAL_THROWS_EXCEPTION
+
ConstEvalInvalidStringInterpolationOperand:
template: "The '#constant' can't be used as part of a string interpolation within a const context, only values of type 'null', 'bool', 'int', 'double', or 'String' can be used."
analyzerCode: CONST_EVAL_TYPE_BOOL_NUM_STRING
@@ -150,6 +169,33 @@
template: "Constant expression depends on itself."
analyzerCode: RECURSIVE_COMPILE_TIME_CONSTANT
+ConstEvalNullValue:
+ template: "Null value during constant evaluation."
+ analyzerCode: CONST_EVAL_THROWS_EXCEPTION
+
+ConstEvalNotListOrSetInSpread:
+ template: "Only lists and sets can be used in spreads in constant lists and sets."
+ analyzerCode: CONST_SPREAD_EXPECTED_LIST_OR_SET
+
+ConstEvalNotMapInSpread:
+ template: "Only maps can be used in spreads in constant maps."
+ analyzerCode: CONST_SPREAD_EXPECTED_MAP
+
+ConstEvalIterationInConstList:
+ template: "Iteration can't be used in a constant list."
+ analyzerCode: NON_CONSTANT_LIST_ELEMENT
+
+ConstEvalIterationInConstSet:
+ template: "Iteration can't be used in a constant set."
+ analyzerCode: NON_CONSTANT_SET_ELEMENT
+
+ConstEvalIterationInConstMap:
+ template: "Iteration can't be used in a constant map."
+ analyzerCode: NON_CONSTANT_MAP_ELEMENT
+
+ConstEvalUnevaluated:
+ template: "Could not evaluate constant expression."
+
NotConstantExpression:
template: "#string is not a constant expression."
analyzerCode: NOT_CONSTANT_EXPRESSION
@@ -175,7 +221,7 @@
ExperimentNotEnabled:
index: 93
- template: "This requires the --#string experiment to be enabled."
+ template: "This requires the '#string' experiment to be enabled."
tip: "Try enabling this experiment by adding it to the command line when compiling and running."
analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED
@@ -528,15 +574,6 @@
analyzerCode: ParserErrorCode.CONST_CLASS
script: "const class C {}"
-ConstAndCovariant:
- index: 57
- template: "Members can't be declared to be both 'const' and 'covariant'."
- tip: "Try removing either the 'const' or 'covariant' keyword."
- analyzerCode: ParserErrorCode.CONST_AND_COVARIANT
- script:
- - "class C { covariant const C f; }"
- - "class C { const covariant C f; }"
-
ConstAndFinal:
index: 58
template: "Members can't be declared to be both 'const' and 'final'."
@@ -548,11 +585,11 @@
- "const final int x = 5;"
- "final const int x = 5;"
-ConstAndVar:
+ConflictingModifiers:
index: 59
- template: "Members can't be declared to be both 'const' and 'var'."
- tip: "Try removing either the 'const' or 'var' keyword."
- analyzerCode: ParserErrorCode.CONST_AND_VAR
+ template: "Members can't be declared to be both '#string' and '#string2'."
+ tip: "Try removing one of the keywords."
+ analyzerCode: ParserErrorCode.CONFLICTING_MODIFIERS
script:
- "class C { const var x; }"
- "class C { var const x; }"
@@ -586,14 +623,22 @@
tip: "Try using a constructor or factory that is 'const'."
analyzerCode: NOT_CONSTANT_EXPRESSION
-ConstAfterFactory:
+ModifierOutOfOrder:
index: 56
- template: "The modifier 'const' should be before the modifier 'factory'."
+ template: "The modifier '#string' should be before the modifier '#string2'."
tip: "Try re-ordering the modifiers."
- analyzerCode: ParserErrorCode.CONST_AFTER_FACTORY
+ analyzerCode: ParserErrorCode.MODIFIER_OUT_OF_ORDER
script:
- "class C { factory const C() = prefix.B.foo; }"
+TypeBeforeFactory:
+ index: 57
+ template: "Factory constructors cannot have a return type."
+ tip: "Try removing the type appearing before 'factory'."
+ analyzerCode: ParserErrorCode.TYPE_BEFORE_FACTORY
+ script:
+ - "class C { T factory C() { return null; } }"
+
ConstConstructorWithBody:
template: "A const constructor can't have a body."
tip: "Try removing either the 'const' keyword or the body."
@@ -609,14 +654,6 @@
script:
- "class C { const m() {} }"
-CovariantAfterFinal:
- index: 65
- template: "The modifier 'covariant' should be before the modifier 'final'."
- tip: "Try re-ordering the modifiers."
- analyzerCode: ParserErrorCode.COVARIANT_AFTER_FINAL
- script:
- - "final covariant f;"
-
CovariantAfterVar:
index: 8
template: "The modifier 'covariant' should be before the modifier 'var'."
@@ -637,7 +674,7 @@
DuplicatedModifier:
index: 70
template: "The modifier '#lexeme' was already specified."
- tip: "Try removing all but one occurance of the modifier."
+ tip: "Try removing all but one occurence of the modifier."
analyzerCode: ParserErrorCode.DUPLICATED_MODIFIER
script:
- "class C { const const m; }"
@@ -2133,7 +2170,7 @@
ImportAfterPart:
index: 10
- template: "Import directives must preceed part directives."
+ template: "Import directives must precede part directives."
tip: "Try moving the import directives before the part directives."
analyzerCode: ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE
script:
@@ -2141,7 +2178,7 @@
ExportAfterPart:
index: 75
- template: "Export directives must preceed part directives."
+ template: "Export directives must precede part directives."
tip: "Try moving the export directives before the part directives."
analyzerCode: ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE
script:
@@ -2431,7 +2468,7 @@
MissingOperatorKeyword:
index: 31
- template: "Operator declarations must be preceeded by the keyword 'operator'."
+ template: "Operator declarations must be preceded by the keyword 'operator'."
tip: "Try adding the keyword 'operator'."
analyzerCode: ParserErrorCode.MISSING_KEYWORD_OPERATOR
script:
@@ -2444,6 +2481,16 @@
script:
- "class C { void operator %=(x) {} }"
+NotBinaryOperator:
+ template: "'#lexeme' isn't a binary operator."
+ script: >
+ class C { operator~() { return null; } }
+
+ main() {
+ C c = new C();
+ print(c ~ 2);
+ }
+
OperatorParameterMismatch0:
template: "Operator '#name' shouldn't have any parameters."
@@ -2506,9 +2553,19 @@
template: "SDK libraries specification not found: #uri."
tip: "Normally, the specification is a file named 'libraries.json' in the Dart SDK install location."
+InvalidSuperInInitializer:
+ index: 95
+ template: "Can only use 'super' in an initializer for calling the superclass constructor (e.g. 'super()' or 'super.namedConstructor()')"
+ analyzerCode: ParserErrorCode.INVALID_SUPER_IN_INITIALIZER
+
+InvalidThisInInitializer:
+ index: 65
+ template: "Can only use 'this' in an initializer for field initialization (e.g. 'this.x = something') and constructor redirection (e.g. 'this()' or 'this.namedConstructor())"
+ analyzerCode: ParserErrorCode.INVALID_THIS_IN_INITIALIZER
+
ThisAccessInFieldInitializer:
template: "Can't access 'this' in a field initializer to read '#name'."
- analyzerCode: THIS_ACCESS_FROM_INITIALIZER
+ analyzerCode: THIS_ACCESS_FROM_FIELD_INITIALIZER
ThisOrSuperAccessInFieldInitializer:
template: "Can't access '#string' in a field initializer."
@@ -3126,6 +3183,10 @@
prefix?.Object;
}
+CantUseControlFlowOrSpreadAsConstant:
+ template: "'#lexeme' is not supported in constant expressions."
+ analyzerCode: NOT_CONSTANT_EXPRESSION
+
CantUseDeferredPrefixAsConstant:
template: >
'#lexeme' can't be used in a constant expression because it's marked as
diff --git a/front_end/pubspec.yaml b/front_end/pubspec.yaml
index b3f5034..64e9958 100644
--- a/front_end/pubspec.yaml
+++ b/front_end/pubspec.yaml
@@ -1,31 +1,24 @@
name: front_end
# Currently, front_end API is not stable and users should not
# depend on semver semantics when depending on this package.
-version: 0.1.14
+version: 0.1.18
author: Dart Team <misc@dartlang.org>
description: Front end for compilation of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/front_end
environment:
sdk: '>=2.1.0-dev.5.0 <3.0.0'
dependencies:
- charcode: '^1.1.1'
- convert: '^2.0.1'
- crypto: '^2.0.2'
- kernel: 0.3.14
- meta: '^1.1.1'
+ kernel: 0.3.18
package_config: '^1.0.1'
path: '^1.3.9'
- source_span: '^1.2.3'
yaml: '^2.1.12'
dev_dependencies:
- analyzer: 0.35.4
+ analyzer: 0.36.3
args: '>=0.13.0 <2.0.0'
build_integration:
path: ../build_integration
dart_style: '^1.0.7'
json_rpc_2: ^2.0.9
- mockito: ^2.0.2
- stream_channel: ^1.6.1
test: ^1.3.4
test_reflective_loader: ^0.1.0
web_socket_channel: ^1.0.4
diff --git a/front_end/testcases/argument_mismatch.dart b/front_end/testcases/argument_mismatch.dart
index 61a678e..7cce446 100644
--- a/front_end/testcases/argument_mismatch.dart
+++ b/front_end/testcases/argument_mismatch.dart
@@ -2,9 +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=warning,context*/
-
-/*@context=CandidateFound*/ foo() {}
+foo() {}
test() {
/*@warning=MethodNotFound*/ foo(null);
diff --git a/front_end/testcases/argument_mismatch.dart.legacy.expect b/front_end/testcases/argument_mismatch.dart.legacy.expect
index d836fc0..ac488e4 100644
--- a/front_end/testcases/argument_mismatch.dart.legacy.expect
+++ b/front_end/testcases/argument_mismatch.dart.legacy.expect
@@ -2,13 +2,13 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/argument_mismatch.dart:10:34: Warning: Too many positional arguments: 0 allowed, but 1 found.
+// pkg/front_end/testcases/argument_mismatch.dart:8:34: Warning: Too many positional arguments: 0 allowed, but 1 found.
// Try removing the extra positional arguments.
// /*@warning=MethodNotFound*/ foo(null);
// ^
-// pkg/front_end/testcases/argument_mismatch.dart:7:29: Context: Found this candidate, but the arguments don't match.
-// /*@context=CandidateFound*/ foo() {}
-// ^^^
+// pkg/front_end/testcases/argument_mismatch.dart:5:1: Context: Found this candidate, but the arguments don't match.
+// foo() {}
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/argument_mismatch.dart.legacy.transformed.expect b/front_end/testcases/argument_mismatch.dart.legacy.transformed.expect
index d836fc0..ac488e4 100644
--- a/front_end/testcases/argument_mismatch.dart.legacy.transformed.expect
+++ b/front_end/testcases/argument_mismatch.dart.legacy.transformed.expect
@@ -2,13 +2,13 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/argument_mismatch.dart:10:34: Warning: Too many positional arguments: 0 allowed, but 1 found.
+// pkg/front_end/testcases/argument_mismatch.dart:8:34: Warning: Too many positional arguments: 0 allowed, but 1 found.
// Try removing the extra positional arguments.
// /*@warning=MethodNotFound*/ foo(null);
// ^
-// pkg/front_end/testcases/argument_mismatch.dart:7:29: Context: Found this candidate, but the arguments don't match.
-// /*@context=CandidateFound*/ foo() {}
-// ^^^
+// pkg/front_end/testcases/argument_mismatch.dart:5:1: Context: Found this candidate, but the arguments don't match.
+// foo() {}
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.expect b/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.expect
index 92d0def..abff6cf 100644
--- a/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.expect
+++ b/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
- method bar<Y extends self::A::X = dynamic>() → dynamic
+ method bar<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic
return null;
}
class B extends core::Object {
diff --git a/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.transformed.expect b/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.transformed.expect
index 92d0def..abff6cf 100644
--- a/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.transformed.expect
+++ b/front_end/testcases/bounds_check_depends_on_inference.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
- method bar<Y extends self::A::X = dynamic>() → dynamic
+ method bar<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic
return null;
}
class B extends core::Object {
diff --git a/front_end/testcases/bounds_check_depends_on_inference.dart.outline.expect b/front_end/testcases/bounds_check_depends_on_inference.dart.outline.expect
index ec400af..8a919db 100644
--- a/front_end/testcases/bounds_check_depends_on_inference.dart.outline.expect
+++ b/front_end/testcases/bounds_check_depends_on_inference.dart.outline.expect
@@ -5,7 +5,7 @@
class A<X extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::A<self::A::X>
;
- method bar<Y extends self::A::X = dynamic>() → dynamic
+ method bar<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic
;
}
class B extends core::Object {
diff --git a/front_end/testcases/bug21938.dart b/front_end/testcases/bug21938.dart
index c8555af..b6e851b 100644
--- a/front_end/testcases/bug21938.dart
+++ b/front_end/testcases/bug21938.dart
@@ -2,15 +2,13 @@
// 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=error*/
-
test() {
Object x;
Function f;
- x /*@error=UndefinedMethod*/ ();
- x /*@error=UndefinedMethod*/ (3);
+ x();
+ x(3);
f(5, 2);
- x. /*@error=UndefinedMethod*/ call();
+ x.call();
f.call;
f.call(5, 2);
}
diff --git a/front_end/testcases/bug21938.dart.strong.expect b/front_end/testcases/bug21938.dart.strong.expect
index 25e833b..aa88e80 100644
--- a/front_end/testcases/bug21938.dart.strong.expect
+++ b/front_end/testcases/bug21938.dart.strong.expect
@@ -2,23 +2,23 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/bug21938.dart:10:4: Error: The method 'call' isn't defined for the class 'Object'.
+// pkg/front_end/testcases/bug21938.dart:8:4: Error: The method 'call' isn't defined for the class 'Object'.
// - 'Object' is from 'dart:core'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
-// x /*@error=UndefinedMethod*/ ();
+// x();
// ^
//
-// pkg/front_end/testcases/bug21938.dart:11:4: Error: The method 'call' isn't defined for the class 'Object'.
+// pkg/front_end/testcases/bug21938.dart:9:4: Error: The method 'call' isn't defined for the class 'Object'.
// - 'Object' is from 'dart:core'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
-// x /*@error=UndefinedMethod*/ (3);
+// x(3);
// ^
//
-// pkg/front_end/testcases/bug21938.dart:13:33: Error: The method 'call' isn't defined for the class 'Object'.
+// pkg/front_end/testcases/bug21938.dart:11:5: Error: The method 'call' isn't defined for the class 'Object'.
// - 'Object' is from 'dart:core'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
-// x. /*@error=UndefinedMethod*/ call();
-// ^^^^
+// x.call();
+// ^^^^
//
import self as self;
import "dart:core" as core;
@@ -26,22 +26,22 @@
static method test() → dynamic {
core::Object x;
core::Function f;
- invalid-expression "pkg/front_end/testcases/bug21938.dart:10:4: Error: The method 'call' isn't defined for the class 'Object'.
+ invalid-expression "pkg/front_end/testcases/bug21938.dart:8:4: Error: The method 'call' isn't defined for the class 'Object'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
- x /*@error=UndefinedMethod*/ ();
+ x();
^";
- invalid-expression "pkg/front_end/testcases/bug21938.dart:11:4: Error: The method 'call' isn't defined for the class 'Object'.
+ invalid-expression "pkg/front_end/testcases/bug21938.dart:9:4: Error: The method 'call' isn't defined for the class 'Object'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
- x /*@error=UndefinedMethod*/ (3);
+ x(3);
^";
f.call(5, 2);
- invalid-expression "pkg/front_end/testcases/bug21938.dart:13:33: Error: The method 'call' isn't defined for the class 'Object'.
+ invalid-expression "pkg/front_end/testcases/bug21938.dart:11:5: Error: The method 'call' isn't defined for the class 'Object'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
- x. /*@error=UndefinedMethod*/ call();
- ^^^^";
+ x.call();
+ ^^^^";
f.call;
f.call(5, 2);
}
diff --git a/front_end/testcases/bug32629.dart b/front_end/testcases/bug32629.dart
index 88610e0..fc0492f 100644
--- a/front_end/testcases/bug32629.dart
+++ b/front_end/testcases/bug32629.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.
-/*@testedFeatures=error*/
-
class A {
dynamic call(dynamic a, dynamic b) {
return a;
diff --git a/front_end/testcases/bug33298.dart.legacy.expect b/front_end/testcases/bug33298.dart.legacy.expect
index c9a8e28..c12d485 100644
--- a/front_end/testcases/bug33298.dart.legacy.expect
+++ b/front_end/testcases/bug33298.dart.legacy.expect
@@ -13,7 +13,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method call(self::B::T t) → self::B::T
+ method call(generic-covariant-impl self::B::T t) → self::B::T
return t;
}
class C extends core::Object {
diff --git a/front_end/testcases/bug33298.dart.legacy.transformed.expect b/front_end/testcases/bug33298.dart.legacy.transformed.expect
index c9a8e28..c12d485 100644
--- a/front_end/testcases/bug33298.dart.legacy.transformed.expect
+++ b/front_end/testcases/bug33298.dart.legacy.transformed.expect
@@ -13,7 +13,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method call(self::B::T t) → self::B::T
+ method call(generic-covariant-impl self::B::T t) → self::B::T
return t;
}
class C extends core::Object {
diff --git a/front_end/testcases/bug33298.dart.outline.expect b/front_end/testcases/bug33298.dart.outline.expect
index ed25402..1d7e071 100644
--- a/front_end/testcases/bug33298.dart.outline.expect
+++ b/front_end/testcases/bug33298.dart.outline.expect
@@ -11,7 +11,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- method call(self::B::T t) → self::B::T
+ method call(generic-covariant-impl self::B::T t) → self::B::T
;
}
class C extends core::Object {
diff --git a/front_end/testcases/bug35470.dart.legacy.expect b/front_end/testcases/bug35470.dart.legacy.expect
index 7f2ad6a..630df24 100644
--- a/front_end/testcases/bug35470.dart.legacy.expect
+++ b/front_end/testcases/bug35470.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
- method foo<Y extends self::A::X = dynamic>() → dynamic {}
+ method foo<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic {}
}
class B extends self::A<dynamic> {
synthetic constructor •() → self::B
diff --git a/front_end/testcases/bug35470.dart.legacy.transformed.expect b/front_end/testcases/bug35470.dart.legacy.transformed.expect
index 7f2ad6a..630df24 100644
--- a/front_end/testcases/bug35470.dart.legacy.transformed.expect
+++ b/front_end/testcases/bug35470.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
- method foo<Y extends self::A::X = dynamic>() → dynamic {}
+ method foo<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic {}
}
class B extends self::A<dynamic> {
synthetic constructor •() → self::B
diff --git a/front_end/testcases/bug35470.dart.outline.expect b/front_end/testcases/bug35470.dart.outline.expect
index 26320fb..33d29f3 100644
--- a/front_end/testcases/bug35470.dart.outline.expect
+++ b/front_end/testcases/bug35470.dart.outline.expect
@@ -5,7 +5,7 @@
class A<X extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::A<self::A::X>
;
- method foo<Y extends self::A::X = dynamic>() → dynamic
+ method foo<generic-covariant-impl Y extends self::A::X = dynamic>() → dynamic
;
}
class B extends self::A<dynamic> {
diff --git a/front_end/testcases/check_deferred_allocation.dart.legacy.expect b/front_end/testcases/check_deferred_allocation.dart.legacy.expect
index 5167dc9..c660edf 100644
--- a/front_end/testcases/check_deferred_allocation.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_allocation.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_allocation.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_allocation.dart.legacy.transformed.expect
index 5167dc9..c660edf 100644
--- a/front_end/testcases/check_deferred_allocation.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_allocation.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_allocation.dart.strong.expect b/front_end/testcases/check_deferred_allocation.dart.strong.expect
index 799a3cd..0a70d79 100644
--- a/front_end/testcases/check_deferred_allocation.dart.strong.expect
+++ b/front_end/testcases/check_deferred_allocation.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect b/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect
index 494d25e..b5040a5 100644
--- a/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_allocation.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args.dart.legacy.expect b/front_end/testcases/check_deferred_before_args.dart.legacy.expect
index 908e7aa..e223280 100644
--- a/front_end/testcases/check_deferred_before_args.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_before_args.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_before_args.dart.legacy.transformed.expect
index 908e7aa..e223280 100644
--- a/front_end/testcases/check_deferred_before_args.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_before_args.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args.dart.strong.expect b/front_end/testcases/check_deferred_before_args.dart.strong.expect
index b570941..26b5b7d 100644
--- a/front_end/testcases/check_deferred_before_args.dart.strong.expect
+++ b/front_end/testcases/check_deferred_before_args.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "dart:core" as core;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect b/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
index 1ea2a3f..1f4e6c8 100644
--- a/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args2.dart.legacy.expect b/front_end/testcases/check_deferred_before_args2.dart.legacy.expect
index e9712c6..eebc07b 100644
--- a/front_end/testcases/check_deferred_before_args2.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_before_args2.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args2.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_before_args2.dart.legacy.transformed.expect
index 7f12556..989c4c4 100644
--- a/front_end/testcases/check_deferred_before_args2.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_before_args2.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:async" as asy;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args2.dart.strong.expect b/front_end/testcases/check_deferred_before_args2.dart.strong.expect
index db0bb07..512b965 100644
--- a/front_end/testcases/check_deferred_before_args2.dart.strong.expect
+++ b/front_end/testcases/check_deferred_before_args2.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect b/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect
index 5ac3a08..7b3dfb1 100644
--- a/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_before_args2.dart.strong.transformed.expect
@@ -2,7 +2,7 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_call.dart.legacy.expect b/front_end/testcases/check_deferred_before_call.dart.legacy.expect
index 2a8fcd5..3cf5bf4 100644
--- a/front_end/testcases/check_deferred_before_call.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_before_call.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_call.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_before_call.dart.legacy.transformed.expect
index 2a8fcd5..3cf5bf4 100644
--- a/front_end/testcases/check_deferred_before_call.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_before_call.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_call.dart.strong.expect b/front_end/testcases/check_deferred_before_call.dart.strong.expect
index a4a8839..feb2112 100644
--- a/front_end/testcases/check_deferred_before_call.dart.strong.expect
+++ b/front_end/testcases/check_deferred_before_call.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect b/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect
index 2b6f45a..b755990 100644
--- a/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_before_call.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_write.dart.legacy.expect b/front_end/testcases/check_deferred_before_write.dart.legacy.expect
index d1bc459..169b56c 100644
--- a/front_end/testcases/check_deferred_before_write.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_before_write.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_write.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_before_write.dart.legacy.transformed.expect
index d1bc459..169b56c 100644
--- a/front_end/testcases/check_deferred_before_write.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_before_write.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_write.dart.strong.expect b/front_end/testcases/check_deferred_before_write.dart.strong.expect
index cf5fce5..3fa478a 100644
--- a/front_end/testcases/check_deferred_before_write.dart.strong.expect
+++ b/front_end/testcases/check_deferred_before_write.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect b/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect
index a6a7f4a..40b7cc6 100644
--- a/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_before_write.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read.dart.legacy.expect b/front_end/testcases/check_deferred_read.dart.legacy.expect
index 175fa7c..714d35c 100644
--- a/front_end/testcases/check_deferred_read.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_read.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_read.dart.legacy.transformed.expect
index 175fa7c..714d35c 100644
--- a/front_end/testcases/check_deferred_read.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_read.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read.dart.strong.expect b/front_end/testcases/check_deferred_read.dart.strong.expect
index 1af399d..500b9e9 100644
--- a/front_end/testcases/check_deferred_read.dart.strong.expect
+++ b/front_end/testcases/check_deferred_read.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read.dart.strong.transformed.expect b/front_end/testcases/check_deferred_read.dart.strong.transformed.expect
index daa8674..1e9676c 100644
--- a/front_end/testcases/check_deferred_read.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_read.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_static_field.dart.legacy.expect b/front_end/testcases/check_deferred_read_static_field.dart.legacy.expect
index 60e13fd..01f9ffd 100644
--- a/front_end/testcases/check_deferred_read_static_field.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_read_static_field.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_static_field.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_read_static_field.dart.legacy.transformed.expect
index 60e13fd..01f9ffd 100644
--- a/front_end/testcases/check_deferred_read_static_field.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_read_static_field.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_static_field.dart.strong.expect b/front_end/testcases/check_deferred_read_static_field.dart.strong.expect
index 90d44a4..a454d85 100644
--- a/front_end/testcases/check_deferred_read_static_field.dart.strong.expect
+++ b/front_end/testcases/check_deferred_read_static_field.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect b/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect
index ed7f244..c8d8259 100644
--- a/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_read_static_field.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_type.dart.legacy.expect b/front_end/testcases/check_deferred_read_type.dart.legacy.expect
index 3982934..8acc0bb 100644
--- a/front_end/testcases/check_deferred_read_type.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_read_type.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_type.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_read_type.dart.legacy.transformed.expect
index 3982934..8acc0bb 100644
--- a/front_end/testcases/check_deferred_read_type.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_read_type.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_type.dart.strong.expect b/front_end/testcases/check_deferred_read_type.dart.strong.expect
index d62739e..413f2f6 100644
--- a/front_end/testcases/check_deferred_read_type.dart.strong.expect
+++ b/front_end/testcases/check_deferred_read_type.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect b/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect
index 747f240..363f918 100644
--- a/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_read_type.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_static_method_call.dart.legacy.expect b/front_end/testcases/check_deferred_static_method_call.dart.legacy.expect
index a054b09..5e32eae 100644
--- a/front_end/testcases/check_deferred_static_method_call.dart.legacy.expect
+++ b/front_end/testcases/check_deferred_static_method_call.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_static_method_call.dart.legacy.transformed.expect b/front_end/testcases/check_deferred_static_method_call.dart.legacy.transformed.expect
index a054b09..5e32eae 100644
--- a/front_end/testcases/check_deferred_static_method_call.dart.legacy.transformed.expect
+++ b/front_end/testcases/check_deferred_static_method_call.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_static_method_call.dart.strong.expect b/front_end/testcases/check_deferred_static_method_call.dart.strong.expect
index 6ee7c79..cf7b29c 100644
--- a/front_end/testcases/check_deferred_static_method_call.dart.strong.expect
+++ b/front_end/testcases/check_deferred_static_method_call.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect b/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect
index cfe8c33..0e05e8f 100644
--- a/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect
+++ b/front_end/testcases/check_deferred_static_method_call.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/constructor_const_inference.dart.legacy.expect b/front_end/testcases/constructor_const_inference.dart.legacy.expect
index b3c195b..fa5e33f 100644
--- a/front_end/testcases/constructor_const_inference.dart.legacy.expect
+++ b/front_end/testcases/constructor_const_inference.dart.legacy.expect
@@ -8,7 +8,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_Y<self::A::T> x;
+ generic-covariant-impl field self::_Y<self::A::T> x;
constructor •(self::_Y<self::A::T> x) → self::A<self::A::T>
: self::A::x = x, super core::Object::•()
;
diff --git a/front_end/testcases/constructor_const_inference.dart.legacy.transformed.expect b/front_end/testcases/constructor_const_inference.dart.legacy.transformed.expect
index b3c195b..fa5e33f 100644
--- a/front_end/testcases/constructor_const_inference.dart.legacy.transformed.expect
+++ b/front_end/testcases/constructor_const_inference.dart.legacy.transformed.expect
@@ -8,7 +8,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_Y<self::A::T> x;
+ generic-covariant-impl field self::_Y<self::A::T> x;
constructor •(self::_Y<self::A::T> x) → self::A<self::A::T>
: self::A::x = x, super core::Object::•()
;
diff --git a/front_end/testcases/constructor_const_inference.dart.outline.expect b/front_end/testcases/constructor_const_inference.dart.outline.expect
index 071faac..2ad0826 100644
--- a/front_end/testcases/constructor_const_inference.dart.outline.expect
+++ b/front_end/testcases/constructor_const_inference.dart.outline.expect
@@ -7,7 +7,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_Y<self::A::T> x;
+ generic-covariant-impl field self::_Y<self::A::T> x;
constructor •(self::_Y<self::A::T> x) → self::A<self::A::T>
;
}
diff --git a/front_end/testcases/control_flow_collection.dart b/front_end/testcases/control_flow_collection.dart
new file mode 100644
index 0000000..987769f
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2019, 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.
+
+main() {
+ final aList = <int>[
+ 1,
+ if (oracle()) 2,
+ if (oracle()) 3 else -1,
+ if (oracle()) if (oracle()) 4,
+ for (int i in <int>[5, 6, 7]) i,
+ for (int i in <int>[8, 9, 10]) if (oracle()) i,
+ for (int i = 11; i <= 14; ++i) i,
+ ];
+ final aSet = <int>{
+ 1,
+ if (oracle()) 2,
+ if (oracle()) 3 else -1,
+ if (oracle()) if (oracle()) 4,
+ for (int i in <int>[5, 6, 7]) i,
+ for (int i in <int>[8, 9, 10]) if (oracle()) i,
+ for (int i = 11; i <= 14; ++i) i,
+ };
+ final aMap = <int, int>{
+ 1: 1,
+ if (oracle()) 2: 2,
+ if (oracle()) 3: 3 else -1: -1,
+ if (oracle()) if (oracle()) 4: 4,
+ for (int i in <int>[5, 6, 7]) i: i,
+ for (int i in <int>[8, 9, 10]) if (oracle()) i: i,
+ for (int i = 11; i <= 14; ++i) i: i,
+ };
+
+ print(aList);
+ print(aSet);
+ print(aMap);
+}
+
+oracle() => true;
diff --git a/front_end/testcases/control_flow_collection.dart.legacy.expect b/front_end/testcases/control_flow_collection.dart.legacy.expect
new file mode 100644
index 0000000..099350f
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.legacy.expect
@@ -0,0 +1,113 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection.dart:8:7: Error: Unexpected token 'if'.
+// if (oracle()) 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:9:7: Error: Unexpected token 'if'.
+// if (oracle()) 3 else -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:10:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:10:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:11:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:12:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:12:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:13:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:17:7: Error: Unexpected token 'if'.
+// if (oracle()) 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:18:7: Error: Unexpected token 'if'.
+// if (oracle()) 3 else -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:19:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:19:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:20:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:21:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:21:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:22:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:26:7: Error: Unexpected token 'if'.
+// if (oracle()) 2: 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:27:7: Error: Unexpected token 'if'.
+// if (oracle()) 3: 3 else -1: -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:28:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4: 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:28:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4: 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:29:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i: i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:30:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i: i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:30:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i: i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:31:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i: i,
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ final dynamic aList = <core::int>[1];
+ final dynamic aSet = <core::int>{1};
+ final dynamic aMap = <core::int, core::int>{1: 1};
+ core::print(aList);
+ core::print(aSet);
+ core::print(aMap);
+}
+static method oracle() → dynamic
+ return true;
diff --git a/front_end/testcases/control_flow_collection.dart.legacy.transformed.expect b/front_end/testcases/control_flow_collection.dart.legacy.transformed.expect
new file mode 100644
index 0000000..099350f
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.legacy.transformed.expect
@@ -0,0 +1,113 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection.dart:8:7: Error: Unexpected token 'if'.
+// if (oracle()) 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:9:7: Error: Unexpected token 'if'.
+// if (oracle()) 3 else -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:10:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:10:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:11:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:12:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:12:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:13:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:17:7: Error: Unexpected token 'if'.
+// if (oracle()) 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:18:7: Error: Unexpected token 'if'.
+// if (oracle()) 3 else -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:19:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:19:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:20:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:21:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:21:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:22:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:26:7: Error: Unexpected token 'if'.
+// if (oracle()) 2: 2,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:27:7: Error: Unexpected token 'if'.
+// if (oracle()) 3: 3 else -1: -1,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:28:21: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4: 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:28:7: Error: Unexpected token 'if'.
+// if (oracle()) if (oracle()) 4: 4,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:29:7: Error: Unexpected token 'for'.
+// for (int i in <int>[5, 6, 7]) i: i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:30:38: Error: Unexpected token 'if'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i: i,
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:30:7: Error: Unexpected token 'for'.
+// for (int i in <int>[8, 9, 10]) if (oracle()) i: i,
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection.dart:31:7: Error: Unexpected token 'for'.
+// for (int i = 11; i <= 14; ++i) i: i,
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ final dynamic aList = <core::int>[1];
+ final dynamic aSet = <core::int>{1};
+ final dynamic aMap = <core::int, core::int>{1: 1};
+ core::print(aList);
+ core::print(aSet);
+ core::print(aMap);
+}
+static method oracle() → dynamic
+ return true;
diff --git a/front_end/testcases/control_flow_collection.dart.outline.expect b/front_end/testcases/control_flow_collection.dart.outline.expect
new file mode 100644
index 0000000..b0c1797
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.outline.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+
+static method main() → dynamic
+ ;
+static method oracle() → dynamic
+ ;
diff --git a/front_end/testcases/control_flow_collection.dart.strong.expect b/front_end/testcases/control_flow_collection.dart.strong.expect
new file mode 100644
index 0000000..8c19425
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.strong.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+static method main() → dynamic {
+ final core::List<core::int> aList = block {
+ final core::List<core::int> #t1 = <core::int>[];
+ #t1.{core::List::add}(1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(3);
+ else
+ #t1.{core::List::add}(1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t1.{core::List::add}(i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t1.{core::List::add}(i);
+ } =>#t1;
+ final core::Set<core::int> aSet = block {
+ final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>();
+ #t2.{core::Set::add}(1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(3);
+ else
+ #t2.{core::Set::add}(1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t2.{core::Set::add}(i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t2.{core::Set::add}(i);
+ } =>#t2;
+ final core::Map<core::int, core::int> aMap = block {
+ final core::Map<core::int, core::int> #t3 = <core::int, core::int>{};
+ #t3.{core::Map::[]=}(1, 1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(2, 2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(3, 3);
+ else
+ #t3.{core::Map::[]=}(1.{core::int::unary-}(), 1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(4, 4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t3.{core::Map::[]=}(i, i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(i, i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t3.{core::Map::[]=}(i, i);
+ } =>#t3;
+ core::print(aList);
+ core::print(aSet);
+ core::print(aMap);
+}
+static method oracle() → dynamic
+ return true;
diff --git a/front_end/testcases/control_flow_collection.dart.strong.transformed.expect b/front_end/testcases/control_flow_collection.dart.strong.transformed.expect
new file mode 100644
index 0000000..8c19425
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.strong.transformed.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+static method main() → dynamic {
+ final core::List<core::int> aList = block {
+ final core::List<core::int> #t1 = <core::int>[];
+ #t1.{core::List::add}(1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(3);
+ else
+ #t1.{core::List::add}(1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t1.{core::List::add}(i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t1.{core::List::add}(i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t1.{core::List::add}(i);
+ } =>#t1;
+ final core::Set<core::int> aSet = block {
+ final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>();
+ #t2.{core::Set::add}(1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(3);
+ else
+ #t2.{core::Set::add}(1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t2.{core::Set::add}(i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t2.{core::Set::add}(i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t2.{core::Set::add}(i);
+ } =>#t2;
+ final core::Map<core::int, core::int> aMap = block {
+ final core::Map<core::int, core::int> #t3 = <core::int, core::int>{};
+ #t3.{core::Map::[]=}(1, 1);
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(2, 2);
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(3, 3);
+ else
+ #t3.{core::Map::[]=}(1.{core::int::unary-}(), 1.{core::int::unary-}());
+ if(self::oracle() as{TypeError} core::bool)
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(4, 4);
+ for (core::int i in <core::int>[5, 6, 7])
+ #t3.{core::Map::[]=}(i, i);
+ for (core::int i in <core::int>[8, 9, 10])
+ if(self::oracle() as{TypeError} core::bool)
+ #t3.{core::Map::[]=}(i, i);
+ for (core::int i = 11; i.{core::num::<=}(14); i = i.{core::num::+}(1))
+ #t3.{core::Map::[]=}(i, i);
+ } =>#t3;
+ core::print(aList);
+ core::print(aSet);
+ core::print(aMap);
+}
+static method oracle() → dynamic
+ return true;
diff --git a/front_end/testcases/control_flow_collection.dart.type_promotion.expect b/front_end/testcases/control_flow_collection.dart.type_promotion.expect
new file mode 100644
index 0000000..5476097
--- /dev/null
+++ b/front_end/testcases/control_flow_collection.dart.type_promotion.expect
@@ -0,0 +1,9 @@
+pkg/front_end/testcases/control_flow_collection.dart:13:33: Context: Write to i@364
+ for (int i = 11; i <= 14; ++i) i,
+ ^^
+pkg/front_end/testcases/control_flow_collection.dart:22:33: Context: Write to i@364
+ for (int i = 11; i <= 14; ++i) i,
+ ^^
+pkg/front_end/testcases/control_flow_collection.dart:31:33: Context: Write to i@364
+ for (int i = 11; i <= 14; ++i) i: i,
+ ^^
diff --git a/front_end/testcases/control_flow_collection_inference.dart b/front_end/testcases/control_flow_collection_inference.dart
new file mode 100644
index 0000000..4a64f6a
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart
@@ -0,0 +1,272 @@
+// Copyright (c) 2019, 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.
+
+// Oracle is generic to test the inference in conditions of if-elements.
+oracle<T>([T t]) => true;
+
+testIfElement(dynamic dynVar, List<int> listInt, List<double> listDouble,
+ Map<String, int> mapToInt, Map<String, double> mapToDouble) {
+ var list10 = [if (oracle("foo")) 42];
+ var set10 = {if (oracle("foo")) 42, null};
+ var map10 = {if (oracle("foo")) "bar": 42, "baz": null};
+ var list11 = [if (oracle("foo")) dynVar];
+ var set11 = {if (oracle("foo")) dynVar, null};
+ var map11 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+ var list12 = [if (oracle("foo")) [42]];
+ var set12 = {if (oracle("foo")) [42], null};
+ var map12 = {if (oracle("foo")) "bar": [42], "baz": null};
+ var list20 = [if (oracle("foo")) ...[42]];
+ var set20 = {if (oracle("foo")) ...[42], null};
+ var map20 = {if (oracle("foo")) ...{"bar": 42}, "baz": null};
+ var list21 = [if (oracle("foo")) ...[dynVar]];
+ var set21 = {if (oracle("foo")) ...[dynVar], null};
+ var map21 = {if (oracle("foo")) ...{"bar": dynVar}, "baz": null};
+ var list22 = [if (oracle("foo")) ...[[42]]];
+ var set22 = {if (oracle("foo")) ...[[42]], null};
+ var map22 = {if (oracle("foo")) ...{"bar": [42]}, "baz": null};
+ var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+ var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+ var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+ var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+ var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+ var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+ var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+ var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+ var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+ List<List<int>> list40 = [if (oracle("foo")) ...[[]]];
+ Set<List<int>> set40 = {if (oracle("foo")) ...[[]], null};
+ Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+ List<List<int>> list41 = [if (oracle("foo")) ...{[]}];
+ Set<List<int>> set41 = {if (oracle("foo")) ...{[]}, null};
+ List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+ Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+ Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+ List<int> list50 = [if (oracle("foo")) ...[]];
+ Set<int> set50 = {if (oracle("foo")) ...[], null};
+ Map<String, int> map50 = {if (oracle("foo")) ...{}, "baz": null};
+ List<int> list51 = [if (oracle("foo")) ...{}];
+ Set<int> set51 = {if (oracle("foo")) ...{}, null};
+ List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+ Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+ Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+ List<List<int>> list60 = [if (oracle("foo")) ...[[]]];
+ Set<List<int>> set60 = {if (oracle("foo")) ...[[]], null};
+ Map<String, List<int>> map60 = {if (oracle("foo")) ...{"bar": []}, "baz": null};
+ List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+ Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+ Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+ List<List<int>> list70 = [if (oracle("foo")) []];
+ Set<List<int>> set70 = {if (oracle("foo")) [], null};
+ List<List<int>> list71 = [if (oracle("foo")) if (oracle()) []];
+ Set<List<int>> set71 = {if (oracle("foo")) if (oracle()) [], null};
+ var list80 = [if (oracle("foo")) 42 else 3.14];
+ var set80 = {if (oracle("foo")) 42 else 3.14, null};
+ var map80 = {if (oracle("foo")) "bar": 42 else "bar": 3.14, "baz": null};
+ var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+ var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+ var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+ var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+ var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+ var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+ var list83 = [if (oracle("foo")) 42 else ...listDouble];
+ var set83 = {if (oracle("foo")) ...listInt else 3.14, null};
+ var map83 = {if (oracle("foo")) ...mapToInt else "bar": 3.14, "baz": null};
+ List<int> list90 = [if (oracle("foo")) dynVar];
+ Set<int> set90 = {if (oracle("foo")) dynVar, null};
+ Map<String, int> map90 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+ List<int> list91 = [if (oracle("foo")) ...dynVar];
+ Set<int> set91 = {if (oracle("foo")) ...dynVar, null};
+ Map<String, int> map91 = {if (oracle("foo")) ...dynVar, "baz": null};
+ List<int> list100 = [if (dynVar) 42];
+ Set<int> set100 = {if (dynVar) 42};
+ Map<int, int> map100 = {if (dynVar) 42: 42};
+}
+
+testIfElementErrors(Map<int, int> map) {
+ <int>[if (oracle("foo")) "bar"];
+ <int>{if (oracle("foo")) "bar", null};
+ <String, int>{if (oracle("foo")) "bar": "bar", "baz": null};
+ <int>[if (oracle("foo")) ...["bar"]];
+ <int>{if (oracle("foo")) ...["bar"], null};
+ <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+ <int>[if (oracle("foo")) ...map];
+ <int>{if (oracle("foo")) ...map, null};
+ <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+ <String>[if (oracle("foo")) 42 else 3.14];
+ <String>{if (oracle("foo")) 42 else 3.14, null};
+ <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+ <int>[if (oracle("foo")) ...map else 42];
+ <int>{if (oracle("foo")) ...map else 42, null};
+ <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+ <int>[if (oracle("foo")) 42 else ...map];
+ <int>{if (oracle("foo")) ...map else 42, null};
+ <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+
+ Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+ Map<dynamic, dynamic> map10 = {if (oracle("foo")) 42 else "bar": 3.14};
+ Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+ Map<dynamic, dynamic> map11 = {if (oracle("foo")) "bar": 3.14 else 42};
+ var map12 = {if (oracle("foo")) 42 else "bar": 3.14};
+ var map13 = {if (oracle("foo")) "bar": 3.14 else 42};
+ List<int> list20 = [if (42) 42];
+ Set<int> set20 = {if (42) 42};
+ Map<int, int> map30 = {if (42) 42: 42};
+ List<String> list40 = <String>[if (oracle("foo")) true else 42];
+ Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+ Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+ Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+}
+
+testForElement(dynamic dynVar, List<int> listInt, List<double> listDouble, int
+ index, Map<String, int> mapStringInt, Map<String, double> mapStringDouble) {
+ var list10 = [for (int i = 0; oracle("foo"); i++) 42];
+ var set10 = {for (int i = 0; oracle("foo"); i++) 42, null};
+ var map10 = {for (int i = 0; oracle("foo"); i++) "bar": 42, "baz": null};
+ var list11 = [for (int i = 0; oracle("foo"); i++) dynVar];
+ var set11 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+ var map11 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+ var list12 = [for (int i = 0; oracle("foo"); i++) [42]];
+ var set12 = {for (int i = 0; oracle("foo"); i++) [42], null};
+ var map12 = {for (int i = 0; oracle("foo"); i++) "bar": [42], "baz": null};
+ var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+ var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+ var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+ var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+ var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+ var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+ var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+ var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+ var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+ var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+ var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+ var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+ var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+ var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+ var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+ var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+ var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+ var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+ List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+ Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+ Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+ List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+ Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+ List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+ Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+ Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+ List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+ Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+ Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+ List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+ Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+ List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+ Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+ List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+ Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+ Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+ List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+ Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+ Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+ List<List<int>> list70 = [for (int i = 0; oracle("foo"); i++) []];
+ Set<List<int>> set70 = {for (int i = 0; oracle("foo"); i++) [], null};
+ Map<String, List<int>> map70 = {for (int i = 0; oracle("foo"); i++) "bar": [], "baz": null};
+ List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+ Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+ Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+ var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+ var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+ var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+ var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+ var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+ var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+ var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+ var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+ var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+ var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+ var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+ var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+ List<int> list90 = [for (int i = 0; oracle("foo"); i++) dynVar];
+ Set<int> set90 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+ Map<String, int> map90 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+ List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+ Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+ Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+ List<int> list100 = <int>[for (index = 0; oracle("foo"); index++) 42];
+ Set<int> set100 = <int>{for (index = 0; oracle("foo"); index++) 42};
+ Map<String, int> map100 = <String, int>{for (index = 0; oracle("foo"); index++) "bar": 42};
+ var list110 = [for (var i in [1, 2, 3]) i];
+ var set110 = {for (var i in [1, 2, 3]) i, null};
+ var map110 = {for (var i in [1, 2, 3]) "bar": i, "baz": null};
+ List<int> list120 = [for (var i in dynVar) i];
+ Set<int> set120 = {for (var i in dynVar) i, null};
+ Map<String, int> map120 = {for (var i in dynVar) "bar": i, "baz": null};
+ List<int> list130 = [for (var i = 1; i < 2; i++) i];
+ Set<int> set130 = {for (var i = 1; i < 2; i++) i};
+ Map<int, int> map130 = {for (var i = 1; i < 2; i++) i: i};
+}
+
+testForElementErrors(Map<int, int> map, List<int> list) async {
+ <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+ <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+ <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+ <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+ <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+ <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+ <int>[for (int i = 0; oracle("foo"); i++) ...map];
+ <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+ <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+ <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+ <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+ <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+ <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+ <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+ <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+ <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+ <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+ <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+
+ final i = 0;
+ <int>[for (i in <int>[1]) i];
+ <int>{for (i in <int>[1]) i, null};
+ <String, int>{for (i in <int>[1]) "bar": i, "baz": null};
+
+ var list10 = [for (var i in "not iterable") i];
+ var set10 = {for (var i in "not iterable") i, null};
+ var map10 = {for (var i in "not iterable") "bar": i, "baz": null};
+ var list20 = [for (int i in ["not", "int"]) i];
+ var set20 = {for (int i in ["not", "int"]) i, null};
+ var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+ var list30 = [await for (var i in "not stream") i];
+ var set30 = {await for (var i in "not stream") i, null};
+ var map30 = {await for (var i in "not stream") "bar": i, "baz": null};
+ var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+ var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+ var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+ var list50 = [await for (;;) 42];
+ var set50 = {await for (;;) 42, null};
+ var map50 = {await for (;;) "bar": 42, "baz": null};
+ var list60 = [for (; "not bool";) 42];
+ var set60 = {for (; "not bool";) 42, null};
+ var map60 = {for (; "not bool";) "bar": 42, "baz": null};
+}
+
+testForElementErrorsNotAsync(Stream<int> stream) {
+ <int>[await for (int i in stream) i];
+ <int>{await for (int i in stream) i};
+ <String, int>{await for (int i in stream) "bar": i};
+}
+
+class A {}
+
+class B extends A {
+ int get foo => 42;
+}
+
+testPromotion(A a) {
+ List<int> list10 = [if (a is B) a.foo];
+ Set<int> set10 = {if (a is B) a.foo};
+ Map<int, int> map10 = {if (a is B) a.foo: a.foo};
+}
+
+main() {}
diff --git a/front_end/testcases/control_flow_collection_inference.dart.hierarchy.expect b/front_end/testcases/control_flow_collection_inference.dart.hierarchy.expect
new file mode 100644
index 0000000..3a1da21
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.hierarchy.expect
@@ -0,0 +1,55 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+A:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+B:
+ superclasses:
+ Object
+ -> A
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ B.foo
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
diff --git a/front_end/testcases/control_flow_collection_inference.dart.legacy.expect b/front_end/testcases/control_flow_collection_inference.dart.legacy.expect
new file mode 100644
index 0000000..ffd86f8
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.legacy.expect
@@ -0,0 +1,2036 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:10:17: Error: Unexpected token 'if'.
+// var list10 = [if (oracle("foo")) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:11:16: Error: Unexpected token 'if'.
+// var set10 = {if (oracle("foo")) 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:12:16: Error: Unexpected token 'if'.
+// var map10 = {if (oracle("foo")) "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:13:17: Error: Unexpected token 'if'.
+// var list11 = [if (oracle("foo")) dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:14:16: Error: Unexpected token 'if'.
+// var set11 = {if (oracle("foo")) dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:15:16: Error: Unexpected token 'if'.
+// var map11 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:16:17: Error: Unexpected token 'if'.
+// var list12 = [if (oracle("foo")) [42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:17:16: Error: Unexpected token 'if'.
+// var set12 = {if (oracle("foo")) [42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:18:16: Error: Unexpected token 'if'.
+// var map12 = {if (oracle("foo")) "bar": [42], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:19:36: Error: Unexpected token '...'.
+// var list20 = [if (oracle("foo")) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:19:17: Error: Unexpected token 'if'.
+// var list20 = [if (oracle("foo")) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:20:35: Error: Unexpected token '...'.
+// var set20 = {if (oracle("foo")) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:20:16: Error: Unexpected token 'if'.
+// var set20 = {if (oracle("foo")) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:21:35: Error: Unexpected token '...'.
+// var map20 = {if (oracle("foo")) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:21:16: Error: Unexpected token 'if'.
+// var map20 = {if (oracle("foo")) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:22:36: Error: Unexpected token '...'.
+// var list21 = [if (oracle("foo")) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:22:17: Error: Unexpected token 'if'.
+// var list21 = [if (oracle("foo")) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:23:35: Error: Unexpected token '...'.
+// var set21 = {if (oracle("foo")) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:23:16: Error: Unexpected token 'if'.
+// var set21 = {if (oracle("foo")) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:24:35: Error: Unexpected token '...'.
+// var map21 = {if (oracle("foo")) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:24:16: Error: Unexpected token 'if'.
+// var map21 = {if (oracle("foo")) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:25:36: Error: Unexpected token '...'.
+// var list22 = [if (oracle("foo")) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:25:17: Error: Unexpected token 'if'.
+// var list22 = [if (oracle("foo")) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:26:35: Error: Unexpected token '...'.
+// var set22 = {if (oracle("foo")) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:26:16: Error: Unexpected token 'if'.
+// var set22 = {if (oracle("foo")) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:27:35: Error: Unexpected token '...'.
+// var map22 = {if (oracle("foo")) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:27:16: Error: Unexpected token 'if'.
+// var map22 = {if (oracle("foo")) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:50: Error: Unexpected token '...'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:36: Error: Unexpected token 'if'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:17: Error: Unexpected token 'if'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:49: Error: Unexpected token '...'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:35: Error: Unexpected token 'if'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:16: Error: Unexpected token 'if'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:49: Error: Unexpected token '...'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:35: Error: Unexpected token 'if'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:16: Error: Unexpected token 'if'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:50: Error: Unexpected token '...'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:36: Error: Unexpected token 'if'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:17: Error: Unexpected token 'if'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:49: Error: Unexpected token '...'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:35: Error: Unexpected token 'if'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:16: Error: Unexpected token 'if'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:49: Error: Unexpected token '...'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:35: Error: Unexpected token 'if'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:16: Error: Unexpected token 'if'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:50: Error: Unexpected token '...'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:36: Error: Unexpected token 'if'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:17: Error: Unexpected token 'if'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:49: Error: Unexpected token '...'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:35: Error: Unexpected token 'if'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:16: Error: Unexpected token 'if'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:49: Error: Unexpected token '...'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:35: Error: Unexpected token 'if'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:16: Error: Unexpected token 'if'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:37:48: Error: Unexpected token '...'.
+// List<List<int>> list40 = [if (oracle("foo")) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:37:29: Error: Unexpected token 'if'.
+// List<List<int>> list40 = [if (oracle("foo")) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:38:46: Error: Unexpected token '...'.
+// Set<List<int>> set40 = {if (oracle("foo")) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:38:27: Error: Unexpected token 'if'.
+// Set<List<int>> set40 = {if (oracle("foo")) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:54: Error: Unexpected token '...'.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:40:48: Error: Unexpected token '...'.
+// List<List<int>> list41 = [if (oracle("foo")) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:40:29: Error: Unexpected token 'if'.
+// List<List<int>> list41 = [if (oracle("foo")) ...{[]}];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:41:46: Error: Unexpected token '...'.
+// Set<List<int>> set41 = {if (oracle("foo")) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:41:27: Error: Unexpected token 'if'.
+// Set<List<int>> set41 = {if (oracle("foo")) ...{[]}, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:62: Error: Unexpected token '...'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:48: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:29: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:60: Error: Unexpected token '...'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:46: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:27: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:68: Error: Unexpected token '...'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:54: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:45:42: Error: Unexpected token '...'.
+// List<int> list50 = [if (oracle("foo")) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:45:23: Error: Unexpected token 'if'.
+// List<int> list50 = [if (oracle("foo")) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:46:40: Error: Unexpected token '...'.
+// Set<int> set50 = {if (oracle("foo")) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:46:21: Error: Unexpected token 'if'.
+// Set<int> set50 = {if (oracle("foo")) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:47:48: Error: Unexpected token '...'.
+// Map<String, int> map50 = {if (oracle("foo")) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:47:29: Error: Unexpected token 'if'.
+// Map<String, int> map50 = {if (oracle("foo")) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:48:42: Error: Unexpected token '...'.
+// List<int> list51 = [if (oracle("foo")) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:48:23: Error: Unexpected token 'if'.
+// List<int> list51 = [if (oracle("foo")) ...{}];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:49:40: Error: Unexpected token '...'.
+// Set<int> set51 = {if (oracle("foo")) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:49:21: Error: Unexpected token 'if'.
+// Set<int> set51 = {if (oracle("foo")) ...{}, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:56: Error: Unexpected token '...'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:42: Error: Unexpected token 'if'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:23: Error: Unexpected token 'if'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:54: Error: Unexpected token '...'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:40: Error: Unexpected token 'if'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:21: Error: Unexpected token 'if'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:62: Error: Unexpected token '...'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:48: Error: Unexpected token 'if'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:29: Error: Unexpected token 'if'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:53:48: Error: Unexpected token '...'.
+// List<List<int>> list60 = [if (oracle("foo")) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:53:29: Error: Unexpected token 'if'.
+// List<List<int>> list60 = [if (oracle("foo")) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:54:46: Error: Unexpected token '...'.
+// Set<List<int>> set60 = {if (oracle("foo")) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:54:27: Error: Unexpected token 'if'.
+// Set<List<int>> set60 = {if (oracle("foo")) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:55:54: Error: Unexpected token '...'.
+// Map<String, List<int>> map60 = {if (oracle("foo")) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:55:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map60 = {if (oracle("foo")) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:62: Error: Unexpected token '...'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:48: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:29: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:60: Error: Unexpected token '...'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:46: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:27: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:68: Error: Unexpected token '...'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:54: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:59:29: Error: Unexpected token 'if'.
+// List<List<int>> list70 = [if (oracle("foo")) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:60:27: Error: Unexpected token 'if'.
+// Set<List<int>> set70 = {if (oracle("foo")) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:61:48: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [if (oracle("foo")) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:61:29: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [if (oracle("foo")) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:62:46: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {if (oracle("foo")) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:62:27: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {if (oracle("foo")) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:63:17: Error: Unexpected token 'if'.
+// var list80 = [if (oracle("foo")) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:64:16: Error: Unexpected token 'if'.
+// var set80 = {if (oracle("foo")) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:65:16: Error: Unexpected token 'if'.
+// var map80 = {if (oracle("foo")) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:36: Error: Unexpected token '...'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:52: Error: Unexpected token '...'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:17: Error: Unexpected token 'if'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:35: Error: Unexpected token '...'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:51: Error: Unexpected token '...'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:16: Error: Unexpected token 'if'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:35: Error: Unexpected token '...'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:52: Error: Unexpected token '...'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:16: Error: Unexpected token 'if'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:36: Error: Unexpected token '...'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:52: Error: Unexpected token '...'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:17: Error: Unexpected token 'if'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:35: Error: Unexpected token '...'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:51: Error: Unexpected token '...'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:16: Error: Unexpected token 'if'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:35: Error: Unexpected token '...'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:52: Error: Unexpected token '...'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:16: Error: Unexpected token 'if'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:72:44: Error: Unexpected token '...'.
+// var list83 = [if (oracle("foo")) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:72:17: Error: Unexpected token 'if'.
+// var list83 = [if (oracle("foo")) 42 else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:73:35: Error: Unexpected token '...'.
+// var set83 = {if (oracle("foo")) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:73:16: Error: Unexpected token 'if'.
+// var set83 = {if (oracle("foo")) ...listInt else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:74:35: Error: Unexpected token '...'.
+// var map83 = {if (oracle("foo")) ...mapToInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:74:16: Error: Unexpected token 'if'.
+// var map83 = {if (oracle("foo")) ...mapToInt else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:75:23: Error: Unexpected token 'if'.
+// List<int> list90 = [if (oracle("foo")) dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:76:21: Error: Unexpected token 'if'.
+// Set<int> set90 = {if (oracle("foo")) dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:77:29: Error: Unexpected token 'if'.
+// Map<String, int> map90 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:78:42: Error: Unexpected token '...'.
+// List<int> list91 = [if (oracle("foo")) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:78:23: Error: Unexpected token 'if'.
+// List<int> list91 = [if (oracle("foo")) ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:79:40: Error: Unexpected token '...'.
+// Set<int> set91 = {if (oracle("foo")) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:79:21: Error: Unexpected token 'if'.
+// Set<int> set91 = {if (oracle("foo")) ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:80:48: Error: Unexpected token '...'.
+// Map<String, int> map91 = {if (oracle("foo")) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:80:29: Error: Unexpected token 'if'.
+// Map<String, int> map91 = {if (oracle("foo")) ...dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:81:24: Error: Unexpected token 'if'.
+// List<int> list100 = [if (dynVar) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:82:22: Error: Unexpected token 'if'.
+// Set<int> set100 = {if (dynVar) 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:83:27: Error: Unexpected token 'if'.
+// Map<int, int> map100 = {if (dynVar) 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:87:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) "bar"];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:88:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) "bar", null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:89:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) "bar": "bar", "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:12: Error: Unexpected token 'if'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:12: Error: Unexpected token 'if'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:20: Error: Unexpected token 'if'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:36: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:51: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:25: Error: Unexpected token 'if'.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:107:34: Error: Unexpected token 'if'.
+// Map<dynamic, dynamic> map10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:25: Error: Unexpected token 'if'.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:109:34: Error: Unexpected token 'if'.
+// Map<dynamic, dynamic> map11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:110:16: Error: Unexpected token 'if'.
+// var map12 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:111:16: Error: Unexpected token 'if'.
+// var map13 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:112:23: Error: Unexpected token 'if'.
+// List<int> list20 = [if (42) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:113:21: Error: Unexpected token 'if'.
+// Set<int> set20 = {if (42) 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:114:26: Error: Unexpected token 'if'.
+// Map<int, int> map30 = {if (42) 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:34: Error: Unexpected token 'if'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:32: Error: Unexpected token 'if'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:42: Error: Unexpected token 'if'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:42: Error: Unexpected token 'if'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:123:17: Error: Unexpected token 'for'.
+// var list10 = [for (int i = 0; oracle("foo"); i++) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:124:16: Error: Unexpected token 'for'.
+// var set10 = {for (int i = 0; oracle("foo"); i++) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:125:16: Error: Unexpected token 'for'.
+// var map10 = {for (int i = 0; oracle("foo"); i++) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:126:17: Error: Unexpected token 'for'.
+// var list11 = [for (int i = 0; oracle("foo"); i++) dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:127:16: Error: Unexpected token 'for'.
+// var set11 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:128:16: Error: Unexpected token 'for'.
+// var map11 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:129:17: Error: Unexpected token 'for'.
+// var list12 = [for (int i = 0; oracle("foo"); i++) [42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:130:16: Error: Unexpected token 'for'.
+// var set12 = {for (int i = 0; oracle("foo"); i++) [42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:131:16: Error: Unexpected token 'for'.
+// var map12 = {for (int i = 0; oracle("foo"); i++) "bar": [42], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:132:53: Error: Unexpected token '...'.
+// var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:132:17: Error: Unexpected token 'for'.
+// var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:133:52: Error: Unexpected token '...'.
+// var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:133:16: Error: Unexpected token 'for'.
+// var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:134:52: Error: Unexpected token '...'.
+// var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:134:16: Error: Unexpected token 'for'.
+// var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:135:53: Error: Unexpected token '...'.
+// var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:135:17: Error: Unexpected token 'for'.
+// var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:136:52: Error: Unexpected token '...'.
+// var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:136:16: Error: Unexpected token 'for'.
+// var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:137:52: Error: Unexpected token '...'.
+// var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:137:16: Error: Unexpected token 'for'.
+// var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:138:53: Error: Unexpected token '...'.
+// var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:138:17: Error: Unexpected token 'for'.
+// var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:139:52: Error: Unexpected token '...'.
+// var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:139:16: Error: Unexpected token 'for'.
+// var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:140:52: Error: Unexpected token '...'.
+// var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:140:16: Error: Unexpected token 'for'.
+// var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:67: Error: Unexpected token '...'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:53: Error: Unexpected token 'if'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:17: Error: Unexpected token 'for'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:66: Error: Unexpected token '...'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:52: Error: Unexpected token 'if'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:16: Error: Unexpected token 'for'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:66: Error: Unexpected token '...'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:52: Error: Unexpected token 'if'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:16: Error: Unexpected token 'for'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:67: Error: Unexpected token '...'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:53: Error: Unexpected token 'if'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:17: Error: Unexpected token 'for'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:66: Error: Unexpected token '...'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:52: Error: Unexpected token 'if'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:16: Error: Unexpected token 'for'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:66: Error: Unexpected token '...'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:52: Error: Unexpected token 'if'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:16: Error: Unexpected token 'for'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:67: Error: Unexpected token '...'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:53: Error: Unexpected token 'if'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:17: Error: Unexpected token 'for'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:66: Error: Unexpected token '...'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:52: Error: Unexpected token 'if'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:16: Error: Unexpected token 'for'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:66: Error: Unexpected token '...'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:52: Error: Unexpected token 'if'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:16: Error: Unexpected token 'for'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:150:65: Error: Unexpected token '...'.
+// List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:150:29: Error: Unexpected token 'for'.
+// List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:151:63: Error: Unexpected token '...'.
+// Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:151:27: Error: Unexpected token 'for'.
+// Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:152:71: Error: Unexpected token '...'.
+// Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:152:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:153:65: Error: Unexpected token '...'.
+// List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:153:29: Error: Unexpected token 'for'.
+// List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:154:63: Error: Unexpected token '...'.
+// Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:154:27: Error: Unexpected token 'for'.
+// Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:79: Error: Unexpected token '...'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:65: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:29: Error: Unexpected token 'for'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:77: Error: Unexpected token '...'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:63: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:27: Error: Unexpected token 'for'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:85: Error: Unexpected token '...'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:158:59: Error: Unexpected token '...'.
+// List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:158:23: Error: Unexpected token 'for'.
+// List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:159:57: Error: Unexpected token '...'.
+// Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:159:21: Error: Unexpected token 'for'.
+// Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:160:65: Error: Unexpected token '...'.
+// Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:160:29: Error: Unexpected token 'for'.
+// Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:161:59: Error: Unexpected token '...'.
+// List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:161:23: Error: Unexpected token 'for'.
+// List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:162:57: Error: Unexpected token '...'.
+// Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:162:21: Error: Unexpected token 'for'.
+// Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:73: Error: Unexpected token '...'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:59: Error: Unexpected token 'if'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:23: Error: Unexpected token 'for'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:71: Error: Unexpected token '...'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:57: Error: Unexpected token 'if'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:21: Error: Unexpected token 'for'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:165:65: Error: Unexpected token '...'.
+// List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:165:29: Error: Unexpected token 'for'.
+// List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:166:63: Error: Unexpected token '...'.
+// Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:166:27: Error: Unexpected token 'for'.
+// Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:167:71: Error: Unexpected token '...'.
+// Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:167:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:79: Error: Unexpected token '...'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:65: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:29: Error: Unexpected token 'for'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:77: Error: Unexpected token '...'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:63: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:27: Error: Unexpected token 'for'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:85: Error: Unexpected token '...'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:171:29: Error: Unexpected token 'for'.
+// List<List<int>> list70 = [for (int i = 0; oracle("foo"); i++) []];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:172:27: Error: Unexpected token 'for'.
+// Set<List<int>> set70 = {for (int i = 0; oracle("foo"); i++) [], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:173:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map70 = {for (int i = 0; oracle("foo"); i++) "bar": [], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:174:65: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:174:29: Error: Unexpected token 'for'.
+// List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:175:63: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:175:27: Error: Unexpected token 'for'.
+// Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:176:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:176:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:177:53: Error: Unexpected token 'if'.
+// var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:177:17: Error: Unexpected token 'for'.
+// var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:178:52: Error: Unexpected token 'if'.
+// var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:178:16: Error: Unexpected token 'for'.
+// var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:179:52: Error: Unexpected token 'if'.
+// var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:179:16: Error: Unexpected token 'for'.
+// var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:67: Error: Unexpected token '...'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:83: Error: Unexpected token '...'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:53: Error: Unexpected token 'if'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:17: Error: Unexpected token 'for'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:66: Error: Unexpected token '...'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:82: Error: Unexpected token '...'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:52: Error: Unexpected token 'if'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:16: Error: Unexpected token 'for'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:66: Error: Unexpected token '...'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:87: Error: Unexpected token '...'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:52: Error: Unexpected token 'if'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:16: Error: Unexpected token 'for'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:67: Error: Unexpected token '...'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:83: Error: Unexpected token '...'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:53: Error: Unexpected token 'if'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:17: Error: Unexpected token 'for'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:66: Error: Unexpected token '...'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:82: Error: Unexpected token '...'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:52: Error: Unexpected token 'if'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:16: Error: Unexpected token 'for'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:66: Error: Unexpected token '...'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:87: Error: Unexpected token '...'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:52: Error: Unexpected token 'if'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:16: Error: Unexpected token 'for'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:75: Error: Unexpected token '...'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:53: Error: Unexpected token 'if'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:17: Error: Unexpected token 'for'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:66: Error: Unexpected token '...'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:52: Error: Unexpected token 'if'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:16: Error: Unexpected token 'for'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:66: Error: Unexpected token '...'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:52: Error: Unexpected token 'if'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:16: Error: Unexpected token 'for'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:189:23: Error: Unexpected token 'for'.
+// List<int> list90 = [for (int i = 0; oracle("foo"); i++) dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:190:21: Error: Unexpected token 'for'.
+// Set<int> set90 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:191:29: Error: Unexpected token 'for'.
+// Map<String, int> map90 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:192:59: Error: Unexpected token '...'.
+// List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:192:23: Error: Unexpected token 'for'.
+// List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:193:57: Error: Unexpected token '...'.
+// Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:193:21: Error: Unexpected token 'for'.
+// Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:194:65: Error: Unexpected token '...'.
+// Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:194:29: Error: Unexpected token 'for'.
+// Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:195:29: Error: Unexpected token 'for'.
+// List<int> list100 = <int>[for (index = 0; oracle("foo"); index++) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:196:27: Error: Unexpected token 'for'.
+// Set<int> set100 = <int>{for (index = 0; oracle("foo"); index++) 42};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:197:43: Error: Unexpected token 'for'.
+// Map<String, int> map100 = <String, int>{for (index = 0; oracle("foo"); index++) "bar": 42};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:198:18: Error: Unexpected token 'for'.
+// var list110 = [for (var i in [1, 2, 3]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:199:17: Error: Unexpected token 'for'.
+// var set110 = {for (var i in [1, 2, 3]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:200:17: Error: Unexpected token 'for'.
+// var map110 = {for (var i in [1, 2, 3]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:201:24: Error: Unexpected token 'for'.
+// List<int> list120 = [for (var i in dynVar) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:202:22: Error: Unexpected token 'for'.
+// Set<int> set120 = {for (var i in dynVar) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:203:30: Error: Unexpected token 'for'.
+// Map<String, int> map120 = {for (var i in dynVar) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:204:24: Error: Unexpected token 'for'.
+// List<int> list130 = [for (var i = 1; i < 2; i++) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:205:22: Error: Unexpected token 'for'.
+// Set<int> set130 = {for (var i = 1; i < 2; i++) i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:206:27: Error: Unexpected token 'for'.
+// Map<int, int> map130 = {for (var i = 1; i < 2; i++) i: i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:210:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:211:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:45: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:45: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:50: Error: Unexpected token '...'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:45: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:45: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:50: Error: Unexpected token '...'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:48: Error: Unexpected token 'if'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:12: Error: Unexpected token 'for'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:48: Error: Unexpected token 'if'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:12: Error: Unexpected token 'for'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:56: Error: Unexpected token 'if'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:20: Error: Unexpected token 'for'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:59: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:45: Error: Unexpected token 'if'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:59: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:45: Error: Unexpected token 'if'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:67: Error: Unexpected token '...'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:53: Error: Unexpected token 'if'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:17: Error: Unexpected token 'for'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:67: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:45: Error: Unexpected token 'if'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:67: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:45: Error: Unexpected token 'if'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:82: Error: Unexpected token '...'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:53: Error: Unexpected token 'if'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:17: Error: Unexpected token 'for'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:230:9: Error: Unexpected token 'for'.
+// <int>[for (i in <int>[1]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:231:9: Error: Unexpected token 'for'.
+// <int>{for (i in <int>[1]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:232:16: Error: Unexpected token 'for'.
+// <String, int>{for (i in <int>[1]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:234:17: Error: Unexpected token 'for'.
+// var list10 = [for (var i in "not iterable") i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:235:16: Error: Unexpected token 'for'.
+// var set10 = {for (var i in "not iterable") i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:236:16: Error: Unexpected token 'for'.
+// var map10 = {for (var i in "not iterable") "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:17: Error: Unexpected token 'for'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:16: Error: Unexpected token 'for'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:16: Error: Unexpected token 'for'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:240:23: Error: Unexpected token 'for'.
+// var list30 = [await for (var i in "not stream") i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:241:22: Error: Unexpected token 'for'.
+// var set30 = {await for (var i in "not stream") i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:242:22: Error: Unexpected token 'for'.
+// var map30 = {await for (var i in "not stream") "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:23: Error: Unexpected token 'for'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:22: Error: Unexpected token 'for'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:22: Error: Unexpected token 'for'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:17: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var list50 = [await for (;;) 42];
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:23: Error: Unexpected token 'for'.
+// var list50 = [await for (;;) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var set50 = {await for (;;) 42, null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:22: Error: Unexpected token 'for'.
+// var set50 = {await for (;;) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:22: Error: Unexpected token 'for'.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:249:17: Error: Unexpected token 'for'.
+// var list60 = [for (; "not bool";) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:250:16: Error: Unexpected token 'for'.
+// var set60 = {for (; "not bool";) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:251:16: Error: Unexpected token 'for'.
+// var map60 = {for (; "not bool";) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>[await for (int i in stream) i];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:15: Error: Unexpected token 'for'.
+// <int>[await for (int i in stream) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>{await for (int i in stream) i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:15: Error: Unexpected token 'for'.
+// <int>{await for (int i in stream) i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:34: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:23: Error: Unexpected token 'for'.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:267:23: Error: Unexpected token 'if'.
+// List<int> list10 = [if (a is B) a.foo];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:268:21: Error: Unexpected token 'if'.
+// Set<int> set10 = {if (a is B) a.foo};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:269:26: Error: Unexpected token 'if'.
+// Map<int, int> map10 = {if (a is B) a.foo: a.foo};
+// ^^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get foo() → core::int
+ return 42;
+}
+static method oracle<T extends core::Object = dynamic>([self::oracle::T t = null]) → dynamic
+ return true;
+static method testIfElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::Map<core::String, core::int> mapToInt, core::Map<core::String, core::double> mapToDouble) → dynamic {
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list11 = <dynamic>[];
+ dynamic set11 = <dynamic>{null};
+ dynamic map11 = <dynamic, dynamic>{"baz": null};
+ dynamic list12 = <dynamic>[];
+ dynamic set12 = <dynamic>{null};
+ dynamic map12 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list21 = <dynamic>[];
+ dynamic set21 = <dynamic>{null};
+ dynamic map21 = <dynamic, dynamic>{"baz": null};
+ dynamic list22 = <dynamic>[];
+ dynamic set22 = <dynamic>{null};
+ dynamic map22 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list31 = <dynamic>[];
+ dynamic set31 = <dynamic>{null};
+ dynamic map31 = <dynamic, dynamic>{"baz": null};
+ dynamic list33 = <dynamic>[];
+ dynamic set33 = <dynamic>{null};
+ dynamic map33 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list40 = <dynamic>[];
+ core::Set<core::List<core::int>> set40 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map40 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list41 = <dynamic>[];
+ core::Set<core::List<core::int>> set41 = <dynamic>{null};
+ core::List<core::List<core::int>> list42 = <dynamic>[];
+ core::Set<core::List<core::int>> set42 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map42 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list50 = <dynamic>[];
+ core::Set<core::int> set50 = <dynamic>{null};
+ core::Map<core::String, core::int> map50 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list51 = <dynamic>[];
+ core::Set<core::int> set51 = <dynamic>{null};
+ core::List<core::int> list52 = <dynamic>[];
+ core::Set<core::int> set52 = <dynamic>{null};
+ core::Map<core::String, core::int> map52 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list60 = <dynamic>[];
+ core::Set<core::List<core::int>> set60 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map60 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list61 = <dynamic>[];
+ core::Set<core::List<core::int>> set61 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map61 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list70 = <dynamic>[];
+ core::Set<core::List<core::int>> set70 = <dynamic>{null};
+ core::List<core::List<core::int>> list71 = <dynamic>[];
+ core::Set<core::List<core::int>> set71 = <dynamic>{null};
+ dynamic list80 = <dynamic>[];
+ dynamic set80 = <dynamic>{null};
+ dynamic map80 = <dynamic, dynamic>{"baz": null};
+ dynamic list81 = <dynamic>[];
+ dynamic set81 = <dynamic>{null};
+ dynamic map81 = <dynamic, dynamic>{"baz": null};
+ dynamic list82 = <dynamic>[];
+ dynamic set82 = <dynamic>{null};
+ dynamic map82 = <dynamic>{null};
+ dynamic list83 = <dynamic>[];
+ dynamic set83 = <dynamic>{null};
+ dynamic map83 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list90 = <dynamic>[];
+ core::Set<core::int> set90 = <dynamic>{null};
+ core::Map<core::String, core::int> map90 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list91 = <dynamic>[];
+ core::Set<core::int> set91 = <dynamic>{null};
+ core::Map<core::String, core::int> map91 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list100 = <dynamic>[];
+ core::Set<core::int> set100 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map100 = <dynamic, dynamic>{};
+}
+static method testIfElementErrors(core::Map<core::int, core::int> map) → dynamic {
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::String>[];
+ <core::String>{null};
+ <core::String, core::String>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ core::Set<dynamic> set10 = <dynamic, dynamic>{};
+ core::Map<dynamic, dynamic> map10 = <dynamic, dynamic>{};
+ core::Set<dynamic> set11 = <dynamic, dynamic>{};
+ core::Map<dynamic, dynamic> map11 = <dynamic, dynamic>{};
+ dynamic map12 = <dynamic, dynamic>{};
+ dynamic map13 = <dynamic, dynamic>{};
+ core::List<core::int> list20 = <dynamic>[];
+ core::Set<core::int> set20 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map30 = <dynamic, dynamic>{};
+ core::List<core::String> list40 = <core::String>[];
+ core::Set<core::String> set40 = <core::String>{};
+ core::Map<core::String, core::int> map40 = <core::String, core::int>{};
+ core::Map<core::int, core::String> map41 = <core::int, core::String>{};
+}
+static method testForElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::int index, core::Map<core::String, core::int> mapStringInt, core::Map<core::String, core::double> mapStringDouble) → dynamic {
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list11 = <dynamic>[];
+ dynamic set11 = <dynamic>{null};
+ dynamic map11 = <dynamic, dynamic>{"baz": null};
+ dynamic list12 = <dynamic>[];
+ dynamic set12 = <dynamic>{null};
+ dynamic map12 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list21 = <dynamic>[];
+ dynamic set21 = <dynamic>{null};
+ dynamic map21 = <dynamic, dynamic>{"baz": null};
+ dynamic list22 = <dynamic>[];
+ dynamic set22 = <dynamic>{null};
+ dynamic map22 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list31 = <dynamic>[];
+ dynamic set31 = <dynamic>{null};
+ dynamic map31 = <dynamic, dynamic>{"baz": null};
+ dynamic list33 = <dynamic>[];
+ dynamic set33 = <dynamic>{null};
+ dynamic map33 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list40 = <dynamic>[];
+ core::Set<core::List<core::int>> set40 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map40 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list41 = <dynamic>[];
+ core::Set<core::List<core::int>> set41 = <dynamic>{null};
+ core::List<core::List<core::int>> list42 = <dynamic>[];
+ core::Set<core::List<core::int>> set42 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map42 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list50 = <dynamic>[];
+ core::Set<core::int> set50 = <dynamic>{null};
+ core::Map<core::String, core::int> map50 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list51 = <dynamic>[];
+ core::Set<core::int> set51 = <dynamic>{null};
+ core::List<core::int> list52 = <dynamic>[];
+ core::Set<core::int> set52 = <dynamic>{null};
+ core::List<core::List<core::int>> list60 = <dynamic>[];
+ core::Set<core::List<core::int>> set60 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map60 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list61 = <dynamic>[];
+ core::Set<core::List<core::int>> set61 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map61 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list70 = <dynamic>[];
+ core::Set<core::List<core::int>> set70 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map70 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list71 = <dynamic>[];
+ core::Set<core::List<core::int>> set71 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map71 = <dynamic, dynamic>{"baz": null};
+ dynamic list80 = <dynamic>[];
+ dynamic set80 = <dynamic>{null};
+ dynamic map80 = <dynamic, dynamic>{"baz": null};
+ dynamic list81 = <dynamic>[];
+ dynamic set81 = <dynamic>{null};
+ dynamic map81 = <dynamic, dynamic>{"baz": null};
+ dynamic list82 = <dynamic>[];
+ dynamic set82 = <dynamic>{null};
+ dynamic map82 = <dynamic, dynamic>{"baz": null};
+ dynamic list83 = <dynamic>[];
+ dynamic set83 = <dynamic>{null};
+ dynamic map83 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list90 = <dynamic>[];
+ core::Set<core::int> set90 = <dynamic>{null};
+ core::Map<core::String, core::int> map90 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list91 = <dynamic>[];
+ core::Set<core::int> set91 = <dynamic>{null};
+ core::Map<core::String, core::int> map91 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list100 = <core::int>[];
+ core::Set<core::int> set100 = <core::int>{};
+ core::Map<core::String, core::int> map100 = <core::String, core::int>{};
+ dynamic list110 = <dynamic>[];
+ dynamic set110 = <dynamic>{null};
+ dynamic map110 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list120 = <dynamic>[];
+ core::Set<core::int> set120 = <dynamic>{null};
+ core::Map<core::String, core::int> map120 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list130 = <dynamic>[];
+ core::Set<core::int> set130 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map130 = <dynamic, dynamic>{};
+}
+static method testForElementErrors(core::Map<core::int, core::int> map, core::List<core::int> list) → dynamic async {
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{42: null};
+ <core::String>[];
+ <core::String>{null};
+ <core::String, core::String>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ final dynamic i = 0;
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list40 = <dynamic>[];
+ dynamic set40 = <dynamic>{null};
+ dynamic map40 = <dynamic, dynamic>{"baz": null};
+ dynamic list50 = <dynamic>[];
+ dynamic set50 = <dynamic>{null};
+ dynamic map50 = <dynamic, dynamic>{"baz": null};
+ dynamic list60 = <dynamic>[];
+ dynamic set60 = <dynamic>{null};
+ dynamic map60 = <dynamic, dynamic>{"baz": null};
+}
+static method testForElementErrorsNotAsync(asy::Stream<core::int> stream) → dynamic {
+ <core::int>[];
+ <core::int>{};
+ <core::String, core::int>{};
+}
+static method testPromotion(self::A a) → dynamic {
+ core::List<core::int> list10 = <dynamic>[];
+ core::Set<core::int> set10 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map10 = <dynamic, dynamic>{};
+}
+static method main() → dynamic {}
diff --git a/front_end/testcases/control_flow_collection_inference.dart.legacy.transformed.expect b/front_end/testcases/control_flow_collection_inference.dart.legacy.transformed.expect
new file mode 100644
index 0000000..d384c49
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.legacy.transformed.expect
@@ -0,0 +1,2059 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:10:17: Error: Unexpected token 'if'.
+// var list10 = [if (oracle("foo")) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:11:16: Error: Unexpected token 'if'.
+// var set10 = {if (oracle("foo")) 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:12:16: Error: Unexpected token 'if'.
+// var map10 = {if (oracle("foo")) "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:13:17: Error: Unexpected token 'if'.
+// var list11 = [if (oracle("foo")) dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:14:16: Error: Unexpected token 'if'.
+// var set11 = {if (oracle("foo")) dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:15:16: Error: Unexpected token 'if'.
+// var map11 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:16:17: Error: Unexpected token 'if'.
+// var list12 = [if (oracle("foo")) [42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:17:16: Error: Unexpected token 'if'.
+// var set12 = {if (oracle("foo")) [42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:18:16: Error: Unexpected token 'if'.
+// var map12 = {if (oracle("foo")) "bar": [42], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:19:36: Error: Unexpected token '...'.
+// var list20 = [if (oracle("foo")) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:19:17: Error: Unexpected token 'if'.
+// var list20 = [if (oracle("foo")) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:20:35: Error: Unexpected token '...'.
+// var set20 = {if (oracle("foo")) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:20:16: Error: Unexpected token 'if'.
+// var set20 = {if (oracle("foo")) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:21:35: Error: Unexpected token '...'.
+// var map20 = {if (oracle("foo")) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:21:16: Error: Unexpected token 'if'.
+// var map20 = {if (oracle("foo")) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:22:36: Error: Unexpected token '...'.
+// var list21 = [if (oracle("foo")) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:22:17: Error: Unexpected token 'if'.
+// var list21 = [if (oracle("foo")) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:23:35: Error: Unexpected token '...'.
+// var set21 = {if (oracle("foo")) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:23:16: Error: Unexpected token 'if'.
+// var set21 = {if (oracle("foo")) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:24:35: Error: Unexpected token '...'.
+// var map21 = {if (oracle("foo")) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:24:16: Error: Unexpected token 'if'.
+// var map21 = {if (oracle("foo")) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:25:36: Error: Unexpected token '...'.
+// var list22 = [if (oracle("foo")) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:25:17: Error: Unexpected token 'if'.
+// var list22 = [if (oracle("foo")) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:26:35: Error: Unexpected token '...'.
+// var set22 = {if (oracle("foo")) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:26:16: Error: Unexpected token 'if'.
+// var set22 = {if (oracle("foo")) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:27:35: Error: Unexpected token '...'.
+// var map22 = {if (oracle("foo")) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:27:16: Error: Unexpected token 'if'.
+// var map22 = {if (oracle("foo")) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:50: Error: Unexpected token '...'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:36: Error: Unexpected token 'if'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:28:17: Error: Unexpected token 'if'.
+// var list30 = [if (oracle("foo")) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:49: Error: Unexpected token '...'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:35: Error: Unexpected token 'if'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:29:16: Error: Unexpected token 'if'.
+// var set30 = {if (oracle("foo")) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:49: Error: Unexpected token '...'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:35: Error: Unexpected token 'if'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:30:16: Error: Unexpected token 'if'.
+// var map30 = {if (oracle("foo")) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:50: Error: Unexpected token '...'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:36: Error: Unexpected token 'if'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:31:17: Error: Unexpected token 'if'.
+// var list31 = [if (oracle("foo")) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:49: Error: Unexpected token '...'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:35: Error: Unexpected token 'if'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:32:16: Error: Unexpected token 'if'.
+// var set31 = {if (oracle("foo")) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:49: Error: Unexpected token '...'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:35: Error: Unexpected token 'if'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:33:16: Error: Unexpected token 'if'.
+// var map31 = {if (oracle("foo")) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:50: Error: Unexpected token '...'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:36: Error: Unexpected token 'if'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:34:17: Error: Unexpected token 'if'.
+// var list33 = [if (oracle("foo")) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:49: Error: Unexpected token '...'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:35: Error: Unexpected token 'if'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:35:16: Error: Unexpected token 'if'.
+// var set33 = {if (oracle("foo")) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:49: Error: Unexpected token '...'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:35: Error: Unexpected token 'if'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:36:16: Error: Unexpected token 'if'.
+// var map33 = {if (oracle("foo")) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:37:48: Error: Unexpected token '...'.
+// List<List<int>> list40 = [if (oracle("foo")) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:37:29: Error: Unexpected token 'if'.
+// List<List<int>> list40 = [if (oracle("foo")) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:38:46: Error: Unexpected token '...'.
+// Set<List<int>> set40 = {if (oracle("foo")) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:38:27: Error: Unexpected token 'if'.
+// Set<List<int>> set40 = {if (oracle("foo")) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:54: Error: Unexpected token '...'.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:40:48: Error: Unexpected token '...'.
+// List<List<int>> list41 = [if (oracle("foo")) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:40:29: Error: Unexpected token 'if'.
+// List<List<int>> list41 = [if (oracle("foo")) ...{[]}];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:41:46: Error: Unexpected token '...'.
+// Set<List<int>> set41 = {if (oracle("foo")) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:41:27: Error: Unexpected token 'if'.
+// Set<List<int>> set41 = {if (oracle("foo")) ...{[]}, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:62: Error: Unexpected token '...'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:48: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:42:29: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:60: Error: Unexpected token '...'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:46: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:43:27: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:68: Error: Unexpected token '...'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:54: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:44:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:45:42: Error: Unexpected token '...'.
+// List<int> list50 = [if (oracle("foo")) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:45:23: Error: Unexpected token 'if'.
+// List<int> list50 = [if (oracle("foo")) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:46:40: Error: Unexpected token '...'.
+// Set<int> set50 = {if (oracle("foo")) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:46:21: Error: Unexpected token 'if'.
+// Set<int> set50 = {if (oracle("foo")) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:47:48: Error: Unexpected token '...'.
+// Map<String, int> map50 = {if (oracle("foo")) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:47:29: Error: Unexpected token 'if'.
+// Map<String, int> map50 = {if (oracle("foo")) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:48:42: Error: Unexpected token '...'.
+// List<int> list51 = [if (oracle("foo")) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:48:23: Error: Unexpected token 'if'.
+// List<int> list51 = [if (oracle("foo")) ...{}];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:49:40: Error: Unexpected token '...'.
+// Set<int> set51 = {if (oracle("foo")) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:49:21: Error: Unexpected token 'if'.
+// Set<int> set51 = {if (oracle("foo")) ...{}, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:56: Error: Unexpected token '...'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:42: Error: Unexpected token 'if'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:50:23: Error: Unexpected token 'if'.
+// List<int> list52 = [if (oracle("foo")) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:54: Error: Unexpected token '...'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:40: Error: Unexpected token 'if'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:51:21: Error: Unexpected token 'if'.
+// Set<int> set52 = {if (oracle("foo")) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:62: Error: Unexpected token '...'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:48: Error: Unexpected token 'if'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:52:29: Error: Unexpected token 'if'.
+// Map<String, int> map52 = {if (oracle("foo")) if (oracle()) ...{}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:53:48: Error: Unexpected token '...'.
+// List<List<int>> list60 = [if (oracle("foo")) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:53:29: Error: Unexpected token 'if'.
+// List<List<int>> list60 = [if (oracle("foo")) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:54:46: Error: Unexpected token '...'.
+// Set<List<int>> set60 = {if (oracle("foo")) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:54:27: Error: Unexpected token 'if'.
+// Set<List<int>> set60 = {if (oracle("foo")) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:55:54: Error: Unexpected token '...'.
+// Map<String, List<int>> map60 = {if (oracle("foo")) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:55:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map60 = {if (oracle("foo")) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:62: Error: Unexpected token '...'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:48: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:56:29: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [if (oracle("foo")) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:60: Error: Unexpected token '...'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:46: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:57:27: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {if (oracle("foo")) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:68: Error: Unexpected token '...'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:54: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:58:35: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {if (oracle("foo")) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:59:29: Error: Unexpected token 'if'.
+// List<List<int>> list70 = [if (oracle("foo")) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:60:27: Error: Unexpected token 'if'.
+// Set<List<int>> set70 = {if (oracle("foo")) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:61:48: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [if (oracle("foo")) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:61:29: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [if (oracle("foo")) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:62:46: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {if (oracle("foo")) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:62:27: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {if (oracle("foo")) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:63:17: Error: Unexpected token 'if'.
+// var list80 = [if (oracle("foo")) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:64:16: Error: Unexpected token 'if'.
+// var set80 = {if (oracle("foo")) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:65:16: Error: Unexpected token 'if'.
+// var map80 = {if (oracle("foo")) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:36: Error: Unexpected token '...'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:52: Error: Unexpected token '...'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:66:17: Error: Unexpected token 'if'.
+// var list81 = [if (oracle("foo")) ...listInt else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:35: Error: Unexpected token '...'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:51: Error: Unexpected token '...'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:67:16: Error: Unexpected token 'if'.
+// var set81 = {if (oracle("foo")) ...listInt else ...listDouble, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:35: Error: Unexpected token '...'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:52: Error: Unexpected token '...'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:68:16: Error: Unexpected token 'if'.
+// var map81 = {if (oracle("foo")) ...mapToInt else ...mapToDouble, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:36: Error: Unexpected token '...'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:52: Error: Unexpected token '...'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:69:17: Error: Unexpected token 'if'.
+// var list82 = [if (oracle("foo")) ...listInt else ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:35: Error: Unexpected token '...'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:51: Error: Unexpected token '...'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:70:16: Error: Unexpected token 'if'.
+// var set82 = {if (oracle("foo")) ...listInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:35: Error: Unexpected token '...'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:52: Error: Unexpected token '...'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:16: Error: Unexpected token 'if'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:72:44: Error: Unexpected token '...'.
+// var list83 = [if (oracle("foo")) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:72:17: Error: Unexpected token 'if'.
+// var list83 = [if (oracle("foo")) 42 else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:73:35: Error: Unexpected token '...'.
+// var set83 = {if (oracle("foo")) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:73:16: Error: Unexpected token 'if'.
+// var set83 = {if (oracle("foo")) ...listInt else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:74:35: Error: Unexpected token '...'.
+// var map83 = {if (oracle("foo")) ...mapToInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:74:16: Error: Unexpected token 'if'.
+// var map83 = {if (oracle("foo")) ...mapToInt else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:75:23: Error: Unexpected token 'if'.
+// List<int> list90 = [if (oracle("foo")) dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:76:21: Error: Unexpected token 'if'.
+// Set<int> set90 = {if (oracle("foo")) dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:77:29: Error: Unexpected token 'if'.
+// Map<String, int> map90 = {if (oracle("foo")) "bar": dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:78:42: Error: Unexpected token '...'.
+// List<int> list91 = [if (oracle("foo")) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:78:23: Error: Unexpected token 'if'.
+// List<int> list91 = [if (oracle("foo")) ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:79:40: Error: Unexpected token '...'.
+// Set<int> set91 = {if (oracle("foo")) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:79:21: Error: Unexpected token 'if'.
+// Set<int> set91 = {if (oracle("foo")) ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:80:48: Error: Unexpected token '...'.
+// Map<String, int> map91 = {if (oracle("foo")) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:80:29: Error: Unexpected token 'if'.
+// Map<String, int> map91 = {if (oracle("foo")) ...dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:81:24: Error: Unexpected token 'if'.
+// List<int> list100 = [if (dynVar) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:82:22: Error: Unexpected token 'if'.
+// Set<int> set100 = {if (dynVar) 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:83:27: Error: Unexpected token 'if'.
+// Map<int, int> map100 = {if (dynVar) 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:87:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) "bar"];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:88:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) "bar", null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:89:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) "bar": "bar", "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:12: Error: Unexpected token 'if'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:12: Error: Unexpected token 'if'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:20: Error: Unexpected token 'if'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:28: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:36: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:36: Error: Unexpected token '...'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:9: Error: Unexpected token 'if'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:28: Error: Unexpected token '...'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:9: Error: Unexpected token 'if'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:51: Error: Unexpected token '...'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:17: Error: Unexpected token 'if'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:25: Error: Unexpected token 'if'.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:107:34: Error: Unexpected token 'if'.
+// Map<dynamic, dynamic> map10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:25: Error: Unexpected token 'if'.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:109:34: Error: Unexpected token 'if'.
+// Map<dynamic, dynamic> map11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:110:16: Error: Unexpected token 'if'.
+// var map12 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:111:16: Error: Unexpected token 'if'.
+// var map13 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:112:23: Error: Unexpected token 'if'.
+// List<int> list20 = [if (42) 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:113:21: Error: Unexpected token 'if'.
+// Set<int> set20 = {if (42) 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:114:26: Error: Unexpected token 'if'.
+// Map<int, int> map30 = {if (42) 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:34: Error: Unexpected token 'if'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:32: Error: Unexpected token 'if'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:42: Error: Unexpected token 'if'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:42: Error: Unexpected token 'if'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:123:17: Error: Unexpected token 'for'.
+// var list10 = [for (int i = 0; oracle("foo"); i++) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:124:16: Error: Unexpected token 'for'.
+// var set10 = {for (int i = 0; oracle("foo"); i++) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:125:16: Error: Unexpected token 'for'.
+// var map10 = {for (int i = 0; oracle("foo"); i++) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:126:17: Error: Unexpected token 'for'.
+// var list11 = [for (int i = 0; oracle("foo"); i++) dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:127:16: Error: Unexpected token 'for'.
+// var set11 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:128:16: Error: Unexpected token 'for'.
+// var map11 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:129:17: Error: Unexpected token 'for'.
+// var list12 = [for (int i = 0; oracle("foo"); i++) [42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:130:16: Error: Unexpected token 'for'.
+// var set12 = {for (int i = 0; oracle("foo"); i++) [42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:131:16: Error: Unexpected token 'for'.
+// var map12 = {for (int i = 0; oracle("foo"); i++) "bar": [42], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:132:53: Error: Unexpected token '...'.
+// var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:132:17: Error: Unexpected token 'for'.
+// var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:133:52: Error: Unexpected token '...'.
+// var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:133:16: Error: Unexpected token 'for'.
+// var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:134:52: Error: Unexpected token '...'.
+// var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:134:16: Error: Unexpected token 'for'.
+// var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:135:53: Error: Unexpected token '...'.
+// var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:135:17: Error: Unexpected token 'for'.
+// var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:136:52: Error: Unexpected token '...'.
+// var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:136:16: Error: Unexpected token 'for'.
+// var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:137:52: Error: Unexpected token '...'.
+// var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:137:16: Error: Unexpected token 'for'.
+// var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:138:53: Error: Unexpected token '...'.
+// var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:138:17: Error: Unexpected token 'for'.
+// var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:139:52: Error: Unexpected token '...'.
+// var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:139:16: Error: Unexpected token 'for'.
+// var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:140:52: Error: Unexpected token '...'.
+// var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:140:16: Error: Unexpected token 'for'.
+// var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:67: Error: Unexpected token '...'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:53: Error: Unexpected token 'if'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:141:17: Error: Unexpected token 'for'.
+// var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:66: Error: Unexpected token '...'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:52: Error: Unexpected token 'if'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:142:16: Error: Unexpected token 'for'.
+// var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:66: Error: Unexpected token '...'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:52: Error: Unexpected token 'if'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:143:16: Error: Unexpected token 'for'.
+// var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:67: Error: Unexpected token '...'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:53: Error: Unexpected token 'if'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:144:17: Error: Unexpected token 'for'.
+// var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:66: Error: Unexpected token '...'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:52: Error: Unexpected token 'if'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:145:16: Error: Unexpected token 'for'.
+// var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:66: Error: Unexpected token '...'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:52: Error: Unexpected token 'if'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:146:16: Error: Unexpected token 'for'.
+// var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:67: Error: Unexpected token '...'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:53: Error: Unexpected token 'if'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:147:17: Error: Unexpected token 'for'.
+// var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:66: Error: Unexpected token '...'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:52: Error: Unexpected token 'if'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:148:16: Error: Unexpected token 'for'.
+// var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:66: Error: Unexpected token '...'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:52: Error: Unexpected token 'if'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:149:16: Error: Unexpected token 'for'.
+// var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:150:65: Error: Unexpected token '...'.
+// List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:150:29: Error: Unexpected token 'for'.
+// List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:151:63: Error: Unexpected token '...'.
+// Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:151:27: Error: Unexpected token 'for'.
+// Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:152:71: Error: Unexpected token '...'.
+// Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:152:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:153:65: Error: Unexpected token '...'.
+// List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:153:29: Error: Unexpected token 'for'.
+// List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:154:63: Error: Unexpected token '...'.
+// Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:154:27: Error: Unexpected token 'for'.
+// Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:79: Error: Unexpected token '...'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:65: Error: Unexpected token 'if'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:155:29: Error: Unexpected token 'for'.
+// List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:77: Error: Unexpected token '...'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:63: Error: Unexpected token 'if'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:156:27: Error: Unexpected token 'for'.
+// Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:85: Error: Unexpected token '...'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:157:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:158:59: Error: Unexpected token '...'.
+// List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:158:23: Error: Unexpected token 'for'.
+// List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:159:57: Error: Unexpected token '...'.
+// Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:159:21: Error: Unexpected token 'for'.
+// Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:160:65: Error: Unexpected token '...'.
+// Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:160:29: Error: Unexpected token 'for'.
+// Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:161:59: Error: Unexpected token '...'.
+// List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:161:23: Error: Unexpected token 'for'.
+// List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:162:57: Error: Unexpected token '...'.
+// Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:162:21: Error: Unexpected token 'for'.
+// Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:73: Error: Unexpected token '...'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:59: Error: Unexpected token 'if'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:163:23: Error: Unexpected token 'for'.
+// List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:71: Error: Unexpected token '...'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:57: Error: Unexpected token 'if'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:164:21: Error: Unexpected token 'for'.
+// Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:165:65: Error: Unexpected token '...'.
+// List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:165:29: Error: Unexpected token 'for'.
+// List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:166:63: Error: Unexpected token '...'.
+// Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:166:27: Error: Unexpected token 'for'.
+// Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:167:71: Error: Unexpected token '...'.
+// Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:167:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:79: Error: Unexpected token '...'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:65: Error: Unexpected token 'if'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:168:29: Error: Unexpected token 'for'.
+// List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:77: Error: Unexpected token '...'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:63: Error: Unexpected token 'if'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:169:27: Error: Unexpected token 'for'.
+// Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:85: Error: Unexpected token '...'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:170:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:171:29: Error: Unexpected token 'for'.
+// List<List<int>> list70 = [for (int i = 0; oracle("foo"); i++) []];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:172:27: Error: Unexpected token 'for'.
+// Set<List<int>> set70 = {for (int i = 0; oracle("foo"); i++) [], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:173:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map70 = {for (int i = 0; oracle("foo"); i++) "bar": [], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:174:65: Error: Unexpected token 'if'.
+// List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:174:29: Error: Unexpected token 'for'.
+// List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:175:63: Error: Unexpected token 'if'.
+// Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:175:27: Error: Unexpected token 'for'.
+// Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:176:71: Error: Unexpected token 'if'.
+// Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:176:35: Error: Unexpected token 'for'.
+// Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:177:53: Error: Unexpected token 'if'.
+// var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:177:17: Error: Unexpected token 'for'.
+// var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:178:52: Error: Unexpected token 'if'.
+// var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:178:16: Error: Unexpected token 'for'.
+// var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:179:52: Error: Unexpected token 'if'.
+// var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:179:16: Error: Unexpected token 'for'.
+// var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:67: Error: Unexpected token '...'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:83: Error: Unexpected token '...'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:53: Error: Unexpected token 'if'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:180:17: Error: Unexpected token 'for'.
+// var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:66: Error: Unexpected token '...'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:82: Error: Unexpected token '...'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:52: Error: Unexpected token 'if'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:181:16: Error: Unexpected token 'for'.
+// var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:66: Error: Unexpected token '...'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:87: Error: Unexpected token '...'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:52: Error: Unexpected token 'if'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:182:16: Error: Unexpected token 'for'.
+// var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:67: Error: Unexpected token '...'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:83: Error: Unexpected token '...'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:53: Error: Unexpected token 'if'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:183:17: Error: Unexpected token 'for'.
+// var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:66: Error: Unexpected token '...'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:82: Error: Unexpected token '...'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:52: Error: Unexpected token 'if'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:184:16: Error: Unexpected token 'for'.
+// var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:66: Error: Unexpected token '...'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:87: Error: Unexpected token '...'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:52: Error: Unexpected token 'if'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:185:16: Error: Unexpected token 'for'.
+// var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:75: Error: Unexpected token '...'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:53: Error: Unexpected token 'if'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:186:17: Error: Unexpected token 'for'.
+// var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:66: Error: Unexpected token '...'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:52: Error: Unexpected token 'if'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:187:16: Error: Unexpected token 'for'.
+// var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:66: Error: Unexpected token '...'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:52: Error: Unexpected token 'if'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:188:16: Error: Unexpected token 'for'.
+// var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:189:23: Error: Unexpected token 'for'.
+// List<int> list90 = [for (int i = 0; oracle("foo"); i++) dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:190:21: Error: Unexpected token 'for'.
+// Set<int> set90 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:191:29: Error: Unexpected token 'for'.
+// Map<String, int> map90 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:192:59: Error: Unexpected token '...'.
+// List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:192:23: Error: Unexpected token 'for'.
+// List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:193:57: Error: Unexpected token '...'.
+// Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:193:21: Error: Unexpected token 'for'.
+// Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:194:65: Error: Unexpected token '...'.
+// Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:194:29: Error: Unexpected token 'for'.
+// Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:195:29: Error: Unexpected token 'for'.
+// List<int> list100 = <int>[for (index = 0; oracle("foo"); index++) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:196:27: Error: Unexpected token 'for'.
+// Set<int> set100 = <int>{for (index = 0; oracle("foo"); index++) 42};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:197:43: Error: Unexpected token 'for'.
+// Map<String, int> map100 = <String, int>{for (index = 0; oracle("foo"); index++) "bar": 42};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:198:18: Error: Unexpected token 'for'.
+// var list110 = [for (var i in [1, 2, 3]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:199:17: Error: Unexpected token 'for'.
+// var set110 = {for (var i in [1, 2, 3]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:200:17: Error: Unexpected token 'for'.
+// var map110 = {for (var i in [1, 2, 3]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:201:24: Error: Unexpected token 'for'.
+// List<int> list120 = [for (var i in dynVar) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:202:22: Error: Unexpected token 'for'.
+// Set<int> set120 = {for (var i in dynVar) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:203:30: Error: Unexpected token 'for'.
+// Map<String, int> map120 = {for (var i in dynVar) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:204:24: Error: Unexpected token 'for'.
+// List<int> list130 = [for (var i = 1; i < 2; i++) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:205:22: Error: Unexpected token 'for'.
+// Set<int> set130 = {for (var i = 1; i < 2; i++) i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:206:27: Error: Unexpected token 'for'.
+// Map<int, int> map130 = {for (var i = 1; i < 2; i++) i: i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:210:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:211:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:45: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:45: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:50: Error: Unexpected token '...'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:45: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:45: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:50: Error: Unexpected token '...'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:14: Error: Unexpected token 'for'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:48: Error: Unexpected token 'if'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:12: Error: Unexpected token 'for'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:48: Error: Unexpected token 'if'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:12: Error: Unexpected token 'for'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:56: Error: Unexpected token 'if'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:20: Error: Unexpected token 'for'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:59: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:45: Error: Unexpected token 'if'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:59: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:45: Error: Unexpected token 'if'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:67: Error: Unexpected token '...'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:53: Error: Unexpected token 'if'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:17: Error: Unexpected token 'for'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:67: Error: Unexpected token '...'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:45: Error: Unexpected token 'if'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:9: Error: Unexpected token 'for'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:67: Error: Unexpected token '...'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:45: Error: Unexpected token 'if'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:9: Error: Unexpected token 'for'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:82: Error: Unexpected token '...'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:53: Error: Unexpected token 'if'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:17: Error: Unexpected token 'for'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:230:9: Error: Unexpected token 'for'.
+// <int>[for (i in <int>[1]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:231:9: Error: Unexpected token 'for'.
+// <int>{for (i in <int>[1]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:232:16: Error: Unexpected token 'for'.
+// <String, int>{for (i in <int>[1]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:234:17: Error: Unexpected token 'for'.
+// var list10 = [for (var i in "not iterable") i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:235:16: Error: Unexpected token 'for'.
+// var set10 = {for (var i in "not iterable") i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:236:16: Error: Unexpected token 'for'.
+// var map10 = {for (var i in "not iterable") "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:17: Error: Unexpected token 'for'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:16: Error: Unexpected token 'for'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:16: Error: Unexpected token 'for'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:240:23: Error: Unexpected token 'for'.
+// var list30 = [await for (var i in "not stream") i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:241:22: Error: Unexpected token 'for'.
+// var set30 = {await for (var i in "not stream") i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:242:22: Error: Unexpected token 'for'.
+// var map30 = {await for (var i in "not stream") "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:23: Error: Unexpected token 'for'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:22: Error: Unexpected token 'for'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:22: Error: Unexpected token 'for'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:17: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var list50 = [await for (;;) 42];
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:23: Error: Unexpected token 'for'.
+// var list50 = [await for (;;) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var set50 = {await for (;;) 42, null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:22: Error: Unexpected token 'for'.
+// var set50 = {await for (;;) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:22: Error: Unexpected token 'for'.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:249:17: Error: Unexpected token 'for'.
+// var list60 = [for (; "not bool";) 42];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:250:16: Error: Unexpected token 'for'.
+// var set60 = {for (; "not bool";) 42, null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:251:16: Error: Unexpected token 'for'.
+// var map60 = {for (; "not bool";) "bar": 42, "baz": null};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>[await for (int i in stream) i];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:15: Error: Unexpected token 'for'.
+// <int>[await for (int i in stream) i];
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>{await for (int i in stream) i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:15: Error: Unexpected token 'for'.
+// <int>{await for (int i in stream) i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:34: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:23: Error: Unexpected token 'for'.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:267:23: Error: Unexpected token 'if'.
+// List<int> list10 = [if (a is B) a.foo];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:268:21: Error: Unexpected token 'if'.
+// Set<int> set10 = {if (a is B) a.foo};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:269:26: Error: Unexpected token 'if'.
+// Map<int, int> map10 = {if (a is B) a.foo: a.foo};
+// ^^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get foo() → core::int
+ return 42;
+}
+static method oracle<T extends core::Object = dynamic>([self::oracle::T t = null]) → dynamic
+ return true;
+static method testIfElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::Map<core::String, core::int> mapToInt, core::Map<core::String, core::double> mapToDouble) → dynamic {
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list11 = <dynamic>[];
+ dynamic set11 = <dynamic>{null};
+ dynamic map11 = <dynamic, dynamic>{"baz": null};
+ dynamic list12 = <dynamic>[];
+ dynamic set12 = <dynamic>{null};
+ dynamic map12 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list21 = <dynamic>[];
+ dynamic set21 = <dynamic>{null};
+ dynamic map21 = <dynamic, dynamic>{"baz": null};
+ dynamic list22 = <dynamic>[];
+ dynamic set22 = <dynamic>{null};
+ dynamic map22 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list31 = <dynamic>[];
+ dynamic set31 = <dynamic>{null};
+ dynamic map31 = <dynamic, dynamic>{"baz": null};
+ dynamic list33 = <dynamic>[];
+ dynamic set33 = <dynamic>{null};
+ dynamic map33 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list40 = <dynamic>[];
+ core::Set<core::List<core::int>> set40 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map40 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list41 = <dynamic>[];
+ core::Set<core::List<core::int>> set41 = <dynamic>{null};
+ core::List<core::List<core::int>> list42 = <dynamic>[];
+ core::Set<core::List<core::int>> set42 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map42 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list50 = <dynamic>[];
+ core::Set<core::int> set50 = <dynamic>{null};
+ core::Map<core::String, core::int> map50 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list51 = <dynamic>[];
+ core::Set<core::int> set51 = <dynamic>{null};
+ core::List<core::int> list52 = <dynamic>[];
+ core::Set<core::int> set52 = <dynamic>{null};
+ core::Map<core::String, core::int> map52 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list60 = <dynamic>[];
+ core::Set<core::List<core::int>> set60 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map60 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list61 = <dynamic>[];
+ core::Set<core::List<core::int>> set61 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map61 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list70 = <dynamic>[];
+ core::Set<core::List<core::int>> set70 = <dynamic>{null};
+ core::List<core::List<core::int>> list71 = <dynamic>[];
+ core::Set<core::List<core::int>> set71 = <dynamic>{null};
+ dynamic list80 = <dynamic>[];
+ dynamic set80 = <dynamic>{null};
+ dynamic map80 = <dynamic, dynamic>{"baz": null};
+ dynamic list81 = <dynamic>[];
+ dynamic set81 = <dynamic>{null};
+ dynamic map81 = <dynamic, dynamic>{"baz": null};
+ dynamic list82 = <dynamic>[];
+ dynamic set82 = <dynamic>{null};
+ dynamic map82 = <dynamic>{null};
+ dynamic list83 = <dynamic>[];
+ dynamic set83 = <dynamic>{null};
+ dynamic map83 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list90 = <dynamic>[];
+ core::Set<core::int> set90 = <dynamic>{null};
+ core::Map<core::String, core::int> map90 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list91 = <dynamic>[];
+ core::Set<core::int> set91 = <dynamic>{null};
+ core::Map<core::String, core::int> map91 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list100 = <dynamic>[];
+ core::Set<core::int> set100 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map100 = <dynamic, dynamic>{};
+}
+static method testIfElementErrors(core::Map<core::int, core::int> map) → dynamic {
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::String>[];
+ <core::String>{null};
+ <core::String, core::String>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ core::Set<dynamic> set10 = <dynamic, dynamic>{};
+ core::Map<dynamic, dynamic> map10 = <dynamic, dynamic>{};
+ core::Set<dynamic> set11 = <dynamic, dynamic>{};
+ core::Map<dynamic, dynamic> map11 = <dynamic, dynamic>{};
+ dynamic map12 = <dynamic, dynamic>{};
+ dynamic map13 = <dynamic, dynamic>{};
+ core::List<core::int> list20 = <dynamic>[];
+ core::Set<core::int> set20 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map30 = <dynamic, dynamic>{};
+ core::List<core::String> list40 = <core::String>[];
+ core::Set<core::String> set40 = <core::String>{};
+ core::Map<core::String, core::int> map40 = <core::String, core::int>{};
+ core::Map<core::int, core::String> map41 = <core::int, core::String>{};
+}
+static method testForElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::int index, core::Map<core::String, core::int> mapStringInt, core::Map<core::String, core::double> mapStringDouble) → dynamic {
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list11 = <dynamic>[];
+ dynamic set11 = <dynamic>{null};
+ dynamic map11 = <dynamic, dynamic>{"baz": null};
+ dynamic list12 = <dynamic>[];
+ dynamic set12 = <dynamic>{null};
+ dynamic map12 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list21 = <dynamic>[];
+ dynamic set21 = <dynamic>{null};
+ dynamic map21 = <dynamic, dynamic>{"baz": null};
+ dynamic list22 = <dynamic>[];
+ dynamic set22 = <dynamic>{null};
+ dynamic map22 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list31 = <dynamic>[];
+ dynamic set31 = <dynamic>{null};
+ dynamic map31 = <dynamic, dynamic>{"baz": null};
+ dynamic list33 = <dynamic>[];
+ dynamic set33 = <dynamic>{null};
+ dynamic map33 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list40 = <dynamic>[];
+ core::Set<core::List<core::int>> set40 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map40 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list41 = <dynamic>[];
+ core::Set<core::List<core::int>> set41 = <dynamic>{null};
+ core::List<core::List<core::int>> list42 = <dynamic>[];
+ core::Set<core::List<core::int>> set42 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map42 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list50 = <dynamic>[];
+ core::Set<core::int> set50 = <dynamic>{null};
+ core::Map<core::String, core::int> map50 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list51 = <dynamic>[];
+ core::Set<core::int> set51 = <dynamic>{null};
+ core::List<core::int> list52 = <dynamic>[];
+ core::Set<core::int> set52 = <dynamic>{null};
+ core::List<core::List<core::int>> list60 = <dynamic>[];
+ core::Set<core::List<core::int>> set60 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map60 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list61 = <dynamic>[];
+ core::Set<core::List<core::int>> set61 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map61 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list70 = <dynamic>[];
+ core::Set<core::List<core::int>> set70 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map70 = <dynamic, dynamic>{"baz": null};
+ core::List<core::List<core::int>> list71 = <dynamic>[];
+ core::Set<core::List<core::int>> set71 = <dynamic>{null};
+ core::Map<core::String, core::List<core::int>> map71 = <dynamic, dynamic>{"baz": null};
+ dynamic list80 = <dynamic>[];
+ dynamic set80 = <dynamic>{null};
+ dynamic map80 = <dynamic, dynamic>{"baz": null};
+ dynamic list81 = <dynamic>[];
+ dynamic set81 = <dynamic>{null};
+ dynamic map81 = <dynamic, dynamic>{"baz": null};
+ dynamic list82 = <dynamic>[];
+ dynamic set82 = <dynamic>{null};
+ dynamic map82 = <dynamic, dynamic>{"baz": null};
+ dynamic list83 = <dynamic>[];
+ dynamic set83 = <dynamic>{null};
+ dynamic map83 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list90 = <dynamic>[];
+ core::Set<core::int> set90 = <dynamic>{null};
+ core::Map<core::String, core::int> map90 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list91 = <dynamic>[];
+ core::Set<core::int> set91 = <dynamic>{null};
+ core::Map<core::String, core::int> map91 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list100 = <core::int>[];
+ core::Set<core::int> set100 = <core::int>{};
+ core::Map<core::String, core::int> map100 = <core::String, core::int>{};
+ dynamic list110 = <dynamic>[];
+ dynamic set110 = <dynamic>{null};
+ dynamic map110 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list120 = <dynamic>[];
+ core::Set<core::int> set120 = <dynamic>{null};
+ core::Map<core::String, core::int> map120 = <dynamic, dynamic>{"baz": null};
+ core::List<core::int> list130 = <dynamic>[];
+ core::Set<core::int> set130 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map130 = <dynamic, dynamic>{};
+}
+static method testForElementErrors(core::Map<core::int, core::int> map, core::List<core::int> list) → dynamic /* originally async */ {
+ final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::int, core::int>{42: null};
+ <core::String>[];
+ <core::String>{null};
+ <core::String, core::String>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ final dynamic i = 0;
+ <core::int>[];
+ <core::int>{null};
+ <core::String, core::int>{"baz": null};
+ dynamic list10 = <dynamic>[];
+ dynamic set10 = <dynamic>{null};
+ dynamic map10 = <dynamic, dynamic>{"baz": null};
+ dynamic list20 = <dynamic>[];
+ dynamic set20 = <dynamic>{null};
+ dynamic map20 = <dynamic, dynamic>{"baz": null};
+ dynamic list30 = <dynamic>[];
+ dynamic set30 = <dynamic>{null};
+ dynamic map30 = <dynamic, dynamic>{"baz": null};
+ dynamic list40 = <dynamic>[];
+ dynamic set40 = <dynamic>{null};
+ dynamic map40 = <dynamic, dynamic>{"baz": null};
+ dynamic list50 = <dynamic>[];
+ dynamic set50 = <dynamic>{null};
+ dynamic map50 = <dynamic, dynamic>{"baz": null};
+ dynamic list60 = <dynamic>[];
+ dynamic set60 = <dynamic>{null};
+ dynamic map60 = <dynamic, dynamic>{"baz": null};
+ }
+ asy::_completeOnAsyncReturn(:async_completer, :return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :async_completer.start(:async_op);
+ return :async_completer.{asy::Completer::future};
+}
+static method testForElementErrorsNotAsync(asy::Stream<core::int> stream) → dynamic {
+ <core::int>[];
+ <core::int>{};
+ <core::String, core::int>{};
+}
+static method testPromotion(self::A a) → dynamic {
+ core::List<core::int> list10 = <dynamic>[];
+ core::Set<core::int> set10 = <dynamic, dynamic>{};
+ core::Map<core::int, core::int> map10 = <dynamic, dynamic>{};
+}
+static method main() → dynamic {}
diff --git a/front_end/testcases/control_flow_collection_inference.dart.outline.expect b/front_end/testcases/control_flow_collection_inference.dart.outline.expect
new file mode 100644
index 0000000..c40231f
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.outline.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ ;
+ get foo() → core::int
+ ;
+}
+static method oracle<T extends core::Object = dynamic>([self::oracle::T t]) → dynamic
+ ;
+static method testIfElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::Map<core::String, core::int> mapToInt, core::Map<core::String, core::double> mapToDouble) → dynamic
+ ;
+static method testIfElementErrors(core::Map<core::int, core::int> map) → dynamic
+ ;
+static method testForElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::int index, core::Map<core::String, core::int> mapStringInt, core::Map<core::String, core::double> mapStringDouble) → dynamic
+ ;
+static method testForElementErrors(core::Map<core::int, core::int> map, core::List<core::int> list) → dynamic
+ ;
+static method testForElementErrorsNotAsync(asy::Stream<core::int> stream) → dynamic
+ ;
+static method testPromotion(self::A a) → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/front_end/testcases/control_flow_collection_inference.dart.strong.expect b/front_end/testcases/control_flow_collection_inference.dart.strong.expect
new file mode 100644
index 0000000..c3b0f74
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.strong.expect
@@ -0,0 +1,2313 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:34: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:38: Error: Unexpected type 'Map<String, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:44: Error: Expected ':' after this.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:107:53: Error: Expected ':' after this.
+// Map<dynamic, dynamic> map10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:61: Error: Expected ':' after this.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:109:70: Error: Expected ':' after this.
+// Map<dynamic, dynamic> map11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:110:35: Error: Expected ':' after this.
+// var map12 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:111:52: Error: Expected ':' after this.
+// var map13 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:87:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[if (oracle("foo")) "bar"];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:88:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{if (oracle("foo")) "bar", null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:89:43: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <String, int>{if (oracle("foo")) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:47: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:46: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:61: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:39: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:112:27: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// List<int> list20 = [if (42) 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:113:25: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// Set<int> set20 = {if (42) 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:114:30: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// Map<int, int> map30 = {if (42) 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:53: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:63: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:51: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:61: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:75: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:65: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:79: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:230:14: Error: Setter not found: 'i'.
+// <int>[for (i in <int>[1]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:231:14: Error: Setter not found: 'i'.
+// <int>{for (i in <int>[1]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:232:21: Error: Setter not found: 'i'.
+// <String, int>{for (i in <int>[1]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:17: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var list50 = [await for (;;) 42];
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var set50 = {await for (;;) 42, null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:210:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:211:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:50: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:54: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:61: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:69: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:77: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:92: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:234:31: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var list10 = [for (var i in "not iterable") i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:235:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var set10 = {for (var i in "not iterable") i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:236:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var map10 = {for (var i in "not iterable") "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:39: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:240:37: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var list30 = [await for (var i in "not stream") i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:241:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var set30 = {await for (var i in "not stream") i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:242:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var map30 = {await for (var i in "not stream") "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:58: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:65: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:249:24: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var list60 = [for (; "not bool";) 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:250:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var set60 = {for (; "not bool";) 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:251:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var map60 = {for (; "not bool";) "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>[await for (int i in stream) i];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>{await for (int i in stream) i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:34: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get foo() → core::int
+ return 42;
+}
+static method oracle<T extends core::Object = dynamic>([self::oracle::T t = null]) → dynamic
+ return true;
+static method testIfElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::Map<core::String, core::int> mapToInt, core::Map<core::String, core::double> mapToDouble) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t1 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t1.{core::List::add}(42);
+ } =>#t1;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t2.{core::Set::add}(42);
+ #t2.{core::Set::add}(null);
+ } =>#t2;
+ core::Map<core::String, core::int> map10 = block {
+ final core::Map<core::String, core::int> #t3 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t3.{core::Map::[]=}("bar", 42);
+ #t3.{core::Map::[]=}("baz", null);
+ } =>#t3;
+ core::List<dynamic> list11 = block {
+ final core::List<dynamic> #t4 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t4.{core::List::add}(dynVar);
+ } =>#t4;
+ core::Set<dynamic> set11 = block {
+ final core::Set<dynamic> #t5 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t5.{core::Set::add}(dynVar);
+ #t5.{core::Set::add}(null);
+ } =>#t5;
+ core::Map<core::String, dynamic> map11 = block {
+ final core::Map<core::String, dynamic> #t6 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t6.{core::Map::[]=}("bar", dynVar);
+ #t6.{core::Map::[]=}("baz", null);
+ } =>#t6;
+ core::List<core::List<core::int>> list12 = block {
+ final core::List<core::List<core::int>> #t7 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t7.{core::List::add}(<core::int>[42]);
+ } =>#t7;
+ core::Set<core::List<core::int>> set12 = block {
+ final core::Set<core::List<core::int>> #t8 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t8.{core::Set::add}(<core::int>[42]);
+ #t8.{core::Set::add}(null);
+ } =>#t8;
+ core::Map<core::String, core::List<core::int>> map12 = block {
+ final core::Map<core::String, core::List<core::int>> #t9 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t9.{core::Map::[]=}("bar", <core::int>[42]);
+ #t9.{core::Map::[]=}("baz", null);
+ } =>#t9;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t10 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t11 in <core::int>[42])
+ #t10.{core::List::add}(#t11);
+ } =>#t10;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t12 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t13 in <core::int>[42])
+ #t12.{core::Set::add}(#t13);
+ #t12.{core::Set::add}(null);
+ } =>#t12;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t14 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t15 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t14.{core::Map::[]=}(#t15.{core::MapEntry::key}, #t15.{core::MapEntry::value});
+ #t14.{core::Map::[]=}("baz", null);
+ } =>#t14;
+ core::List<dynamic> list21 = block {
+ final core::List<dynamic> #t16 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t17 in <dynamic>[dynVar])
+ #t16.{core::List::add}(#t17);
+ } =>#t16;
+ core::Set<dynamic> set21 = block {
+ final core::Set<dynamic> #t18 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t19 in <dynamic>[dynVar])
+ #t18.{core::Set::add}(#t19);
+ #t18.{core::Set::add}(null);
+ } =>#t18;
+ core::Map<core::String, dynamic> map21 = block {
+ final core::Map<core::String, dynamic> #t20 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t21 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t20.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
+ #t20.{core::Map::[]=}("baz", null);
+ } =>#t20;
+ core::List<core::List<core::int>> list22 = block {
+ final core::List<core::List<core::int>> #t22 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t23 in <core::List<core::int>>[<core::int>[42]])
+ #t22.{core::List::add}(#t23);
+ } =>#t22;
+ core::Set<core::List<core::int>> set22 = block {
+ final core::Set<core::List<core::int>> #t24 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t25 in <core::List<core::int>>[<core::int>[42]])
+ #t24.{core::Set::add}(#t25);
+ #t24.{core::Set::add}(null);
+ } =>#t24;
+ core::Map<core::String, core::List<core::int>> map22 = block {
+ final core::Map<core::String, core::List<core::int>> #t26 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t27 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t26.{core::Map::[]=}(#t27.{core::MapEntry::key}, #t27.{core::MapEntry::value});
+ #t26.{core::Map::[]=}("baz", null);
+ } =>#t26;
+ core::List<core::int> list30 = block {
+ final core::List<core::int> #t28 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t29 in <core::int>[42])
+ #t28.{core::List::add}(#t29);
+ } =>#t28;
+ core::Set<core::int> set30 = block {
+ final core::Set<core::int> #t30 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t31 in <core::int>[42])
+ #t30.{core::Set::add}(#t31);
+ #t30.{core::Set::add}(null);
+ } =>#t30;
+ core::Map<core::String, core::int> map30 = block {
+ final core::Map<core::String, core::int> #t32 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t33 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t32.{core::Map::[]=}(#t33.{core::MapEntry::key}, #t33.{core::MapEntry::value});
+ #t32.{core::Map::[]=}("baz", null);
+ } =>#t32;
+ core::List<dynamic> list31 = block {
+ final core::List<dynamic> #t34 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t35 in <dynamic>[dynVar])
+ #t34.{core::List::add}(#t35);
+ } =>#t34;
+ core::Set<dynamic> set31 = block {
+ final core::Set<dynamic> #t36 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t37 in <dynamic>[dynVar])
+ #t36.{core::Set::add}(#t37);
+ #t36.{core::Set::add}(null);
+ } =>#t36;
+ core::Map<core::String, dynamic> map31 = block {
+ final core::Map<core::String, dynamic> #t38 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t39 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t38.{core::Map::[]=}(#t39.{core::MapEntry::key}, #t39.{core::MapEntry::value});
+ #t38.{core::Map::[]=}("baz", null);
+ } =>#t38;
+ core::List<core::List<core::int>> list33 = block {
+ final core::List<core::List<core::int>> #t40 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t41 in <core::List<core::int>>[<core::int>[42]])
+ #t40.{core::List::add}(#t41);
+ } =>#t40;
+ core::Set<core::List<core::int>> set33 = block {
+ final core::Set<core::List<core::int>> #t42 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t43 in <core::List<core::int>>[<core::int>[42]])
+ #t42.{core::Set::add}(#t43);
+ #t42.{core::Set::add}(null);
+ } =>#t42;
+ core::Map<core::String, core::List<core::int>> map33 = block {
+ final core::Map<core::String, core::List<core::int>> #t44 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t45 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t44.{core::Map::[]=}(#t45.{core::MapEntry::key}, #t45.{core::MapEntry::value});
+ #t44.{core::Map::[]=}("baz", null);
+ } =>#t44;
+ core::List<core::List<core::int>> list40 = block {
+ final core::List<core::List<core::int>> #t46 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t47 in <core::List<core::int>>[<core::int>[]])
+ #t46.{core::List::add}(#t47);
+ } =>#t46;
+ core::Set<core::List<core::int>> set40 = block {
+ final core::Set<core::List<core::int>> #t48 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t49 in <core::List<core::int>>[<core::int>[]])
+ #t48.{core::Set::add}(#t49);
+ #t48.{core::Set::add}(null);
+ } =>#t48;
+ core::Map<core::String, core::List<core::int>> map40 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:39:34: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Map<String, List<int>> map40 = {if (oracle(\"foo\")) ...{\"bar\", []}, \"baz\": null};
+ ^";
+ core::List<core::List<core::int>> list41 = block {
+ final core::List<core::List<core::int>> #t50 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t51 in let final core::Set<core::List<core::int>> #t52 = col::LinkedHashSet::•<core::List<core::int>>() in let final dynamic #t53 = #t52.{core::Set::add}(<core::int>[]) in #t52)
+ #t50.{core::List::add}(#t51);
+ } =>#t50;
+ core::Set<core::List<core::int>> set41 = block {
+ final core::Set<core::List<core::int>> #t54 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t55 in let final core::Set<core::List<core::int>> #t56 = col::LinkedHashSet::•<core::List<core::int>>() in let final dynamic #t57 = #t56.{core::Set::add}(<core::int>[]) in #t56)
+ #t54.{core::Set::add}(#t55);
+ #t54.{core::Set::add}(null);
+ } =>#t54;
+ core::List<core::List<core::int>> list42 = block {
+ final core::List<core::List<core::int>> #t58 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t59 in <core::List<core::int>>[<core::int>[]])
+ #t58.{core::List::add}(#t59);
+ } =>#t58;
+ core::Set<core::List<core::int>> set42 = block {
+ final core::Set<core::List<core::int>> #t60 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t61 in <core::List<core::int>>[<core::int>[]])
+ #t60.{core::Set::add}(#t61);
+ #t60.{core::Set::add}(null);
+ } =>#t60;
+ core::Map<core::String, core::List<core::int>> map42 = block {
+ final core::Map<core::String, core::List<core::int>> #t62 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t63 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t62.{core::Map::[]=}(#t63.{core::MapEntry::key}, #t63.{core::MapEntry::value});
+ #t62.{core::Map::[]=}("baz", null);
+ } =>#t62;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t64 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t65 in <core::int>[])
+ #t64.{core::List::add}(#t65);
+ } =>#t64;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t66 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t67 in <core::int>[])
+ #t66.{core::Set::add}(#t67);
+ #t66.{core::Set::add}(null);
+ } =>#t66;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t68 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t69 in <core::String, core::int>{}.{core::Map::entries})
+ #t68.{core::Map::[]=}(#t69.{core::MapEntry::key}, #t69.{core::MapEntry::value});
+ #t68.{core::Map::[]=}("baz", null);
+ } =>#t68;
+ core::List<core::int> list51 = block {
+ final core::List<core::int> #t70 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t71 in let final core::Set<core::int> #t72 = col::LinkedHashSet::•<core::int>() in #t72)
+ #t70.{core::List::add}(#t71);
+ } =>#t70;
+ core::Set<core::int> set51 = block {
+ final core::Set<core::int> #t73 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t74 in let final core::Set<core::int> #t75 = col::LinkedHashSet::•<core::int>() in #t75)
+ #t73.{core::Set::add}(#t74);
+ #t73.{core::Set::add}(null);
+ } =>#t73;
+ core::List<core::int> list52 = block {
+ final core::List<core::int> #t76 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t77 in <core::int>[])
+ #t76.{core::List::add}(#t77);
+ } =>#t76;
+ core::Set<core::int> set52 = block {
+ final core::Set<core::int> #t78 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t79 in <core::int>[])
+ #t78.{core::Set::add}(#t79);
+ #t78.{core::Set::add}(null);
+ } =>#t78;
+ core::Map<core::String, core::int> map52 = block {
+ final core::Map<core::String, core::int> #t80 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t81 in <core::String, core::int>{}.{core::Map::entries})
+ #t80.{core::Map::[]=}(#t81.{core::MapEntry::key}, #t81.{core::MapEntry::value});
+ #t80.{core::Map::[]=}("baz", null);
+ } =>#t80;
+ core::List<core::List<core::int>> list60 = block {
+ final core::List<core::List<core::int>> #t82 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t83 in <core::List<core::int>>[<core::int>[]])
+ #t82.{core::List::add}(#t83);
+ } =>#t82;
+ core::Set<core::List<core::int>> set60 = block {
+ final core::Set<core::List<core::int>> #t84 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t85 in <core::List<core::int>>[<core::int>[]])
+ #t84.{core::Set::add}(#t85);
+ #t84.{core::Set::add}(null);
+ } =>#t84;
+ core::Map<core::String, core::List<core::int>> map60 = block {
+ final core::Map<core::String, core::List<core::int>> #t86 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t87 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t86.{core::Map::[]=}(#t87.{core::MapEntry::key}, #t87.{core::MapEntry::value});
+ #t86.{core::Map::[]=}("baz", null);
+ } =>#t86;
+ core::List<core::List<core::int>> list61 = block {
+ final core::List<core::List<core::int>> #t88 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t89 in <core::List<core::int>>[<core::int>[]])
+ #t88.{core::List::add}(#t89);
+ } =>#t88;
+ core::Set<core::List<core::int>> set61 = block {
+ final core::Set<core::List<core::int>> #t90 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t91 in <core::List<core::int>>[<core::int>[]])
+ #t90.{core::Set::add}(#t91);
+ #t90.{core::Set::add}(null);
+ } =>#t90;
+ core::Map<core::String, core::List<core::int>> map61 = block {
+ final core::Map<core::String, core::List<core::int>> #t92 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t93 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t92.{core::Map::[]=}(#t93.{core::MapEntry::key}, #t93.{core::MapEntry::value});
+ #t92.{core::Map::[]=}("baz", null);
+ } =>#t92;
+ core::List<core::List<core::int>> list70 = block {
+ final core::List<core::List<core::int>> #t94 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t94.{core::List::add}(<core::int>[]);
+ } =>#t94;
+ core::Set<core::List<core::int>> set70 = block {
+ final core::Set<core::List<core::int>> #t95 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t95.{core::Set::add}(<core::int>[]);
+ #t95.{core::Set::add}(null);
+ } =>#t95;
+ core::List<core::List<core::int>> list71 = block {
+ final core::List<core::List<core::int>> #t96 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t96.{core::List::add}(<core::int>[]);
+ } =>#t96;
+ core::Set<core::List<core::int>> set71 = block {
+ final core::Set<core::List<core::int>> #t97 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t97.{core::Set::add}(<core::int>[]);
+ #t97.{core::Set::add}(null);
+ } =>#t97;
+ core::List<core::num> list80 = block {
+ final core::List<core::num> #t98 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t98.{core::List::add}(42);
+ else
+ #t98.{core::List::add}(3.14);
+ } =>#t98;
+ core::Set<core::num> set80 = block {
+ final core::Set<core::num> #t99 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t99.{core::Set::add}(42);
+ else
+ #t99.{core::Set::add}(3.14);
+ #t99.{core::Set::add}(null);
+ } =>#t99;
+ core::Map<core::String, core::num> map80 = block {
+ final core::Map<core::String, core::num> #t100 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t100.{core::Map::[]=}("bar", 42);
+ else
+ #t100.{core::Map::[]=}("bar", 3.14);
+ #t100.{core::Map::[]=}("baz", null);
+ } =>#t100;
+ core::List<core::num> list81 = block {
+ final core::List<core::num> #t101 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t102 in listInt)
+ #t101.{core::List::add}(#t102);
+ else
+ for (final core::num #t103 in listDouble)
+ #t101.{core::List::add}(#t103);
+ } =>#t101;
+ core::Set<core::num> set81 = block {
+ final core::Set<core::num> #t104 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t105 in listInt)
+ #t104.{core::Set::add}(#t105);
+ else
+ for (final core::num #t106 in listDouble)
+ #t104.{core::Set::add}(#t106);
+ #t104.{core::Set::add}(null);
+ } =>#t104;
+ core::Map<core::String, core::num> map81 = block {
+ final core::Map<core::String, core::num> #t107 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t108 in mapToInt.{core::Map::entries})
+ #t107.{core::Map::[]=}(#t108.{core::MapEntry::key}, #t108.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<core::String, core::num> #t109 in mapToDouble.{core::Map::entries})
+ #t107.{core::Map::[]=}(#t109.{core::MapEntry::key}, #t109.{core::MapEntry::value});
+ #t107.{core::Map::[]=}("baz", null);
+ } =>#t107;
+ core::List<dynamic> list82 = block {
+ final core::List<dynamic> #t110 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t111 in listInt)
+ #t110.{core::List::add}(#t111);
+ else
+ for (final dynamic #t112 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t110.{core::List::add}(#t112);
+ } =>#t110;
+ core::Set<dynamic> set82 = block {
+ final core::Set<dynamic> #t113 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t114 in listInt)
+ #t113.{core::Set::add}(#t114);
+ else
+ for (final dynamic #t115 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t113.{core::Set::add}(#t115);
+ #t113.{core::Set::add}(null);
+ } =>#t113;
+ core::Set<dynamic> map82 = block {
+ final core::Set<dynamic> #t116 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t116.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:71:38: Error: Unexpected type 'Map<String, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ var map82 = {if (oracle(\"foo\")) ...mapToInt else ...dynVar, null};
+ ^");
+ else
+ for (final dynamic #t117 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t116.{core::Set::add}(#t117);
+ #t116.{core::Set::add}(null);
+ } =>#t116;
+ core::List<core::num> list83 = block {
+ final core::List<core::num> #t118 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t118.{core::List::add}(42);
+ else
+ for (final core::num #t119 in listDouble)
+ #t118.{core::List::add}(#t119);
+ } =>#t118;
+ core::Set<core::num> set83 = block {
+ final core::Set<core::num> #t120 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t121 in listInt)
+ #t120.{core::Set::add}(#t121);
+ else
+ #t120.{core::Set::add}(3.14);
+ #t120.{core::Set::add}(null);
+ } =>#t120;
+ core::Map<core::String, core::num> map83 = block {
+ final core::Map<core::String, core::num> #t122 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t123 in mapToInt.{core::Map::entries})
+ #t122.{core::Map::[]=}(#t123.{core::MapEntry::key}, #t123.{core::MapEntry::value});
+ else
+ #t122.{core::Map::[]=}("bar", 3.14);
+ #t122.{core::Map::[]=}("baz", null);
+ } =>#t122;
+ core::List<core::int> list90 = block {
+ final core::List<core::int> #t124 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t124.{core::List::add}(dynVar as{TypeError} core::int);
+ } =>#t124;
+ core::Set<core::int> set90 = block {
+ final core::Set<core::int> #t125 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t125.{core::Set::add}(dynVar as{TypeError} core::int);
+ #t125.{core::Set::add}(null);
+ } =>#t125;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t126 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t126.{core::Map::[]=}("bar", dynVar as{TypeError} core::int);
+ #t126.{core::Map::[]=}("baz", null);
+ } =>#t126;
+ core::List<core::int> list91 = block {
+ final core::List<core::int> #t127 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t128 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t129 = #t128 as{TypeError} core::int;
+ #t127.{core::List::add}(#t129);
+ }
+ } =>#t127;
+ core::Set<core::int> set91 = block {
+ final core::Set<core::int> #t130 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t131 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t132 = #t131 as{TypeError} core::int;
+ #t130.{core::Set::add}(#t132);
+ }
+ #t130.{core::Set::add}(null);
+ } =>#t130;
+ core::Map<core::String, core::int> map91 = block {
+ final core::Map<core::String, core::int> #t133 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<dynamic, dynamic> #t134 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::String #t135 = #t134.{core::MapEntry::key} as{TypeError} core::String;
+ final core::int #t136 = #t134.{core::MapEntry::value} as{TypeError} core::int;
+ #t133.{core::Map::[]=}(#t135, #t136);
+ }
+ #t133.{core::Map::[]=}("baz", null);
+ } =>#t133;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t137 = <core::int>[];
+ if(dynVar as{TypeError} core::bool)
+ #t137.{core::List::add}(42);
+ } =>#t137;
+ core::Set<core::int> set100 = block {
+ final core::Set<core::int> #t138 = col::LinkedHashSet::•<core::int>();
+ if(dynVar as{TypeError} core::bool)
+ #t138.{core::Set::add}(42);
+ } =>#t138;
+ core::Map<core::int, core::int> map100 = block {
+ final core::Map<core::int, core::int> #t139 = <core::int, core::int>{};
+ if(dynVar as{TypeError} core::bool)
+ #t139.{core::Map::[]=}(42, 42);
+ } =>#t139;
+}
+static method testIfElementErrors(core::Map<core::int, core::int> map) → dynamic {
+ block {
+ final core::List<core::int> #t140 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t140.{core::List::add}(let final<BottomType> #t141 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:87:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[if (oracle(\"foo\")) \"bar\"];
+ ^" in "bar" as{TypeError} core::int);
+ } =>#t140;
+ block {
+ final core::Set<core::int> #t142 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t142.{core::Set::add}(let final<BottomType> #t143 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:88:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{if (oracle(\"foo\")) \"bar\", null};
+ ^" in "bar" as{TypeError} core::int);
+ #t142.{core::Set::add}(null);
+ } =>#t142;
+ block {
+ final core::Map<core::String, core::int> #t144 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t144.{core::Map::[]=}("bar", let final<BottomType> #t145 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:89:43: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int);
+ #t144.{core::Map::[]=}("baz", null);
+ } =>#t144;
+ block {
+ final core::List<core::int> #t146 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t147 in <core::int>[let final<BottomType> #t148 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:90:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[if (oracle(\"foo\")) ...[\"bar\"]];
+ ^" in "bar" as{TypeError} core::int])
+ #t146.{core::List::add}(#t147);
+ } =>#t146;
+ block {
+ final core::Set<core::int> #t149 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t150 in <core::int>[let final<BottomType> #t151 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:91:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{if (oracle(\"foo\")) ...[\"bar\"], null};
+ ^" in "bar" as{TypeError} core::int])
+ #t149.{core::Set::add}(#t150);
+ #t149.{core::Set::add}(null);
+ } =>#t149;
+ block {
+ final core::Map<core::String, core::int> #t152 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t153 in <core::String, core::int>{"bar": let final<BottomType> #t154 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:92:47: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <String, int>{if (oracle(\"foo\")) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int}.{core::Map::entries})
+ #t152.{core::Map::[]=}(#t153.{core::MapEntry::key}, #t153.{core::MapEntry::value});
+ #t152.{core::Map::[]=}("baz", null);
+ } =>#t152;
+ block {
+ final core::List<core::int> #t155 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t155.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:93:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) ...map];
+ ^");
+ } =>#t155;
+ block {
+ final core::Set<core::int> #t156 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t156.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:94:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map, null};
+ ^");
+ #t156.{core::Set::add}(null);
+ } =>#t156;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[\"bar\"], \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[\"bar\"], \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::String> #t157 = <core::String>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t157.{core::List::add}(let final<BottomType> #t158 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:96:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[if (oracle(\"foo\")) 42 else 3.14];
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t157.{core::List::add}(let final<BottomType> #t159 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:96:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[if (oracle(\"foo\")) 42 else 3.14];
+ ^" in 3.14 as{TypeError} core::String);
+ } =>#t157;
+ block {
+ final core::Set<core::String> #t160 = col::LinkedHashSet::•<core::String>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t160.{core::Set::add}(let final<BottomType> #t161 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:97:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{if (oracle(\"foo\")) 42 else 3.14, null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t160.{core::Set::add}(let final<BottomType> #t162 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:97:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{if (oracle(\"foo\")) 42 else 3.14, null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t160.{core::Set::add}(null);
+ } =>#t160;
+ block {
+ final core::Map<core::String, core::String> #t163 = <core::String, core::String>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t163.{core::Map::[]=}("bar", let final<BottomType> #t164 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:98:46: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{if (oracle(\"foo\")) \"bar\": 42 else \"baz\": 3.14, \"baz\": null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t163.{core::Map::[]=}("baz", let final<BottomType> #t165 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:98:61: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{if (oracle(\"foo\")) \"bar\": 42 else \"baz\": 3.14, \"baz\": null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t163.{core::Map::[]=}("baz", null);
+ } =>#t163;
+ block {
+ final core::List<core::int> #t166 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t166.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:99:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) ...map else 42];
+ ^");
+ else
+ #t166.{core::List::add}(42);
+ } =>#t166;
+ block {
+ final core::Set<core::int> #t167 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t167.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:100:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map else 42, null};
+ ^");
+ else
+ #t167.{core::Set::add}(42);
+ #t167.{core::Set::add}(null);
+ } =>#t167;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[42] else \"bar\": 42, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[42] else \"bar\": 42, \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::int> #t168 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t168.{core::List::add}(42);
+ else
+ #t168.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:102:39: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) 42 else ...map];
+ ^");
+ } =>#t168;
+ block {
+ final core::Set<core::int> #t169 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t169.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:103:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map else 42, null};
+ ^");
+ else
+ #t169.{core::Set::add}(42);
+ #t169.{core::Set::add}(null);
+ } =>#t169;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": 42 else ...[42], \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": 42 else ...[42], \"baz\": null};
+ ^": null};
+ core::Set<dynamic> set10 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:106:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Set<dynamic> set10 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^";
+ core::Map<dynamic, dynamic> map10 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:107:53: Error: Expected ':' after this.
+ Map<dynamic, dynamic> map10 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^": null};
+ core::Set<dynamic> set11 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:108:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Set<dynamic> set11 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^";
+ core::Map<dynamic, dynamic> map11 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:109:70: Error: Expected ':' after this.
+ Map<dynamic, dynamic> map11 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^": null};
+ core::Map<<BottomType>, core::Null> map12 = <<BottomType>, core::Null>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:110:35: Error: Expected ':' after this.
+ var map12 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^": null};
+ core::Map<<BottomType>, core::Null> map13 = <<BottomType>, core::Null>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:111:52: Error: Expected ':' after this.
+ var map13 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^": null};
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t170 = <core::int>[];
+ if(let final<BottomType> #t171 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:112:27: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ List<int> list20 = [if (42) 42];
+ ^" in 42 as{TypeError} core::bool)
+ #t170.{core::List::add}(42);
+ } =>#t170;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t172 = col::LinkedHashSet::•<core::int>();
+ if(let final<BottomType> #t173 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:113:25: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ Set<int> set20 = {if (42) 42};
+ ^" in 42 as{TypeError} core::bool)
+ #t172.{core::Set::add}(42);
+ } =>#t172;
+ core::Map<core::int, core::int> map30 = block {
+ final core::Map<core::int, core::int> #t174 = <core::int, core::int>{};
+ if(let final<BottomType> #t175 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:114:30: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ Map<int, int> map30 = {if (42) 42: 42};
+ ^" in 42 as{TypeError} core::bool)
+ #t174.{core::Map::[]=}(42, 42);
+ } =>#t174;
+ core::List<core::String> list40 = block {
+ final core::List<core::String> #t176 = <core::String>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t176.{core::List::add}(let final<BottomType> #t177 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:115:53: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ List<String> list40 = <String>[if (oracle(\"foo\")) true else 42];
+ ^" in true as{TypeError} core::String);
+ else
+ #t176.{core::List::add}(let final<BottomType> #t178 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:115:63: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ List<String> list40 = <String>[if (oracle(\"foo\")) true else 42];
+ ^" in 42 as{TypeError} core::String);
+ } =>#t176;
+ core::Set<core::String> set40 = block {
+ final core::Set<core::String> #t179 = col::LinkedHashSet::•<core::String>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t179.{core::Set::add}(let final<BottomType> #t180 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:116:51: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Set<String> set40 = <String>{if (oracle(\"foo\")) true else 42};
+ ^" in true as{TypeError} core::String);
+ else
+ #t179.{core::Set::add}(let final<BottomType> #t181 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:116:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Set<String> set40 = <String>{if (oracle(\"foo\")) true else 42};
+ ^" in 42 as{TypeError} core::String);
+ } =>#t179;
+ core::Map<core::String, core::int> map40 = block {
+ final core::Map<core::String, core::int> #t182 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t182.{core::Map::[]=}(let final<BottomType> #t183 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:117:61: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<String, int> map40 = <String, int>{if (oracle(\"foo\")) true: 42 else 42: 42};
+ ^" in true as{TypeError} core::String, 42);
+ else
+ #t182.{core::Map::[]=}(let final<BottomType> #t184 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:117:75: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<String, int> map40 = <String, int>{if (oracle(\"foo\")) true: 42 else 42: 42};
+ ^" in 42 as{TypeError} core::String, 42);
+ } =>#t182;
+ core::Map<core::int, core::String> map41 = block {
+ final core::Map<core::int, core::String> #t185 = <core::int, core::String>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t185.{core::Map::[]=}(42, let final<BottomType> #t186 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:118:65: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<int, String> map41 = <int, String>{if (oracle(\"foo\")) 42: true else 42: 42};
+ ^" in true as{TypeError} core::String);
+ else
+ #t185.{core::Map::[]=}(42, let final<BottomType> #t187 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:118:79: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<int, String> map41 = <int, String>{if (oracle(\"foo\")) 42: true else 42: 42};
+ ^" in 42 as{TypeError} core::String);
+ } =>#t185;
+}
+static method testForElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::int index, core::Map<core::String, core::int> mapStringInt, core::Map<core::String, core::double> mapStringDouble) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t188 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t188.{core::List::add}(42);
+ } =>#t188;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t189 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t189.{core::Set::add}(42);
+ #t189.{core::Set::add}(null);
+ } =>#t189;
+ core::Map<core::String, core::int> map10 = block {
+ final core::Map<core::String, core::int> #t190 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t190.{core::Map::[]=}("bar", 42);
+ #t190.{core::Map::[]=}("baz", null);
+ } =>#t190;
+ core::List<dynamic> list11 = block {
+ final core::List<dynamic> #t191 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t191.{core::List::add}(dynVar);
+ } =>#t191;
+ core::Set<dynamic> set11 = block {
+ final core::Set<dynamic> #t192 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t192.{core::Set::add}(dynVar);
+ #t192.{core::Set::add}(null);
+ } =>#t192;
+ core::Map<core::String, dynamic> map11 = block {
+ final core::Map<core::String, dynamic> #t193 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t193.{core::Map::[]=}("bar", dynVar);
+ #t193.{core::Map::[]=}("baz", null);
+ } =>#t193;
+ core::List<core::List<core::int>> list12 = block {
+ final core::List<core::List<core::int>> #t194 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t194.{core::List::add}(<core::int>[42]);
+ } =>#t194;
+ core::Set<core::List<core::int>> set12 = block {
+ final core::Set<core::List<core::int>> #t195 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t195.{core::Set::add}(<core::int>[42]);
+ #t195.{core::Set::add}(null);
+ } =>#t195;
+ core::Map<core::String, core::List<core::int>> map12 = block {
+ final core::Map<core::String, core::List<core::int>> #t196 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t196.{core::Map::[]=}("bar", <core::int>[42]);
+ #t196.{core::Map::[]=}("baz", null);
+ } =>#t196;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t197 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t198 in <core::int>[42])
+ #t197.{core::List::add}(#t198);
+ } =>#t197;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t199 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t200 in <core::int>[42])
+ #t199.{core::Set::add}(#t200);
+ #t199.{core::Set::add}(null);
+ } =>#t199;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t201 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::int> #t202 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t201.{core::Map::[]=}(#t202.{core::MapEntry::key}, #t202.{core::MapEntry::value});
+ #t201.{core::Map::[]=}("baz", null);
+ } =>#t201;
+ core::List<dynamic> list21 = block {
+ final core::List<dynamic> #t203 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t204 in <dynamic>[dynVar])
+ #t203.{core::List::add}(#t204);
+ } =>#t203;
+ core::Set<dynamic> set21 = block {
+ final core::Set<dynamic> #t205 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t206 in <dynamic>[dynVar])
+ #t205.{core::Set::add}(#t206);
+ #t205.{core::Set::add}(null);
+ } =>#t205;
+ core::Map<core::String, dynamic> map21 = block {
+ final core::Map<core::String, dynamic> #t207 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, dynamic> #t208 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t207.{core::Map::[]=}(#t208.{core::MapEntry::key}, #t208.{core::MapEntry::value});
+ #t207.{core::Map::[]=}("baz", null);
+ } =>#t207;
+ core::List<core::List<core::int>> list22 = block {
+ final core::List<core::List<core::int>> #t209 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t210 in <core::List<core::int>>[<core::int>[42]])
+ #t209.{core::List::add}(#t210);
+ } =>#t209;
+ core::Set<core::List<core::int>> set22 = block {
+ final core::Set<core::List<core::int>> #t211 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t212 in <core::List<core::int>>[<core::int>[42]])
+ #t211.{core::Set::add}(#t212);
+ #t211.{core::Set::add}(null);
+ } =>#t211;
+ core::Map<core::String, core::List<core::int>> map22 = block {
+ final core::Map<core::String, core::List<core::int>> #t213 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t214 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t213.{core::Map::[]=}(#t214.{core::MapEntry::key}, #t214.{core::MapEntry::value});
+ #t213.{core::Map::[]=}("baz", null);
+ } =>#t213;
+ core::List<core::int> list30 = block {
+ final core::List<core::int> #t215 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t216 in <core::int>[42])
+ #t215.{core::List::add}(#t216);
+ } =>#t215;
+ core::Set<core::int> set30 = block {
+ final core::Set<core::int> #t217 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t218 in <core::int>[42])
+ #t217.{core::Set::add}(#t218);
+ #t217.{core::Set::add}(null);
+ } =>#t217;
+ core::Map<core::String, core::int> map30 = block {
+ final core::Map<core::String, core::int> #t219 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t220 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t219.{core::Map::[]=}(#t220.{core::MapEntry::key}, #t220.{core::MapEntry::value});
+ #t219.{core::Map::[]=}("baz", null);
+ } =>#t219;
+ core::List<dynamic> list31 = block {
+ final core::List<dynamic> #t221 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t222 in <dynamic>[dynVar])
+ #t221.{core::List::add}(#t222);
+ } =>#t221;
+ core::Set<dynamic> set31 = block {
+ final core::Set<dynamic> #t223 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t224 in <dynamic>[dynVar])
+ #t223.{core::Set::add}(#t224);
+ #t223.{core::Set::add}(null);
+ } =>#t223;
+ core::Map<core::String, dynamic> map31 = block {
+ final core::Map<core::String, dynamic> #t225 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t226 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t225.{core::Map::[]=}(#t226.{core::MapEntry::key}, #t226.{core::MapEntry::value});
+ #t225.{core::Map::[]=}("baz", null);
+ } =>#t225;
+ core::List<core::List<core::int>> list33 = block {
+ final core::List<core::List<core::int>> #t227 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t228 in <core::List<core::int>>[<core::int>[42]])
+ #t227.{core::List::add}(#t228);
+ } =>#t227;
+ core::Set<core::List<core::int>> set33 = block {
+ final core::Set<core::List<core::int>> #t229 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t230 in <core::List<core::int>>[<core::int>[42]])
+ #t229.{core::Set::add}(#t230);
+ #t229.{core::Set::add}(null);
+ } =>#t229;
+ core::Map<core::String, core::List<core::int>> map33 = block {
+ final core::Map<core::String, core::List<core::int>> #t231 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t232 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t231.{core::Map::[]=}(#t232.{core::MapEntry::key}, #t232.{core::MapEntry::value});
+ #t231.{core::Map::[]=}("baz", null);
+ } =>#t231;
+ core::List<core::List<core::int>> list40 = block {
+ final core::List<core::List<core::int>> #t233 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t234 in <core::List<core::int>>[<core::int>[]])
+ #t233.{core::List::add}(#t234);
+ } =>#t233;
+ core::Set<core::List<core::int>> set40 = block {
+ final core::Set<core::List<core::int>> #t235 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t236 in <core::List<core::int>>[<core::int>[]])
+ #t235.{core::Set::add}(#t236);
+ #t235.{core::Set::add}(null);
+ } =>#t235;
+ core::Map<core::String, core::List<core::int>> map40 = block {
+ final core::Map<core::String, core::List<core::int>> #t237 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t238 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t237.{core::Map::[]=}(#t238.{core::MapEntry::key}, #t238.{core::MapEntry::value});
+ #t237.{core::Map::[]=}("baz", null);
+ } =>#t237;
+ core::List<core::List<core::int>> list41 = block {
+ final core::List<core::List<core::int>> #t239 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t240 in let final core::Set<core::List<core::int>> #t241 = col::LinkedHashSet::•<core::List<core::int>>() in let final dynamic #t242 = #t241.{core::Set::add}(<core::int>[]) in #t241)
+ #t239.{core::List::add}(#t240);
+ } =>#t239;
+ core::Set<core::List<core::int>> set41 = block {
+ final core::Set<core::List<core::int>> #t243 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t244 in let final core::Set<core::List<core::int>> #t245 = col::LinkedHashSet::•<core::List<core::int>>() in let final dynamic #t246 = #t245.{core::Set::add}(<core::int>[]) in #t245)
+ #t243.{core::Set::add}(#t244);
+ #t243.{core::Set::add}(null);
+ } =>#t243;
+ core::List<core::List<core::int>> list42 = block {
+ final core::List<core::List<core::int>> #t247 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t248 in <core::List<core::int>>[<core::int>[]])
+ #t247.{core::List::add}(#t248);
+ } =>#t247;
+ core::Set<core::List<core::int>> set42 = block {
+ final core::Set<core::List<core::int>> #t249 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t250 in <core::List<core::int>>[<core::int>[]])
+ #t249.{core::Set::add}(#t250);
+ #t249.{core::Set::add}(null);
+ } =>#t249;
+ core::Map<core::String, core::List<core::int>> map42 = block {
+ final core::Map<core::String, core::List<core::int>> #t251 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t252 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t251.{core::Map::[]=}(#t252.{core::MapEntry::key}, #t252.{core::MapEntry::value});
+ #t251.{core::Map::[]=}("baz", null);
+ } =>#t251;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t253 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t254 in <core::int>[])
+ #t253.{core::List::add}(#t254);
+ } =>#t253;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t255 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t256 in <core::int>[])
+ #t255.{core::Set::add}(#t256);
+ #t255.{core::Set::add}(null);
+ } =>#t255;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t257 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::int> #t258 in <core::String, core::int>{}.{core::Map::entries})
+ #t257.{core::Map::[]=}(#t258.{core::MapEntry::key}, #t258.{core::MapEntry::value});
+ #t257.{core::Map::[]=}("baz", null);
+ } =>#t257;
+ core::List<core::int> list51 = block {
+ final core::List<core::int> #t259 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t260 in let final core::Set<core::int> #t261 = col::LinkedHashSet::•<core::int>() in #t261)
+ #t259.{core::List::add}(#t260);
+ } =>#t259;
+ core::Set<core::int> set51 = block {
+ final core::Set<core::int> #t262 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t263 in let final core::Set<core::int> #t264 = col::LinkedHashSet::•<core::int>() in #t264)
+ #t262.{core::Set::add}(#t263);
+ #t262.{core::Set::add}(null);
+ } =>#t262;
+ core::List<core::int> list52 = block {
+ final core::List<core::int> #t265 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t266 in <core::int>[])
+ #t265.{core::List::add}(#t266);
+ } =>#t265;
+ core::Set<core::int> set52 = block {
+ final core::Set<core::int> #t267 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t268 in <core::int>[])
+ #t267.{core::Set::add}(#t268);
+ #t267.{core::Set::add}(null);
+ } =>#t267;
+ core::List<core::List<core::int>> list60 = block {
+ final core::List<core::List<core::int>> #t269 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t270 in <core::List<core::int>>[<core::int>[]])
+ #t269.{core::List::add}(#t270);
+ } =>#t269;
+ core::Set<core::List<core::int>> set60 = block {
+ final core::Set<core::List<core::int>> #t271 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t272 in <core::List<core::int>>[<core::int>[]])
+ #t271.{core::Set::add}(#t272);
+ #t271.{core::Set::add}(null);
+ } =>#t271;
+ core::Map<core::String, core::List<core::int>> map60 = block {
+ final core::Map<core::String, core::List<core::int>> #t273 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t274 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t273.{core::Map::[]=}(#t274.{core::MapEntry::key}, #t274.{core::MapEntry::value});
+ #t273.{core::Map::[]=}("baz", null);
+ } =>#t273;
+ core::List<core::List<core::int>> list61 = block {
+ final core::List<core::List<core::int>> #t275 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t276 in <core::List<core::int>>[<core::int>[]])
+ #t275.{core::List::add}(#t276);
+ } =>#t275;
+ core::Set<core::List<core::int>> set61 = block {
+ final core::Set<core::List<core::int>> #t277 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t278 in <core::List<core::int>>[<core::int>[]])
+ #t277.{core::Set::add}(#t278);
+ #t277.{core::Set::add}(null);
+ } =>#t277;
+ core::Map<core::String, core::List<core::int>> map61 = block {
+ final core::Map<core::String, core::List<core::int>> #t279 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t280 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t279.{core::Map::[]=}(#t280.{core::MapEntry::key}, #t280.{core::MapEntry::value});
+ #t279.{core::Map::[]=}("baz", null);
+ } =>#t279;
+ core::List<core::List<core::int>> list70 = block {
+ final core::List<core::List<core::int>> #t281 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t281.{core::List::add}(<core::int>[]);
+ } =>#t281;
+ core::Set<core::List<core::int>> set70 = block {
+ final core::Set<core::List<core::int>> #t282 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t282.{core::Set::add}(<core::int>[]);
+ #t282.{core::Set::add}(null);
+ } =>#t282;
+ core::Map<core::String, core::List<core::int>> map70 = block {
+ final core::Map<core::String, core::List<core::int>> #t283 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t283.{core::Map::[]=}("bar", <core::int>[]);
+ #t283.{core::Map::[]=}("baz", null);
+ } =>#t283;
+ core::List<core::List<core::int>> list71 = block {
+ final core::List<core::List<core::int>> #t284 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t284.{core::List::add}(<core::int>[]);
+ } =>#t284;
+ core::Set<core::List<core::int>> set71 = block {
+ final core::Set<core::List<core::int>> #t285 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t285.{core::Set::add}(<core::int>[]);
+ #t285.{core::Set::add}(null);
+ } =>#t285;
+ core::Map<core::String, core::List<core::int>> map71 = block {
+ final core::Map<core::String, core::List<core::int>> #t286 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t286.{core::Map::[]=}("bar", <core::int>[]);
+ #t286.{core::Map::[]=}("baz", null);
+ } =>#t286;
+ core::List<core::num> list80 = block {
+ final core::List<core::num> #t287 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t287.{core::List::add}(42);
+ else
+ #t287.{core::List::add}(3.14);
+ } =>#t287;
+ core::Set<core::num> set80 = block {
+ final core::Set<core::num> #t288 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t288.{core::Set::add}(42);
+ else
+ #t288.{core::Set::add}(3.14);
+ #t288.{core::Set::add}(null);
+ } =>#t288;
+ core::Map<core::String, core::num> map80 = block {
+ final core::Map<core::String, core::num> #t289 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t289.{core::Map::[]=}("bar", 42);
+ else
+ #t289.{core::Map::[]=}("bar", 3.14);
+ #t289.{core::Map::[]=}("baz", null);
+ } =>#t289;
+ core::List<core::num> list81 = block {
+ final core::List<core::num> #t290 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t291 in listInt)
+ #t290.{core::List::add}(#t291);
+ else
+ for (final core::num #t292 in listDouble)
+ #t290.{core::List::add}(#t292);
+ } =>#t290;
+ core::Set<core::num> set81 = block {
+ final core::Set<core::num> #t293 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t294 in listInt)
+ #t293.{core::Set::add}(#t294);
+ else
+ for (final core::num #t295 in listDouble)
+ #t293.{core::Set::add}(#t295);
+ #t293.{core::Set::add}(null);
+ } =>#t293;
+ core::Map<core::String, core::num> map81 = block {
+ final core::Map<core::String, core::num> #t296 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t297 in mapStringInt.{core::Map::entries})
+ #t296.{core::Map::[]=}(#t297.{core::MapEntry::key}, #t297.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<core::String, core::num> #t298 in mapStringDouble.{core::Map::entries})
+ #t296.{core::Map::[]=}(#t298.{core::MapEntry::key}, #t298.{core::MapEntry::value});
+ #t296.{core::Map::[]=}("baz", null);
+ } =>#t296;
+ core::List<dynamic> list82 = block {
+ final core::List<dynamic> #t299 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t300 in listInt)
+ #t299.{core::List::add}(#t300);
+ else
+ for (final dynamic #t301 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t299.{core::List::add}(#t301);
+ } =>#t299;
+ core::Set<dynamic> set82 = block {
+ final core::Set<dynamic> #t302 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t303 in listInt)
+ #t302.{core::Set::add}(#t303);
+ else
+ for (final dynamic #t304 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t302.{core::Set::add}(#t304);
+ #t302.{core::Set::add}(null);
+ } =>#t302;
+ core::Map<dynamic, dynamic> map82 = block {
+ final core::Map<dynamic, dynamic> #t305 = <dynamic, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<dynamic, dynamic> #t306 in mapStringInt.{core::Map::entries})
+ #t305.{core::Map::[]=}(#t306.{core::MapEntry::key}, #t306.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<dynamic, dynamic> #t307 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
+ #t305.{core::Map::[]=}(#t307.{core::MapEntry::key}, #t307.{core::MapEntry::value});
+ #t305.{core::Map::[]=}("baz", null);
+ } =>#t305;
+ core::List<core::num> list83 = block {
+ final core::List<core::num> #t308 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t308.{core::List::add}(42);
+ else
+ for (final core::num #t309 in listDouble)
+ #t308.{core::List::add}(#t309);
+ } =>#t308;
+ core::Set<core::num> set83 = block {
+ final core::Set<core::num> #t310 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t311 in listInt)
+ #t310.{core::Set::add}(#t311);
+ else
+ #t310.{core::Set::add}(3.14);
+ #t310.{core::Set::add}(null);
+ } =>#t310;
+ core::Map<core::String, core::num> map83 = block {
+ final core::Map<core::String, core::num> #t312 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t313 in mapStringInt.{core::Map::entries})
+ #t312.{core::Map::[]=}(#t313.{core::MapEntry::key}, #t313.{core::MapEntry::value});
+ else
+ #t312.{core::Map::[]=}("bar", 3.14);
+ #t312.{core::Map::[]=}("baz", null);
+ } =>#t312;
+ core::List<core::int> list90 = block {
+ final core::List<core::int> #t314 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t314.{core::List::add}(dynVar as{TypeError} core::int);
+ } =>#t314;
+ core::Set<core::int> set90 = block {
+ final core::Set<core::int> #t315 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t315.{core::Set::add}(dynVar as{TypeError} core::int);
+ #t315.{core::Set::add}(null);
+ } =>#t315;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t316 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t316.{core::Map::[]=}("bar", dynVar as{TypeError} core::int);
+ #t316.{core::Map::[]=}("baz", null);
+ } =>#t316;
+ core::List<core::int> list91 = block {
+ final core::List<core::int> #t317 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t318 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t319 = #t318 as{TypeError} core::int;
+ #t317.{core::List::add}(#t319);
+ }
+ } =>#t317;
+ core::Set<core::int> set91 = block {
+ final core::Set<core::int> #t320 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t321 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t322 = #t321 as{TypeError} core::int;
+ #t320.{core::Set::add}(#t322);
+ }
+ #t320.{core::Set::add}(null);
+ } =>#t320;
+ core::Map<core::String, core::int> map91 = block {
+ final core::Map<core::String, core::int> #t323 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<dynamic, dynamic> #t324 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::String #t325 = #t324.{core::MapEntry::key} as{TypeError} core::String;
+ final core::int #t326 = #t324.{core::MapEntry::value} as{TypeError} core::int;
+ #t323.{core::Map::[]=}(#t325, #t326);
+ }
+ #t323.{core::Map::[]=}("baz", null);
+ } =>#t323;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t327 = <core::int>[];
+ for (final core::int #t328 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t327.{core::List::add}(42);
+ } =>#t327;
+ core::Set<core::int> set100 = block {
+ final core::Set<core::int> #t329 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t330 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t329.{core::Set::add}(42);
+ } =>#t329;
+ core::Map<core::String, core::int> map100 = block {
+ final core::Map<core::String, core::int> #t331 = <core::String, core::int>{};
+ for (final core::int #t332 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t331.{core::Map::[]=}("bar", 42);
+ } =>#t331;
+ core::List<core::int> list110 = block {
+ final core::List<core::int> #t333 = <core::int>[];
+ for (core::int i in <core::int>[1, 2, 3])
+ #t333.{core::List::add}(i);
+ } =>#t333;
+ core::Set<core::int> set110 = block {
+ final core::Set<core::int> #t334 = col::LinkedHashSet::•<core::int>();
+ for (core::int i in <core::int>[1, 2, 3])
+ #t334.{core::Set::add}(i);
+ #t334.{core::Set::add}(null);
+ } =>#t334;
+ core::Map<core::String, core::int> map110 = block {
+ final core::Map<core::String, core::int> #t335 = <core::String, core::int>{};
+ for (core::int i in <core::int>[1, 2, 3])
+ #t335.{core::Map::[]=}("bar", i);
+ #t335.{core::Map::[]=}("baz", null);
+ } =>#t335;
+ core::List<core::int> list120 = block {
+ final core::List<core::int> #t336 = <core::int>[];
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t336.{core::List::add}(i as{TypeError} core::int);
+ } =>#t336;
+ core::Set<core::int> set120 = block {
+ final core::Set<core::int> #t337 = col::LinkedHashSet::•<core::int>();
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t337.{core::Set::add}(i as{TypeError} core::int);
+ #t337.{core::Set::add}(null);
+ } =>#t337;
+ core::Map<core::String, core::int> map120 = block {
+ final core::Map<core::String, core::int> #t338 = <core::String, core::int>{};
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t338.{core::Map::[]=}("bar", i as{TypeError} core::int);
+ #t338.{core::Map::[]=}("baz", null);
+ } =>#t338;
+ core::List<core::int> list130 = block {
+ final core::List<core::int> #t339 = <core::int>[];
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t339.{core::List::add}(i);
+ } =>#t339;
+ core::Set<core::int> set130 = block {
+ final core::Set<core::int> #t340 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t340.{core::Set::add}(i);
+ } =>#t340;
+ core::Map<core::int, core::int> map130 = block {
+ final core::Map<core::int, core::int> #t341 = <core::int, core::int>{};
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t341.{core::Map::[]=}(i, i);
+ } =>#t341;
+}
+static method testForElementErrors(core::Map<core::int, core::int> map, core::List<core::int> list) → dynamic async {
+ block {
+ final core::List<core::int> #t342 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t342.{core::List::add}(let final<BottomType> #t343 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:210:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) \"bar\"];
+ ^" in "bar" as{TypeError} core::int);
+ } =>#t342;
+ block {
+ final core::Set<core::int> #t344 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t344.{core::Set::add}(let final<BottomType> #t345 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:211:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\", null};
+ ^" in "bar" as{TypeError} core::int);
+ #t344.{core::Set::add}(null);
+ } =>#t344;
+ block {
+ final core::Map<core::int, core::int> #t346 = <core::int, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t346.{core::Map::[]=}(let final<BottomType> #t347 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:50: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int, let final<BottomType> #t348 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int);
+ #t346.{core::Map::[]=}(let final<BottomType> #t349 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "baz" as{TypeError} core::int, null);
+ } =>#t346;
+ block {
+ final core::List<core::int> #t350 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t351 in <core::int>[let final<BottomType> #t352 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:213:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) ...[\"bar\"]];
+ ^" in "bar" as{TypeError} core::int])
+ #t350.{core::List::add}(#t351);
+ } =>#t350;
+ block {
+ final core::Set<core::int> #t353 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t354 in <core::int>[let final<BottomType> #t355 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:214:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) ...[\"bar\"], null};
+ ^" in "bar" as{TypeError} core::int])
+ #t353.{core::Set::add}(#t354);
+ #t353.{core::Set::add}(null);
+ } =>#t353;
+ block {
+ final core::Map<core::int, core::int> #t356 = <core::int, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::int, core::int> #t357 in <core::int, core::int>{let final<BottomType> #t358 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:54: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int: let final<BottomType> #t359 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:61: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int}.{core::Map::entries})
+ #t356.{core::Map::[]=}(#t357.{core::MapEntry::key}, #t357.{core::MapEntry::value});
+ #t356.{core::Map::[]=}(let final<BottomType> #t360 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:69: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "baz" as{TypeError} core::int, null);
+ } =>#t356;
+ block {
+ final core::List<core::int> #t361 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t361.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:216:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) ...map];
+ ^");
+ } =>#t361;
+ block {
+ final core::Set<core::int> #t362 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t362.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:217:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) ...map, null};
+ ^");
+ #t362.{core::Set::add}(null);
+ } =>#t362;
+ <core::int, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...list, 42: null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...list, 42: null};
+ ^": null};
+ block {
+ final core::List<core::String> #t363 = <core::String>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t363.{core::List::add}(let final<BottomType> #t364 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:219:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14];
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t363.{core::List::add}(let final<BottomType> #t365 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:219:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14];
+ ^" in 3.14 as{TypeError} core::String);
+ } =>#t363;
+ block {
+ final core::Set<core::String> #t366 = col::LinkedHashSet::•<core::String>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t366.{core::Set::add}(let final<BottomType> #t367 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:220:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14, null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t366.{core::Set::add}(let final<BottomType> #t368 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:220:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14, null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t366.{core::Set::add}(null);
+ } =>#t366;
+ block {
+ final core::Map<core::String, core::String> #t369 = <core::String, core::String>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t369.{core::Map::[]=}("bar", let final<BottomType> #t370 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:221:77: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else \"bar\": 3.14, \"baz\": null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t369.{core::Map::[]=}("bar", let final<BottomType> #t371 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:221:92: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else \"bar\": 3.14, \"baz\": null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t369.{core::Map::[]=}("baz", null);
+ } =>#t369;
+ block {
+ final core::List<core::int> #t372 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t372.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:222:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...map else 42];
+ ^");
+ else
+ #t372.{core::List::add}(42);
+ } =>#t372;
+ block {
+ final core::Set<core::int> #t373 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t373.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:223:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...map else 42, null};
+ ^");
+ else
+ #t373.{core::Set::add}(42);
+ #t373.{core::Set::add}(null);
+ } =>#t373;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...list else \"bar\": 42, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...list else \"bar\": 42, \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::int> #t374 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t374.{core::List::add}(42);
+ else
+ #t374.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:225:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else ...map];
+ ^");
+ } =>#t374;
+ block {
+ final core::Set<core::int> #t375 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t375.{core::Set::add}(42);
+ else
+ #t375.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:226:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else ...map, null};
+ ^");
+ #t375.{core::Set::add}(null);
+ } =>#t375;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else ...list, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else ...list, \"baz\": null};
+ ^": null};
+ final core::int i = 0;
+ block {
+ final core::List<core::int> #t376 = <core::int>[];
+ for (final core::int #t377 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:230:14: Error: Setter not found: 'i'.
+ <int>[for (i in <int>[1]) i];
+ ^";
+ #t376.{core::List::add}(i);
+ }
+ } =>#t376;
+ block {
+ final core::Set<core::int> #t378 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t379 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:231:14: Error: Setter not found: 'i'.
+ <int>{for (i in <int>[1]) i, null};
+ ^";
+ #t378.{core::Set::add}(i);
+ }
+ #t378.{core::Set::add}(null);
+ } =>#t378;
+ block {
+ final core::Map<core::String, core::int> #t380 = <core::String, core::int>{};
+ for (final core::int #t381 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:232:21: Error: Setter not found: 'i'.
+\t<String, int>{for (i in <int>[1]) \"bar\": i, \"baz\": null};
+\t ^";
+ #t380.{core::Map::[]=}("bar", i);
+ }
+ #t380.{core::Map::[]=}("baz", null);
+ } =>#t380;
+ core::List<dynamic> list10 = block {
+ final core::List<dynamic> #t382 = <dynamic>[];
+ for (dynamic i in let final<BottomType> #t383 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:234:31: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var list10 = [for (var i in \"not iterable\") i];
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t382.{core::List::add}(i);
+ } =>#t382;
+ core::Set<dynamic> set10 = block {
+ final core::Set<dynamic> #t384 = col::LinkedHashSet::•<dynamic>();
+ for (dynamic i in let final<BottomType> #t385 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:235:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var set10 = {for (var i in \"not iterable\") i, null};
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t384.{core::Set::add}(i);
+ #t384.{core::Set::add}(null);
+ } =>#t384;
+ core::Map<core::String, dynamic> map10 = block {
+ final core::Map<core::String, dynamic> #t386 = <core::String, dynamic>{};
+ for (dynamic i in let final<BottomType> #t387 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:236:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var map10 = {for (var i in \"not iterable\") \"bar\": i, \"baz\": null};
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t386.{core::Map::[]=}("bar", i);
+ #t386.{core::Map::[]=}("baz", null);
+ } =>#t386;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t388 = <core::int>[];
+ for (core::int i in <core::int>[let final<BottomType> #t389 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:237:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list20 = [for (int i in [\"not\", \"int\"]) i];
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t390 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:237:39: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list20 = [for (int i in [\"not\", \"int\"]) i];
+ ^" in "int" as{TypeError} core::int])
+ #t388.{core::List::add}(i);
+ } =>#t388;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t391 = col::LinkedHashSet::•<core::int>();
+ for (core::int i in <core::int>[let final<BottomType> #t392 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:238:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set20 = {for (int i in [\"not\", \"int\"]) i, null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t393 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:238:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set20 = {for (int i in [\"not\", \"int\"]) i, null};
+ ^" in "int" as{TypeError} core::int])
+ #t391.{core::Set::add}(i);
+ #t391.{core::Set::add}(null);
+ } =>#t391;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t394 = <core::String, core::int>{};
+ for (core::int i in <core::int>[let final<BottomType> #t395 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:239:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map20 = {for (int i in [\"not\", \"int\"]) \"bar\": i, \"baz\": null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t396 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:239:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map20 = {for (int i in [\"not\", \"int\"]) \"bar\": i, \"baz\": null};
+ ^" in "int" as{TypeError} core::int])
+ #t394.{core::Map::[]=}("bar", i);
+ #t394.{core::Map::[]=}("baz", null);
+ } =>#t394;
+ core::List<dynamic> list30 = block {
+ final core::List<dynamic> #t397 = <dynamic>[];
+ await for (dynamic i in let final<BottomType> #t398 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:240:37: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var list30 = [await for (var i in \"not stream\") i];
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>)
+ #t397.{core::List::add}(i);
+ } =>#t397;
+ core::Set<dynamic> set30 = block {
+ final core::Set<dynamic> #t399 = col::LinkedHashSet::•<dynamic>();
+ await for (dynamic i in let final<BottomType> #t400 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:241:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var set30 = {await for (var i in \"not stream\") i, null};
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>)
+ #t399.{core::Set::add}(i);
+ #t399.{core::Set::add}(null);
+ } =>#t399;
+ core::Map<core::String, dynamic> map30 = block {
+ final core::Map<core::String, dynamic> #t401 = <core::String, dynamic>{};
+ await for (dynamic i in let final<BottomType> #t402 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:242:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var map30 = {await for (var i in \"not stream\") \"bar\": i, \"baz\": null};
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>)
+ #t401.{core::Map::[]=}("bar", i);
+ #t401.{core::Map::[]=}("baz", null);
+ } =>#t401;
+ core::List<core::int> list40 = block {
+ final core::List<core::int> #t403 = <core::int>[];
+ await for (core::int i in asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t404 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:243:58: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list40 = [await for (int i in Stream.fromIterable([\"not\", \"int\"])) i];
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t405 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:243:65: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list40 = [await for (int i in Stream.fromIterable([\"not\", \"int\"])) i];
+ ^" in "int" as{TypeError} core::int]))
+ #t403.{core::List::add}(i);
+ } =>#t403;
+ core::Set<core::int> set40 = block {
+ final core::Set<core::int> #t406 = col::LinkedHashSet::•<core::int>();
+ await for (core::int i in asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t407 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:244:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) i, null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t408 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:244:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) i, null};
+ ^" in "int" as{TypeError} core::int]))
+ #t406.{core::Set::add}(i);
+ #t406.{core::Set::add}(null);
+ } =>#t406;
+ core::Map<core::String, core::int> map40 = block {
+ final core::Map<core::String, core::int> #t409 = <core::String, core::int>{};
+ await for (core::int i in asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t410 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:245:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) \"bar\": i, \"baz\": null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t411 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:245:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) \"bar\": i, \"baz\": null};
+ ^" in "int" as{TypeError} core::int]))
+ #t409.{core::Map::[]=}("bar", i);
+ #t409.{core::Map::[]=}("baz", null);
+ } =>#t409;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t412 = <core::int>[];
+ for (; ; )
+ #t412.{core::List::add}(42);
+ } =>#t412;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t413 = col::LinkedHashSet::•<core::int>();
+ for (; ; )
+ #t413.{core::Set::add}(42);
+ #t413.{core::Set::add}(null);
+ } =>#t413;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t414 = <core::String, core::int>{};
+ for (; ; )
+ #t414.{core::Map::[]=}("bar", 42);
+ #t414.{core::Map::[]=}("baz", null);
+ } =>#t414;
+ core::List<core::int> list60 = block {
+ final core::List<core::int> #t415 = <core::int>[];
+ for (; let final<BottomType> #t416 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:249:24: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var list60 = [for (; \"not bool\";) 42];
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t415.{core::List::add}(42);
+ } =>#t415;
+ core::Set<core::int> set60 = block {
+ final core::Set<core::int> #t417 = col::LinkedHashSet::•<core::int>();
+ for (; let final<BottomType> #t418 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:250:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var set60 = {for (; \"not bool\";) 42, null};
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t417.{core::Set::add}(42);
+ #t417.{core::Set::add}(null);
+ } =>#t417;
+ core::Map<core::String, core::int> map60 = block {
+ final core::Map<core::String, core::int> #t419 = <core::String, core::int>{};
+ for (; let final<BottomType> #t420 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:251:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var map60 = {for (; \"not bool\";) \"bar\": 42, \"baz\": null};
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t419.{core::Map::[]=}("bar", 42);
+ #t419.{core::Map::[]=}("baz", null);
+ } =>#t419;
+}
+static method testForElementErrorsNotAsync(asy::Stream<core::int> stream) → dynamic {
+ block {
+ final core::List<core::int> #t421 = <core::int>[];
+ await for (core::int i in stream)
+ #t421.{core::List::add}(i);
+ } =>#t421;
+ block {
+ final core::Set<core::int> #t422 = col::LinkedHashSet::•<core::int>();
+ await for (core::int i in stream)
+ #t422.{core::Set::add}(i);
+ } =>#t422;
+ block {
+ final core::Map<core::String, core::int> #t423 = <core::String, core::int>{};
+ await for (core::int i in stream)
+ #t423.{core::Map::[]=}("bar", i);
+ } =>#t423;
+}
+static method testPromotion(self::A a) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t424 = <core::int>[];
+ if(a is self::B)
+ #t424.{core::List::add}(a{self::B}.{self::B::foo});
+ } =>#t424;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t425 = col::LinkedHashSet::•<core::int>();
+ if(a is self::B)
+ #t425.{core::Set::add}(a{self::B}.{self::B::foo});
+ } =>#t425;
+ core::Map<core::int, core::int> map10 = block {
+ final core::Map<core::int, core::int> #t426 = <core::int, core::int>{};
+ if(a is self::B)
+ #t426.{core::Map::[]=}(a{self::B}.{self::B::foo}, a{self::B}.{self::B::foo});
+ } =>#t426;
+}
+static method main() → dynamic {}
diff --git a/front_end/testcases/control_flow_collection_inference.dart.strong.transformed.expect b/front_end/testcases/control_flow_collection_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..3c4ea93
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.strong.transformed.expect
@@ -0,0 +1,2464 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:39:34: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Map<String, List<int>> map40 = {if (oracle("foo")) ...{"bar", []}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:71:38: Error: Unexpected type 'Map<String, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// var map82 = {if (oracle("foo")) ...mapToInt else ...dynVar, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:44: Error: Expected ':' after this.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:107:53: Error: Expected ':' after this.
+// Map<dynamic, dynamic> map10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:61: Error: Expected ':' after this.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:109:70: Error: Expected ':' after this.
+// Map<dynamic, dynamic> map11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:110:35: Error: Expected ':' after this.
+// var map12 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:111:52: Error: Expected ':' after this.
+// var map13 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:87:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[if (oracle("foo")) "bar"];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:88:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{if (oracle("foo")) "bar", null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:89:43: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <String, int>{if (oracle("foo")) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:90:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[if (oracle("foo")) ...["bar"]];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:91:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{if (oracle("foo")) ...["bar"], null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:92:47: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <String, int>{if (oracle("foo")) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:93:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:94:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) ...["bar"], "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:96:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[if (oracle("foo")) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:97:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{if (oracle("foo")) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:46: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:98:61: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{if (oracle("foo")) "bar": 42 else "baz": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:99:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) ...map else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:100:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) ...[42] else "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:102:39: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[if (oracle("foo")) 42 else ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:103:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{if (oracle("foo")) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{if (oracle("foo")) "bar": 42 else ...[42], "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:106:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Set<dynamic> set10 = {if (oracle("foo")) 42 else "bar": 3.14};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:108:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// Set<dynamic> set11 = {if (oracle("foo")) "bar": 3.14 else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:112:27: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// List<int> list20 = [if (42) 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:113:25: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// Set<int> set20 = {if (42) 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:114:30: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// Map<int, int> map30 = {if (42) 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:53: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:115:63: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// List<String> list40 = <String>[if (oracle("foo")) true else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:51: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:116:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Set<String> set40 = <String>{if (oracle("foo")) true else 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:61: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:117:75: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<String, int> map40 = <String, int>{if (oracle("foo")) true: 42 else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:65: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:118:79: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// Map<int, String> map41 = <int, String>{if (oracle("foo")) 42: true else 42: 42};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:230:14: Error: Setter not found: 'i'.
+// <int>[for (i in <int>[1]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:231:14: Error: Setter not found: 'i'.
+// <int>{for (i in <int>[1]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:232:21: Error: Setter not found: 'i'.
+// <String, int>{for (i in <int>[1]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:246:17: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var list50 = [await for (;;) 42];
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:247:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var set50 = {await for (;;) 42, null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:248:16: Error: The keyword 'await' isn't allowed for a normal 'for' statement.
+// Try removing the keyword, or use a for-each statement.
+// var map50 = {await for (;;) "bar": 42, "baz": null};
+// ^^^^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:210:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:211:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:50: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:212:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:213:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:214:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:54: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:61: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:215:69: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:216:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:217:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:219:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:220:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:77: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:221:92: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+// Try changing the type of the left hand side, or casting the right hand side to 'String'.
+// <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:222:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:223:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:225:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:226:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+// - 'List' is from 'dart:core'.
+// <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:234:31: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var list10 = [for (var i in "not iterable") i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:235:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var set10 = {for (var i in "not iterable") i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:236:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// - 'Iterable' is from 'dart:core'.
+// var map10 = {for (var i in "not iterable") "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:237:39: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list20 = [for (int i in ["not", "int"]) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:238:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set20 = {for (int i in ["not", "int"]) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:239:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map20 = {for (int i in ["not", "int"]) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:240:37: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var list30 = [await for (var i in "not stream") i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:241:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var set30 = {await for (var i in "not stream") i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:242:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// - 'Stream' is from 'dart:async'.
+// var map30 = {await for (var i in "not stream") "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:58: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:243:65: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var list40 = [await for (int i in Stream.fromIterable(["not", "int"])) i];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:244:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var set40 = {await for (int i in Stream.fromIterable(["not", "int"])) i, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:245:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// Try changing the type of the left hand side, or casting the right hand side to 'int'.
+// var map40 = {await for (int i in Stream.fromIterable(["not", "int"])) "bar": i, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:249:24: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var list60 = [for (; "not bool";) 42];
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:250:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var set60 = {for (; "not bool";) 42, null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:251:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+// Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+// var map60 = {for (; "not bool";) "bar": 42, "baz": null};
+// ^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:255:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>[await for (int i in stream) i];
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:256:26: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <int>{await for (int i in stream) i};
+// ^^
+//
+// pkg/front_end/testcases/control_flow_collection_inference.dart:257:34: Error: The asynchronous for-in can only be used in functions marked with 'async' or 'async*'.
+// Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for loop.
+// <String, int>{await for (int i in stream) "bar": i};
+// ^^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get foo() → core::int
+ return 42;
+}
+static method oracle<T extends core::Object = dynamic>([self::oracle::T t = null]) → dynamic
+ return true;
+static method testIfElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::Map<core::String, core::int> mapToInt, core::Map<core::String, core::double> mapToDouble) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t1 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t1.{core::List::add}(42);
+ } =>#t1;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t2.{core::Set::add}(42);
+ #t2.{core::Set::add}(null);
+ } =>#t2;
+ core::Map<core::String, core::int> map10 = block {
+ final core::Map<core::String, core::int> #t3 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t3.{core::Map::[]=}("bar", 42);
+ #t3.{core::Map::[]=}("baz", null);
+ } =>#t3;
+ core::List<dynamic> list11 = block {
+ final core::List<dynamic> #t4 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t4.{core::List::add}(dynVar);
+ } =>#t4;
+ core::Set<dynamic> set11 = block {
+ final core::Set<dynamic> #t5 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t5.{core::Set::add}(dynVar);
+ #t5.{core::Set::add}(null);
+ } =>#t5;
+ core::Map<core::String, dynamic> map11 = block {
+ final core::Map<core::String, dynamic> #t6 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t6.{core::Map::[]=}("bar", dynVar);
+ #t6.{core::Map::[]=}("baz", null);
+ } =>#t6;
+ core::List<core::List<core::int>> list12 = block {
+ final core::List<core::List<core::int>> #t7 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t7.{core::List::add}(<core::int>[42]);
+ } =>#t7;
+ core::Set<core::List<core::int>> set12 = block {
+ final core::Set<core::List<core::int>> #t8 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t8.{core::Set::add}(<core::int>[42]);
+ #t8.{core::Set::add}(null);
+ } =>#t8;
+ core::Map<core::String, core::List<core::int>> map12 = block {
+ final core::Map<core::String, core::List<core::int>> #t9 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t9.{core::Map::[]=}("bar", <core::int>[42]);
+ #t9.{core::Map::[]=}("baz", null);
+ } =>#t9;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t10 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t11 in <core::int>[42])
+ #t10.{core::List::add}(#t11);
+ } =>#t10;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t12 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t13 in <core::int>[42])
+ #t12.{core::Set::add}(#t13);
+ #t12.{core::Set::add}(null);
+ } =>#t12;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t14 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t15 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t14.{core::Map::[]=}(#t15.{core::MapEntry::key}, #t15.{core::MapEntry::value});
+ #t14.{core::Map::[]=}("baz", null);
+ } =>#t14;
+ core::List<dynamic> list21 = block {
+ final core::List<dynamic> #t16 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t17 in <dynamic>[dynVar])
+ #t16.{core::List::add}(#t17);
+ } =>#t16;
+ core::Set<dynamic> set21 = block {
+ final core::Set<dynamic> #t18 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t19 in <dynamic>[dynVar])
+ #t18.{core::Set::add}(#t19);
+ #t18.{core::Set::add}(null);
+ } =>#t18;
+ core::Map<core::String, dynamic> map21 = block {
+ final core::Map<core::String, dynamic> #t20 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t21 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t20.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
+ #t20.{core::Map::[]=}("baz", null);
+ } =>#t20;
+ core::List<core::List<core::int>> list22 = block {
+ final core::List<core::List<core::int>> #t22 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t23 in <core::List<core::int>>[<core::int>[42]])
+ #t22.{core::List::add}(#t23);
+ } =>#t22;
+ core::Set<core::List<core::int>> set22 = block {
+ final core::Set<core::List<core::int>> #t24 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t25 in <core::List<core::int>>[<core::int>[42]])
+ #t24.{core::Set::add}(#t25);
+ #t24.{core::Set::add}(null);
+ } =>#t24;
+ core::Map<core::String, core::List<core::int>> map22 = block {
+ final core::Map<core::String, core::List<core::int>> #t26 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t27 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t26.{core::Map::[]=}(#t27.{core::MapEntry::key}, #t27.{core::MapEntry::value});
+ #t26.{core::Map::[]=}("baz", null);
+ } =>#t26;
+ core::List<core::int> list30 = block {
+ final core::List<core::int> #t28 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t29 in <core::int>[42])
+ #t28.{core::List::add}(#t29);
+ } =>#t28;
+ core::Set<core::int> set30 = block {
+ final core::Set<core::int> #t30 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t31 in <core::int>[42])
+ #t30.{core::Set::add}(#t31);
+ #t30.{core::Set::add}(null);
+ } =>#t30;
+ core::Map<core::String, core::int> map30 = block {
+ final core::Map<core::String, core::int> #t32 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t33 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t32.{core::Map::[]=}(#t33.{core::MapEntry::key}, #t33.{core::MapEntry::value});
+ #t32.{core::Map::[]=}("baz", null);
+ } =>#t32;
+ core::List<dynamic> list31 = block {
+ final core::List<dynamic> #t34 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t35 in <dynamic>[dynVar])
+ #t34.{core::List::add}(#t35);
+ } =>#t34;
+ core::Set<dynamic> set31 = block {
+ final core::Set<dynamic> #t36 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t37 in <dynamic>[dynVar])
+ #t36.{core::Set::add}(#t37);
+ #t36.{core::Set::add}(null);
+ } =>#t36;
+ core::Map<core::String, dynamic> map31 = block {
+ final core::Map<core::String, dynamic> #t38 = <core::String, dynamic>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t39 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t38.{core::Map::[]=}(#t39.{core::MapEntry::key}, #t39.{core::MapEntry::value});
+ #t38.{core::Map::[]=}("baz", null);
+ } =>#t38;
+ core::List<core::List<core::int>> list33 = block {
+ final core::List<core::List<core::int>> #t40 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t41 in <core::List<core::int>>[<core::int>[42]])
+ #t40.{core::List::add}(#t41);
+ } =>#t40;
+ core::Set<core::List<core::int>> set33 = block {
+ final core::Set<core::List<core::int>> #t42 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t43 in <core::List<core::int>>[<core::int>[42]])
+ #t42.{core::Set::add}(#t43);
+ #t42.{core::Set::add}(null);
+ } =>#t42;
+ core::Map<core::String, core::List<core::int>> map33 = block {
+ final core::Map<core::String, core::List<core::int>> #t44 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t45 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t44.{core::Map::[]=}(#t45.{core::MapEntry::key}, #t45.{core::MapEntry::value});
+ #t44.{core::Map::[]=}("baz", null);
+ } =>#t44;
+ core::List<core::List<core::int>> list40 = block {
+ final core::List<core::List<core::int>> #t46 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t47 in <core::List<core::int>>[<core::int>[]])
+ #t46.{core::List::add}(#t47);
+ } =>#t46;
+ core::Set<core::List<core::int>> set40 = block {
+ final core::Set<core::List<core::int>> #t48 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t49 in <core::List<core::int>>[<core::int>[]])
+ #t48.{core::Set::add}(#t49);
+ #t48.{core::Set::add}(null);
+ } =>#t48;
+ core::Map<core::String, core::List<core::int>> map40 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:39:34: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Map<String, List<int>> map40 = {if (oracle(\"foo\")) ...{\"bar\", []}, \"baz\": null};
+ ^";
+ core::List<core::List<core::int>> list41 = block {
+ final core::List<core::List<core::int>> #t50 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t51 in let final core::Set<core::List<core::int>> #t52 = col::LinkedHashSet::•<core::List<core::int>>() in let final core::bool #t53 = #t52.{core::Set::add}(<core::int>[]) in #t52)
+ #t50.{core::List::add}(#t51);
+ } =>#t50;
+ core::Set<core::List<core::int>> set41 = block {
+ final core::Set<core::List<core::int>> #t54 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t55 in let final core::Set<core::List<core::int>> #t56 = col::LinkedHashSet::•<core::List<core::int>>() in let final core::bool #t57 = #t56.{core::Set::add}(<core::int>[]) in #t56)
+ #t54.{core::Set::add}(#t55);
+ #t54.{core::Set::add}(null);
+ } =>#t54;
+ core::List<core::List<core::int>> list42 = block {
+ final core::List<core::List<core::int>> #t58 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t59 in <core::List<core::int>>[<core::int>[]])
+ #t58.{core::List::add}(#t59);
+ } =>#t58;
+ core::Set<core::List<core::int>> set42 = block {
+ final core::Set<core::List<core::int>> #t60 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t61 in <core::List<core::int>>[<core::int>[]])
+ #t60.{core::Set::add}(#t61);
+ #t60.{core::Set::add}(null);
+ } =>#t60;
+ core::Map<core::String, core::List<core::int>> map42 = block {
+ final core::Map<core::String, core::List<core::int>> #t62 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t63 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t62.{core::Map::[]=}(#t63.{core::MapEntry::key}, #t63.{core::MapEntry::value});
+ #t62.{core::Map::[]=}("baz", null);
+ } =>#t62;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t64 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t65 in <core::int>[])
+ #t64.{core::List::add}(#t65);
+ } =>#t64;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t66 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t67 in <core::int>[])
+ #t66.{core::Set::add}(#t67);
+ #t66.{core::Set::add}(null);
+ } =>#t66;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t68 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t69 in <core::String, core::int>{}.{core::Map::entries})
+ #t68.{core::Map::[]=}(#t69.{core::MapEntry::key}, #t69.{core::MapEntry::value});
+ #t68.{core::Map::[]=}("baz", null);
+ } =>#t68;
+ core::List<core::int> list51 = block {
+ final core::List<core::int> #t70 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t71 in let final core::Set<core::int> #t72 = col::LinkedHashSet::•<core::int>() in #t72)
+ #t70.{core::List::add}(#t71);
+ } =>#t70;
+ core::Set<core::int> set51 = block {
+ final core::Set<core::int> #t73 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t74 in let final core::Set<core::int> #t75 = col::LinkedHashSet::•<core::int>() in #t75)
+ #t73.{core::Set::add}(#t74);
+ #t73.{core::Set::add}(null);
+ } =>#t73;
+ core::List<core::int> list52 = block {
+ final core::List<core::int> #t76 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t77 in <core::int>[])
+ #t76.{core::List::add}(#t77);
+ } =>#t76;
+ core::Set<core::int> set52 = block {
+ final core::Set<core::int> #t78 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t79 in <core::int>[])
+ #t78.{core::Set::add}(#t79);
+ #t78.{core::Set::add}(null);
+ } =>#t78;
+ core::Map<core::String, core::int> map52 = block {
+ final core::Map<core::String, core::int> #t80 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t81 in <core::String, core::int>{}.{core::Map::entries})
+ #t80.{core::Map::[]=}(#t81.{core::MapEntry::key}, #t81.{core::MapEntry::value});
+ #t80.{core::Map::[]=}("baz", null);
+ } =>#t80;
+ core::List<core::List<core::int>> list60 = block {
+ final core::List<core::List<core::int>> #t82 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t83 in <core::List<core::int>>[<core::int>[]])
+ #t82.{core::List::add}(#t83);
+ } =>#t82;
+ core::Set<core::List<core::int>> set60 = block {
+ final core::Set<core::List<core::int>> #t84 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::List<core::int> #t85 in <core::List<core::int>>[<core::int>[]])
+ #t84.{core::Set::add}(#t85);
+ #t84.{core::Set::add}(null);
+ } =>#t84;
+ core::Map<core::String, core::List<core::int>> map60 = block {
+ final core::Map<core::String, core::List<core::int>> #t86 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t87 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t86.{core::Map::[]=}(#t87.{core::MapEntry::key}, #t87.{core::MapEntry::value});
+ #t86.{core::Map::[]=}("baz", null);
+ } =>#t86;
+ core::List<core::List<core::int>> list61 = block {
+ final core::List<core::List<core::int>> #t88 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t89 in <core::List<core::int>>[<core::int>[]])
+ #t88.{core::List::add}(#t89);
+ } =>#t88;
+ core::Set<core::List<core::int>> set61 = block {
+ final core::Set<core::List<core::int>> #t90 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t91 in <core::List<core::int>>[<core::int>[]])
+ #t90.{core::Set::add}(#t91);
+ #t90.{core::Set::add}(null);
+ } =>#t90;
+ core::Map<core::String, core::List<core::int>> map61 = block {
+ final core::Map<core::String, core::List<core::int>> #t92 = <core::String, core::List<core::int>>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t93 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t92.{core::Map::[]=}(#t93.{core::MapEntry::key}, #t93.{core::MapEntry::value});
+ #t92.{core::Map::[]=}("baz", null);
+ } =>#t92;
+ core::List<core::List<core::int>> list70 = block {
+ final core::List<core::List<core::int>> #t94 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t94.{core::List::add}(<core::int>[]);
+ } =>#t94;
+ core::Set<core::List<core::int>> set70 = block {
+ final core::Set<core::List<core::int>> #t95 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t95.{core::Set::add}(<core::int>[]);
+ #t95.{core::Set::add}(null);
+ } =>#t95;
+ core::List<core::List<core::int>> list71 = block {
+ final core::List<core::List<core::int>> #t96 = <core::List<core::int>>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t96.{core::List::add}(<core::int>[]);
+ } =>#t96;
+ core::Set<core::List<core::int>> set71 = block {
+ final core::Set<core::List<core::int>> #t97 = col::LinkedHashSet::•<core::List<core::int>>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t97.{core::Set::add}(<core::int>[]);
+ #t97.{core::Set::add}(null);
+ } =>#t97;
+ core::List<core::num> list80 = block {
+ final core::List<core::num> #t98 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t98.{core::List::add}(42);
+ else
+ #t98.{core::List::add}(3.14);
+ } =>#t98;
+ core::Set<core::num> set80 = block {
+ final core::Set<core::num> #t99 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t99.{core::Set::add}(42);
+ else
+ #t99.{core::Set::add}(3.14);
+ #t99.{core::Set::add}(null);
+ } =>#t99;
+ core::Map<core::String, core::num> map80 = block {
+ final core::Map<core::String, core::num> #t100 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t100.{core::Map::[]=}("bar", 42);
+ else
+ #t100.{core::Map::[]=}("bar", 3.14);
+ #t100.{core::Map::[]=}("baz", null);
+ } =>#t100;
+ core::List<core::num> list81 = block {
+ final core::List<core::num> #t101 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t102 in listInt)
+ #t101.{core::List::add}(#t102);
+ else
+ for (final core::num #t103 in listDouble)
+ #t101.{core::List::add}(#t103);
+ } =>#t101;
+ core::Set<core::num> set81 = block {
+ final core::Set<core::num> #t104 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t105 in listInt)
+ #t104.{core::Set::add}(#t105);
+ else
+ for (final core::num #t106 in listDouble)
+ #t104.{core::Set::add}(#t106);
+ #t104.{core::Set::add}(null);
+ } =>#t104;
+ core::Map<core::String, core::num> map81 = block {
+ final core::Map<core::String, core::num> #t107 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t108 in mapToInt.{core::Map::entries})
+ #t107.{core::Map::[]=}(#t108.{core::MapEntry::key}, #t108.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<core::String, core::num> #t109 in mapToDouble.{core::Map::entries})
+ #t107.{core::Map::[]=}(#t109.{core::MapEntry::key}, #t109.{core::MapEntry::value});
+ #t107.{core::Map::[]=}("baz", null);
+ } =>#t107;
+ core::List<dynamic> list82 = block {
+ final core::List<dynamic> #t110 = <dynamic>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t111 in listInt)
+ #t110.{core::List::add}(#t111);
+ else
+ for (final dynamic #t112 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t110.{core::List::add}(#t112);
+ } =>#t110;
+ core::Set<dynamic> set82 = block {
+ final core::Set<dynamic> #t113 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t114 in listInt)
+ #t113.{core::Set::add}(#t114);
+ else
+ for (final dynamic #t115 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t113.{core::Set::add}(#t115);
+ #t113.{core::Set::add}(null);
+ } =>#t113;
+ core::Set<dynamic> map82 = block {
+ final core::Set<dynamic> #t116 = col::LinkedHashSet::•<dynamic>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t116.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:71:38: Error: Unexpected type 'Map<String, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ var map82 = {if (oracle(\"foo\")) ...mapToInt else ...dynVar, null};
+ ^");
+ else
+ for (final dynamic #t117 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t116.{core::Set::add}(#t117);
+ #t116.{core::Set::add}(null);
+ } =>#t116;
+ core::List<core::num> list83 = block {
+ final core::List<core::num> #t118 = <core::num>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t118.{core::List::add}(42);
+ else
+ for (final core::num #t119 in listDouble)
+ #t118.{core::List::add}(#t119);
+ } =>#t118;
+ core::Set<core::num> set83 = block {
+ final core::Set<core::num> #t120 = col::LinkedHashSet::•<core::num>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::num #t121 in listInt)
+ #t120.{core::Set::add}(#t121);
+ else
+ #t120.{core::Set::add}(3.14);
+ #t120.{core::Set::add}(null);
+ } =>#t120;
+ core::Map<core::String, core::num> map83 = block {
+ final core::Map<core::String, core::num> #t122 = <core::String, core::num>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t123 in mapToInt.{core::Map::entries})
+ #t122.{core::Map::[]=}(#t123.{core::MapEntry::key}, #t123.{core::MapEntry::value});
+ else
+ #t122.{core::Map::[]=}("bar", 3.14);
+ #t122.{core::Map::[]=}("baz", null);
+ } =>#t122;
+ core::List<core::int> list90 = block {
+ final core::List<core::int> #t124 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t124.{core::List::add}(dynVar as{TypeError} core::int);
+ } =>#t124;
+ core::Set<core::int> set90 = block {
+ final core::Set<core::int> #t125 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t125.{core::Set::add}(dynVar as{TypeError} core::int);
+ #t125.{core::Set::add}(null);
+ } =>#t125;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t126 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t126.{core::Map::[]=}("bar", dynVar as{TypeError} core::int);
+ #t126.{core::Map::[]=}("baz", null);
+ } =>#t126;
+ core::List<core::int> list91 = block {
+ final core::List<core::int> #t127 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t128 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t129 = #t128 as{TypeError} core::int;
+ #t127.{core::List::add}(#t129);
+ }
+ } =>#t127;
+ core::Set<core::int> set91 = block {
+ final core::Set<core::int> #t130 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final dynamic #t131 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t132 = #t131 as{TypeError} core::int;
+ #t130.{core::Set::add}(#t132);
+ }
+ #t130.{core::Set::add}(null);
+ } =>#t130;
+ core::Map<core::String, core::int> map91 = block {
+ final core::Map<core::String, core::int> #t133 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<dynamic, dynamic> #t134 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::String #t135 = #t134.{core::MapEntry::key} as{TypeError} core::String;
+ final core::int #t136 = #t134.{core::MapEntry::value} as{TypeError} core::int;
+ #t133.{core::Map::[]=}(#t135, #t136);
+ }
+ #t133.{core::Map::[]=}("baz", null);
+ } =>#t133;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t137 = <core::int>[];
+ if(dynVar as{TypeError} core::bool)
+ #t137.{core::List::add}(42);
+ } =>#t137;
+ core::Set<core::int> set100 = block {
+ final core::Set<core::int> #t138 = col::LinkedHashSet::•<core::int>();
+ if(dynVar as{TypeError} core::bool)
+ #t138.{core::Set::add}(42);
+ } =>#t138;
+ core::Map<core::int, core::int> map100 = block {
+ final core::Map<core::int, core::int> #t139 = <core::int, core::int>{};
+ if(dynVar as{TypeError} core::bool)
+ #t139.{core::Map::[]=}(42, 42);
+ } =>#t139;
+}
+static method testIfElementErrors(core::Map<core::int, core::int> map) → dynamic {
+ block {
+ final core::List<core::int> #t140 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t140.{core::List::add}(let final<BottomType> #t141 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:87:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[if (oracle(\"foo\")) \"bar\"];
+ ^" in "bar" as{TypeError} core::int);
+ } =>#t140;
+ block {
+ final core::Set<core::int> #t142 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t142.{core::Set::add}(let final<BottomType> #t143 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:88:28: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{if (oracle(\"foo\")) \"bar\", null};
+ ^" in "bar" as{TypeError} core::int);
+ #t142.{core::Set::add}(null);
+ } =>#t142;
+ block {
+ final core::Map<core::String, core::int> #t144 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t144.{core::Map::[]=}("bar", let final<BottomType> #t145 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:89:43: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int);
+ #t144.{core::Map::[]=}("baz", null);
+ } =>#t144;
+ block {
+ final core::List<core::int> #t146 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t147 in <core::int>[let final<BottomType> #t148 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:90:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[if (oracle(\"foo\")) ...[\"bar\"]];
+ ^" in "bar" as{TypeError} core::int])
+ #t146.{core::List::add}(#t147);
+ } =>#t146;
+ block {
+ final core::Set<core::int> #t149 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::int #t150 in <core::int>[let final<BottomType> #t151 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:91:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{if (oracle(\"foo\")) ...[\"bar\"], null};
+ ^" in "bar" as{TypeError} core::int])
+ #t149.{core::Set::add}(#t150);
+ #t149.{core::Set::add}(null);
+ } =>#t149;
+ block {
+ final core::Map<core::String, core::int> #t152 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t153 in <core::String, core::int>{"bar": let final<BottomType> #t154 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:92:47: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <String, int>{if (oracle(\"foo\")) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int}.{core::Map::entries})
+ #t152.{core::Map::[]=}(#t153.{core::MapEntry::key}, #t153.{core::MapEntry::value});
+ #t152.{core::Map::[]=}("baz", null);
+ } =>#t152;
+ block {
+ final core::List<core::int> #t155 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t155.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:93:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) ...map];
+ ^");
+ } =>#t155;
+ block {
+ final core::Set<core::int> #t156 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t156.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:94:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map, null};
+ ^");
+ #t156.{core::Set::add}(null);
+ } =>#t156;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[\"bar\"], \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:95:39: Error: Unexpected type 'List<String>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[\"bar\"], \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::String> #t157 = <core::String>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t157.{core::List::add}(let final<BottomType> #t158 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:96:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[if (oracle(\"foo\")) 42 else 3.14];
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t157.{core::List::add}(let final<BottomType> #t159 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:96:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[if (oracle(\"foo\")) 42 else 3.14];
+ ^" in 3.14 as{TypeError} core::String);
+ } =>#t157;
+ block {
+ final core::Set<core::String> #t160 = col::LinkedHashSet::•<core::String>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t160.{core::Set::add}(let final<BottomType> #t161 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:97:31: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{if (oracle(\"foo\")) 42 else 3.14, null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t160.{core::Set::add}(let final<BottomType> #t162 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:97:39: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{if (oracle(\"foo\")) 42 else 3.14, null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t160.{core::Set::add}(null);
+ } =>#t160;
+ block {
+ final core::Map<core::String, core::String> #t163 = <core::String, core::String>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t163.{core::Map::[]=}("bar", let final<BottomType> #t164 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:98:46: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{if (oracle(\"foo\")) \"bar\": 42 else \"baz\": 3.14, \"baz\": null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t163.{core::Map::[]=}("baz", let final<BottomType> #t165 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:98:61: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{if (oracle(\"foo\")) \"bar\": 42 else \"baz\": 3.14, \"baz\": null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t163.{core::Map::[]=}("baz", null);
+ } =>#t163;
+ block {
+ final core::List<core::int> #t166 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t166.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:99:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) ...map else 42];
+ ^");
+ else
+ #t166.{core::List::add}(42);
+ } =>#t166;
+ block {
+ final core::Set<core::int> #t167 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t167.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:100:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map else 42, null};
+ ^");
+ else
+ #t167.{core::Set::add}(42);
+ #t167.{core::Set::add}(null);
+ } =>#t167;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[42] else \"bar\": 42, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:101:39: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) ...[42] else \"bar\": 42, \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::int> #t168 = <core::int>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t168.{core::List::add}(42);
+ else
+ #t168.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:102:39: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[if (oracle(\"foo\")) 42 else ...map];
+ ^");
+ } =>#t168;
+ block {
+ final core::Set<core::int> #t169 = col::LinkedHashSet::•<core::int>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t169.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:103:31: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{if (oracle(\"foo\")) ...map else 42, null};
+ ^");
+ else
+ #t169.{core::Set::add}(42);
+ #t169.{core::Set::add}(null);
+ } =>#t169;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": 42 else ...[42], \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:104:54: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{if (oracle(\"foo\")) \"bar\": 42 else ...[42], \"baz\": null};
+ ^": null};
+ core::Set<dynamic> set10 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:106:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Set<dynamic> set10 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^";
+ core::Map<dynamic, dynamic> map10 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:107:53: Error: Expected ':' after this.
+ Map<dynamic, dynamic> map10 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^": null};
+ core::Set<dynamic> set11 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:108:24: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ Set<dynamic> set11 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^";
+ core::Map<dynamic, dynamic> map11 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:109:70: Error: Expected ':' after this.
+ Map<dynamic, dynamic> map11 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^": null};
+ core::Map<<BottomType>, core::Null> map12 = <<BottomType>, core::Null>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:110:35: Error: Expected ':' after this.
+ var map12 = {if (oracle(\"foo\")) 42 else \"bar\": 3.14};
+ ^": null};
+ core::Map<<BottomType>, core::Null> map13 = <<BottomType>, core::Null>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:111:52: Error: Expected ':' after this.
+ var map13 = {if (oracle(\"foo\")) \"bar\": 3.14 else 42};
+ ^": null};
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t170 = <core::int>[];
+ if(let final<BottomType> #t171 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:112:27: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ List<int> list20 = [if (42) 42];
+ ^" in 42 as{TypeError} core::bool)
+ #t170.{core::List::add}(42);
+ } =>#t170;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t172 = col::LinkedHashSet::•<core::int>();
+ if(let final<BottomType> #t173 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:113:25: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ Set<int> set20 = {if (42) 42};
+ ^" in 42 as{TypeError} core::bool)
+ #t172.{core::Set::add}(42);
+ } =>#t172;
+ core::Map<core::int, core::int> map30 = block {
+ final core::Map<core::int, core::int> #t174 = <core::int, core::int>{};
+ if(let final<BottomType> #t175 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:114:30: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ Map<int, int> map30 = {if (42) 42: 42};
+ ^" in 42 as{TypeError} core::bool)
+ #t174.{core::Map::[]=}(42, 42);
+ } =>#t174;
+ core::List<core::String> list40 = block {
+ final core::List<core::String> #t176 = <core::String>[];
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t176.{core::List::add}(let final<BottomType> #t177 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:115:53: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ List<String> list40 = <String>[if (oracle(\"foo\")) true else 42];
+ ^" in true as{TypeError} core::String);
+ else
+ #t176.{core::List::add}(let final<BottomType> #t178 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:115:63: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ List<String> list40 = <String>[if (oracle(\"foo\")) true else 42];
+ ^" in 42 as{TypeError} core::String);
+ } =>#t176;
+ core::Set<core::String> set40 = block {
+ final core::Set<core::String> #t179 = col::LinkedHashSet::•<core::String>();
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t179.{core::Set::add}(let final<BottomType> #t180 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:116:51: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Set<String> set40 = <String>{if (oracle(\"foo\")) true else 42};
+ ^" in true as{TypeError} core::String);
+ else
+ #t179.{core::Set::add}(let final<BottomType> #t181 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:116:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Set<String> set40 = <String>{if (oracle(\"foo\")) true else 42};
+ ^" in 42 as{TypeError} core::String);
+ } =>#t179;
+ core::Map<core::String, core::int> map40 = block {
+ final core::Map<core::String, core::int> #t182 = <core::String, core::int>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t182.{core::Map::[]=}(let final<BottomType> #t183 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:117:61: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<String, int> map40 = <String, int>{if (oracle(\"foo\")) true: 42 else 42: 42};
+ ^" in true as{TypeError} core::String, 42);
+ else
+ #t182.{core::Map::[]=}(let final<BottomType> #t184 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:117:75: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<String, int> map40 = <String, int>{if (oracle(\"foo\")) true: 42 else 42: 42};
+ ^" in 42 as{TypeError} core::String, 42);
+ } =>#t182;
+ core::Map<core::int, core::String> map41 = block {
+ final core::Map<core::int, core::String> #t185 = <core::int, core::String>{};
+ if(self::oracle<core::String>("foo") as{TypeError} core::bool)
+ #t185.{core::Map::[]=}(42, let final<BottomType> #t186 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:118:65: Error: A value of type 'bool' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<int, String> map41 = <int, String>{if (oracle(\"foo\")) 42: true else 42: 42};
+ ^" in true as{TypeError} core::String);
+ else
+ #t185.{core::Map::[]=}(42, let final<BottomType> #t187 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:118:79: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ Map<int, String> map41 = <int, String>{if (oracle(\"foo\")) 42: true else 42: 42};
+ ^" in 42 as{TypeError} core::String);
+ } =>#t185;
+}
+static method testForElement(dynamic dynVar, core::List<core::int> listInt, core::List<core::double> listDouble, core::int index, core::Map<core::String, core::int> mapStringInt, core::Map<core::String, core::double> mapStringDouble) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t188 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t188.{core::List::add}(42);
+ } =>#t188;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t189 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t189.{core::Set::add}(42);
+ #t189.{core::Set::add}(null);
+ } =>#t189;
+ core::Map<core::String, core::int> map10 = block {
+ final core::Map<core::String, core::int> #t190 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t190.{core::Map::[]=}("bar", 42);
+ #t190.{core::Map::[]=}("baz", null);
+ } =>#t190;
+ core::List<dynamic> list11 = block {
+ final core::List<dynamic> #t191 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t191.{core::List::add}(dynVar);
+ } =>#t191;
+ core::Set<dynamic> set11 = block {
+ final core::Set<dynamic> #t192 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t192.{core::Set::add}(dynVar);
+ #t192.{core::Set::add}(null);
+ } =>#t192;
+ core::Map<core::String, dynamic> map11 = block {
+ final core::Map<core::String, dynamic> #t193 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t193.{core::Map::[]=}("bar", dynVar);
+ #t193.{core::Map::[]=}("baz", null);
+ } =>#t193;
+ core::List<core::List<core::int>> list12 = block {
+ final core::List<core::List<core::int>> #t194 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t194.{core::List::add}(<core::int>[42]);
+ } =>#t194;
+ core::Set<core::List<core::int>> set12 = block {
+ final core::Set<core::List<core::int>> #t195 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t195.{core::Set::add}(<core::int>[42]);
+ #t195.{core::Set::add}(null);
+ } =>#t195;
+ core::Map<core::String, core::List<core::int>> map12 = block {
+ final core::Map<core::String, core::List<core::int>> #t196 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t196.{core::Map::[]=}("bar", <core::int>[42]);
+ #t196.{core::Map::[]=}("baz", null);
+ } =>#t196;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t197 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t198 in <core::int>[42])
+ #t197.{core::List::add}(#t198);
+ } =>#t197;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t199 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t200 in <core::int>[42])
+ #t199.{core::Set::add}(#t200);
+ #t199.{core::Set::add}(null);
+ } =>#t199;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t201 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::int> #t202 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t201.{core::Map::[]=}(#t202.{core::MapEntry::key}, #t202.{core::MapEntry::value});
+ #t201.{core::Map::[]=}("baz", null);
+ } =>#t201;
+ core::List<dynamic> list21 = block {
+ final core::List<dynamic> #t203 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t204 in <dynamic>[dynVar])
+ #t203.{core::List::add}(#t204);
+ } =>#t203;
+ core::Set<dynamic> set21 = block {
+ final core::Set<dynamic> #t205 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t206 in <dynamic>[dynVar])
+ #t205.{core::Set::add}(#t206);
+ #t205.{core::Set::add}(null);
+ } =>#t205;
+ core::Map<core::String, dynamic> map21 = block {
+ final core::Map<core::String, dynamic> #t207 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, dynamic> #t208 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t207.{core::Map::[]=}(#t208.{core::MapEntry::key}, #t208.{core::MapEntry::value});
+ #t207.{core::Map::[]=}("baz", null);
+ } =>#t207;
+ core::List<core::List<core::int>> list22 = block {
+ final core::List<core::List<core::int>> #t209 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t210 in <core::List<core::int>>[<core::int>[42]])
+ #t209.{core::List::add}(#t210);
+ } =>#t209;
+ core::Set<core::List<core::int>> set22 = block {
+ final core::Set<core::List<core::int>> #t211 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t212 in <core::List<core::int>>[<core::int>[42]])
+ #t211.{core::Set::add}(#t212);
+ #t211.{core::Set::add}(null);
+ } =>#t211;
+ core::Map<core::String, core::List<core::int>> map22 = block {
+ final core::Map<core::String, core::List<core::int>> #t213 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t214 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t213.{core::Map::[]=}(#t214.{core::MapEntry::key}, #t214.{core::MapEntry::value});
+ #t213.{core::Map::[]=}("baz", null);
+ } =>#t213;
+ core::List<core::int> list30 = block {
+ final core::List<core::int> #t215 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t216 in <core::int>[42])
+ #t215.{core::List::add}(#t216);
+ } =>#t215;
+ core::Set<core::int> set30 = block {
+ final core::Set<core::int> #t217 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t218 in <core::int>[42])
+ #t217.{core::Set::add}(#t218);
+ #t217.{core::Set::add}(null);
+ } =>#t217;
+ core::Map<core::String, core::int> map30 = block {
+ final core::Map<core::String, core::int> #t219 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::int> #t220 in <core::String, core::int>{"bar": 42}.{core::Map::entries})
+ #t219.{core::Map::[]=}(#t220.{core::MapEntry::key}, #t220.{core::MapEntry::value});
+ #t219.{core::Map::[]=}("baz", null);
+ } =>#t219;
+ core::List<dynamic> list31 = block {
+ final core::List<dynamic> #t221 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t222 in <dynamic>[dynVar])
+ #t221.{core::List::add}(#t222);
+ } =>#t221;
+ core::Set<dynamic> set31 = block {
+ final core::Set<dynamic> #t223 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t224 in <dynamic>[dynVar])
+ #t223.{core::Set::add}(#t224);
+ #t223.{core::Set::add}(null);
+ } =>#t223;
+ core::Map<core::String, dynamic> map31 = block {
+ final core::Map<core::String, dynamic> #t225 = <core::String, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, dynamic> #t226 in <core::String, dynamic>{"bar": dynVar}.{core::Map::entries})
+ #t225.{core::Map::[]=}(#t226.{core::MapEntry::key}, #t226.{core::MapEntry::value});
+ #t225.{core::Map::[]=}("baz", null);
+ } =>#t225;
+ core::List<core::List<core::int>> list33 = block {
+ final core::List<core::List<core::int>> #t227 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t228 in <core::List<core::int>>[<core::int>[42]])
+ #t227.{core::List::add}(#t228);
+ } =>#t227;
+ core::Set<core::List<core::int>> set33 = block {
+ final core::Set<core::List<core::int>> #t229 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t230 in <core::List<core::int>>[<core::int>[42]])
+ #t229.{core::Set::add}(#t230);
+ #t229.{core::Set::add}(null);
+ } =>#t229;
+ core::Map<core::String, core::List<core::int>> map33 = block {
+ final core::Map<core::String, core::List<core::int>> #t231 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t232 in <core::String, core::List<core::int>>{"bar": <core::int>[42]}.{core::Map::entries})
+ #t231.{core::Map::[]=}(#t232.{core::MapEntry::key}, #t232.{core::MapEntry::value});
+ #t231.{core::Map::[]=}("baz", null);
+ } =>#t231;
+ core::List<core::List<core::int>> list40 = block {
+ final core::List<core::List<core::int>> #t233 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t234 in <core::List<core::int>>[<core::int>[]])
+ #t233.{core::List::add}(#t234);
+ } =>#t233;
+ core::Set<core::List<core::int>> set40 = block {
+ final core::Set<core::List<core::int>> #t235 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t236 in <core::List<core::int>>[<core::int>[]])
+ #t235.{core::Set::add}(#t236);
+ #t235.{core::Set::add}(null);
+ } =>#t235;
+ core::Map<core::String, core::List<core::int>> map40 = block {
+ final core::Map<core::String, core::List<core::int>> #t237 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t238 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t237.{core::Map::[]=}(#t238.{core::MapEntry::key}, #t238.{core::MapEntry::value});
+ #t237.{core::Map::[]=}("baz", null);
+ } =>#t237;
+ core::List<core::List<core::int>> list41 = block {
+ final core::List<core::List<core::int>> #t239 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t240 in let final core::Set<core::List<core::int>> #t241 = col::LinkedHashSet::•<core::List<core::int>>() in let final core::bool #t242 = #t241.{core::Set::add}(<core::int>[]) in #t241)
+ #t239.{core::List::add}(#t240);
+ } =>#t239;
+ core::Set<core::List<core::int>> set41 = block {
+ final core::Set<core::List<core::int>> #t243 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t244 in let final core::Set<core::List<core::int>> #t245 = col::LinkedHashSet::•<core::List<core::int>>() in let final core::bool #t246 = #t245.{core::Set::add}(<core::int>[]) in #t245)
+ #t243.{core::Set::add}(#t244);
+ #t243.{core::Set::add}(null);
+ } =>#t243;
+ core::List<core::List<core::int>> list42 = block {
+ final core::List<core::List<core::int>> #t247 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t248 in <core::List<core::int>>[<core::int>[]])
+ #t247.{core::List::add}(#t248);
+ } =>#t247;
+ core::Set<core::List<core::int>> set42 = block {
+ final core::Set<core::List<core::int>> #t249 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t250 in <core::List<core::int>>[<core::int>[]])
+ #t249.{core::Set::add}(#t250);
+ #t249.{core::Set::add}(null);
+ } =>#t249;
+ core::Map<core::String, core::List<core::int>> map42 = block {
+ final core::Map<core::String, core::List<core::int>> #t251 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t252 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t251.{core::Map::[]=}(#t252.{core::MapEntry::key}, #t252.{core::MapEntry::value});
+ #t251.{core::Map::[]=}("baz", null);
+ } =>#t251;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t253 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t254 in <core::int>[])
+ #t253.{core::List::add}(#t254);
+ } =>#t253;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t255 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t256 in <core::int>[])
+ #t255.{core::Set::add}(#t256);
+ #t255.{core::Set::add}(null);
+ } =>#t255;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t257 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::int> #t258 in <core::String, core::int>{}.{core::Map::entries})
+ #t257.{core::Map::[]=}(#t258.{core::MapEntry::key}, #t258.{core::MapEntry::value});
+ #t257.{core::Map::[]=}("baz", null);
+ } =>#t257;
+ core::List<core::int> list51 = block {
+ final core::List<core::int> #t259 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t260 in let final core::Set<core::int> #t261 = col::LinkedHashSet::•<core::int>() in #t261)
+ #t259.{core::List::add}(#t260);
+ } =>#t259;
+ core::Set<core::int> set51 = block {
+ final core::Set<core::int> #t262 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t263 in let final core::Set<core::int> #t264 = col::LinkedHashSet::•<core::int>() in #t264)
+ #t262.{core::Set::add}(#t263);
+ #t262.{core::Set::add}(null);
+ } =>#t262;
+ core::List<core::int> list52 = block {
+ final core::List<core::int> #t265 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t266 in <core::int>[])
+ #t265.{core::List::add}(#t266);
+ } =>#t265;
+ core::Set<core::int> set52 = block {
+ final core::Set<core::int> #t267 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::int #t268 in <core::int>[])
+ #t267.{core::Set::add}(#t268);
+ #t267.{core::Set::add}(null);
+ } =>#t267;
+ core::List<core::List<core::int>> list60 = block {
+ final core::List<core::List<core::int>> #t269 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t270 in <core::List<core::int>>[<core::int>[]])
+ #t269.{core::List::add}(#t270);
+ } =>#t269;
+ core::Set<core::List<core::int>> set60 = block {
+ final core::Set<core::List<core::int>> #t271 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::List<core::int> #t272 in <core::List<core::int>>[<core::int>[]])
+ #t271.{core::Set::add}(#t272);
+ #t271.{core::Set::add}(null);
+ } =>#t271;
+ core::Map<core::String, core::List<core::int>> map60 = block {
+ final core::Map<core::String, core::List<core::int>> #t273 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::String, core::List<core::int>> #t274 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t273.{core::Map::[]=}(#t274.{core::MapEntry::key}, #t274.{core::MapEntry::value});
+ #t273.{core::Map::[]=}("baz", null);
+ } =>#t273;
+ core::List<core::List<core::int>> list61 = block {
+ final core::List<core::List<core::int>> #t275 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t276 in <core::List<core::int>>[<core::int>[]])
+ #t275.{core::List::add}(#t276);
+ } =>#t275;
+ core::Set<core::List<core::int>> set61 = block {
+ final core::Set<core::List<core::int>> #t277 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::List<core::int> #t278 in <core::List<core::int>>[<core::int>[]])
+ #t277.{core::Set::add}(#t278);
+ #t277.{core::Set::add}(null);
+ } =>#t277;
+ core::Map<core::String, core::List<core::int>> map61 = block {
+ final core::Map<core::String, core::List<core::int>> #t279 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::List<core::int>> #t280 in <core::String, core::List<core::int>>{"bar": <core::int>[]}.{core::Map::entries})
+ #t279.{core::Map::[]=}(#t280.{core::MapEntry::key}, #t280.{core::MapEntry::value});
+ #t279.{core::Map::[]=}("baz", null);
+ } =>#t279;
+ core::List<core::List<core::int>> list70 = block {
+ final core::List<core::List<core::int>> #t281 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t281.{core::List::add}(<core::int>[]);
+ } =>#t281;
+ core::Set<core::List<core::int>> set70 = block {
+ final core::Set<core::List<core::int>> #t282 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t282.{core::Set::add}(<core::int>[]);
+ #t282.{core::Set::add}(null);
+ } =>#t282;
+ core::Map<core::String, core::List<core::int>> map70 = block {
+ final core::Map<core::String, core::List<core::int>> #t283 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t283.{core::Map::[]=}("bar", <core::int>[]);
+ #t283.{core::Map::[]=}("baz", null);
+ } =>#t283;
+ core::List<core::List<core::int>> list71 = block {
+ final core::List<core::List<core::int>> #t284 = <core::List<core::int>>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t284.{core::List::add}(<core::int>[]);
+ } =>#t284;
+ core::Set<core::List<core::int>> set71 = block {
+ final core::Set<core::List<core::int>> #t285 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t285.{core::Set::add}(<core::int>[]);
+ #t285.{core::Set::add}(null);
+ } =>#t285;
+ core::Map<core::String, core::List<core::int>> map71 = block {
+ final core::Map<core::String, core::List<core::int>> #t286 = <core::String, core::List<core::int>>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t286.{core::Map::[]=}("bar", <core::int>[]);
+ #t286.{core::Map::[]=}("baz", null);
+ } =>#t286;
+ core::List<core::num> list80 = block {
+ final core::List<core::num> #t287 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t287.{core::List::add}(42);
+ else
+ #t287.{core::List::add}(3.14);
+ } =>#t287;
+ core::Set<core::num> set80 = block {
+ final core::Set<core::num> #t288 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t288.{core::Set::add}(42);
+ else
+ #t288.{core::Set::add}(3.14);
+ #t288.{core::Set::add}(null);
+ } =>#t288;
+ core::Map<core::String, core::num> map80 = block {
+ final core::Map<core::String, core::num> #t289 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t289.{core::Map::[]=}("bar", 42);
+ else
+ #t289.{core::Map::[]=}("bar", 3.14);
+ #t289.{core::Map::[]=}("baz", null);
+ } =>#t289;
+ core::List<core::num> list81 = block {
+ final core::List<core::num> #t290 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t291 in listInt)
+ #t290.{core::List::add}(#t291);
+ else
+ for (final core::num #t292 in listDouble)
+ #t290.{core::List::add}(#t292);
+ } =>#t290;
+ core::Set<core::num> set81 = block {
+ final core::Set<core::num> #t293 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t294 in listInt)
+ #t293.{core::Set::add}(#t294);
+ else
+ for (final core::num #t295 in listDouble)
+ #t293.{core::Set::add}(#t295);
+ #t293.{core::Set::add}(null);
+ } =>#t293;
+ core::Map<core::String, core::num> map81 = block {
+ final core::Map<core::String, core::num> #t296 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t297 in mapStringInt.{core::Map::entries})
+ #t296.{core::Map::[]=}(#t297.{core::MapEntry::key}, #t297.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<core::String, core::num> #t298 in mapStringDouble.{core::Map::entries})
+ #t296.{core::Map::[]=}(#t298.{core::MapEntry::key}, #t298.{core::MapEntry::value});
+ #t296.{core::Map::[]=}("baz", null);
+ } =>#t296;
+ core::List<dynamic> list82 = block {
+ final core::List<dynamic> #t299 = <dynamic>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t300 in listInt)
+ #t299.{core::List::add}(#t300);
+ else
+ for (final dynamic #t301 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t299.{core::List::add}(#t301);
+ } =>#t299;
+ core::Set<dynamic> set82 = block {
+ final core::Set<dynamic> #t302 = col::LinkedHashSet::•<dynamic>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final dynamic #t303 in listInt)
+ #t302.{core::Set::add}(#t303);
+ else
+ for (final dynamic #t304 in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t302.{core::Set::add}(#t304);
+ #t302.{core::Set::add}(null);
+ } =>#t302;
+ core::Map<dynamic, dynamic> map82 = block {
+ final core::Map<dynamic, dynamic> #t305 = <dynamic, dynamic>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<dynamic, dynamic> #t306 in mapStringInt.{core::Map::entries})
+ #t305.{core::Map::[]=}(#t306.{core::MapEntry::key}, #t306.{core::MapEntry::value});
+ else
+ for (final core::MapEntry<dynamic, dynamic> #t307 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
+ #t305.{core::Map::[]=}(#t307.{core::MapEntry::key}, #t307.{core::MapEntry::value});
+ #t305.{core::Map::[]=}("baz", null);
+ } =>#t305;
+ core::List<core::num> list83 = block {
+ final core::List<core::num> #t308 = <core::num>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t308.{core::List::add}(42);
+ else
+ for (final core::num #t309 in listDouble)
+ #t308.{core::List::add}(#t309);
+ } =>#t308;
+ core::Set<core::num> set83 = block {
+ final core::Set<core::num> #t310 = col::LinkedHashSet::•<core::num>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::num #t311 in listInt)
+ #t310.{core::Set::add}(#t311);
+ else
+ #t310.{core::Set::add}(3.14);
+ #t310.{core::Set::add}(null);
+ } =>#t310;
+ core::Map<core::String, core::num> map83 = block {
+ final core::Map<core::String, core::num> #t312 = <core::String, core::num>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ for (final core::MapEntry<core::String, core::num> #t313 in mapStringInt.{core::Map::entries})
+ #t312.{core::Map::[]=}(#t313.{core::MapEntry::key}, #t313.{core::MapEntry::value});
+ else
+ #t312.{core::Map::[]=}("bar", 3.14);
+ #t312.{core::Map::[]=}("baz", null);
+ } =>#t312;
+ core::List<core::int> list90 = block {
+ final core::List<core::int> #t314 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t314.{core::List::add}(dynVar as{TypeError} core::int);
+ } =>#t314;
+ core::Set<core::int> set90 = block {
+ final core::Set<core::int> #t315 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t315.{core::Set::add}(dynVar as{TypeError} core::int);
+ #t315.{core::Set::add}(null);
+ } =>#t315;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t316 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t316.{core::Map::[]=}("bar", dynVar as{TypeError} core::int);
+ #t316.{core::Map::[]=}("baz", null);
+ } =>#t316;
+ core::List<core::int> list91 = block {
+ final core::List<core::int> #t317 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t318 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t319 = #t318 as{TypeError} core::int;
+ #t317.{core::List::add}(#t319);
+ }
+ } =>#t317;
+ core::Set<core::int> set91 = block {
+ final core::Set<core::int> #t320 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final dynamic #t321 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t322 = #t321 as{TypeError} core::int;
+ #t320.{core::Set::add}(#t322);
+ }
+ #t320.{core::Set::add}(null);
+ } =>#t320;
+ core::Map<core::String, core::int> map91 = block {
+ final core::Map<core::String, core::int> #t323 = <core::String, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<dynamic, dynamic> #t324 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::String #t325 = #t324.{core::MapEntry::key} as{TypeError} core::String;
+ final core::int #t326 = #t324.{core::MapEntry::value} as{TypeError} core::int;
+ #t323.{core::Map::[]=}(#t325, #t326);
+ }
+ #t323.{core::Map::[]=}("baz", null);
+ } =>#t323;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t327 = <core::int>[];
+ for (final core::int #t328 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t327.{core::List::add}(42);
+ } =>#t327;
+ core::Set<core::int> set100 = block {
+ final core::Set<core::int> #t329 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t330 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t329.{core::Set::add}(42);
+ } =>#t329;
+ core::Map<core::String, core::int> map100 = block {
+ final core::Map<core::String, core::int> #t331 = <core::String, core::int>{};
+ for (final core::int #t332 = index = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; index = index.{core::num::+}(1))
+ #t331.{core::Map::[]=}("bar", 42);
+ } =>#t331;
+ core::List<core::int> list110 = block {
+ final core::List<core::int> #t333 = <core::int>[];
+ for (core::int i in <core::int>[1, 2, 3])
+ #t333.{core::List::add}(i);
+ } =>#t333;
+ core::Set<core::int> set110 = block {
+ final core::Set<core::int> #t334 = col::LinkedHashSet::•<core::int>();
+ for (core::int i in <core::int>[1, 2, 3])
+ #t334.{core::Set::add}(i);
+ #t334.{core::Set::add}(null);
+ } =>#t334;
+ core::Map<core::String, core::int> map110 = block {
+ final core::Map<core::String, core::int> #t335 = <core::String, core::int>{};
+ for (core::int i in <core::int>[1, 2, 3])
+ #t335.{core::Map::[]=}("bar", i);
+ #t335.{core::Map::[]=}("baz", null);
+ } =>#t335;
+ core::List<core::int> list120 = block {
+ final core::List<core::int> #t336 = <core::int>[];
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t336.{core::List::add}(i as{TypeError} core::int);
+ } =>#t336;
+ core::Set<core::int> set120 = block {
+ final core::Set<core::int> #t337 = col::LinkedHashSet::•<core::int>();
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t337.{core::Set::add}(i as{TypeError} core::int);
+ #t337.{core::Set::add}(null);
+ } =>#t337;
+ core::Map<core::String, core::int> map120 = block {
+ final core::Map<core::String, core::int> #t338 = <core::String, core::int>{};
+ for (dynamic i in dynVar as{TypeError} core::Iterable<dynamic>)
+ #t338.{core::Map::[]=}("bar", i as{TypeError} core::int);
+ #t338.{core::Map::[]=}("baz", null);
+ } =>#t338;
+ core::List<core::int> list130 = block {
+ final core::List<core::int> #t339 = <core::int>[];
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t339.{core::List::add}(i);
+ } =>#t339;
+ core::Set<core::int> set130 = block {
+ final core::Set<core::int> #t340 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t340.{core::Set::add}(i);
+ } =>#t340;
+ core::Map<core::int, core::int> map130 = block {
+ final core::Map<core::int, core::int> #t341 = <core::int, core::int>{};
+ for (core::int i = 1; i.{core::num::<}(2); i = i.{core::num::+}(1))
+ #t341.{core::Map::[]=}(i, i);
+ } =>#t341;
+}
+static method testForElementErrors(core::Map<core::int, core::int> map, core::List<core::int> list) → dynamic /* originally async */ {
+ final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+ asy::FutureOr<dynamic> :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ block {
+ final core::List<core::int> #t342 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t342.{core::List::add}(let final<BottomType> #t343 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:210:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) \"bar\"];
+ ^" in "bar" as{TypeError} core::int);
+ } =>#t342;
+ block {
+ final core::Set<core::int> #t344 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t344.{core::Set::add}(let final<BottomType> #t345 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:211:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\", null};
+ ^" in "bar" as{TypeError} core::int);
+ #t344.{core::Set::add}(null);
+ } =>#t344;
+ block {
+ final core::Map<core::int, core::int> #t346 = <core::int, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t346.{core::Map::[]=}(let final<BottomType> #t347 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:50: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int, let final<BottomType> #t348 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "bar" as{TypeError} core::int);
+ #t346.{core::Map::[]=}(let final<BottomType> #t349 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:212:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) \"bar\": \"bar\", \"baz\": null};
+ ^" in "baz" as{TypeError} core::int, null);
+ } =>#t346;
+ block {
+ final core::List<core::int> #t350 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t351 in <core::int>[let final<BottomType> #t352 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:213:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) ...[\"bar\"]];
+ ^" in "bar" as{TypeError} core::int])
+ #t350.{core::List::add}(#t351);
+ } =>#t350;
+ block {
+ final core::Set<core::int> #t353 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::int #t354 in <core::int>[let final<BottomType> #t355 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:214:49: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) ...[\"bar\"], null};
+ ^" in "bar" as{TypeError} core::int])
+ #t353.{core::Set::add}(#t354);
+ #t353.{core::Set::add}(null);
+ } =>#t353;
+ block {
+ final core::Map<core::int, core::int> #t356 = <core::int, core::int>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ for (final core::MapEntry<core::int, core::int> #t357 in <core::int, core::int>{let final<BottomType> #t358 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:54: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int: let final<BottomType> #t359 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:61: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "bar" as{TypeError} core::int}.{core::Map::entries})
+ #t356.{core::Map::[]=}(#t357.{core::MapEntry::key}, #t357.{core::MapEntry::value});
+ #t356.{core::Map::[]=}(let final<BottomType> #t360 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:215:69: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...{\"bar\": \"bar\"}, \"baz\": null};
+ ^" in "baz" as{TypeError} core::int, null);
+ } =>#t356;
+ block {
+ final core::List<core::int> #t361 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t361.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:216:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) ...map];
+ ^");
+ } =>#t361;
+ block {
+ final core::Set<core::int> #t362 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ #t362.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:217:48: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) ...map, null};
+ ^");
+ #t362.{core::Set::add}(null);
+ } =>#t362;
+ <core::int, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...list, 42: null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:218:53: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <int, int>{for (int i = 0; oracle(\"foo\"); i++) ...list, 42: null};
+ ^": null};
+ block {
+ final core::List<core::String> #t363 = <core::String>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t363.{core::List::add}(let final<BottomType> #t364 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:219:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14];
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t363.{core::List::add}(let final<BottomType> #t365 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:219:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14];
+ ^" in 3.14 as{TypeError} core::String);
+ } =>#t363;
+ block {
+ final core::Set<core::String> #t366 = col::LinkedHashSet::•<core::String>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t366.{core::Set::add}(let final<BottomType> #t367 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:220:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14, null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t366.{core::Set::add}(let final<BottomType> #t368 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:220:70: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else 3.14, null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t366.{core::Set::add}(null);
+ } =>#t366;
+ block {
+ final core::Map<core::String, core::String> #t369 = <core::String, core::String>{};
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t369.{core::Map::[]=}("bar", let final<BottomType> #t370 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:221:77: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else \"bar\": 3.14, \"baz\": null};
+ ^" in 42 as{TypeError} core::String);
+ else
+ #t369.{core::Map::[]=}("bar", let final<BottomType> #t371 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:221:92: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
+Try changing the type of the left hand side, or casting the right hand side to 'String'.
+ <String, String>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else \"bar\": 3.14, \"baz\": null};
+ ^" in 3.14 as{TypeError} core::String);
+ #t369.{core::Map::[]=}("baz", null);
+ } =>#t369;
+ block {
+ final core::List<core::int> #t372 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t372.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:222:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...map else 42];
+ ^");
+ else
+ #t372.{core::List::add}(42);
+ } =>#t372;
+ block {
+ final core::Set<core::int> #t373 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t373.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:223:62: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...map else 42, null};
+ ^");
+ else
+ #t373.{core::Set::add}(42);
+ #t373.{core::Set::add}(null);
+ } =>#t373;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...list else \"bar\": 42, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:224:70: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) ...list else \"bar\": 42, \"baz\": null};
+ ^": null};
+ block {
+ final core::List<core::int> #t374 = <core::int>[];
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t374.{core::List::add}(42);
+ else
+ #t374.{core::List::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:225:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>[for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else ...map];
+ ^");
+ } =>#t374;
+ block {
+ final core::Set<core::int> #t375 = col::LinkedHashSet::•<core::int>();
+ for (core::int i = 0; self::oracle<core::String>("foo") as{TypeError} core::bool; i = i.{core::num::+}(1))
+ if(self::oracle<dynamic>() as{TypeError} core::bool)
+ #t375.{core::Set::add}(42);
+ else
+ #t375.{core::Set::add}(invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:226:70: Error: Unexpected type 'Map<int, int>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+ <int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) 42 else ...map, null};
+ ^");
+ #t375.{core::Set::add}(null);
+ } =>#t375;
+ <core::String, core::int>{invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else ...list, \"baz\": null};
+ ^": null, invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:227:85: Error: Unexpected type 'List<int>' of a map spread entry. Expected 'dynamic' or a Map.
+ - 'List' is from 'dart:core'.
+ <String, int>{for (int i = 0; oracle(\"foo\"); i++) if (oracle()) \"bar\": 42 else ...list, \"baz\": null};
+ ^": null};
+ final core::int i = 0;
+ block {
+ final core::List<core::int> #t376 = <core::int>[];
+ for (final core::int #t377 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:230:14: Error: Setter not found: 'i'.
+ <int>[for (i in <int>[1]) i];
+ ^";
+ #t376.{core::List::add}(i);
+ }
+ } =>#t376;
+ block {
+ final core::Set<core::int> #t378 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t379 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:231:14: Error: Setter not found: 'i'.
+ <int>{for (i in <int>[1]) i, null};
+ ^";
+ #t378.{core::Set::add}(i);
+ }
+ #t378.{core::Set::add}(null);
+ } =>#t378;
+ block {
+ final core::Map<core::String, core::int> #t380 = <core::String, core::int>{};
+ for (final core::int #t381 in <core::int>[1]) {
+ invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:232:21: Error: Setter not found: 'i'.
+\t<String, int>{for (i in <int>[1]) \"bar\": i, \"baz\": null};
+\t ^";
+ #t380.{core::Map::[]=}("bar", i);
+ }
+ #t380.{core::Map::[]=}("baz", null);
+ } =>#t380;
+ core::List<dynamic> list10 = block {
+ final core::List<dynamic> #t382 = <dynamic>[];
+ for (dynamic i in let final<BottomType> #t383 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:234:31: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var list10 = [for (var i in \"not iterable\") i];
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t382.{core::List::add}(i);
+ } =>#t382;
+ core::Set<dynamic> set10 = block {
+ final core::Set<dynamic> #t384 = col::LinkedHashSet::•<dynamic>();
+ for (dynamic i in let final<BottomType> #t385 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:235:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var set10 = {for (var i in \"not iterable\") i, null};
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t384.{core::Set::add}(i);
+ #t384.{core::Set::add}(null);
+ } =>#t384;
+ core::Map<core::String, dynamic> map10 = block {
+ final core::Map<core::String, dynamic> #t386 = <core::String, dynamic>{};
+ for (dynamic i in let final<BottomType> #t387 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:236:30: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ - 'Iterable' is from 'dart:core'.
+ var map10 = {for (var i in \"not iterable\") \"bar\": i, \"baz\": null};
+ ^" in "not iterable" as{TypeError} core::Iterable<dynamic>)
+ #t386.{core::Map::[]=}("bar", i);
+ #t386.{core::Map::[]=}("baz", null);
+ } =>#t386;
+ core::List<core::int> list20 = block {
+ final core::List<core::int> #t388 = <core::int>[];
+ for (core::int i in <core::int>[let final<BottomType> #t389 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:237:32: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list20 = [for (int i in [\"not\", \"int\"]) i];
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t390 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:237:39: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list20 = [for (int i in [\"not\", \"int\"]) i];
+ ^" in "int" as{TypeError} core::int])
+ #t388.{core::List::add}(i);
+ } =>#t388;
+ core::Set<core::int> set20 = block {
+ final core::Set<core::int> #t391 = col::LinkedHashSet::•<core::int>();
+ for (core::int i in <core::int>[let final<BottomType> #t392 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:238:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set20 = {for (int i in [\"not\", \"int\"]) i, null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t393 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:238:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set20 = {for (int i in [\"not\", \"int\"]) i, null};
+ ^" in "int" as{TypeError} core::int])
+ #t391.{core::Set::add}(i);
+ #t391.{core::Set::add}(null);
+ } =>#t391;
+ core::Map<core::String, core::int> map20 = block {
+ final core::Map<core::String, core::int> #t394 = <core::String, core::int>{};
+ for (core::int i in <core::int>[let final<BottomType> #t395 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:239:31: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map20 = {for (int i in [\"not\", \"int\"]) \"bar\": i, \"baz\": null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t396 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:239:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map20 = {for (int i in [\"not\", \"int\"]) \"bar\": i, \"baz\": null};
+ ^" in "int" as{TypeError} core::int])
+ #t394.{core::Map::[]=}("bar", i);
+ #t394.{core::Map::[]=}("baz", null);
+ } =>#t394;
+ final core::List<dynamic> #t397 = <dynamic>[];
+ {
+ dynamic :stream = let final<BottomType> #t398 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:240:37: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var list30 = [await for (var i in \"not stream\") i];
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>;
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L2:
+ while (true) {
+ dynamic #t399 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t400 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic i = :for-iterator.{asy::_StreamIterator::current};
+ #t397.{core::List::add}(i);
+ }
+ else
+ break #L2;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t401 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::List<dynamic> list30 = block {} =>#t397;
+ final core::Set<dynamic> #t402 = col::LinkedHashSet::•<dynamic>();
+ {
+ dynamic :stream = let final<BottomType> #t403 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:241:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var set30 = {await for (var i in \"not stream\") i, null};
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>;
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L3:
+ while (true) {
+ dynamic #t404 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t405 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic i = :for-iterator.{asy::_StreamIterator::current};
+ #t402.{core::Set::add}(i);
+ }
+ else
+ break #L3;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t406 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::Set<dynamic> set30 = block {
+ #t402.{core::Set::add}(null);
+ } =>#t402;
+ final core::Map<core::String, dynamic> #t407 = <core::String, dynamic>{};
+ {
+ dynamic :stream = let final<BottomType> #t408 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:242:36: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ - 'Stream' is from 'dart:async'.
+ var map30 = {await for (var i in \"not stream\") \"bar\": i, \"baz\": null};
+ ^" in "not stream" as{TypeError} asy::Stream<dynamic>;
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L4:
+ while (true) {
+ dynamic #t409 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t410 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ dynamic i = :for-iterator.{asy::_StreamIterator::current};
+ #t407.{core::Map::[]=}("bar", i);
+ }
+ else
+ break #L4;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t411 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::Map<core::String, dynamic> map30 = block {
+ #t407.{core::Map::[]=}("baz", null);
+ } =>#t407;
+ final core::List<core::int> #t412 = <core::int>[];
+ {
+ dynamic :stream = asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t413 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:243:58: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list40 = [await for (int i in Stream.fromIterable([\"not\", \"int\"])) i];
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t414 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:243:65: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var list40 = [await for (int i in Stream.fromIterable([\"not\", \"int\"])) i];
+ ^" in "int" as{TypeError} core::int]);
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L5:
+ while (true) {
+ dynamic #t415 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t416 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int i = :for-iterator.{asy::_StreamIterator::current};
+ #t412.{core::List::add}(i);
+ }
+ else
+ break #L5;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t417 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::List<core::int> list40 = block {} =>#t412;
+ final core::Set<core::int> #t418 = col::LinkedHashSet::•<core::int>();
+ {
+ dynamic :stream = asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t419 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:244:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) i, null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t420 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:244:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var set40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) i, null};
+ ^" in "int" as{TypeError} core::int]);
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L6:
+ while (true) {
+ dynamic #t421 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t422 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int i = :for-iterator.{asy::_StreamIterator::current};
+ #t418.{core::Set::add}(i);
+ }
+ else
+ break #L6;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t423 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::Set<core::int> set40 = block {
+ #t418.{core::Set::add}(null);
+ } =>#t418;
+ final core::Map<core::String, core::int> #t424 = <core::String, core::int>{};
+ {
+ dynamic :stream = asy::Stream::fromIterable<core::int>(<core::int>[let final<BottomType> #t425 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:245:57: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) \"bar\": i, \"baz\": null};
+ ^" in "not" as{TypeError} core::int, let final<BottomType> #t426 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:245:64: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+Try changing the type of the left hand side, or casting the right hand side to 'int'.
+ var map40 = {await for (int i in Stream.fromIterable([\"not\", \"int\"])) \"bar\": i, \"baz\": null};
+ ^" in "int" as{TypeError} core::int]);
+ asy::_asyncStarListenHelper(:stream, :async_op);
+ asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
+ const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
+ try
+ #L7:
+ while (true) {
+ dynamic #t427 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
+ [yield] let dynamic #t428 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
+ if(:result) {
+ core::int i = :for-iterator.{asy::_StreamIterator::current};
+ #t424.{core::Map::[]=}("bar", i);
+ }
+ else
+ break #L7;
+ }
+ finally
+ if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
+ [yield] let dynamic #t429 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
+ :result;
+ }
+ }
+ core::Map<core::String, core::int> map40 = block {
+ #t424.{core::Map::[]=}("baz", null);
+ } =>#t424;
+ core::List<core::int> list50 = block {
+ final core::List<core::int> #t430 = <core::int>[];
+ for (; ; )
+ #t430.{core::List::add}(42);
+ } =>#t430;
+ core::Set<core::int> set50 = block {
+ final core::Set<core::int> #t431 = col::LinkedHashSet::•<core::int>();
+ for (; ; )
+ #t431.{core::Set::add}(42);
+ #t431.{core::Set::add}(null);
+ } =>#t431;
+ core::Map<core::String, core::int> map50 = block {
+ final core::Map<core::String, core::int> #t432 = <core::String, core::int>{};
+ for (; ; )
+ #t432.{core::Map::[]=}("bar", 42);
+ #t432.{core::Map::[]=}("baz", null);
+ } =>#t432;
+ core::List<core::int> list60 = block {
+ final core::List<core::int> #t433 = <core::int>[];
+ for (; let final<BottomType> #t434 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:249:24: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var list60 = [for (; \"not bool\";) 42];
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t433.{core::List::add}(42);
+ } =>#t433;
+ core::Set<core::int> set60 = block {
+ final core::Set<core::int> #t435 = col::LinkedHashSet::•<core::int>();
+ for (; let final<BottomType> #t436 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:250:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var set60 = {for (; \"not bool\";) 42, null};
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t435.{core::Set::add}(42);
+ #t435.{core::Set::add}(null);
+ } =>#t435;
+ core::Map<core::String, core::int> map60 = block {
+ final core::Map<core::String, core::int> #t437 = <core::String, core::int>{};
+ for (; let final<BottomType> #t438 = invalid-expression "pkg/front_end/testcases/control_flow_collection_inference.dart:251:23: Error: A value of type 'String' can't be assigned to a variable of type 'bool'.
+Try changing the type of the left hand side, or casting the right hand side to 'bool'.
+ var map60 = {for (; \"not bool\";) \"bar\": 42, \"baz\": null};
+ ^" in "not bool" as{TypeError} core::bool; )
+ #t437.{core::Map::[]=}("bar", 42);
+ #t437.{core::Map::[]=}("baz", null);
+ } =>#t437;
+ }
+ asy::_completeOnAsyncReturn(:async_completer, :return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :async_completer.start(:async_op);
+ return :async_completer.{asy::Completer::future};
+}
+static method testForElementErrorsNotAsync(asy::Stream<core::int> stream) → dynamic {
+ block {
+ final core::List<core::int> #t439 = <core::int>[];
+ await for (core::int i in stream)
+ #t439.{core::List::add}(i);
+ } =>#t439;
+ block {
+ final core::Set<core::int> #t440 = col::LinkedHashSet::•<core::int>();
+ await for (core::int i in stream)
+ #t440.{core::Set::add}(i);
+ } =>#t440;
+ block {
+ final core::Map<core::String, core::int> #t441 = <core::String, core::int>{};
+ await for (core::int i in stream)
+ #t441.{core::Map::[]=}("bar", i);
+ } =>#t441;
+}
+static method testPromotion(self::A a) → dynamic {
+ core::List<core::int> list10 = block {
+ final core::List<core::int> #t442 = <core::int>[];
+ if(a is self::B)
+ #t442.{core::List::add}(a{self::B}.{self::B::foo});
+ } =>#t442;
+ core::Set<core::int> set10 = block {
+ final core::Set<core::int> #t443 = col::LinkedHashSet::•<core::int>();
+ if(a is self::B)
+ #t443.{core::Set::add}(a{self::B}.{self::B::foo});
+ } =>#t443;
+ core::Map<core::int, core::int> map10 = block {
+ final core::Map<core::int, core::int> #t444 = <core::int, core::int>{};
+ if(a is self::B)
+ #t444.{core::Map::[]=}(a{self::B}.{self::B::foo}, a{self::B}.{self::B::foo});
+ } =>#t444;
+}
+static method main() → dynamic {}
diff --git a/front_end/testcases/control_flow_collection_inference.dart.type_promotion.expect b/front_end/testcases/control_flow_collection_inference.dart.type_promotion.expect
new file mode 100644
index 0000000..648acdc
--- /dev/null
+++ b/front_end/testcases/control_flow_collection_inference.dart.type_promotion.expect
@@ -0,0 +1,306 @@
+pkg/front_end/testcases/control_flow_collection_inference.dart:123:49: Context: Write to i@7018
+ var list10 = [for (int i = 0; oracle("foo"); i++) 42];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:124:48: Context: Write to i@7018
+ var set10 = {for (int i = 0; oracle("foo"); i++) 42, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:125:48: Context: Write to i@7018
+ var map10 = {for (int i = 0; oracle("foo"); i++) "bar": 42, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:126:49: Context: Write to i@7018
+ var list11 = [for (int i = 0; oracle("foo"); i++) dynVar];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:127:48: Context: Write to i@7018
+ var set11 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:128:48: Context: Write to i@7018
+ var map11 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:129:49: Context: Write to i@7018
+ var list12 = [for (int i = 0; oracle("foo"); i++) [42]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:130:48: Context: Write to i@7018
+ var set12 = {for (int i = 0; oracle("foo"); i++) [42], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:131:48: Context: Write to i@7018
+ var map12 = {for (int i = 0; oracle("foo"); i++) "bar": [42], "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:132:49: Context: Write to i@7018
+ var list20 = [for (int i = 0; oracle("foo"); i++) ...[42]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:133:48: Context: Write to i@7018
+ var set20 = {for (int i = 0; oracle("foo"); i++) ...[42], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:134:48: Context: Write to i@7018
+ var map20 = {for (int i = 0; oracle("foo"); i++) ...{"bar": 42}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:135:49: Context: Write to i@7018
+ var list21 = [for (int i = 0; oracle("foo"); i++) ...[dynVar]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:136:48: Context: Write to i@7018
+ var set21 = {for (int i = 0; oracle("foo"); i++) ...[dynVar], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:137:48: Context: Write to i@7018
+ var map21 = {for (int i = 0; oracle("foo"); i++) ...{"bar": dynVar}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:138:49: Context: Write to i@7018
+ var list22 = [for (int i = 0; oracle("foo"); i++) ...[[42]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:139:48: Context: Write to i@7018
+ var set22 = {for (int i = 0; oracle("foo"); i++) ...[[42]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:140:48: Context: Write to i@7018
+ var map22 = {for (int i = 0; oracle("foo"); i++) ...{"bar": [42]}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:141:49: Context: Write to i@7018
+ var list30 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:142:48: Context: Write to i@7018
+ var set30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[42], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:143:48: Context: Write to i@7018
+ var map30 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": 42}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:144:49: Context: Write to i@7018
+ var list31 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:145:48: Context: Write to i@7018
+ var set31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[dynVar], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:146:48: Context: Write to i@7018
+ var map31 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": dynVar}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:147:49: Context: Write to i@7018
+ var list33 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:148:48: Context: Write to i@7018
+ var set33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[42]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:149:48: Context: Write to i@7018
+ var map33 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": [42]}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:150:61: Context: Write to i@7018
+ List<List<int>> list40 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:151:59: Context: Write to i@7018
+ Set<List<int>> set40 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:152:67: Context: Write to i@7018
+ Map<String, List<int>> map40 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:153:61: Context: Write to i@7018
+ List<List<int>> list41 = [for (int i = 0; oracle("foo"); i++) ...{[]}];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:154:59: Context: Write to i@7018
+ Set<List<int>> set41 = {for (int i = 0; oracle("foo"); i++) ...{[]}, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:155:61: Context: Write to i@7018
+ List<List<int>> list42 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:156:59: Context: Write to i@7018
+ Set<List<int>> set42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:157:67: Context: Write to i@7018
+ Map<String, List<int>> map42 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:158:55: Context: Write to i@7018
+ List<int> list50 = [for (int i = 0; oracle("foo"); i++) ...[]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:159:53: Context: Write to i@7018
+ Set<int> set50 = {for (int i = 0; oracle("foo"); i++) ...[], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:160:61: Context: Write to i@7018
+ Map<String, int> map50 = {for (int i = 0; oracle("foo"); i++) ...{}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:161:55: Context: Write to i@7018
+ List<int> list51 = [for (int i = 0; oracle("foo"); i++) ...{}];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:162:53: Context: Write to i@7018
+ Set<int> set51 = {for (int i = 0; oracle("foo"); i++) ...{}, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:163:55: Context: Write to i@7018
+ List<int> list52 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:164:53: Context: Write to i@7018
+ Set<int> set52 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:165:61: Context: Write to i@7018
+ List<List<int>> list60 = [for (int i = 0; oracle("foo"); i++) ...[[]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:166:59: Context: Write to i@7018
+ Set<List<int>> set60 = {for (int i = 0; oracle("foo"); i++) ...[[]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:167:67: Context: Write to i@7018
+ Map<String, List<int>> map60 = {for (int i = 0; oracle("foo"); i++) ...{"bar": []}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:168:61: Context: Write to i@7018
+ List<List<int>> list61 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:169:59: Context: Write to i@7018
+ Set<List<int>> set61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...[[]], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:170:67: Context: Write to i@7018
+ Map<String, List<int>> map61 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...{"bar": []}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:171:61: Context: Write to i@7018
+ List<List<int>> list70 = [for (int i = 0; oracle("foo"); i++) []];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:172:59: Context: Write to i@7018
+ Set<List<int>> set70 = {for (int i = 0; oracle("foo"); i++) [], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:173:67: Context: Write to i@7018
+ Map<String, List<int>> map70 = {for (int i = 0; oracle("foo"); i++) "bar": [], "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:174:61: Context: Write to i@7018
+ List<List<int>> list71 = [for (int i = 0; oracle("foo"); i++) if (oracle()) []];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:175:59: Context: Write to i@7018
+ Set<List<int>> set71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) [], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:176:67: Context: Write to i@7018
+ Map<String, List<int>> map71 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": [], "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:177:49: Context: Write to i@7018
+ var list80 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:178:48: Context: Write to i@7018
+ var set80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:179:48: Context: Write to i@7018
+ var map80 = {for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:180:49: Context: Write to i@7018
+ var list81 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:181:48: Context: Write to i@7018
+ var set81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...listDouble, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:182:48: Context: Write to i@7018
+ var map81 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...mapStringDouble, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:183:49: Context: Write to i@7018
+ var list82 = [for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:184:48: Context: Write to i@7018
+ var set82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else ...dynVar, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:185:48: Context: Write to i@7018
+ var map82 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else ...dynVar, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:186:49: Context: Write to i@7018
+ var list83 = [for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...listDouble];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:187:48: Context: Write to i@7018
+ var set83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...listInt else 3.14, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:188:48: Context: Write to i@7018
+ var map83 = {for (int i = 0; oracle("foo"); i++) if (oracle()) ...mapStringInt else "bar": 3.14, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:189:55: Context: Write to i@7018
+ List<int> list90 = [for (int i = 0; oracle("foo"); i++) dynVar];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:190:53: Context: Write to i@7018
+ Set<int> set90 = {for (int i = 0; oracle("foo"); i++) dynVar, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:191:61: Context: Write to i@7018
+ Map<String, int> map90 = {for (int i = 0; oracle("foo"); i++) "bar": dynVar, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:192:55: Context: Write to i@7018
+ List<int> list91 = [for (int i = 0; oracle("foo"); i++) ...dynVar];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:193:53: Context: Write to i@7018
+ Set<int> set91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:194:61: Context: Write to i@7018
+ Map<String, int> map91 = {for (int i = 0; oracle("foo"); i++) ...dynVar, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:195:40: Context: Write to index@6916
+ List<int> list100 = <int>[for (index = 0; oracle("foo"); index++) 42];
+ ^
+pkg/front_end/testcases/control_flow_collection_inference.dart:195:65: Context: Write to index@6916
+ List<int> list100 = <int>[for (index = 0; oracle("foo"); index++) 42];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:196:38: Context: Write to index@6916
+ Set<int> set100 = <int>{for (index = 0; oracle("foo"); index++) 42};
+ ^
+pkg/front_end/testcases/control_flow_collection_inference.dart:196:63: Context: Write to index@6916
+ Set<int> set100 = <int>{for (index = 0; oracle("foo"); index++) 42};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:197:54: Context: Write to index@6916
+ Map<String, int> map100 = <String, int>{for (index = 0; oracle("foo"); index++) "bar": 42};
+ ^
+pkg/front_end/testcases/control_flow_collection_inference.dart:197:79: Context: Write to index@6916
+ Map<String, int> map100 = <String, int>{for (index = 0; oracle("foo"); index++) "bar": 42};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:204:48: Context: Write to i@7018
+ List<int> list130 = [for (var i = 1; i < 2; i++) i];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:205:46: Context: Write to i@7018
+ Set<int> set130 = {for (var i = 1; i < 2; i++) i};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:206:51: Context: Write to i@7018
+ Map<int, int> map130 = {for (var i = 1; i < 2; i++) i: i};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:210:41: Context: Write to i@13789
+ <int>[for (int i = 0; oracle("foo"); i++) "bar"];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:211:41: Context: Write to i@13789
+ <int>{for (int i = 0; oracle("foo"); i++) "bar", null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:212:46: Context: Write to i@13789
+ <int, int>{for (int i = 0; oracle("foo"); i++) "bar": "bar", "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:213:41: Context: Write to i@13789
+ <int>[for (int i = 0; oracle("foo"); i++) ...["bar"]];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:214:41: Context: Write to i@13789
+ <int>{for (int i = 0; oracle("foo"); i++) ...["bar"], null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:215:46: Context: Write to i@13789
+ <int, int>{for (int i = 0; oracle("foo"); i++) ...{"bar": "bar"}, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:216:41: Context: Write to i@13789
+ <int>[for (int i = 0; oracle("foo"); i++) ...map];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:217:41: Context: Write to i@13789
+ <int>{for (int i = 0; oracle("foo"); i++) ...map, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:218:46: Context: Write to i@13789
+ <int, int>{for (int i = 0; oracle("foo"); i++) ...list, 42: null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:219:44: Context: Write to i@13789
+ <String>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:220:44: Context: Write to i@13789
+ <String>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else 3.14, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:221:52: Context: Write to i@13789
+ <String, String>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else "bar": 3.14, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:222:41: Context: Write to i@13789
+ <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:223:41: Context: Write to i@13789
+ <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...map else 42, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:224:49: Context: Write to i@13789
+ <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) ...list else "bar": 42, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:225:41: Context: Write to i@13789
+ <int>[for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:226:41: Context: Write to i@13789
+ <int>{for (int i = 0; oracle("foo"); i++) if (oracle()) 42 else ...map, null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:227:49: Context: Write to i@13789
+ <String, int>{for (int i = 0; oracle("foo"); i++) if (oracle()) "bar": 42 else ...list, "baz": null};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:267:29: Context: Possible promotion of a@16609
+ List<int> list10 = [if (a is B) a.foo];
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:268:27: Context: Possible promotion of a@16609
+ Set<int> set10 = {if (a is B) a.foo};
+ ^^
+pkg/front_end/testcases/control_flow_collection_inference.dart:269:32: Context: Possible promotion of a@16609
+ Map<int, int> map10 = {if (a is B) a.foo: a.foo};
+ ^^
diff --git a/front_end/testcases/covariant_generic.dart.outline.expect b/front_end/testcases/covariant_generic.dart.outline.expect
index 0014cd5..4b44219 100644
--- a/front_end/testcases/covariant_generic.dart.outline.expect
+++ b/front_end/testcases/covariant_generic.dart.outline.expect
@@ -6,13 +6,13 @@
class Foo<T extends core::Object = dynamic> extends core::Object {
final field self::Foo::T finalField;
final field (self::Foo::T) → void callbackField;
- field self::Foo::T mutableField;
+ generic-covariant-impl field self::Foo::T mutableField;
field (self::Foo::T) → void mutableCallbackField;
constructor •(self::Foo::T finalField, (self::Foo::T) → void callbackField) → self::Foo<self::Foo::T>
;
- method method(self::Foo::T x) → void
+ method method(generic-covariant-impl self::Foo::T x) → void
;
- set setter(self::Foo::T x) → dynamic
+ set setter(generic-covariant-impl self::Foo::T x) → dynamic
;
method withCallback((self::Foo::T) → void callback) → void
;
diff --git a/front_end/testcases/deferred_type_annotation.dart.legacy.expect b/front_end/testcases/deferred_type_annotation.dart.legacy.expect
index 423412d..982cf85 100644
--- a/front_end/testcases/deferred_type_annotation.dart.legacy.expect
+++ b/front_end/testcases/deferred_type_annotation.dart.legacy.expect
@@ -9,7 +9,7 @@
// ^^^
//
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as d;
diff --git a/front_end/testcases/deferred_type_annotation.dart.legacy.transformed.expect b/front_end/testcases/deferred_type_annotation.dart.legacy.transformed.expect
index 423412d..982cf85 100644
--- a/front_end/testcases/deferred_type_annotation.dart.legacy.transformed.expect
+++ b/front_end/testcases/deferred_type_annotation.dart.legacy.transformed.expect
@@ -9,7 +9,7 @@
// ^^^
//
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as d;
diff --git a/front_end/testcases/deferred_type_annotation.dart.outline.expect b/front_end/testcases/deferred_type_annotation.dart.outline.expect
index 7693576..592059d 100644
--- a/front_end/testcases/deferred_type_annotation.dart.outline.expect
+++ b/front_end/testcases/deferred_type_annotation.dart.outline.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as d;
diff --git a/front_end/testcases/deferred_type_annotation.dart.strong.expect b/front_end/testcases/deferred_type_annotation.dart.strong.expect
index 6be11a9..29b1b92 100644
--- a/front_end/testcases/deferred_type_annotation.dart.strong.expect
+++ b/front_end/testcases/deferred_type_annotation.dart.strong.expect
@@ -9,7 +9,7 @@
// ^^^
//
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as d;
diff --git a/front_end/testcases/deferred_type_annotation.dart.strong.transformed.expect b/front_end/testcases/deferred_type_annotation.dart.strong.transformed.expect
index 6be11a9..29b1b92 100644
--- a/front_end/testcases/deferred_type_annotation.dart.strong.transformed.expect
+++ b/front_end/testcases/deferred_type_annotation.dart.strong.transformed.expect
@@ -9,7 +9,7 @@
// ^^^
//
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as d;
diff --git a/front_end/testcases/duplicated_declarations.dart.legacy.expect b/front_end/testcases/duplicated_declarations.dart.legacy.expect
index f1e837f..86ec30f 100644
--- a/front_end/testcases/duplicated_declarations.dart.legacy.expect
+++ b/front_end/testcases/duplicated_declarations.dart.legacy.expect
@@ -2,12 +2,12 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
//
-// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
diff --git a/front_end/testcases/duplicated_declarations.dart.legacy.transformed.expect b/front_end/testcases/duplicated_declarations.dart.legacy.transformed.expect
index f1e837f..86ec30f 100644
--- a/front_end/testcases/duplicated_declarations.dart.legacy.transformed.expect
+++ b/front_end/testcases/duplicated_declarations.dart.legacy.transformed.expect
@@ -2,12 +2,12 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
//
-// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
diff --git a/front_end/testcases/duplicated_declarations.dart.outline.expect b/front_end/testcases/duplicated_declarations.dart.outline.expect
index 63f345e..1933ac0 100644
--- a/front_end/testcases/duplicated_declarations.dart.outline.expect
+++ b/front_end/testcases/duplicated_declarations.dart.outline.expect
@@ -2,12 +2,12 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
//
-// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
diff --git a/front_end/testcases/duplicated_declarations.dart.strong.expect b/front_end/testcases/duplicated_declarations.dart.strong.expect
index a51c4ba..6e8d2d8 100644
--- a/front_end/testcases/duplicated_declarations.dart.strong.expect
+++ b/front_end/testcases/duplicated_declarations.dart.strong.expect
@@ -2,12 +2,12 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:7:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
//
-// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must preceed part directives.
+// pkg/front_end/testcases/duplicated_declarations.dart:9:1: Error: Import directives must precede part directives.
// Try moving the import directives before the part directives.
// import 'duplicated_declarations_lib.dart' as Typedef;
// ^^^^^^
diff --git a/front_end/testcases/dynamic_and_void.dart b/front_end/testcases/dynamic_and_void.dart
index 21800bd..f6b345c 100644
--- a/front_end/testcases/dynamic_and_void.dart
+++ b/front_end/testcases/dynamic_and_void.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.
-/*@testedFeatures=warning*/
-
// dynamic is treated as a name exported by dart:core. void is not treated as a
// name exported by dart:core.
diff --git a/front_end/testcases/dynamic_and_void.dart.legacy.expect b/front_end/testcases/dynamic_and_void.dart.legacy.expect
index 3760ddb..5606157 100644
--- a/front_end/testcases/dynamic_and_void.dart.legacy.expect
+++ b/front_end/testcases/dynamic_and_void.dart.legacy.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/dynamic_and_void.dart:12:27: Warning: Type 'dynamic' not found.
+// pkg/front_end/testcases/dynamic_and_void.dart:10:27: Warning: Type 'dynamic' not found.
// /*@warning=TypeNotFound*/ dynamic testDynamic() => 0;
// ^^^^^^^
//
diff --git a/front_end/testcases/dynamic_and_void.dart.legacy.transformed.expect b/front_end/testcases/dynamic_and_void.dart.legacy.transformed.expect
index 3760ddb..5606157 100644
--- a/front_end/testcases/dynamic_and_void.dart.legacy.transformed.expect
+++ b/front_end/testcases/dynamic_and_void.dart.legacy.transformed.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/dynamic_and_void.dart:12:27: Warning: Type 'dynamic' not found.
+// pkg/front_end/testcases/dynamic_and_void.dart:10:27: Warning: Type 'dynamic' not found.
// /*@warning=TypeNotFound*/ dynamic testDynamic() => 0;
// ^^^^^^^
//
diff --git a/front_end/testcases/dynamic_and_void.dart.outline.expect b/front_end/testcases/dynamic_and_void.dart.outline.expect
index f080c68..b659017 100644
--- a/front_end/testcases/dynamic_and_void.dart.outline.expect
+++ b/front_end/testcases/dynamic_and_void.dart.outline.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/dynamic_and_void.dart:12:27: Warning: Type 'dynamic' not found.
+// pkg/front_end/testcases/dynamic_and_void.dart:10:27: Warning: Type 'dynamic' not found.
// /*@warning=TypeNotFound*/ dynamic testDynamic() => 0;
// ^^^^^^^
//
diff --git a/front_end/testcases/export_main.dart.legacy.expect b/front_end/testcases/export_main.dart.legacy.expect
index 1f4d73b..2ce3772 100644
--- a/front_end/testcases/export_main.dart.legacy.expect
+++ b/front_end/testcases/export_main.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./hello.dart" as hel;
+import "hello.dart" as hel;
additionalExports = (hel::main)
diff --git a/front_end/testcases/export_main.dart.legacy.transformed.expect b/front_end/testcases/export_main.dart.legacy.transformed.expect
index 1f4d73b..2ce3772 100644
--- a/front_end/testcases/export_main.dart.legacy.transformed.expect
+++ b/front_end/testcases/export_main.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./hello.dart" as hel;
+import "hello.dart" as hel;
additionalExports = (hel::main)
diff --git a/front_end/testcases/export_main.dart.outline.expect b/front_end/testcases/export_main.dart.outline.expect
index 349482d..ce25789 100644
--- a/front_end/testcases/export_main.dart.outline.expect
+++ b/front_end/testcases/export_main.dart.outline.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./hello.dart" as hel;
+import "hello.dart" as hel;
additionalExports = (hel::main)
diff --git a/front_end/testcases/export_main.dart.strong.expect b/front_end/testcases/export_main.dart.strong.expect
index 1f4d73b..2ce3772 100644
--- a/front_end/testcases/export_main.dart.strong.expect
+++ b/front_end/testcases/export_main.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./hello.dart" as hel;
+import "hello.dart" as hel;
additionalExports = (hel::main)
diff --git a/front_end/testcases/export_main.dart.strong.transformed.expect b/front_end/testcases/export_main.dart.strong.transformed.expect
index 1f4d73b..2ce3772 100644
--- a/front_end/testcases/export_main.dart.strong.transformed.expect
+++ b/front_end/testcases/export_main.dart.strong.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./hello.dart" as hel;
+import "hello.dart" as hel;
additionalExports = (hel::main)
diff --git a/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml b/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml
new file mode 100644
index 0000000..9b5507b
--- /dev/null
+++ b/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml
@@ -0,0 +1,30 @@
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "main.dart"
+definitions: [a, b]
+position: "dart:collection"
+expression: |
+ (a, b) {
+ if (a._usedData != b._usedData ||
+ a._deletedKeys != b._deletedKeys ||
+ a._hashMask != b._hashMask ||
+ a._index.length != b._index.length ||
+ a._data.length != b._data.length) {
+ return false;
+ }
+ for (var i = 0; i < a._index.length; ++i) {
+ if (a._index[i] != b._index[i]) {
+ return false;
+ }
+ }
+ for (var i = 0; i < a._data.length; ++i) {
+ var ad = a._data[i];
+ var bd = b._data[i];
+ if (!identical(ad, bd) && !(ad == a && bd == b)) {
+ return false;
+ }
+ }
+ return true;
+ }(a, b)
\ No newline at end of file
diff --git a/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml.expect b/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml.expect
new file mode 100644
index 0000000..ad666aa
--- /dev/null
+++ b/front_end/testcases/expression/from_vm_cc_linked_hash_map.expression.yaml.expect
@@ -0,0 +1,21 @@
+Errors: {
+}
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr(dynamic a, dynamic b) → dynamic
+ return ((dynamic a, dynamic b) → dart.core::bool {
+ if(!a._usedData.{dart.core::Object::==}(b._usedData) || !a._deletedKeys.{dart.core::Object::==}(b._deletedKeys) || !a._hashMask.{dart.core::Object::==}(b._hashMask) || !a._index.length.{dart.core::Object::==}(b._index.length) || !a._data.length.{dart.core::Object::==}(b._data.length)) {
+ return false;
+ }
+ for (dart.core::int i = 0; i.{dart.core::num::<}(a._index.length as{TypeError} dart.core::num); i = i.{dart.core::num::+}(1)) {
+ if(!a._index.[](i).{dart.core::Object::==}(b._index.[](i))) {
+ return false;
+ }
+ }
+ for (dart.core::int i = 0; i.{dart.core::num::<}(a._data.length as{TypeError} dart.core::num); i = i.{dart.core::num::+}(1)) {
+ dynamic ad = a._data.[](i);
+ dynamic bd = b._data.[](i);
+ if(!dart.core::identical(ad, bd) && !(ad.{dart.core::Object::==}(a) && bd.{dart.core::Object::==}(b))) {
+ return false;
+ }
+ }
+ return true;
+ }).call(a, b);
diff --git a/front_end/testcases/for_in_without_declaration.dart.legacy.expect b/front_end/testcases/for_in_without_declaration.dart.legacy.expect
index 8e5c9f4..9cc7892 100644
--- a/front_end/testcases/for_in_without_declaration.dart.legacy.expect
+++ b/front_end/testcases/for_in_without_declaration.dart.legacy.expect
@@ -142,10 +142,8 @@
^^^";
dynamic x;
dynamic y;
- {
- core::print(x);
- core::print(y);
- }
+ core::print(x);
+ core::print(y);
}
}
const core::int constant = 0;
diff --git a/front_end/testcases/for_in_without_declaration.dart.legacy.transformed.expect b/front_end/testcases/for_in_without_declaration.dart.legacy.transformed.expect
index 8e5c9f4..9cc7892 100644
--- a/front_end/testcases/for_in_without_declaration.dart.legacy.transformed.expect
+++ b/front_end/testcases/for_in_without_declaration.dart.legacy.transformed.expect
@@ -142,10 +142,8 @@
^^^";
dynamic x;
dynamic y;
- {
- core::print(x);
- core::print(y);
- }
+ core::print(x);
+ core::print(y);
}
}
const core::int constant = 0;
diff --git a/front_end/testcases/for_in_without_declaration.dart.strong.expect b/front_end/testcases/for_in_without_declaration.dart.strong.expect
index cc7b291..9e758ec 100644
--- a/front_end/testcases/for_in_without_declaration.dart.strong.expect
+++ b/front_end/testcases/for_in_without_declaration.dart.strong.expect
@@ -172,10 +172,8 @@
^^^";
dynamic x;
dynamic y;
- {
- core::print(x);
- core::print(y);
- }
+ core::print(x);
+ core::print(y);
}
}
const core::int constant = 0;
diff --git a/front_end/testcases/for_in_without_declaration.dart.strong.transformed.expect b/front_end/testcases/for_in_without_declaration.dart.strong.transformed.expect
index cc7b291..9e758ec 100644
--- a/front_end/testcases/for_in_without_declaration.dart.strong.transformed.expect
+++ b/front_end/testcases/for_in_without_declaration.dart.strong.transformed.expect
@@ -172,10 +172,8 @@
^^^";
dynamic x;
dynamic y;
- {
- core::print(x);
- core::print(y);
- }
+ core::print(x);
+ core::print(y);
}
}
const core::int constant = 0;
diff --git a/front_end/testcases/incremental_initialize_from_dill/changing_modules.yaml b/front_end/testcases/incremental_initialize_from_dill/changing_modules.yaml
new file mode 100644
index 0000000..ba6a85f
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/changing_modules.yaml
@@ -0,0 +1,147 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with a number of modules.
+# Compile again with changing modules.
+
+type: newworld
+strong: true
+modules:
+ example_0.1.0:
+ example_0.1.0/a.dart: |
+ a() {
+ la1();
+ }
+ la1() {
+ print("Hello from v0.1.0");
+ }
+ example_0.1.0/b.dart: |
+ import "a.dart";
+ b() {
+ a();
+ }
+ example_0.1.0/.packages: |
+ example:.
+ example_0.1.1:
+ example_0.1.1/b.dart: |
+ b() {
+ print("Hello from v0.1.1");
+ }
+ bool example011 = true;
+ example_0.1.1/.packages: |
+ example:.
+ foo_1:
+ foo_1/foo.dart: |
+ import "package:example/b.dart";
+ foo() {
+ print("Hello from foo");
+ b();
+ }
+ bool foo1 = true;
+ foo_1/.packages: |
+ foo:.
+ example:../example_0.1.0
+ foo_2:
+ foo_2/foo.dart: |
+ import "package:example/b.dart";
+ import "bar.dart";
+ import "baz.dart";
+ foo() {
+ print("Hello from foo 2");
+ bar();
+ baz();
+ b();
+ }
+ bool foo2 = true;
+ foo_2/bar.dart: |
+ bar() {
+ print("hello from bar");
+ }
+ foo_2/baz.dart: |
+ baz() {
+ print("hello from baz");
+ }
+ foo_2/.packages: |
+ foo:.
+ example:../example_0.1.1
+worlds:
+ - entry: main.dart
+ fromComponent: true
+ sources:
+ main.dart: |
+ import "package:example/b.dart";
+ main() {
+ print("hello");
+ b();
+ }
+ .packages: example:example_0.1.0
+ modules:
+ - example_0.1.0
+ expectedLibraryCount: 3
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ package:example/b.dart:
+ - Procedure b
+ package:example/a.dart:
+ - Procedure a
+ - Procedure la1
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ sources:
+ main.dart: |
+ import "package:foo/foo.dart";
+ main() {
+ print("hello");
+ foo();
+ }
+ .packages: |
+ example:example_0.1.0
+ foo:foo_1
+ modules:
+ - example_0.1.0
+ - foo_1
+ expectedLibraryCount: 4
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ package:example/b.dart:
+ - Procedure b
+ package:example/a.dart:
+ - Procedure a
+ - Procedure la1
+ package:foo/foo.dart:
+ - Procedure foo
+ - Field foo1
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ sources:
+ main.dart: |
+ import "package:foo/foo.dart";
+ main() {
+ print("hello");
+ foo();
+ }
+ .packages: |
+ example:example_0.1.1
+ foo:foo_2
+ modules:
+ - example_0.1.1
+ - foo_2
+ expectedLibraryCount: 5
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ package:example/b.dart:
+ - Procedure b
+ - Field example011
+ package:foo/foo.dart:
+ - Procedure foo
+ - Field foo2
+ package:foo/bar.dart:
+ - Procedure bar
+ package:foo/baz.dart:
+ - Procedure baz
diff --git a/front_end/testcases/incremental_initialize_from_dill/changing_modules_2.yaml b/front_end/testcases/incremental_initialize_from_dill/changing_modules_2.yaml
new file mode 100644
index 0000000..4d0a193
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/changing_modules_2.yaml
@@ -0,0 +1,73 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with a number of modules.
+# Compile again with changing modules.
+
+type: newworld
+strong: true
+modules:
+ example_1:
+ example_1/a.dart: |
+ a() {}
+ var example = true;
+ example_1/.packages: |
+ example:.
+ example_2:
+ example_2/a.dart: |
+ a() {}
+ var example = true;
+ example_2/.packages: |
+ example:.
+ foo:
+ foo/foo.dart: |
+ export "package:example/a.dart";
+ var foo = true;
+ foo/.packages: |
+ foo:.
+ example:../example_1
+worlds:
+ - entry: main.dart
+ fromComponent: true
+ sources:
+ main.dart: |
+ import "package:foo/foo.dart";
+ main() {
+ print("hello");
+ a();
+ }
+ .packages: |
+ foo:foo
+ example:example_1
+ modules:
+ - foo
+ - example_1
+ expectedLibraryCount: 3
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ package:foo/foo.dart:
+ - Field foo
+ package:example/a.dart:
+ - Procedure a
+ - Field example
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ sources:
+ .packages: |
+ foo:foo
+ example:example_2
+ modules:
+ - foo
+ - example_2
+ expectedLibraryCount: 3
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ package:foo/foo.dart:
+ - Field foo
+ package:example/a.dart:
+ - Procedure a
+ - Field example
diff --git a/front_end/testcases/incremental_initialize_from_dill/changing_modules_3.yaml b/front_end/testcases/incremental_initialize_from_dill/changing_modules_3.yaml
new file mode 100644
index 0000000..7e64c8c
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/changing_modules_3.yaml
@@ -0,0 +1,64 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with a number of modules.
+# Compile again with changing modules.
+
+type: newworld
+strong: true
+modules:
+ foo:
+ foo/foo.dart: |
+ var foo = true;
+ foo/.packages: |
+ foo:.
+ foo2:
+ foo2/foo.dart: |
+ var foo2 = true;
+ foo2/.packages: |
+ foo:.
+worlds:
+ - entry: main.dart
+ fromComponent: true
+ simulateTransformer: true
+ sources:
+ main.dart: |
+ import "package:foo/foo.dart";
+ main() {
+ print(foo);
+ }
+ .packages: |
+ foo:foo
+ modules:
+ - foo
+ expectedLibraryCount: 2
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ - Field lalala_SimulateTransformer
+ package:foo/foo.dart:
+ - Field foo
+ - Field lalala_SimulateTransformer
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ simulateTransformer: true
+ sources:
+ main.dart: |
+ import "package:foo/foo.dart";
+ main() {
+ print(foo2);
+ }
+ .packages: |
+ foo:foo2
+ modules:
+ - foo2
+ expectedLibraryCount: 2
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Procedure main
+ - Field lalala_SimulateTransformer
+ package:foo/foo.dart:
+ - Field foo2
+ - Field lalala_SimulateTransformer
diff --git a/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_non_package_unreferenced_libraries.yaml b/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_non_package_unreferenced_libraries.yaml
new file mode 100644
index 0000000..08f0a4c
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_non_package_unreferenced_libraries.yaml
@@ -0,0 +1,41 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with no packages and two libraries. Update the world
+# to now only include one library. The now no longer referenced library should
+# also have been removed from the uri to sources.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ main.dart: |
+ import "b.dart";
+ main() { b(); }
+ b.dart: |
+ b() {}
+ expectedLibraryCount: 2
+ - entry: main.dart
+ worldType: updated
+ invalidate:
+ - main.dart
+ expectInitializeFromDill: false
+ sources:
+ main.dart: |
+ main() {}
+ expectedLibraryCount: 1
+ uriToSourcesDoesntInclude:
+ - b.dart
+ - entry: main.dart
+ worldType: updated
+ invalidate:
+ - main.dart
+ expectInitializeFromDill: false
+ sources:
+ main.dart: |
+ main() {}
+ expectedLibraryCount: 1
+ uriToSourcesDoesntInclude:
+ - b.dart
diff --git a/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_unreferenced_package_library.yaml b/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_unreferenced_package_library.yaml
new file mode 100644
index 0000000..ef7857f
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/cleans_up_uritosource_unreferenced_package_library.yaml
@@ -0,0 +1,34 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with a package. Update the world so that the .packages
+# no longer reference the package (and the source no longe ruse it) and
+# recompile. The now no longer referenced package library should also have been
+# removed from the uri to sources.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ .packages: example:pkg/example
+ main.dart: |
+ import "package:example/b.dart";
+ main() { b(); }
+ pkg/example/b.dart: |
+ b() {}
+ expectedLibraryCount: 2
+ - entry: main.dart
+ worldType: updated
+ invalidate:
+ - main.dart
+ - .packages
+ expectInitializeFromDill: false
+ sources:
+ .packages:
+ main.dart: |
+ main() {}
+ expectedLibraryCount: 1
+ uriToSourcesDoesntInclude:
+ - pkg/example/b.dart
diff --git a/front_end/testcases/incremental_initialize_from_dill/constant_set_literal.yaml b/front_end/testcases/incremental_initialize_from_dill/constant_set_literal.yaml
new file mode 100644
index 0000000..4b1c653
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/constant_set_literal.yaml
@@ -0,0 +1,31 @@
+# Copyright (c) 2019, 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.md file.
+
+# Test that constant set literals works as expected.
+
+type: newworld
+strong: true
+worlds:
+ - entry: "main.dart"
+ sources:
+ main.dart: |
+ import 'lib.dart';
+
+ const Set<String> foo = {};
+ main() {
+ print(foo);
+ print(bar);
+ }
+ lib.dart: |
+ const Set<String> bar = {"hello", "world"};
+ expectedLibraryCount: 2
+ - entry: "main.dart"
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - lib.dart
+ sources:
+ lib.dart: |
+ const Set<int> bar = {42};
+ expectedLibraryCount: 2
diff --git a/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml b/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml
new file mode 100644
index 0000000..b426a33
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml
@@ -0,0 +1,27 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile a application.
+# Perform an expression calculation on it, where the expression gives a compile
+# time error.
+# Ask to compile again, and make sure we don't see the expression compilation
+# error.
+
+type: newworld
+strong: false
+worlds:
+ - entry: main.dart
+ sources:
+ main.dart: |
+ main() {
+ print("hello");
+ }
+ expectedLibraryCount: 1
+ expressionCompilation:
+ uri: main.dart
+ expression: foo()
+ - entry: main.dart
+ expectInitializeFromDill: false
+ worldType: updated
+ expectedLibraryCount: 1
diff --git a/front_end/testcases/incremental_initialize_from_dill/flutter_mixin_failure_1.yaml b/front_end/testcases/incremental_initialize_from_dill/flutter_mixin_failure_1.yaml
new file mode 100644
index 0000000..1a79746
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/flutter_mixin_failure_1.yaml
@@ -0,0 +1,63 @@
+# Copyright (c) 2019, 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.md file.
+
+# Regression test from flutter.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ main.dart: |
+ import 'lib.dart';
+
+ class Test extends Test2 {
+ Quux world() => null;
+ }
+
+ abstract class Test2 {
+ Baz world();
+ }
+ lib.dart: |
+ class FooEntry {}
+
+ class BarEntry extends FooEntry {}
+
+ abstract class FooTarget {
+ void hello(FooEntry entry);
+ }
+
+ abstract class Baz implements FooTarget {
+ void hello(covariant FooEntry entry) {}
+ }
+
+ mixin MyMixin on Baz {}
+
+ abstract class Qux extends Baz {
+ void hello(BarEntry entry) {}
+ }
+
+ class Quux extends Qux with MyMixin {}
+ expectedLibraryCount: 2
+ - entry: main.dart
+ worldType: updated
+ invalidate:
+ - main.dart
+ expectInitializeFromDill: false
+ sources:
+ main.dart: |
+ import 'lib.dart';
+
+ class Test extends Test2 {
+ Quux world() => null;
+ }
+
+ abstract class Test2 {
+ Baz world();
+ }
+
+ main() {
+ print(new Test());
+ }
+ expectedLibraryCount: 2
diff --git a/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml b/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml
new file mode 100644
index 0000000..5bfb458
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml
@@ -0,0 +1,17 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with the option of only getting an outline.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ main.dart: |
+ main() {
+ print("hello");
+ b();
+ }
+ outlineOnly: true
\ No newline at end of file
diff --git a/front_end/testcases/incremental_initialize_from_dill/outline_only_2.yaml b/front_end/testcases/incremental_initialize_from_dill/outline_only_2.yaml
new file mode 100644
index 0000000..0105f44
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/outline_only_2.yaml
@@ -0,0 +1,22 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with the option of only getting an outline.
+# This is a reproduction of http://dartbug.com/36498.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ main.dart: |
+ abstract class Foo {
+ int get foo;
+ }
+
+ class Bar implements Foo {
+ static int _foo = 0;
+ final foo = _foo++;
+ }
+ outlineOnly: true
\ No newline at end of file
diff --git a/front_end/testcases/incremental_initialize_from_dill/reissue_errors_5.yaml b/front_end/testcases/incremental_initialize_from_dill/reissue_errors_5.yaml
new file mode 100644
index 0000000..c5164e2
--- /dev/null
+++ b/front_end/testcases/incremental_initialize_from_dill/reissue_errors_5.yaml
@@ -0,0 +1,67 @@
+# Copyright (c) 2019, 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.md file.
+
+# Compile an application with errors in it, then - without fixing the errors -
+# recompile. Make sure we still get errors. As long as we don't fix the error,
+# we keep getting errors. Once we fix it, we no longer get errors.
+
+type: newworld
+strong: true
+worlds:
+ - entry: main.dart
+ sources:
+ .packages: mypackage:mypackage
+ main.dart: |
+ import "package:mypackage/a.dart" as a;
+
+ main() {
+ a.main();
+ }
+ mypackage/a.dart: |
+ import "package:mypackage/b.dart";
+
+ main() {
+ foo();
+ }
+ mypackage/b.dart: |
+ foo() {
+ bar();
+ }
+ expectedLibraryCount: 3
+ errors: true
+ - entry: main.dart
+ errors: true
+ worldType: updated
+ expectInitializeFromDill: false
+ expectedLibraryCount: 3
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - package:mypackage/a.dart
+ sources:
+ mypackage/a.dart: |
+ import "package:mypackage/b.dart";
+
+ main() {
+ foo();
+ foo();
+ }
+ expectedLibraryCount: 3
+ errors: true
+ - entry: main.dart
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - package:mypackage/a.dart
+ sources:
+ mypackage/a.dart: |
+ main() {
+ foo();
+ foo();
+ }
+
+ foo() {}
+ expectedLibraryCount: 2
+ errors: false
\ No newline at end of file
diff --git a/front_end/testcases/inference/async_closure_return_type_flatten.dart b/front_end/testcases/inference/async_closure_return_type_flatten.dart
index deab006..2f2fe1b 100644
--- a/front_end/testcases/inference/async_closure_return_type_flatten.dart
+++ b/front_end/testcases/inference/async_closure_return_type_flatten.dart
@@ -8,10 +8,8 @@
import 'dart:async';
Future<int> futureInt = null;
-var /*@topType=() -> Future<int>*/ f = /*@returnType=Future<int>*/ () =>
- futureInt;
-var /*@topType=() -> Future<int>*/ g = /*@returnType=Future<int>*/ () async =>
- futureInt;
+var f = /*@returnType=Future<int>*/ () => futureInt;
+var g = /*@returnType=Future<int>*/ () async => futureInt;
main() {
f;
diff --git a/front_end/testcases/inference/async_closure_return_type_future.dart b/front_end/testcases/inference/async_closure_return_type_future.dart
index 5fbc5aa..0abd1b3 100644
--- a/front_end/testcases/inference/async_closure_return_type_future.dart
+++ b/front_end/testcases/inference/async_closure_return_type_future.dart
@@ -5,8 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=() -> Future<int>*/ f = /*@returnType=Future<int>*/ () async =>
- 0;
+var f = /*@returnType=Future<int>*/ () async => 0;
main() {
f;
diff --git a/front_end/testcases/inference/async_closure_return_type_future_or.dart b/front_end/testcases/inference/async_closure_return_type_future_or.dart
index 3404437..086bedf 100644
--- a/front_end/testcases/inference/async_closure_return_type_future_or.dart
+++ b/front_end/testcases/inference/async_closure_return_type_future_or.dart
@@ -8,10 +8,8 @@
import 'dart:async';
FutureOr<int> futureOrInt = null;
-var /*@topType=() -> FutureOr<int>*/ f = /*@returnType=FutureOr<int>*/ () =>
- futureOrInt;
-var /*@topType=() -> Future<int>*/ g = /*@returnType=Future<int>*/ () async =>
- futureOrInt;
+var f = /*@returnType=FutureOr<int>*/ () => futureOrInt;
+var g = /*@returnType=Future<int>*/ () async => futureOrInt;
main() {
f;
diff --git a/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart b/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart
index 94e4661..9e190d1 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart
+++ b/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart
@@ -6,7 +6,7 @@
library test;
String f() => null;
-var /*@topType=() -> String*/ g = f;
+var g = f;
main() {
f;
diff --git a/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart b/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart
index f640d14..3901551 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart
+++ b/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ h = null;
+var h = null;
void foo(int f(Object _)) {}
test() {
diff --git a/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.type_promotion.expect b/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.type_promotion.expect
index 2c4de0d..14d415b 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.type_promotion.expect
+++ b/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart.type_promotion.expect
@@ -1,3 +1,3 @@
-pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart:17:5: Context: Write to f@369
+pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart:17:5: Context: Write to f@348
f = /*error:INVALID_CAST_FUNCTION_EXPR*/ /*@returnType=Null*/ (/*@type=Object*/ x) =>
^
diff --git a/front_end/testcases/inference/block_bodied_lambdas_returns.dart b/front_end/testcases/inference/block_bodied_lambdas_returns.dart
index e385138..852fb3f 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_returns.dart
+++ b/front_end/testcases/inference/block_bodied_lambdas_returns.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=warning,inference*/
+/*@testedFeatures=inference*/
library test;
main() {
@@ -32,7 +32,7 @@
};
var /*@type=(bool) -> int*/ g = /*@returnType=int*/ (bool b) {
if (b) {
- /*@warning=ReturnWithoutExpression*/ return;
+ return;
} else {
return 0;
}
@@ -62,7 +62,7 @@
if (b) {
return 0;
} else {
- /*@warning=ReturnWithoutExpression*/ return;
+ return;
}
};
var /*@type=(bool) -> int*/ l = /*@returnType=int*/ (bool b) {
diff --git a/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.expect b/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.expect
index a4231bb..6d433ff 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.expect
+++ b/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.expect
@@ -2,13 +2,13 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:35:44: Warning: Must explicitly return a value from a non-void function.
-// /*@warning=ReturnWithoutExpression*/ return;
-// ^
+// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:35:7: Warning: Must explicitly return a value from a non-void function.
+// return;
+// ^
//
-// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:65:44: Warning: Must explicitly return a value from a non-void function.
-// /*@warning=ReturnWithoutExpression*/ return;
-// ^
+// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:65:7: Warning: Must explicitly return a value from a non-void function.
+// return;
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect b/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect
index a4231bb..6d433ff 100644
--- a/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/block_bodied_lambdas_returns.dart.strong.transformed.expect
@@ -2,13 +2,13 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:35:44: Warning: Must explicitly return a value from a non-void function.
-// /*@warning=ReturnWithoutExpression*/ return;
-// ^
+// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:35:7: Warning: Must explicitly return a value from a non-void function.
+// return;
+// ^
//
-// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:65:44: Warning: Must explicitly return a value from a non-void function.
-// /*@warning=ReturnWithoutExpression*/ return;
-// ^
+// pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart:65:7: Warning: Must explicitly return a value from a non-void function.
+// return;
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/inference/bottom.dart b/front_end/testcases/inference/bottom.dart
index 567246e..99a196f 100644
--- a/front_end/testcases/inference/bottom.dart
+++ b/front_end/testcases/inference/bottom.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ v = null;
+var v = null;
main() {
v;
diff --git a/front_end/testcases/inference/bottom_in_closure.dart b/front_end/testcases/inference/bottom_in_closure.dart
index a1be850..d375da9 100644
--- a/front_end/testcases/inference/bottom_in_closure.dart
+++ b/front_end/testcases/inference/bottom_in_closure.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=() -> Null*/ v = /*@returnType=Null*/ () => null;
+var v = /*@returnType=Null*/ () => null;
main() {
v;
diff --git a/front_end/testcases/inference/bug30251.dart b/front_end/testcases/inference/bug30251.dart
index 63e0ffa..98c6b1e 100644
--- a/front_end/testcases/inference/bug30251.dart
+++ b/front_end/testcases/inference/bug30251.dart
@@ -8,7 +8,7 @@
T f<T>(T t) => t;
class C {
- final /*@topType=dynamic*/ x;
+ final x;
C(int p) : x = /*@typeArgs=int*/ f(1 /*@target=num::+*/ + p);
}
diff --git a/front_end/testcases/inference/bug31132.dart b/front_end/testcases/inference/bug31132.dart
index 9e69bff..234be9a 100644
--- a/front_end/testcases/inference/bug31132.dart
+++ b/front_end/testcases/inference/bug31132.dart
@@ -8,7 +8,7 @@
class B {}
class C extends B {
- var /*@topType=dynamic*/ z;
+ var z;
}
void test(B x) {
diff --git a/front_end/testcases/inference/bug31132.dart.type_promotion.expect b/front_end/testcases/inference/bug31132.dart.type_promotion.expect
index 101f24d..8387b10 100644
--- a/front_end/testcases/inference/bug31132.dart.type_promotion.expect
+++ b/front_end/testcases/inference/bug31132.dart.type_promotion.expect
@@ -1,3 +1,3 @@
-pkg/front_end/testcases/inference/bug31132.dart:15:25: Context: Possible promotion of x@339
+pkg/front_end/testcases/inference/bug31132.dart:15:25: Context: Possible promotion of x@318
var /*@type=C*/ y = x is C ? /*@promotedType=C*/ x : new C();
^^
diff --git a/front_end/testcases/inference/callable_generic_class.dart.legacy.expect b/front_end/testcases/inference/callable_generic_class.dart.legacy.expect
index 19abeae..0423f11 100644
--- a/front_end/testcases/inference/callable_generic_class.dart.legacy.expect
+++ b/front_end/testcases/inference/callable_generic_class.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::ActionDispatcher<self::ActionDispatcher::P>
: super core::Object::•()
;
- method call([self::ActionDispatcher::P value = null]) → void {}
+ method call([generic-covariant-impl self::ActionDispatcher::P value = null]) → void {}
}
class Bar extends core::Object {
synthetic constructor •() → self::Bar
diff --git a/front_end/testcases/inference/callable_generic_class.dart.legacy.transformed.expect b/front_end/testcases/inference/callable_generic_class.dart.legacy.transformed.expect
index 19abeae..0423f11 100644
--- a/front_end/testcases/inference/callable_generic_class.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/callable_generic_class.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::ActionDispatcher<self::ActionDispatcher::P>
: super core::Object::•()
;
- method call([self::ActionDispatcher::P value = null]) → void {}
+ method call([generic-covariant-impl self::ActionDispatcher::P value = null]) → void {}
}
class Bar extends core::Object {
synthetic constructor •() → self::Bar
diff --git a/front_end/testcases/inference/callable_generic_class.dart.outline.expect b/front_end/testcases/inference/callable_generic_class.dart.outline.expect
index 186f5b0..013bfca 100644
--- a/front_end/testcases/inference/callable_generic_class.dart.outline.expect
+++ b/front_end/testcases/inference/callable_generic_class.dart.outline.expect
@@ -5,7 +5,7 @@
class ActionDispatcher<P extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::ActionDispatcher<self::ActionDispatcher::P>
;
- method call([self::ActionDispatcher::P value]) → void
+ method call([generic-covariant-impl self::ActionDispatcher::P value]) → void
;
}
class Bar extends core::Object {
diff --git a/front_end/testcases/inference/circular_method_inference.dart b/front_end/testcases/inference/circular_method_inference.dart
index a5492c9..73ac166 100644
--- a/front_end/testcases/inference/circular_method_inference.dart
+++ b/front_end/testcases/inference/circular_method_inference.dart
@@ -10,11 +10,11 @@
// that causes type inference for the method `f` to go into an infinite loop.
abstract class A extends B {
- /*@topType=dynamic*/ f(/*@topType=dynamic*/ x);
+ f(x);
}
abstract class B extends A {
- /*@topType=dynamic*/ f(/*@topType=dynamic*/ x);
+ f(x);
}
main() {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures.dart b/front_end/testcases/inference/circular_reference_via_closures.dart
index 2e499a1..b63fb9a 100644
--- a/front_end/testcases/inference/circular_reference_via_closures.dart
+++ b/front_end/testcases/inference/circular_reference_via_closures.dart
@@ -2,12 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference,error*/
+/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
- y;
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
- x;
+var x = /*@returnType=invalid-type*/ () => y;
+var y = /*@returnType=invalid-type*/ () => x;
main() {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect b/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
index 5b3b71c..73adfd1 100644
--- a/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
+++ b/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
@@ -2,18 +2,18 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
-// ^
+// var y = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => y;
+// ^
//
import self as self;
-static field dynamic x = () → dynamic => self::y;
-static field dynamic y = () → dynamic => self::x;
+static field invalid-type x = (() → invalid-type => self::y) as{TypeError} invalid-type;
+static field invalid-type y = (() → invalid-type => self::x) as{TypeError} invalid-type;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect b/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect
index 5b3b71c..73adfd1 100644
--- a/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect
@@ -2,18 +2,18 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
-// ^
+// var y = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => y;
+// ^
//
import self as self;
-static field dynamic x = () → dynamic => self::y;
-static field dynamic y = () → dynamic => self::x;
+static field invalid-type x = (() → invalid-type => self::y) as{TypeError} invalid-type;
+static field invalid-type y = (() → invalid-type => self::x) as{TypeError} invalid-type;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
index 2e499a1..b63fb9a 100644
--- a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
+++ b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
@@ -2,12 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference,error*/
+/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
- y;
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
- x;
+var x = /*@returnType=invalid-type*/ () => y;
+var y = /*@returnType=invalid-type*/ () => x;
main() {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
index a4e4a26..4f81f83 100644
--- a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
+++ b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
@@ -2,18 +2,18 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
-// ^
+// var y = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => y;
+// ^
//
import self as self;
-static field dynamic x = () → dynamic => self::y;
-static field dynamic y = () → dynamic => self::x;
+static field invalid-type x = (() → invalid-type => self::y) as{TypeError} invalid-type;
+static field invalid-type y = (() → invalid-type => self::x) as{TypeError} invalid-type;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect
index a4e4a26..4f81f83 100644
--- a/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect
@@ -2,18 +2,18 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
-// ^
+// var y = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => y;
+// ^
//
import self as self;
-static field dynamic x = () → dynamic => self::y;
-static field dynamic y = () → dynamic => self::x;
+static field invalid-type x = (() → invalid-type => self::y) as{TypeError} invalid-type;
+static field invalid-type y = (() → invalid-type => self::x) as{TypeError} invalid-type;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/conditional_lub.dart b/front_end/testcases/inference/conditional_lub.dart
index cab1316..a6b43a6 100644
--- a/front_end/testcases/inference/conditional_lub.dart
+++ b/front_end/testcases/inference/conditional_lub.dart
@@ -8,7 +8,7 @@
bool b = true;
int x = 0;
double y = 0.0;
-var /*@topType=num*/ z = b ? x : y;
+var z = b ? x : y;
main() {
var /*@type=num*/ z = b ? x : y;
diff --git a/front_end/testcases/inference/conflicting_fields.dart b/front_end/testcases/inference/conflicting_fields.dart
index 0c53592..72edc67 100644
--- a/front_end/testcases/inference/conflicting_fields.dart
+++ b/front_end/testcases/inference/conflicting_fields.dart
@@ -15,8 +15,8 @@
}
class B extends A implements I {
- get /*@topType=dynamic*/field1 => null;
- get /*@topType=dynamic*/field2 => null;
+ get field1 => null;
+ get field2 => null;
}
main() {}
diff --git a/front_end/testcases/inference/conflicting_fields.dart.strong.expect b/front_end/testcases/inference/conflicting_fields.dart.strong.expect
index be7339f..3f45ef6 100644
--- a/front_end/testcases/inference/conflicting_fields.dart.strong.expect
+++ b/front_end/testcases/inference/conflicting_fields.dart.strong.expect
@@ -2,28 +2,28 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/conflicting_fields.dart:18:27: Error: Can't infer a type for 'field1' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/conflicting_fields.dart:18:7: Error: Can't infer a type for 'field1' as some of the inherited members have different types.
// Try adding an explicit type.
-// get /*@topType=dynamic*/field1 => null;
-// ^
+// get field1 => null;
+// ^
//
-// pkg/front_end/testcases/inference/conflicting_fields.dart:19:27: Error: Can't infer a type for 'field2' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/conflicting_fields.dart:19:7: Error: Can't infer a type for 'field2' as some of the inherited members have different types.
// Try adding an explicit type.
-// get /*@topType=dynamic*/field2 => null;
-// ^
+// get field2 => null;
+// ^
//
-// pkg/front_end/testcases/inference/conflicting_fields.dart:19:27: Error: The return type of the method 'B.field2' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.field2'.
+// pkg/front_end/testcases/inference/conflicting_fields.dart:19:7: Error: The return type of the method 'B.field2' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.field2'.
// Change to a subtype of 'int'.
-// get /*@topType=dynamic*/field2 => null;
-// ^
+// get field2 => null;
+// ^
// pkg/front_end/testcases/inference/conflicting_fields.dart:9:7: Context: This is the overridden method ('field2').
// int field2;
// ^
//
-// pkg/front_end/testcases/inference/conflicting_fields.dart:18:27: Error: The return type of the method 'B.field1' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'I.field1'.
+// pkg/front_end/testcases/inference/conflicting_fields.dart:18:7: Error: The return type of the method 'B.field1' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'I.field1'.
// Change to a subtype of 'int'.
-// get /*@topType=dynamic*/field1 => null;
-// ^
+// get field1 => null;
+// ^
// pkg/front_end/testcases/inference/conflicting_fields.dart:13:7: Context: This is the overridden method ('field1').
// int field1;
// ^
diff --git a/front_end/testcases/inference/conflicts_can_happen.dart b/front_end/testcases/inference/conflicts_can_happen.dart
index ce73f69..6679d6e 100644
--- a/front_end/testcases/inference/conflicts_can_happen.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
class I1 {
@@ -22,14 +22,12 @@
}
class C1 implements A, B {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
- null;
+ get a => null;
}
// Still ambiguous
class C2 implements B, A {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
- null;
+ get a => null;
}
main() {}
diff --git a/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect b/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
index fd0caa9..6e8c47d 100644
--- a/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
+++ b/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
@@ -2,48 +2,48 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: Can't infer a type for 'a' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:7: Error: Can't infer a type for 'a' as some of the inherited members have different types.
// Try adding an explicit type.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: Can't infer a type for 'a' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:30:7: Error: Can't infer a type for 'a' as some of the inherited members have different types.
// Try adding an explicit type.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: The return type of the method 'C1.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:7: Error: The return type of the method 'C1.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
// - 'I1' is from 'pkg/front_end/testcases/inference/conflicts_can_happen.dart'.
// Change to a subtype of 'I1'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen.dart:17:12: Context: This is the overridden method ('a').
// final I1 a = null;
// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: The return type of the method 'C1.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:7: Error: The return type of the method 'C1.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
// - 'I2' is from 'pkg/front_end/testcases/inference/conflicts_can_happen.dart'.
// Change to a subtype of 'I2'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen.dart:21:12: Context: This is the overridden method ('a').
// final I2 a = null;
// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:30:7: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
// - 'I2' is from 'pkg/front_end/testcases/inference/conflicts_can_happen.dart'.
// Change to a subtype of 'I2'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen.dart:21:12: Context: This is the overridden method ('a').
// final I2 a = null;
// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:30:7: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
// - 'I1' is from 'pkg/front_end/testcases/inference/conflicts_can_happen.dart'.
// Change to a subtype of 'I1'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen.dart:17:12: Context: This is the overridden method ('a').
// final I1 a = null;
// ^
diff --git a/front_end/testcases/inference/conflicts_can_happen2.dart b/front_end/testcases/inference/conflicts_can_happen2.dart
index 150baa5..65a929e 100644
--- a/front_end/testcases/inference/conflicts_can_happen2.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
class I1 {
@@ -31,8 +31,7 @@
}
class C2 implements A, B {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
- null;
+ get a => null;
}
main() {}
diff --git a/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect b/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
index 292f0b7..411506a 100644
--- a/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
+++ b/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
@@ -2,25 +2,25 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: Can't infer a type for 'a' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:7: Error: Can't infer a type for 'a' as some of the inherited members have different types.
// Try adding an explicit type.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:7: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I1', of the overridden method, 'A.a'.
// - 'I1' is from 'pkg/front_end/testcases/inference/conflicts_can_happen2.dart'.
// Change to a subtype of 'I1'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:22:12: Context: This is the overridden method ('a').
// final I1 a = null;
// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:7: Error: The return type of the method 'C2.a' is 'dynamic', which does not match the return type, 'I2', of the overridden method, 'B.a'.
// - 'I2' is from 'pkg/front_end/testcases/inference/conflicts_can_happen2.dart'.
// Change to a subtype of 'I2'.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
-// ^
+// get a => null;
+// ^
// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:26:12: Context: This is the overridden method ('a').
// final I2 a = null;
// ^
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.expect
index 67e376b..afd777c 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.transformed.expect
index 67e376b..afd777c 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.expect
index e84c59d..3a5a56b 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor _() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.transformed.expect
index e84c59d..3a5a56b 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor _() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.expect
index 0e2824f..523f87e 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field self::A<self::A::T> f = new self::A::•<dynamic>();
+ generic-covariant-impl field self::A<self::A::T> f = new self::A::•<dynamic>();
constructor •() → self::A<self::A::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.transformed.expect
index 0e2824f..523f87e 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field self::A<self::A::T> f = new self::A::•<dynamic>();
+ generic-covariant-impl field self::A<self::A::T> f = new self::A::•<dynamic>();
constructor •() → self::A<self::A::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.expect
index 3aaa8b1..12938f7 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor named(core::List<self::C::T> t) → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.transformed.expect
index 3aaa8b1..12938f7 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor named(core::List<self::C::T> t) → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.expect
index 4761f0f..d35dcf3 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.transformed.expect
index 4761f0f..d35dcf3 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.expect
index 0dd3c05..6ad8fb3 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.transformed.expect
index 0dd3c05..6ad8fb3 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.expect
index 8b7170d..a9f6850 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor •(self::CImpl::T t) → self::CImpl<self::CImpl::T>
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.transformed.expect
index 8b7170d..a9f6850 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.legacy.transformed.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor •(self::CImpl::T t) → self::CImpl<self::CImpl::T>
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.expect
index 2efa6f7..c8c111e 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor _(self::CImpl::T t) → self::CImpl<self::CImpl::T>
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.transformed.expect
index 2efa6f7..c8c111e 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.legacy.transformed.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor _(self::CImpl::T t) → self::CImpl<self::CImpl::T>
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
index 579d4cf..2385460 100644
--- a/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
+++ b/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor _(self::CImpl::T t) → self::CImpl<self::CImpl::T>
;
static factory •<T extends core::Object = dynamic>(self::CImpl::•::T t) → self::CImpl<self::CImpl::•::T>
diff --git a/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.expect b/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.expect
index c5caad7..e3c5f4a 100644
--- a/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.expect
@@ -8,8 +8,8 @@
;
}
class Pair<T extends self::Clonable<self::Pair::T> = dynamic, U extends self::Clonable<self::Pair::U> = dynamic> extends core::Object {
- field self::Pair::T t;
- field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → self::Pair<self::Pair::T, self::Pair::U>
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.transformed.expect
index c5caad7..e3c5f4a 100644
--- a/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_inference_f_bounded.dart.legacy.transformed.expect
@@ -8,8 +8,8 @@
;
}
class Pair<T extends self::Clonable<self::Pair::T> = dynamic, U extends self::Clonable<self::Pair::U> = dynamic> extends core::Object {
- field self::Pair::T t;
- field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → self::Pair<self::Pair::T, self::Pair::U>
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_inference_f_bounded.dart.outline.expect b/front_end/testcases/inference/constructors_inference_f_bounded.dart.outline.expect
index 006b8a2..8337c9e 100644
--- a/front_end/testcases/inference/constructors_inference_f_bounded.dart.outline.expect
+++ b/front_end/testcases/inference/constructors_inference_f_bounded.dart.outline.expect
@@ -7,8 +7,8 @@
;
}
class Pair<T extends self::Clonable<self::Pair::T> = dynamic, U extends self::Clonable<self::Pair::U> = dynamic> extends core::Object {
- field self::Pair::T t;
- field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → self::Pair<self::Pair::T, self::Pair::U>
;
constructor _() → self::Pair<self::Pair::T, self::Pair::U>
diff --git a/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.expect b/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.expect
index 65cb4b4..0a86feb 100644
--- a/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.expect
+++ b/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class Pair<T extends core::Object = dynamic, U extends core::Object = dynamic> extends core::Object {
- field self::Pair::T t;
- field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → self::Pair<self::Pair::T, self::Pair::U>
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.transformed.expect b/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.transformed.expect
index 65cb4b4..0a86feb 100644
--- a/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/constructors_reverse_type_parameters.dart.legacy.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class Pair<T extends core::Object = dynamic, U extends core::Object = dynamic> extends core::Object {
- field self::Pair::T t;
- field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → self::Pair<self::Pair::T, self::Pair::U>
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart b/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart
index ee8b2d1..3eacb18 100644
--- a/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart
+++ b/front_end/testcases/inference/dont_infer_field_type_when_initializer_is_null.dart
@@ -5,15 +5,15 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ x = null;
-var /*@topType=int*/ y = 3;
+var x = null;
+var y = 3;
class A {
- static var /*@topType=dynamic*/ x = null;
- static var /*@topType=int*/ y = 3;
+ static var x = null;
+ static var y = 3;
- var /*@topType=dynamic*/ x2 = null;
- var /*@topType=int*/ y2 = 3;
+ var x2 = null;
+ var y2 = 3;
}
main() {
diff --git a/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart b/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart
index 3d735e5..a2a520c 100644
--- a/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart
+++ b/front_end/testcases/inference/downwards_context_from_inferred_field_type.dart
@@ -10,7 +10,7 @@
}
class B implements A {
- final /*@topType=Iterable<String>*/ foo = /*@typeArgs=String*/ const [];
+ final foo = /*@typeArgs=String*/ const [];
}
void main() {}
diff --git a/front_end/testcases/inference/downwards_inference_annotations_class_members.dart b/front_end/testcases/inference/downwards_inference_annotations_class_members.dart
index 37db38e..239edeb 100644
--- a/front_end/testcases/inference/downwards_inference_annotations_class_members.dart
+++ b/front_end/testcases/inference/downwards_inference_annotations_class_members.dart
@@ -14,7 +14,7 @@
Bar();
@Foo(/*@typeArgs=String*/ const [])
- var /*@topType=dynamic*/ x;
+ var x;
@Foo(/*@typeArgs=String*/ const [])
void f();
diff --git a/front_end/testcases/inference/downwards_inference_annotations_parameter.dart b/front_end/testcases/inference/downwards_inference_annotations_parameter.dart
index e4a9dea..7b0ab28 100644
--- a/front_end/testcases/inference/downwards_inference_annotations_parameter.dart
+++ b/front_end/testcases/inference/downwards_inference_annotations_parameter.dart
@@ -12,7 +12,7 @@
void f(@Foo(/*@typeArgs=String*/ const []) x) {}
class C {
- void m(@Foo(/*@typeArgs=String*/ const []) /*@topType=dynamic*/ x) {}
+ void m(@Foo(/*@typeArgs=String*/ const []) x) {}
}
main() {}
diff --git a/front_end/testcases/inference/downwards_inference_inside_top_level.dart b/front_end/testcases/inference/downwards_inference_inside_top_level.dart
index a3abe27..c50d687 100644
--- a/front_end/testcases/inference/downwards_inference_inside_top_level.dart
+++ b/front_end/testcases/inference/downwards_inference_inside_top_level.dart
@@ -13,8 +13,7 @@
B(T x);
}
-var /*@topType=A*/ t1 = new A()
- .. /*@target=A::b*/ b = new /*@typeArgs=int*/ B(1);
-var /*@topType=List<B<int>>*/ t2 = <B<int>>[new /*@typeArgs=int*/ B(2)];
+var t1 = new A().. /*@target=A::b*/ b = new /*@typeArgs=int*/ B(1);
+var t2 = <B<int>>[new /*@typeArgs=int*/ B(2)];
main() {}
diff --git a/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart b/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart
index 6d4662c..aec027f 100644
--- a/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart
+++ b/front_end/testcases/inference/downwards_inference_inside_top_level_2.dart
@@ -9,6 +9,6 @@
A(T x);
}
-var /*@topType=List<A<int>>*/ t1 = <A<int>>[new /*@typeArgs=int*/ A(1)];
+var t1 = <A<int>>[new /*@typeArgs=int*/ A(1)];
main() {}
diff --git a/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.expect b/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.expect
index c462d74..c641be2 100644
--- a/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.expect
+++ b/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class A<S extends core::Object = dynamic, T extends core::Object = dynamic> extends core::Object {
- field self::A::S x;
- field self::A::T y;
+ generic-covariant-impl field self::A::S x;
+ generic-covariant-impl field self::A::T y;
constructor •(self::A::S x, self::A::T y) → self::A<self::A::S, self::A::T>
: self::A::x = x, self::A::y = y, super core::Object::•()
;
diff --git a/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.transformed.expect b/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.transformed.expect
index c462d74..c641be2 100644
--- a/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.legacy.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class A<S extends core::Object = dynamic, T extends core::Object = dynamic> extends core::Object {
- field self::A::S x;
- field self::A::T y;
+ generic-covariant-impl field self::A::S x;
+ generic-covariant-impl field self::A::T y;
constructor •(self::A::S x, self::A::T y) → self::A<self::A::S, self::A::T>
: self::A::x = x, self::A::y = y, super core::Object::•()
;
diff --git a/front_end/testcases/inference/downwards_inference_on_list_literals_infer_if_value_types_match_context.dart b/front_end/testcases/inference/downwards_inference_on_list_literals_infer_if_value_types_match_context.dart
index ba11a16..3e0ba76 100644
--- a/front_end/testcases/inference/downwards_inference_on_list_literals_infer_if_value_types_match_context.dart
+++ b/front_end/testcases/inference/downwards_inference_on_list_literals_infer_if_value_types_match_context.dart
@@ -21,8 +21,7 @@
AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf;
AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf;
- /*@topType=dynamic*/ method(
- AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
+ method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
/*@target=C::assertAOf*/ assertAOf(
/*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
assertBOf(
@@ -40,8 +39,7 @@
AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf;
AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf;
- /*@topType=dynamic*/ method(
- AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
+ method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
/*@target=G::assertAOf*/ assertAOf(
/*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
this. /*@target=G::assertAOf*/ assertAOf(
diff --git a/front_end/testcases/inference/field_initializer_context_implicit.dart b/front_end/testcases/inference/field_initializer_context_implicit.dart
index e2e94bf..328482d 100644
--- a/front_end/testcases/inference/field_initializer_context_implicit.dart
+++ b/front_end/testcases/inference/field_initializer_context_implicit.dart
@@ -8,7 +8,7 @@
T f<T>() => null;
class C implements B {
- final /*@topType=int*/ x;
+ final x;
C() : x = /*@typeArgs=int*/ f();
}
diff --git a/front_end/testcases/inference/field_initializer_parameter.dart b/front_end/testcases/inference/field_initializer_parameter.dart
index fc2a1fa..f8779f9 100644
--- a/front_end/testcases/inference/field_initializer_parameter.dart
+++ b/front_end/testcases/inference/field_initializer_parameter.dart
@@ -8,7 +8,7 @@
T f<T>(T t) => t;
class C {
- final /*@topType=dynamic*/ x;
+ final x;
C(int p) : x = /*@typeArgs=int*/ f(p);
}
diff --git a/front_end/testcases/inference/field_refers_to_static_getter.dart b/front_end/testcases/inference/field_refers_to_static_getter.dart
index de4f471..9fa9e35 100644
--- a/front_end/testcases/inference/field_refers_to_static_getter.dart
+++ b/front_end/testcases/inference/field_refers_to_static_getter.dart
@@ -6,7 +6,7 @@
library test;
class C {
- final /*@topType=int*/ x = _x;
+ final x = _x;
static int get _x => null;
}
diff --git a/front_end/testcases/inference/field_refers_to_top_level_getter.dart b/front_end/testcases/inference/field_refers_to_top_level_getter.dart
index 5bcd783..1a2e6a6 100644
--- a/front_end/testcases/inference/field_refers_to_top_level_getter.dart
+++ b/front_end/testcases/inference/field_refers_to_top_level_getter.dart
@@ -6,7 +6,7 @@
library test;
class C {
- final /*@topType=int*/ x = y;
+ final x = y;
}
int get y => null;
diff --git a/front_end/testcases/inference/future_then.dart b/front_end/testcases/inference/future_then.dart
index 75782a4..ec52859 100644
--- a/front_end/testcases/inference/future_then.dart
+++ b/front_end/testcases/inference/future_then.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then.dart.legacy.expect b/front_end/testcases/inference/future_then.dart.legacy.expect
index 1d88ee8..88b6639 100644
--- a/front_end/testcases/inference/future_then.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then.dart.legacy.transformed.expect
index 4f27ec5..4f440e2 100644
--- a/front_end/testcases/inference/future_then.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then.dart.outline.expect b/front_end/testcases/inference/future_then.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then.dart.outline.expect
+++ b/front_end/testcases/inference/future_then.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_2.dart b/front_end/testcases/inference/future_then_2.dart
index f5f9def..7dd9d8f 100644
--- a/front_end/testcases/inference/future_then_2.dart
+++ b/front_end/testcases/inference/future_then_2.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_2.dart.legacy.expect b/front_end/testcases/inference/future_then_2.dart.legacy.expect
index 67aa4fb..a91d75e 100644
--- a/front_end/testcases/inference/future_then_2.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_2.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_2.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_2.dart.legacy.transformed.expect
index a9f33b6..6538f9e 100644
--- a/front_end/testcases/inference/future_then_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_2.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_2.dart.outline.expect b/front_end/testcases/inference/future_then_2.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_2.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_2.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_3.dart b/front_end/testcases/inference/future_then_3.dart
index 1b4bfac..59ef995 100644
--- a/front_end/testcases/inference/future_then_3.dart
+++ b/front_end/testcases/inference/future_then_3.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_3.dart.legacy.expect b/front_end/testcases/inference/future_then_3.dart.legacy.expect
index 0f44112..2a3484c 100644
--- a/front_end/testcases/inference/future_then_3.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_3.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_3.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_3.dart.legacy.transformed.expect
index 8bca318..346e77b 100644
--- a/front_end/testcases/inference/future_then_3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_3.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_3.dart.outline.expect b/front_end/testcases/inference/future_then_3.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_3.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_3.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_4.dart b/front_end/testcases/inference/future_then_4.dart
index afc672d..81923b7 100644
--- a/front_end/testcases/inference/future_then_4.dart
+++ b/front_end/testcases/inference/future_then_4.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_4.dart.legacy.expect b/front_end/testcases/inference/future_then_4.dart.legacy.expect
index f659f1f..c7d577e 100644
--- a/front_end/testcases/inference/future_then_4.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_4.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_4.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_4.dart.legacy.transformed.expect
index 56334ca..c90b143 100644
--- a/front_end/testcases/inference/future_then_4.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_4.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_4.dart.outline.expect b/front_end/testcases/inference/future_then_4.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_4.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_4.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_5.dart b/front_end/testcases/inference/future_then_5.dart
index 2fa4ef8..fbbcd00 100644
--- a/front_end/testcases/inference/future_then_5.dart
+++ b/front_end/testcases/inference/future_then_5.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_5.dart.legacy.expect b/front_end/testcases/inference/future_then_5.dart.legacy.expect
index e9987cb..141e3e7 100644
--- a/front_end/testcases/inference/future_then_5.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_5.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_5.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_5.dart.legacy.transformed.expect
index 25dacbf..33b2911 100644
--- a/front_end/testcases/inference/future_then_5.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_5.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_5.dart.outline.expect b/front_end/testcases/inference/future_then_5.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_5.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_5.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_6.dart b/front_end/testcases/inference/future_then_6.dart
index 25cb27f..6731ae3 100644
--- a/front_end/testcases/inference/future_then_6.dart
+++ b/front_end/testcases/inference/future_then_6.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_6.dart.legacy.expect b/front_end/testcases/inference/future_then_6.dart.legacy.expect
index 44e0272..cc6a439 100644
--- a/front_end/testcases/inference/future_then_6.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_6.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_6.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_6.dart.legacy.transformed.expect
index bde8fe5..9ad93e8 100644
--- a/front_end/testcases/inference/future_then_6.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_6.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_6.dart.outline.expect b/front_end/testcases/inference/future_then_6.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_6.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_6.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional.dart b/front_end/testcases/inference/future_then_conditional.dart
index 32f7cf2..2554216 100644
--- a/front_end/testcases/inference/future_then_conditional.dart
+++ b/front_end/testcases/inference/future_then_conditional.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional.dart.legacy.expect
index 4ddf6a7..579d81d 100644
--- a/front_end/testcases/inference/future_then_conditional.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional.dart.legacy.transformed.expect
index 0fc63fc..1ae82f7 100644
--- a/front_end/testcases/inference/future_then_conditional.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional.dart.outline.expect b/front_end/testcases/inference/future_then_conditional.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_2.dart b/front_end/testcases/inference/future_then_conditional_2.dart
index 9fb812d..ea5c226 100644
--- a/front_end/testcases/inference/future_then_conditional_2.dart
+++ b/front_end/testcases/inference/future_then_conditional_2.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional_2.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional_2.dart.legacy.expect
index df550a5..3fbb4f7 100644
--- a/front_end/testcases/inference/future_then_conditional_2.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional_2.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_2.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional_2.dart.legacy.transformed.expect
index 6885ac4..9b1db02 100644
--- a/front_end/testcases/inference/future_then_conditional_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional_2.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_2.dart.outline.expect b/front_end/testcases/inference/future_then_conditional_2.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional_2.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional_2.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_3.dart b/front_end/testcases/inference/future_then_conditional_3.dart
index 6a68194..3505a6d 100644
--- a/front_end/testcases/inference/future_then_conditional_3.dart
+++ b/front_end/testcases/inference/future_then_conditional_3.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional_3.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional_3.dart.legacy.expect
index 9932aa3..a38c5ae 100644
--- a/front_end/testcases/inference/future_then_conditional_3.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional_3.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_3.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional_3.dart.legacy.transformed.expect
index c7618fd..364a78a 100644
--- a/front_end/testcases/inference/future_then_conditional_3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional_3.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_3.dart.outline.expect b/front_end/testcases/inference/future_then_conditional_3.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional_3.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional_3.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_4.dart b/front_end/testcases/inference/future_then_conditional_4.dart
index f99855b..36ffafd 100644
--- a/front_end/testcases/inference/future_then_conditional_4.dart
+++ b/front_end/testcases/inference/future_then_conditional_4.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional_4.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional_4.dart.legacy.expect
index 7658f20..189b93e 100644
--- a/front_end/testcases/inference/future_then_conditional_4.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional_4.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_4.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional_4.dart.legacy.transformed.expect
index 9abcfd0..4a5e294 100644
--- a/front_end/testcases/inference/future_then_conditional_4.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional_4.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_4.dart.outline.expect b/front_end/testcases/inference/future_then_conditional_4.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional_4.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional_4.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_5.dart b/front_end/testcases/inference/future_then_conditional_5.dart
index 7520121..52dc987 100644
--- a/front_end/testcases/inference/future_then_conditional_5.dart
+++ b/front_end/testcases/inference/future_then_conditional_5.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional_5.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional_5.dart.legacy.expect
index 09a4b7b..8b21e2e 100644
--- a/front_end/testcases/inference/future_then_conditional_5.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional_5.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_5.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional_5.dart.legacy.transformed.expect
index 2f416f7..e5e7c73 100644
--- a/front_end/testcases/inference/future_then_conditional_5.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional_5.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_5.dart.outline.expect b/front_end/testcases/inference/future_then_conditional_5.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional_5.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional_5.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_6.dart b/front_end/testcases/inference/future_then_conditional_6.dart
index b5d6508..b89a28b 100644
--- a/front_end/testcases/inference/future_then_conditional_6.dart
+++ b/front_end/testcases/inference/future_then_conditional_6.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_conditional_6.dart.legacy.expect b/front_end/testcases/inference/future_then_conditional_6.dart.legacy.expect
index 24ff832..d4392fe 100644
--- a/front_end/testcases/inference/future_then_conditional_6.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_conditional_6.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_6.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_conditional_6.dart.legacy.transformed.expect
index 65684a7..fecb72e 100644
--- a/front_end/testcases/inference/future_then_conditional_6.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_conditional_6.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_conditional_6.dart.outline.expect b/front_end/testcases/inference/future_then_conditional_6.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_conditional_6.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_conditional_6.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_ifNull.dart b/front_end/testcases/inference/future_then_ifNull.dart
index 96695d4..c399f90 100644
--- a/front_end/testcases/inference/future_then_ifNull.dart
+++ b/front_end/testcases/inference/future_then_ifNull.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_ifNull.dart.legacy.expect b/front_end/testcases/inference/future_then_ifNull.dart.legacy.expect
index 57222ab..985e5ba 100644
--- a/front_end/testcases/inference/future_then_ifNull.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_ifNull.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_ifNull.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_ifNull.dart.legacy.transformed.expect
index 557fab9..f3c12bb 100644
--- a/front_end/testcases/inference/future_then_ifNull.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_ifNull.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_ifNull.dart.outline.expect b/front_end/testcases/inference/future_then_ifNull.dart.outline.expect
index 5e26f10..18f6651 100644
--- a/front_end/testcases/inference/future_then_ifNull.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_ifNull.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards.dart b/front_end/testcases/inference/future_then_upwards.dart
index 1a770e9..9c33569 100644
--- a/front_end/testcases/inference/future_then_upwards.dart
+++ b/front_end/testcases/inference/future_then_upwards.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_upwards.dart.legacy.expect b/front_end/testcases/inference/future_then_upwards.dart.legacy.expect
index 3b3f456..c454264 100644
--- a/front_end/testcases/inference/future_then_upwards.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_upwards.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_upwards.dart.legacy.transformed.expect
index 3b3f456..c454264 100644
--- a/front_end/testcases/inference/future_then_upwards.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_upwards.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards.dart.outline.expect b/front_end/testcases/inference/future_then_upwards.dart.outline.expect
index e9cb911..e5a534c 100644
--- a/front_end/testcases/inference/future_then_upwards.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_upwards.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_2.dart b/front_end/testcases/inference/future_then_upwards_2.dart
index b9d340e..ffc3c35 100644
--- a/front_end/testcases/inference/future_then_upwards_2.dart
+++ b/front_end/testcases/inference/future_then_upwards_2.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_upwards_2.dart.legacy.expect b/front_end/testcases/inference/future_then_upwards_2.dart.legacy.expect
index f0dc55f..4c532cc 100644
--- a/front_end/testcases/inference/future_then_upwards_2.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_upwards_2.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_2.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_upwards_2.dart.legacy.transformed.expect
index f0dc55f..4c532cc 100644
--- a/front_end/testcases/inference/future_then_upwards_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_upwards_2.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_2.dart.outline.expect b/front_end/testcases/inference/future_then_upwards_2.dart.outline.expect
index e9cb911..e5a534c 100644
--- a/front_end/testcases/inference/future_then_upwards_2.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_upwards_2.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_3.dart b/front_end/testcases/inference/future_then_upwards_3.dart
index f57ee71..8351c02 100644
--- a/front_end/testcases/inference/future_then_upwards_3.dart
+++ b/front_end/testcases/inference/future_then_upwards_3.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(T x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_then_upwards_3.dart.legacy.expect b/front_end/testcases/inference/future_then_upwards_3.dart.legacy.expect
index e868c2d..86abe95 100644
--- a/front_end/testcases/inference/future_then_upwards_3.dart.legacy.expect
+++ b/front_end/testcases/inference/future_then_upwards_3.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_3.dart.legacy.transformed.expect b/front_end/testcases/inference/future_then_upwards_3.dart.legacy.transformed.expect
index e868c2d..86abe95 100644
--- a/front_end/testcases/inference/future_then_upwards_3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_then_upwards_3.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_then_upwards_3.dart.outline.expect b/front_end/testcases/inference/future_then_upwards_3.dart.outline.expect
index cdfda19..9162c9b 100644
--- a/front_end/testcases/inference/future_then_upwards_3.dart.outline.expect
+++ b/front_end/testcases/inference/future_then_upwards_3.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional.dart b/front_end/testcases/inference/future_union_async_conditional.dart
index e1f0f8c..455dab2 100644
--- a/front_end/testcases/inference/future_union_async_conditional.dart
+++ b/front_end/testcases/inference/future_union_async_conditional.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_async_conditional.dart.legacy.expect b/front_end/testcases/inference/future_union_async_conditional.dart.legacy.expect
index 42ac544..aed7501 100644
--- a/front_end/testcases/inference/future_union_async_conditional.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_async_conditional.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_async_conditional.dart.legacy.transformed.expect
index 7cb03fb..7697712 100644
--- a/front_end/testcases/inference/future_union_async_conditional.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_async_conditional.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional.dart.outline.expect b/front_end/testcases/inference/future_union_async_conditional.dart.outline.expect
index 0e45bdd..e80eb43 100644
--- a/front_end/testcases/inference/future_union_async_conditional.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_async_conditional.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional_2.dart b/front_end/testcases/inference/future_union_async_conditional_2.dart
index 41e7cb0..5188287 100644
--- a/front_end/testcases/inference/future_union_async_conditional_2.dart
+++ b/front_end/testcases/inference/future_union_async_conditional_2.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value(x) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.expect b/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.expect
index 0985390..b3989b2 100644
--- a/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.transformed.expect
index 6eb70db..8c463d9 100644
--- a/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_async_conditional_2.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_async_conditional_2.dart.outline.expect b/front_end/testcases/inference/future_union_async_conditional_2.dart.outline.expect
index 0e45bdd..e80eb43 100644
--- a/front_end/testcases/inference/future_union_async_conditional_2.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_async_conditional_2.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards.dart b/front_end/testcases/inference/future_union_downwards.dart
index 5622782..2882aa8 100644
--- a/front_end/testcases/inference/future_union_downwards.dart
+++ b/front_end/testcases/inference/future_union_downwards.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value([x]) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_downwards.dart.legacy.expect b/front_end/testcases/inference/future_union_downwards.dart.legacy.expect
index 5ca32db..c309ae6 100644
--- a/front_end/testcases/inference/future_union_downwards.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_downwards.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_downwards.dart.legacy.transformed.expect
index 9c918a1..5fb66a8 100644
--- a/front_end/testcases/inference/future_union_downwards.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_downwards.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards.dart.outline.expect b/front_end/testcases/inference/future_union_downwards.dart.outline.expect
index 10cd1f0..263a94f 100644
--- a/front_end/testcases/inference/future_union_downwards.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_downwards.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_2.dart b/front_end/testcases/inference/future_union_downwards_2.dart
index 7ff20a9..9c32e85 100644
--- a/front_end/testcases/inference/future_union_downwards_2.dart
+++ b/front_end/testcases/inference/future_union_downwards_2.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value([x]) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_downwards_2.dart.legacy.expect b/front_end/testcases/inference/future_union_downwards_2.dart.legacy.expect
index 8471190..a89b874 100644
--- a/front_end/testcases/inference/future_union_downwards_2.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_downwards_2.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_2.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_downwards_2.dart.legacy.transformed.expect
index a165015..ec5724d 100644
--- a/front_end/testcases/inference/future_union_downwards_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_downwards_2.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_2.dart.outline.expect b/front_end/testcases/inference/future_union_downwards_2.dart.outline.expect
index 10cd1f0..263a94f 100644
--- a/front_end/testcases/inference/future_union_downwards_2.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_downwards_2.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_3.dart b/front_end/testcases/inference/future_union_downwards_3.dart
index 3cd6687..6d421db 100644
--- a/front_end/testcases/inference/future_union_downwards_3.dart
+++ b/front_end/testcases/inference/future_union_downwards_3.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value([x]) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_downwards_3.dart.legacy.expect b/front_end/testcases/inference/future_union_downwards_3.dart.legacy.expect
index a2acf08..9b07131 100644
--- a/front_end/testcases/inference/future_union_downwards_3.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_downwards_3.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_3.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_downwards_3.dart.legacy.transformed.expect
index f4d6505..a3884a8 100644
--- a/front_end/testcases/inference/future_union_downwards_3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_downwards_3.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_3.dart.outline.expect b/front_end/testcases/inference/future_union_downwards_3.dart.outline.expect
index 58b3b85..da18d4d 100644
--- a/front_end/testcases/inference/future_union_downwards_3.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_downwards_3.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_4.dart b/front_end/testcases/inference/future_union_downwards_4.dart
index 0bf7b5c..e9a48fc 100644
--- a/front_end/testcases/inference/future_union_downwards_4.dart
+++ b/front_end/testcases/inference/future_union_downwards_4.dart
@@ -10,7 +10,7 @@
class MyFuture<T> implements Future<T> {
MyFuture() {}
MyFuture.value([x]) {}
- dynamic noSuchMethod(/*@topType=Invocation*/ invocation) => null;
+ dynamic noSuchMethod(invocation) => null;
MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
}
diff --git a/front_end/testcases/inference/future_union_downwards_4.dart.legacy.expect b/front_end/testcases/inference/future_union_downwards_4.dart.legacy.expect
index 4efea1b..b27e6d9 100644
--- a/front_end/testcases/inference/future_union_downwards_4.dart.legacy.expect
+++ b/front_end/testcases/inference/future_union_downwards_4.dart.legacy.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_4.dart.legacy.transformed.expect b/front_end/testcases/inference/future_union_downwards_4.dart.legacy.transformed.expect
index b6eba1b..ca29563 100644
--- a/front_end/testcases/inference/future_union_downwards_4.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/future_union_downwards_4.dart.legacy.transformed.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/future_union_downwards_4.dart.outline.expect b/front_end/testcases/inference/future_union_downwards_4.dart.outline.expect
index 58b3b85..da18d4d 100644
--- a/front_end/testcases/inference/future_union_downwards_4.dart.outline.expect
+++ b/front_end/testcases/inference/future_union_downwards_4.dart.outline.expect
@@ -18,7 +18,7 @@
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {() → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
+ no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>;
no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>
return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>;
diff --git a/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.outline.expect b/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.outline.expect
index 93dfbdf..39a3325 100644
--- a/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.outline.expect
+++ b/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.outline.expect
@@ -5,7 +5,7 @@
class Foo<T extends core::Pattern = dynamic> extends core::Object {
synthetic constructor •() → self::Foo<self::Foo::T>
;
- method method<U extends self::Foo::T = dynamic>(self::Foo::method::U u) → self::Foo::method::U
+ method method<generic-covariant-impl U extends self::Foo::T = dynamic>(self::Foo::method::U u) → self::Foo::method::U
;
}
static method main() → dynamic
diff --git a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart b/front_end/testcases/inference/generic_methods_dart_math_min_max.dart
index 5ce58e8..c5494ef 100644
--- a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart
+++ b/front_end/testcases/inference/generic_methods_dart_math_min_max.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,error*/
+/*@testedFeatures=inference*/
library test;
import 'dart:math';
@@ -25,18 +25,16 @@
printInt(myMax(1, 2) as int);
printInt(
- /*@typeArgs=int*/ max(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
+ /*@typeArgs=int*/ max(1, 2.0));
printInt(
- /*@typeArgs=int*/ min(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
+ /*@typeArgs=int*/ min(1, 2.0));
printDouble(
/*@typeArgs=double*/ max(1, 2.0));
printDouble(
/*@typeArgs=double*/ min(1, 2.0));
// Types other than int and double are not accepted.
- printInt(/*@typeArgs=int*/ min(
- /*@error=ArgumentTypeNotAssignable*/ "hi",
- /*@error=ArgumentTypeNotAssignable*/ "there"));
+ printInt(/*@typeArgs=int*/ min("hi", "there"));
}
main() {}
diff --git a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.expect b/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.expect
index 13f3e92..14e6aae 100644
--- a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.expect
+++ b/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.expect
@@ -2,25 +2,25 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@typeArgs=int*/ max(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
-// ^
+// /*@typeArgs=int*/ max(1, 2.0));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@typeArgs=int*/ min(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
-// ^
+// /*@typeArgs=int*/ min(1, 2.0));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:38:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@error=ArgumentTypeNotAssignable*/ "hi",
-// ^
+// printInt(/*@typeArgs=int*/ min("hi", "there"));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:39:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@error=ArgumentTypeNotAssignable*/ "there"));
-// ^
+// printInt(/*@typeArgs=int*/ min("hi", "there"));
+// ^
//
import self as self;
import "dart:core" as core;
@@ -41,22 +41,22 @@
self::printDouble(math::min<core::double>(1.0, 2.0));
self::printInt(self::myMax(1, 2) as{TypeError} core::int);
self::printInt(self::myMax(1, 2) as core::int);
- self::printInt(math::max<core::int>(1, let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+ self::printInt(math::max<core::int>(1, let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@typeArgs=int*/ max(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
- ^" in 2.0 as{TypeError} core::int));
- self::printInt(math::min<core::int>(1, let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+ /*@typeArgs=int*/ max(1, 2.0));
+ ^" in 2.0 as{TypeError} core::int));
+ self::printInt(math::min<core::int>(1, let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@typeArgs=int*/ min(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
- ^" in 2.0 as{TypeError} core::int));
+ /*@typeArgs=int*/ min(1, 2.0));
+ ^" in 2.0 as{TypeError} core::int));
self::printDouble(math::max<core::double>(1.0, 2.0));
self::printDouble(math::min<core::double>(1.0, 2.0));
- self::printInt(math::min<core::int>(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:38:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+ self::printInt(math::min<core::int>(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@error=ArgumentTypeNotAssignable*/ \"hi\",
- ^" in "hi" as{TypeError} core::int, let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:39:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+ printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
+ ^" in "hi" as{TypeError} core::int, let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@error=ArgumentTypeNotAssignable*/ \"there\"));
- ^" in "there" as{TypeError} core::int));
+ printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
+ ^" in "there" as{TypeError} core::int));
}
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.transformed.expect b/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.transformed.expect
index 13f3e92..14e6aae 100644
--- a/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/generic_methods_dart_math_min_max.dart.strong.transformed.expect
@@ -2,25 +2,25 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@typeArgs=int*/ max(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
-// ^
+// /*@typeArgs=int*/ max(1, 2.0));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@typeArgs=int*/ min(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
-// ^
+// /*@typeArgs=int*/ min(1, 2.0));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:38:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@error=ArgumentTypeNotAssignable*/ "hi",
-// ^
+// printInt(/*@typeArgs=int*/ min("hi", "there"));
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:39:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// Try changing the type of the parameter, or casting the argument to 'int'.
-// /*@error=ArgumentTypeNotAssignable*/ "there"));
-// ^
+// printInt(/*@typeArgs=int*/ min("hi", "there"));
+// ^
//
import self as self;
import "dart:core" as core;
@@ -41,22 +41,22 @@
self::printDouble(math::min<core::double>(1.0, 2.0));
self::printInt(self::myMax(1, 2) as{TypeError} core::int);
self::printInt(self::myMax(1, 2) as core::int);
- self::printInt(math::max<core::int>(1, let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+ self::printInt(math::max<core::int>(1, let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@typeArgs=int*/ max(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
- ^" in 2.0 as{TypeError} core::int));
- self::printInt(math::min<core::int>(1, let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:69: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
+ /*@typeArgs=int*/ max(1, 2.0));
+ ^" in 2.0 as{TypeError} core::int));
+ self::printInt(math::min<core::int>(1, let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@typeArgs=int*/ min(1, /*@error=ArgumentTypeNotAssignable*/ 2.0));
- ^" in 2.0 as{TypeError} core::int));
+ /*@typeArgs=int*/ min(1, 2.0));
+ ^" in 2.0 as{TypeError} core::int));
self::printDouble(math::max<core::double>(1.0, 2.0));
self::printDouble(math::min<core::double>(1.0, 2.0));
- self::printInt(math::min<core::int>(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:38:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+ self::printInt(math::min<core::int>(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@error=ArgumentTypeNotAssignable*/ \"hi\",
- ^" in "hi" as{TypeError} core::int, let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:39:44: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
+ printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
+ ^" in "hi" as{TypeError} core::int, let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
Try changing the type of the parameter, or casting the argument to 'int'.
- /*@error=ArgumentTypeNotAssignable*/ \"there\"));
- ^" in "there" as{TypeError} core::int));
+ printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
+ ^" in "there" as{TypeError} core::int));
}
static method main() → dynamic {}
diff --git a/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart b/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart
index c72713a..fc87629 100644
--- a/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart
+++ b/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_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,error*/
+/*@testedFeatures=inference*/
library test;
class C {
@@ -10,15 +10,12 @@
}
class D extends C {
-/*@error=OverrideTypeVariablesMismatch*/
-/*@error=OverrideTypeMismatchReturnType*/ /*@topType=dynamic*/ m(
- /*@topType=dynamic*/ x) =>
- x;
+ m(x) => x;
}
main() {
int y = /*info:DYNAMIC_CAST*/ new D()
- . /*error:WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD*/ /*@target=D::m*/ /*@error=TypeArgumentMismatch*/ m<
- int>(42);
+ . /*error:WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD*/ /*@target=D::m*/ m<int>(
+ 42);
print(y);
}
diff --git a/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart.strong.expect b/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart.strong.expect
index 6e70f39..d79aa89 100644
--- a/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart.strong.expect
+++ b/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart.strong.expect
@@ -2,24 +2,24 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:14:64: Error: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
-// /*@error=OverrideTypeMismatchReturnType*/ /*@topType=dynamic*/ m(
-// ^
+// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:13:3: Error: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
+// m(x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:9:5: Context: This is the overridden method ('m').
// T m<T>(T x) => x;
// ^
//
-// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:14:64: Error: The return type of the method 'D.m' is 'dynamic', which does not match the return type, 'T', of the overridden method, 'C.m'.
+// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:13:3: Error: The return type of the method 'D.m' is 'dynamic', which does not match the return type, 'T', of the overridden method, 'C.m'.
// Change to a subtype of 'T'.
-// /*@error=OverrideTypeMismatchReturnType*/ /*@topType=dynamic*/ m(
-// ^
+// m(x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:9:5: Context: This is the overridden method ('m').
// T m<T>(T x) => x;
// ^
//
-// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:21:106: Error: Expected 0 type arguments.
-// . /*error:WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD*/ /*@target=D::m*/ /*@error=TypeArgumentMismatch*/ m<
-// ^
+// pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:18:74: Error: Expected 0 type arguments.
+// . /*error:WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD*/ /*@target=D::m*/ m<int>(
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart
index b1f78be..5d9fa15 100644
--- a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart
+++ b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart
@@ -2,21 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference,error*/
+/*@testedFeatures=inference*/
library test;
class C {
- /*@topType=dynamic*/ m(/*@topType=dynamic*/ x) => x;
+ m(x) => x;
dynamic g(int x) => x;
}
class D extends C {
- T /*@error=OverrideTypeVariablesMismatch*/ m<T>(
- T /*@error=OverrideTypeMismatchParameter*/ x) =>
- x;
- T /*@error=OverrideTypeVariablesMismatch*/ g<T>(
- T /*@error=OverrideTypeMismatchParameter*/ x) =>
- x;
+ T m<T>(T x) => x;
+ T g<T>(T x) => x;
}
main() {
diff --git a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.expect b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.expect
index 2b9e694..ecbdb07 100644
--- a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.expect
+++ b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.expect
@@ -2,16 +2,16 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:46: Warning: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
-// T /*@error=OverrideTypeVariablesMismatch*/ m<T>(
-// ^
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:24: Context: This is the overridden method ('m').
-// /*@topType=dynamic*/ m(/*@topType=dynamic*/ x) => x;
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:5: Warning: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
+// T m<T>(T x) => x;
+// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:3: Context: This is the overridden method ('m').
+// m(x) => x;
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:17:46: Warning: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
-// T /*@error=OverrideTypeVariablesMismatch*/ g<T>(
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:15:5: Warning: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
+// T g<T>(T x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:10:11: Context: This is the overridden method ('g').
// dynamic g(int x) => x;
// ^
diff --git a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.transformed.expect b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.transformed.expect
index 2b9e694..ecbdb07 100644
--- a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.legacy.transformed.expect
@@ -2,16 +2,16 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:46: Warning: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
-// T /*@error=OverrideTypeVariablesMismatch*/ m<T>(
-// ^
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:24: Context: This is the overridden method ('m').
-// /*@topType=dynamic*/ m(/*@topType=dynamic*/ x) => x;
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:5: Warning: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
+// T m<T>(T x) => x;
+// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:3: Context: This is the overridden method ('m').
+// m(x) => x;
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:17:46: Warning: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
-// T /*@error=OverrideTypeVariablesMismatch*/ g<T>(
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:15:5: Warning: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
+// T g<T>(T x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:10:11: Context: This is the overridden method ('g').
// dynamic g(int x) => x;
// ^
diff --git a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.strong.expect b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.strong.expect
index 04d3c2c..9d1f921 100644
--- a/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.strong.expect
+++ b/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart.strong.expect
@@ -2,32 +2,32 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:46: Error: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
-// T /*@error=OverrideTypeVariablesMismatch*/ m<T>(
-// ^
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:24: Context: This is the overridden method ('m').
-// /*@topType=dynamic*/ m(/*@topType=dynamic*/ x) => x;
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:5: Error: Declared type variables of 'D.m' doesn't match those on overridden method 'C.m'.
+// T m<T>(T x) => x;
+// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:3: Context: This is the overridden method ('m').
+// m(x) => x;
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:15:54: Error: The parameter 'x' of the method 'D.m' has type 'T', which does not match the corresponding type, 'dynamic', in the overridden method, 'C.m'.
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:14:12: Error: The parameter 'x' of the method 'D.m' has type 'T', which does not match the corresponding type, 'dynamic', in the overridden method, 'C.m'.
// Change to a supertype of 'dynamic', or, for a covariant parameter, a subtype.
-// T /*@error=OverrideTypeMismatchParameter*/ x) =>
-// ^
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:24: Context: This is the overridden method ('m').
-// /*@topType=dynamic*/ m(/*@topType=dynamic*/ x) => x;
-// ^
+// T m<T>(T x) => x;
+// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:9:3: Context: This is the overridden method ('m').
+// m(x) => x;
+// ^
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:17:46: Error: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
-// T /*@error=OverrideTypeVariablesMismatch*/ g<T>(
-// ^
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:15:5: Error: Declared type variables of 'D.g' doesn't match those on overridden method 'C.g'.
+// T g<T>(T x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:10:11: Context: This is the overridden method ('g').
// dynamic g(int x) => x;
// ^
//
-// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:18:54: Error: The parameter 'x' of the method 'D.g' has type 'T', which does not match the corresponding type, 'int', in the overridden method, 'C.g'.
+// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:15:12: Error: The parameter 'x' of the method 'D.g' has type 'T', which does not match the corresponding type, 'int', in the overridden method, 'C.g'.
// Change to a supertype of 'int', or, for a covariant parameter, a subtype.
-// T /*@error=OverrideTypeMismatchParameter*/ x) =>
-// ^
+// T g<T>(T x) => x;
+// ^
// pkg/front_end/testcases/inference/generic_methods_handle_override_of_non_generic_with_generic.dart:10:11: Context: This is the overridden method ('g').
// dynamic g(int x) => x;
// ^
diff --git a/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type.dart b/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type.dart
index 8fc6aa4..c980fb7 100644
--- a/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type.dart
+++ b/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type.dart
@@ -6,7 +6,7 @@
library test;
class C<T> extends D<T> {
- /*@topType=(C::f::U) -> void*/ f<U>(/*@topType=C::f::U*/ x) {}
+ f<U>(x) {}
}
class D<T> {
diff --git a/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type2.dart b/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type2.dart
index ca323a2..8ca88c6 100644
--- a/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type2.dart
+++ b/front_end/testcases/inference/generic_methods_infer_generic_function_parameter_type2.dart
@@ -6,7 +6,7 @@
library test;
class C<T> extends D<T> {
- /*@topType=void*/ f<U>(/*@topType=() -> List<C::f::U>*/ g) => null;
+ f<U>(g) => null;
}
abstract class D<T> {
diff --git a/front_end/testcases/inference/generic_methods_infer_generic_function_return_type.dart b/front_end/testcases/inference/generic_methods_infer_generic_function_return_type.dart
index 16f1fcf..e46904d 100644
--- a/front_end/testcases/inference/generic_methods_infer_generic_function_return_type.dart
+++ b/front_end/testcases/inference/generic_methods_infer_generic_function_return_type.dart
@@ -6,7 +6,7 @@
library test;
class C<T> extends D<T> {
- /*@topType=() -> C::f::U*/ f<U>(/*@topType=C::f::U*/ x) {}
+ f<U>(x) {}
}
class D<T> {
diff --git a/front_end/testcases/inference/generic_methods_infer_generic_method_type.dart b/front_end/testcases/inference/generic_methods_infer_generic_method_type.dart
index db7ae17..db2f883 100644
--- a/front_end/testcases/inference/generic_methods_infer_generic_method_type.dart
+++ b/front_end/testcases/inference/generic_methods_infer_generic_method_type.dart
@@ -10,7 +10,7 @@
}
class D extends C {
- /*@topType=D::m::S*/ m<S>(/*@topType=D::m::S*/ x) => x;
+ m<S>(x) => x;
}
main() {
diff --git a/front_end/testcases/inference/index_assign_operator_return_type.dart b/front_end/testcases/inference/index_assign_operator_return_type.dart
index 6f16f85..47099c8 100644
--- a/front_end/testcases/inference/index_assign_operator_return_type.dart
+++ b/front_end/testcases/inference/index_assign_operator_return_type.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,error*/
+/*@testedFeatures=inference*/
library test;
class C {
@@ -14,7 +14,7 @@
}
class D extends C implements I {
- operator /*@topType=void*/ []=(dynamic index, dynamic value) {}
+ operator []=(dynamic index, dynamic value) {}
}
main() {}
diff --git a/front_end/testcases/inference/index_assign_operator_return_type_2.dart b/front_end/testcases/inference/index_assign_operator_return_type_2.dart
index b7ddcd0..84362ad 100644
--- a/front_end/testcases/inference/index_assign_operator_return_type_2.dart
+++ b/front_end/testcases/inference/index_assign_operator_return_type_2.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,error*/
+/*@testedFeatures=inference*/
library test;
class C {
@@ -14,7 +14,7 @@
}
class D extends C implements I {
- operator /*@topType=void*/ []=(int index, /*@topType=dynamic*/ value) {}
+ operator []=(int index, value) {}
}
main() {}
diff --git a/front_end/testcases/inference/infer_accessor_from_later_inferred_field.dart b/front_end/testcases/inference/infer_accessor_from_later_inferred_field.dart
index 0d751d9..bd7233a 100644
--- a/front_end/testcases/inference/infer_accessor_from_later_inferred_field.dart
+++ b/front_end/testcases/inference/infer_accessor_from_later_inferred_field.dart
@@ -6,12 +6,12 @@
library test;
class A implements B {
- get /*@topType=int*/ x => f();
- void set x(/*@topType=int*/ value) {}
+ get x => f();
+ void set x(value) {}
}
class B {
- var /*@topType=int*/ x = 0;
+ var x = 0;
}
dynamic f() => null;
diff --git a/front_end/testcases/inference/infer_assign_to_ref.dart b/front_end/testcases/inference/infer_assign_to_ref.dart
index ac6e633..c4b8bcc 100644
--- a/front_end/testcases/inference/infer_assign_to_ref.dart
+++ b/front_end/testcases/inference/infer_assign_to_ref.dart
@@ -10,7 +10,7 @@
}
A a = new A();
-var /*@topType=int*/ c = 0;
+var c = 0;
main() {
a;
diff --git a/front_end/testcases/inference/infer_binary_custom.dart b/front_end/testcases/inference/infer_binary_custom.dart
index ceb40bb..d25eef7 100644
--- a/front_end/testcases/inference/infer_binary_custom.dart
+++ b/front_end/testcases/inference/infer_binary_custom.dart
@@ -6,12 +6,12 @@
library test;
class A {
- int operator +(/*@topType=dynamic*/ other) => 1;
- double operator -(/*@topType=dynamic*/ other) => 2.0;
+ int operator +(other) => 1;
+ double operator -(other) => 2.0;
}
-var /*@topType=int*/ v_add = new A() /*@target=A::+*/ + 'foo';
-var /*@topType=double*/ v_minus = new A() /*@target=A::-*/ - 'bar';
+var v_add = new A() /*@target=A::+*/ + 'foo';
+var v_minus = new A() /*@target=A::-*/ - 'bar';
main() {
v_add;
diff --git a/front_end/testcases/inference/infer_binary_double_double.dart b/front_end/testcases/inference/infer_binary_double_double.dart
index 4a70a38..ad180e6 100644
--- a/front_end/testcases/inference/infer_binary_double_double.dart
+++ b/front_end/testcases/inference/infer_binary_double_double.dart
@@ -5,18 +5,18 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a_equal = 1.0 /*@target=num::==*/ == 2.0;
-var /*@topType=bool*/ a_notEqual = 1.0 /*@target=num::==*/ != 2.0;
-var /*@topType=double*/ a_add = 1.0 /*@target=double::+*/ + 2.0;
-var /*@topType=double*/ a_subtract = 1.0 /*@target=double::-*/ - 2.0;
-var /*@topType=double*/ a_multiply = 1.0 /*@target=double::**/ * 2.0;
-var /*@topType=double*/ a_divide = 1.0 /*@target=double::/ */ / 2.0;
-var /*@topType=int*/ a_floorDivide = 1.0 /*@target=double::~/ */ ~/ 2.0;
-var /*@topType=bool*/ a_greater = 1.0 /*@target=num::>*/ > 2.0;
-var /*@topType=bool*/ a_less = 1.0 /*@target=num::<*/ < 2.0;
-var /*@topType=bool*/ a_greaterEqual = 1.0 /*@target=num::>=*/ >= 2.0;
-var /*@topType=bool*/ a_lessEqual = 1.0 /*@target=num::<=*/ <= 2.0;
-var /*@topType=double*/ a_modulo = 1.0 /*@target=double::%*/ % 2.0;
+var a_equal = 1.0 /*@target=num::==*/ == 2.0;
+var a_notEqual = 1.0 /*@target=num::==*/ != 2.0;
+var a_add = 1.0 /*@target=double::+*/ + 2.0;
+var a_subtract = 1.0 /*@target=double::-*/ - 2.0;
+var a_multiply = 1.0 /*@target=double::**/ * 2.0;
+var a_divide = 1.0 /*@target=double::/ */ / 2.0;
+var a_floorDivide = 1.0 /*@target=double::~/ */ ~/ 2.0;
+var a_greater = 1.0 /*@target=num::>*/ > 2.0;
+var a_less = 1.0 /*@target=num::<*/ < 2.0;
+var a_greaterEqual = 1.0 /*@target=num::>=*/ >= 2.0;
+var a_lessEqual = 1.0 /*@target=num::<=*/ <= 2.0;
+var a_modulo = 1.0 /*@target=double::%*/ % 2.0;
main() {
a_equal;
diff --git a/front_end/testcases/inference/infer_binary_double_int.dart b/front_end/testcases/inference/infer_binary_double_int.dart
index 00d3420..7794c6d 100644
--- a/front_end/testcases/inference/infer_binary_double_int.dart
+++ b/front_end/testcases/inference/infer_binary_double_int.dart
@@ -5,18 +5,18 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a_equal = 1.0 /*@target=num::==*/ == 2;
-var /*@topType=bool*/ a_notEqual = 1.0 /*@target=num::==*/ != 2;
-var /*@topType=double*/ a_add = 1.0 /*@target=double::+*/ + 2;
-var /*@topType=double*/ a_subtract = 1.0 /*@target=double::-*/ - 2;
-var /*@topType=double*/ a_multiply = 1.0 /*@target=double::**/ * 2;
-var /*@topType=double*/ a_divide = 1.0 /*@target=double::/ */ / 2;
-var /*@topType=int*/ a_floorDivide = 1.0 /*@target=double::~/ */ ~/ 2;
-var /*@topType=bool*/ a_greater = 1.0 /*@target=num::>*/ > 2;
-var /*@topType=bool*/ a_less = 1.0 /*@target=num::<*/ < 2;
-var /*@topType=bool*/ a_greaterEqual = 1.0 /*@target=num::>=*/ >= 2;
-var /*@topType=bool*/ a_lessEqual = 1.0 /*@target=num::<=*/ <= 2;
-var /*@topType=double*/ a_modulo = 1.0 /*@target=double::%*/ % 2;
+var a_equal = 1.0 /*@target=num::==*/ == 2;
+var a_notEqual = 1.0 /*@target=num::==*/ != 2;
+var a_add = 1.0 /*@target=double::+*/ + 2;
+var a_subtract = 1.0 /*@target=double::-*/ - 2;
+var a_multiply = 1.0 /*@target=double::**/ * 2;
+var a_divide = 1.0 /*@target=double::/ */ / 2;
+var a_floorDivide = 1.0 /*@target=double::~/ */ ~/ 2;
+var a_greater = 1.0 /*@target=num::>*/ > 2;
+var a_less = 1.0 /*@target=num::<*/ < 2;
+var a_greaterEqual = 1.0 /*@target=num::>=*/ >= 2;
+var a_lessEqual = 1.0 /*@target=num::<=*/ <= 2;
+var a_modulo = 1.0 /*@target=double::%*/ % 2;
main() {
a_equal;
diff --git a/front_end/testcases/inference/infer_binary_int_double.dart b/front_end/testcases/inference/infer_binary_int_double.dart
index 7d85e62..64d270f 100644
--- a/front_end/testcases/inference/infer_binary_int_double.dart
+++ b/front_end/testcases/inference/infer_binary_int_double.dart
@@ -5,18 +5,18 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a_equal = 1 /*@target=num::==*/ == 2.0;
-var /*@topType=bool*/ a_notEqual = 1 /*@target=num::==*/ != 2.0;
-var /*@topType=double*/ a_add = 1 /*@target=num::+*/ + 2.0;
-var /*@topType=double*/ a_subtract = 1 /*@target=num::-*/ - 2.0;
-var /*@topType=double*/ a_multiply = 1 /*@target=num::**/ * 2.0;
-var /*@topType=double*/ a_divide = 1 /*@target=num::/ */ / 2.0;
-var /*@topType=int*/ a_floorDivide = 1 /*@target=num::~/ */ ~/ 2.0;
-var /*@topType=bool*/ a_greater = 1 /*@target=num::>*/ > 2.0;
-var /*@topType=bool*/ a_less = 1 /*@target=num::<*/ < 2.0;
-var /*@topType=bool*/ a_greaterEqual = 1 /*@target=num::>=*/ >= 2.0;
-var /*@topType=bool*/ a_lessEqual = 1 /*@target=num::<=*/ <= 2.0;
-var /*@topType=double*/ a_modulo = 1 /*@target=num::%*/ % 2.0;
+var a_equal = 1 /*@target=num::==*/ == 2.0;
+var a_notEqual = 1 /*@target=num::==*/ != 2.0;
+var a_add = 1 /*@target=num::+*/ + 2.0;
+var a_subtract = 1 /*@target=num::-*/ - 2.0;
+var a_multiply = 1 /*@target=num::**/ * 2.0;
+var a_divide = 1 /*@target=num::/ */ / 2.0;
+var a_floorDivide = 1 /*@target=num::~/ */ ~/ 2.0;
+var a_greater = 1 /*@target=num::>*/ > 2.0;
+var a_less = 1 /*@target=num::<*/ < 2.0;
+var a_greaterEqual = 1 /*@target=num::>=*/ >= 2.0;
+var a_lessEqual = 1 /*@target=num::<=*/ <= 2.0;
+var a_modulo = 1 /*@target=num::%*/ % 2.0;
main() {
a_equal;
diff --git a/front_end/testcases/inference/infer_binary_int_int.dart b/front_end/testcases/inference/infer_binary_int_int.dart
index 1f22bd7..7283155 100644
--- a/front_end/testcases/inference/infer_binary_int_int.dart
+++ b/front_end/testcases/inference/infer_binary_int_int.dart
@@ -5,23 +5,23 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a_equal = 1 /*@target=num::==*/ == 2;
-var /*@topType=bool*/ a_notEqual = 1 /*@target=num::==*/ != 2;
-var /*@topType=int*/ a_bitXor = 1 /*@target=int::^*/ ^ 2;
-var /*@topType=int*/ a_bitAnd = 1 /*@target=int::&*/ & 2;
-var /*@topType=int*/ a_bitOr = 1 /*@target=int::|*/ | 2;
-var /*@topType=int*/ a_bitShiftRight = 1 /*@target=int::>>*/ >> 2;
-var /*@topType=int*/ a_bitShiftLeft = 1 /*@target=int::<<*/ << 2;
-var /*@topType=int*/ a_add = 1 /*@target=num::+*/ + 2;
-var /*@topType=int*/ a_subtract = 1 /*@target=num::-*/ - 2;
-var /*@topType=int*/ a_multiply = 1 /*@target=num::**/ * 2;
-var /*@topType=double*/ a_divide = 1 /*@target=num::/ */ / 2;
-var /*@topType=int*/ a_floorDivide = 1 /*@target=num::~/ */ ~/ 2;
-var /*@topType=bool*/ a_greater = 1 /*@target=num::>*/ > 2;
-var /*@topType=bool*/ a_less = 1 /*@target=num::<*/ < 2;
-var /*@topType=bool*/ a_greaterEqual = 1 /*@target=num::>=*/ >= 2;
-var /*@topType=bool*/ a_lessEqual = 1 /*@target=num::<=*/ <= 2;
-var /*@topType=int*/ a_modulo = 1 /*@target=num::%*/ % 2;
+var a_equal = 1 /*@target=num::==*/ == 2;
+var a_notEqual = 1 /*@target=num::==*/ != 2;
+var a_bitXor = 1 /*@target=int::^*/ ^ 2;
+var a_bitAnd = 1 /*@target=int::&*/ & 2;
+var a_bitOr = 1 /*@target=int::|*/ | 2;
+var a_bitShiftRight = 1 /*@target=int::>>*/ >> 2;
+var a_bitShiftLeft = 1 /*@target=int::<<*/ << 2;
+var a_add = 1 /*@target=num::+*/ + 2;
+var a_subtract = 1 /*@target=num::-*/ - 2;
+var a_multiply = 1 /*@target=num::**/ * 2;
+var a_divide = 1 /*@target=num::/ */ / 2;
+var a_floorDivide = 1 /*@target=num::~/ */ ~/ 2;
+var a_greater = 1 /*@target=num::>*/ > 2;
+var a_less = 1 /*@target=num::<*/ < 2;
+var a_greaterEqual = 1 /*@target=num::>=*/ >= 2;
+var a_lessEqual = 1 /*@target=num::<=*/ <= 2;
+var a_modulo = 1 /*@target=num::%*/ % 2;
main() {
a_equal;
diff --git a/front_end/testcases/inference/infer_conditional.dart b/front_end/testcases/inference/infer_conditional.dart
index 042a3a1..26bc6ea 100644
--- a/front_end/testcases/inference/infer_conditional.dart
+++ b/front_end/testcases/inference/infer_conditional.dart
@@ -5,8 +5,8 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=num*/ a = 1 /*@target=num::==*/ == 2 ? 1 : 2.0;
-var /*@topType=num*/ b = 1 /*@target=num::==*/ == 2 ? 1.0 : 2;
+var a = 1 /*@target=num::==*/ == 2 ? 1 : 2.0;
+var b = 1 /*@target=num::==*/ == 2 ? 1.0 : 2;
main() {
a;
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart b/front_end/testcases/inference/infer_consts_transitively_2.dart
index 1159b22..a86c249 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart
@@ -7,8 +7,8 @@
import 'infer_consts_transitively_2_a.dart';
-const /*@topType=int*/ m1 = a1;
-const /*@topType=int*/ m2 = a2;
+const m1 = a1;
+const m2 = a2;
foo() {
int i;
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.expect b/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.expect
index 0998224..80d04c7 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as inf;
+import "infer_consts_transitively_2_a.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
@@ -15,8 +15,8 @@
library;
import self as inf;
-import "./infer_consts_transitively_2.dart" as self;
-import "./infer_consts_transitively_2_b.dart" as inf2;
+import "infer_consts_transitively_2.dart" as self;
+import "infer_consts_transitively_2_b.dart" as inf2;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.transformed.expect
index 0998224..80d04c7 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as inf;
+import "infer_consts_transitively_2_a.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
@@ -15,8 +15,8 @@
library;
import self as inf;
-import "./infer_consts_transitively_2.dart" as self;
-import "./infer_consts_transitively_2_b.dart" as inf2;
+import "infer_consts_transitively_2.dart" as self;
+import "infer_consts_transitively_2_b.dart" as inf2;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.expect b/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.expect
index 3530a86..d434a70 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as inf;
+import "infer_consts_transitively_2_a.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_consts_transitively_2.dart" as self;
-import "./infer_consts_transitively_2_b.dart" as inf2;
+import "infer_consts_transitively_2.dart" as self;
+import "infer_consts_transitively_2_b.dart" as inf2;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.transformed.expect b/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.transformed.expect
index 3530a86..d434a70 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as inf;
+import "infer_consts_transitively_2_a.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_consts_transitively_2.dart" as self;
-import "./infer_consts_transitively_2_b.dart" as inf2;
+import "infer_consts_transitively_2.dart" as self;
+import "infer_consts_transitively_2_b.dart" as inf2;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2.dart.type_promotion.expect b/front_end/testcases/inference/infer_consts_transitively_2.dart.type_promotion.expect
index 3628855..d118f42 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2.dart.type_promotion.expect
@@ -1,3 +1,3 @@
-pkg/front_end/testcases/inference/infer_consts_transitively_2.dart:15:5: Context: Write to i@387
+pkg/front_end/testcases/inference/infer_consts_transitively_2.dart:15:5: Context: Write to i@353
i = m1;
^
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_a.dart b/front_end/testcases/inference/infer_consts_transitively_2_a.dart
index 05643fe..25fcf76 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_a.dart
+++ b/front_end/testcases/inference/infer_consts_transitively_2_a.dart
@@ -7,7 +7,7 @@
import 'infer_consts_transitively_2.dart';
import 'infer_consts_transitively_2_b.dart';
-const /*@topType=int*/ a1 = m2;
-const /*@topType=int*/ a2 = b1;
+const a1 = m2;
+const a2 = b1;
main() {}
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.expect b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.expect
index c06662b..6fa0ac1 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
-import "./infer_consts_transitively_2.dart" as test;
-import "./infer_consts_transitively_2_b.dart" as inf;
+import "infer_consts_transitively_2.dart" as test;
+import "infer_consts_transitively_2_b.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
@@ -13,7 +13,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as self;
+import "infer_consts_transitively_2_a.dart" as self;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.transformed.expect
index c06662b..6fa0ac1 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
-import "./infer_consts_transitively_2.dart" as test;
-import "./infer_consts_transitively_2_b.dart" as inf;
+import "infer_consts_transitively_2.dart" as test;
+import "infer_consts_transitively_2_b.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
@@ -13,7 +13,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as self;
+import "infer_consts_transitively_2_a.dart" as self;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.expect b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.expect
index cbafa8c..f548afe 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2.dart" as test;
-import "./infer_consts_transitively_2_b.dart" as inf;
+import "infer_consts_transitively_2.dart" as test;
+import "infer_consts_transitively_2_b.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
@@ -14,7 +14,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as self;
+import "infer_consts_transitively_2_a.dart" as self;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.transformed.expect
index cbafa8c..f548afe 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_consts_transitively_2_a.dart.strong.transformed.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_consts_transitively_2.dart" as test;
-import "./infer_consts_transitively_2_b.dart" as inf;
+import "infer_consts_transitively_2.dart" as test;
+import "infer_consts_transitively_2_b.dart" as inf;
import "org-dartlang-testcase:///infer_consts_transitively_2.dart";
import "org-dartlang-testcase:///infer_consts_transitively_2_b.dart";
@@ -14,7 +14,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_consts_transitively_2_a.dart" as self;
+import "infer_consts_transitively_2_a.dart" as self;
import "org-dartlang-testcase:///infer_consts_transitively_2_a.dart";
diff --git a/front_end/testcases/inference/infer_consts_transitively_2_b.dart b/front_end/testcases/inference/infer_consts_transitively_2_b.dart
index 6210f30..99d0034 100644
--- a/front_end/testcases/inference/infer_consts_transitively_2_b.dart
+++ b/front_end/testcases/inference/infer_consts_transitively_2_b.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*@testedFeatures=inference*/
-const /*@topType=int*/ b1 = 2;
+const b1 = 2;
main() {
b1;
diff --git a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart
index 690be00..4acae34 100644
--- a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart
+++ b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart
@@ -6,16 +6,11 @@
library test;
class A {
- var /*@topType=dynamic*/ x,
- /*@topType=int*/ y = 2,
- /*@topType=String*/ z = "hi";
+ var x, y = 2, z = "hi";
}
class B implements A {
- var /*@topType=dynamic*/ x = 2,
- /*@topType=int*/ y = 3,
- /*@topType=String*/ z,
- /*@topType=int*/ w = 2;
+ var x = 2, y = 3, z, w = 2;
}
foo() {
diff --git a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.expect b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.expect
index 5c42083..06929ac 100644
--- a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.expect
+++ b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:21:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::y*/ y;
// ^
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::w*/ w;
// ^
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:32:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::z*/ z;
// ^
@@ -41,18 +41,18 @@
core::String s;
core::int i;
s = new self::B::•().{self::B::x} as{TypeError} core::String;
- s = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ s = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:21:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::y*/ y;
^" in new self::B::•().{self::B::y} as{TypeError} core::String;
s = new self::B::•().{self::B::z};
- s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::w*/ w;
^" in new self::B::•().{self::B::w} as{TypeError} core::String;
i = new self::B::•().{self::B::x} as{TypeError} core::int;
i = new self::B::•().{self::B::y};
- i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:32:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::z*/ z;
^" in new self::B::•().{self::B::z} as{TypeError} core::int;
diff --git a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.transformed.expect b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.transformed.expect
index 5c42083..06929ac 100644
--- a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.strong.transformed.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:21:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::y*/ y;
// ^
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::w*/ w;
// ^
//
-// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:32:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::z*/ z;
// ^
@@ -41,18 +41,18 @@
core::String s;
core::int i;
s = new self::B::•().{self::B::x} as{TypeError} core::String;
- s = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ s = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:21:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::y*/ y;
^" in new self::B::•().{self::B::y} as{TypeError} core::String;
s = new self::B::•().{self::B::z};
- s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::w*/ w;
^" in new self::B::•().{self::B::w} as{TypeError} core::String;
i = new self::B::•().{self::B::x} as{TypeError} core::int;
i = new self::B::•().{self::B::y};
- i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:32:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::z*/ z;
^" in new self::B::•().{self::B::z} as{TypeError} core::int;
diff --git a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.type_promotion.expect b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.type_promotion.expect
index 7c9fd70..eeb9f3c 100644
--- a/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart.type_promotion.expect
@@ -1,24 +1,24 @@
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:25:5: Context: Write to s@537
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:20:5: Context: Write to s@374
s = /*info:DYNAMIC_CAST*/ new B(). /*@target=B::x*/ x;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:5: Context: Write to s@537
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:21:5: Context: Write to s@374
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::y*/ y;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:5: Context: Write to s@537
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:22:5: Context: Write to s@374
s = new B(). /*@target=B::z*/ z;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:5: Context: Write to s@537
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:5: Context: Write to s@374
s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::w*/ w;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:30:5: Context: Write to i@546
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:25:5: Context: Write to i@383
i = /*info:DYNAMIC_CAST*/ new B(). /*@target=B::x*/ x;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:31:5: Context: Write to i@546
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:26:5: Context: Write to i@383
i = new B(). /*@target=B::y*/ y;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:32:5: Context: Write to i@546
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:27:5: Context: Write to i@383
i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B::z*/ z;
^
-pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:33:5: Context: Write to i@546
+pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:28:5: Context: Write to i@383
i = new B(). /*@target=B::w*/ w;
^
diff --git a/front_end/testcases/inference/infer_field_from_later_inferred_field.dart b/front_end/testcases/inference/infer_field_from_later_inferred_field.dart
index b2c29f6..ed04bda 100644
--- a/front_end/testcases/inference/infer_field_from_later_inferred_field.dart
+++ b/front_end/testcases/inference/infer_field_from_later_inferred_field.dart
@@ -6,11 +6,11 @@
library test;
class A implements B {
- var /*@topType=int*/ x;
+ var x;
}
class B {
- var /*@topType=int*/ x = 0;
+ var x = 0;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_from_later_inferred_getter.dart b/front_end/testcases/inference/infer_field_from_later_inferred_getter.dart
index 680a38b..bed6351 100644
--- a/front_end/testcases/inference/infer_field_from_later_inferred_getter.dart
+++ b/front_end/testcases/inference/infer_field_from_later_inferred_getter.dart
@@ -6,11 +6,11 @@
library test;
class A implements B {
- var /*@topType=int*/ x;
+ var x;
}
abstract class B implements C {
- get /*@topType=int*/ x;
+ get x;
}
abstract class C {
diff --git a/front_end/testcases/inference/infer_field_from_later_inferred_setter.dart b/front_end/testcases/inference/infer_field_from_later_inferred_setter.dart
index 25960b5..5d758a8 100644
--- a/front_end/testcases/inference/infer_field_from_later_inferred_setter.dart
+++ b/front_end/testcases/inference/infer_field_from_later_inferred_setter.dart
@@ -6,11 +6,11 @@
library test;
class A implements B {
- var /*@topType=int*/ x;
+ var x;
}
abstract class B implements C {
- void set x(/*@topType=int*/ value);
+ void set x(value);
}
abstract class C {
diff --git a/front_end/testcases/inference/infer_field_override_multiple.dart b/front_end/testcases/inference/infer_field_override_multiple.dart
index 8b6336a..7ba15bc 100644
--- a/front_end/testcases/inference/infer_field_override_multiple.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
abstract class A {
@@ -23,21 +23,21 @@
// Superclasses have a consistent type for `x` so inferrence succeeds.
class E extends A implements B {
- var /*@topType=int*/ x;
+ var x;
}
// 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*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+ var x;
}
class G extends A implements D {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+ var x;
}
class H extends C implements D {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect b/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
index 01203f7..c24c0bb 100644
--- a/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
+++ b/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
@@ -2,65 +2,65 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: Can't infer a type for 'x' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:7: Error: Can't infer a type for 'x' as some of the inherited members have different types.
// Try adding an explicit type.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: Can't infer a type for 'x' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:7: Error: Can't infer a type for 'x' as some of the inherited members have different types.
// Try adding an explicit type.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: Can't infer a type for 'x' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:7: Error: Can't infer a type for 'x' as some of the inherited members have different types.
// Try adding an explicit type.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: The return type of the method 'F.x' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:7: Error: The return type of the method 'F.x' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.x'.
// Change to a subtype of 'int'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:9:11: Context: This is the overridden method ('x').
// int get x;
// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: The return type of the method 'F.x' is 'dynamic', which does not match the return type, 'num', of the overridden method, 'C.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:7: Error: The return type of the method 'F.x' is 'dynamic', which does not match the return type, 'num', of the overridden method, 'C.x'.
// Change to a subtype of 'num'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:17:11: Context: This is the overridden method ('x').
// num get x;
// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: The return type of the method 'G.x' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:7: Error: The return type of the method 'G.x' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.x'.
// Change to a subtype of 'int'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:9:11: Context: This is the overridden method ('x').
// int get x;
// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: The return type of the method 'G.x' is 'dynamic', which does not match the return type, 'double', of the overridden method, 'D.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:7: Error: The return type of the method 'G.x' is 'dynamic', which does not match the return type, 'double', of the overridden method, 'D.x'.
// Change to a subtype of 'double'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:21:14: Context: This is the overridden method ('x').
// double get x;
// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: The return type of the method 'H.x' is 'dynamic', which does not match the return type, 'num', of the overridden method, 'C.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:7: Error: The return type of the method 'H.x' is 'dynamic', which does not match the return type, 'num', of the overridden method, 'C.x'.
// Change to a subtype of 'num'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:17:11: Context: This is the overridden method ('x').
// num get x;
// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: The return type of the method 'H.x' is 'dynamic', which does not match the return type, 'double', of the overridden method, 'D.x'.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:7: Error: The return type of the method 'H.x' is 'dynamic', which does not match the return type, 'double', of the overridden method, 'D.x'.
// Change to a subtype of 'double'.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:21:14: Context: This is the overridden method ('x').
// double get x;
// ^
diff --git a/front_end/testcases/inference/infer_field_override_of_override.dart b/front_end/testcases/inference/infer_field_override_of_override.dart
index c1438e7..fe84499 100644
--- a/front_end/testcases/inference/infer_field_override_of_override.dart
+++ b/front_end/testcases/inference/infer_field_override_of_override.dart
@@ -14,7 +14,7 @@
}
class C extends B {
- var /*@topType=int*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_override_with_substitution.dart b/front_end/testcases/inference/infer_field_override_with_substitution.dart
index 966ead8..eaa800f 100644
--- a/front_end/testcases/inference/infer_field_override_with_substitution.dart
+++ b/front_end/testcases/inference/infer_field_override_with_substitution.dart
@@ -12,9 +12,9 @@
}
class B extends A<int> {
- var /*@topType=List<int>*/ x;
- var /*@topType=List<int>*/ y;
- var /*@topType=List<int>*/ z;
+ var x;
+ var y;
+ var z;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.expect b/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.expect
index 0ca493c..6e31b6d 100644
--- a/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.expect
@@ -3,12 +3,12 @@
import "dart:core" as core;
abstract class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> z = null;
+ generic-covariant-impl field core::List<self::A::T> z = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
abstract get x() → core::List<self::A::T>;
- abstract set y(core::List<self::A::T> value) → void;
+ abstract set y(generic-covariant-impl core::List<self::A::T> value) → void;
}
class B extends self::A<core::int> {
field dynamic x = null;
diff --git a/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.transformed.expect
index 0ca493c..6e31b6d 100644
--- a/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_field_override_with_substitution.dart.legacy.transformed.expect
@@ -3,12 +3,12 @@
import "dart:core" as core;
abstract class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> z = null;
+ generic-covariant-impl field core::List<self::A::T> z = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
abstract get x() → core::List<self::A::T>;
- abstract set y(core::List<self::A::T> value) → void;
+ abstract set y(generic-covariant-impl core::List<self::A::T> value) → void;
}
class B extends self::A<core::int> {
field dynamic x = null;
diff --git a/front_end/testcases/inference/infer_field_override_with_substitution.dart.outline.expect b/front_end/testcases/inference/infer_field_override_with_substitution.dart.outline.expect
index 71b6a0a..2fc6225 100644
--- a/front_end/testcases/inference/infer_field_override_with_substitution.dart.outline.expect
+++ b/front_end/testcases/inference/infer_field_override_with_substitution.dart.outline.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
abstract class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> z;
+ generic-covariant-impl field core::List<self::A::T> z;
synthetic constructor •() → self::A<self::A::T>
;
abstract get x() → core::List<self::A::T>;
- abstract set y(core::List<self::A::T> value) → void;
+ abstract set y(generic-covariant-impl core::List<self::A::T> value) → void;
}
class B extends self::A<core::int> {
field dynamic x;
diff --git a/front_end/testcases/inference/infer_field_overrides_getter.dart b/front_end/testcases/inference/infer_field_overrides_getter.dart
index 753c60d..04bc378 100644
--- a/front_end/testcases/inference/infer_field_overrides_getter.dart
+++ b/front_end/testcases/inference/infer_field_overrides_getter.dart
@@ -14,23 +14,23 @@
}
class C extends A {
- var /*@topType=int*/ x;
+ var x;
}
class D extends B {
- var /*@topType=int*/ x;
+ var x;
}
class E implements A {
- var /*@topType=int*/ x;
+ var x;
}
class F implements B {
- var /*@topType=int*/ x;
+ var x;
}
class G extends Object with B {
- var /*@topType=int*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_overrides_setter.dart b/front_end/testcases/inference/infer_field_overrides_setter.dart
index 6b58152..2bbf71a 100644
--- a/front_end/testcases/inference/infer_field_overrides_setter.dart
+++ b/front_end/testcases/inference/infer_field_overrides_setter.dart
@@ -14,23 +14,23 @@
}
class C extends A {
- var /*@topType=int*/ x;
+ var x;
}
class D extends B {
- var /*@topType=int*/ x;
+ var x;
}
class E implements A {
- var /*@topType=int*/ x;
+ var x;
}
class F implements B {
- var /*@topType=int*/ x;
+ var x;
}
class G extends Object with B {
- var /*@topType=int*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference/infer_field_static.dart b/front_end/testcases/inference/infer_field_static.dart
index d5ddfbc..619762f 100644
--- a/front_end/testcases/inference/infer_field_static.dart
+++ b/front_end/testcases/inference/infer_field_static.dart
@@ -15,7 +15,7 @@
// So B.x doesn't inherit A.x's type.
class B extends A {
- static var /*@topType=dynamic*/ x = f();
+ static var x = f();
}
// Similar with C.x. It is not even eligible for inference since it's static
diff --git a/front_end/testcases/inference/infer_final_field_getter_and_setter.dart b/front_end/testcases/inference/infer_final_field_getter_and_setter.dart
index 185cb96..64260b8 100644
--- a/front_end/testcases/inference/infer_final_field_getter_and_setter.dart
+++ b/front_end/testcases/inference/infer_final_field_getter_and_setter.dart
@@ -11,7 +11,7 @@
}
class B extends A {
- final /*@topType=int*/ x;
+ final x;
B(this.x);
}
diff --git a/front_end/testcases/inference/infer_final_field_getter_only.dart b/front_end/testcases/inference/infer_final_field_getter_only.dart
index fc4531b..7f0c3b0 100644
--- a/front_end/testcases/inference/infer_final_field_getter_only.dart
+++ b/front_end/testcases/inference/infer_final_field_getter_only.dart
@@ -10,7 +10,7 @@
}
class B extends A {
- final /*@topType=int*/ x;
+ final x;
B(this.x);
}
diff --git a/front_end/testcases/inference/infer_final_field_setter_only.dart b/front_end/testcases/inference/infer_final_field_setter_only.dart
index 39ed20b..15aaf46 100644
--- a/front_end/testcases/inference/infer_final_field_setter_only.dart
+++ b/front_end/testcases/inference/infer_final_field_setter_only.dart
@@ -10,7 +10,7 @@
}
class B extends A {
- final /*@topType=double*/ x;
+ final x;
B(this.x);
}
diff --git a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart
index 3b9b207..ec28367 100644
--- a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart
+++ b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart
@@ -7,32 +7,30 @@
class A {
int x;
- B operator +(/*@topType=dynamic*/ other) => null;
+ B operator +(other) => null;
}
class B extends A {
B(ignore);
}
-var /*@topType=A*/ a = new A();
+var a = new A();
// Note: it doesn't matter that some of these refer to 'x'.
-var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
-var /*@topType=List<dynamic>*/ c1 = /*@typeArgs=dynamic*/ [
+var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+var c1 = /*@typeArgs=dynamic*/ [
/*error:UNDEFINED_IDENTIFIER*/ x
]; // list literals
-var /*@topType=List<dynamic>*/ c2 = /*@typeArgs=dynamic*/ const [];
-var /*@topType=Map<dynamic, dynamic>*/ d = <dynamic, dynamic>{
- 'a': 'b'
-}; // map literals
-var /*@topType=A*/ e = new A().. /*@target=A::x*/ x = 3; // cascades
-var /*@topType=int*/ f =
+var c2 = /*@typeArgs=dynamic*/ const [];
+var d = <dynamic, dynamic>{'a': 'b'}; // map literals
+var e = new A().. /*@target=A::x*/ x = 3; // cascades
+var f =
2 /*@target=num::+*/ + 3; // binary expressions are OK if the left operand
// is from a library in a different strongest
// conected component.
-var /*@topType=int*/ g = /*@target=int::unary-*/ -3;
-var /*@topType=B*/ h = new A() /*@target=A::+*/ + 3;
-var /*@topType=dynamic*/ i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
-var /*@topType=B*/ j = /*info:UNNECESSARY_CAST*/ null as B;
+var g = /*@target=int::unary-*/ -3;
+var h = new A() /*@target=A::+*/ + 3;
+var i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
+var j = /*info:UNNECESSARY_CAST*/ null as B;
test1() {
a = /*error:INVALID_ASSIGNMENT*/ "hi";
diff --git a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.expect b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.expect
index 7ccc813..7004d74 100644
--- a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:61: Warning: Getter not found: 'x'.
-// var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
-// ^
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:46: Warning: Getter not found: 'x'.
+// var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+// ^
//
// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:21:34: Warning: Getter not found: 'x'.
// /*error:UNDEFINED_IDENTIFIER*/ x
diff --git a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.transformed.expect
index 7ccc813..7004d74 100644
--- a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.legacy.transformed.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:61: Warning: Getter not found: 'x'.
-// var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
-// ^
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:46: Warning: Getter not found: 'x'.
+// var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+// ^
//
// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:21:34: Warning: Getter not found: 'x'.
// /*error:UNDEFINED_IDENTIFIER*/ x
diff --git a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
index 0b2998b..4002d85 100644
--- a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
@@ -2,82 +2,82 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:61: Error: Getter not found: 'x'.
-// var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
-// ^
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:46: Error: Getter not found: 'x'.
+// var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+// ^
//
// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:21:34: Error: Getter not found: 'x'.
// /*error:UNDEFINED_IDENTIFIER*/ x
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:34:79: Error: The method 'unary-' isn't defined for the class 'A'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:32:58: Error: The method 'unary-' isn't defined for the class 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
-// var /*@topType=dynamic*/ i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
-// ^
+// var i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
+// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:38:36: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:36:36: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
// a = /*error:INVALID_ASSIGNMENT*/ "hi";
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:40:36: Error: A value of type 'String' can't be assigned to a variable of type 'B'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:38:36: Error: A value of type 'String' can't be assigned to a variable of type 'B'.
// - 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'B'.
// b = /*error:INVALID_ASSIGNMENT*/ "hi";
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:43:59: Error: A value of type 'Set<dynamic>' can't be assigned to a variable of type 'List<dynamic>'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:41:59: Error: A value of type 'Set<dynamic>' can't be assigned to a variable of type 'List<dynamic>'.
// - 'Set' is from 'dart:core'.
// - 'List' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'List<dynamic>'.
// c1 = /*error:INVALID_ASSIGNMENT*/ /*@typeArgs=dynamic*/ {};
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:45:59: Error: A value of type 'Set<dynamic>' can't be assigned to a variable of type 'List<dynamic>'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:43:59: Error: A value of type 'Set<dynamic>' can't be assigned to a variable of type 'List<dynamic>'.
// - 'Set' is from 'dart:core'.
// - 'List' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'List<dynamic>'.
// c2 = /*error:INVALID_ASSIGNMENT*/ /*@typeArgs=dynamic*/ {};
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:47:36: Error: A value of type 'int' can't be assigned to a variable of type 'Map<dynamic, dynamic>'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:45:36: Error: A value of type 'int' can't be assigned to a variable of type 'Map<dynamic, dynamic>'.
// - 'Map' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'Map<dynamic, dynamic>'.
// d = /*error:INVALID_ASSIGNMENT*/ 3;
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:49:67: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:47:67: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'A'.
// - 'Map' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
// e = /*error:INVALID_ASSIGNMENT*/ /*@typeArgs=dynamic, dynamic*/ {};
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:51:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:49:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// f = /*error:INVALID_ASSIGNMENT*/ false;
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:53:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:51:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// g = /*error:INVALID_ASSIGNMENT*/ false;
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:54:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:52:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
// - 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'B'.
// h = /*error:INVALID_ASSIGNMENT*/ false;
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:58:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:56:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
// - 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'B'.
// j = /*error:INVALID_ASSIGNMENT*/ false;
// ^
//
-// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:59:58: Error: A value of type 'List<dynamic>' can't be assigned to a variable of type 'B'.
+// pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:57:58: Error: A value of type 'List<dynamic>' can't be assigned to a variable of type 'B'.
// - 'List' is from 'dart:core'.
// - 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'B'.
@@ -102,9 +102,9 @@
;
}
static field self::A a = new self::A::•();
-static field self::B b = new self::B::•(invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:61: Error: Getter not found: 'x'.
-var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
- ^");
+static field self::B b = new self::B::•(invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:46: Error: Getter not found: 'x'.
+var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+ ^");
static field core::List<dynamic> c1 = <dynamic>[invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:21:34: Error: Getter not found: 'x'.
/*error:UNDEFINED_IDENTIFIER*/ x
^"];
@@ -114,20 +114,20 @@
static field core::int f = 2.{core::num::+}(3);
static field core::int g = 3.{core::int::unary-}();
static field self::B h = new self::A::•().{self::A::+}(3);
-static field dynamic i = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:34:79: Error: The method 'unary-' isn't defined for the class 'A'.
+static field dynamic i = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:32:58: Error: The method 'unary-' isn't defined for the class 'A'.
- 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
-var /*@topType=dynamic*/ i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
- ^";
+var i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
+ ^";
static field self::B j = null as self::B;
static method test1() → dynamic {
- self::a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:38:36: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+ self::a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:36:36: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
a = /*error:INVALID_ASSIGNMENT*/ \"hi\";
^" in "hi" as{TypeError} self::A;
self::a = new self::B::•(3);
- self::b = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:40:36: Error: A value of type 'String' can't be assigned to a variable of type 'B'.
+ self::b = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:38:36: Error: A value of type 'String' can't be assigned to a variable of type 'B'.
- 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'B'.
b = /*error:INVALID_ASSIGNMENT*/ \"hi\";
@@ -138,29 +138,29 @@
self::c2 = <dynamic>[];
self::c2 = let final core::Set<dynamic> #t6 = col::LinkedHashSet::•<dynamic>() in #t6;
self::d = <dynamic, dynamic>{};
- self::d = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:47:36: Error: A value of type 'int' can't be assigned to a variable of type 'Map<dynamic, dynamic>'.
+ self::d = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:45:36: Error: A value of type 'int' can't be assigned to a variable of type 'Map<dynamic, dynamic>'.
- 'Map' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'Map<dynamic, dynamic>'.
d = /*error:INVALID_ASSIGNMENT*/ 3;
^" in 3 as{TypeError} core::Map<dynamic, dynamic>;
self::e = new self::A::•();
- self::e = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:49:67: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'A'.
+ self::e = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:47:67: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'A'.
- 'Map' is from 'dart:core'.
- 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
e = /*error:INVALID_ASSIGNMENT*/ /*@typeArgs=dynamic, dynamic*/ {};
^" in <dynamic, dynamic>{} as{TypeError} self::A;
self::f = 3;
- self::f = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:51:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
+ self::f = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:49:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
f = /*error:INVALID_ASSIGNMENT*/ false;
^" in false as{TypeError} core::int;
self::g = 1;
- self::g = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:53:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
+ self::g = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:51:36: Error: A value of type 'bool' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
g = /*error:INVALID_ASSIGNMENT*/ false;
^" in false as{TypeError} core::int;
- self::h = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:54:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
+ self::h = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:52:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
- 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'B'.
h = /*error:INVALID_ASSIGNMENT*/ false;
@@ -168,12 +168,12 @@
self::h = new self::B::•("b");
self::i = false;
self::j = new self::B::•("b");
- self::j = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:58:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
+ self::j = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:56:36: Error: A value of type 'bool' can't be assigned to a variable of type 'B'.
- 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'B'.
j = /*error:INVALID_ASSIGNMENT*/ false;
^" in false as{TypeError} self::B;
- self::j = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:59:58: Error: A value of type 'List<dynamic>' can't be assigned to a variable of type 'B'.
+ self::j = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:57:58: Error: A value of type 'List<dynamic>' can't be assigned to a variable of type 'B'.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'B'.
diff --git a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.transformed.expect
index f0a746a..93049fd 100644
--- a/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.transformed.expect
@@ -17,7 +17,7 @@
}
static field self::A a = new self::A::•();
static field self::B b = new self::B::•(invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:19:61: Error: Getter not found: 'x'.
-var /*@topType=B*/ b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
+var b = new B(/*error:UNDEFINED_IDENTIFIER*/ x); // allocations
^");
static field core::List<dynamic> c1 = <dynamic>[invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:21:34: Error: Getter not found: 'x'.
/*error:UNDEFINED_IDENTIFIER*/ x
@@ -31,7 +31,7 @@
static field dynamic i = let final self::A #t3 = new self::A::•() in invalid-expression "pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart:34:79: Error: The method 'unary-' isn't defined for the class 'A'.
- 'A' is from 'pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
-var /*@topType=dynamic*/ i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
+var i = /*error:UNDEFINED_OPERATOR,info:DYNAMIC_INVOKE*/ -new A();
^";
static field self::B j = null as self::B;
static method test1() → dynamic {
diff --git a/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields.dart b/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields.dart
index 3c9c3ef..6226e35 100644
--- a/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields.dart
+++ b/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields.dart
@@ -6,11 +6,11 @@
library test;
class A {
- var /*@topType=dynamic*/ x;
+ var x;
}
class B implements A {
- var /*@topType=dynamic*/ x = 2;
+ var x = 2;
}
foo() {
diff --git a/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields2.dart b/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields2.dart
index fd0a94b..178c14a 100644
--- a/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields2.dart
+++ b/front_end/testcases/inference/infer_from_rhs_only_if_it_wont_conflict_with_overridden_fields2.dart
@@ -6,11 +6,11 @@
library test;
class A {
- final /*@topType=dynamic*/ x = null;
+ final x = null;
}
class B implements A {
- final /*@topType=dynamic*/ x = 2;
+ final x = 2;
}
foo() {
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart
index f2357b3..9943823 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart
@@ -7,7 +7,7 @@
import 'infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart';
-var /*@topType=int*/ y = x; // now ok :)
+var y = x; // now ok :)
test1() {
int t = 3;
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.expect
index 4ea1232..9c32726 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart";
@@ -24,7 +24,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.transformed.expect
index 4ea1232..9c32726 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart";
@@ -24,7 +24,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.expect
index c251bf8..3e157ba 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart";
@@ -25,7 +25,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.transformed.expect
index c251bf8..3e157ba 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart";
@@ -25,7 +25,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf2;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.type_promotion.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.type_promotion.expect
index f71d77a..ca48ff3 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart.type_promotion.expect
@@ -1,6 +1,6 @@
-pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart:14:5: Context: Write to t@389
+pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart:14:5: Context: Write to t@372
t = x;
^
-pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart:15:5: Context: Write to t@389
+pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on.dart:15:5: Context: Write to t@372
t = y;
^
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart
index 6b746f5..59b8aa8 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart
@@ -8,7 +8,7 @@
import 'infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart';
class B {
- static var /*@topType=int*/ y = A.x;
+ static var y = A.x;
}
test1() {
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.expect
index 878a97d..11440fd 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.transformed.expect
index 878a97d..11440fd 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.expect
index 28ec8b4..d23de18 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.transformed.expect
index 28ec8b4..d23de18 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.type_promotion.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.type_promotion.expect
index 5b8cb3d..298131f 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart.type_promotion.expect
@@ -1,6 +1,6 @@
-pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart:16:5: Context: Write to t@400
+pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart:16:5: Context: Write to t@383
t = A.x;
^
-pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart:17:5: Context: Write to t@400
+pkg/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2.dart:17:5: Context: Write to t@383
t = B.y;
^
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart
index dd2ad8c..cc5d086 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart
@@ -6,7 +6,7 @@
import 'infer_from_variables_in_cycle_libs_when_flag_is_on2.dart';
class A {
- static var /*@topType=int*/ x = 2;
+ static var x = 2;
}
main() {}
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.expect
index 9af84b2..3f3d4f9 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.expect
@@ -15,7 +15,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.transformed.expect
index 9af84b2..3f3d4f9 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.legacy.transformed.expect
@@ -15,7 +15,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.expect
index 5112e7e..1ace456 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.expect
@@ -15,7 +15,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.transformed.expect
index 5112e7e..1ace456 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart.strong.transformed.expect
@@ -15,7 +15,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as self;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart
index ccc5157..e0f359b 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart
@@ -5,6 +5,6 @@
/*@testedFeatures=inference*/
import 'infer_from_variables_in_cycle_libs_when_flag_is_on2.dart';
-var /*@topType=int*/ x = 2; // ok to infer
+var x = 2; // ok to infer
main() {}
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.expect
index ad43ba3..12230fd 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.expect
@@ -9,7 +9,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.transformed.expect
index ad43ba3..12230fd 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.legacy.transformed.expect
@@ -9,7 +9,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.expect
index f5cd011..f6fbc3e 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.expect
@@ -10,7 +10,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.transformed.expect
index f5cd011..f6fbc3e 100644
--- a/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a.dart.strong.transformed.expect
@@ -10,7 +10,7 @@
library test;
import self as self2;
import "dart:core" as core;
-import "./infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
+import "infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_cycle_libs_when_flag_is_on2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart
index a270099..4b54811 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart
@@ -7,7 +7,7 @@
import 'infer_from_variables_in_non_cycle_imports_with_flag_a.dart';
-var /*@topType=int*/ y = x;
+var y = x;
test1() {
x = /*error:INVALID_ASSIGNMENT*/ "hi";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.expect
index d442d47..6e1db6f 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.expect
@@ -1,6 +1,6 @@
library test;
import self as self;
-import "./infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.transformed.expect
index d442d47..6e1db6f 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library test;
import self as self;
-import "./infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.expect
index ebfe694..1499bf7 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.expect
@@ -13,7 +13,7 @@
// ^
//
import self as self;
-import "./infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.transformed.expect
index ebfe694..1499bf7 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag.dart.strong.transformed.expect
@@ -13,7 +13,7 @@
// ^
//
import self as self;
-import "./infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag_a.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart
index bdf047f..f7bb1b1 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart
@@ -8,7 +8,7 @@
import 'infer_from_variables_in_non_cycle_imports_with_flag2_a.dart';
class B {
- static var /*@topType=int*/ y = A.x;
+ static var y = A.x;
}
test1() {
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.expect
index db58bcd..426906e 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.transformed.expect
index db58bcd..426906e 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.expect
index 2af44de..4d2b4b8 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.expect
@@ -14,7 +14,7 @@
//
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.transformed.expect b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.transformed.expect
index 2af44de..4d2b4b8 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
//
import self as self;
import "dart:core" as core;
-import "./infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
+import "infer_from_variables_in_non_cycle_imports_with_flag2_a.dart" as inf;
import "org-dartlang-testcase:///infer_from_variables_in_non_cycle_imports_with_flag2_a.dart";
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2_a.dart b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2_a.dart
index 7ab5fda..906f8d8 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2_a.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag2_a.dart
@@ -4,7 +4,7 @@
/*@testedFeatures=inference*/
class A {
- static var /*@topType=int*/ x = 2;
+ static var x = 2;
}
main() {}
diff --git a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag_a.dart b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag_a.dart
index 3195c4c..1aa8c0a 100644
--- a/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag_a.dart
+++ b/front_end/testcases/inference/infer_from_variables_in_non_cycle_imports_with_flag_a.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*@testedFeatures=inference*/
-var /*@topType=int*/ x = 2;
+var x = 2;
main() {
x;
diff --git a/front_end/testcases/inference/infer_getter_cross_to_setter.dart b/front_end/testcases/inference/infer_getter_cross_to_setter.dart
index 91cd19f..203adfa 100644
--- a/front_end/testcases/inference/infer_getter_cross_to_setter.dart
+++ b/front_end/testcases/inference/infer_getter_cross_to_setter.dart
@@ -10,7 +10,7 @@
}
abstract class B extends A {
- get /*@topType=double*/ x;
+ get x;
}
main() {}
diff --git a/front_end/testcases/inference/infer_getter_from_later_inferred_getter.dart b/front_end/testcases/inference/infer_getter_from_later_inferred_getter.dart
index ff91432..7469d08 100644
--- a/front_end/testcases/inference/infer_getter_from_later_inferred_getter.dart
+++ b/front_end/testcases/inference/infer_getter_from_later_inferred_getter.dart
@@ -6,11 +6,11 @@
library test;
class A implements B {
- get /*@topType=int*/ x => f();
+ get x => f();
}
abstract class B implements C {
- get /*@topType=int*/ x;
+ get x;
}
abstract class C {
diff --git a/front_end/testcases/inference/infer_method_missing_params.dart b/front_end/testcases/inference/infer_method_missing_params.dart
index 18bc5e3..a9f6d88 100644
--- a/front_end/testcases/inference/infer_method_missing_params.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
// All of these cases are error conditions; this test checks how we recover.
@@ -20,13 +20,9 @@
}
abstract class C implements A, B {
- /*@topType=int*/ /*@error=OverrideMoreRequiredArguments*/ 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});
+ f(x, y);
+ g(x, [y]);
+ h(x, {y});
}
main() {}
diff --git a/front_end/testcases/inference/infer_method_missing_params.dart.legacy.expect b/front_end/testcases/inference/infer_method_missing_params.dart.legacy.expect
index 1738d37..5337a40 100644
--- a/front_end/testcases/inference/infer_method_missing_params.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_method_missing_params.dart.legacy.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:61: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
-// /*@topType=int*/ /*@error=OverrideMoreRequiredArguments*/ f(
-// ^
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:3: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
+// f(x, y);
+// ^
// pkg/front_end/testcases/inference/infer_method_missing_params.dart:17:7: Context: This is the overridden method ('f').
// int f(int x);
// ^
diff --git a/front_end/testcases/inference/infer_method_missing_params.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_method_missing_params.dart.legacy.transformed.expect
index 1738d37..5337a40 100644
--- a/front_end/testcases/inference/infer_method_missing_params.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_method_missing_params.dart.legacy.transformed.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:61: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
-// /*@topType=int*/ /*@error=OverrideMoreRequiredArguments*/ f(
-// ^
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:3: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
+// f(x, y);
+// ^
// pkg/front_end/testcases/inference/infer_method_missing_params.dart:17:7: Context: This is the overridden method ('f').
// int f(int x);
// ^
diff --git a/front_end/testcases/inference/infer_method_missing_params.dart.outline.expect b/front_end/testcases/inference/infer_method_missing_params.dart.outline.expect
index 5e0625d..0ae3513 100644
--- a/front_end/testcases/inference/infer_method_missing_params.dart.outline.expect
+++ b/front_end/testcases/inference/infer_method_missing_params.dart.outline.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:61: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
-// /*@topType=int*/ /*@error=OverrideMoreRequiredArguments*/ f(
-// ^
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:3: Warning: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
+// f(x, y);
+// ^
// pkg/front_end/testcases/inference/infer_method_missing_params.dart:17:7: Context: This is the overridden method ('f').
// int f(int x);
// ^
diff --git a/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect b/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
index e47b23c..f4717a8 100644
--- a/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
+++ b/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
@@ -2,24 +2,24 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:25:79: Error: Can't infer a type for 'y' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:8: Error: Can't infer a type for 'y' as some of the inherited members have different types.
// Try adding an explicit type.
-// /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y);
-// ^
+// f(x, y);
+// ^
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:29:80: Error: Can't infer a type for 'y' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:25:9: Error: Can't infer a type for 'y' as some of the inherited members have different types.
// Try adding an explicit type.
-// {/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y});
-// ^
+// h(x, {y});
+// ^
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:27:80: Error: Can't infer a type for 'y' as some of the inherited members have different types.
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:24:9: Error: Can't infer a type for 'y' as some of the inherited members have different types.
// Try adding an explicit type.
-// [/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y]);
-// ^
+// g(x, [y]);
+// ^
//
-// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:61: Error: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
-// /*@topType=int*/ /*@error=OverrideMoreRequiredArguments*/ f(
-// ^
+// pkg/front_end/testcases/inference/infer_method_missing_params.dart:23:3: Error: The method 'C.f' has more required arguments than those of overridden method 'B.f'.
+// f(x, y);
+// ^
// pkg/front_end/testcases/inference/infer_method_missing_params.dart:17:7: Context: This is the overridden method ('f').
// int f(int x);
// ^
diff --git a/front_end/testcases/inference/infer_parameter_type_setter_from_field.dart b/front_end/testcases/inference/infer_parameter_type_setter_from_field.dart
index d7e8119..2374e76 100644
--- a/front_end/testcases/inference/infer_parameter_type_setter_from_field.dart
+++ b/front_end/testcases/inference/infer_parameter_type_setter_from_field.dart
@@ -6,7 +6,7 @@
library test;
class C extends D {
- set /*@topType=void*/ foo(/*@topType=int*/ x) {}
+ set foo(x) {}
}
class D {
diff --git a/front_end/testcases/inference/infer_parameter_type_setter_from_setter.dart b/front_end/testcases/inference/infer_parameter_type_setter_from_setter.dart
index 9e5cad7..bee5d20 100644
--- a/front_end/testcases/inference/infer_parameter_type_setter_from_setter.dart
+++ b/front_end/testcases/inference/infer_parameter_type_setter_from_setter.dart
@@ -6,11 +6,11 @@
library test;
class C extends D {
- set /*@topType=void*/ foo(/*@topType=int*/ x) {}
+ set foo(x) {}
}
class D {
- set /*@topType=void*/ foo(int x) {}
+ set foo(int x) {}
}
main() {}
diff --git a/front_end/testcases/inference/infer_prefix_expression.dart b/front_end/testcases/inference/infer_prefix_expression.dart
index ea88fe0..0561e23 100644
--- a/front_end/testcases/inference/infer_prefix_expression.dart
+++ b/front_end/testcases/inference/infer_prefix_expression.dart
@@ -5,9 +5,9 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a_not = !true;
-var /*@topType=int*/ a_complement = /*@target=int::~*/ ~1;
-var /*@topType=int*/ a_negate = /*@target=int::unary-*/ -1;
+var a_not = !true;
+var a_complement = /*@target=int::~*/ ~1;
+var a_negate = /*@target=int::unary-*/ -1;
main() {
a_not;
diff --git a/front_end/testcases/inference/infer_prefix_expression_custom.dart b/front_end/testcases/inference/infer_prefix_expression_custom.dart
index 46cfedc..fe447a9 100644
--- a/front_end/testcases/inference/infer_prefix_expression_custom.dart
+++ b/front_end/testcases/inference/infer_prefix_expression_custom.dart
@@ -11,9 +11,9 @@
double operator -() => 2.0;
}
-var /*@topType=A*/ a = new A();
-var /*@topType=int*/ v_complement = /*@target=A::~*/ ~a;
-var /*@topType=double*/ v_negate = /*@target=A::unary-*/ -a;
+var a = new A();
+var v_complement = /*@target=A::~*/ ~a;
+var v_negate = /*@target=A::unary-*/ -a;
main() {
a;
diff --git a/front_end/testcases/inference/infer_return_type_for_static_setter.dart b/front_end/testcases/inference/infer_return_type_for_static_setter.dart
index e3bf142..972b299 100644
--- a/front_end/testcases/inference/infer_return_type_for_static_setter.dart
+++ b/front_end/testcases/inference/infer_return_type_for_static_setter.dart
@@ -6,9 +6,9 @@
library test;
class C {
- static set /*@topType=void*/ foo(int x) {}
+ static set foo(int x) {}
}
-set /*@topType=void*/ bar(int x) {}
+set bar(int x) {}
main() {}
diff --git a/front_end/testcases/inference/infer_setter_cross_to_getter.dart b/front_end/testcases/inference/infer_setter_cross_to_getter.dart
index 47f35d5..219dca0 100644
--- a/front_end/testcases/inference/infer_setter_cross_to_getter.dart
+++ b/front_end/testcases/inference/infer_setter_cross_to_getter.dart
@@ -10,7 +10,7 @@
}
abstract class B extends A {
- void set x(/*@topType=double*/ value);
+ void set x(value);
}
main() {}
diff --git a/front_end/testcases/inference/infer_setter_from_later_inferred_setter.dart b/front_end/testcases/inference/infer_setter_from_later_inferred_setter.dart
index 2a4141b..c0ae645 100644
--- a/front_end/testcases/inference/infer_setter_from_later_inferred_setter.dart
+++ b/front_end/testcases/inference/infer_setter_from_later_inferred_setter.dart
@@ -6,11 +6,11 @@
library test;
class A implements B {
- void set x(/*@topType=int*/ value) {}
+ void set x(value) {}
}
abstract class B implements C {
- void set x(/*@topType=int*/ value);
+ void set x(value);
}
abstract class C {
diff --git a/front_end/testcases/inference/infer_setter_return_type_only.dart b/front_end/testcases/inference/infer_setter_return_type_only.dart
index 57583aa..8e536dc 100644
--- a/front_end/testcases/inference/infer_setter_return_type_only.dart
+++ b/front_end/testcases/inference/infer_setter_return_type_only.dart
@@ -12,7 +12,7 @@
class B extends A {
// The setter return type should be inferred, but the setter parameter type
// should not.
- set /*@topType=void*/ x(Object o) {}
+ set x(Object o) {}
}
main() {
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart b/front_end/testcases/inference/infer_statics_transitively.dart
index aa06cbb..8c3c5d0 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart
+++ b/front_end/testcases/inference/infer_statics_transitively.dart
@@ -7,8 +7,8 @@
import 'infer_statics_transitively_a.dart';
-final /*@topType=int*/ m1 = a1;
-final /*@topType=int*/ m2 = A.a2;
+final m1 = a1;
+final m2 = A.a2;
foo() {
int i;
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart.legacy.expect b/front_end/testcases/inference/infer_statics_transitively.dart.legacy.expect
index 094adfb..7e55b99 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_statics_transitively.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf;
+import "infer_statics_transitively_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf2;
-import "./infer_statics_transitively.dart" as self;
+import "infer_statics_transitively_b.dart" as inf2;
+import "infer_statics_transitively.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_statics_transitively.dart.legacy.transformed.expect
index 094adfb..7e55b99 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf;
+import "infer_statics_transitively_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf2;
-import "./infer_statics_transitively.dart" as self;
+import "infer_statics_transitively_b.dart" as inf2;
+import "infer_statics_transitively.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart.strong.expect b/front_end/testcases/inference/infer_statics_transitively.dart.strong.expect
index 7d3fd79..99c4846 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart.strong.expect
+++ b/front_end/testcases/inference/infer_statics_transitively.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf;
+import "infer_statics_transitively_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf2;
-import "./infer_statics_transitively.dart" as self;
+import "infer_statics_transitively_b.dart" as inf2;
+import "infer_statics_transitively.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart.strong.transformed.expect b/front_end/testcases/inference/infer_statics_transitively.dart.strong.transformed.expect
index 7d3fd79..99c4846 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf;
+import "infer_statics_transitively_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -16,8 +16,8 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf2;
-import "./infer_statics_transitively.dart" as self;
+import "infer_statics_transitively_b.dart" as inf2;
+import "infer_statics_transitively.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively.dart.type_promotion.expect b/front_end/testcases/inference/infer_statics_transitively.dart.type_promotion.expect
index 2bf9cee..f5e0605 100644
--- a/front_end/testcases/inference/infer_statics_transitively.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_statics_transitively.dart.type_promotion.expect
@@ -1,3 +1,3 @@
-pkg/front_end/testcases/inference/infer_statics_transitively.dart:15:5: Context: Write to i@388
+pkg/front_end/testcases/inference/infer_statics_transitively.dart:15:5: Context: Write to i@354
i = m1;
^
diff --git a/front_end/testcases/inference/infer_statics_transitively2.dart b/front_end/testcases/inference/infer_statics_transitively2.dart
index 148c6f1..40dbc28 100644
--- a/front_end/testcases/inference/infer_statics_transitively2.dart
+++ b/front_end/testcases/inference/infer_statics_transitively2.dart
@@ -5,10 +5,10 @@
/*@testedFeatures=inference*/
library test;
-const /*@topType=int*/ x1 = 1;
-final /*@topType=int*/ x2 = 1;
-final /*@topType=int*/ y1 = x1;
-final /*@topType=int*/ y2 = x2;
+const x1 = 1;
+final x2 = 1;
+final y1 = x1;
+final y2 = x2;
foo() {
int i;
diff --git a/front_end/testcases/inference/infer_statics_transitively2.dart.type_promotion.expect b/front_end/testcases/inference/infer_statics_transitively2.dart.type_promotion.expect
index bd3b23f..bd4a813 100644
--- a/front_end/testcases/inference/infer_statics_transitively2.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_statics_transitively2.dart.type_promotion.expect
@@ -1,6 +1,6 @@
-pkg/front_end/testcases/inference/infer_statics_transitively2.dart:15:5: Context: Write to i@403
+pkg/front_end/testcases/inference/infer_statics_transitively2.dart:15:5: Context: Write to i@335
i = y1;
^
-pkg/front_end/testcases/inference/infer_statics_transitively2.dart:16:5: Context: Write to i@403
+pkg/front_end/testcases/inference/infer_statics_transitively2.dart:16:5: Context: Write to i@335
i = y2;
^
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart b/front_end/testcases/inference/infer_statics_transitively3.dart
index 6bd303b..16e92d1 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart
@@ -8,12 +8,12 @@
import 'infer_statics_transitively3_a.dart' show a1, A;
import 'infer_statics_transitively3_a.dart' as p show a2, A;
-const /*@topType=int*/ t1 = 1;
-const /*@topType=int*/ t2 = t1;
-const /*@topType=int*/ t3 = a1;
-const /*@topType=int*/ t4 = p.a2;
-const /*@topType=dynamic*/ t5 = A.a3;
-const /*@topType=dynamic*/ t6 = p.A.a3;
+const t1 = 1;
+const t2 = t1;
+const t3 = a1;
+const t4 = p.a2;
+const t5 = A.a3;
+const t6 = p.A.a3;
foo() {
int i;
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.expect b/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.expect
index c14e037..b5b71b0 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively3_a.dart" as inf;
+import "infer_statics_transitively3_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart";
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart" as p;
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.transformed.expect
index c14e037..b5b71b0 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively3_a.dart" as inf;
+import "infer_statics_transitively3_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart";
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart" as p;
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart.strong.expect b/front_end/testcases/inference/infer_statics_transitively3.dart.strong.expect
index 8554b53..d80f5c4 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart.strong.expect
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively3_a.dart" as inf;
+import "infer_statics_transitively3_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart";
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart" as p;
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart.strong.transformed.expect b/front_end/testcases/inference/infer_statics_transitively3.dart.strong.transformed.expect
index 8554b53..d80f5c4 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively3_a.dart" as inf;
+import "infer_statics_transitively3_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart";
import "org-dartlang-testcase:///infer_statics_transitively3_a.dart" as p;
diff --git a/front_end/testcases/inference/infer_statics_transitively3.dart.type_promotion.expect b/front_end/testcases/inference/infer_statics_transitively3.dart.type_promotion.expect
index 2d28253..3a64db3 100644
--- a/front_end/testcases/inference/infer_statics_transitively3.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_statics_transitively3.dart.type_promotion.expect
@@ -1,12 +1,12 @@
-pkg/front_end/testcases/inference/infer_statics_transitively3.dart:20:5: Context: Write to i@602
+pkg/front_end/testcases/inference/infer_statics_transitively3.dart:20:5: Context: Write to i@492
i = t1;
^
-pkg/front_end/testcases/inference/infer_statics_transitively3.dart:21:5: Context: Write to i@602
+pkg/front_end/testcases/inference/infer_statics_transitively3.dart:21:5: Context: Write to i@492
i = t2;
^
-pkg/front_end/testcases/inference/infer_statics_transitively3.dart:22:5: Context: Write to i@602
+pkg/front_end/testcases/inference/infer_statics_transitively3.dart:22:5: Context: Write to i@492
i = t3;
^
-pkg/front_end/testcases/inference/infer_statics_transitively3.dart:23:5: Context: Write to i@602
+pkg/front_end/testcases/inference/infer_statics_transitively3.dart:23:5: Context: Write to i@492
i = t4;
^
diff --git a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.expect b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.expect
index 041ca29..4e48a93 100644
--- a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -21,7 +21,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf2;
+import "infer_statics_transitively_a.dart" as inf2;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -44,8 +44,8 @@
library;
import self as inf2;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.transformed.expect
index 041ca29..4e48a93 100644
--- a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.legacy.transformed.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -21,7 +21,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf2;
+import "infer_statics_transitively_a.dart" as inf2;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -44,8 +44,8 @@
library;
import self as inf2;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.expect b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.expect
index 295510c..9891055 100644
--- a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -21,7 +21,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf2;
+import "infer_statics_transitively_a.dart" as inf2;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -45,8 +45,8 @@
library;
import self as inf2;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.transformed.expect
index 295510c..9891055 100644
--- a/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_2_a.dart.strong.transformed.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -21,7 +21,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as inf2;
+import "infer_statics_transitively_a.dart" as inf2;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
@@ -45,8 +45,8 @@
library;
import self as inf2;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_a.dart b/front_end/testcases/inference/infer_statics_transitively_a.dart
index 3d09a81..a7b6d9e 100644
--- a/front_end/testcases/inference/infer_statics_transitively_a.dart
+++ b/front_end/testcases/inference/infer_statics_transitively_a.dart
@@ -7,10 +7,10 @@
import 'infer_statics_transitively.dart';
import 'infer_statics_transitively_b.dart';
-final /*@topType=int*/ a1 = m2;
+final a1 = m2;
class A {
- static final /*@topType=int*/ a2 = b1;
+ static final a2 = b1;
}
main() {}
diff --git a/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.expect b/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.expect
index e1f6bf9..7c8af8a 100644
--- a/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -19,7 +19,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as self;
+import "infer_statics_transitively_a.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.transformed.expect
index e1f6bf9..7c8af8a 100644
--- a/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_a.dart.legacy.transformed.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -19,7 +19,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as self;
+import "infer_statics_transitively_a.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.expect b/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.expect
index e5c5eb0..aa6b4be 100644
--- a/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -19,7 +19,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as self;
+import "infer_statics_transitively_a.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.transformed.expect
index e5c5eb0..aa6b4be 100644
--- a/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_transitively_a.dart.strong.transformed.expect
@@ -1,8 +1,8 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_statics_transitively_b.dart" as inf;
-import "./infer_statics_transitively.dart" as test;
+import "infer_statics_transitively_b.dart" as inf;
+import "infer_statics_transitively.dart" as test;
import "org-dartlang-testcase:///infer_statics_transitively.dart";
import "org-dartlang-testcase:///infer_statics_transitively_b.dart";
@@ -19,7 +19,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_statics_transitively_a.dart" as self;
+import "infer_statics_transitively_a.dart" as self;
import "org-dartlang-testcase:///infer_statics_transitively_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.expect b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.expect
index cdad9fa..1303bcc 100644
--- a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_with_method_invocations_a.dart" as inf;
+import "infer_statics_with_method_invocations_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_with_method_invocations_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.transformed.expect
index cdad9fa..1303bcc 100644
--- a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_with_method_invocations_a.dart" as inf;
+import "infer_statics_with_method_invocations_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_with_method_invocations_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.expect b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.expect
index cdad9fa..1303bcc 100644
--- a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.expect
+++ b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_with_method_invocations_a.dart" as inf;
+import "infer_statics_with_method_invocations_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_with_method_invocations_a.dart";
diff --git a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.transformed.expect b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.transformed.expect
index cdad9fa..1303bcc 100644
--- a/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_statics_with_method_invocations.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_statics_with_method_invocations_a.dart" as inf;
+import "infer_statics_with_method_invocations_a.dart" as inf;
import "org-dartlang-testcase:///infer_statics_with_method_invocations_a.dart";
diff --git a/front_end/testcases/inference/infer_throw.dart b/front_end/testcases/inference/infer_throw.dart
index 0bd74f4..53940dc 100644
--- a/front_end/testcases/inference/infer_throw.dart
+++ b/front_end/testcases/inference/infer_throw.dart
@@ -5,10 +5,10 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ t = true;
-var /*@topType=dynamic*/ a = (throw 0);
-var /*@topType=int*/ b = (throw 0) ? 1 : 2;
-var /*@topType=int*/ c = t ? (throw 1) : 2;
-var /*@topType=int*/ d = t ? 1 : (throw 2);
+var t = true;
+var a = (throw 0);
+var b = (throw 0) ? 1 : 2;
+var c = t ? (throw 1) : 2;
+var d = t ? 1 : (throw 2);
main() {}
diff --git a/front_end/testcases/inference/infer_throw_downwards.dart b/front_end/testcases/inference/infer_throw_downwards.dart
index c733531..d542a11 100644
--- a/front_end/testcases/inference/infer_throw_downwards.dart
+++ b/front_end/testcases/inference/infer_throw_downwards.dart
@@ -7,7 +7,7 @@
T f<T>() => null;
-var /*@topType=dynamic*/ x = throw /*@typeArgs=dynamic*/ f();
+var x = throw /*@typeArgs=dynamic*/ f();
void g() {
var /*@type=dynamic*/ x = throw /*@typeArgs=dynamic*/ f();
diff --git a/front_end/testcases/inference/infer_type_on_overridden_fields2.dart b/front_end/testcases/inference/infer_type_on_overridden_fields2.dart
index 356477b..e203004 100644
--- a/front_end/testcases/inference/infer_type_on_overridden_fields2.dart
+++ b/front_end/testcases/inference/infer_type_on_overridden_fields2.dart
@@ -10,7 +10,7 @@
}
class B extends A {
- get /*@topType=int*/ x => 3;
+ get x => 3;
}
foo() {
diff --git a/front_end/testcases/inference/infer_type_on_overridden_fields4.dart b/front_end/testcases/inference/infer_type_on_overridden_fields4.dart
index 130f045..5dd2297 100644
--- a/front_end/testcases/inference/infer_type_on_overridden_fields4.dart
+++ b/front_end/testcases/inference/infer_type_on_overridden_fields4.dart
@@ -10,7 +10,7 @@
}
class B implements A {
- get /*@topType=int*/ x => 3;
+ get x => 3;
}
foo() {
diff --git a/front_end/testcases/inference/infer_type_on_var_from_field.dart b/front_end/testcases/inference/infer_type_on_var_from_field.dart
index 8c53b40..8301e0d 100644
--- a/front_end/testcases/inference/infer_type_on_var_from_field.dart
+++ b/front_end/testcases/inference/infer_type_on_var_from_field.dart
@@ -8,7 +8,7 @@
class A {
int x = 0;
- /*@topType=dynamic*/ test1() {
+ test1() {
var /*@type=int*/ a = /*@target=A::x*/ x;
a = /*error:INVALID_ASSIGNMENT*/ "hi";
a = 3;
@@ -21,7 +21,7 @@
}
int y; // field def after use
- final /*@topType=int*/ z = 42; // should infer `int`
+ final z = 42; // should infer `int`
}
main() {}
diff --git a/front_end/testcases/inference/infer_type_on_var_from_field.dart.type_promotion.expect b/front_end/testcases/inference/infer_type_on_var_from_field.dart.type_promotion.expect
index e745ffe..426e83a 100644
--- a/front_end/testcases/inference/infer_type_on_var_from_field.dart.type_promotion.expect
+++ b/front_end/testcases/inference/infer_type_on_var_from_field.dart.type_promotion.expect
@@ -1,18 +1,18 @@
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:13:7: Context: Write to a@341
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:13:7: Context: Write to a@320
a = /*error:INVALID_ASSIGNMENT*/ "hi";
^
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:14:7: Context: Write to a@341
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:14:7: Context: Write to a@320
a = 3;
^
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:16:7: Context: Write to b@441
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:16:7: Context: Write to b@420
b = /*error:INVALID_ASSIGNMENT*/ "hi";
^
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:17:7: Context: Write to b@441
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:17:7: Context: Write to b@420
b = 4;
^
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:19:7: Context: Write to c@541
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:19:7: Context: Write to c@520
c = /*error:INVALID_ASSIGNMENT*/ "hi";
^
-pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:20:7: Context: Write to c@541
+pkg/front_end/testcases/inference/infer_type_on_var_from_field.dart:20:7: Context: Write to c@520
c = 4;
^
diff --git a/front_end/testcases/inference/infer_type_on_var_from_top_level.dart b/front_end/testcases/inference/infer_type_on_var_from_top_level.dart
index 402a884..6b971b5 100644
--- a/front_end/testcases/inference/infer_type_on_var_from_top_level.dart
+++ b/front_end/testcases/inference/infer_type_on_var_from_top_level.dart
@@ -20,6 +20,6 @@
}
int y = 0; // field def after use
-final /*@topType=int*/ z = 42; // should infer `int`
+final z = 42; // should infer `int`
main() {}
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart
index 8f61c86..6a235ad 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart
@@ -8,7 +8,7 @@
import 'infer_type_regardless_of_declaration_order_or_cycles_b.dart';
class C extends B {
- get /*@topType=int*/ x => null;
+ get x => null;
}
class A {
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.expect
index 4302f4f..707d09d 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.expect
@@ -1,6 +1,6 @@
library test;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
@@ -29,7 +29,7 @@
library;
import self as inf;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.transformed.expect
index 4302f4f..707d09d 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library test;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
@@ -29,7 +29,7 @@
library;
import self as inf;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.expect
index 1f0fd34..ff10b61 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.expect
@@ -8,7 +8,7 @@
// ^
//
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
@@ -40,7 +40,7 @@
library;
import self as inf;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.transformed.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.transformed.expect
index 1f0fd34..ff10b61 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles.dart.strong.transformed.expect
@@ -8,7 +8,7 @@
// ^
//
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as inf;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
@@ -40,7 +40,7 @@
library;
import self as inf;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as self;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.expect
index 2e91f62..f32c8d5 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
@@ -13,7 +13,7 @@
library test;
import self as test;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.transformed.expect
index 2e91f62..f32c8d5 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
@@ -13,7 +13,7 @@
library test;
import self as test;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.expect
index fe03c30..9b49051 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
@@ -21,7 +21,7 @@
// ^
//
import self as test;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
diff --git a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.transformed.expect b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.transformed.expect
index fe03c30..9b49051 100644
--- a/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_type_regardless_of_declaration_order_or_cycles_b.dart.strong.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
+import "infer_type_regardless_of_declaration_order_or_cycles.dart" as test;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles.dart";
@@ -21,7 +21,7 @@
// ^
//
import self as test;
-import "./infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
+import "infer_type_regardless_of_declaration_order_or_cycles_b.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///infer_type_regardless_of_declaration_order_or_cycles_b.dart";
diff --git a/front_end/testcases/inference/infer_typed_map_literal.dart b/front_end/testcases/inference/infer_typed_map_literal.dart
index 0b78431..03bad8b 100644
--- a/front_end/testcases/inference/infer_typed_map_literal.dart
+++ b/front_end/testcases/inference/infer_typed_map_literal.dart
@@ -5,13 +5,12 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=Map<int, String>*/ a = <int, String>{0: 'aaa', 1: 'bbb'};
-var /*@topType=Map<double, int>*/ b = <double, int>{1.1: 1, 2.2: 2};
-var /*@topType=Map<List<int>, Map<String, double>>*/ c =
- <List<int>, Map<String, double>>{};
-var /*@topType=Map<int, dynamic>*/ d = <int, dynamic>{};
-var /*@topType=Map<dynamic, int>*/ e = <dynamic, int>{};
-var /*@topType=Map<dynamic, dynamic>*/ f = <dynamic, dynamic>{};
+var a = <int, String>{0: 'aaa', 1: 'bbb'};
+var b = <double, int>{1.1: 1, 2.2: 2};
+var c = <List<int>, Map<String, double>>{};
+var d = <int, dynamic>{};
+var e = <dynamic, int>{};
+var f = <dynamic, dynamic>{};
main() {
a;
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart
index b86463c..c1be80c 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart
@@ -11,8 +11,8 @@
}
class B implements A<int> {
- get /*@topType=int*/ x => 3;
- get /*@topType=int*/ w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
+ get x => 3;
+ get w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
}
foo() {
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.expect
index 2ac925a..e8cded4 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.expect
@@ -2,10 +2,10 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// get /*@topType=int*/ w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
-// ^
+// get w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
+// ^
//
// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:69: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
@@ -29,10 +29,10 @@
get x() → core::int
return 3;
get w() → core::int
- return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- get /*@topType=int*/ w => /*error:RETURN_OF_INVALID_TYPE*/ \"hello\";
- ^" in "hello" as{TypeError} core::int;
+ get w => /*error:RETURN_OF_INVALID_TYPE*/ \"hello\";
+ ^" in "hello" as{TypeError} core::int;
}
static method foo() → dynamic {
core::String y = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:69: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.transformed.expect
index 2ac925a..e8cded4 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart.strong.transformed.expect
@@ -2,10 +2,10 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// get /*@topType=int*/ w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
-// ^
+// get w => /*error:RETURN_OF_INVALID_TYPE*/ "hello";
+// ^
//
// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:69: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
@@ -29,10 +29,10 @@
get x() → core::int
return 3;
get w() → core::int
- return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- get /*@topType=int*/ w => /*error:RETURN_OF_INVALID_TYPE*/ \"hello\";
- ^" in "hello" as{TypeError} core::int;
+ get w => /*error:RETURN_OF_INVALID_TYPE*/ \"hello\";
+ ^" in "hello" as{TypeError} core::int;
}
static method foo() → dynamic {
core::String y = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:69: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart
index d3bf9ef..957177a 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart
@@ -11,7 +11,7 @@
class B<E> extends A<E> {
E y;
- get /*@topType=B::E*/ x => /*@target=B::y*/ y;
+ get x => /*@target=B::y*/ y;
}
foo() {
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.expect
index ef150d9..3c624e6 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.expect
@@ -3,13 +3,13 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field self::A::T x = null;
+ generic-covariant-impl field self::A::T x = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
}
class B<E extends core::Object = dynamic> extends self::A<self::B::E> {
- field self::B::E y = null;
+ generic-covariant-impl field self::B::E y = null;
synthetic constructor •() → self::B<self::B::E>
: super self::A::•()
;
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.transformed.expect
index ef150d9..3c624e6 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.legacy.transformed.expect
@@ -3,13 +3,13 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field self::A::T x = null;
+ generic-covariant-impl field self::A::T x = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
}
class B<E extends core::Object = dynamic> extends self::A<self::B::E> {
- field self::B::E y = null;
+ generic-covariant-impl field self::B::E y = null;
synthetic constructor •() → self::B<self::B::E>
: super self::A::•()
;
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_5.dart b/front_end/testcases/inference/infer_types_on_generic_instantiations_5.dart
index 473e129..5025679 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_5.dart
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_5.dart
@@ -6,12 +6,12 @@
library test;
abstract class I<E> {
- String m(/*@topType=dynamic*/ a, String f(v, E e));
+ String m(a, String f(v, E e));
}
abstract class A<E> implements I<E> {
const A();
- String m(/*@topType=dynamic*/ a, String f(v, E e));
+ String m(a, String f(v, E e));
}
abstract class M {
@@ -22,7 +22,7 @@
const B();
int get y => 0;
- /*@topType=String*/ m(/*@topType=dynamic*/ a, f(v, E e)) {}
+ m(a, f(v, E e)) {}
}
foo() {
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart
index c3b7d7d..49235aa 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart
@@ -21,7 +21,7 @@
const B();
int get y => 0;
- /*@topType=A<B::E>*/ m(/*@topType=dynamic*/ a, f(v, int e)) {}
+ m(a, f(v, int e)) {}
}
foo() {
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.expect
index 2f73c7b..ecee2c6 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
@@ -34,7 +34,7 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.transformed.expect
index 2f73c7b..ecee2c6 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library test;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
@@ -34,7 +34,7 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.expect
index af26f52..1f20b42 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.expect
@@ -9,7 +9,7 @@
//
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
@@ -45,7 +45,7 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.transformed.expect
index af26f52..1f20b42 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle.dart.strong.transformed.expect
@@ -9,7 +9,7 @@
//
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as inf;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
@@ -45,7 +45,7 @@
library;
import self as inf;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart
index aac0b74..0d4db22 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart
@@ -6,7 +6,7 @@
import 'infer_types_on_generic_instantiations_in_library_cycle.dart';
abstract class I<E> {
- A<E> m(/*@topType=dynamic*/ a, String f(v, int e));
+ A<E> m(a, String f(v, int e));
}
main() {}
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.expect
index c8150f5..54ed9fa 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
@@ -16,7 +16,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.transformed.expect
index c8150f5..54ed9fa 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
@@ -16,7 +16,7 @@
library test;
import self as test;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.expect
index 09436d7..a10bf88 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
@@ -24,7 +24,7 @@
//
import self as test;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
diff --git a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.transformed.expect b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.transformed.expect
index 09436d7..a10bf88 100644
--- a/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_generic_instantiations_in_library_cycle_a.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
+import "infer_types_on_generic_instantiations_in_library_cycle.dart" as test;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle.dart";
@@ -24,7 +24,7 @@
//
import self as test;
import "dart:core" as core;
-import "./infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
+import "infer_types_on_generic_instantiations_in_library_cycle_a.dart" as self;
import "org-dartlang-testcase:///infer_types_on_generic_instantiations_in_library_cycle_a.dart";
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.expect b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.expect
index 4cb8f64..5afe30e 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::Bar<self::Bar::T>
: super core::Object::•()
;
- method foo(self::Bar::T t) → void {
+ method foo(generic-covariant-impl self::Bar::T t) → void {
for (dynamic i in t) {
core::int x = i;
}
@@ -22,7 +22,7 @@
synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S>
: super core::Object::•()
;
- method foo(self::Baz::S t) → void {
+ method foo(generic-covariant-impl self::Baz::S t) → void {
for (dynamic i in t) {
core::int x = i;
self::Baz::T y = i;
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.transformed.expect
index 4cb8f64..5afe30e 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::Bar<self::Bar::T>
: super core::Object::•()
;
- method foo(self::Bar::T t) → void {
+ method foo(generic-covariant-impl self::Bar::T t) → void {
for (dynamic i in t) {
core::int x = i;
}
@@ -22,7 +22,7 @@
synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S>
: super core::Object::•()
;
- method foo(self::Baz::S t) → void {
+ method foo(generic-covariant-impl self::Baz::S t) → void {
for (dynamic i in t) {
core::int x = i;
self::Baz::T y = i;
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart
index f2fc604..9b410ed 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart
@@ -12,7 +12,7 @@
}
class Bar<T extends Stream<String>> {
- /*@topType=dynamic*/ foo(T t) async {
+ foo(T t) async {
await for (var /*@type=String*/ i in t) {
int x = /*error:INVALID_ASSIGNMENT*/ i;
}
@@ -20,7 +20,7 @@
}
class Baz<T, E extends Stream<T>, S extends E> {
- /*@topType=dynamic*/ foo(S t) async {
+ foo(S t) async {
await for (var /*@type=Baz::T*/ i in t) {
int x = /*error:INVALID_ASSIGNMENT*/ i;
T y = i;
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.expect b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.expect
index 0d7e2c9..e4a880e 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.expect
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.expect
@@ -15,7 +15,7 @@
synthetic constructor •() → self::Bar<self::Bar::T>
: super core::Object::•()
;
- method foo(self::Bar::T t) → dynamic async {
+ method foo(generic-covariant-impl self::Bar::T t) → dynamic async {
await for (dynamic i in t) {
core::int x = i;
}
@@ -25,7 +25,7 @@
synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S>
: super core::Object::•()
;
- method foo(self::Baz::S t) → dynamic async {
+ method foo(generic-covariant-impl self::Baz::S t) → dynamic async {
await for (dynamic i in t) {
core::int x = i;
self::Baz::T y = i;
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.transformed.expect b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.transformed.expect
index 2cc1d41..a26de4c 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.legacy.transformed.expect
@@ -15,7 +15,7 @@
synthetic constructor •() → self::Bar<self::Bar::T>
: super core::Object::•()
;
- method foo(self::Bar::T t) → dynamic /* originally async */ {
+ method foo(generic-covariant-impl self::Bar::T t) → dynamic /* originally async */ {
final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
asy::FutureOr<dynamic> :return_value;
dynamic :async_stack_trace;
@@ -74,7 +74,7 @@
synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S>
: super core::Object::•()
;
- method foo(self::Baz::S t) → dynamic /* originally async */ {
+ method foo(generic-covariant-impl self::Baz::S t) → dynamic /* originally async */ {
final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
asy::FutureOr<dynamic> :return_value;
dynamic :async_stack_trace;
diff --git a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.outline.expect b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.outline.expect
index 70778c8..c157ca9 100644
--- a/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.outline.expect
+++ b/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.outline.expect
@@ -13,13 +13,13 @@
class Bar<T extends asy::Stream<core::String> = dynamic> extends core::Object {
synthetic constructor •() → self::Bar<self::Bar::T>
;
- method foo(self::Bar::T t) → dynamic
+ method foo(generic-covariant-impl self::Bar::T t) → dynamic
;
}
class Baz<T extends core::Object = dynamic, E extends asy::Stream<self::Baz::T> = dynamic, S extends self::Baz::E = dynamic> extends core::Object {
synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S>
;
- method foo(self::Baz::S t) → dynamic
+ method foo(generic-covariant-impl self::Baz::S t) → dynamic
;
}
abstract class MyStream<T extends core::Object = dynamic> extends asy::Stream<self::MyStream::T> {
diff --git a/front_end/testcases/inference/infer_variable_void.dart b/front_end/testcases/inference/infer_variable_void.dart
index 3e54630..65fdfb3 100644
--- a/front_end/testcases/inference/infer_variable_void.dart
+++ b/front_end/testcases/inference/infer_variable_void.dart
@@ -6,7 +6,7 @@
library test;
void f() {}
-var /*@topType=void*/ x = /*info:USE_OF_VOID_RESULT*/ f();
+var x = /*info:USE_OF_VOID_RESULT*/ f();
main() {
x;
diff --git a/front_end/testcases/inference/inferred_initializing_formal_checks_default_value.dart b/front_end/testcases/inference/inferred_initializing_formal_checks_default_value.dart
index d383d76..5ecd7db 100644
--- a/front_end/testcases/inference/inferred_initializing_formal_checks_default_value.dart
+++ b/front_end/testcases/inference/inferred_initializing_formal_checks_default_value.dart
@@ -6,7 +6,7 @@
library test;
class Foo {
- var /*@topType=int*/ x = 1;
+ var x = 1;
Foo([this.x = /*error:INVALID_ASSIGNMENT*/ "1"]);
}
diff --git a/front_end/testcases/inference/inferred_nonstatic_field_depends_on_static_field_complex.dart b/front_end/testcases/inference/inferred_nonstatic_field_depends_on_static_field_complex.dart
index 281d549..760375f 100644
--- a/front_end/testcases/inference/inferred_nonstatic_field_depends_on_static_field_complex.dart
+++ b/front_end/testcases/inference/inferred_nonstatic_field_depends_on_static_field_complex.dart
@@ -6,8 +6,8 @@
library test;
class C {
- static var /*@topType=String*/ x = 'x';
- var /*@topType=Map<String, Map<String, String>>*/ y = /*@typeArgs=String, Map<String, String>*/ {
+ static var x = 'x';
+ var y = /*@typeArgs=String, Map<String, String>*/ {
'a': /*@typeArgs=String, String*/ {'b': 'c'},
'd': /*@typeArgs=String, String*/ {'e': x}
};
diff --git a/front_end/testcases/inference/inferred_nonstatic_field_depends_on_top_level_var_simple.dart b/front_end/testcases/inference/inferred_nonstatic_field_depends_on_top_level_var_simple.dart
index 39d8091..8e9c16b 100644
--- a/front_end/testcases/inference/inferred_nonstatic_field_depends_on_top_level_var_simple.dart
+++ b/front_end/testcases/inference/inferred_nonstatic_field_depends_on_top_level_var_simple.dart
@@ -5,10 +5,10 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=String*/ x = 'x';
+var x = 'x';
class C {
- var /*@topType=String*/ y = x;
+ var y = x;
}
main() {
diff --git a/front_end/testcases/inference/inferred_type_cascade.dart b/front_end/testcases/inference/inferred_type_cascade.dart
index a6308da..c7f21af 100644
--- a/front_end/testcases/inference/inferred_type_cascade.dart
+++ b/front_end/testcases/inference/inferred_type_cascade.dart
@@ -11,7 +11,7 @@
void m() {}
}
-var /*@topType=A*/ v = new A()
+var v = new A()
.. /*@target=A::a*/ a = 1
.. /*@target=A::b*/ b. /*@target=List::add*/ add(2)
.. /*@target=A::m*/ m();
diff --git a/front_end/testcases/inference/inferred_type_custom_binary_op.dart b/front_end/testcases/inference/inferred_type_custom_binary_op.dart
index bc3ee5c..776efe5 100644
--- a/front_end/testcases/inference/inferred_type_custom_binary_op.dart
+++ b/front_end/testcases/inference/inferred_type_custom_binary_op.dart
@@ -10,7 +10,7 @@
}
C c = new C();
-var /*@topType=bool*/ x = c /*@target=C::**/ * c;
+var x = c /*@target=C::**/ * c;
main() {
c;
diff --git a/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart b/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart
index 02e1dfb..72a8365 100644
--- a/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart
+++ b/front_end/testcases/inference/inferred_type_custom_binary_op_via_interface.dart
@@ -12,7 +12,7 @@
abstract class C implements I {}
C c;
-var /*@topType=bool*/ x = c /*@target=I::**/ * c;
+var x = c /*@target=I::**/ * c;
main() {
c;
diff --git a/front_end/testcases/inference/inferred_type_custom_unary_op.dart b/front_end/testcases/inference/inferred_type_custom_unary_op.dart
index d54e302..26e560c 100644
--- a/front_end/testcases/inference/inferred_type_custom_unary_op.dart
+++ b/front_end/testcases/inference/inferred_type_custom_unary_op.dart
@@ -10,7 +10,7 @@
}
C c = new C();
-var /*@topType=bool*/ x = /*@target=C::unary-*/ -c;
+var x = /*@target=C::unary-*/ -c;
main() {
c;
diff --git a/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart b/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart
index 1289475..db149d1 100644
--- a/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart
+++ b/front_end/testcases/inference/inferred_type_custom_unary_op_via_interface.dart
@@ -12,7 +12,7 @@
abstract class C implements I {}
C c;
-var /*@topType=bool*/ x = /*@target=I::unary-*/ -c;
+var x = /*@target=I::unary-*/ -c;
main() {
c;
diff --git a/front_end/testcases/inference/inferred_type_extract_method_tear_off.dart b/front_end/testcases/inference/inferred_type_extract_method_tear_off.dart
index e9e21a5..813e3cd 100644
--- a/front_end/testcases/inference/inferred_type_extract_method_tear_off.dart
+++ b/front_end/testcases/inference/inferred_type_extract_method_tear_off.dart
@@ -10,6 +10,6 @@
}
C f() => null;
-var /*@topType=() -> bool*/ x = f(). /*@target=C::g*/ g;
+var x = f(). /*@target=C::g*/ g;
main() {}
diff --git a/front_end/testcases/inference/inferred_type_extract_method_tear_off_via_interface.dart b/front_end/testcases/inference/inferred_type_extract_method_tear_off_via_interface.dart
index 28313ff..b4874c6 100644
--- a/front_end/testcases/inference/inferred_type_extract_method_tear_off_via_interface.dart
+++ b/front_end/testcases/inference/inferred_type_extract_method_tear_off_via_interface.dart
@@ -12,6 +12,6 @@
abstract class C implements I {}
C f() => null;
-var /*@topType=() -> bool*/ x = f(). /*@target=I::g*/ g;
+var x = f(). /*@target=I::g*/ g;
main() {}
diff --git a/front_end/testcases/inference/inferred_type_from_top_level_executable_tear_off.dart b/front_end/testcases/inference/inferred_type_from_top_level_executable_tear_off.dart
index 4ccdbce..38ccc97 100644
--- a/front_end/testcases/inference/inferred_type_from_top_level_executable_tear_off.dart
+++ b/front_end/testcases/inference/inferred_type_from_top_level_executable_tear_off.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=(Object) -> void*/ v = print;
+var v = print;
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_invoke_method.dart b/front_end/testcases/inference/inferred_type_invoke_method.dart
index ec5825a..387aeff 100644
--- a/front_end/testcases/inference/inferred_type_invoke_method.dart
+++ b/front_end/testcases/inference/inferred_type_invoke_method.dart
@@ -10,6 +10,6 @@
}
C f() => null;
-var /*@topType=bool*/ x = f(). /*@target=C::g*/ g();
+var x = f(). /*@target=C::g*/ g();
main() {}
diff --git a/front_end/testcases/inference/inferred_type_invoke_method_via_interface.dart b/front_end/testcases/inference/inferred_type_invoke_method_via_interface.dart
index f28fb58..e31a0d3 100644
--- a/front_end/testcases/inference/inferred_type_invoke_method_via_interface.dart
+++ b/front_end/testcases/inference/inferred_type_invoke_method_via_interface.dart
@@ -12,6 +12,6 @@
abstract class C implements I {}
C f() => null;
-var /*@topType=bool*/ x = f(). /*@target=I::g*/ g();
+var x = f(). /*@target=I::g*/ g();
main() {}
diff --git a/front_end/testcases/inference/inferred_type_is_enum.dart b/front_end/testcases/inference/inferred_type_is_enum.dart
index 46c1099..1262709 100644
--- a/front_end/testcases/inference/inferred_type_is_enum.dart
+++ b/front_end/testcases/inference/inferred_type_is_enum.dart
@@ -6,7 +6,7 @@
library test;
enum E { v1 }
-final /*@topType=E*/ x = E.v1;
+final x = E.v1;
main() {
x;
diff --git a/front_end/testcases/inference/inferred_type_is_enum_values.dart b/front_end/testcases/inference/inferred_type_is_enum_values.dart
index abc84d5..2463b13 100644
--- a/front_end/testcases/inference/inferred_type_is_enum_values.dart
+++ b/front_end/testcases/inference/inferred_type_is_enum_values.dart
@@ -6,7 +6,7 @@
library test;
enum E { v1 }
-final /*@topType=List<E>*/ x = E.values;
+final x = E.values;
main() {
x;
diff --git a/front_end/testcases/inference/inferred_type_is_typedef.dart b/front_end/testcases/inference/inferred_type_is_typedef.dart
index fa8c890..faf400f 100644
--- a/front_end/testcases/inference/inferred_type_is_typedef.dart
+++ b/front_end/testcases/inference/inferred_type_is_typedef.dart
@@ -6,7 +6,7 @@
library test;
typedef void F();
-final /*@topType=Map<String, () -> void>*/ x = <String, F>{};
+final x = <String, F>{};
main() {
x;
diff --git a/front_end/testcases/inference/inferred_type_is_typedef_parameterized.dart b/front_end/testcases/inference/inferred_type_is_typedef_parameterized.dart
index 26b4cc8..09ae0af 100644
--- a/front_end/testcases/inference/inferred_type_is_typedef_parameterized.dart
+++ b/front_end/testcases/inference/inferred_type_is_typedef_parameterized.dart
@@ -6,6 +6,6 @@
library test;
typedef T F<T>();
-final /*@topType=Map<String, () -> int>*/ x = <String, F<int>>{};
+final x = <String, F<int>>{};
main() {}
diff --git a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type.dart b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type.dart
index 9ea230b..2cc5ff7 100644
--- a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type.dart
+++ b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type.dart
@@ -7,7 +7,7 @@
int f() => null;
String g() => null;
-var /*@topType=List<() -> Object>*/ v = /*@typeArgs=() -> Object*/ [f, g];
+var v = /*@typeArgs=() -> Object*/ [f, g];
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_function_typed_param.dart b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_function_typed_param.dart
index 17056f9..dadf60b 100644
--- a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_function_typed_param.dart
+++ b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_function_typed_param.dart
@@ -7,10 +7,7 @@
int f(int x(String y)) => null;
String g(int x(String y)) => null;
-var /*@topType=List<((String) -> int) -> Object>*/ v = /*@typeArgs=((String) -> int) -> Object*/ [
- f,
- g
-];
+var v = /*@typeArgs=((String) -> int) -> Object*/ [f, g];
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_named_param.dart b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_named_param.dart
index 4a1212c..d922665 100644
--- a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_named_param.dart
+++ b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_named_param.dart
@@ -7,10 +7,7 @@
int f({int x}) => null;
String g({int x}) => null;
-var /*@topType=List<({x: int}) -> Object>*/ v = /*@typeArgs=({x: int}) -> Object*/ [
- f,
- g
-];
+var v = /*@typeArgs=({x: int}) -> Object*/ [f, g];
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_positional_param.dart b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_positional_param.dart
index 192c43f..1307233 100644
--- a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_positional_param.dart
+++ b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_positional_param.dart
@@ -7,10 +7,7 @@
int f([int x]) => null;
String g([int x]) => null;
-var /*@topType=List<([int]) -> Object>*/ v = /*@typeArgs=([int]) -> Object*/ [
- f,
- g
-];
+var v = /*@typeArgs=([int]) -> Object*/ [f, g];
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_required_param.dart b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_required_param.dart
index 4d1cef2..926a0d3 100644
--- a/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_required_param.dart
+++ b/front_end/testcases/inference/inferred_type_uses_synthetic_function_type_required_param.dart
@@ -7,7 +7,7 @@
int f(int x) => null;
String g(int x) => null;
-var /*@topType=List<(int) -> Object>*/ v = /*@typeArgs=(int) -> Object*/ [f, g];
+var v = /*@typeArgs=(int) -> Object*/ [f, g];
main() {
v;
diff --git a/front_end/testcases/inference/inferred_type_via_closure_multiple_levels_of_nesting.dart b/front_end/testcases/inference/inferred_type_via_closure_multiple_levels_of_nesting.dart
index 1408cdd..11972a9 100644
--- a/front_end/testcases/inference/inferred_type_via_closure_multiple_levels_of_nesting.dart
+++ b/front_end/testcases/inference/inferred_type_via_closure_multiple_levels_of_nesting.dart
@@ -6,7 +6,7 @@
library test;
class C {
- static final /*@topType=(bool) -> (int) -> Map<int, bool>*/ f = /*@returnType=(int) -> Map<int, bool>*/ (bool
+ static final f = /*@returnType=(int) -> Map<int, bool>*/ (bool
b) => /*@returnType=Map<int, bool>*/ (int i) => /*@typeArgs=int, bool*/ {i: b};
}
diff --git a/front_end/testcases/inference/inferred_type_via_closure_type_depends_on_args.dart b/front_end/testcases/inference/inferred_type_via_closure_type_depends_on_args.dart
index 3de4209..76efa44 100644
--- a/front_end/testcases/inference/inferred_type_via_closure_type_depends_on_args.dart
+++ b/front_end/testcases/inference/inferred_type_via_closure_type_depends_on_args.dart
@@ -6,8 +6,7 @@
library test;
class C {
- static final /*@topType=(bool) -> bool*/ f = /*@returnType=bool*/ (bool b) =>
- b;
+ static final f = /*@returnType=bool*/ (bool b) => b;
}
main() {}
diff --git a/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_field.dart b/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_field.dart
index 8d3291f..08e3315 100644
--- a/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_field.dart
+++ b/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_field.dart
@@ -6,7 +6,7 @@
library test;
class C {
- static final /*@topType=(bool) -> int*/ f = /*@returnType=int*/ (bool b) => 1;
+ static final f = /*@returnType=int*/ (bool b) => 1;
}
main() {}
diff --git a/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_top_level.dart b/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_top_level.dart
index 5a23706..1030f5b 100644
--- a/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_top_level.dart
+++ b/front_end/testcases/inference/inferred_type_via_closure_type_independent_of_args_top_level.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-final /*@topType=(bool) -> int*/ f = /*@returnType=int*/ (bool b) => 1;
+final f = /*@returnType=int*/ (bool b) => 1;
main() {
f;
diff --git a/front_end/testcases/inference/inheritance_does_not_imply_circularity.dart b/front_end/testcases/inference/inheritance_does_not_imply_circularity.dart
index fb72d4d..4c3240d 100644
--- a/front_end/testcases/inference/inheritance_does_not_imply_circularity.dart
+++ b/front_end/testcases/inference/inheritance_does_not_imply_circularity.dart
@@ -10,7 +10,7 @@
// circularity.
class I1 {
- final /*@topType=int*/ x = y;
+ final x = y;
}
abstract class I2 {
@@ -21,6 +21,6 @@
int get x => 0;
}
-var /*@topType=int*/ y = new C(). /*@target=C::x*/ x;
+var y = new C(). /*@target=C::x*/ x;
main() {}
diff --git a/front_end/testcases/inference/instantiate_to_bounds_invoke_constructor_type_args_exact.dart b/front_end/testcases/inference/instantiate_to_bounds_invoke_constructor_type_args_exact.dart
index cca99f8..a1c62d3 100644
--- a/front_end/testcases/inference/instantiate_to_bounds_invoke_constructor_type_args_exact.dart
+++ b/front_end/testcases/inference/instantiate_to_bounds_invoke_constructor_type_args_exact.dart
@@ -7,7 +7,7 @@
class C<T extends num> {}
-var /*@topType=C<int>*/ x = new C<int>();
+var x = new C<int>();
main() {
x;
diff --git a/front_end/testcases/inference/list_literal_typed.dart b/front_end/testcases/inference/list_literal_typed.dart
index d923333..5182f1a 100644
--- a/front_end/testcases/inference/list_literal_typed.dart
+++ b/front_end/testcases/inference/list_literal_typed.dart
@@ -5,10 +5,10 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=List<int>*/ a = <int>[];
-var /*@topType=List<double>*/ b = <double>[1.0, 2.0, 3.0];
-var /*@topType=List<List<int>>*/ c = <List<int>>[];
-var /*@topType=List<dynamic>*/ d = <dynamic>[1, 2.0, false];
+var a = <int>[];
+var b = <double>[1.0, 2.0, 3.0];
+var c = <List<int>>[];
+var d = <dynamic>[1, 2.0, false];
main() {
var /*@type=List<int>*/ a = <int>[];
diff --git a/front_end/testcases/inference/list_literals_top_level.dart b/front_end/testcases/inference/list_literals_top_level.dart
index 1f6736b..84b51a0 100644
--- a/front_end/testcases/inference/list_literals_top_level.dart
+++ b/front_end/testcases/inference/list_literals_top_level.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=List<int>*/ x1 = /*@typeArgs=int*/ [1, 2, 3];
+var x1 = /*@typeArgs=int*/ [1, 2, 3];
test1() {
x1. /*@target=List::add*/ add(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi');
x1. /*@target=List::add*/ add(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0);
@@ -13,7 +13,7 @@
List<num> y = x1;
}
-var /*@topType=List<num>*/ x2 = /*@typeArgs=num*/ [1, 2.0, 3];
+var x2 = /*@typeArgs=num*/ [1, 2.0, 3];
test2() {
x2. /*@target=List::add*/ add(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi');
x2. /*@target=List::add*/ add(4.0);
diff --git a/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.expect b/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.expect
index e89d29c..f31c88e 100644
--- a/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.expect
+++ b/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.transformed.expect b/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.transformed.expect
index e89d29c..f31c88e 100644
--- a/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/local_constructor_from_arguments.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
: self::C::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/inference/local_constructor_from_arguments.dart.outline.expect b/front_end/testcases/inference/local_constructor_from_arguments.dart.outline.expect
index 9c807e8..cdfac01 100644
--- a/front_end/testcases/inference/local_constructor_from_arguments.dart.outline.expect
+++ b/front_end/testcases/inference/local_constructor_from_arguments.dart.outline.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → self::C<self::C::T>
;
}
diff --git a/front_end/testcases/inference/map_literals_top_level.dart b/front_end/testcases/inference/map_literals_top_level.dart
index 7ce98e6..362aef1 100644
--- a/front_end/testcases/inference/map_literals_top_level.dart
+++ b/front_end/testcases/inference/map_literals_top_level.dart
@@ -5,10 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=Map<int, String>*/ x1 = /*@typeArgs=int, String*/ {
- 1: 'x',
- 2: 'y'
-};
+var x1 = /*@typeArgs=int, String*/ {1: 'x', 2: 'y'};
test1() {
x1 /*@target=Map::[]=*/ [3] = 'z';
x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
@@ -17,11 +14,7 @@
Map<num, String> y = x1;
}
-var /*@topType=Map<num, Pattern>*/ x2 = /*@typeArgs=num, Pattern*/ {
- 1: 'x',
- 2: 'y',
- 3.0: new RegExp('.')
-};
+var x2 = /*@typeArgs=num, Pattern*/ {1: 'x', 2: 'y', 3.0: new RegExp('.')};
test2() {
x2 /*@target=Map::[]=*/ [3] = 'z';
x2 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
diff --git a/front_end/testcases/inference/map_literals_top_level.dart.strong.expect b/front_end/testcases/inference/map_literals_top_level.dart.strong.expect
index 29bcc2c..9049589 100644
--- a/front_end/testcases/inference/map_literals_top_level.dart.strong.expect
+++ b/front_end/testcases/inference/map_literals_top_level.dart.strong.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:14:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:11:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:15:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:12:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:16:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:13:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// x1 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:27:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:20:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
// Try changing the type of the left hand side, or casting the right hand side to 'num'.
// x2 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:29:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:22:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
// - 'Pattern' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'Pattern'.
// x2 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
@@ -35,15 +35,15 @@
static field core::Map<core::num, core::Pattern> x2 = <core::num, core::Pattern>{1: "x", 2: "y", 3.0: core::RegExp::•(".")};
static method test1() → dynamic {
self::x1.{core::Map::[]=}(3, "z");
- self::x1.{core::Map::[]=}(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:14:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ self::x1.{core::Map::[]=}(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:11:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
^" in "hi" as{TypeError} core::int, "w");
- self::x1.{core::Map::[]=}(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:15:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+ self::x1.{core::Map::[]=}(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:12:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
^" in 4.0 as{TypeError} core::int, "u");
- self::x1.{core::Map::[]=}(3, let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:16:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ self::x1.{core::Map::[]=}(3, let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:13:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
x1 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
^" in 42 as{TypeError} core::String);
@@ -51,12 +51,12 @@
}
static method test2() → dynamic {
self::x2.{core::Map::[]=}(3, "z");
- self::x2.{core::Map::[]=}(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:27:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
+ self::x2.{core::Map::[]=}(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:20:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
Try changing the type of the left hand side, or casting the right hand side to 'num'.
x2 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
^" in "hi" as{TypeError} core::num, "w");
self::x2.{core::Map::[]=}(4.0, "u");
- self::x2.{core::Map::[]=}(3, let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:29:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
+ self::x2.{core::Map::[]=}(3, let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:22:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
- 'Pattern' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'Pattern'.
x2 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
diff --git a/front_end/testcases/inference/map_literals_top_level.dart.strong.transformed.expect b/front_end/testcases/inference/map_literals_top_level.dart.strong.transformed.expect
index 29bcc2c..9049589 100644
--- a/front_end/testcases/inference/map_literals_top_level.dart.strong.transformed.expect
+++ b/front_end/testcases/inference/map_literals_top_level.dart.strong.transformed.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:14:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:11:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:15:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:12:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:16:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:13:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// Try changing the type of the left hand side, or casting the right hand side to 'String'.
// x1 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:27:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:20:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
// Try changing the type of the left hand side, or casting the right hand side to 'num'.
// x2 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
// ^
//
-// pkg/front_end/testcases/inference/map_literals_top_level.dart:29:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
+// pkg/front_end/testcases/inference/map_literals_top_level.dart:22:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
// - 'Pattern' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'Pattern'.
// x2 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
@@ -35,15 +35,15 @@
static field core::Map<core::num, core::Pattern> x2 = <core::num, core::Pattern>{1: "x", 2: "y", 3.0: core::RegExp::•(".")};
static method test1() → dynamic {
self::x1.{core::Map::[]=}(3, "z");
- self::x1.{core::Map::[]=}(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:14:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ self::x1.{core::Map::[]=}(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:11:67: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
^" in "hi" as{TypeError} core::int, "w");
- self::x1.{core::Map::[]=}(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:15:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+ self::x1.{core::Map::[]=}(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:12:67: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
x1 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u';
^" in 4.0 as{TypeError} core::int, "u");
- self::x1.{core::Map::[]=}(3, let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:16:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
+ self::x1.{core::Map::[]=}(3, let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:13:62: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
Try changing the type of the left hand side, or casting the right hand side to 'String'.
x1 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
^" in 42 as{TypeError} core::String);
@@ -51,12 +51,12 @@
}
static method test2() → dynamic {
self::x2.{core::Map::[]=}(3, "z");
- self::x2.{core::Map::[]=}(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:27:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
+ self::x2.{core::Map::[]=}(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:20:67: Error: A value of type 'String' can't be assigned to a variable of type 'num'.
Try changing the type of the left hand side, or casting the right hand side to 'num'.
x2 /*@target=Map::[]=*/ [/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w';
^" in "hi" as{TypeError} core::num, "w");
self::x2.{core::Map::[]=}(4.0, "u");
- self::x2.{core::Map::[]=}(3, let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:29:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
+ self::x2.{core::Map::[]=}(3, let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/inference/map_literals_top_level.dart:22:62: Error: A value of type 'int' can't be assigned to a variable of type 'Pattern'.
- 'Pattern' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'Pattern'.
x2 /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42;
diff --git a/front_end/testcases/inference/method_call_with_type_arguments_instance_method.dart b/front_end/testcases/inference/method_call_with_type_arguments_instance_method.dart
index 3198118..a1490d6 100644
--- a/front_end/testcases/inference/method_call_with_type_arguments_instance_method.dart
+++ b/front_end/testcases/inference/method_call_with_type_arguments_instance_method.dart
@@ -11,6 +11,6 @@
class D<T> {}
-var /*@topType=D<int>*/ f = new C(). /*@target=C::f*/ f<int>();
+var f = new C(). /*@target=C::f*/ f<int>();
main() {}
diff --git a/front_end/testcases/inference/method_call_with_type_arguments_instance_method_identifier_sequence.dart b/front_end/testcases/inference/method_call_with_type_arguments_instance_method_identifier_sequence.dart
index e7fe40a..3b57d56 100644
--- a/front_end/testcases/inference/method_call_with_type_arguments_instance_method_identifier_sequence.dart
+++ b/front_end/testcases/inference/method_call_with_type_arguments_instance_method_identifier_sequence.dart
@@ -12,6 +12,6 @@
class D<T> {}
C c;
-var /*@topType=D<int>*/ f = c. /*@target=C::f*/ f<int>();
+var f = c. /*@target=C::f*/ f<int>();
main() {}
diff --git a/front_end/testcases/inference/method_call_with_type_arguments_static_method.dart b/front_end/testcases/inference/method_call_with_type_arguments_static_method.dart
index 1ba94e3..5ca8020 100644
--- a/front_end/testcases/inference/method_call_with_type_arguments_static_method.dart
+++ b/front_end/testcases/inference/method_call_with_type_arguments_static_method.dart
@@ -11,6 +11,6 @@
class D<T> {}
-var /*@topType=D<int>*/ f = C.f<int>();
+var f = C.f<int>();
main() {}
diff --git a/front_end/testcases/inference/method_call_with_type_arguments_top_level_function.dart b/front_end/testcases/inference/method_call_with_type_arguments_top_level_function.dart
index afc9811..4574e77 100644
--- a/front_end/testcases/inference/method_call_with_type_arguments_top_level_function.dart
+++ b/front_end/testcases/inference/method_call_with_type_arguments_top_level_function.dart
@@ -9,7 +9,7 @@
class D<T> {}
-var /*@topType=D<int>*/ g = f<int>();
+var g = f<int>();
main() {
g;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_3.dart b/front_end/testcases/inference/mixin_inference_outwards_3.dart
index 001083d..1d03f48 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_3.dart
+++ b/front_end/testcases/inference/mixin_inference_outwards_3.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.
-/*@testedFeatures=error*/
-
class I<X> {}
class M0<T> extends Object implements I<T> {}
@@ -12,7 +10,6 @@
// M0 is inferred as M0<dynamic>
// Error since class hierarchy is inconsistent
-class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
- extends Object with M0, M1<int> {}
+class A extends Object with M0, M1<int> {}
main() {}
diff --git a/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.expect b/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.expect
index 890adf5..0c7e099 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.transformed.expect b/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.transformed.expect
index 2b7b8f2..4a8d005 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_3.dart.legacy.transformed.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect b/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect
index 6452cea..f4273b4 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect b/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect
index 890adf5..0c7e099 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:69: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:13:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_4.dart b/front_end/testcases/inference/mixin_inference_outwards_4.dart
index 73f13f6..4f88178 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_4.dart
+++ b/front_end/testcases/inference/mixin_inference_outwards_4.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.
-/*@testedFeatures=error*/
-
class I<X> {}
class M0<T> extends Object implements I<T> {}
@@ -13,8 +11,6 @@
// M0 is inferred as M0<dynamic> (unconstrained)
// M1 is inferred as M1<dynamic> (constrained by inferred argument to M0)
// Error since class hierarchy is inconsistent
-class /*@error=AmbiguousSupertypes*/ A extends Object
- with M0, M1
- implements I<int> {}
+class A extends Object with M0, M1 implements I<int> {}
main() {}
diff --git a/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.expect b/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.expect
index fb172cf..969931b 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.expect
@@ -1,10 +1,10 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:14:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart'.
-// class /*@error=AmbiguousSupertypes*/ A extends Object
-// ^
+// class A extends Object with M0, M1 implements I<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.transformed.expect b/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.transformed.expect
index 17ece57..b25c51d 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_4.dart.legacy.transformed.expect
@@ -1,10 +1,10 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:14:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart'.
-// class /*@error=AmbiguousSupertypes*/ A extends Object
-// ^
+// class A extends Object with M0, M1 implements I<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect b/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect
index bae1a11..96a22ac 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect
@@ -1,10 +1,10 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:14:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart'.
-// class /*@error=AmbiguousSupertypes*/ A extends Object
-// ^
+// class A extends Object with M0, M1 implements I<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect b/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect
index fb172cf..969931b 100644
--- a/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect
+++ b/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect
@@ -1,10 +1,10 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
+// pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:14:7: Error: 'A' can't implement both 'I<dynamic>' and 'I<int>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart'.
-// class /*@error=AmbiguousSupertypes*/ A extends Object
-// ^
+// class A extends Object with M0, M1 implements I<int> {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_1.dart b/front_end/testcases/inference/mixin_inference_unification_1.dart
index 002c659..ed6e1be 100644
--- a/front_end/testcases/inference/mixin_inference_unification_1.dart
+++ b/front_end/testcases/inference/mixin_inference_unification_1.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.
-/*@testedFeatures=error*/
-
class I<X, Y> {}
class M0<T> implements I<T, int> {}
@@ -12,7 +10,6 @@
// M0 inferred as M0<String>
// M1 inferred as M1<int>
-class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
- extends Object with M0, M1 {}
+class A extends Object with M0, M1 {}
main() {}
diff --git a/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.expect b/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.expect
index a776b09..59abdc5 100644
--- a/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.transformed.expect b/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.transformed.expect
index 06aab2c..6a20389 100644
--- a/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_1.dart.legacy.transformed.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect b/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect
index ab6dd91..1858f05 100644
--- a/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect b/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect
index a776b09..59abdc5 100644
--- a/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect
@@ -1,15 +1,15 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:69: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:13:7: Error: 'A' can't implement both 'I<dynamic, int>' and 'I<String, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_1.dart'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_2.dart b/front_end/testcases/inference/mixin_inference_unification_2.dart
index ecff4ec..64d4550 100644
--- a/front_end/testcases/inference/mixin_inference_unification_2.dart
+++ b/front_end/testcases/inference/mixin_inference_unification_2.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.
-/*@testedFeatures=error*/
-
class I<X, Y> {}
class M0<T> implements I<T, List<T>> {}
@@ -16,7 +14,6 @@
// U0 = List<U1>
// U1 = List<U0>
// which has no finite solution
-class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
- extends Object with M0, M1 {}
+class A extends Object with M0, M1 {}
main() {}
diff --git a/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.expect b/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.expect
index 6e2e1ab..1ed537d 100644
--- a/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.expect
@@ -1,17 +1,17 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.transformed.expect b/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.transformed.expect
index da13f1a..8b678a5 100644
--- a/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_2.dart.legacy.transformed.expect
@@ -1,17 +1,17 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect b/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect
index 1e1142a..aa39cba 100644
--- a/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect
@@ -1,17 +1,17 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect b/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect
index 6e2e1ab..1ed537d 100644
--- a/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect
+++ b/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect
@@ -1,17 +1,17 @@
//
// Problems in component:
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'Object with M0, M1' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
-// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:69: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
+// pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:17:7: Error: 'A' can't implement both 'I<dynamic, List<dynamic>>' and 'I<List<dynamic>, dynamic>'
// - 'I' is from 'pkg/front_end/testcases/inference/mixin_inference_unification_2.dart'.
// - 'List' is from 'dart:core'.
-// class /*@error=AmbiguousSupertypes*/ /*@error=AmbiguousSupertypes*/ A
-// ^
+// class A extends Object with M0, M1 {}
+// ^
//
library;
import self as self;
diff --git a/front_end/testcases/inference/non_inferrable_getter_setter.dart b/front_end/testcases/inference/non_inferrable_getter_setter.dart
index 919883c..f8ac0dc 100644
--- a/front_end/testcases/inference/non_inferrable_getter_setter.dart
+++ b/front_end/testcases/inference/non_inferrable_getter_setter.dart
@@ -6,8 +6,8 @@
library test;
class C {
- get /*@topType=dynamic*/ x => null;
- void set x(/*@topType=dynamic*/ value) {}
+ get x => null;
+ void set x(value) {}
}
main() {}
diff --git a/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart b/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart
index 65e1bda..2eb6926 100644
--- a/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart
+++ b/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ h = null;
+var h = null;
void foo(int f(Object _)) {}
test() {
diff --git a/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart.type_promotion.expect b/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart.type_promotion.expect
index 1eed720..8eb4001 100644
--- a/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart.type_promotion.expect
+++ b/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart.type_promotion.expect
@@ -1,6 +1,6 @@
-pkg/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart:15:5: Context: Write to f@369
+pkg/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart:15:5: Context: Write to f@348
f = /*@returnType=Null*/ (/*@type=Object*/ x) => 'hello';
^
-pkg/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart:18:5: Context: Write to g@542
+pkg/front_end/testcases/inference/null_literal_should_not_infer_as_bottom.dart:18:5: Context: Write to g@521
g = 'hello';
^
diff --git a/front_end/testcases/inference/property_get_toplevel.dart b/front_end/testcases/inference/property_get_toplevel.dart
index 745394e..15b76a6 100644
--- a/front_end/testcases/inference/property_get_toplevel.dart
+++ b/front_end/testcases/inference/property_get_toplevel.dart
@@ -12,8 +12,8 @@
}
C c = new C();
-var /*@topType=() -> int*/ function_ref = c. /*@target=C::function*/ function;
-var /*@topType=List<() -> int>*/ function_ref_list = /*@typeArgs=() -> int*/ [
+var function_ref = c. /*@target=C::function*/ function;
+var function_ref_list = /*@typeArgs=() -> int*/ [
c. /*@target=C::function*/ function
];
diff --git a/front_end/testcases/inference/property_set.dart.legacy.expect b/front_end/testcases/inference/property_set.dart.legacy.expect
index 27f4870..dc17adc 100644
--- a/front_end/testcases/inference/property_set.dart.legacy.expect
+++ b/front_end/testcases/inference/property_set.dart.legacy.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> x = null;
+ generic-covariant-impl field core::List<self::A::T> x = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- set y(core::List<self::A::T> value) → void {}
+ set y(generic-covariant-impl core::List<self::A::T> value) → void {}
}
static method test() → dynamic {
self::A<core::int> a_int = new self::A::•<core::int>();
diff --git a/front_end/testcases/inference/property_set.dart.legacy.transformed.expect b/front_end/testcases/inference/property_set.dart.legacy.transformed.expect
index 27f4870..dc17adc 100644
--- a/front_end/testcases/inference/property_set.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/property_set.dart.legacy.transformed.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> x = null;
+ generic-covariant-impl field core::List<self::A::T> x = null;
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- set y(core::List<self::A::T> value) → void {}
+ set y(generic-covariant-impl core::List<self::A::T> value) → void {}
}
static method test() → dynamic {
self::A<core::int> a_int = new self::A::•<core::int>();
diff --git a/front_end/testcases/inference/property_set.dart.outline.expect b/front_end/testcases/inference/property_set.dart.outline.expect
index f8ea57e..e1a87aa 100644
--- a/front_end/testcases/inference/property_set.dart.outline.expect
+++ b/front_end/testcases/inference/property_set.dart.outline.expect
@@ -3,10 +3,10 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::T> x;
+ generic-covariant-impl field core::List<self::A::T> x;
synthetic constructor •() → self::A<self::A::T>
;
- set y(core::List<self::A::T> value) → void
+ set y(generic-covariant-impl core::List<self::A::T> value) → void
;
}
static method test() → dynamic
diff --git a/front_end/testcases/inference/reference_to_typedef.dart b/front_end/testcases/inference/reference_to_typedef.dart
index 20bd461..59ec3b8 100644
--- a/front_end/testcases/inference/reference_to_typedef.dart
+++ b/front_end/testcases/inference/reference_to_typedef.dart
@@ -6,6 +6,6 @@
library test;
typedef void F();
-final /*@topType=Type*/ x = F;
+final x = F;
main() {}
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.expect
index 1a2885a..19bc37f 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.transformed.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.transformed.expect
index 1a2885a..19bc37f 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.expect
index 2582978..9c77221 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.transformed.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.transformed.expect
index 2582978..9c77221 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.expect
index 41053f4..b4e4156 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.expect
@@ -3,16 +3,16 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method op(self::C::T b) → void {
+ method op(generic-covariant-impl self::C::T b) → void {
self::C::T r1 = this.{self::C::a}.+(b);
self::C::T r2 = this.{self::C::a}.-(b);
self::C::T r3 = this.{self::C::a}.*(b);
}
- method opEq(self::C::T b) → void {
+ method opEq(generic-covariant-impl self::C::T b) → void {
this.{self::C::a} = this.{self::C::a}.+(b);
this.{self::C::a} = this.{self::C::a}.-(b);
this.{self::C::a} = this.{self::C::a}.*(b);
diff --git a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.transformed.expect b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.transformed.expect
index 41053f4..b4e4156 100644
--- a/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.legacy.transformed.expect
@@ -3,16 +3,16 @@
import "dart:core" as core;
class C<T extends core::num = dynamic> extends core::Object {
- field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method op(self::C::T b) → void {
+ method op(generic-covariant-impl self::C::T b) → void {
self::C::T r1 = this.{self::C::a}.+(b);
self::C::T r2 = this.{self::C::a}.-(b);
self::C::T r3 = this.{self::C::a}.*(b);
}
- method opEq(self::C::T b) → void {
+ method opEq(generic-covariant-impl self::C::T b) → void {
this.{self::C::a} = this.{self::C::a}.+(b);
this.{self::C::a} = this.{self::C::a}.-(b);
this.{self::C::a} = this.{self::C::a}.*(b);
diff --git a/front_end/testcases/inference/setter_return_type.dart b/front_end/testcases/inference/setter_return_type.dart
index 864265c..7ea8bea 100644
--- a/front_end/testcases/inference/setter_return_type.dart
+++ b/front_end/testcases/inference/setter_return_type.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,error*/
+/*@testedFeatures=inference*/
library test;
class C {
@@ -14,7 +14,7 @@
}
class D extends C implements I {
- set /*@topType=void*/ x(/*@topType=int*/ value) {}
+ set x(value) {}
}
main() {}
diff --git a/front_end/testcases/inference/simple_literal_bool.dart b/front_end/testcases/inference/simple_literal_bool.dart
index 265b08b..d1f1a07 100644
--- a/front_end/testcases/inference/simple_literal_bool.dart
+++ b/front_end/testcases/inference/simple_literal_bool.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=bool*/ a = true;
+var a = true;
main() {
var /*@type=bool*/ b = false;
diff --git a/front_end/testcases/inference/simple_literal_double.dart b/front_end/testcases/inference/simple_literal_double.dart
index ca78922..c595708 100644
--- a/front_end/testcases/inference/simple_literal_double.dart
+++ b/front_end/testcases/inference/simple_literal_double.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=double*/ a = 1.2;
+var a = 1.2;
main() {
var /*@type=double*/ b = 3.4;
diff --git a/front_end/testcases/inference/simple_literal_int.dart b/front_end/testcases/inference/simple_literal_int.dart
index c3ae42f..c01ba89 100644
--- a/front_end/testcases/inference/simple_literal_int.dart
+++ b/front_end/testcases/inference/simple_literal_int.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=int*/ a = 1;
+var a = 1;
main() {
var /*@type=int*/ b = 2;
diff --git a/front_end/testcases/inference/simple_literal_null.dart b/front_end/testcases/inference/simple_literal_null.dart
index d1652f5..6ca0f65 100644
--- a/front_end/testcases/inference/simple_literal_null.dart
+++ b/front_end/testcases/inference/simple_literal_null.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=dynamic*/ a = null;
+var a = null;
main() {
var /*@type=dynamic*/ b = null;
diff --git a/front_end/testcases/inference/static_method_tear_off.dart b/front_end/testcases/inference/static_method_tear_off.dart
index 7a8dfd9..ecd7504 100644
--- a/front_end/testcases/inference/static_method_tear_off.dart
+++ b/front_end/testcases/inference/static_method_tear_off.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-const /*@topType=(String) -> int*/ v = C.f;
+const v = C.f;
class C {
static int f(String s) => null;
diff --git a/front_end/testcases/inference/string_literal.dart b/front_end/testcases/inference/string_literal.dart
index 8261e2b..6eb5292 100644
--- a/front_end/testcases/inference/string_literal.dart
+++ b/front_end/testcases/inference/string_literal.dart
@@ -5,10 +5,10 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=int*/ x = 1;
-var /*@topType=String*/ a = 'aaa';
-var /*@topType=String*/ b = 'b ${x} bb';
-var /*@topType=String*/ c = 'c ${x} cc' 'ccc';
+var x = 1;
+var a = 'aaa';
+var b = 'b ${x} bb';
+var c = 'c ${x} cc' 'ccc';
main() {
var /*@type=int*/ x = 1;
diff --git a/front_end/testcases/inference/super_index_set_substitution.dart.legacy.expect b/front_end/testcases/inference/super_index_set_substitution.dart.legacy.expect
index 5bbe4de..b1c6c5f 100644
--- a/front_end/testcases/inference/super_index_set_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference/super_index_set_substitution.dart.legacy.expect
@@ -9,7 +9,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator []=(core::Map<core::int, self::B::T> x, core::List<self::B::T> y) → void {}
+ operator []=(generic-covariant-impl core::Map<core::int, self::B::T> x, generic-covariant-impl core::List<self::B::T> y) → void {}
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
synthetic constructor •() → self::C<self::C::U>
diff --git a/front_end/testcases/inference/super_index_set_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference/super_index_set_substitution.dart.legacy.transformed.expect
index 5bbe4de..b1c6c5f 100644
--- a/front_end/testcases/inference/super_index_set_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/super_index_set_substitution.dart.legacy.transformed.expect
@@ -9,7 +9,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator []=(core::Map<core::int, self::B::T> x, core::List<self::B::T> y) → void {}
+ operator []=(generic-covariant-impl core::Map<core::int, self::B::T> x, generic-covariant-impl core::List<self::B::T> y) → void {}
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
synthetic constructor •() → self::C<self::C::U>
diff --git a/front_end/testcases/inference/super_index_set_substitution.dart.outline.expect b/front_end/testcases/inference/super_index_set_substitution.dart.outline.expect
index a7cf483..80fd653 100644
--- a/front_end/testcases/inference/super_index_set_substitution.dart.outline.expect
+++ b/front_end/testcases/inference/super_index_set_substitution.dart.outline.expect
@@ -8,7 +8,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- operator []=(core::Map<core::int, self::B::T> x, core::List<self::B::T> y) → void
+ operator []=(generic-covariant-impl core::Map<core::int, self::B::T> x, generic-covariant-impl core::List<self::B::T> y) → void
;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.expect b/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.expect
index b0a8223..20df3bc 100644
--- a/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method g(self::E<self::B::T> x) → self::D<self::B::T>
+ method g(generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.transformed.expect
index b0a8223..20df3bc 100644
--- a/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/super_method_invocation_substitution.dart.legacy.transformed.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method g(self::E<self::B::T> x) → self::D<self::B::T>
+ method g(generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference/super_method_invocation_substitution.dart.outline.expect b/front_end/testcases/inference/super_method_invocation_substitution.dart.outline.expect
index 27eacb9..f2b99a5 100644
--- a/front_end/testcases/inference/super_method_invocation_substitution.dart.outline.expect
+++ b/front_end/testcases/inference/super_method_invocation_substitution.dart.outline.expect
@@ -16,7 +16,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- method g(self::E<self::B::T> x) → self::D<self::B::T>
+ method g(generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference/super_property_get.dart b/front_end/testcases/inference/super_property_get.dart
index 75b3499..d778047 100644
--- a/front_end/testcases/inference/super_property_get.dart
+++ b/front_end/testcases/inference/super_property_get.dart
@@ -6,7 +6,7 @@
library test;
class C {
- var /*@topType=int*/ x = 0;
+ var x = 0;
}
class D extends C {
diff --git a/front_end/testcases/inference/super_property_get_invoke_function_typed.dart b/front_end/testcases/inference/super_property_get_invoke_function_typed.dart
index 1a9fb6d..75a68da 100644
--- a/front_end/testcases/inference/super_property_get_invoke_function_typed.dart
+++ b/front_end/testcases/inference/super_property_get_invoke_function_typed.dart
@@ -6,7 +6,7 @@
library test;
class C {
- var /*@topType=() -> int*/ f = /*@returnType=int*/ () => 0;
+ var f = /*@returnType=int*/ () => 0;
}
class D extends C {
diff --git a/front_end/testcases/inference/super_property_get_invoke_implicit_call.dart b/front_end/testcases/inference/super_property_get_invoke_implicit_call.dart
index 3de2bf8..e7d11f2 100644
--- a/front_end/testcases/inference/super_property_get_invoke_implicit_call.dart
+++ b/front_end/testcases/inference/super_property_get_invoke_implicit_call.dart
@@ -10,7 +10,7 @@
}
class C {
- var /*@topType=CallableClass*/ f = new CallableClass();
+ var f = new CallableClass();
}
class D extends C {
diff --git a/front_end/testcases/inference/super_property_get_substitution.dart.legacy.expect b/front_end/testcases/inference/super_property_get_substitution.dart.legacy.expect
index 23680d0..fd035f1 100644
--- a/front_end/testcases/inference/super_property_get_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference/super_property_get_substitution.dart.legacy.expect
@@ -16,7 +16,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/super_property_get_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference/super_property_get_substitution.dart.legacy.transformed.expect
index 23680d0..fd035f1 100644
--- a/front_end/testcases/inference/super_property_get_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/super_property_get_substitution.dart.legacy.transformed.expect
@@ -16,7 +16,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/super_property_get_substitution.dart.outline.expect b/front_end/testcases/inference/super_property_get_substitution.dart.outline.expect
index bc7d92d..caa88dc 100644
--- a/front_end/testcases/inference/super_property_get_substitution.dart.outline.expect
+++ b/front_end/testcases/inference/super_property_get_substitution.dart.outline.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x;
+ generic-covariant-impl field self::D<self::B::T> x;
synthetic constructor •() → self::B<self::B::T>
;
}
diff --git a/front_end/testcases/inference/super_property_set_substitution.dart.legacy.expect b/front_end/testcases/inference/super_property_set_substitution.dart.legacy.expect
index 696b98f..ae129dc 100644
--- a/front_end/testcases/inference/super_property_set_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference/super_property_set_substitution.dart.legacy.expect
@@ -16,7 +16,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/super_property_set_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference/super_property_set_substitution.dart.legacy.transformed.expect
index 696b98f..ae129dc 100644
--- a/front_end/testcases/inference/super_property_set_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference/super_property_set_substitution.dart.legacy.transformed.expect
@@ -16,7 +16,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/inference/super_property_set_substitution.dart.outline.expect b/front_end/testcases/inference/super_property_set_substitution.dart.outline.expect
index 886a4fd..1fa178c 100644
--- a/front_end/testcases/inference/super_property_set_substitution.dart.outline.expect
+++ b/front_end/testcases/inference/super_property_set_substitution.dart.outline.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- field self::D<self::B::T> x;
+ generic-covariant-impl field self::D<self::B::T> x;
synthetic constructor •() → self::B<self::B::T>
;
}
diff --git a/front_end/testcases/inference/toplevel_inference_toplevel_var.dart b/front_end/testcases/inference/toplevel_inference_toplevel_var.dart
index 86a6ea3..80477d3 100644
--- a/front_end/testcases/inference/toplevel_inference_toplevel_var.dart
+++ b/front_end/testcases/inference/toplevel_inference_toplevel_var.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=int*/ i = 0;
+var i = 0;
main() {
var /*@type=int*/ j = i;
diff --git a/front_end/testcases/inference/type_cast.dart b/front_end/testcases/inference/type_cast.dart
index 2dd2b01..d55a1cc 100644
--- a/front_end/testcases/inference/type_cast.dart
+++ b/front_end/testcases/inference/type_cast.dart
@@ -8,11 +8,11 @@
class A<T> {}
class B<T> extends A<T> {
- /*@topType=dynamic*/ foo() {}
+ foo() {}
}
A<num> a = new B<int>();
-var /*@topType=B<int>*/ b = (a as B<int>);
+var b = (a as B<int>);
main() {
A<num> a = new B<int>();
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_dynamic_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_dynamic_param.dart
index b8ba0e2..208b13d 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_dynamic_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_dynamic_param.dart
@@ -9,7 +9,7 @@
C(T x());
}
-var /*@topType=C<dynamic>*/ v = new C<dynamic>(/*@returnType=int*/ () {
+var v = new C<dynamic>(/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_type_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_type_param.dart
index 6313ca1..e59070e 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_type_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_explicit_type_param.dart
@@ -9,7 +9,7 @@
C(T x());
}
-var /*@topType=C<int>*/ v = new C<int>(/*@returnType=int*/ () {
+var v = new C<int>(/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_no_type_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_no_type_param.dart
index 6ed1ab4..0c85e2f 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_no_type_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_constructor_call_no_type_param.dart
@@ -9,7 +9,7 @@
C(x());
}
-var /*@topType=C*/ v = new C(/*@returnType=int*/ () {
+var v = new C(/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param.dart
index 27638af..72be85e 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param.dart
@@ -6,7 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=List<dynamic>*/ v = f<dynamic>(
+var v = f<dynamic>(
/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart
index fcb3945..59c1da4 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart
@@ -6,6 +6,8 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
+var v = (f<dynamic>)(() {
+ return 1;
+});
main() {}
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.legacy.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.legacy.expect
index 361c9d3..ba6541a 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.legacy.expect
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.legacy.expect
@@ -2,21 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:39: Error: An equality expression can't be an operand of another equality expression.
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:19: Error: An equality expression can't be an operand of another equality expression.
// Try re-writing the expression.
-// var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
-// ^
+// var v = (f<dynamic>)(() {
+// ^
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:40: Error: Expected an identifier, but got ')'.
-// var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
-// ^
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:20: Error: Expected an identifier, but got ')'.
+// var v = (f<dynamic>)(() {
+// ^
//
import self as self;
import "dart:core" as core;
-static field dynamic v = self::f.<(dynamic).>(invalid-expression "pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:40: Error: This couldn't be parsed.
-var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
- ^").call(() → dynamic {
+static field dynamic v = self::f.<(dynamic).>(invalid-expression "pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:20: Error: This couldn't be parsed.
+var v = (f<dynamic>)(() {
+ ^").call(() → dynamic {
return 1;
});
static method f<T extends core::Object = dynamic>(() → self::f::T g) → core::List<self::f::T>
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.outline.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.outline.expect
index 58e5d4b..48a0717 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.outline.expect
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart.outline.expect
@@ -2,14 +2,14 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:39: Error: An equality expression can't be an operand of another equality expression.
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:19: Error: An equality expression can't be an operand of another equality expression.
// Try re-writing the expression.
-// var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
-// ^
+// var v = (f<dynamic>)(() {
+// ^
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:40: Error: Expected an identifier, but got ')'.
-// var /*@topType=dynamic*/v = (f<dynamic>)(() { return 1; });
-// ^
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1.dart:9:20: Error: Expected an identifier, but got ')'.
+// var v = (f<dynamic>)(() {
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
index 90d0037..0a3a0e2 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
@@ -6,8 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=dynamic*/ v =
- (f)<dynamic>(/*info:INFERRED_TYPE_CLOSURE*/ /*@returnType=int*/ () {
+var v = (f)<dynamic>(/*info:INFERRED_TYPE_CLOSURE*/ /*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart.strong.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart.strong.expect
new file mode 100644
index 0000000..a43bff6
--- /dev/null
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart.strong.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field core::List<dynamic> v = self::f.call<dynamic>(() → core::int {
+ return 1;
+});
+static method f<T extends core::Object = dynamic>(() → self::f::T g) → core::List<self::f::T>
+ return <self::f::T>[g.call()];
+static method main() → dynamic {
+ self::v;
+}
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param.dart
index cd0d3ba..d332d12 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param.dart
@@ -6,7 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=List<int>*/ v = f<int>(/*@returnType=int*/ () {
+var v = f<int>(/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart
index 761fe2a..b24960b 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart
@@ -6,6 +6,8 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
+var v = (f<int>)(() {
+ return 1;
+});
main() {}
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.legacy.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.legacy.expect
index 4492f7c..27f915d 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.legacy.expect
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.legacy.expect
@@ -2,21 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:35: Error: An equality expression can't be an operand of another equality expression.
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:15: Error: An equality expression can't be an operand of another equality expression.
// Try re-writing the expression.
-// var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
-// ^
+// var v = (f<int>)(() {
+// ^
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:36: Error: Expected an identifier, but got ')'.
-// var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
-// ^
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:16: Error: Expected an identifier, but got ')'.
+// var v = (f<int>)(() {
+// ^
//
import self as self;
import "dart:core" as core;
-static field dynamic v = self::f.<(core::int).>(invalid-expression "pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:36: Error: This couldn't be parsed.
-var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
- ^").call(() → dynamic {
+static field dynamic v = self::f.<(core::int).>(invalid-expression "pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:16: Error: This couldn't be parsed.
+var v = (f<int>)(() {
+ ^").call(() → dynamic {
return 1;
});
static method f<T extends core::Object = dynamic>(() → self::f::T g) → core::List<self::f::T>
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.outline.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.outline.expect
index 6f5ce50..babb86c 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.outline.expect
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart.outline.expect
@@ -2,14 +2,14 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:35: Error: An equality expression can't be an operand of another equality expression.
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:15: Error: An equality expression can't be an operand of another equality expression.
// Try re-writing the expression.
-// var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
-// ^
+// var v = (f<int>)(() {
+// ^
//
-// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:36: Error: Expected an identifier, but got ')'.
-// var /*@topType=dynamic*/v = (f<int>)(() { return 1; });
-// ^
+// pkg/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1.dart:9:16: Error: Expected an identifier, but got ')'.
+// var v = (f<int>)(() {
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
index d9bf6c6..f8ab111 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
@@ -6,8 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=dynamic*/ v =
- (f)<int>(/*info:INFERRED_TYPE_CLOSURE*/ /*@returnType=int*/ () {
+var v = (f)<int>(/*info:INFERRED_TYPE_CLOSURE*/ /*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart.strong.expect b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart.strong.expect
new file mode 100644
index 0000000..cd480b4
--- /dev/null
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart.strong.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static field core::List<core::int> v = self::f.call<core::int>(() → core::int {
+ return 1;
+});
+static method f<T extends core::Object = dynamic>(() → self::f::T g) → core::List<self::f::T>
+ return <self::f::T>[g.call()];
+static method main() → dynamic {
+ self::v;
+}
diff --git a/front_end/testcases/inference/unsafe_block_closure_inference_method_call_no_type_param.dart b/front_end/testcases/inference/unsafe_block_closure_inference_method_call_no_type_param.dart
index 366bc8c..45e2995 100644
--- a/front_end/testcases/inference/unsafe_block_closure_inference_method_call_no_type_param.dart
+++ b/front_end/testcases/inference/unsafe_block_closure_inference_method_call_no_type_param.dart
@@ -6,10 +6,10 @@
library test;
class C {
- double f(/*@topType=dynamic*/ x) => 1.0;
+ double f(x) => 1.0;
}
-var /*@topType=double*/ v = new C(). /*@target=C::f*/ f(/*@returnType=int*/ () {
+var v = new C(). /*@target=C::f*/ f(/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart b/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart
index bc4dbaf..6e49f44 100644
--- a/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart
+++ b/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart
@@ -16,7 +16,7 @@
print("running");
}
-var /*@topType=dynamic*/ x = run<dynamic>(printRunning);
+var x = run<dynamic>(printRunning);
main() {
void printRunning() {
diff --git a/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart.type_promotion.expect b/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart.type_promotion.expect
index 96232fc..0c4ff5c 100644
--- a/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart.type_promotion.expect
+++ b/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart.type_promotion.expect
@@ -1,12 +1,12 @@
-pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:29:5: Context: Write to x@559
+pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:29:5: Context: Write to x@538
x = 123;
^
-pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:30:5: Context: Write to x@559
+pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:30:5: Context: Write to x@538
x = 'hi';
^
-pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:31:5: Context: Write to y@612
+pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:31:5: Context: Write to y@591
y = /*error:INVALID_ASSIGNMENT*/ 123;
^
-pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:32:5: Context: Write to y@612
+pkg/front_end/testcases/inference/void_return_type_subtypes_dynamic.dart:32:5: Context: Write to y@591
y = /*error:INVALID_ASSIGNMENT*/ 'hi';
^
diff --git a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart b/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
index 68d91d1..5d9af14 100644
--- a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
class A {
@@ -10,22 +10,21 @@
int g(dynamic i) => 0;
}
-var /*@topType=A*/ a = new A();
+var a = new A();
// 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*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
- a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(c);
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ c = /*@returnType=dynamic*/ () =>
- a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(b);
+var b = /*@returnType=invalid-type*/ () =>
+ a. /*@typeArgs=invalid-type*/ /*@target=A::f*/ f(c);
+var c = /*@returnType=invalid-type*/ () =>
+ a. /*@typeArgs=invalid-type*/ /*@target=A::f*/ f(b);
// e's use of a.g breaks the circularity, because a.g is not generic, therefore
// the type of e does not depend on the type of d.
-var /*@topType=() -> () -> int*/ d = /*@returnType=() -> int*/ () =>
+var d = /*@returnType=() -> int*/ () =>
a. /*@typeArgs=() -> int*/ /*@target=A::f*/ f(e);
-var /*@topType=() -> int*/ e = /*@returnType=int*/ () =>
- a. /*@target=A::g*/ g(d);
+var e = /*@returnType=int*/ () => a. /*@target=A::g*/ g(d);
main() {}
diff --git a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect b/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
index 637a638..1681eb9 100644
--- a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
+++ b/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
@@ -2,15 +2,15 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:20:5: Error: Can't infer the type of 'c': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ c = /*@returnType=dynamic*/ () =>
-// ^
+// var c = /*@returnType=invalid-type*/ () =>
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:18:5: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
-// ^
+// var b = /*@returnType=invalid-type*/ () =>
+// ^
//
import self as self;
import "dart:core" as core;
@@ -25,8 +25,8 @@
return 0;
}
static field self::A a = new self::A::•();
-static field dynamic b = () → dynamic => self::a.{self::A::f}<dynamic>(self::c);
-static field dynamic c = () → dynamic => self::a.{self::A::f}<dynamic>(self::b);
+static field invalid-type b = (() → invalid-type => self::a.{self::A::f}<invalid-type>(self::c)) as{TypeError} invalid-type;
+static field invalid-type c = (() → invalid-type => self::a.{self::A::f}<invalid-type>(self::b)) as{TypeError} invalid-type;
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 method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.transformed.expect b/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.transformed.expect
index 637a638..1681eb9 100644
--- a/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.transformed.expect
@@ -2,15 +2,15 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:20:5: Error: Can't infer the type of 'c': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ c = /*@returnType=dynamic*/ () =>
-// ^
+// var c = /*@returnType=invalid-type*/ () =>
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:18:5: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
-// ^
+// var b = /*@returnType=invalid-type*/ () =>
+// ^
//
import self as self;
import "dart:core" as core;
@@ -25,8 +25,8 @@
return 0;
}
static field self::A a = new self::A::•();
-static field dynamic b = () → dynamic => self::a.{self::A::f}<dynamic>(self::c);
-static field dynamic c = () → dynamic => self::a.{self::A::f}<dynamic>(self::b);
+static field invalid-type b = (() → invalid-type => self::a.{self::A::f}<invalid-type>(self::c)) as{TypeError} invalid-type;
+static field invalid-type c = (() → invalid-type => self::a.{self::A::f}<invalid-type>(self::b)) as{TypeError} invalid-type;
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 method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart b/front_end/testcases/inference_new/dependency_only_if_overloaded.dart
index 0c3cd9b..1880cfe 100644
--- a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
int intValue = 0;
@@ -12,21 +12,18 @@
// There's a circularity between a and b because the type of `int + x` depends
// on the type of x.
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>
- intValue /*@target=num::+*/ + b;
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = a();
+var a = /*@returnType=num*/ () => intValue /*@target=num::+*/ + b;
+var b = a();
// But there's no circularity between c and d because the type of `num + x` is
// always num.
-var /*@topType=() -> num*/ c = /*@returnType=num*/ () =>
- numValue /*@target=num::+*/ + d;
-var /*@topType=num*/ d = c();
+var c = /*@returnType=num*/ () => numValue /*@target=num::+*/ + d;
+var d = c();
// Similar for double.
-var /*@topType=() -> double*/ e = /*@returnType=double*/ () =>
- doubleValue /*@target=double::+*/ + f;
-var /*@topType=double*/ f = e();
+var e = /*@returnType=double*/ () => doubleValue /*@target=double::+*/ + f;
+var f = e();
main() {}
diff --git a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect b/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
index d2d6d0d..f2657ee 100644
--- a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
+++ b/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
@@ -2,15 +2,15 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:16:5: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = a();
-// ^
+// var b = a();
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:15:5: Error: Can't infer the type of 'a': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>
-// ^
+// var a = /*@returnType=num*/ () => intValue /*@target=num::+*/ + b;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -18,8 +18,8 @@
static field core::int intValue = 0;
static field core::num numValue = 0;
static field core::double doubleValue = 0.0;
-static field dynamic a = () → core::num => self::intValue.{core::num::+}(self::b as{TypeError} core::num);
-static field dynamic b = self::a.call();
+static field invalid-type a = (() → core::num => self::intValue.{core::num::+}(self::b as{TypeError} core::num)) as{TypeError} invalid-type;
+static field invalid-type b = self::a.call() as{TypeError} invalid-type;
static field () → core::num c = () → core::num => self::numValue.{core::num::+}(self::d);
static field core::num d = self::c.call();
static field () → core::double e = () → core::double => self::doubleValue.{core::double::+}(self::f);
diff --git a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.transformed.expect b/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.transformed.expect
index d2d6d0d..6d183c0 100644
--- a/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.transformed.expect
@@ -2,15 +2,20 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:17:72: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = a();
-// ^
+// var /*@error=CantInferTypeDueToCircularity*/ b = a/*@error=UndefinedMethod*/();
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:15:72: Error: Can't infer the type of 'a': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>
-// ^
+// var /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>
+// ^
+//
+// pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:17:77: Error: The method 'call' isn't defined for the class 'invalid-type'.
+// Try correcting the name to the name of an existing method, or defining a method named 'call'.
+// var /*@error=CantInferTypeDueToCircularity*/ b = a/*@error=UndefinedMethod*/();
+// ^
//
import self as self;
import "dart:core" as core;
@@ -18,8 +23,11 @@
static field core::int intValue = 0;
static field core::num numValue = 0;
static field core::double doubleValue = 0.0;
-static field dynamic a = () → core::num => self::intValue.{core::num::+}(self::b as{TypeError} core::num);
-static field dynamic b = self::a.call();
+static field invalid-type a = (() → core::num => self::intValue.{core::num::+}(self::b as{TypeError} core::num)) as{TypeError} invalid-type;
+static field invalid-type b = invalid-expression "pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:17:77: Error: The method 'call' isn't defined for the class 'invalid-type'.
+Try correcting the name to the name of an existing method, or defining a method named 'call'.
+var /*@error=CantInferTypeDueToCircularity*/ b = a/*@error=UndefinedMethod*/();
+ ^";
static field () → core::num c = () → core::num => self::numValue.{core::num::+}(self::d);
static field core::num d = self::c.call();
static field () → core::double e = () → core::double => self::doubleValue.{core::double::+}(self::f);
diff --git a/front_end/testcases/inference_new/downwards_inference_inside_top_level.dart b/front_end/testcases/inference_new/downwards_inference_inside_top_level.dart
index 3a5760c..e296a6a 100644
--- a/front_end/testcases/inference_new/downwards_inference_inside_top_level.dart
+++ b/front_end/testcases/inference_new/downwards_inference_inside_top_level.dart
@@ -13,8 +13,6 @@
B(T x);
}
-var /*@topType=List<B<int>>*/ t3 = /*@typeArgs=B<int>*/ [
- new /*@typeArgs=int*/ B(3)
-];
+var t3 = /*@typeArgs=B<int>*/ [new /*@typeArgs=int*/ B(3)];
main() {}
diff --git a/front_end/testcases/inference_new/downwards_inference_inside_top_level_2.dart b/front_end/testcases/inference_new/downwards_inference_inside_top_level_2.dart
index 4c8edf2..5f75350 100644
--- a/front_end/testcases/inference_new/downwards_inference_inside_top_level_2.dart
+++ b/front_end/testcases/inference_new/downwards_inference_inside_top_level_2.dart
@@ -9,8 +9,6 @@
A(T x);
}
-var /*@topType=List<A<int>>*/ t2 = /*@typeArgs=A<int>*/ [
- new /*@typeArgs=int*/ A(2)
-];
+var t2 = /*@typeArgs=A<int>*/ [new /*@typeArgs=int*/ A(2)];
main() {}
diff --git a/front_end/testcases/inference_new/field_inference_circularity.dart b/front_end/testcases/inference_new/field_inference_circularity.dart
index d8b81a7..a609915 100644
--- a/front_end/testcases/inference_new/field_inference_circularity.dart
+++ b/front_end/testcases/inference_new/field_inference_circularity.dart
@@ -2,22 +2,20 @@
// 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,error*/
+/*@testedFeatures=inference*/
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*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
- new B(). /*@target=B::x*/ x;
- var /*@topType=() -> dynamic*/ y = /*@returnType=dynamic*/ () =>
- new B(). /*@target=B::x*/ x;
+ var x = /*@returnType=invalid-type*/ () => new B(). /*@target=B::x*/ x;
+ var y = /*@returnType=invalid-type*/ () => new B(). /*@target=B::x*/ x;
}
class B extends A {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x;
- var /*@topType=() -> dynamic*/ y;
+ var x;
+ var y;
}
main() {}
diff --git a/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect b/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
index 0d47f0c..e436c4f 100644
--- a/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
+++ b/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
@@ -2,29 +2,29 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/field_inference_circularity.dart:12:7: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => new B(). /*@target=B::x*/ x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/field_inference_circularity.dart:17:7: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x;
-// ^
+// var x;
+// ^
//
import self as self;
import "dart:core" as core;
class A extends core::Object {
- field dynamic x = () → dynamic => new self::B::•().{self::B::x};
- field () → dynamic y = () → dynamic => new self::B::•().{self::B::x};
+ field invalid-type x = (() → invalid-type => new self::B::•().{self::B::x}) as{TypeError} invalid-type;
+ field () → invalid-type y = () → invalid-type => new self::B::•().{self::B::x};
synthetic constructor •() → self::A
: super core::Object::•()
;
}
class B extends self::A {
- field dynamic x = null;
- field () → dynamic y = null;
+ field invalid-type x = null;
+ field () → invalid-type y = null;
synthetic constructor •() → self::B
: super self::A::•()
;
diff --git a/front_end/testcases/inference_new/field_inference_circularity.dart.strong.transformed.expect b/front_end/testcases/inference_new/field_inference_circularity.dart.strong.transformed.expect
index 0d47f0c..e436c4f 100644
--- a/front_end/testcases/inference_new/field_inference_circularity.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/field_inference_circularity.dart.strong.transformed.expect
@@ -2,29 +2,29 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/field_inference_circularity.dart:12:7: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => new B(). /*@target=B::x*/ x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/field_inference_circularity.dart:17:7: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x;
-// ^
+// var x;
+// ^
//
import self as self;
import "dart:core" as core;
class A extends core::Object {
- field dynamic x = () → dynamic => new self::B::•().{self::B::x};
- field () → dynamic y = () → dynamic => new self::B::•().{self::B::x};
+ field invalid-type x = (() → invalid-type => new self::B::•().{self::B::x}) as{TypeError} invalid-type;
+ field () → invalid-type y = () → invalid-type => new self::B::•().{self::B::x};
synthetic constructor •() → self::A
: super core::Object::•()
;
}
class B extends self::A {
- field dynamic x = null;
- field () → dynamic y = null;
+ field invalid-type x = null;
+ field () → invalid-type y = null;
synthetic constructor •() → self::B
: super self::A::•()
;
diff --git a/front_end/testcases/inference_new/for_each_identifier_downwards.dart b/front_end/testcases/inference_new/for_each_identifier_downwards.dart
index 4e96e3e..0977a74 100644
--- a/front_end/testcases/inference_new/for_each_identifier_downwards.dart
+++ b/front_end/testcases/inference_new/for_each_identifier_downwards.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,error*/
+/*@testedFeatures=inference*/
library test;
T f<T>() => null;
diff --git a/front_end/testcases/inference_new/for_each_invalid_iterable.dart b/front_end/testcases/inference_new/for_each_invalid_iterable.dart
index da9ed77..29a09fd 100644
--- a/front_end/testcases/inference_new/for_each_invalid_iterable.dart
+++ b/front_end/testcases/inference_new/for_each_invalid_iterable.dart
@@ -2,16 +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.
-/*@testedFeatures=inference,error*/
+/*@testedFeatures=inference*/
library test;
test() async {
String s;
- for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
- await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ for (int x in s) {}
+ await for (int x in s) {}
int y;
- for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
- await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ for (y in s) {}
+ await for (y in s) {}
}
main() {}
diff --git a/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect b/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
index a921371..d0463b8 100644
--- a/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
+++ b/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
@@ -2,25 +2,25 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:17: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
// - 'Iterable' is from 'dart:core'.
-// for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// for (int x in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:23: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
// - 'Stream' is from 'dart:async'.
-// await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// await for (int x in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:13: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
// - 'Iterable' is from 'dart:core'.
-// for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// for (y in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:19: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
// - 'Stream' is from 'dart:async'.
-// await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// await for (y in s) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -28,29 +28,29 @@
static method test() → dynamic async {
core::String s;
- for (final dynamic #t1 in let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ for (final dynamic #t1 in let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:17: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
- 'Iterable' is from 'dart:core'.
- for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} core::Iterable<dynamic>) {
+ for (int x in s) {}
+ ^" in s as{TypeError} core::Iterable<dynamic>) {
core::int x = #t1 as{TypeError} core::int;
}
- await for (final dynamic #t3 in let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ await for (final dynamic #t3 in let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:23: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
- 'Stream' is from 'dart:async'.
- await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} asy::Stream<dynamic>) {
+ await for (int x in s) {}
+ ^" in s as{TypeError} asy::Stream<dynamic>) {
core::int x = #t3 as{TypeError} core::int;
}
core::int y;
- for (final dynamic #t5 in let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ for (final dynamic #t5 in let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:13: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
- 'Iterable' is from 'dart:core'.
- for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} core::Iterable<dynamic>) {
+ for (y in s) {}
+ ^" in s as{TypeError} core::Iterable<dynamic>) {
y = #t5 as{TypeError} core::int;
}
- await for (final dynamic #t7 in let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ await for (final dynamic #t7 in let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:19: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
- 'Stream' is from 'dart:async'.
- await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} asy::Stream<dynamic>) {
+ await for (y in s) {}
+ ^" in s as{TypeError} asy::Stream<dynamic>) {
y = #t7 as{TypeError} core::int;
}
}
diff --git a/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect b/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
index e1b9af6..7376685 100644
--- a/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
@@ -2,25 +2,25 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:17: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
// - 'Iterable' is from 'dart:core'.
-// for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// for (int x in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:23: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
// - 'Stream' is from 'dart:async'.
-// await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// await for (int x in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:13: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
// - 'Iterable' is from 'dart:core'.
-// for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// for (y in s) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+// pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:19: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
// - 'Stream' is from 'dart:async'.
-// await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
-// ^
+// await for (y in s) {}
+// ^
//
import self as self;
import "dart:async" as asy;
@@ -43,17 +43,17 @@
#L1:
{
core::String s;
- for (final dynamic #t1 in let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ for (final dynamic #t1 in let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:17: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
- 'Iterable' is from 'dart:core'.
- for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} core::Iterable<dynamic>) {
+ for (int x in s) {}
+ ^" in s as{TypeError} core::Iterable<dynamic>) {
core::int x = #t1 as{TypeError} core::int;
}
{
- dynamic :stream = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ dynamic :stream = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:23: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
- 'Stream' is from 'dart:async'.
- await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} asy::Stream<dynamic>;
+ await for (int x in s) {}
+ ^" in s as{TypeError} asy::Stream<dynamic>;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
@@ -78,17 +78,17 @@
}
}
core::int y;
- for (final dynamic #t8 in let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
+ for (final dynamic #t8 in let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:13: Error: The type 'String' used in the 'for' loop must implement 'Iterable<dynamic>'.
- 'Iterable' is from 'dart:core'.
- for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} core::Iterable<dynamic>) {
+ for (y in s) {}
+ ^" in s as{TypeError} core::Iterable<dynamic>) {
y = #t8 as{TypeError} core::int;
}
{
- dynamic :stream = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
+ dynamic :stream = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:19: Error: The type 'String' used in the 'for' loop must implement 'Stream<dynamic>'.
- 'Stream' is from 'dart:async'.
- await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
- ^" in s as{TypeError} asy::Stream<dynamic>;
+ await for (y in s) {}
+ ^" in s as{TypeError} asy::Stream<dynamic>;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
diff --git a/front_end/testcases/inference_new/for_each_outer_var_type.dart b/front_end/testcases/inference_new/for_each_outer_var_type.dart
index 9ffdfe8..e98bf31 100644
--- a/front_end/testcases/inference_new/for_each_outer_var_type.dart
+++ b/front_end/testcases/inference_new/for_each_outer_var_type.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,error*/
+/*@testedFeatures=inference*/
library test;
import 'dart:async';
@@ -23,8 +23,8 @@
await for (a in stream) {}
for (b in iterable) {}
await for (b in stream) {}
- for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
- await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
+ for (i in iterable) {}
+ await for (i in stream) {}
for (a in /*@typeArgs=Iterable<A>*/ f()) {}
await for (a in /*@typeArgs=Stream<A>*/ f()) {}
}
diff --git a/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect b/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
index eed185f..01186e9 100644
--- a/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
+++ b/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:10: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
// Try changing the type of the variable.
-// for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
-// ^
+// for (i in iterable) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:16: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
// Try changing the type of the variable.
-// await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
-// ^
+// await for (i in stream) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -51,18 +51,18 @@
b = #t4 as{TypeError} self::B;
}
for (final self::A #t5 in iterable) {
- i = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:10: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
- 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
Try changing the type of the variable.
- for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
- ^" in #t5 as{TypeError} core::int;
+ for (i in iterable) {}
+ ^" in #t5 as{TypeError} core::int;
}
await for (final self::A #t7 in stream) {
- i = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:16: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
- 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
Try changing the type of the variable.
- await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
- ^" in #t7 as{TypeError} core::int;
+ await for (i in stream) {}
+ ^" in #t7 as{TypeError} core::int;
}
for (final self::A #t9 in self::f<core::Iterable<self::A>>()) {
a = #t9;
diff --git a/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect b/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
index d924c02..4a60fd2 100644
--- a/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:10: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
// Try changing the type of the variable.
-// for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
-// ^
+// for (i in iterable) {}
+// ^
//
-// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:16: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
// Try changing the type of the variable.
-// await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
-// ^
+// await for (i in stream) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -110,11 +110,11 @@
}
}
for (final self::A #t11 in iterable) {
- i = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:10: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
- 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
Try changing the type of the variable.
- for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
- ^" in #t11 as{TypeError} core::int;
+ for (i in iterable) {}
+ ^" in #t11 as{TypeError} core::int;
}
{
dynamic :stream = stream;
@@ -129,11 +129,11 @@
if(:result) {
final self::A #t15 = :for-iterator.{asy::_StreamIterator::current};
{
- i = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:16: Error: A value of type 'A' can't be assigned to a variable of type 'int'.
- 'A' is from 'pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart'.
Try changing the type of the variable.
- await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
- ^" in #t15 as{TypeError} core::int;
+ await for (i in stream) {}
+ ^" in #t15 as{TypeError} core::int;
}
}
else
diff --git a/front_end/testcases/inference_new/infer_assign_to_index.dart b/front_end/testcases/inference_new/infer_assign_to_index.dart
index f08da41..8eb3740 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index.dart
+++ b/front_end/testcases/inference_new/infer_assign_to_index.dart
@@ -6,6 +6,6 @@
library test;
List<double> a = <double>[];
-var /*@topType=double*/ b = (a /*@target=List::[]=*/ [0] = 1.0);
+var b = (a /*@target=List::[]=*/ [0] = 1.0);
main() {}
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.expect b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.expect
index c6fb73b..9619672 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.expect
@@ -8,10 +8,10 @@
;
operator [](core::String s) → self::Base::T
return this.{self::Base::getValue}(s);
- operator []=(core::String s, self::Base::U v) → void
+ operator []=(core::String s, generic-covariant-impl self::Base::U v) → void
return this.{self::Base::setValue}(s, v);
abstract method getValue(core::String s) → self::Base::T;
- abstract method setValue(core::String s, self::Base::U v) → void;
+ abstract method setValue(core::String s, generic-covariant-impl self::Base::U v) → void;
}
abstract class Test1 extends self::Base<core::int, core::int> {
synthetic constructor •() → self::Test1
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.transformed.expect b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.transformed.expect
index c6fb73b..9619672 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.legacy.transformed.expect
@@ -8,10 +8,10 @@
;
operator [](core::String s) → self::Base::T
return this.{self::Base::getValue}(s);
- operator []=(core::String s, self::Base::U v) → void
+ operator []=(core::String s, generic-covariant-impl self::Base::U v) → void
return this.{self::Base::setValue}(s, v);
abstract method getValue(core::String s) → self::Base::T;
- abstract method setValue(core::String s, self::Base::U v) → void;
+ abstract method setValue(core::String s, generic-covariant-impl self::Base::U v) → void;
}
abstract class Test1 extends self::Base<core::int, core::int> {
synthetic constructor •() → self::Test1
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.outline.expect b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.outline.expect
index 43e0d64..98949ae 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.outline.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.outline.expect
@@ -7,10 +7,10 @@
;
operator [](core::String s) → self::Base::T
;
- operator []=(core::String s, self::Base::U v) → void
+ operator []=(core::String s, generic-covariant-impl self::Base::U v) → void
;
abstract method getValue(core::String s) → self::Base::T;
- abstract method setValue(core::String s, self::Base::U v) → void;
+ abstract method setValue(core::String s, generic-covariant-impl self::Base::U v) → void;
}
abstract class Test1 extends self::Base<core::int, core::int> {
synthetic constructor •() → self::Test1
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.expect b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.expect
index 8d92bc9..bab4ea5 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.expect
@@ -7,7 +7,7 @@
: super core::Object::•()
;
abstract operator [](core::String s) → self::Test::T;
- abstract operator []=(core::String s, self::Test::U v) → void;
+ abstract operator []=(core::String s, generic-covariant-impl self::Test::U v) → void;
}
static method getInt() → core::int
return 0;
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.transformed.expect b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.transformed.expect
index 8d92bc9..bab4ea5 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.legacy.transformed.expect
@@ -7,7 +7,7 @@
: super core::Object::•()
;
abstract operator [](core::String s) → self::Test::T;
- abstract operator []=(core::String s, self::Test::U v) → void;
+ abstract operator []=(core::String s, generic-covariant-impl self::Test::U v) → void;
}
static method getInt() → core::int
return 0;
diff --git a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.outline.expect b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.outline.expect
index f14f72a..2be1f6f 100644
--- a/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.outline.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.outline.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::Test<self::Test::T, self::Test::U>
;
abstract operator [](core::String s) → self::Test::T;
- abstract operator []=(core::String s, self::Test::U v) → void;
+ abstract operator []=(core::String s, generic-covariant-impl self::Test::U v) → void;
}
static method getInt() → core::int
;
diff --git a/front_end/testcases/inference_new/infer_assign_to_property.dart b/front_end/testcases/inference_new/infer_assign_to_property.dart
index eb39317..7b7d80f 100644
--- a/front_end/testcases/inference_new/infer_assign_to_property.dart
+++ b/front_end/testcases/inference_new/infer_assign_to_property.dart
@@ -9,13 +9,13 @@
int f;
}
-var /*@topType=int*/ v_assign = (new A(). /*@target=A::f*/ f = 1);
-var /*@topType=int*/ v_plus = (new A(). /*@target=A::f*/ f += 1);
-var /*@topType=int*/ v_minus = (new A(). /*@target=A::f*/ f -= 1);
-var /*@topType=int*/ v_multiply = (new A(). /*@target=A::f*/ f *= 1);
-var /*@topType=int*/ v_prefix_pp = (++new A(). /*@target=A::f*/ f);
-var /*@topType=int*/ v_prefix_mm = (--new A(). /*@target=A::f*/ f);
-var /*@topType=int*/ v_postfix_pp = (new A(). /*@target=A::f*/ f++);
-var /*@topType=int*/ v_postfix_mm = (new A(). /*@target=A::f*/ f--);
+var v_assign = (new A(). /*@target=A::f*/ f = 1);
+var v_plus = (new A(). /*@target=A::f*/ f += 1);
+var v_minus = (new A(). /*@target=A::f*/ f -= 1);
+var v_multiply = (new A(). /*@target=A::f*/ f *= 1);
+var v_prefix_pp = (++new A(). /*@target=A::f*/ f);
+var v_prefix_mm = (--new A(). /*@target=A::f*/ f);
+var v_postfix_pp = (new A(). /*@target=A::f*/ f++);
+var v_postfix_mm = (new A(). /*@target=A::f*/ f--);
main() {}
diff --git a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart
index af534a0..0a7493d 100644
--- a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart
+++ b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart
@@ -6,17 +6,17 @@
library test;
class A {
- int operator +(/*@topType=dynamic*/ other) => 1;
- double operator -(/*@topType=dynamic*/ other) => 2.0;
+ int operator +(other) => 1;
+ double operator -(other) => 2.0;
}
class B {
A a;
}
-var /*@topType=int*/ v_prefix_pp = (++new B(). /*@target=B::a*/ a);
-var /*@topType=double*/ v_prefix_mm = (--new B(). /*@target=B::a*/ a);
-var /*@topType=A*/ v_postfix_pp = (new B(). /*@target=B::a*/ a++);
-var /*@topType=A*/ v_postfix_mm = (new B(). /*@target=B::a*/ a--);
+var v_prefix_pp = (++new B(). /*@target=B::a*/ a);
+var v_prefix_mm = (--new B(). /*@target=B::a*/ a);
+var v_postfix_pp = (new B(). /*@target=B::a*/ a++);
+var v_postfix_mm = (new B(). /*@target=B::a*/ a--);
main() {}
diff --git a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.expect b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.expect
index 0299145..a3ccc64 100644
--- a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.expect
@@ -2,29 +2,29 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:17:37: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:17:20: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// var /*@topType=int*/ v_prefix_pp = (++new B(). /*@target=B::a*/ a);
-// ^
+// var v_prefix_pp = (++new B(). /*@target=B::a*/ a);
+// ^
//
-// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:18:40: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:18:20: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// var /*@topType=double*/ v_prefix_mm = (--new B(). /*@target=B::a*/ a);
-// ^
+// var v_prefix_mm = (--new B(). /*@target=B::a*/ a);
+// ^
//
-// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:19:63: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:19:48: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// var /*@topType=A*/ v_postfix_pp = (new B(). /*@target=B::a*/ a++);
-// ^
+// var v_postfix_pp = (new B(). /*@target=B::a*/ a++);
+// ^
//
-// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:20:63: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:20:48: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// var /*@topType=A*/ v_postfix_mm = (new B(). /*@target=B::a*/ a--);
-// ^
+// var v_postfix_mm = (new B(). /*@target=B::a*/ a--);
+// ^
//
import self as self;
import "dart:core" as core;
@@ -44,24 +44,24 @@
: super core::Object::•()
;
}
-static field core::int v_prefix_pp = let final self::B #t1 = new self::B::•() in #t1.{self::B::a} = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:17:37: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
+static field core::int v_prefix_pp = let final self::B #t1 = new self::B::•() in #t1.{self::B::a} = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:17:20: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
-var /*@topType=int*/ v_prefix_pp = (++new B(). /*@target=B::a*/ a);
- ^" in #t1.{self::B::a}.{self::A::+}(1) as{TypeError} self::A;
-static field core::double v_prefix_mm = let final self::B #t3 = new self::B::•() in #t3.{self::B::a} = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:18:40: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
+var v_prefix_pp = (++new B(). /*@target=B::a*/ a);
+ ^" in #t1.{self::B::a}.{self::A::+}(1) as{TypeError} self::A;
+static field core::double v_prefix_mm = let final self::B #t3 = new self::B::•() in #t3.{self::B::a} = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:18:20: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
-var /*@topType=double*/ v_prefix_mm = (--new B(). /*@target=B::a*/ a);
- ^" in #t3.{self::B::a}.{self::A::-}(1) as{TypeError} self::A;
-static field self::A v_postfix_pp = let final self::B #t5 = new self::B::•() in let final self::A #t6 = #t5.{self::B::a} in let final core::int #t7 = #t5.{self::B::a} = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:19:63: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
+var v_prefix_mm = (--new B(). /*@target=B::a*/ a);
+ ^" in #t3.{self::B::a}.{self::A::-}(1) as{TypeError} self::A;
+static field self::A v_postfix_pp = let final self::B #t5 = new self::B::•() in let final self::A #t6 = #t5.{self::B::a} in let final core::int #t7 = #t5.{self::B::a} = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:19:48: Error: A value of type 'int' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
-var /*@topType=A*/ v_postfix_pp = (new B(). /*@target=B::a*/ a++);
- ^" in #t6.{self::A::+}(1) as{TypeError} self::A in #t6;
-static field self::A v_postfix_mm = let final self::B #t9 = new self::B::•() in let final self::A #t10 = #t9.{self::B::a} in let final core::double #t11 = #t9.{self::B::a} = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:20:63: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
+var v_postfix_pp = (new B(). /*@target=B::a*/ a++);
+ ^" in #t6.{self::A::+}(1) as{TypeError} self::A in #t6;
+static field self::A v_postfix_mm = let final self::B #t9 = new self::B::•() in let final self::A #t10 = #t9.{self::B::a} in let final core::double #t11 = #t9.{self::B::a} = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:20:48: Error: A value of type 'double' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
-var /*@topType=A*/ v_postfix_mm = (new B(). /*@target=B::a*/ a--);
- ^" in #t10.{self::A::-}(1) as{TypeError} self::A in #t10;
+var v_postfix_mm = (new B(). /*@target=B::a*/ a--);
+ ^" in #t10.{self::A::-}(1) as{TypeError} self::A in #t10;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.transformed.expect b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.transformed.expect
index 7a44f95..2d70eeb 100644
--- a/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/infer_assign_to_property_custom.dart.strong.transformed.expect
@@ -19,18 +19,18 @@
}
static field core::int v_prefix_pp = let final self::B #t1 = new self::B::•() in #t1.{self::B::a} = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:17:37: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'test::A'.
Try changing the type of the left hand side, or casting the right hand side to 'test::A'.
-var /*@topType=int*/ v_prefix_pp = (++new B(). /*@target=B::a*/ a);
+var v_prefix_pp = (++new B(). /*@target=B::a*/ a);
^" in #t1.{self::B::a}.{self::A::+}(1) as{TypeError} <BottomType>;
static field core::double v_prefix_mm = let final self::B #t3 = new self::B::•() in #t3.{self::B::a} = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:18:40: Error: A value of type 'dart.core::double' can't be assigned to a variable of type 'test::A'.
Try changing the type of the left hand side, or casting the right hand side to 'test::A'.
-var /*@topType=double*/ v_prefix_mm = (--new B(). /*@target=B::a*/ a);
+var v_prefix_mm = (--new B(). /*@target=B::a*/ a);
^" in #t3.{self::B::a}.{self::A::-}(1) as{TypeError} <BottomType>;
static field self::A v_postfix_pp = let final self::B #t5 = new self::B::•() in let final self::A #t6 = #t5.{self::B::a} in let final core::int #t7 = #t5.{self::B::a} = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:19:63: Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'test::A'.
Try changing the type of the left hand side, or casting the right hand side to 'test::A'.
-var /*@topType=A*/ v_postfix_pp = (new B(). /*@target=B::a*/ a++);
+var v_postfix_pp = (new B(). /*@target=B::a*/ a++);
^" in #t6.{self::A::+}(1) as{TypeError} <BottomType>in #t6;
static field self::A v_postfix_mm = let final self::B #t9 = new self::B::•() in let final self::A #t10 = #t9.{self::B::a} in let final core::double #t11 = #t9.{self::B::a} = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/inference_new/infer_assign_to_property_custom.dart:20:63: Error: A value of type 'dart.core::double' can't be assigned to a variable of type 'test::A'.
Try changing the type of the left hand side, or casting the right hand side to 'test::A'.
-var /*@topType=A*/ v_postfix_mm = (new B(). /*@target=B::a*/ a--);
+var v_postfix_mm = (new B(). /*@target=B::a*/ a--);
^" in #t10.{self::A::-}(1) as{TypeError} <BottomType>in #t10;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/infer_assign_to_ref.dart b/front_end/testcases/inference_new/infer_assign_to_ref.dart
index 4ddb4ed..3416a62 100644
--- a/front_end/testcases/inference_new/infer_assign_to_ref.dart
+++ b/front_end/testcases/inference_new/infer_assign_to_ref.dart
@@ -10,9 +10,9 @@
}
A a = new A();
-var /*@topType=int*/ b = (a. /*@target=A::f*/ f = 1);
-var /*@topType=int*/ c = 0;
-var /*@topType=int*/ d = (c = 1);
+var b = (a. /*@target=A::f*/ f = 1);
+var c = 0;
+var d = (c = 1);
main() {
a;
diff --git a/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart b/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart
index bec35e1..33c324d 100644
--- a/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart
+++ b/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart
@@ -13,7 +13,7 @@
// Type inference should fail here since the getter and setter for x don't
// match.
class B extends A {
- var /*@topType=int*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect b/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
index d33cc4c..9a78098 100644
--- a/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
+++ b/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
@@ -2,10 +2,10 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart:16:24: Error: The return type of the method 'B.x' is 'int', which does not match the return type, 'double', of the overridden method, 'A.x'.
+// pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart:16:7: Error: The return type of the method 'B.x' is 'int', which does not match the return type, 'double', of the overridden method, 'A.x'.
// Change to a subtype of 'double'.
-// var /*@topType=int*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart:10:12: Context: This is the overridden method ('x').
// void set x(double value);
// ^
diff --git a/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart b/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart
index 4b47931..7ebfa01 100644
--- a/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart
+++ b/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart
@@ -16,7 +16,7 @@
// The getter in B doesn't screen the setter in A, so inference sees two
// different types and gives an error.
class C extends B {
- var /*@topType=int*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect b/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
index 9e226c5..83026ec 100644
--- a/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
+++ b/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
@@ -2,10 +2,10 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart:19:24: Error: The return type of the method 'C.x' is 'int', which does not match the return type, 'num', of the overridden method, 'A.x'.
+// pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart:19:7: Error: The return type of the method 'C.x' is 'int', which does not match the return type, 'num', of the overridden method, 'A.x'.
// Change to a subtype of 'num'.
-// var /*@topType=int*/ x;
-// ^
+// var x;
+// ^
// pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart:9:12: Context: This is the overridden method ('x').
// void set x(num value);
// ^
diff --git a/front_end/testcases/inference_new/infer_field_override_setter_overrides_getter.dart b/front_end/testcases/inference_new/infer_field_override_setter_overrides_getter.dart
index 182b452..8e774ec 100644
--- a/front_end/testcases/inference_new/infer_field_override_setter_overrides_getter.dart
+++ b/front_end/testcases/inference_new/infer_field_override_setter_overrides_getter.dart
@@ -16,7 +16,7 @@
// The getter in B doesn't screen the setter in A, so inference sees two
// different types and gives an error.
class C extends B {
- var /*@topType=num*/ x;
+ var x;
}
main() {}
diff --git a/front_end/testcases/inference_new/infer_instance_accessor_ref.dart b/front_end/testcases/inference_new/infer_instance_accessor_ref.dart
index 9abb415..fd98fc2 100644
--- a/front_end/testcases/inference_new/infer_instance_accessor_ref.dart
+++ b/front_end/testcases/inference_new/infer_instance_accessor_ref.dart
@@ -18,8 +18,8 @@
class D extends C {}
-var /*@topType=A*/ a = new A();
-var /*@topType=C*/ x = a. /*@target=A::b*/ b. /*@target=B::c*/ c;
-var /*@topType=C*/ y = a. /*@target=A::b*/ b. /*@target=B::c*/ c ??= new D();
+var a = new A();
+var x = a. /*@target=A::b*/ b. /*@target=B::c*/ c;
+var y = a. /*@target=A::b*/ b. /*@target=B::c*/ c ??= new D();
main() {}
diff --git a/front_end/testcases/inference_new/infer_instance_field_ref.dart b/front_end/testcases/inference_new/infer_instance_field_ref.dart
index 192a93b..e649aab 100644
--- a/front_end/testcases/inference_new/infer_instance_field_ref.dart
+++ b/front_end/testcases/inference_new/infer_instance_field_ref.dart
@@ -17,8 +17,8 @@
class D extends C {}
-var /*@topType=A*/ a = new A();
-var /*@topType=C*/ x = a. /*@target=A::b*/ b. /*@target=B::c*/ c;
-var /*@topType=C*/ y = a. /*@target=A::b*/ b. /*@target=B::c*/ c ??= new D();
+var a = new A();
+var x = a. /*@target=A::b*/ b. /*@target=B::c*/ c;
+var y = a. /*@target=A::b*/ b. /*@target=B::c*/ c ??= new D();
main() {}
diff --git a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
index 888321e..9ffd8ea 100644
--- a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
+++ b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
@@ -2,21 +2,18 @@
// 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,error*/
+/*@testedFeatures=inference*/
library test;
// In the code below, there is a circularity between A.b and x.
class A {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
- x;
- var /*@topType=() -> dynamic*/ c = /*@returnType=dynamic*/ () => x;
+ var b = /*@returnType=invalid-type*/ () => x;
+ var c = /*@returnType=invalid-type*/ () => x;
}
-var /*@topType=A*/ a = new A();
-var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
- a. /*@target=A::b*/ b;
-var /*@topType=() -> () -> dynamic*/ y = /*@returnType=() -> dynamic*/ () =>
- a. /*@target=A::c*/ c;
+var a = new A();
+var x = /*@returnType=invalid-type*/ () => a. /*@target=A::b*/ b;
+var y = /*@returnType=() -> invalid-type*/ () => a. /*@target=A::c*/ c;
main() {}
diff --git a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
index c125a14..46baf2b 100644
--- a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
+++ b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:11:7: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
-// ^
+// var b = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:16:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => a. /*@target=A::b*/ b;
+// ^
//
import self as self;
import "dart:core" as core;
class A extends core::Object {
- field dynamic b = () → dynamic => self::x;
- field () → dynamic c = () → dynamic => self::x;
+ field invalid-type b = (() → invalid-type => self::x) as{TypeError} invalid-type;
+ field () → invalid-type c = () → invalid-type => self::x;
synthetic constructor •() → self::A
: super core::Object::•()
;
}
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 field invalid-type x = (() → invalid-type => self::a.{self::A::b}) as{TypeError} invalid-type;
+static field () → () → invalid-type y = () → () → invalid-type => self::a.{self::A::c};
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.transformed.expect b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.transformed.expect
index c125a14..46baf2b 100644
--- a/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.transformed.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:11:7: Error: Can't infer the type of 'b': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
-// ^
+// var b = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:16:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => a. /*@target=A::b*/ b;
+// ^
//
import self as self;
import "dart:core" as core;
class A extends core::Object {
- field dynamic b = () → dynamic => self::x;
- field () → dynamic c = () → dynamic => self::x;
+ field invalid-type b = (() → invalid-type => self::x) as{TypeError} invalid-type;
+ field () → invalid-type c = () → invalid-type => self::x;
synthetic constructor •() → self::A
: super core::Object::•()
;
}
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 field invalid-type x = (() → invalid-type => self::a.{self::A::b}) as{TypeError} invalid-type;
+static field () → () → invalid-type y = () → () → invalid-type => self::a.{self::A::c};
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/infer_logical.dart b/front_end/testcases/inference_new/infer_logical.dart
index 4989c2a..5cf7f8a 100644
--- a/front_end/testcases/inference_new/infer_logical.dart
+++ b/front_end/testcases/inference_new/infer_logical.dart
@@ -7,8 +7,8 @@
T f<T>() => null;
-var /*@topType=bool*/ x = /*@typeArgs=bool*/ f() || /*@typeArgs=bool*/ f();
-var /*@topType=bool*/ y = /*@typeArgs=bool*/ f() && /*@typeArgs=bool*/ f();
+var x = /*@typeArgs=bool*/ f() || /*@typeArgs=bool*/ f();
+var y = /*@typeArgs=bool*/ f() && /*@typeArgs=bool*/ f();
void test() {
var /*@type=bool*/ x = /*@typeArgs=bool*/ f() || /*@typeArgs=bool*/ f();
diff --git a/front_end/testcases/inference_new/infer_use_of_void.dart b/front_end/testcases/inference_new/infer_use_of_void.dart
index a713ece..a90fa93 100644
--- a/front_end/testcases/inference_new/infer_use_of_void.dart
+++ b/front_end/testcases/inference_new/infer_use_of_void.dart
@@ -10,11 +10,10 @@
}
class C extends B {
- /*@topType=void*/ f() {}
+ f() {}
}
-var /*@topType=void*/ x =
- new C(). /*info:USE_OF_VOID_RESULT*/ /*@target=C::f*/ f();
+var x = new C(). /*info:USE_OF_VOID_RESULT*/ /*@target=C::f*/ f();
main() {
x;
diff --git a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart
index 07bb7f4..6b14c21 100644
--- a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart
+++ b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart
@@ -2,10 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=error,inference*/
+/*@testedFeatures=inference*/
int i;
String s;
-var /*@topType=String*/ x = i = /*@error=InvalidAssignment*/ s;
+var x = i = s;
main() {}
diff --git a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.expect b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.expect
index 28a9284..5768908 100644
--- a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.expect
+++ b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.expect
@@ -2,18 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart:9:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart:9:13: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// var /*@topType=String*/ x = i = /*@error=InvalidAssignment*/ s;
-// ^
+// var x = i = s;
+// ^
//
import self as self;
import "dart:core" as core;
static field core::int i;
static field core::String s;
-static field core::String x = self::i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart:9:62: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+static field core::String x = self::i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart:9:13: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
-var /*@topType=String*/ x = i = /*@error=InvalidAssignment*/ s;
- ^" in self::s as{TypeError} core::int;
+var x = i = s;
+ ^" in self::s as{TypeError} core::int;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.transformed.expect b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.transformed.expect
index 90592a6..4b4d6da 100644
--- a/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart.strong.transformed.expect
@@ -6,6 +6,6 @@
static field core::String s;
static field core::String x = self::i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference_new/invalid_assignment_during_toplevel_inference.dart:9:62: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
-var /*@topType=String*/ x = i = /*@error=InvalidAssignment*/ s;
+var x = i = /*@error=InvalidAssignment*/ s;
^" in self::s as{TypeError} <BottomType>;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/list_literals_can_infer_null_top_level.dart b/front_end/testcases/inference_new/list_literals_can_infer_null_top_level.dart
index 3a9a4bb..1045584 100644
--- a/front_end/testcases/inference_new/list_literals_can_infer_null_top_level.dart
+++ b/front_end/testcases/inference_new/list_literals_can_infer_null_top_level.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=List<Null>*/ x = /*@typeArgs=Null*/ [null];
+var x = /*@typeArgs=Null*/ [null];
main() {
x;
diff --git a/front_end/testcases/inference_new/map_literals_can_infer_null_top_level.dart b/front_end/testcases/inference_new/map_literals_can_infer_null_top_level.dart
index 6b5dccd..04c633b 100644
--- a/front_end/testcases/inference_new/map_literals_can_infer_null_top_level.dart
+++ b/front_end/testcases/inference_new/map_literals_can_infer_null_top_level.dart
@@ -5,7 +5,7 @@
/*@testedFeatures=inference*/
library test;
-var /*@topType=Map<Null, Null>*/ x = /*@typeArgs=Null, Null*/ {null: null};
+var x = /*@typeArgs=Null, Null*/ {null: null};
main() {
x;
diff --git a/front_end/testcases/inference_new/property_get_toplevel.dart b/front_end/testcases/inference_new/property_get_toplevel.dart
index 449ec76..e0201da 100644
--- a/front_end/testcases/inference_new/property_get_toplevel.dart
+++ b/front_end/testcases/inference_new/property_get_toplevel.dart
@@ -12,16 +12,12 @@
}
C c = new C();
-var /*@topType=int*/ field_ref = c. /*@target=C::field*/ field;
-var /*@topType=int*/ getter_ref = c. /*@target=C::getter*/ getter;
-var /*@topType=() -> int*/ function_ref = c. /*@target=C::function*/ function;
-var /*@topType=List<int>*/ field_ref_list = /*@typeArgs=int*/ [
- c. /*@target=C::field*/ field
-];
-var /*@topType=List<int>*/ getter_ref_list = /*@typeArgs=int*/ [
- c. /*@target=C::getter*/ getter
-];
-var /*@topType=List<() -> int>*/ function_ref_list = /*@typeArgs=() -> int*/ [
+var field_ref = c. /*@target=C::field*/ field;
+var getter_ref = c. /*@target=C::getter*/ getter;
+var function_ref = c. /*@target=C::function*/ function;
+var field_ref_list = /*@typeArgs=int*/ [c. /*@target=C::field*/ field];
+var getter_ref_list = /*@typeArgs=int*/ [c. /*@target=C::getter*/ getter];
+var function_ref_list = /*@typeArgs=() -> int*/ [
c. /*@target=C::function*/ function
];
diff --git a/front_end/testcases/inference_new/strongly_connected_component.dart b/front_end/testcases/inference_new/strongly_connected_component.dart
index 0589e0a..788e92f 100644
--- a/front_end/testcases/inference_new/strongly_connected_component.dart
+++ b/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,error*/
+/*@testedFeatures=inference*/
library test;
bool f() => null;
@@ -14,10 +14,8 @@
// circularity, and for error recovery their type is set to `dynamic`.
// Thereafter, z infers without problems.
-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;
+var x = /*@returnType=invalid-type*/ () => f() ? y : z;
+var y = /*@returnType=invalid-type*/ () => x;
+var z = /*@returnType=invalid-type*/ () => x;
main() {}
diff --git a/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect b/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
index 6f86a2f..88bfdb0 100644
--- a/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
+++ b/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// 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.
+// pkg/front_end/testcases/inference_new/strongly_connected_component.dart:18:5: Error: Can't infer the type of 'y': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
-// ^
+// var y = /*@returnType=invalid-type*/ () => x;
+// ^
//
-// 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.
+// pkg/front_end/testcases/inference_new/strongly_connected_component.dart:17:5: Error: Can't infer the type of 'x': circularity found during type inference.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
-// ^
+// var x = /*@returnType=invalid-type*/ () => f() ? y : z;
+// ^
//
import self as self;
import "dart:core" as core;
-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 field invalid-type x = (() → invalid-type => self::f() ?{invalid-type} self::y : self::z) as{TypeError} invalid-type;
+static field invalid-type y = (() → invalid-type => self::x) as{TypeError} invalid-type;
+static field () → dynamic z = () → invalid-type => self::x;
static method f() → core::bool
return null;
static method main() → dynamic {}
diff --git a/front_end/testcases/inference_new/strongly_connected_component.dart.strong.transformed.expect b/front_end/testcases/inference_new/strongly_connected_component.dart.strong.transformed.expect
index 6f86a2f..9a54331 100644
--- a/front_end/testcases/inference_new/strongly_connected_component.dart.strong.transformed.expect
+++ b/front_end/testcases/inference_new/strongly_connected_component.dart.strong.transformed.expect
@@ -4,12 +4,12 @@
//
// 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.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+// var /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
// ^
//
// 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.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+// var /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
// ^
//
import self as self;
diff --git a/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.expect b/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.expect
index b5345da..0f54c8d 100644
--- a/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.expect
+++ b/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator [](self::E<self::B::T> x) → self::D<self::B::T>
+ operator [](generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.transformed.expect b/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.transformed.expect
index b5345da..0f54c8d 100644
--- a/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/inference_new/super_index_get_substitution.dart.legacy.transformed.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator [](self::E<self::B::T> x) → self::D<self::B::T>
+ operator [](generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference_new/super_index_get_substitution.dart.outline.expect b/front_end/testcases/inference_new/super_index_get_substitution.dart.outline.expect
index 44d6487..12ca495 100644
--- a/front_end/testcases/inference_new/super_index_get_substitution.dart.outline.expect
+++ b/front_end/testcases/inference_new/super_index_get_substitution.dart.outline.expect
@@ -16,7 +16,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- operator [](self::E<self::B::T> x) → self::D<self::B::T>
+ operator [](generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/front_end/testcases/inference_new/top_level_field_depends_on_multiple_inheritance.dart b/front_end/testcases/inference_new/top_level_field_depends_on_multiple_inheritance.dart
index b0382f2..d687e58 100644
--- a/front_end/testcases/inference_new/top_level_field_depends_on_multiple_inheritance.dart
+++ b/front_end/testcases/inference_new/top_level_field_depends_on_multiple_inheritance.dart
@@ -37,6 +37,6 @@
// bar().foo resolves to G::foo, which is inherited from E::foo, so its return
// type is B. Note that the target is annotated as G::foo, since that is the
// forwarding stub.
-var /*@topType=B*/ x = bar(). /*@target=G::foo*/ foo();
+var x = bar(). /*@target=G::foo*/ foo();
main() {}
diff --git a/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart b/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
index 54b5f61..937495a 100644
--- a/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
+++ b/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2.dart
@@ -6,7 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=List<int>*/ v = (f) /*@typeArgs=int*/ (/*@returnType=int*/ () {
+var v = (f) /*@typeArgs=int*/ (/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart b/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
index 54b5f61..937495a 100644
--- a/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
+++ b/front_end/testcases/inference_new/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2.dart
@@ -6,7 +6,7 @@
library test;
List<T> f<T>(T g()) => <T>[g()];
-var /*@topType=List<int>*/ v = (f) /*@typeArgs=int*/ (/*@returnType=int*/ () {
+var v = (f) /*@typeArgs=int*/ (/*@returnType=int*/ () {
return 1;
});
diff --git a/front_end/testcases/inference_new/void_return_type_subtypes_dynamic.dart b/front_end/testcases/inference_new/void_return_type_subtypes_dynamic.dart
index 0567c06..69ae7ee 100644
--- a/front_end/testcases/inference_new/void_return_type_subtypes_dynamic.dart
+++ b/front_end/testcases/inference_new/void_return_type_subtypes_dynamic.dart
@@ -16,7 +16,6 @@
print("running");
}
-var /*@topType=void*/ y = /*info:USE_OF_VOID_RESULT*/ /*@typeArgs=void*/ run(
- printRunning);
+var y = /*info:USE_OF_VOID_RESULT*/ /*@typeArgs=void*/ run(printRunning);
main() {}
diff --git a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.expect b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.expect
index 34e8860..aa682e0 100644
--- a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.expect
+++ b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./non_simple_many_libs_same_name_cycle_lib.dart" as non;
+import "non_simple_many_libs_same_name_cycle_lib.dart" as non;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle_lib.dart" as lib;
@@ -14,7 +14,7 @@
library non_simple_many_libs_same_name_cycle_lib;
import self as non;
-import "./non_simple_many_libs_same_name_cycle.dart" as self;
+import "non_simple_many_libs_same_name_cycle.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle.dart" as lib;
diff --git a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.transformed.expect b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.transformed.expect
index 34e8860..aa682e0 100644
--- a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.transformed.expect
+++ b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./non_simple_many_libs_same_name_cycle_lib.dart" as non;
+import "non_simple_many_libs_same_name_cycle_lib.dart" as non;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle_lib.dart" as lib;
@@ -14,7 +14,7 @@
library non_simple_many_libs_same_name_cycle_lib;
import self as non;
-import "./non_simple_many_libs_same_name_cycle.dart" as self;
+import "non_simple_many_libs_same_name_cycle.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle.dart" as lib;
diff --git a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.outline.expect b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.outline.expect
index 63b417d..8b8c4bb 100644
--- a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.outline.expect
+++ b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.outline.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./non_simple_many_libs_same_name_cycle_lib.dart" as non;
+import "non_simple_many_libs_same_name_cycle_lib.dart" as non;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle_lib.dart" as lib;
@@ -14,7 +14,7 @@
library non_simple_many_libs_same_name_cycle_lib;
import self as non;
-import "./non_simple_many_libs_same_name_cycle.dart" as self;
+import "non_simple_many_libs_same_name_cycle.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle.dart" as lib;
diff --git a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.expect b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.expect
index aa390f4..5ed003d 100644
--- a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.expect
+++ b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.expect
@@ -27,7 +27,7 @@
library non_simple_many_libs_same_name_cycle_lib;
import self as self2;
-import "./non_simple_many_libs_same_name_cycle.dart" as self;
+import "non_simple_many_libs_same_name_cycle.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle.dart" as lib;
diff --git a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.transformed.expect b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.transformed.expect
index aa390f4..5ed003d 100644
--- a/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.transformed.expect
+++ b/front_end/testcases/instantiate_to_bound/non_simple_many_libs_same_name_cycle.dart.strong.transformed.expect
@@ -27,7 +27,7 @@
library non_simple_many_libs_same_name_cycle_lib;
import self as self2;
-import "./non_simple_many_libs_same_name_cycle.dart" as self;
+import "non_simple_many_libs_same_name_cycle.dart" as self;
import "dart:core" as core;
import "org-dartlang-testcase:///non_simple_many_libs_same_name_cycle.dart" as lib;
diff --git a/front_end/testcases/invalid_assignment.dart b/front_end/testcases/invalid_assignment.dart
index 346a87a..0c76ccc 100644
--- a/front_end/testcases/invalid_assignment.dart
+++ b/front_end/testcases/invalid_assignment.dart
@@ -2,19 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=error*/
-
class A {
String operator +(int i) => '';
}
test(int i, String s, A a) {
i = 1;
- i = /*@error=InvalidAssignment*/ s;
+ i = s;
i ??= 1;
- i ??= /*@error=InvalidAssignment*/ s;
+ i ??= s;
a = new A();
- a /*@error=InvalidAssignment*/ += 1;
+ a += 1;
}
main() {}
diff --git a/front_end/testcases/invalid_assignment.dart.strong.expect b/front_end/testcases/invalid_assignment.dart.strong.expect
index c15f6aa..32d40ad 100644
--- a/front_end/testcases/invalid_assignment.dart.strong.expect
+++ b/front_end/testcases/invalid_assignment.dart.strong.expect
@@ -2,21 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/invalid_assignment.dart:13:36: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/invalid_assignment.dart:11:7: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// i = /*@error=InvalidAssignment*/ s;
-// ^
+// i = s;
+// ^
//
-// pkg/front_end/testcases/invalid_assignment.dart:15:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/invalid_assignment.dart:13:9: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// i ??= /*@error=InvalidAssignment*/ s;
-// ^
+// i ??= s;
+// ^
//
-// pkg/front_end/testcases/invalid_assignment.dart:17:34: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/invalid_assignment.dart:15:5: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/invalid_assignment.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// a /*@error=InvalidAssignment*/ += 1;
-// ^
+// a += 1;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -30,20 +30,20 @@
}
static method test(core::int i, core::String s, self::A a) → dynamic {
i = 1;
- i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:13:36: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:11:7: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- i = /*@error=InvalidAssignment*/ s;
- ^" in s as{TypeError} core::int;
+ i = s;
+ ^" in s as{TypeError} core::int;
i.{core::num::==}(null) ?{core::int} i = 1 : null;
- i.{core::num::==}(null) ?{core::Object} i = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:15:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i.{core::num::==}(null) ?{core::Object} i = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:13:9: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- i ??= /*@error=InvalidAssignment*/ s;
- ^" in s as{TypeError} core::int : null;
+ i ??= s;
+ ^" in s as{TypeError} core::int : null;
a = new self::A::•();
- a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:17:34: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+ a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:15:5: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/invalid_assignment.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
- a /*@error=InvalidAssignment*/ += 1;
- ^" in a.{self::A::+}(1) as{TypeError} self::A;
+ a += 1;
+ ^" in a.{self::A::+}(1) as{TypeError} self::A;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/invalid_assignment.dart.strong.transformed.expect b/front_end/testcases/invalid_assignment.dart.strong.transformed.expect
index c15f6aa..32d40ad 100644
--- a/front_end/testcases/invalid_assignment.dart.strong.transformed.expect
+++ b/front_end/testcases/invalid_assignment.dart.strong.transformed.expect
@@ -2,21 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/invalid_assignment.dart:13:36: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/invalid_assignment.dart:11:7: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// i = /*@error=InvalidAssignment*/ s;
-// ^
+// i = s;
+// ^
//
-// pkg/front_end/testcases/invalid_assignment.dart:15:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/invalid_assignment.dart:13:9: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// i ??= /*@error=InvalidAssignment*/ s;
-// ^
+// i ??= s;
+// ^
//
-// pkg/front_end/testcases/invalid_assignment.dart:17:34: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+// pkg/front_end/testcases/invalid_assignment.dart:15:5: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
// - 'A' is from 'pkg/front_end/testcases/invalid_assignment.dart'.
// Try changing the type of the left hand side, or casting the right hand side to 'A'.
-// a /*@error=InvalidAssignment*/ += 1;
-// ^
+// a += 1;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -30,20 +30,20 @@
}
static method test(core::int i, core::String s, self::A a) → dynamic {
i = 1;
- i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:13:36: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:11:7: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- i = /*@error=InvalidAssignment*/ s;
- ^" in s as{TypeError} core::int;
+ i = s;
+ ^" in s as{TypeError} core::int;
i.{core::num::==}(null) ?{core::int} i = 1 : null;
- i.{core::num::==}(null) ?{core::Object} i = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:15:38: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
+ i.{core::num::==}(null) ?{core::Object} i = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:13:9: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- i ??= /*@error=InvalidAssignment*/ s;
- ^" in s as{TypeError} core::int : null;
+ i ??= s;
+ ^" in s as{TypeError} core::int : null;
a = new self::A::•();
- a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:17:34: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
+ a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:15:5: Error: A value of type 'String' can't be assigned to a variable of type 'A'.
- 'A' is from 'pkg/front_end/testcases/invalid_assignment.dart'.
Try changing the type of the left hand side, or casting the right hand side to 'A'.
- a /*@error=InvalidAssignment*/ += 1;
- ^" in a.{self::A::+}(1) as{TypeError} self::A;
+ a += 1;
+ ^" in a.{self::A::+}(1) as{TypeError} self::A;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/invalid_assignment.dart.type_promotion.expect b/front_end/testcases/invalid_assignment.dart.type_promotion.expect
index abff5c0..a7b9f5a 100644
--- a/front_end/testcases/invalid_assignment.dart.type_promotion.expect
+++ b/front_end/testcases/invalid_assignment.dart.type_promotion.expect
@@ -1,18 +1,18 @@
-pkg/front_end/testcases/invalid_assignment.dart:12:5: Context: Write to i@300
+pkg/front_end/testcases/invalid_assignment.dart:10:5: Context: Write to i@273
i = 1;
^
-pkg/front_end/testcases/invalid_assignment.dart:13:5: Context: Write to i@300
- i = /*@error=InvalidAssignment*/ s;
+pkg/front_end/testcases/invalid_assignment.dart:11:5: Context: Write to i@273
+ i = s;
^
-pkg/front_end/testcases/invalid_assignment.dart:14:5: Context: Write to i@300
+pkg/front_end/testcases/invalid_assignment.dart:12:5: Context: Write to i@273
i ??= 1;
^^^
-pkg/front_end/testcases/invalid_assignment.dart:15:5: Context: Write to i@300
- i ??= /*@error=InvalidAssignment*/ s;
+pkg/front_end/testcases/invalid_assignment.dart:13:5: Context: Write to i@273
+ i ??= s;
^^^
-pkg/front_end/testcases/invalid_assignment.dart:16:5: Context: Write to a@315
+pkg/front_end/testcases/invalid_assignment.dart:14:5: Context: Write to a@288
a = new A();
^
-pkg/front_end/testcases/invalid_assignment.dart:17:34: Context: Write to a@315
- a /*@error=InvalidAssignment*/ += 1;
- ^^
+pkg/front_end/testcases/invalid_assignment.dart:15:5: Context: Write to a@288
+ a += 1;
+ ^^
diff --git a/front_end/testcases/invalid_cast.dart b/front_end/testcases/invalid_cast.dart
index 9baaf86..105b26b 100644
--- a/front_end/testcases/invalid_cast.dart
+++ b/front_end/testcases/invalid_cast.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.
-/*@testedFeatures=error*/
-
class C {
C();
factory C.fact() => null;
@@ -19,19 +17,17 @@
bad() {
void localFunction(int i) {}
- List<int> a = <Object> /*@error=InvalidCastLiteralList*/ [];
- Map<int, String> b = <Object, String> /*@error=InvalidCastLiteralMap*/ {};
- Map<int, String> c = <int, Object> /*@error=InvalidCastLiteralMap*/ {};
- int Function(Object) d = /*@error=InvalidCastFunctionExpr*/ (int i) => i;
+ List<int> a = <Object>[];
+ Map<int, String> b = <Object, String>{};
+ Map<int, String> c = <int, Object>{};
+ int Function(Object) d = (int i) => i;
D e = new C.fact();
D f = new C.fact2();
- D g = new /*@error=InvalidCastNewExpr*/ C.nonFact();
- D h = new /*@error=InvalidCastNewExpr*/ C.nonFact2();
- void Function(Object) i =
- C. /*@error=InvalidCastStaticMethod*/ staticFunction;
- void Function(Object)
- j = /*@error=InvalidCastTopLevelFunction*/ topLevelFunction;
- void Function(Object) k = /*@error=InvalidCastLocalFunction*/ localFunction;
+ D g = new C.nonFact();
+ D h = new C.nonFact2();
+ void Function(Object) i = C.staticFunction;
+ void Function(Object) j = topLevelFunction;
+ void Function(Object) k = localFunction;
}
ok() {
diff --git a/front_end/testcases/invalid_cast.dart.strong.expect b/front_end/testcases/invalid_cast.dart.strong.expect
index 254485f..f9329e5 100644
--- a/front_end/testcases/invalid_cast.dart.strong.expect
+++ b/front_end/testcases/invalid_cast.dart.strong.expect
@@ -2,64 +2,64 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/invalid_cast.dart:22:60: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
+// pkg/front_end/testcases/invalid_cast.dart:20:25: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
// - 'List' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the list literal or the context in which it is used.
-// List<int> a = <Object> /*@error=InvalidCastLiteralList*/ [];
-// ^
+// List<int> a = <Object>[];
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:23:74: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
+// pkg/front_end/testcases/invalid_cast.dart:21:40: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
// - 'Map' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the map literal or the context in which it is used.
-// Map<int, String> b = <Object, String> /*@error=InvalidCastLiteralMap*/ {};
-// ^
+// Map<int, String> b = <Object, String>{};
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:24:71: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
+// pkg/front_end/testcases/invalid_cast.dart:22:37: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
// - 'Map' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the map literal or the context in which it is used.
-// Map<int, String> c = <int, Object> /*@error=InvalidCastLiteralMap*/ {};
-// ^
+// Map<int, String> c = <int, Object>{};
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:25:63: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:23:28: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function expression or the context in which it is used.
-// int Function(Object) d = /*@error=InvalidCastFunctionExpr*/ (int i) => i;
-// ^
+// int Function(Object) d = (int i) => i;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:28:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+// pkg/front_end/testcases/invalid_cast.dart:26:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
// - 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// - 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// Change the type of the object being constructed or the context in which it is used.
-// D g = new /*@error=InvalidCastNewExpr*/ C.nonFact();
-// ^
+// D g = new C.nonFact();
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:29:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+// pkg/front_end/testcases/invalid_cast.dart:27:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
// - 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// - 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// Change the type of the object being constructed or the context in which it is used.
-// D h = new /*@error=InvalidCastNewExpr*/ C.nonFact2();
-// ^
+// D h = new C.nonFact2();
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:31:45: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:28:31: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the method or the context in which it is used.
-// C. /*@error=InvalidCastStaticMethod*/ staticFunction;
-// ^
+// void Function(Object) i = C.staticFunction;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:33:50: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:29:29: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function or the context in which it is used.
-// j = /*@error=InvalidCastTopLevelFunction*/ topLevelFunction;
-// ^
+// void Function(Object) j = topLevelFunction;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:34:65: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:30:29: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function or the context in which it is used.
-// void Function(Object) k = /*@error=InvalidCastLocalFunction*/ localFunction;
-// ^
+// void Function(Object) k = localFunction;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -89,58 +89,58 @@
static method topLevelFunction(core::int i) → void {}
static method bad() → dynamic {
function localFunction(core::int i) → void {}
- core::List<core::int> a = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:22:60: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
+ core::List<core::int> a = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:20:25: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
- 'List' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the list literal or the context in which it is used.
- List<int> a = <Object> /*@error=InvalidCastLiteralList*/ [];
- ^" in <core::Object>[];
- core::Map<core::int, core::String> b = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:23:74: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
+ List<int> a = <Object>[];
+ ^" in <core::Object>[];
+ core::Map<core::int, core::String> b = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:21:40: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
- 'Map' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the map literal or the context in which it is used.
- Map<int, String> b = <Object, String> /*@error=InvalidCastLiteralMap*/ {};
- ^" in <core::Object, core::String>{};
- core::Map<core::int, core::String> c = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:24:71: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
+ Map<int, String> b = <Object, String>{};
+ ^" in <core::Object, core::String>{};
+ core::Map<core::int, core::String> c = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:22:37: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
- 'Map' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the map literal or the context in which it is used.
- Map<int, String> c = <int, Object> /*@error=InvalidCastLiteralMap*/ {};
- ^" in <core::int, core::Object>{};
- (core::Object) → core::int d = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:25:63: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
+ Map<int, String> c = <int, Object>{};
+ ^" in <core::int, core::Object>{};
+ (core::Object) → core::int d = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:23:28: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function expression or the context in which it is used.
- int Function(Object) d = /*@error=InvalidCastFunctionExpr*/ (int i) => i;
- ^" in (core::int i) → core::int => i;
+ int Function(Object) d = (int i) => i;
+ ^" in (core::int i) → core::int => i;
self::D e = self::C::fact() as{TypeError} self::D;
self::D f = new self::D::•() as{TypeError} self::D;
- self::D g = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:28:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+ self::D g = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:26:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
- 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
- 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
Change the type of the object being constructed or the context in which it is used.
- D g = new /*@error=InvalidCastNewExpr*/ C.nonFact();
- ^" in new self::C::nonFact();
- self::D h = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:29:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+ D g = new C.nonFact();
+ ^" in new self::C::nonFact();
+ self::D h = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:27:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
- 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
- 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
Change the type of the object being constructed or the context in which it is used.
- D h = new /*@error=InvalidCastNewExpr*/ C.nonFact2();
- ^" in new self::C::nonFact2();
- (core::Object) → void i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:31:45: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ D h = new C.nonFact2();
+ ^" in new self::C::nonFact2();
+ (core::Object) → void i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:28:31: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the method or the context in which it is used.
- C. /*@error=InvalidCastStaticMethod*/ staticFunction;
- ^" in self::C::staticFunction;
- (core::Object) → void j = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:33:50: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ void Function(Object) i = C.staticFunction;
+ ^" in self::C::staticFunction;
+ (core::Object) → void j = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:29:29: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function or the context in which it is used.
- j = /*@error=InvalidCastTopLevelFunction*/ topLevelFunction;
- ^" in self::topLevelFunction;
- (core::Object) → void k = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:34:65: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ void Function(Object) j = topLevelFunction;
+ ^" in self::topLevelFunction;
+ (core::Object) → void k = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:30:29: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function or the context in which it is used.
- void Function(Object) k = /*@error=InvalidCastLocalFunction*/ localFunction;
- ^" in localFunction;
+ void Function(Object) k = localFunction;
+ ^" in localFunction;
}
static method ok() → dynamic {
function localFunction(core::int i) → void {}
diff --git a/front_end/testcases/invalid_cast.dart.strong.transformed.expect b/front_end/testcases/invalid_cast.dart.strong.transformed.expect
index a04133c..6e9e1eb 100644
--- a/front_end/testcases/invalid_cast.dart.strong.transformed.expect
+++ b/front_end/testcases/invalid_cast.dart.strong.transformed.expect
@@ -2,64 +2,64 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/invalid_cast.dart:22:60: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
+// pkg/front_end/testcases/invalid_cast.dart:20:25: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
// - 'List' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the list literal or the context in which it is used.
-// List<int> a = <Object> /*@error=InvalidCastLiteralList*/ [];
-// ^
+// List<int> a = <Object>[];
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:23:74: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
+// pkg/front_end/testcases/invalid_cast.dart:21:40: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
// - 'Map' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the map literal or the context in which it is used.
-// Map<int, String> b = <Object, String> /*@error=InvalidCastLiteralMap*/ {};
-// ^
+// Map<int, String> b = <Object, String>{};
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:24:71: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
+// pkg/front_end/testcases/invalid_cast.dart:22:37: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
// - 'Map' is from 'dart:core'.
// - 'Object' is from 'dart:core'.
// Change the type of the map literal or the context in which it is used.
-// Map<int, String> c = <int, Object> /*@error=InvalidCastLiteralMap*/ {};
-// ^
+// Map<int, String> c = <int, Object>{};
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:25:63: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:23:28: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function expression or the context in which it is used.
-// int Function(Object) d = /*@error=InvalidCastFunctionExpr*/ (int i) => i;
-// ^
+// int Function(Object) d = (int i) => i;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:28:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+// pkg/front_end/testcases/invalid_cast.dart:26:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
// - 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// - 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// Change the type of the object being constructed or the context in which it is used.
-// D g = new /*@error=InvalidCastNewExpr*/ C.nonFact();
-// ^
+// D g = new C.nonFact();
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:29:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+// pkg/front_end/testcases/invalid_cast.dart:27:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
// - 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// - 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
// Change the type of the object being constructed or the context in which it is used.
-// D h = new /*@error=InvalidCastNewExpr*/ C.nonFact2();
-// ^
+// D h = new C.nonFact2();
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:31:45: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:28:31: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the method or the context in which it is used.
-// C. /*@error=InvalidCastStaticMethod*/ staticFunction;
-// ^
+// void Function(Object) i = C.staticFunction;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:33:50: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:29:29: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function or the context in which it is used.
-// j = /*@error=InvalidCastTopLevelFunction*/ topLevelFunction;
-// ^
+// void Function(Object) j = topLevelFunction;
+// ^
//
-// pkg/front_end/testcases/invalid_cast.dart:34:65: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+// pkg/front_end/testcases/invalid_cast.dart:30:29: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
// - 'Object' is from 'dart:core'.
// Change the type of the function or the context in which it is used.
-// void Function(Object) k = /*@error=InvalidCastLocalFunction*/ localFunction;
-// ^
+// void Function(Object) k = localFunction;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -89,58 +89,58 @@
static method topLevelFunction(core::int i) → void {}
static method bad() → dynamic {
function localFunction(core::int i) → void {}
- core::List<core::int> a = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:22:60: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
+ core::List<core::int> a = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:20:25: Error: The list literal type 'List<Object>' isn't of expected type 'List<int>'.
- 'List' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the list literal or the context in which it is used.
- List<int> a = <Object> /*@error=InvalidCastLiteralList*/ [];
- ^" in <core::Object>[];
- core::Map<core::int, core::String> b = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:23:74: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
+ List<int> a = <Object>[];
+ ^" in <core::Object>[];
+ core::Map<core::int, core::String> b = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:21:40: Error: The map literal type 'Map<Object, String>' isn't of expected type 'Map<int, String>'.
- 'Map' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the map literal or the context in which it is used.
- Map<int, String> b = <Object, String> /*@error=InvalidCastLiteralMap*/ {};
- ^" in <core::Object, core::String>{};
- core::Map<core::int, core::String> c = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:24:71: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
+ Map<int, String> b = <Object, String>{};
+ ^" in <core::Object, core::String>{};
+ core::Map<core::int, core::String> c = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:22:37: Error: The map literal type 'Map<int, Object>' isn't of expected type 'Map<int, String>'.
- 'Map' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change the type of the map literal or the context in which it is used.
- Map<int, String> c = <int, Object> /*@error=InvalidCastLiteralMap*/ {};
- ^" in <core::int, core::Object>{};
- (core::Object) → core::int d = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:25:63: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
+ Map<int, String> c = <int, Object>{};
+ ^" in <core::int, core::Object>{};
+ (core::Object) → core::int d = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:23:28: Error: The function expression type 'int Function(int)' isn't of expected type 'int Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function expression or the context in which it is used.
- int Function(Object) d = /*@error=InvalidCastFunctionExpr*/ (int i) => i;
- ^" in (core::int i) → core::int => i;
+ int Function(Object) d = (int i) => i;
+ ^" in (core::int i) → core::int => i;
self::D e = self::C::fact() as{TypeError} self::D;
self::D f = new self::D::•() as{TypeError} self::D;
- self::D g = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:28:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+ self::D g = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:26:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
- 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
- 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
Change the type of the object being constructed or the context in which it is used.
- D g = new /*@error=InvalidCastNewExpr*/ C.nonFact();
- ^" in new self::C::nonFact();
- self::D h = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:29:43: Error: The constructor returns type 'C' that isn't of expected type 'D'.
+ D g = new C.nonFact();
+ ^" in new self::C::nonFact();
+ self::D h = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:27:13: Error: The constructor returns type 'C' that isn't of expected type 'D'.
- 'C' is from 'pkg/front_end/testcases/invalid_cast.dart'.
- 'D' is from 'pkg/front_end/testcases/invalid_cast.dart'.
Change the type of the object being constructed or the context in which it is used.
- D h = new /*@error=InvalidCastNewExpr*/ C.nonFact2();
- ^" in new self::C::nonFact2();
- (core::Object) → void i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:31:45: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ D h = new C.nonFact2();
+ ^" in new self::C::nonFact2();
+ (core::Object) → void i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:28:31: Error: The static method has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the method or the context in which it is used.
- C. /*@error=InvalidCastStaticMethod*/ staticFunction;
- ^" in self::C::staticFunction;
- (core::Object) → void j = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:33:50: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ void Function(Object) i = C.staticFunction;
+ ^" in self::C::staticFunction;
+ (core::Object) → void j = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:29:29: Error: The top level function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function or the context in which it is used.
- j = /*@error=InvalidCastTopLevelFunction*/ topLevelFunction;
- ^" in self::topLevelFunction;
- (core::Object) → void k = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:34:65: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
+ void Function(Object) j = topLevelFunction;
+ ^" in self::topLevelFunction;
+ (core::Object) → void k = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/invalid_cast.dart:30:29: Error: The local function has type 'void Function(int)' that isn't of expected type 'void Function(Object)'.
- 'Object' is from 'dart:core'.
Change the type of the function or the context in which it is used.
- void Function(Object) k = /*@error=InvalidCastLocalFunction*/ localFunction;
- ^" in localFunction;
+ void Function(Object) k = localFunction;
+ ^" in localFunction;
}
static method ok() → dynamic {
function localFunction(core::int i) → void {}
diff --git a/front_end/testcases/issue34899.dart.legacy.expect b/front_end/testcases/issue34899.dart.legacy.expect
index 41128df..e7b5b76 100644
--- a/front_end/testcases/issue34899.dart.legacy.expect
+++ b/front_end/testcases/issue34899.dart.legacy.expect
@@ -5,7 +5,7 @@
class Foo<T extends core::Object = dynamic> extends core::Object {
final field () → asy::Future<dynamic> quux;
- field self::Foo::T t;
+ generic-covariant-impl field self::Foo::T t;
constructor •(() → asy::Future<dynamic> quux, self::Foo::T t) → self::Foo<self::Foo::T>
: self::Foo::quux = quux, self::Foo::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/issue34899.dart.legacy.transformed.expect b/front_end/testcases/issue34899.dart.legacy.transformed.expect
index 41128df..e7b5b76 100644
--- a/front_end/testcases/issue34899.dart.legacy.transformed.expect
+++ b/front_end/testcases/issue34899.dart.legacy.transformed.expect
@@ -5,7 +5,7 @@
class Foo<T extends core::Object = dynamic> extends core::Object {
final field () → asy::Future<dynamic> quux;
- field self::Foo::T t;
+ generic-covariant-impl field self::Foo::T t;
constructor •(() → asy::Future<dynamic> quux, self::Foo::T t) → self::Foo<self::Foo::T>
: self::Foo::quux = quux, self::Foo::t = t, super core::Object::•()
;
diff --git a/front_end/testcases/issue34899.dart.outline.expect b/front_end/testcases/issue34899.dart.outline.expect
index 1d77be0..48da0fa 100644
--- a/front_end/testcases/issue34899.dart.outline.expect
+++ b/front_end/testcases/issue34899.dart.outline.expect
@@ -5,7 +5,7 @@
class Foo<T extends core::Object = dynamic> extends core::Object {
final field () → asy::Future<dynamic> quux;
- field self::Foo::T t;
+ generic-covariant-impl field self::Foo::T t;
constructor •(() → asy::Future<dynamic> quux, self::Foo::T t) → self::Foo<self::Foo::T>
;
method call() → asy::Future<self::Foo::T>
diff --git a/front_end/testcases/legacy.status b/front_end/testcases/legacy.status
index 947de8b..b1b1917 100644
--- a/front_end/testcases/legacy.status
+++ b/front_end/testcases/legacy.status
@@ -11,6 +11,7 @@
call: Fail # Test can't run.
constructor_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
constructor_initializer_invalid: RuntimeError # Fails execution after recovery
+control_flow_collection: RuntimeError
duplicated_field_initializer: RuntimeError
external_import: RuntimeError # Expected -- test uses import which doesn't exist.
fallthrough: Fail # Missing FallThroughError.
@@ -19,6 +20,7 @@
inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics
inference/constructors_too_many_positional_arguments: Fail
inference/downwards_inference_annotations_locals: Fail # Issue #30031
+inference/downwards_inference_for_each: RuntimeError # Issue #36382
inference/future_then_explicit_future: RuntimeError
inference/generic_methods_infer_js_builtin: RuntimeError # Test attempts to access platform-private library leading to NSM.
inference/infer_assign_to_index: Fail
@@ -35,6 +37,7 @@
micro: Fail # External method marked abstract.
minimum_int: Crash # Min int literal not supported in non-strong mode.
named_parameters: Fail # Missing types and unnecessary default values.
+operator_method_not_found: RuntimeError # Expected
optional: Fail # Unnecessary default values.
rasta/abstract_constructor: Fail
rasta/bad_constructor_redirection: Fail
@@ -111,6 +114,10 @@
regress/issue_35259: RuntimeError # Expected
regress/issue_35260: RuntimeError # Expected
regress/issue_35266: RuntimeError # Expected
+regress/issue_36400: RuntimeError
+regress/issue_36647: RuntimeError # Expected
+regress/issue_36647_2: RuntimeError # Expected
+regress/issue_36669: RuntimeError
reject_generic_function_types_in_bounds: RuntimeError # Expected
runtime_checks/implicit_downcast_constructor_initializer: RuntimeError # Test exercises strong mode semantics
runtime_checks/implicit_downcast_do: RuntimeError # Test exercises strong mode semantics
@@ -126,6 +133,7 @@
runtime_checks_new/stub_checked_via_target: RuntimeError # Test exercises strong mode semantics
set_literals/disambiguation_rule: RuntimeError
spread_collection: RuntimeError
+type_parameter_type_named_int: RuntimeError # Expected
type_variable_as_super: Fail
uninitialized_fields: Fail # Fasta and dartk disagree on static initializers
void_methods: Fail # Bad return from setters.
diff --git a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.expect b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.expect
index fb518e4..c22e364 100644
--- a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.expect
+++ b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.expect
@@ -8,11 +8,11 @@
;
}
class C<T extends self::A = dynamic> extends core::Object {
- field self::C::T _field = null;
+ generic-covariant-impl field self::C::T _field = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method foo(self::C::T x) → dynamic {
+ method foo(generic-covariant-impl self::C::T x) → dynamic {
this.{self::C::_field} = x;
}
}
diff --git a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.transformed.expect b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.transformed.expect
index 9db2af2..b5de22c 100644
--- a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.transformed.expect
+++ b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.legacy.transformed.expect
@@ -8,11 +8,11 @@
;
}
class C<T extends self::A = dynamic> extends core::Object {
- field self::C::T _field = null;
+ generic-covariant-impl field self::C::T _field = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method foo(self::C::T x) → dynamic {
+ method foo(generic-covariant-impl self::C::T x) → dynamic {
this.{self::C::_field} = x;
}
}
@@ -22,11 +22,11 @@
;
}
abstract class _Foo&Object&C extends core::Object implements self::C<self::B> {
- field self::B _field = null;
+ generic-covariant-impl field self::B _field = null;
synthetic constructor •() → self::_Foo&Object&C
: super core::Object::•()
;
- method foo(self::B x) → dynamic {
+ method foo(generic-covariant-impl self::B x) → dynamic {
this.{self::C::_field} = x;
}
}
diff --git a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.outline.expect b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.outline.expect
index 1d0284c..340756e 100644
--- a/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.outline.expect
+++ b/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.outline.expect
@@ -7,10 +7,10 @@
;
}
class C<T extends self::A = dynamic> extends core::Object {
- field self::C::T _field;
+ generic-covariant-impl field self::C::T _field;
synthetic constructor •() → self::C<self::C::T>
;
- method foo(self::C::T x) → dynamic
+ method foo(generic-covariant-impl self::C::T x) → dynamic
;
}
class D extends self::C<self::B> {
diff --git a/front_end/testcases/named_function_scope.dart b/front_end/testcases/named_function_scope.dart
index 97888e3..25c77b1 100644
--- a/front_end/testcases/named_function_scope.dart
+++ b/front_end/testcases/named_function_scope.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.
-/*@testedFeatures=error,warning,context*/
-
class T {}
class V {}
@@ -25,64 +23,51 @@
T t;
// This doesn't cause a scope error as the named function expression has
// its own scope.
- var x = /*@error=NamedFunctionExpression*/ T() {};
+ var x = T() {};
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
+ V v;
// This causes an error, V is already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V;
+ var V;
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
+ V v;
// This causes an error, V is already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
+ var V = null;
}
{
// This causes a scope error as T is already used in the function-type
// scope (the return type).
- var x =
- /*@context=DuplicatedNamePreviouslyUsedCause*/
- T
- /*@error=NamedFunctionExpression*/
- /*@error=DuplicatedNamePreviouslyUsed*/
- T() {};
+ var x = T T() {};
}
{
// This causes a scope error: using the outer definition of `V` as a type
// when defining `V`.
- /*@context=DuplicatedNamePreviouslyUsedCause*/
- V /*@error=DuplicatedNamePreviouslyUsed*/ V;
+
+ V V;
}
{
// This causes a scope error as T is already defined as a type variable in
// the function-type scope.
- var x =
- /*@error=NamedFunctionExpression*/
- /*@error=DuplicatedDeclaration*/
- T< /*@context=DuplicatedDeclarationCause*/ T>() {};
+ var x = T<T>() {};
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/
T t;
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
+ T T() {}
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
+ T T() {}
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/
T t;
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
+ T T(T t) {}
}
{
- /*@context=DuplicatedNamePreviouslyUsedCause*/
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
+ T T(T t) {}
}
{
- void T(/*@error=NotAType*/ T t) {}
+ void T(T t) {}
}
}
-void main() {
-}
+void main() {}
diff --git a/front_end/testcases/named_function_scope.dart.legacy.expect b/front_end/testcases/named_function_scope.dart.legacy.expect
index 5bc6572..69b1086 100644
--- a/front_end/testcases/named_function_scope.dart.legacy.expect
+++ b/front_end/testcases/named_function_scope.dart.legacy.expect
@@ -2,84 +2,84 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/named_function_scope.dart:28:48: Error: A function expression can't have a name.
-// var x = /*@error=NamedFunctionExpression*/ T() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:26:13: Error: A function expression can't have a name.
+// var x = T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:31:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:36:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: A function expression can't have a name.
-// T() {};
+// pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V;
// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
-// T() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:45:9: Context: Previous use of 'T'.
-// T
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:54:5: Context: Previous use of 'V'.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
+// pkg/front_end/testcases/named_function_scope.dart:29:5: Context: Previous use of 'V'.
+// V v;
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: A function expression can't have a name.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
+// pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V = null;
// ^
+// pkg/front_end/testcases/named_function_scope.dart:34:5: Context: Previous use of 'V'.
+// V v;
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:62:52: Context: Previous declaration of 'T'.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: A function expression can't have a name.
+// var x = T T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+// var x = T T() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:13: Context: Previous use of 'T'.
+// var x = T T() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+// V V;
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:47:5: Context: Previous use of 'V'.
+// V V;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: A function expression can't have a name.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+// var x = T<T>() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:52:15: Context: Previous declaration of 'T'.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:55:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:59:5: Context: Previous use of 'T'.
+// T T() {}
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:62:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
// pkg/front_end/testcases/named_function_scope.dart:66:5: Context: Previous use of 'T'.
-// T t;
+// T T(T t) {}
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:71:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:75:5: Context: Previous use of 'T'.
-// T t;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:80:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:83:32: Warning: 'T' isn't a type.
-// void T(/*@error=NotAType*/ T t) {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:69:12: Warning: 'T' isn't a type.
+// void T(T t) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -109,62 +109,62 @@
}
{
self::V v;
- dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V;
+ ^";
}
{
self::V v;
- dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
- ^" in null;
+ dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V = null;
+ ^" in null;
}
{
- dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
- T() {};
- ^" in let final () → self::T T = () → self::T {} in T;
+ dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+ var x = T T() {};
+ ^" in let final () → self::T T = () → self::T {} in T;
}
{
- self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
- V /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+ V V;
+ ^";
}
{
- dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
- T< /*@context=DuplicatedDeclarationCause*/ T>() {};
- ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
+ dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+ var x = T<T>() {};
+ ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
diff --git a/front_end/testcases/named_function_scope.dart.legacy.transformed.expect b/front_end/testcases/named_function_scope.dart.legacy.transformed.expect
index 5bc6572..69b1086 100644
--- a/front_end/testcases/named_function_scope.dart.legacy.transformed.expect
+++ b/front_end/testcases/named_function_scope.dart.legacy.transformed.expect
@@ -2,84 +2,84 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/named_function_scope.dart:28:48: Error: A function expression can't have a name.
-// var x = /*@error=NamedFunctionExpression*/ T() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:26:13: Error: A function expression can't have a name.
+// var x = T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:31:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:36:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: A function expression can't have a name.
-// T() {};
+// pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V;
// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
-// T() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:45:9: Context: Previous use of 'T'.
-// T
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:54:5: Context: Previous use of 'V'.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
+// pkg/front_end/testcases/named_function_scope.dart:29:5: Context: Previous use of 'V'.
+// V v;
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: A function expression can't have a name.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
+// pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V = null;
// ^
+// pkg/front_end/testcases/named_function_scope.dart:34:5: Context: Previous use of 'V'.
+// V v;
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:62:52: Context: Previous declaration of 'T'.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: A function expression can't have a name.
+// var x = T T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+// var x = T T() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:13: Context: Previous use of 'T'.
+// var x = T T() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+// V V;
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:47:5: Context: Previous use of 'V'.
+// V V;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: A function expression can't have a name.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+// var x = T<T>() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:52:15: Context: Previous declaration of 'T'.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:55:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:59:5: Context: Previous use of 'T'.
+// T T() {}
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:62:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
// pkg/front_end/testcases/named_function_scope.dart:66:5: Context: Previous use of 'T'.
-// T t;
+// T T(T t) {}
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:71:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:75:5: Context: Previous use of 'T'.
-// T t;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:80:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:83:32: Warning: 'T' isn't a type.
-// void T(/*@error=NotAType*/ T t) {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:69:12: Warning: 'T' isn't a type.
+// void T(T t) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -109,62 +109,62 @@
}
{
self::V v;
- dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V;
+ ^";
}
{
self::V v;
- dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
- ^" in null;
+ dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V = null;
+ ^" in null;
}
{
- dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
- T() {};
- ^" in let final () → self::T T = () → self::T {} in T;
+ dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+ var x = T T() {};
+ ^" in let final () → self::T T = () → self::T {} in T;
}
{
- self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
- V /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+ V V;
+ ^";
}
{
- dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
- T< /*@context=DuplicatedDeclarationCause*/ T>() {};
- ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
+ dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+ var x = T<T>() {};
+ ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
diff --git a/front_end/testcases/named_function_scope.dart.strong.expect b/front_end/testcases/named_function_scope.dart.strong.expect
index d898d98..ec10637 100644
--- a/front_end/testcases/named_function_scope.dart.strong.expect
+++ b/front_end/testcases/named_function_scope.dart.strong.expect
@@ -2,84 +2,84 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/named_function_scope.dart:28:48: Error: A function expression can't have a name.
-// var x = /*@error=NamedFunctionExpression*/ T() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:26:13: Error: A function expression can't have a name.
+// var x = T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:31:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:36:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: A function expression can't have a name.
-// T() {};
+// pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V;
// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
-// T() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:45:9: Context: Previous use of 'T'.
-// T
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:54:5: Context: Previous use of 'V'.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
+// pkg/front_end/testcases/named_function_scope.dart:29:5: Context: Previous use of 'V'.
+// V v;
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: A function expression can't have a name.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
+// pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V = null;
// ^
+// pkg/front_end/testcases/named_function_scope.dart:34:5: Context: Previous use of 'V'.
+// V v;
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:62:52: Context: Previous declaration of 'T'.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: A function expression can't have a name.
+// var x = T T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+// var x = T T() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:13: Context: Previous use of 'T'.
+// var x = T T() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+// V V;
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:47:5: Context: Previous use of 'V'.
+// V V;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: A function expression can't have a name.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+// var x = T<T>() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:52:15: Context: Previous declaration of 'T'.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:55:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:59:5: Context: Previous use of 'T'.
+// T T() {}
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:62:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
// pkg/front_end/testcases/named_function_scope.dart:66:5: Context: Previous use of 'T'.
-// T t;
+// T T(T t) {}
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:71:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:75:5: Context: Previous use of 'T'.
-// T t;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:80:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:83:32: Error: 'T' isn't a type.
-// void T(/*@error=NotAType*/ T t) {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:69:12: Error: 'T' isn't a type.
+// void T(T t) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -109,62 +109,62 @@
}
{
self::V v;
- dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V;
+ ^";
}
{
self::V v;
- dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
- ^" in null;
+ dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V = null;
+ ^" in null;
}
{
- dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
- T() {};
- ^" in let final () → self::T T = () → self::T {} in T;
+ dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+ var x = T T() {};
+ ^" in let final () → self::T T = () → self::T {} in T;
}
{
- self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
- V /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^" as{TypeError} self::V;
+ self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+ V V;
+ ^" as{TypeError} self::V;
}
{
- dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
- T< /*@context=DuplicatedDeclarationCause*/ T>() {};
- ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
+ dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+ var x = T<T>() {};
+ ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
diff --git a/front_end/testcases/named_function_scope.dart.strong.transformed.expect b/front_end/testcases/named_function_scope.dart.strong.transformed.expect
index d898d98..ec10637 100644
--- a/front_end/testcases/named_function_scope.dart.strong.transformed.expect
+++ b/front_end/testcases/named_function_scope.dart.strong.transformed.expect
@@ -2,84 +2,84 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/named_function_scope.dart:28:48: Error: A function expression can't have a name.
-// var x = /*@error=NamedFunctionExpression*/ T() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:26:13: Error: A function expression can't have a name.
+// var x = T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:31:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
-// var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:36:52: Context: Previous use of 'V'.
-// /*@context=DuplicatedNamePreviouslyUsedCause*/ V v;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: A function expression can't have a name.
-// T() {};
+// pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V;
// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
-// T() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:45:9: Context: Previous use of 'T'.
-// T
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:54:5: Context: Previous use of 'V'.
-// V /*@error=DuplicatedNamePreviouslyUsed*/ V;
+// pkg/front_end/testcases/named_function_scope.dart:29:5: Context: Previous use of 'V'.
+// V v;
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: A function expression can't have a name.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
+// pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+// var V = null;
// ^
+// pkg/front_end/testcases/named_function_scope.dart:34:5: Context: Previous use of 'V'.
+// V v;
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:62:52: Context: Previous declaration of 'T'.
-// T< /*@context=DuplicatedDeclarationCause*/ T>() {};
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: A function expression can't have a name.
+// var x = T T() {};
+// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+// var x = T T() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:41:13: Context: Previous use of 'T'.
+// var x = T T() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+// V V;
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:47:5: Context: Previous use of 'V'.
+// V V;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: A function expression can't have a name.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+// var x = T<T>() {};
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:52:15: Context: Previous declaration of 'T'.
+// var x = T<T>() {};
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:55:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T() {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:59:5: Context: Previous use of 'T'.
+// T T() {}
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
+// pkg/front_end/testcases/named_function_scope.dart:62:5: Context: Previous use of 'T'.
+// T t;
+// ^
+//
+// pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+// T T(T t) {}
+// ^
// pkg/front_end/testcases/named_function_scope.dart:66:5: Context: Previous use of 'T'.
-// T t;
+// T T(T t) {}
// ^
//
-// pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:71:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:75:5: Context: Previous use of 'T'.
-// T t;
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-// pkg/front_end/testcases/named_function_scope.dart:80:5: Context: Previous use of 'T'.
-// T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
-// ^
-//
-// pkg/front_end/testcases/named_function_scope.dart:83:32: Error: 'T' isn't a type.
-// void T(/*@error=NotAType*/ T t) {}
-// ^
+// pkg/front_end/testcases/named_function_scope.dart:69:12: Error: 'T' isn't a type.
+// void T(T t) {}
+// ^
//
import self as self;
import "dart:core" as core;
@@ -109,62 +109,62 @@
}
{
self::V v;
- dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:33:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^";
+ dynamic V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:31:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V;
+ ^";
}
{
self::V v;
- dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:38:49: Error: Can't declare 'V' because it was already used in this scope.
- var /*@error=DuplicatedNamePreviouslyUsed*/ V = null;
- ^" in null;
+ dynamic V = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:36:9: Error: Can't declare 'V' because it was already used in this scope.
+ var V = null;
+ ^" in null;
}
{
- dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:48:9: Error: Can't declare 'T' because it was already used in this scope.
- T() {};
- ^" in let final () → self::T T = () → self::T {} in T;
+ dynamic x = let final dynamic #t2 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:41:15: Error: Can't declare 'T' because it was already used in this scope.
+ var x = T T() {};
+ ^" in let final () → self::T T = () → self::T {} in T;
}
{
- self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:54:47: Error: Can't declare 'V' because it was already used in this scope.
- V /*@error=DuplicatedNamePreviouslyUsed*/ V;
- ^" as{TypeError} self::V;
+ self::V V = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:47:7: Error: Can't declare 'V' because it was already used in this scope.
+ V V;
+ ^" as{TypeError} self::V;
}
{
- dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:62:9: Error: 'T' is already declared in this scope.
- T< /*@context=DuplicatedDeclarationCause*/ T>() {};
- ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
+ dynamic x = let final dynamic #t3 = invalid-expression "pkg/front_end/testcases/named_function_scope.dart:52:13: Error: 'T' is already declared in this scope.
+ var x = T<T>() {};
+ ^" in let final <T extends core::Object = dynamic>() → dynamic T = <T extends core::Object = dynamic>() → dynamic {} in T;
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:67:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:56:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:71:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T() {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:59:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T() {}
+ ^";
function T() → self::T {}
}
}
{
self::T t;
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:76:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:63:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
{
{
- invalid-expression "pkg/front_end/testcases/named_function_scope.dart:80:47: Error: Can't declare 'T' because it was already used in this scope.
- T /*@error=DuplicatedNamePreviouslyUsed*/ T(T t) {}
- ^";
+ invalid-expression "pkg/front_end/testcases/named_function_scope.dart:66:7: Error: Can't declare 'T' because it was already used in this scope.
+ T T(T t) {}
+ ^";
function T(self::T t) → self::T {}
}
}
diff --git a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.expect b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.expect
index 828a1c2..ed949f6 100644
--- a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.expect
+++ b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
abstract class A<X extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::X> foo = null;
+ generic-covariant-impl field core::List<self::A::X> foo = null;
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
diff --git a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.transformed.expect b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.transformed.expect
index 828a1c2..ed949f6 100644
--- a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.transformed.expect
+++ b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
abstract class A<X extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::X> foo = null;
+ generic-covariant-impl field core::List<self::A::X> foo = null;
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
diff --git a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.outline.expect b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.outline.expect
index c6492de..9679fbf 100644
--- a/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.outline.expect
+++ b/front_end/testcases/no_such_method_forwarders/abstract_accessors_from_field_with_substitution.dart.outline.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
abstract class A<X extends core::Object = dynamic> extends core::Object {
- field core::List<self::A::X> foo;
+ generic-covariant-impl field core::List<self::A::X> foo;
synthetic constructor •() → self::A<self::A::X>
;
}
diff --git a/front_end/testcases/no_such_method_forwarders/private.dart.legacy.expect b/front_end/testcases/no_such_method_forwarders/private.dart.legacy.expect
index 214711b..3afff4b 100644
--- a/front_end/testcases/no_such_method_forwarders/private.dart.legacy.expect
+++ b/front_end/testcases/no_such_method_forwarders/private.dart.legacy.expect
@@ -1,7 +1,7 @@
library private;
import self as self;
import "dart:core" as core;
-import "./private_module.dart" as pri;
+import "private_module.dart" as pri;
import "org-dartlang-testcase:///private_module.dart";
diff --git a/front_end/testcases/no_such_method_forwarders/private.dart.legacy.transformed.expect b/front_end/testcases/no_such_method_forwarders/private.dart.legacy.transformed.expect
index 214711b..3afff4b 100644
--- a/front_end/testcases/no_such_method_forwarders/private.dart.legacy.transformed.expect
+++ b/front_end/testcases/no_such_method_forwarders/private.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library private;
import self as self;
import "dart:core" as core;
-import "./private_module.dart" as pri;
+import "private_module.dart" as pri;
import "org-dartlang-testcase:///private_module.dart";
diff --git a/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect b/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect
index 6270b7f..518a7f4 100644
--- a/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect
+++ b/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect
@@ -1,7 +1,7 @@
library private;
import self as self;
import "dart:core" as core;
-import "./private_module.dart" as pri;
+import "private_module.dart" as pri;
import "org-dartlang-testcase:///private_module.dart";
diff --git a/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect b/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect
index 214711b..3afff4b 100644
--- a/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect
+++ b/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect
@@ -1,7 +1,7 @@
library private;
import self as self;
import "dart:core" as core;
-import "./private_module.dart" as pri;
+import "private_module.dart" as pri;
import "org-dartlang-testcase:///private_module.dart";
diff --git a/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect b/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect
index 214711b..3afff4b 100644
--- a/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect
+++ b/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library private;
import self as self;
import "dart:core" as core;
-import "./private_module.dart" as pri;
+import "private_module.dart" as pri;
import "org-dartlang-testcase:///private_module.dart";
diff --git a/front_end/testcases/no_such_method_private_setter.dart.legacy.expect b/front_end/testcases/no_such_method_private_setter.dart.legacy.expect
index 52f88c4..a545e64 100644
--- a/front_end/testcases/no_such_method_private_setter.dart.legacy.expect
+++ b/front_end/testcases/no_such_method_private_setter.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./no_such_method_private_setter_lib.dart" as no_;
+import "no_such_method_private_setter_lib.dart" as no_;
import "org-dartlang-testcase:///no_such_method_private_setter_lib.dart";
diff --git a/front_end/testcases/no_such_method_private_setter.dart.legacy.transformed.expect b/front_end/testcases/no_such_method_private_setter.dart.legacy.transformed.expect
index 52f88c4..a545e64 100644
--- a/front_end/testcases/no_such_method_private_setter.dart.legacy.transformed.expect
+++ b/front_end/testcases/no_such_method_private_setter.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./no_such_method_private_setter_lib.dart" as no_;
+import "no_such_method_private_setter_lib.dart" as no_;
import "org-dartlang-testcase:///no_such_method_private_setter_lib.dart";
diff --git a/front_end/testcases/no_such_method_private_setter.dart.outline.expect b/front_end/testcases/no_such_method_private_setter.dart.outline.expect
index 78df3aa..099c2ab 100644
--- a/front_end/testcases/no_such_method_private_setter.dart.outline.expect
+++ b/front_end/testcases/no_such_method_private_setter.dart.outline.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./no_such_method_private_setter_lib.dart" as no_;
+import "no_such_method_private_setter_lib.dart" as no_;
import "org-dartlang-testcase:///no_such_method_private_setter_lib.dart";
diff --git a/front_end/testcases/no_such_method_private_setter.dart.strong.expect b/front_end/testcases/no_such_method_private_setter.dart.strong.expect
index 52f88c4..a545e64 100644
--- a/front_end/testcases/no_such_method_private_setter.dart.strong.expect
+++ b/front_end/testcases/no_such_method_private_setter.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./no_such_method_private_setter_lib.dart" as no_;
+import "no_such_method_private_setter_lib.dart" as no_;
import "org-dartlang-testcase:///no_such_method_private_setter_lib.dart";
diff --git a/front_end/testcases/no_such_method_private_setter.dart.strong.transformed.expect b/front_end/testcases/no_such_method_private_setter.dart.strong.transformed.expect
index 52f88c4..a545e64 100644
--- a/front_end/testcases/no_such_method_private_setter.dart.strong.transformed.expect
+++ b/front_end/testcases/no_such_method_private_setter.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./no_such_method_private_setter_lib.dart" as no_;
+import "no_such_method_private_setter_lib.dart" as no_;
import "org-dartlang-testcase:///no_such_method_private_setter_lib.dart";
diff --git a/front_end/testcases/operator_method_not_found.dart b/front_end/testcases/operator_method_not_found.dart
new file mode 100644
index 0000000..c54c358
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2019, 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 Foo {
+}
+
+main() {
+ Foo foo = new Foo();
+
+ // Not defined, but given right arity.
+ print(foo < 2);
+ print(foo > 2);
+ print(foo <= 2);
+ print(foo >= 2);
+ print(foo == 2);
+ print(foo - 2);
+ print(foo + 2);
+ print(foo / 2);
+ print(foo ~/ 2);
+ print(foo * 2);
+ print(foo % 2);
+ print(foo | 2);
+ print(foo ^ 2);
+ print(foo & 2);
+ print(foo << 2);
+ print(foo >> 2);
+ // print(foo >>> 2); // triple shift not enabled by default at the moment.
+ print(foo[2] = 2);
+ print(foo[2]);
+ print(~foo);
+ print(-foo);
+
+ // Not defined, and given wrong arity.
+ // Should be binary.
+ print(<foo);
+ print(>foo);
+ print(<=foo);
+ print(>=foo);
+ print(==foo);
+ print(+foo);
+ print(/foo);
+ print(~/foo);
+ print(*foo);
+ print(%foo);
+ print(|foo);
+ print(^foo);
+ print(&foo);
+ print(<<foo);
+ print(>>foo);
+ // print(>>>foo); // triple shift not enabled by default at the moment.
+
+ // Should be unary.
+ print(foo ~ 2);
+}
\ No newline at end of file
diff --git a/front_end/testcases/operator_method_not_found.dart.hierarchy.expect b/front_end/testcases/operator_method_not_found.dart.hierarchy.expect
new file mode 100644
index 0000000..6dc6110
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.hierarchy.expect
@@ -0,0 +1,36 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+Foo:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
diff --git a/front_end/testcases/operator_method_not_found.dart.legacy.expect b/front_end/testcases/operator_method_not_found.dart.legacy.expect
new file mode 100644
index 0000000..0abf9ef
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.legacy.expect
@@ -0,0 +1,154 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: Expected '>' after this.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:13: Error: Expected '[' before this.
+// print(<foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Warning: 'foo' isn't a type.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: Expected an identifier, but got '>'.
+// print(>foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: Expected an identifier, but got '<='.
+// print(<=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: Expected an identifier, but got '>='.
+// print(>=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: Expected an identifier, but got '=='.
+// print(==foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// print(+foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: Expected an identifier, but got '/'.
+// print(/foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: Expected an identifier, but got '~/'.
+// print(~/foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: Expected an identifier, but got '*'.
+// print(*foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: Expected an identifier, but got '%'.
+// print(%foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: Expected an identifier, but got '|'.
+// print(|foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: Expected an identifier, but got '^'.
+// print(^foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: Expected an identifier, but got '&'.
+// print(&foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: Expected an identifier, but got '<<'.
+// print(<<foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: Expected an identifier, but got '>>'.
+// print(>>foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+// print(foo ~ 2);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → self::Foo
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::Foo foo = new self::Foo::•();
+ core::print(foo.<(2));
+ core::print(foo.>(2));
+ core::print(foo.<=(2));
+ core::print(foo.>=(2));
+ core::print(foo.==(2));
+ core::print(foo.-(2));
+ core::print(foo.+(2));
+ core::print(foo./(2));
+ core::print(foo.~/(2));
+ core::print(foo.*(2));
+ core::print(foo.%(2));
+ core::print(foo.|(2));
+ core::print(foo.^(2));
+ core::print(foo.&(2));
+ core::print(foo.<<(2));
+ core::print(foo.>>(2));
+ core::print(let final dynamic #t1 = foo in let final dynamic #t2 = 2 in let final dynamic #t3 = 2 in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3);
+ core::print(foo.[](2));
+ core::print(foo.~());
+ core::print(foo.unary-());
+ core::print(<invalid-type>[]);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: This couldn't be parsed.
+ print(>foo);
+ ^".>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: This couldn't be parsed.
+ print(<=foo);
+ ^".<=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: This couldn't be parsed.
+ print(>=foo);
+ ^".>=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: This couldn't be parsed.
+ print(==foo);
+ ^".==(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: This couldn't be parsed.
+ print(+foo);
+ ^".+(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: This couldn't be parsed.
+ print(/foo);
+ ^"./(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: This couldn't be parsed.
+ print(~/foo);
+ ^".~/(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: This couldn't be parsed.
+ print(*foo);
+ ^".*(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: This couldn't be parsed.
+ print(%foo);
+ ^".%(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: This couldn't be parsed.
+ print(|foo);
+ ^".|(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: This couldn't be parsed.
+ print(^foo);
+ ^".^(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: This couldn't be parsed.
+ print(&foo);
+ ^".&(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: This couldn't be parsed.
+ print(<<foo);
+ ^".<<(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: This couldn't be parsed.
+ print(>>foo);
+ ^".>>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+ print(foo ~ 2);
+ ^");
+}
diff --git a/front_end/testcases/operator_method_not_found.dart.legacy.transformed.expect b/front_end/testcases/operator_method_not_found.dart.legacy.transformed.expect
new file mode 100644
index 0000000..0abf9ef
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.legacy.transformed.expect
@@ -0,0 +1,154 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: Expected '>' after this.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:13: Error: Expected '[' before this.
+// print(<foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Warning: 'foo' isn't a type.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: Expected an identifier, but got '>'.
+// print(>foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: Expected an identifier, but got '<='.
+// print(<=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: Expected an identifier, but got '>='.
+// print(>=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: Expected an identifier, but got '=='.
+// print(==foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// print(+foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: Expected an identifier, but got '/'.
+// print(/foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: Expected an identifier, but got '~/'.
+// print(~/foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: Expected an identifier, but got '*'.
+// print(*foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: Expected an identifier, but got '%'.
+// print(%foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: Expected an identifier, but got '|'.
+// print(|foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: Expected an identifier, but got '^'.
+// print(^foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: Expected an identifier, but got '&'.
+// print(&foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: Expected an identifier, but got '<<'.
+// print(<<foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: Expected an identifier, but got '>>'.
+// print(>>foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+// print(foo ~ 2);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → self::Foo
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::Foo foo = new self::Foo::•();
+ core::print(foo.<(2));
+ core::print(foo.>(2));
+ core::print(foo.<=(2));
+ core::print(foo.>=(2));
+ core::print(foo.==(2));
+ core::print(foo.-(2));
+ core::print(foo.+(2));
+ core::print(foo./(2));
+ core::print(foo.~/(2));
+ core::print(foo.*(2));
+ core::print(foo.%(2));
+ core::print(foo.|(2));
+ core::print(foo.^(2));
+ core::print(foo.&(2));
+ core::print(foo.<<(2));
+ core::print(foo.>>(2));
+ core::print(let final dynamic #t1 = foo in let final dynamic #t2 = 2 in let final dynamic #t3 = 2 in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3);
+ core::print(foo.[](2));
+ core::print(foo.~());
+ core::print(foo.unary-());
+ core::print(<invalid-type>[]);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: This couldn't be parsed.
+ print(>foo);
+ ^".>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: This couldn't be parsed.
+ print(<=foo);
+ ^".<=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: This couldn't be parsed.
+ print(>=foo);
+ ^".>=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: This couldn't be parsed.
+ print(==foo);
+ ^".==(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: This couldn't be parsed.
+ print(+foo);
+ ^".+(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: This couldn't be parsed.
+ print(/foo);
+ ^"./(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: This couldn't be parsed.
+ print(~/foo);
+ ^".~/(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: This couldn't be parsed.
+ print(*foo);
+ ^".*(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: This couldn't be parsed.
+ print(%foo);
+ ^".%(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: This couldn't be parsed.
+ print(|foo);
+ ^".|(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: This couldn't be parsed.
+ print(^foo);
+ ^".^(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: This couldn't be parsed.
+ print(&foo);
+ ^".&(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: This couldn't be parsed.
+ print(<<foo);
+ ^".<<(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: This couldn't be parsed.
+ print(>>foo);
+ ^".>>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+ print(foo ~ 2);
+ ^");
+}
diff --git a/front_end/testcases/operator_method_not_found.dart.outline.expect b/front_end/testcases/operator_method_not_found.dart.outline.expect
new file mode 100644
index 0000000..7835c54
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.outline.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → self::Foo
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/front_end/testcases/operator_method_not_found.dart.strong.expect b/front_end/testcases/operator_method_not_found.dart.strong.expect
new file mode 100644
index 0000000..ec89d36
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.strong.expect
@@ -0,0 +1,344 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: Expected '>' after this.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:13: Error: Expected '[' before this.
+// print(<foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: 'foo' isn't a type.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: Expected an identifier, but got '>'.
+// print(>foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: Expected an identifier, but got '<='.
+// print(<=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: Expected an identifier, but got '>='.
+// print(>=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: Expected an identifier, but got '=='.
+// print(==foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// print(+foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: Expected an identifier, but got '/'.
+// print(/foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: Expected an identifier, but got '~/'.
+// print(~/foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: Expected an identifier, but got '*'.
+// print(*foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: Expected an identifier, but got '%'.
+// print(%foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: Expected an identifier, but got '|'.
+// print(|foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: Expected an identifier, but got '^'.
+// print(^foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: Expected an identifier, but got '&'.
+// print(&foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: Expected an identifier, but got '<<'.
+// print(<<foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: Expected an identifier, but got '>>'.
+// print(>>foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+// print(foo ~ 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:12:13: Error: The method '<' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<'.
+// print(foo < 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:13:13: Error: The method '>' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>'.
+// print(foo > 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:14:13: Error: The method '<=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<='.
+// print(foo <= 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:15:13: Error: The method '>=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>='.
+// print(foo >= 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:17:13: Error: The method '-' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '-'.
+// print(foo - 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:18:13: Error: The method '+' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '+'.
+// print(foo + 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:19:13: Error: The method '/' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '/'.
+// print(foo / 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:20:13: Error: The method '~/' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '~/'.
+// print(foo ~/ 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:21:13: Error: The method '*' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '*'.
+// print(foo * 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:22:13: Error: The method '%' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '%'.
+// print(foo % 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:23:13: Error: The method '|' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '|'.
+// print(foo | 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:24:13: Error: The method '^' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '^'.
+// print(foo ^ 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:25:13: Error: The method '&' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '&'.
+// print(foo & 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:26:13: Error: The method '<<' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<<'.
+// print(foo << 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:27:13: Error: The method '>>' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>>'.
+// print(foo >> 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:29:12: Error: The method '[]=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '[]='.
+// print(foo[2] = 2);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:30:12: Error: The method '[]' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '[]'.
+// print(foo[2]);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:31:9: Error: The method '~' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '~'.
+// print(~foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:32:9: Error: The method 'unary-' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
+// print(-foo);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → self::Foo
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::Foo foo = new self::Foo::•();
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:12:13: Error: The method '<' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<'.
+ print(foo < 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:13:13: Error: The method '>' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>'.
+ print(foo > 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:14:13: Error: The method '<=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<='.
+ print(foo <= 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:15:13: Error: The method '>=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>='.
+ print(foo >= 2);
+ ^^");
+ core::print(foo.{core::Object::==}(2));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:17:13: Error: The method '-' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '-'.
+ print(foo - 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:18:13: Error: The method '+' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '+'.
+ print(foo + 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:19:13: Error: The method '/' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '/'.
+ print(foo / 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:20:13: Error: The method '~/' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '~/'.
+ print(foo ~/ 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:21:13: Error: The method '*' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '*'.
+ print(foo * 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:22:13: Error: The method '%' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '%'.
+ print(foo % 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:23:13: Error: The method '|' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '|'.
+ print(foo | 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:24:13: Error: The method '^' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '^'.
+ print(foo ^ 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:25:13: Error: The method '&' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '&'.
+ print(foo & 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:26:13: Error: The method '<<' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<<'.
+ print(foo << 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:27:13: Error: The method '>>' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>>'.
+ print(foo >> 2);
+ ^^");
+ core::print(let final self::Foo #t1 = foo in let final core::int #t2 = 2 in let final core::int #t3 = 2 in let final dynamic #t4 = invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:29:12: Error: The method '[]=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '[]='.
+ print(foo[2] = 2);
+ ^^^" in #t3);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:30:12: Error: The method '[]' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '[]'.
+ print(foo[2]);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:31:9: Error: The method '~' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '~'.
+ print(~foo);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:32:9: Error: The method 'unary-' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
+ print(-foo);
+ ^");
+ core::print(<invalid-type>[]);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: This couldn't be parsed.
+ print(>foo);
+ ^".>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: This couldn't be parsed.
+ print(<=foo);
+ ^".<=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: This couldn't be parsed.
+ print(>=foo);
+ ^".>=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: This couldn't be parsed.
+ print(==foo);
+ ^".{core::Object::==}(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: This couldn't be parsed.
+ print(+foo);
+ ^".+(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: This couldn't be parsed.
+ print(/foo);
+ ^"./(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: This couldn't be parsed.
+ print(~/foo);
+ ^".~/(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: This couldn't be parsed.
+ print(*foo);
+ ^".*(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: This couldn't be parsed.
+ print(%foo);
+ ^".%(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: This couldn't be parsed.
+ print(|foo);
+ ^".|(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: This couldn't be parsed.
+ print(^foo);
+ ^".^(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: This couldn't be parsed.
+ print(&foo);
+ ^".&(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: This couldn't be parsed.
+ print(<<foo);
+ ^".<<(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: This couldn't be parsed.
+ print(>>foo);
+ ^".>>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+ print(foo ~ 2);
+ ^");
+}
diff --git a/front_end/testcases/operator_method_not_found.dart.strong.transformed.expect b/front_end/testcases/operator_method_not_found.dart.strong.transformed.expect
new file mode 100644
index 0000000..ec89d36
--- /dev/null
+++ b/front_end/testcases/operator_method_not_found.dart.strong.transformed.expect
@@ -0,0 +1,344 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: Expected '>' after this.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:13: Error: Expected '[' before this.
+// print(<foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:36:10: Error: 'foo' isn't a type.
+// print(<foo);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: Expected an identifier, but got '>'.
+// print(>foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: Expected an identifier, but got '<='.
+// print(<=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: Expected an identifier, but got '>='.
+// print(>=foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: Expected an identifier, but got '=='.
+// print(==foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// print(+foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: Expected an identifier, but got '/'.
+// print(/foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: Expected an identifier, but got '~/'.
+// print(~/foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: Expected an identifier, but got '*'.
+// print(*foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: Expected an identifier, but got '%'.
+// print(%foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: Expected an identifier, but got '|'.
+// print(|foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: Expected an identifier, but got '^'.
+// print(^foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: Expected an identifier, but got '&'.
+// print(&foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: Expected an identifier, but got '<<'.
+// print(<<foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: Expected an identifier, but got '>>'.
+// print(>>foo);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+// print(foo ~ 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:12:13: Error: The method '<' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<'.
+// print(foo < 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:13:13: Error: The method '>' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>'.
+// print(foo > 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:14:13: Error: The method '<=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<='.
+// print(foo <= 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:15:13: Error: The method '>=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>='.
+// print(foo >= 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:17:13: Error: The method '-' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '-'.
+// print(foo - 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:18:13: Error: The method '+' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '+'.
+// print(foo + 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:19:13: Error: The method '/' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '/'.
+// print(foo / 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:20:13: Error: The method '~/' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '~/'.
+// print(foo ~/ 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:21:13: Error: The method '*' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '*'.
+// print(foo * 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:22:13: Error: The method '%' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '%'.
+// print(foo % 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:23:13: Error: The method '|' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '|'.
+// print(foo | 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:24:13: Error: The method '^' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '^'.
+// print(foo ^ 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:25:13: Error: The method '&' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '&'.
+// print(foo & 2);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:26:13: Error: The method '<<' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '<<'.
+// print(foo << 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:27:13: Error: The method '>>' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '>>'.
+// print(foo >> 2);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:29:12: Error: The method '[]=' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '[]='.
+// print(foo[2] = 2);
+// ^^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:30:12: Error: The method '[]' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '[]'.
+// print(foo[2]);
+// ^^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:31:9: Error: The method '~' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named '~'.
+// print(~foo);
+// ^
+//
+// pkg/front_end/testcases/operator_method_not_found.dart:32:9: Error: The method 'unary-' isn't defined for the class 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
+// print(-foo);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → self::Foo
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::Foo foo = new self::Foo::•();
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:12:13: Error: The method '<' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<'.
+ print(foo < 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:13:13: Error: The method '>' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>'.
+ print(foo > 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:14:13: Error: The method '<=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<='.
+ print(foo <= 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:15:13: Error: The method '>=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>='.
+ print(foo >= 2);
+ ^^");
+ core::print(foo.{core::Object::==}(2));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:17:13: Error: The method '-' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '-'.
+ print(foo - 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:18:13: Error: The method '+' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '+'.
+ print(foo + 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:19:13: Error: The method '/' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '/'.
+ print(foo / 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:20:13: Error: The method '~/' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '~/'.
+ print(foo ~/ 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:21:13: Error: The method '*' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '*'.
+ print(foo * 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:22:13: Error: The method '%' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '%'.
+ print(foo % 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:23:13: Error: The method '|' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '|'.
+ print(foo | 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:24:13: Error: The method '^' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '^'.
+ print(foo ^ 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:25:13: Error: The method '&' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '&'.
+ print(foo & 2);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:26:13: Error: The method '<<' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '<<'.
+ print(foo << 2);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:27:13: Error: The method '>>' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '>>'.
+ print(foo >> 2);
+ ^^");
+ core::print(let final self::Foo #t1 = foo in let final core::int #t2 = 2 in let final core::int #t3 = 2 in let final dynamic #t4 = invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:29:12: Error: The method '[]=' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '[]='.
+ print(foo[2] = 2);
+ ^^^" in #t3);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:30:12: Error: The method '[]' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '[]'.
+ print(foo[2]);
+ ^^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:31:9: Error: The method '~' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named '~'.
+ print(~foo);
+ ^");
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:32:9: Error: The method 'unary-' isn't defined for the class 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/operator_method_not_found.dart'.
+Try correcting the name to the name of an existing method, or defining a method named 'unary-'.
+ print(-foo);
+ ^");
+ core::print(<invalid-type>[]);
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:37:9: Error: This couldn't be parsed.
+ print(>foo);
+ ^".>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:38:9: Error: This couldn't be parsed.
+ print(<=foo);
+ ^".<=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:39:9: Error: This couldn't be parsed.
+ print(>=foo);
+ ^".>=(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:40:9: Error: This couldn't be parsed.
+ print(==foo);
+ ^".{core::Object::==}(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:41:9: Error: This couldn't be parsed.
+ print(+foo);
+ ^".+(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:42:9: Error: This couldn't be parsed.
+ print(/foo);
+ ^"./(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:43:9: Error: This couldn't be parsed.
+ print(~/foo);
+ ^".~/(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:44:9: Error: This couldn't be parsed.
+ print(*foo);
+ ^".*(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:45:9: Error: This couldn't be parsed.
+ print(%foo);
+ ^".%(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:46:9: Error: This couldn't be parsed.
+ print(|foo);
+ ^".|(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:47:9: Error: This couldn't be parsed.
+ print(^foo);
+ ^".^(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:48:9: Error: This couldn't be parsed.
+ print(&foo);
+ ^".&(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:49:9: Error: This couldn't be parsed.
+ print(<<foo);
+ ^".<<(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:50:9: Error: This couldn't be parsed.
+ print(>>foo);
+ ^".>>(foo));
+ core::print(invalid-expression "pkg/front_end/testcases/operator_method_not_found.dart:54:13: Error: '~' isn't a binary operator.
+ print(foo ~ 2);
+ ^");
+}
diff --git a/front_end/testcases/override_check_accessor_after_inference.dart b/front_end/testcases/override_check_accessor_after_inference.dart
index 94bf861..7d43fe9 100644
--- a/front_end/testcases/override_check_accessor_after_inference.dart
+++ b/front_end/testcases/override_check_accessor_after_inference.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -24,8 +22,8 @@
}
class F extends D {
- void set x(B /*@error=OverrideTypeMismatchParameter*/ value) {}
- A get /*@error=OverrideTypeMismatchReturnType*/ y => null;
+ void set x(B value) {}
+ A get y => null;
}
main() {}
diff --git a/front_end/testcases/override_check_accessor_after_inference.dart.strong.expect b/front_end/testcases/override_check_accessor_after_inference.dart.strong.expect
index 1f70d42..b932a13 100644
--- a/front_end/testcases/override_check_accessor_after_inference.dart.strong.expect
+++ b/front_end/testcases/override_check_accessor_after_inference.dart.strong.expect
@@ -2,23 +2,23 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_accessor_after_inference.dart:28:51: Error: The return type of the method 'F.y' is 'A', which does not match the return type, 'B', of the overridden method, 'D.y'.
+// pkg/front_end/testcases/override_check_accessor_after_inference.dart:26:9: Error: The return type of the method 'F.y' is 'A', which does not match the return type, 'B', of the overridden method, 'D.y'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_after_inference.dart'.
// - 'B' is from 'pkg/front_end/testcases/override_check_accessor_after_inference.dart'.
// Change to a subtype of 'B'.
-// A get /*@error=OverrideTypeMismatchReturnType*/ y => null;
-// ^
-// pkg/front_end/testcases/override_check_accessor_after_inference.dart:18:7: Context: This is the overridden method ('y').
+// A get y => null;
+// ^
+// pkg/front_end/testcases/override_check_accessor_after_inference.dart:16:7: Context: This is the overridden method ('y').
// get y => null; // Inferred type: B
// ^
//
-// pkg/front_end/testcases/override_check_accessor_after_inference.dart:27:57: Error: The parameter 'value' of the method 'F.x' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'D.x'.
+// pkg/front_end/testcases/override_check_accessor_after_inference.dart:25:16: Error: The parameter 'value' of the method 'F.x' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'D.x'.
// - 'B' is from 'pkg/front_end/testcases/override_check_accessor_after_inference.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_after_inference.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void set x(B /*@error=OverrideTypeMismatchParameter*/ value) {}
-// ^
-// pkg/front_end/testcases/override_check_accessor_after_inference.dart:17:12: Context: This is the overridden method ('x').
+// void set x(B value) {}
+// ^
+// pkg/front_end/testcases/override_check_accessor_after_inference.dart:15:12: Context: This is the overridden method ('x').
// void set x(value) {} // Inferred type: A
// ^
//
diff --git a/front_end/testcases/override_check_accessor_basic.dart b/front_end/testcases/override_check_accessor_basic.dart
index a5391b2..a61e5c5 100644
--- a/front_end/testcases/override_check_accessor_basic.dart
+++ b/front_end/testcases/override_check_accessor_basic.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -19,8 +17,8 @@
}
class E extends C {
- void set x(B /*@error=OverrideTypeMismatchParameter*/ value) {}
- Object get /*@error=OverrideTypeMismatchReturnType*/ y => null;
+ void set x(B value) {}
+ Object get y => null;
}
main() {}
diff --git a/front_end/testcases/override_check_accessor_basic.dart.strong.expect b/front_end/testcases/override_check_accessor_basic.dart.strong.expect
index 3407e98..5fc117f 100644
--- a/front_end/testcases/override_check_accessor_basic.dart.strong.expect
+++ b/front_end/testcases/override_check_accessor_basic.dart.strong.expect
@@ -2,23 +2,23 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_accessor_basic.dart:23:56: Error: The return type of the method 'E.y' is 'Object', which does not match the return type, 'A', of the overridden method, 'C.y'.
+// pkg/front_end/testcases/override_check_accessor_basic.dart:21:14: Error: The return type of the method 'E.y' is 'Object', which does not match the return type, 'A', of the overridden method, 'C.y'.
// - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_basic.dart'.
// Change to a subtype of 'A'.
-// Object get /*@error=OverrideTypeMismatchReturnType*/ y => null;
-// ^
-// pkg/front_end/testcases/override_check_accessor_basic.dart:13:9: Context: This is the overridden method ('y').
+// Object get y => null;
+// ^
+// pkg/front_end/testcases/override_check_accessor_basic.dart:11:9: Context: This is the overridden method ('y').
// A get y => null;
// ^
//
-// pkg/front_end/testcases/override_check_accessor_basic.dart:22:57: Error: The parameter 'value' of the method 'E.x' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.x'.
+// pkg/front_end/testcases/override_check_accessor_basic.dart:20:16: Error: The parameter 'value' of the method 'E.x' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.x'.
// - 'B' is from 'pkg/front_end/testcases/override_check_accessor_basic.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_basic.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void set x(B /*@error=OverrideTypeMismatchParameter*/ value) {}
-// ^
-// pkg/front_end/testcases/override_check_accessor_basic.dart:12:12: Context: This is the overridden method ('x').
+// void set x(B value) {}
+// ^
+// pkg/front_end/testcases/override_check_accessor_basic.dart:10:12: Context: This is the overridden method ('x').
// void set x(A value) {}
// ^
//
diff --git a/front_end/testcases/override_check_accessor_with_covariant_modifier.dart b/front_end/testcases/override_check_accessor_with_covariant_modifier.dart
index a679cb1..69ca3c0 100644
--- a/front_end/testcases/override_check_accessor_with_covariant_modifier.dart
+++ b/front_end/testcases/override_check_accessor_with_covariant_modifier.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -21,10 +19,8 @@
void set x1(B value) {} // Ok because covariant is inherited
void set x2(covariant B value) {} // Ok because covariant
void set x3(covariant B value) {} // Ok because covariant
- void set x4(
- B /*@error=OverrideTypeMismatchParameter*/ value) {} // Not covariant
- void set x5(
- covariant String /*@error=OverrideTypeMismatchParameter*/ value) {}
+ void set x4(B value) {} // Not covariant
+ void set x5(covariant String value) {}
void set x6(covariant A value) {} // Always ok
}
diff --git a/front_end/testcases/override_check_accessor_with_covariant_modifier.dart.strong.expect b/front_end/testcases/override_check_accessor_with_covariant_modifier.dart.strong.expect
index 2b08b5a..765bd58 100644
--- a/front_end/testcases/override_check_accessor_with_covariant_modifier.dart.strong.expect
+++ b/front_end/testcases/override_check_accessor_with_covariant_modifier.dart.strong.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:25:50: Error: The parameter 'value' of the method 'D.x4' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.x4'.
+// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:22:17: Error: The parameter 'value' of the method 'D.x4' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.x4'.
// - 'B' is from 'pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// B /*@error=OverrideTypeMismatchParameter*/ value) {} // Not covariant
-// ^
-// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:15:12: Context: This is the overridden method ('x4').
+// void set x4(B value) {} // Not covariant
+// ^
+// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:13:12: Context: This is the overridden method ('x4').
// void set x4(A value) {}
// ^
//
-// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:27:65: Error: The parameter 'value' of the method 'D.x5' has type 'String', which does not match the corresponding type, 'A', in the overridden method, 'C.x5'.
+// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:23:32: Error: The parameter 'value' of the method 'D.x5' has type 'String', which does not match the corresponding type, 'A', in the overridden method, 'C.x5'.
// - 'A' is from 'pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// covariant String /*@error=OverrideTypeMismatchParameter*/ value) {}
-// ^
-// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:16:12: Context: This is the overridden method ('x5').
+// void set x5(covariant String value) {}
+// ^
+// pkg/front_end/testcases/override_check_accessor_with_covariant_modifier.dart:14:12: Context: This is the overridden method ('x5').
// void set x5(covariant A value) {}
// ^
//
diff --git a/front_end/testcases/override_check_after_inference.dart b/front_end/testcases/override_check_after_inference.dart
index 9777a7e..e818940 100644
--- a/front_end/testcases/override_check_after_inference.dart
+++ b/front_end/testcases/override_check_after_inference.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -21,7 +19,7 @@
}
class F extends D {
- void f(B /*@error=OverrideTypeMismatchParameter*/ x) {}
+ void f(B x) {}
}
main() {}
diff --git a/front_end/testcases/override_check_after_inference.dart.strong.expect b/front_end/testcases/override_check_after_inference.dart.strong.expect
index 0cfd406..c6fbf23 100644
--- a/front_end/testcases/override_check_after_inference.dart.strong.expect
+++ b/front_end/testcases/override_check_after_inference.dart.strong.expect
@@ -2,13 +2,13 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_after_inference.dart:24:53: Error: The parameter 'x' of the method 'F.f' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'D.f'.
+// pkg/front_end/testcases/override_check_after_inference.dart:22:12: Error: The parameter 'x' of the method 'F.f' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'D.f'.
// - 'B' is from 'pkg/front_end/testcases/override_check_after_inference.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_after_inference.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f(B /*@error=OverrideTypeMismatchParameter*/ x) {}
-// ^
-// pkg/front_end/testcases/override_check_after_inference.dart:16:8: Context: This is the overridden method ('f').
+// void f(B x) {}
+// ^
+// pkg/front_end/testcases/override_check_after_inference.dart:14:8: Context: This is the overridden method ('f').
// void f(x) {} // Inferred type: (A) -> void
// ^
//
diff --git a/front_end/testcases/override_check_basic.dart b/front_end/testcases/override_check_basic.dart
index 70134a6..69c1593 100644
--- a/front_end/testcases/override_check_basic.dart
+++ b/front_end/testcases/override_check_basic.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -23,10 +21,10 @@
}
class E extends C {
- void f1(B /*@error=OverrideTypeMismatchParameter*/ x) {}
- void f2([B /*@error=OverrideTypeMismatchParameter*/ x]) {}
- void f3({B /*@error=OverrideTypeMismatchParameter*/ x}) {}
- Object /*@error=OverrideTypeMismatchReturnType*/ f4() {}
+ void f1(B x) {}
+ void f2([B x]) {}
+ void f3({B x}) {}
+ Object f4() {}
}
main() {}
diff --git a/front_end/testcases/override_check_basic.dart.strong.expect b/front_end/testcases/override_check_basic.dart.strong.expect
index b7a5ddb..e767515 100644
--- a/front_end/testcases/override_check_basic.dart.strong.expect
+++ b/front_end/testcases/override_check_basic.dart.strong.expect
@@ -2,43 +2,43 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_basic.dart:29:52: Error: The return type of the method 'E.f4' is 'Object', which does not match the return type, 'A', of the overridden method, 'C.f4'.
+// pkg/front_end/testcases/override_check_basic.dart:27:10: Error: The return type of the method 'E.f4' is 'Object', which does not match the return type, 'A', of the overridden method, 'C.f4'.
// - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// Change to a subtype of 'A'.
-// Object /*@error=OverrideTypeMismatchReturnType*/ f4() {}
-// ^
-// pkg/front_end/testcases/override_check_basic.dart:15:5: Context: This is the overridden method ('f4').
+// Object f4() {}
+// ^
+// pkg/front_end/testcases/override_check_basic.dart:13:5: Context: This is the overridden method ('f4').
// A f4() {}
// ^
//
-// pkg/front_end/testcases/override_check_basic.dart:28:55: Error: The parameter 'x' of the method 'E.f3' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f3'.
+// pkg/front_end/testcases/override_check_basic.dart:26:14: Error: The parameter 'x' of the method 'E.f3' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f3'.
// - 'B' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f3({B /*@error=OverrideTypeMismatchParameter*/ x}) {}
-// ^
-// pkg/front_end/testcases/override_check_basic.dart:14:8: Context: This is the overridden method ('f3').
+// void f3({B x}) {}
+// ^
+// pkg/front_end/testcases/override_check_basic.dart:12:8: Context: This is the overridden method ('f3').
// void f3({A x}) {}
// ^
//
-// pkg/front_end/testcases/override_check_basic.dart:26:54: Error: The parameter 'x' of the method 'E.f1' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f1'.
+// pkg/front_end/testcases/override_check_basic.dart:24:13: Error: The parameter 'x' of the method 'E.f1' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f1'.
// - 'B' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f1(B /*@error=OverrideTypeMismatchParameter*/ x) {}
-// ^
-// pkg/front_end/testcases/override_check_basic.dart:12:8: Context: This is the overridden method ('f1').
+// void f1(B x) {}
+// ^
+// pkg/front_end/testcases/override_check_basic.dart:10:8: Context: This is the overridden method ('f1').
// void f1(A x) {}
// ^
//
-// pkg/front_end/testcases/override_check_basic.dart:27:55: Error: The parameter 'x' of the method 'E.f2' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f2'.
+// pkg/front_end/testcases/override_check_basic.dart:25:14: Error: The parameter 'x' of the method 'E.f2' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f2'.
// - 'B' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_basic.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f2([B /*@error=OverrideTypeMismatchParameter*/ x]) {}
-// ^
-// pkg/front_end/testcases/override_check_basic.dart:13:8: Context: This is the overridden method ('f2').
+// void f2([B x]) {}
+// ^
+// pkg/front_end/testcases/override_check_basic.dart:11:8: Context: This is the overridden method ('f2').
// void f2([A x]) {}
// ^
//
diff --git a/front_end/testcases/override_check_two_substitutions.dart b/front_end/testcases/override_check_two_substitutions.dart
index 98ab523..5f5ea0f 100644
--- a/front_end/testcases/override_check_two_substitutions.dart
+++ b/front_end/testcases/override_check_two_substitutions.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.
-/*@testedFeatures=error*/
-
class A<T> {
void f<U>(Map<T, U> m) {}
}
diff --git a/front_end/testcases/override_check_two_substitutions.dart.legacy.expect b/front_end/testcases/override_check_two_substitutions.dart.legacy.expect
index dfd8d78..dd0c4d5 100644
--- a/front_end/testcases/override_check_two_substitutions.dart.legacy.expect
+++ b/front_end/testcases/override_check_two_substitutions.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- method f<U extends core::Object = dynamic>(core::Map<self::A::T, self::A::f::U> m) → void {}
+ method f<U extends core::Object = dynamic>(generic-covariant-impl core::Map<self::A::T, self::A::f::U> m) → void {}
}
class B extends self::A<core::String> {
synthetic constructor •() → self::B
diff --git a/front_end/testcases/override_check_two_substitutions.dart.legacy.transformed.expect b/front_end/testcases/override_check_two_substitutions.dart.legacy.transformed.expect
index dfd8d78..dd0c4d5 100644
--- a/front_end/testcases/override_check_two_substitutions.dart.legacy.transformed.expect
+++ b/front_end/testcases/override_check_two_substitutions.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- method f<U extends core::Object = dynamic>(core::Map<self::A::T, self::A::f::U> m) → void {}
+ method f<U extends core::Object = dynamic>(generic-covariant-impl core::Map<self::A::T, self::A::f::U> m) → void {}
}
class B extends self::A<core::String> {
synthetic constructor •() → self::B
diff --git a/front_end/testcases/override_check_two_substitutions.dart.outline.expect b/front_end/testcases/override_check_two_substitutions.dart.outline.expect
index 2f0107f..e836ac4 100644
--- a/front_end/testcases/override_check_two_substitutions.dart.outline.expect
+++ b/front_end/testcases/override_check_two_substitutions.dart.outline.expect
@@ -5,7 +5,7 @@
class A<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::A<self::A::T>
;
- method f<U extends core::Object = dynamic>(core::Map<self::A::T, self::A::f::U> m) → void
+ method f<U extends core::Object = dynamic>(generic-covariant-impl core::Map<self::A::T, self::A::f::U> m) → void
;
}
class B extends self::A<core::String> {
diff --git a/front_end/testcases/override_check_with_covariant_modifier.dart b/front_end/testcases/override_check_with_covariant_modifier.dart
index 715a685..09df2e3 100644
--- a/front_end/testcases/override_check_with_covariant_modifier.dart
+++ b/front_end/testcases/override_check_with_covariant_modifier.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.
-/*@testedFeatures=error*/
-
class A {}
class B extends A {}
@@ -21,8 +19,8 @@
void f1(B x) {} // Ok because covariant is inherited
void f2(covariant B x) {} // Ok because covariant
void f3(covariant B x) {} // Ok because covariant
- void f4(B /*@error=OverrideTypeMismatchParameter*/ x) {} // Not covariant
- void f5(covariant String /*@error=OverrideTypeMismatchParameter*/ x) {}
+ void f4(B x) {} // Not covariant
+ void f5(covariant String x) {}
void f6(covariant A x) {} // Always ok
}
diff --git a/front_end/testcases/override_check_with_covariant_modifier.dart.strong.expect b/front_end/testcases/override_check_with_covariant_modifier.dart.strong.expect
index d008fb9..25f16c4 100644
--- a/front_end/testcases/override_check_with_covariant_modifier.dart.strong.expect
+++ b/front_end/testcases/override_check_with_covariant_modifier.dart.strong.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:25:69: Error: The parameter 'x' of the method 'D.f5' has type 'String', which does not match the corresponding type, 'A', in the overridden method, 'C.f5'.
+// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:23:28: Error: The parameter 'x' of the method 'D.f5' has type 'String', which does not match the corresponding type, 'A', in the overridden method, 'C.f5'.
// - 'A' is from 'pkg/front_end/testcases/override_check_with_covariant_modifier.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f5(covariant String /*@error=OverrideTypeMismatchParameter*/ x) {}
-// ^
-// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:16:8: Context: This is the overridden method ('f5').
+// void f5(covariant String x) {}
+// ^
+// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:14:8: Context: This is the overridden method ('f5').
// void f5(covariant A x) {}
// ^
//
-// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:24:54: Error: The parameter 'x' of the method 'D.f4' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f4'.
+// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:22:13: Error: The parameter 'x' of the method 'D.f4' has type 'B', which does not match the corresponding type, 'A', in the overridden method, 'C.f4'.
// - 'B' is from 'pkg/front_end/testcases/override_check_with_covariant_modifier.dart'.
// - 'A' is from 'pkg/front_end/testcases/override_check_with_covariant_modifier.dart'.
// Change to a supertype of 'A', or, for a covariant parameter, a subtype.
-// void f4(B /*@error=OverrideTypeMismatchParameter*/ x) {} // Not covariant
-// ^
-// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:15:8: Context: This is the overridden method ('f4').
+// void f4(B x) {} // Not covariant
+// ^
+// pkg/front_end/testcases/override_check_with_covariant_modifier.dart:13:8: Context: This is the overridden method ('f4').
// void f4(A x) {}
// ^
//
diff --git a/front_end/testcases/part_not_part_of.dart.legacy.expect b/front_end/testcases/part_not_part_of.dart.legacy.expect
index a057f8b..b9dac32 100644
--- a/front_end/testcases/part_not_part_of.dart.legacy.expect
+++ b/front_end/testcases/part_not_part_of.dart.legacy.expect
@@ -17,7 +17,7 @@
library;
import self as self2;
-import "./part_not_part_of_lib1.dart" as par;
+import "part_not_part_of_lib1.dart" as par;
import "org-dartlang-testcase:///part_not_part_of_lib1.dart";
diff --git a/front_end/testcases/part_not_part_of.dart.legacy.transformed.expect b/front_end/testcases/part_not_part_of.dart.legacy.transformed.expect
index a057f8b..b9dac32 100644
--- a/front_end/testcases/part_not_part_of.dart.legacy.transformed.expect
+++ b/front_end/testcases/part_not_part_of.dart.legacy.transformed.expect
@@ -17,7 +17,7 @@
library;
import self as self2;
-import "./part_not_part_of_lib1.dart" as par;
+import "part_not_part_of_lib1.dart" as par;
import "org-dartlang-testcase:///part_not_part_of_lib1.dart";
diff --git a/front_end/testcases/part_not_part_of.dart.strong.expect b/front_end/testcases/part_not_part_of.dart.strong.expect
index a057f8b..b9dac32 100644
--- a/front_end/testcases/part_not_part_of.dart.strong.expect
+++ b/front_end/testcases/part_not_part_of.dart.strong.expect
@@ -17,7 +17,7 @@
library;
import self as self2;
-import "./part_not_part_of_lib1.dart" as par;
+import "part_not_part_of_lib1.dart" as par;
import "org-dartlang-testcase:///part_not_part_of_lib1.dart";
diff --git a/front_end/testcases/part_not_part_of.dart.strong.transformed.expect b/front_end/testcases/part_not_part_of.dart.strong.transformed.expect
index a057f8b..b9dac32 100644
--- a/front_end/testcases/part_not_part_of.dart.strong.transformed.expect
+++ b/front_end/testcases/part_not_part_of.dart.strong.transformed.expect
@@ -17,7 +17,7 @@
library;
import self as self2;
-import "./part_not_part_of_lib1.dart" as par;
+import "part_not_part_of_lib1.dart" as par;
import "org-dartlang-testcase:///part_not_part_of_lib1.dart";
diff --git a/front_end/testcases/private_method_tearoff.dart.legacy.expect b/front_end/testcases/private_method_tearoff.dart.legacy.expect
index 2355e10..3e521af 100644
--- a/front_end/testcases/private_method_tearoff.dart.legacy.expect
+++ b/front_end/testcases/private_method_tearoff.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./private_method_tearoff_lib.dart" as pri;
+import "private_method_tearoff_lib.dart" as pri;
import "org-dartlang-testcase:///private_method_tearoff_lib.dart";
diff --git a/front_end/testcases/private_method_tearoff.dart.legacy.transformed.expect b/front_end/testcases/private_method_tearoff.dart.legacy.transformed.expect
index 2355e10..3e521af 100644
--- a/front_end/testcases/private_method_tearoff.dart.legacy.transformed.expect
+++ b/front_end/testcases/private_method_tearoff.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./private_method_tearoff_lib.dart" as pri;
+import "private_method_tearoff_lib.dart" as pri;
import "org-dartlang-testcase:///private_method_tearoff_lib.dart";
diff --git a/front_end/testcases/private_method_tearoff.dart.outline.expect b/front_end/testcases/private_method_tearoff.dart.outline.expect
index d1c7b20..dc1a5ae 100644
--- a/front_end/testcases/private_method_tearoff.dart.outline.expect
+++ b/front_end/testcases/private_method_tearoff.dart.outline.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./private_method_tearoff_lib.dart" as pri;
+import "private_method_tearoff_lib.dart" as pri;
import "org-dartlang-testcase:///private_method_tearoff_lib.dart";
diff --git a/front_end/testcases/private_method_tearoff.dart.strong.expect b/front_end/testcases/private_method_tearoff.dart.strong.expect
index cb76ba8..1422ece 100644
--- a/front_end/testcases/private_method_tearoff.dart.strong.expect
+++ b/front_end/testcases/private_method_tearoff.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./private_method_tearoff_lib.dart" as pri;
+import "private_method_tearoff_lib.dart" as pri;
import "org-dartlang-testcase:///private_method_tearoff_lib.dart";
diff --git a/front_end/testcases/private_method_tearoff.dart.strong.transformed.expect b/front_end/testcases/private_method_tearoff.dart.strong.transformed.expect
index cb76ba8..1422ece 100644
--- a/front_end/testcases/private_method_tearoff.dart.strong.transformed.expect
+++ b/front_end/testcases/private_method_tearoff.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./private_method_tearoff_lib.dart" as pri;
+import "private_method_tearoff_lib.dart" as pri;
import "org-dartlang-testcase:///private_method_tearoff_lib.dart";
diff --git a/front_end/testcases/public_method_tearoff.dart.legacy.expect b/front_end/testcases/public_method_tearoff.dart.legacy.expect
index f4aa6fe..4e942b2 100644
--- a/front_end/testcases/public_method_tearoff.dart.legacy.expect
+++ b/front_end/testcases/public_method_tearoff.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./public_method_tearoff_lib.dart" as pub;
+import "public_method_tearoff_lib.dart" as pub;
import "org-dartlang-testcase:///public_method_tearoff_lib.dart";
diff --git a/front_end/testcases/public_method_tearoff.dart.legacy.transformed.expect b/front_end/testcases/public_method_tearoff.dart.legacy.transformed.expect
index f4aa6fe..4e942b2 100644
--- a/front_end/testcases/public_method_tearoff.dart.legacy.transformed.expect
+++ b/front_end/testcases/public_method_tearoff.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./public_method_tearoff_lib.dart" as pub;
+import "public_method_tearoff_lib.dart" as pub;
import "org-dartlang-testcase:///public_method_tearoff_lib.dart";
diff --git a/front_end/testcases/public_method_tearoff.dart.outline.expect b/front_end/testcases/public_method_tearoff.dart.outline.expect
index 2df3cac..7648db6 100644
--- a/front_end/testcases/public_method_tearoff.dart.outline.expect
+++ b/front_end/testcases/public_method_tearoff.dart.outline.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./public_method_tearoff_lib.dart" as pub;
+import "public_method_tearoff_lib.dart" as pub;
import "org-dartlang-testcase:///public_method_tearoff_lib.dart";
diff --git a/front_end/testcases/public_method_tearoff.dart.strong.expect b/front_end/testcases/public_method_tearoff.dart.strong.expect
index a7c45ab..32ce75e 100644
--- a/front_end/testcases/public_method_tearoff.dart.strong.expect
+++ b/front_end/testcases/public_method_tearoff.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./public_method_tearoff_lib.dart" as pub;
+import "public_method_tearoff_lib.dart" as pub;
import "org-dartlang-testcase:///public_method_tearoff_lib.dart";
diff --git a/front_end/testcases/public_method_tearoff.dart.strong.transformed.expect b/front_end/testcases/public_method_tearoff.dart.strong.transformed.expect
index a7c45ab..32ce75e 100644
--- a/front_end/testcases/public_method_tearoff.dart.strong.transformed.expect
+++ b/front_end/testcases/public_method_tearoff.dart.strong.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./public_method_tearoff_lib.dart" as pub;
+import "public_method_tearoff_lib.dart" as pub;
import "org-dartlang-testcase:///public_method_tearoff_lib.dart";
diff --git a/front_end/testcases/qualified.dart.legacy.expect b/front_end/testcases/qualified.dart.legacy.expect
index 9abbf6a..bd70509 100644
--- a/front_end/testcases/qualified.dart.legacy.expect
+++ b/front_end/testcases/qualified.dart.legacy.expect
@@ -23,7 +23,7 @@
//
import self as self;
import "dart:core" as core;
-import "./qualified_lib.dart" as lib;
+import "qualified_lib.dart" as lib;
import "org-dartlang-testcase:///qualified_lib.dart" as lib;
@@ -73,7 +73,7 @@
library test.qualified.lib;
import self as lib;
import "dart:core" as core;
-import "./qualified.dart" as self;
+import "qualified.dart" as self;
import "org-dartlang-testcase:///qualified.dart" as main;
diff --git a/front_end/testcases/qualified.dart.legacy.transformed.expect b/front_end/testcases/qualified.dart.legacy.transformed.expect
index 6f18b56..df06d18 100644
--- a/front_end/testcases/qualified.dart.legacy.transformed.expect
+++ b/front_end/testcases/qualified.dart.legacy.transformed.expect
@@ -23,7 +23,7 @@
//
import self as self;
import "dart:core" as core;
-import "./qualified_lib.dart" as lib;
+import "qualified_lib.dart" as lib;
import "org-dartlang-testcase:///qualified_lib.dart" as lib;
@@ -76,7 +76,7 @@
library test.qualified.lib;
import self as lib;
import "dart:core" as core;
-import "./qualified.dart" as self;
+import "qualified.dart" as self;
import "org-dartlang-testcase:///qualified.dart" as main;
diff --git a/front_end/testcases/qualified.dart.outline.expect b/front_end/testcases/qualified.dart.outline.expect
index a8b09cd..0fca5f9 100644
--- a/front_end/testcases/qualified.dart.outline.expect
+++ b/front_end/testcases/qualified.dart.outline.expect
@@ -23,7 +23,7 @@
//
import self as self;
import "dart:core" as core;
-import "./qualified_lib.dart" as lib;
+import "qualified_lib.dart" as lib;
import "org-dartlang-testcase:///qualified_lib.dart" as lib;
@@ -62,7 +62,7 @@
library test.qualified.lib;
import self as lib;
import "dart:core" as core;
-import "./qualified.dart" as self;
+import "qualified.dart" as self;
import "org-dartlang-testcase:///qualified.dart" as main;
diff --git a/front_end/testcases/qualified.dart.strong.expect b/front_end/testcases/qualified.dart.strong.expect
index 2844fc6..9bc943f 100644
--- a/front_end/testcases/qualified.dart.strong.expect
+++ b/front_end/testcases/qualified.dart.strong.expect
@@ -23,7 +23,7 @@
//
import self as self;
import "dart:core" as core;
-import "./qualified_lib.dart" as lib;
+import "qualified_lib.dart" as lib;
import "org-dartlang-testcase:///qualified_lib.dart" as lib;
@@ -73,7 +73,7 @@
library test.qualified.lib;
import self as lib;
import "dart:core" as core;
-import "./qualified.dart" as self;
+import "qualified.dart" as self;
import "org-dartlang-testcase:///qualified.dart" as main;
diff --git a/front_end/testcases/qualified.dart.strong.transformed.expect b/front_end/testcases/qualified.dart.strong.transformed.expect
index 807fc74..197c0d8 100644
--- a/front_end/testcases/qualified.dart.strong.transformed.expect
+++ b/front_end/testcases/qualified.dart.strong.transformed.expect
@@ -23,7 +23,7 @@
//
import self as self;
import "dart:core" as core;
-import "./qualified_lib.dart" as lib;
+import "qualified_lib.dart" as lib;
import "org-dartlang-testcase:///qualified_lib.dart" as lib;
@@ -76,7 +76,7 @@
library test.qualified.lib;
import self as lib;
import "dart:core" as core;
-import "./qualified.dart" as self;
+import "qualified.dart" as self;
import "org-dartlang-testcase:///qualified.dart" as main;
diff --git a/front_end/testcases/rasta/bad_default_constructor.dart.strong.expect b/front_end/testcases/rasta/bad_default_constructor.dart.strong.expect
new file mode 100644
index 0000000..8ea402c
--- /dev/null
+++ b/front_end/testcases/rasta/bad_default_constructor.dart.strong.expect
@@ -0,0 +1,33 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/rasta/bad_default_constructor.dart:13:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const B();
+// ^
+//
+// pkg/front_end/testcases/rasta/bad_default_constructor.dart:9:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments.
+// class B extends A {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ constructor •(dynamic x) → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : invalid-initializer
+ ;
+}
+static method main() → dynamic {
+ new self::B::•();
+ invalid-expression "pkg/front_end/testcases/rasta/bad_default_constructor.dart:13:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const B();
+ ^";
+}
diff --git a/front_end/testcases/rasta/bad_default_constructor.dart.strong.transformed.expect b/front_end/testcases/rasta/bad_default_constructor.dart.strong.transformed.expect
new file mode 100644
index 0000000..8ea402c
--- /dev/null
+++ b/front_end/testcases/rasta/bad_default_constructor.dart.strong.transformed.expect
@@ -0,0 +1,33 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/rasta/bad_default_constructor.dart:13:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const B();
+// ^
+//
+// pkg/front_end/testcases/rasta/bad_default_constructor.dart:9:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments.
+// class B extends A {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ constructor •(dynamic x) → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : invalid-initializer
+ ;
+}
+static method main() → dynamic {
+ new self::B::•();
+ invalid-expression "pkg/front_end/testcases/rasta/bad_default_constructor.dart:13:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const B();
+ ^";
+}
diff --git a/front_end/testcases/rasta/export.dart.legacy.expect b/front_end/testcases/rasta/export.dart.legacy.expect
index 467d2a4..b0410f4 100644
--- a/front_end/testcases/rasta/export.dart.legacy.expect
+++ b/front_end/testcases/rasta/export.dart.legacy.expect
@@ -1,6 +1,6 @@
library export;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/export.dart.legacy.transformed.expect b/front_end/testcases/rasta/export.dart.legacy.transformed.expect
index 467d2a4..b0410f4 100644
--- a/front_end/testcases/rasta/export.dart.legacy.transformed.expect
+++ b/front_end/testcases/rasta/export.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library export;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/export.dart.outline.expect b/front_end/testcases/rasta/export.dart.outline.expect
index 7c8cd4d..2314e9e 100644
--- a/front_end/testcases/rasta/export.dart.outline.expect
+++ b/front_end/testcases/rasta/export.dart.outline.expect
@@ -1,6 +1,6 @@
library export;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/export.dart.strong.expect b/front_end/testcases/rasta/export.dart.strong.expect
index 467d2a4..b0410f4 100644
--- a/front_end/testcases/rasta/export.dart.strong.expect
+++ b/front_end/testcases/rasta/export.dart.strong.expect
@@ -1,6 +1,6 @@
library export;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/export.dart.strong.transformed.expect b/front_end/testcases/rasta/export.dart.strong.transformed.expect
index 467d2a4..b0410f4 100644
--- a/front_end/testcases/rasta/export.dart.strong.transformed.expect
+++ b/front_end/testcases/rasta/export.dart.strong.transformed.expect
@@ -1,6 +1,6 @@
library export;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/import_export.dart.legacy.expect b/front_end/testcases/rasta/import_export.dart.legacy.expect
index 33c77ad..e4794e6 100644
--- a/front_end/testcases/rasta/import_export.dart.legacy.expect
+++ b/front_end/testcases/rasta/import_export.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
import "org-dartlang-testcase:///export.dart";
@@ -10,7 +10,7 @@
library export;
import self as self2;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/import_export.dart.legacy.transformed.expect b/front_end/testcases/rasta/import_export.dart.legacy.transformed.expect
index 33c77ad..e4794e6 100644
--- a/front_end/testcases/rasta/import_export.dart.legacy.transformed.expect
+++ b/front_end/testcases/rasta/import_export.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
import "org-dartlang-testcase:///export.dart";
@@ -10,7 +10,7 @@
library export;
import self as self2;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/import_export.dart.outline.expect b/front_end/testcases/rasta/import_export.dart.outline.expect
index d1a411b..42bbbc3 100644
--- a/front_end/testcases/rasta/import_export.dart.outline.expect
+++ b/front_end/testcases/rasta/import_export.dart.outline.expect
@@ -8,7 +8,7 @@
library export;
import self as self2;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/import_export.dart.strong.expect b/front_end/testcases/rasta/import_export.dart.strong.expect
index 33c77ad..e4794e6 100644
--- a/front_end/testcases/rasta/import_export.dart.strong.expect
+++ b/front_end/testcases/rasta/import_export.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
import "org-dartlang-testcase:///export.dart";
@@ -10,7 +10,7 @@
library export;
import self as self2;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/import_export.dart.strong.transformed.expect b/front_end/testcases/rasta/import_export.dart.strong.transformed.expect
index 33c77ad..e4794e6 100644
--- a/front_end/testcases/rasta/import_export.dart.strong.transformed.expect
+++ b/front_end/testcases/rasta/import_export.dart.strong.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
import "org-dartlang-testcase:///export.dart";
@@ -10,7 +10,7 @@
library export;
import self as self2;
-import "./foo.dart" as foo;
+import "foo.dart" as foo;
additionalExports = (foo::foo)
diff --git a/front_end/testcases/rasta/issue_000039.dart.strong.expect b/front_end/testcases/rasta/issue_000039.dart.strong.expect
new file mode 100644
index 0000000..564c718
--- /dev/null
+++ b/front_end/testcases/rasta/issue_000039.dart.strong.expect
@@ -0,0 +1,37 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got '}'.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got ''.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected ';' after this.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:13:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments.
+// class B extends A {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field dynamic a = null;
+ constructor •(dynamic x) → self::A
+ : super core::Object::•() {
+ this.{self::A::a} = invalid-expression "pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got ''.
+ }
+ ^";
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/rasta/issue_000039.dart.strong.transformed.expect b/front_end/testcases/rasta/issue_000039.dart.strong.transformed.expect
new file mode 100644
index 0000000..564c718
--- /dev/null
+++ b/front_end/testcases/rasta/issue_000039.dart.strong.transformed.expect
@@ -0,0 +1,37 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got '}'.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got ''.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected ';' after this.
+// }
+// ^
+//
+// pkg/front_end/testcases/rasta/issue_000039.dart:13:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments.
+// class B extends A {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field dynamic a = null;
+ constructor •(dynamic x) → self::A
+ : super core::Object::•() {
+ this.{self::A::a} = invalid-expression "pkg/front_end/testcases/rasta/issue_000039.dart:10:3: Error: Expected an identifier, but got ''.
+ }
+ ^";
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/rasta/issue_000042.dart.strong.expect b/front_end/testcases/rasta/issue_000042.dart.strong.expect
index 356e6a0..da8f0c6 100644
--- a/front_end/testcases/rasta/issue_000042.dart.strong.expect
+++ b/front_end/testcases/rasta/issue_000042.dart.strong.expect
@@ -34,7 +34,6 @@
^^^";
dynamic x;
dynamic y;
- {}
}
}
#L1:
diff --git a/front_end/testcases/rasta/issue_000042.dart.strong.transformed.expect b/front_end/testcases/rasta/issue_000042.dart.strong.transformed.expect
index 356e6a0..da8f0c6 100644
--- a/front_end/testcases/rasta/issue_000042.dart.strong.transformed.expect
+++ b/front_end/testcases/rasta/issue_000042.dart.strong.transformed.expect
@@ -34,7 +34,6 @@
^^^";
dynamic x;
dynamic y;
- {}
}
}
#L1:
diff --git a/front_end/testcases/rasta/issue_000070.dart.legacy.expect b/front_end/testcases/rasta/issue_000070.dart.legacy.expect
index cb5054f..1deecbc 100644
--- a/front_end/testcases/rasta/issue_000070.dart.legacy.expect
+++ b/front_end/testcases/rasta/issue_000070.dart.legacy.expect
@@ -24,7 +24,7 @@
get getter() → core::List<self::A::U> {
return this.{self::A::field};
}
- set setter(self::A::S s) → void {}
+ set setter(generic-covariant-impl self::A::S s) → void {}
}
abstract class J<Aa extends core::Object = dynamic, B extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::J<self::J::Aa, self::J::B>
diff --git a/front_end/testcases/rasta/issue_000070.dart.legacy.transformed.expect b/front_end/testcases/rasta/issue_000070.dart.legacy.transformed.expect
index 24788b5..6f8f772 100644
--- a/front_end/testcases/rasta/issue_000070.dart.legacy.transformed.expect
+++ b/front_end/testcases/rasta/issue_000070.dart.legacy.transformed.expect
@@ -24,7 +24,7 @@
get getter() → core::List<self::A::U> {
return this.{self::A::field};
}
- set setter(self::A::S s) → void {}
+ set setter(generic-covariant-impl self::A::S s) → void {}
}
abstract class J<Aa extends core::Object = dynamic, B extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::J<self::J::Aa, self::J::B>
diff --git a/front_end/testcases/rasta/issue_000070.dart.outline.expect b/front_end/testcases/rasta/issue_000070.dart.outline.expect
index 3f08fac..89051be 100644
--- a/front_end/testcases/rasta/issue_000070.dart.outline.expect
+++ b/front_end/testcases/rasta/issue_000070.dart.outline.expect
@@ -16,7 +16,7 @@
;
get getter() → core::List<self::A::U>
;
- set setter(self::A::S s) → void
+ set setter(generic-covariant-impl self::A::S s) → void
;
}
abstract class J<Aa extends core::Object = dynamic, B extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/rasta/mixin_library.dart.outline.expect b/front_end/testcases/rasta/mixin_library.dart.outline.expect
index 62d6389..47e7cdf 100644
--- a/front_end/testcases/rasta/mixin_library.dart.outline.expect
+++ b/front_end/testcases/rasta/mixin_library.dart.outline.expect
@@ -6,12 +6,12 @@
field dynamic x;
field dynamic y;
field dynamic z;
- field self::Mixin::T t;
+ generic-covariant-impl field self::Mixin::T t;
synthetic constructor •() → self::Mixin<self::Mixin::T>
;
method foo() → dynamic
;
- method g(self::Mixin::T a) → self::Mixin::T
+ method g(generic-covariant-impl self::Mixin::T a) → self::Mixin::T
;
method h() → dynamic
;
diff --git a/front_end/testcases/rasta/previsit_deferred.dart.legacy.expect b/front_end/testcases/rasta/previsit_deferred.dart.legacy.expect
index a4ac799..0a16b0d 100644
--- a/front_end/testcases/rasta/previsit_deferred.dart.legacy.expect
+++ b/front_end/testcases/rasta/previsit_deferred.dart.legacy.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/rasta/previsit_deferred.dart.legacy.transformed.expect b/front_end/testcases/rasta/previsit_deferred.dart.legacy.transformed.expect
index a4ac799..0a16b0d 100644
--- a/front_end/testcases/rasta/previsit_deferred.dart.legacy.transformed.expect
+++ b/front_end/testcases/rasta/previsit_deferred.dart.legacy.transformed.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/rasta/previsit_deferred.dart.strong.expect b/front_end/testcases/rasta/previsit_deferred.dart.strong.expect
index a4ac799..0a16b0d 100644
--- a/front_end/testcases/rasta/previsit_deferred.dart.strong.expect
+++ b/front_end/testcases/rasta/previsit_deferred.dart.strong.expect
@@ -1,6 +1,6 @@
library;
import self as self;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/rasta/previsit_deferred.dart.strong.transformed.expect b/front_end/testcases/rasta/previsit_deferred.dart.strong.transformed.expect
index 52df70f..601cdae 100644
--- a/front_end/testcases/rasta/previsit_deferred.dart.strong.transformed.expect
+++ b/front_end/testcases/rasta/previsit_deferred.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./deferred_lib.dart" as def;
+import "deferred_lib.dart" as def;
import "org-dartlang-testcase:///deferred_lib.dart" deferred as lib;
diff --git a/front_end/testcases/rasta/super_mixin.dart.legacy.expect b/front_end/testcases/rasta/super_mixin.dart.legacy.expect
index bf05d13..bbd2127 100644
--- a/front_end/testcases/rasta/super_mixin.dart.legacy.expect
+++ b/front_end/testcases/rasta/super_mixin.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./mixin_library.dart" as mix;
+import "mixin_library.dart" as mix;
import "org-dartlang-testcase:///mixin_library.dart";
@@ -64,13 +64,13 @@
field dynamic x = mix::f();
field dynamic y = null;
field dynamic z = null;
- field mix::Mixin::T t = null;
+ generic-covariant-impl field mix::Mixin::T t = null;
synthetic constructor •() → mix::Mixin<mix::Mixin::T>
: super core::Object::•()
;
method foo() → dynamic
return super.foo().+(mix::f());
- method g(mix::Mixin::T a) → mix::Mixin::T
+ method g(generic-covariant-impl mix::Mixin::T a) → mix::Mixin::T
return null;
method h() → dynamic
return mix::V();
diff --git a/front_end/testcases/rasta/super_mixin.dart.legacy.transformed.expect b/front_end/testcases/rasta/super_mixin.dart.legacy.transformed.expect
index f68ab12..90e3685 100644
--- a/front_end/testcases/rasta/super_mixin.dart.legacy.transformed.expect
+++ b/front_end/testcases/rasta/super_mixin.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./mixin_library.dart" as mix;
+import "mixin_library.dart" as mix;
import "org-dartlang-testcase:///mixin_library.dart";
@@ -18,13 +18,13 @@
field dynamic x = mix::f()/* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic y = null /* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic z = null /* from org-dartlang-testcase:///mixin_library.dart */;
- field self::_C&Super&Mixin::V t = null /* from org-dartlang-testcase:///mixin_library.dart */;
+ generic-covariant-impl field self::_C&Super&Mixin::V t = null /* from org-dartlang-testcase:///mixin_library.dart */;
synthetic constructor •() → self::_C&Super&Mixin<self::_C&Super&Mixin::V>
: super self::Super::•()
;
method /* from org-dartlang-testcase:///mixin_library.dart */ foo() → dynamic
return super.foo().+(mix::f());
- method /* from org-dartlang-testcase:///mixin_library.dart */ g(self::_C&Super&Mixin::V a) → self::_C&Super&Mixin::V
+ method /* from org-dartlang-testcase:///mixin_library.dart */ g(generic-covariant-impl self::_C&Super&Mixin::V a) → self::_C&Super&Mixin::V
return null;
method /* from org-dartlang-testcase:///mixin_library.dart */ h() → dynamic
return mix::V();
@@ -44,13 +44,13 @@
field dynamic x = mix::f()/* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic y = null /* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic z = null /* from org-dartlang-testcase:///mixin_library.dart */;
- field dynamic t = null /* from org-dartlang-testcase:///mixin_library.dart */;
+ generic-covariant-impl field dynamic t = null /* from org-dartlang-testcase:///mixin_library.dart */;
synthetic constructor •() → self::_D&Super&Mixin
: super self::Super::•()
;
method /* from org-dartlang-testcase:///mixin_library.dart */ foo() → dynamic
return super.foo().+(mix::f());
- method /* from org-dartlang-testcase:///mixin_library.dart */ g(dynamic a) → dynamic
+ method /* from org-dartlang-testcase:///mixin_library.dart */ g(generic-covariant-impl dynamic a) → dynamic
return null;
method /* from org-dartlang-testcase:///mixin_library.dart */ h() → dynamic
return mix::V();
@@ -70,13 +70,13 @@
field dynamic x = mix::f()/* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic y = null /* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic z = null /* from org-dartlang-testcase:///mixin_library.dart */;
- field self::C2::V t = null /* from org-dartlang-testcase:///mixin_library.dart */;
+ generic-covariant-impl field self::C2::V t = null /* from org-dartlang-testcase:///mixin_library.dart */;
synthetic constructor •() → self::C2<self::C2::V>
: super self::Super::•()
;
method /* from org-dartlang-testcase:///mixin_library.dart */ foo() → dynamic
return super.foo().+(mix::f());
- method /* from org-dartlang-testcase:///mixin_library.dart */ g(self::C2::V a) → self::C2::V
+ method /* from org-dartlang-testcase:///mixin_library.dart */ g(generic-covariant-impl self::C2::V a) → self::C2::V
return null;
method /* from org-dartlang-testcase:///mixin_library.dart */ h() → dynamic
return mix::V();
@@ -91,13 +91,13 @@
field dynamic x = mix::f()/* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic y = null /* from org-dartlang-testcase:///mixin_library.dart */;
field dynamic z = null /* from org-dartlang-testcase:///mixin_library.dart */;
- field dynamic t = null /* from org-dartlang-testcase:///mixin_library.dart */;
+ generic-covariant-impl field dynamic t = null /* from org-dartlang-testcase:///mixin_library.dart */;
synthetic constructor •() → self::D2
: super self::Super::•()
;
method /* from org-dartlang-testcase:///mixin_library.dart */ foo() → dynamic
return super.foo().+(mix::f());
- method /* from org-dartlang-testcase:///mixin_library.dart */ g(dynamic a) → dynamic
+ method /* from org-dartlang-testcase:///mixin_library.dart */ g(generic-covariant-impl dynamic a) → dynamic
return null;
method /* from org-dartlang-testcase:///mixin_library.dart */ h() → dynamic
return mix::V();
@@ -128,13 +128,13 @@
field dynamic x = mix::f();
field dynamic y = null;
field dynamic z = null;
- field mix::Mixin::T t = null;
+ generic-covariant-impl field mix::Mixin::T t = null;
synthetic constructor •() → mix::Mixin<mix::Mixin::T>
: super core::Object::•()
;
method foo() → dynamic
return super.foo().+(mix::f());
- method g(mix::Mixin::T a) → mix::Mixin::T
+ method g(generic-covariant-impl mix::Mixin::T a) → mix::Mixin::T
return null;
method h() → dynamic
return mix::V();
diff --git a/front_end/testcases/rasta/super_mixin.dart.outline.expect b/front_end/testcases/rasta/super_mixin.dart.outline.expect
index 3463b57..f8efb4c 100644
--- a/front_end/testcases/rasta/super_mixin.dart.outline.expect
+++ b/front_end/testcases/rasta/super_mixin.dart.outline.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./mixin_library.dart" as mix;
+import "mixin_library.dart" as mix;
import "org-dartlang-testcase:///mixin_library.dart";
@@ -52,12 +52,12 @@
field dynamic x;
field dynamic y;
field dynamic z;
- field mix::Mixin::T t;
+ generic-covariant-impl field mix::Mixin::T t;
synthetic constructor •() → mix::Mixin<mix::Mixin::T>
;
method foo() → dynamic
;
- method g(mix::Mixin::T a) → mix::Mixin::T
+ method g(generic-covariant-impl mix::Mixin::T a) → mix::Mixin::T
;
method h() → dynamic
;
diff --git a/front_end/testcases/rasta/super_mixin.dart.strong.expect b/front_end/testcases/rasta/super_mixin.dart.strong.expect
index 5ecf3b5..aba8974 100644
--- a/front_end/testcases/rasta/super_mixin.dart.strong.expect
+++ b/front_end/testcases/rasta/super_mixin.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./mixin_library.dart" as mix;
+import "mixin_library.dart" as mix;
import "org-dartlang-testcase:///mixin_library.dart";
diff --git a/front_end/testcases/redirecting_factory_const_inference.dart.legacy.expect b/front_end/testcases/redirecting_factory_const_inference.dart.legacy.expect
index afbcf0c..97f89e1 100644
--- a/front_end/testcases/redirecting_factory_const_inference.dart.legacy.expect
+++ b/front_end/testcases/redirecting_factory_const_inference.dart.legacy.expect
@@ -13,7 +13,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_X<self::A::T> x;
+ generic-covariant-impl field self::_X<self::A::T> x;
constructor •(self::_X<self::A::T> x) → self::A<self::A::T>
: self::A::x = x, super core::Object::•()
;
diff --git a/front_end/testcases/redirecting_factory_const_inference.dart.legacy.transformed.expect b/front_end/testcases/redirecting_factory_const_inference.dart.legacy.transformed.expect
index afbcf0c..97f89e1 100644
--- a/front_end/testcases/redirecting_factory_const_inference.dart.legacy.transformed.expect
+++ b/front_end/testcases/redirecting_factory_const_inference.dart.legacy.transformed.expect
@@ -13,7 +13,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_X<self::A::T> x;
+ generic-covariant-impl field self::_X<self::A::T> x;
constructor •(self::_X<self::A::T> x) → self::A<self::A::T>
: self::A::x = x, super core::Object::•()
;
diff --git a/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect b/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect
index a111baf..25ec287 100644
--- a/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect
+++ b/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect
@@ -12,7 +12,7 @@
;
}
class A<T extends core::Object = dynamic> extends core::Object {
- field self::_X<self::A::T> x;
+ generic-covariant-impl field self::_X<self::A::T> x;
constructor •(self::_X<self::A::T> x) → self::A<self::A::T>
;
}
diff --git a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.expect b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.expect
index dd1e103..f3bfb14 100644
--- a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.expect
@@ -8,7 +8,7 @@
;
}
class Foo<T extends self::X = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor fromX(self::X _init) → self::Foo<self::Foo::T>
: this self::Foo::_internal(x: _init)
;
diff --git a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.transformed.expect b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.transformed.expect
index dd1e103..f3bfb14 100644
--- a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.transformed.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.legacy.transformed.expect
@@ -8,7 +8,7 @@
;
}
class Foo<T extends self::X = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor fromX(self::X _init) → self::Foo<self::Foo::T>
: this self::Foo::_internal(x: _init)
;
diff --git a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.outline.expect b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.outline.expect
index fdfee1c..ba06dee 100644
--- a/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.outline.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.outline.expect
@@ -7,7 +7,7 @@
;
}
class Foo<T extends self::X = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor fromX(self::X _init) → self::Foo<self::Foo::T>
;
constructor fromT(self::Foo::T _init) → self::Foo<self::Foo::T>
diff --git a/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.expect b/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.expect
index c18e8e1..b36d718 100644
--- a/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Foo<T extends core::Object = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor from(core::String _init) → self::Foo<self::Foo::T>
: this self::Foo::_internal(x: _init)
;
diff --git a/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.transformed.expect b/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.transformed.expect
index c18e8e1..b36d718 100644
--- a/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.transformed.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_test.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Foo<T extends core::Object = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor from(core::String _init) → self::Foo<self::Foo::T>
: this self::Foo::_internal(x: _init)
;
diff --git a/front_end/testcases/redirecting_initializer_arguments_test.dart.outline.expect b/front_end/testcases/redirecting_initializer_arguments_test.dart.outline.expect
index 1655fc6..36894d5 100644
--- a/front_end/testcases/redirecting_initializer_arguments_test.dart.outline.expect
+++ b/front_end/testcases/redirecting_initializer_arguments_test.dart.outline.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Foo<T extends core::Object = dynamic> extends core::Object {
- field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor from(core::String _init) → self::Foo<self::Foo::T>
;
constructor _internal({self::Foo::T x}) → self::Foo<self::Foo::T>
diff --git a/front_end/testcases/regress/issue_31155.dart.legacy.expect b/front_end/testcases/regress/issue_31155.dart.legacy.expect
index 8130bfc..35b1ddf 100644
--- a/front_end/testcases/regress/issue_31155.dart.legacy.expect
+++ b/front_end/testcases/regress/issue_31155.dart.legacy.expect
@@ -6,7 +6,7 @@
// var f = Map<A, B> {};
// ^
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceded by the keyword 'operator'.
// Try adding the keyword 'operator'.
// var f = Map<A, B> {};
// ^
diff --git a/front_end/testcases/regress/issue_31155.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_31155.dart.legacy.transformed.expect
index 8130bfc..35b1ddf 100644
--- a/front_end/testcases/regress/issue_31155.dart.legacy.transformed.expect
+++ b/front_end/testcases/regress/issue_31155.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
// var f = Map<A, B> {};
// ^
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceded by the keyword 'operator'.
// Try adding the keyword 'operator'.
// var f = Map<A, B> {};
// ^
diff --git a/front_end/testcases/regress/issue_31155.dart.outline.expect b/front_end/testcases/regress/issue_31155.dart.outline.expect
index 31866e5..368d30d 100644
--- a/front_end/testcases/regress/issue_31155.dart.outline.expect
+++ b/front_end/testcases/regress/issue_31155.dart.outline.expect
@@ -6,7 +6,7 @@
// var f = Map<A, B> {};
// ^
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceded by the keyword 'operator'.
// Try adding the keyword 'operator'.
// var f = Map<A, B> {};
// ^
diff --git a/front_end/testcases/regress/issue_31155.dart.strong.expect b/front_end/testcases/regress/issue_31155.dart.strong.expect
index f9e661a..e6f0d60 100644
--- a/front_end/testcases/regress/issue_31155.dart.strong.expect
+++ b/front_end/testcases/regress/issue_31155.dart.strong.expect
@@ -6,7 +6,7 @@
// var f = Map<A, B> {};
// ^
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceded by the keyword 'operator'.
// Try adding the keyword 'operator'.
// var f = Map<A, B> {};
// ^
diff --git a/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect b/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
index f9e661a..e6f0d60 100644
--- a/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
+++ b/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
// var f = Map<A, B> {};
// ^
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceded by the keyword 'operator'.
// Try adding the keyword 'operator'.
// var f = Map<A, B> {};
// ^
diff --git a/front_end/testcases/regress/issue_32200.dart.strong.expect b/front_end/testcases/regress/issue_32200.dart.strong.expect
index 3316d53..667cb8d 100644
--- a/front_end/testcases/regress/issue_32200.dart.strong.expect
+++ b/front_end/testcases/regress/issue_32200.dart.strong.expect
@@ -6,12 +6,6 @@
// self.Foo self;
// ^^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_32200.dart:13:19: Error: A value of type 'Foo' can't be assigned to a variable of type 'invalid-type'.
-// - 'Foo' is from 'pkg/front_end/testcases/regress/issue_32200.dart'.
-// Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
-// instance.self = instance;
-// ^
-//
import self as self;
import "dart:core" as core;
@@ -25,9 +19,5 @@
}
static method main() → dynamic {
self::Foo instance = new self::Foo::•();
- instance.{self::Foo::self} = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_32200.dart:13:19: Error: A value of type 'Foo' can't be assigned to a variable of type 'invalid-type'.
- - 'Foo' is from 'pkg/front_end/testcases/regress/issue_32200.dart'.
-Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
- instance.self = instance;
- ^" in instance as{TypeError} invalid-type;
+ instance.{self::Foo::self} = instance as{TypeError} invalid-type;
}
diff --git a/front_end/testcases/regress/issue_32200.dart.strong.transformed.expect b/front_end/testcases/regress/issue_32200.dart.strong.transformed.expect
index 3316d53..667cb8d 100644
--- a/front_end/testcases/regress/issue_32200.dart.strong.transformed.expect
+++ b/front_end/testcases/regress/issue_32200.dart.strong.transformed.expect
@@ -6,12 +6,6 @@
// self.Foo self;
// ^^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_32200.dart:13:19: Error: A value of type 'Foo' can't be assigned to a variable of type 'invalid-type'.
-// - 'Foo' is from 'pkg/front_end/testcases/regress/issue_32200.dart'.
-// Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
-// instance.self = instance;
-// ^
-//
import self as self;
import "dart:core" as core;
@@ -25,9 +19,5 @@
}
static method main() → dynamic {
self::Foo instance = new self::Foo::•();
- instance.{self::Foo::self} = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_32200.dart:13:19: Error: A value of type 'Foo' can't be assigned to a variable of type 'invalid-type'.
- - 'Foo' is from 'pkg/front_end/testcases/regress/issue_32200.dart'.
-Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
- instance.self = instance;
- ^" in instance as{TypeError} invalid-type;
+ instance.{self::Foo::self} = instance as{TypeError} invalid-type;
}
diff --git a/front_end/testcases/regress/issue_34291.dart.legacy.expect b/front_end/testcases/regress/issue_34291.dart.legacy.expect
index b75366e..16fd29e 100644
--- a/front_end/testcases/regress/issue_34291.dart.legacy.expect
+++ b/front_end/testcases/regress/issue_34291.dart.legacy.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./issue_34291_lib.dart" as iss;
+import "issue_34291_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34291_lib.dart" as lib;
diff --git a/front_end/testcases/regress/issue_34291.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_34291.dart.legacy.transformed.expect
index b75366e..16fd29e 100644
--- a/front_end/testcases/regress/issue_34291.dart.legacy.transformed.expect
+++ b/front_end/testcases/regress/issue_34291.dart.legacy.transformed.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./issue_34291_lib.dart" as iss;
+import "issue_34291_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34291_lib.dart" as lib;
diff --git a/front_end/testcases/regress/issue_34291.dart.outline.expect b/front_end/testcases/regress/issue_34291.dart.outline.expect
index a72a23c..7e0d3a3 100644
--- a/front_end/testcases/regress/issue_34291.dart.outline.expect
+++ b/front_end/testcases/regress/issue_34291.dart.outline.expect
@@ -1,7 +1,7 @@
library;
import self as self;
import "dart:core" as core;
-import "./issue_34291_lib.dart" as iss;
+import "issue_34291_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34291_lib.dart" as lib;
diff --git a/front_end/testcases/regress/issue_34403.dart.legacy.expect b/front_end/testcases/regress/issue_34403.dart.legacy.expect
index 4bc0e99..6411f4c 100644
--- a/front_end/testcases/regress/issue_34403.dart.legacy.expect
+++ b/front_end/testcases/regress/issue_34403.dart.legacy.expect
@@ -84,7 +84,7 @@
//
import self as self;
import "dart:core" as core;
-import "./issue_34403_lib.dart" as iss;
+import "issue_34403_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34403_lib.dart" as p;
diff --git a/front_end/testcases/regress/issue_34403.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_34403.dart.legacy.transformed.expect
index 4bc0e99..6411f4c 100644
--- a/front_end/testcases/regress/issue_34403.dart.legacy.transformed.expect
+++ b/front_end/testcases/regress/issue_34403.dart.legacy.transformed.expect
@@ -84,7 +84,7 @@
//
import self as self;
import "dart:core" as core;
-import "./issue_34403_lib.dart" as iss;
+import "issue_34403_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34403_lib.dart" as p;
diff --git a/front_end/testcases/regress/issue_34403.dart.strong.expect b/front_end/testcases/regress/issue_34403.dart.strong.expect
index 67776e6..ae029a9 100644
--- a/front_end/testcases/regress/issue_34403.dart.strong.expect
+++ b/front_end/testcases/regress/issue_34403.dart.strong.expect
@@ -84,7 +84,7 @@
//
import self as self;
import "dart:core" as core;
-import "./issue_34403_lib.dart" as iss;
+import "issue_34403_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34403_lib.dart" as p;
diff --git a/front_end/testcases/regress/issue_34403.dart.strong.transformed.expect b/front_end/testcases/regress/issue_34403.dart.strong.transformed.expect
index 67776e6..ae029a9 100644
--- a/front_end/testcases/regress/issue_34403.dart.strong.transformed.expect
+++ b/front_end/testcases/regress/issue_34403.dart.strong.transformed.expect
@@ -84,7 +84,7 @@
//
import self as self;
import "dart:core" as core;
-import "./issue_34403_lib.dart" as iss;
+import "issue_34403_lib.dart" as iss;
import "org-dartlang-testcase:///issue_34403_lib.dart" as p;
diff --git a/front_end/testcases/regress/issue_36400.dart b/front_end/testcases/regress/issue_36400.dart
new file mode 100644
index 0000000..33c29d6
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2019, 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 Test {
+ Test factory Test() {
+ return null;
+ }
+}
+
diff --git a/front_end/testcases/regress/issue_36400.dart.hierarchy.expect b/front_end/testcases/regress/issue_36400.dart.hierarchy.expect
new file mode 100644
index 0000000..6dc337c
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.hierarchy.expect
@@ -0,0 +1,36 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+Test:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
diff --git a/front_end/testcases/regress/issue_36400.dart.legacy.expect b/front_end/testcases/regress/issue_36400.dart.legacy.expect
new file mode 100644
index 0000000..e63b720
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.legacy.expect
@@ -0,0 +1,17 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36400.dart:6:3: Error: Factory constructors cannot have a return type.
+// Try removing the type appearing before 'factory'.
+// Test factory Test() {
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class Test extends core::Object {
+ static factory •() → self::Test {
+ return null;
+ }
+}
diff --git a/front_end/testcases/regress/issue_36400.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_36400.dart.legacy.transformed.expect
new file mode 100644
index 0000000..e63b720
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.legacy.transformed.expect
@@ -0,0 +1,17 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36400.dart:6:3: Error: Factory constructors cannot have a return type.
+// Try removing the type appearing before 'factory'.
+// Test factory Test() {
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class Test extends core::Object {
+ static factory •() → self::Test {
+ return null;
+ }
+}
diff --git a/front_end/testcases/regress/issue_36400.dart.outline.expect b/front_end/testcases/regress/issue_36400.dart.outline.expect
new file mode 100644
index 0000000..2f39e53
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36400.dart:6:3: Error: Factory constructors cannot have a return type.
+// Try removing the type appearing before 'factory'.
+// Test factory Test() {
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class Test extends core::Object {
+ static factory •() → self::Test
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36400.dart.strong.expect b/front_end/testcases/regress/issue_36400.dart.strong.expect
new file mode 100644
index 0000000..e63b720
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.strong.expect
@@ -0,0 +1,17 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36400.dart:6:3: Error: Factory constructors cannot have a return type.
+// Try removing the type appearing before 'factory'.
+// Test factory Test() {
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class Test extends core::Object {
+ static factory •() → self::Test {
+ return null;
+ }
+}
diff --git a/front_end/testcases/regress/issue_36400.dart.strong.transformed.expect b/front_end/testcases/regress/issue_36400.dart.strong.transformed.expect
new file mode 100644
index 0000000..e63b720
--- /dev/null
+++ b/front_end/testcases/regress/issue_36400.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36400.dart:6:3: Error: Factory constructors cannot have a return type.
+// Try removing the type appearing before 'factory'.
+// Test factory Test() {
+// ^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class Test extends core::Object {
+ static factory •() → self::Test {
+ return null;
+ }
+}
diff --git a/front_end/testcases/regress/issue_36647.dart b/front_end/testcases/regress/issue_36647.dart
new file mode 100644
index 0000000..3fcff27
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2019, 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 'issue_36647_lib1.dart';
diff --git a/front_end/testcases/regress/issue_36647.dart.hierarchy.expect b/front_end/testcases/regress/issue_36647.dart.hierarchy.expect
new file mode 100644
index 0000000..f111e00
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.hierarchy.expect
@@ -0,0 +1,36 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+xxx:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
diff --git a/front_end/testcases/regress/issue_36647.dart.legacy.expect b/front_end/testcases/regress/issue_36647.dart.legacy.expect
new file mode 100644
index 0000000..9199ba0
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.legacy.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///issue_36647_lib1.dart";
+
+
+library;
+import self as self2;
+import "issue_36647_lib2.dart" as iss;
+additionalExports = (iss::xxx)
+, iss::XXX)
+, iss::extends)
+
+
+export "org-dartlang-testcase:///issue_36647_lib2.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Expected a class or mixin body, but got 'xx'.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+// Try adding the name of the type of the variable or the keyword 'var'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected an identifier, but got 'extends'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: 'XXX' is already declared in this scope.
+// class xxx xx XXX extends XXX {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Context: Previous declaration of 'XXX'.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Warning: Type 'xx' not found.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Warning: 'xx' isn't a type.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+import self as iss;
+import "dart:core" as core;
+
+class xxx extends core::Object {
+ synthetic constructor •() → iss::xxx
+ : super core::Object::•()
+ ;
+}
+static field invalid-type XXX;
+static field dynamic extends;
diff --git a/front_end/testcases/regress/issue_36647.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_36647.dart.legacy.transformed.expect
new file mode 100644
index 0000000..9199ba0
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.legacy.transformed.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///issue_36647_lib1.dart";
+
+
+library;
+import self as self2;
+import "issue_36647_lib2.dart" as iss;
+additionalExports = (iss::xxx)
+, iss::XXX)
+, iss::extends)
+
+
+export "org-dartlang-testcase:///issue_36647_lib2.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Expected a class or mixin body, but got 'xx'.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+// Try adding the name of the type of the variable or the keyword 'var'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected an identifier, but got 'extends'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: 'XXX' is already declared in this scope.
+// class xxx xx XXX extends XXX {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Context: Previous declaration of 'XXX'.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Warning: Type 'xx' not found.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Warning: 'xx' isn't a type.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+import self as iss;
+import "dart:core" as core;
+
+class xxx extends core::Object {
+ synthetic constructor •() → iss::xxx
+ : super core::Object::•()
+ ;
+}
+static field invalid-type XXX;
+static field dynamic extends;
diff --git a/front_end/testcases/regress/issue_36647.dart.outline.expect b/front_end/testcases/regress/issue_36647.dart.outline.expect
new file mode 100644
index 0000000..0a38be0
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.outline.expect
@@ -0,0 +1,67 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///issue_36647_lib1.dart";
+
+
+library;
+import self as self2;
+import "issue_36647_lib2.dart" as iss;
+additionalExports = (iss::xxx)
+, iss::XXX)
+, iss::extends)
+
+
+export "org-dartlang-testcase:///issue_36647_lib2.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Expected a class or mixin body, but got 'xx'.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+// Try adding the name of the type of the variable or the keyword 'var'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected an identifier, but got 'extends'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: 'XXX' is already declared in this scope.
+// class xxx xx XXX extends XXX {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Context: Previous declaration of 'XXX'.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Warning: Type 'xx' not found.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+import self as iss;
+import "dart:core" as core;
+
+class xxx extends core::Object {
+ synthetic constructor •() → iss::xxx
+ ;
+}
+static field invalid-type XXX;
+static field dynamic extends;
diff --git a/front_end/testcases/regress/issue_36647.dart.strong.expect b/front_end/testcases/regress/issue_36647.dart.strong.expect
new file mode 100644
index 0000000..2e470e5
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.strong.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///issue_36647_lib1.dart";
+
+
+library;
+import self as self2;
+import "issue_36647_lib2.dart" as iss;
+additionalExports = (iss::xxx)
+, iss::XXX)
+, iss::extends)
+
+
+export "org-dartlang-testcase:///issue_36647_lib2.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Expected a class or mixin body, but got 'xx'.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+// Try adding the name of the type of the variable or the keyword 'var'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected an identifier, but got 'extends'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: 'XXX' is already declared in this scope.
+// class xxx xx XXX extends XXX {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Context: Previous declaration of 'XXX'.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Type 'xx' not found.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: 'xx' isn't a type.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+import self as iss;
+import "dart:core" as core;
+
+class xxx extends core::Object {
+ synthetic constructor •() → iss::xxx
+ : super core::Object::•()
+ ;
+}
+static field invalid-type XXX;
+static field dynamic extends;
diff --git a/front_end/testcases/regress/issue_36647.dart.strong.transformed.expect b/front_end/testcases/regress/issue_36647.dart.strong.transformed.expect
new file mode 100644
index 0000000..2e470e5
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647.dart.strong.transformed.expect
@@ -0,0 +1,72 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///issue_36647_lib1.dart";
+
+
+library;
+import self as self2;
+import "issue_36647_lib2.dart" as iss;
+additionalExports = (iss::xxx)
+, iss::XXX)
+, iss::extends)
+
+
+export "org-dartlang-testcase:///issue_36647_lib2.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Expected a class or mixin body, but got 'xx'.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+// Try adding the name of the type of the variable or the keyword 'var'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected an identifier, but got 'extends'.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:18: Error: Expected ';' after this.
+// class xxx xx XXX extends XXX {
+// ^^^^^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:26: Error: 'XXX' is already declared in this scope.
+// class xxx xx XXX extends XXX {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:14: Context: Previous declaration of 'XXX'.
+// class xxx xx XXX extends XXX {
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: Type 'xx' not found.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+// pkg/front_end/testcases/regress/issue_36647_lib2.dart:5:11: Error: 'xx' isn't a type.
+// class xxx xx XXX extends XXX {
+// ^^
+//
+import self as iss;
+import "dart:core" as core;
+
+class xxx extends core::Object {
+ synthetic constructor •() → iss::xxx
+ : super core::Object::•()
+ ;
+}
+static field invalid-type XXX;
+static field dynamic extends;
diff --git a/front_end/testcases/regress/issue_36647_2.dart b/front_end/testcases/regress/issue_36647_2.dart
new file mode 100644
index 0000000..4096e59
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2019, 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.
+
+export 'issue_36647_2_lib1.dart';
diff --git a/front_end/testcases/regress/issue_36647_2.dart.legacy.expect b/front_end/testcases/regress/issue_36647_2.dart.legacy.expect
new file mode 100644
index 0000000..e040789
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart.legacy.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "issue_36647_2_lib1.dart" as iss;
+additionalExports = (iss::foo)
+, iss::bar)
+, iss::baz)
+
+
+export "org-dartlang-testcase:///issue_36647_2_lib1.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:6:5: Error: 'foo' is already declared in this scope.
+// int foo = 43;
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:5:5: Context: Previous declaration of 'foo'.
+// int foo = 42;
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:8:14: Error: 'bar' is already declared in this scope.
+// typedef bool bar();
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:7:14: Context: Previous declaration of 'bar'.
+// typedef bool bar();
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:13:5: Error: 'baz' is already declared in this scope.
+// int baz() {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:9:5: Context: Previous declaration of 'baz'.
+// int baz() {
+// ^^^
+//
+import self as iss;
+import "dart:core" as core;
+
+typedef bar = () → core::bool;
+static field core::int foo;
+static method baz() → core::int {
+ return 42;
+}
diff --git a/front_end/testcases/regress/issue_36647_2.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_36647_2.dart.legacy.transformed.expect
new file mode 100644
index 0000000..e040789
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart.legacy.transformed.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "issue_36647_2_lib1.dart" as iss;
+additionalExports = (iss::foo)
+, iss::bar)
+, iss::baz)
+
+
+export "org-dartlang-testcase:///issue_36647_2_lib1.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:6:5: Error: 'foo' is already declared in this scope.
+// int foo = 43;
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:5:5: Context: Previous declaration of 'foo'.
+// int foo = 42;
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:8:14: Error: 'bar' is already declared in this scope.
+// typedef bool bar();
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:7:14: Context: Previous declaration of 'bar'.
+// typedef bool bar();
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:13:5: Error: 'baz' is already declared in this scope.
+// int baz() {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:9:5: Context: Previous declaration of 'baz'.
+// int baz() {
+// ^^^
+//
+import self as iss;
+import "dart:core" as core;
+
+typedef bar = () → core::bool;
+static field core::int foo;
+static method baz() → core::int {
+ return 42;
+}
diff --git a/front_end/testcases/regress/issue_36647_2.dart.outline.expect b/front_end/testcases/regress/issue_36647_2.dart.outline.expect
new file mode 100644
index 0000000..af81823
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart.outline.expect
@@ -0,0 +1,43 @@
+library;
+import self as self;
+import "issue_36647_2_lib1.dart" as iss;
+additionalExports = (iss::foo)
+, iss::bar)
+, iss::baz)
+
+
+export "org-dartlang-testcase:///issue_36647_2_lib1.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:6:5: Error: 'foo' is already declared in this scope.
+// int foo = 43;
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:5:5: Context: Previous declaration of 'foo'.
+// int foo = 42;
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:8:14: Error: 'bar' is already declared in this scope.
+// typedef bool bar();
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:7:14: Context: Previous declaration of 'bar'.
+// typedef bool bar();
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:13:5: Error: 'baz' is already declared in this scope.
+// int baz() {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:9:5: Context: Previous declaration of 'baz'.
+// int baz() {
+// ^^^
+//
+import self as iss;
+import "dart:core" as core;
+
+typedef bar = () → core::bool;
+static field core::int foo;
+static method baz() → core::int
+ ;
diff --git a/front_end/testcases/regress/issue_36647_2.dart.strong.expect b/front_end/testcases/regress/issue_36647_2.dart.strong.expect
new file mode 100644
index 0000000..e040789
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart.strong.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "issue_36647_2_lib1.dart" as iss;
+additionalExports = (iss::foo)
+, iss::bar)
+, iss::baz)
+
+
+export "org-dartlang-testcase:///issue_36647_2_lib1.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:6:5: Error: 'foo' is already declared in this scope.
+// int foo = 43;
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:5:5: Context: Previous declaration of 'foo'.
+// int foo = 42;
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:8:14: Error: 'bar' is already declared in this scope.
+// typedef bool bar();
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:7:14: Context: Previous declaration of 'bar'.
+// typedef bool bar();
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:13:5: Error: 'baz' is already declared in this scope.
+// int baz() {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:9:5: Context: Previous declaration of 'baz'.
+// int baz() {
+// ^^^
+//
+import self as iss;
+import "dart:core" as core;
+
+typedef bar = () → core::bool;
+static field core::int foo;
+static method baz() → core::int {
+ return 42;
+}
diff --git a/front_end/testcases/regress/issue_36647_2.dart.strong.transformed.expect b/front_end/testcases/regress/issue_36647_2.dart.strong.transformed.expect
new file mode 100644
index 0000000..e040789
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2.dart.strong.transformed.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "issue_36647_2_lib1.dart" as iss;
+additionalExports = (iss::foo)
+, iss::bar)
+, iss::baz)
+
+
+export "org-dartlang-testcase:///issue_36647_2_lib1.dart";
+
+
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:6:5: Error: 'foo' is already declared in this scope.
+// int foo = 43;
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:5:5: Context: Previous declaration of 'foo'.
+// int foo = 42;
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:8:14: Error: 'bar' is already declared in this scope.
+// typedef bool bar();
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:7:14: Context: Previous declaration of 'bar'.
+// typedef bool bar();
+// ^^^
+//
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:13:5: Error: 'baz' is already declared in this scope.
+// int baz() {
+// ^^^
+// pkg/front_end/testcases/regress/issue_36647_2_lib1.dart:9:5: Context: Previous declaration of 'baz'.
+// int baz() {
+// ^^^
+//
+import self as iss;
+import "dart:core" as core;
+
+typedef bar = () → core::bool;
+static field core::int foo;
+static method baz() → core::int {
+ return 42;
+}
diff --git a/front_end/testcases/regress/issue_36647_2_lib1.dart b/front_end/testcases/regress/issue_36647_2_lib1.dart
new file mode 100644
index 0000000..b2d8d4b
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_2_lib1.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2019, 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.
+
+int foo = 42;
+int foo = 43;
+typedef bool bar();
+typedef bool bar();
+int baz() {
+ return 42;
+}
+
+int baz() {
+ return 43;
+}
diff --git a/front_end/testcases/regress/issue_36647_lib1.dart b/front_end/testcases/regress/issue_36647_lib1.dart
new file mode 100644
index 0000000..4aef191
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_lib1.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2019, 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.
+
+export 'issue_36647_lib2.dart';
diff --git a/front_end/testcases/regress/issue_36647_lib2.dart b/front_end/testcases/regress/issue_36647_lib2.dart
new file mode 100644
index 0000000..3960141
--- /dev/null
+++ b/front_end/testcases/regress/issue_36647_lib2.dart
@@ -0,0 +1,6 @@
+// Copyright (c) 2019, 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 xxx xx XXX extends XXX {
+}
diff --git a/front_end/testcases/regress/issue_36669.dart b/front_end/testcases/regress/issue_36669.dart
new file mode 100644
index 0000000..5aba8e6
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2019, 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 NoUnnamedConstuctor {
+ NoUnnamedConstuctor._();
+}
+
+class MixMeIn {}
+
+class Foo extends NoUnnamedConstuctor with MixMeIn {}
diff --git a/front_end/testcases/regress/issue_36669.dart.hierarchy.expect b/front_end/testcases/regress/issue_36669.dart.hierarchy.expect
new file mode 100644
index 0000000..b7c594c
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.hierarchy.expect
@@ -0,0 +1,114 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+NoUnnamedConstuctor:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+MixMeIn:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+NoUnnamedConstuctor with MixMeIn:
+ superclasses:
+ Object
+ -> NoUnnamedConstuctor
+ interfaces: MixMeIn
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+ interfaceMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ interfaceSetters:
+
+Foo:
+ superclasses:
+ Object
+ -> NoUnnamedConstuctor
+ -> _Foo&NoUnnamedConstuctor&MixMeIn
+ interfaces: MixMeIn
+ classMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+ interfaceMembers:
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ interfaceSetters:
diff --git a/front_end/testcases/regress/issue_36669.dart.legacy.expect b/front_end/testcases/regress/issue_36669.dart.legacy.expect
new file mode 100644
index 0000000..104dfea
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.legacy.expect
@@ -0,0 +1,31 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36669.dart:11:7: Error: The superclass, 'NoUnnamedConstuctor with MixMeIn', has no unnamed constructor that takes no arguments.
+// class Foo extends NoUnnamedConstuctor with MixMeIn {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class NoUnnamedConstuctor extends core::Object {
+ constructor _() → self::NoUnnamedConstuctor
+ : super core::Object::•()
+ ;
+}
+class MixMeIn extends core::Object {
+ synthetic constructor •() → self::MixMeIn
+ : super core::Object::•()
+ ;
+}
+abstract class _Foo&NoUnnamedConstuctor&MixMeIn = self::NoUnnamedConstuctor with self::MixMeIn {
+ synthetic constructor _() → self::_Foo&NoUnnamedConstuctor&MixMeIn
+ : super self::NoUnnamedConstuctor::_()
+ ;
+}
+class Foo extends self::_Foo&NoUnnamedConstuctor&MixMeIn {
+ synthetic constructor •() → self::Foo
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36669.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_36669.dart.legacy.transformed.expect
new file mode 100644
index 0000000..25e5cab
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.legacy.transformed.expect
@@ -0,0 +1,31 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36669.dart:11:7: Error: The superclass, 'NoUnnamedConstuctor with MixMeIn', has no unnamed constructor that takes no arguments.
+// class Foo extends NoUnnamedConstuctor with MixMeIn {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class NoUnnamedConstuctor extends core::Object {
+ constructor _() → self::NoUnnamedConstuctor
+ : super core::Object::•()
+ ;
+}
+class MixMeIn extends core::Object {
+ synthetic constructor •() → self::MixMeIn
+ : super core::Object::•()
+ ;
+}
+abstract class _Foo&NoUnnamedConstuctor&MixMeIn extends self::NoUnnamedConstuctor implements self::MixMeIn {
+ synthetic constructor _() → self::_Foo&NoUnnamedConstuctor&MixMeIn
+ : super self::NoUnnamedConstuctor::_()
+ ;
+}
+class Foo extends self::_Foo&NoUnnamedConstuctor&MixMeIn {
+ synthetic constructor •() → self::Foo
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36669.dart.outline.expect b/front_end/testcases/regress/issue_36669.dart.outline.expect
new file mode 100644
index 0000000..ea21227
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.outline.expect
@@ -0,0 +1,21 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class NoUnnamedConstuctor extends core::Object {
+ constructor _() → self::NoUnnamedConstuctor
+ ;
+}
+class MixMeIn extends core::Object {
+ synthetic constructor •() → self::MixMeIn
+ ;
+}
+abstract class _Foo&NoUnnamedConstuctor&MixMeIn = self::NoUnnamedConstuctor with self::MixMeIn {
+ synthetic constructor _() → self::_Foo&NoUnnamedConstuctor&MixMeIn
+ : super self::NoUnnamedConstuctor::_()
+ ;
+}
+class Foo extends self::_Foo&NoUnnamedConstuctor&MixMeIn {
+ synthetic constructor •() → self::Foo
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36669.dart.strong.expect b/front_end/testcases/regress/issue_36669.dart.strong.expect
new file mode 100644
index 0000000..104dfea
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.strong.expect
@@ -0,0 +1,31 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36669.dart:11:7: Error: The superclass, 'NoUnnamedConstuctor with MixMeIn', has no unnamed constructor that takes no arguments.
+// class Foo extends NoUnnamedConstuctor with MixMeIn {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class NoUnnamedConstuctor extends core::Object {
+ constructor _() → self::NoUnnamedConstuctor
+ : super core::Object::•()
+ ;
+}
+class MixMeIn extends core::Object {
+ synthetic constructor •() → self::MixMeIn
+ : super core::Object::•()
+ ;
+}
+abstract class _Foo&NoUnnamedConstuctor&MixMeIn = self::NoUnnamedConstuctor with self::MixMeIn {
+ synthetic constructor _() → self::_Foo&NoUnnamedConstuctor&MixMeIn
+ : super self::NoUnnamedConstuctor::_()
+ ;
+}
+class Foo extends self::_Foo&NoUnnamedConstuctor&MixMeIn {
+ synthetic constructor •() → self::Foo
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36669.dart.strong.transformed.expect b/front_end/testcases/regress/issue_36669.dart.strong.transformed.expect
new file mode 100644
index 0000000..25e5cab
--- /dev/null
+++ b/front_end/testcases/regress/issue_36669.dart.strong.transformed.expect
@@ -0,0 +1,31 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36669.dart:11:7: Error: The superclass, 'NoUnnamedConstuctor with MixMeIn', has no unnamed constructor that takes no arguments.
+// class Foo extends NoUnnamedConstuctor with MixMeIn {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class NoUnnamedConstuctor extends core::Object {
+ constructor _() → self::NoUnnamedConstuctor
+ : super core::Object::•()
+ ;
+}
+class MixMeIn extends core::Object {
+ synthetic constructor •() → self::MixMeIn
+ : super core::Object::•()
+ ;
+}
+abstract class _Foo&NoUnnamedConstuctor&MixMeIn extends self::NoUnnamedConstuctor implements self::MixMeIn {
+ synthetic constructor _() → self::_Foo&NoUnnamedConstuctor&MixMeIn
+ : super self::NoUnnamedConstuctor::_()
+ ;
+}
+class Foo extends self::_Foo&NoUnnamedConstuctor&MixMeIn {
+ synthetic constructor •() → self::Foo
+ : invalid-initializer
+ ;
+}
diff --git a/front_end/testcases/regress/issue_36793.dart b/front_end/testcases/regress/issue_36793.dart
new file mode 100644
index 0000000..1601a23
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int y = 42;
+
+@y
+int x = 1;
+@y
+int x = 2;
+
+main() {
+ print(y);
+}
\ No newline at end of file
diff --git a/front_end/testcases/regress/issue_36793.dart.legacy.expect b/front_end/testcases/regress/issue_36793.dart.legacy.expect
new file mode 100644
index 0000000..4735cfe
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart.legacy.expect
@@ -0,0 +1,19 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36793.dart:10:5: Error: 'x' is already declared in this scope.
+// int x = 2;
+// ^
+// pkg/front_end/testcases/regress/issue_36793.dart:8:5: Context: Previous declaration of 'x'.
+// int x = 1;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int y = 42;
+static field core::int x;
+static method main() → dynamic {
+ core::print(self::y);
+}
diff --git a/front_end/testcases/regress/issue_36793.dart.legacy.transformed.expect b/front_end/testcases/regress/issue_36793.dart.legacy.transformed.expect
new file mode 100644
index 0000000..4735cfe
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart.legacy.transformed.expect
@@ -0,0 +1,19 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36793.dart:10:5: Error: 'x' is already declared in this scope.
+// int x = 2;
+// ^
+// pkg/front_end/testcases/regress/issue_36793.dart:8:5: Context: Previous declaration of 'x'.
+// int x = 1;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int y = 42;
+static field core::int x;
+static method main() → dynamic {
+ core::print(self::y);
+}
diff --git a/front_end/testcases/regress/issue_36793.dart.outline.expect b/front_end/testcases/regress/issue_36793.dart.outline.expect
new file mode 100644
index 0000000..659526a
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36793.dart:10:5: Error: 'x' is already declared in this scope.
+// int x = 2;
+// ^
+// pkg/front_end/testcases/regress/issue_36793.dart:8:5: Context: Previous declaration of 'x'.
+// int x = 1;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int y;
+static field core::int x;
+static method main() → dynamic
+ ;
diff --git a/front_end/testcases/regress/issue_36793.dart.strong.expect b/front_end/testcases/regress/issue_36793.dart.strong.expect
new file mode 100644
index 0000000..4735cfe
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart.strong.expect
@@ -0,0 +1,19 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36793.dart:10:5: Error: 'x' is already declared in this scope.
+// int x = 2;
+// ^
+// pkg/front_end/testcases/regress/issue_36793.dart:8:5: Context: Previous declaration of 'x'.
+// int x = 1;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int y = 42;
+static field core::int x;
+static method main() → dynamic {
+ core::print(self::y);
+}
diff --git a/front_end/testcases/regress/issue_36793.dart.strong.transformed.expect b/front_end/testcases/regress/issue_36793.dart.strong.transformed.expect
new file mode 100644
index 0000000..4735cfe
--- /dev/null
+++ b/front_end/testcases/regress/issue_36793.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/regress/issue_36793.dart:10:5: Error: 'x' is already declared in this scope.
+// int x = 2;
+// ^
+// pkg/front_end/testcases/regress/issue_36793.dart:8:5: Context: Previous declaration of 'x'.
+// int x = 1;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int y = 42;
+static field core::int x;
+static method main() → dynamic {
+ core::print(self::y);
+}
diff --git a/front_end/testcases/runtime_checks/contravariant_getter.dart b/front_end/testcases/runtime_checks/contravariant_getter.dart
index 4cb62d5..b8ff15c 100644
--- a/front_end/testcases/runtime_checks/contravariant_getter.dart
+++ b/front_end/testcases/runtime_checks/contravariant_getter.dart
@@ -9,7 +9,7 @@
class C<T> {
F<T> y;
- void f(T /*@covariance=genericImpl*/ value) {
+ void f(T value) {
this.y(value);
}
}
diff --git a/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.expect b/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.expect
index d75022d..79b167b 100644
--- a/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.expect
@@ -8,7 +8,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T value) → void {
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::y}(value);
}
}
diff --git a/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.transformed.expect
index d75022d..79b167b 100644
--- a/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/contravariant_getter.dart.legacy.transformed.expect
@@ -8,7 +8,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T value) → void {
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::y}(value);
}
}
diff --git a/front_end/testcases/runtime_checks/contravariant_getter.dart.outline.expect b/front_end/testcases/runtime_checks/contravariant_getter.dart.outline.expect
index 5cb4a3a..7657ab7 100644
--- a/front_end/testcases/runtime_checks/contravariant_getter.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/contravariant_getter.dart.outline.expect
@@ -7,7 +7,7 @@
field (self::C::T) → void y;
synthetic constructor •() → self::C<self::C::T>
;
- method f(self::C::T value) → void
+ method f(generic-covariant-impl self::C::T value) → void
;
}
static method g(self::C<core::num> c) → void
diff --git a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
index bbe2c24..ec30f9e 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
@@ -6,8 +6,8 @@
library test;
class C<T> {
- void f< /*@covariance=genericImpl*/ U extends T>(U x) {}
- void g1< /*@covariance=genericImpl*/ U extends T>() {
+ void f<U extends T>(U x) {}
+ void g1<U extends T>() {
this.f<U>(1.5);
}
}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.expect
index b8aa4df..f6a34fb 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.expect
@@ -6,8 +6,8 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void {}
- method g1<U extends self::C::T = dynamic>() → void {
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method g1<generic-covariant-impl U extends self::C::T = dynamic>() → void {
this.{self::C::f}<self::C::g1::U>(1.5);
}
}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.transformed.expect
index b8aa4df..f6a34fb 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.legacy.transformed.expect
@@ -6,8 +6,8 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void {}
- method g1<U extends self::C::T = dynamic>() → void {
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method g1<generic-covariant-impl U extends self::C::T = dynamic>() → void {
this.{self::C::f}<self::C::g1::U>(1.5);
}
}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.outline.expect
index 6a94b0f..9f98ab1 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.outline.expect
@@ -5,9 +5,9 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void
;
- method g1<U extends self::C::T = dynamic>() → void
+ method g1<generic-covariant-impl U extends self::C::T = dynamic>() → void
;
}
static method g2(self::C<core::Object> c) → void
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
index f263624..d5cfa14 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
@@ -6,7 +6,7 @@
library test;
class C<T> {
- void f(T /*@covariance=genericImpl*/ x) {}
+ void f(T x) {}
}
void g1(C<num> c) {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.expect
index 11fed34..35df363 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method g1(self::C<core::num> c) → void {
c.f(1.5);
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.transformed.expect
index 11fed34..35df363 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method g1(self::C<core::num> c) → void {
c.f(1.5);
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.outline.expect
index af07f90..755eea6 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.outline.expect
@@ -5,7 +5,7 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f(self::C::T x) → void
+ method f(generic-covariant-impl self::C::T x) → void
;
}
static method g1(self::C<core::num> c) → void
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
index f8341a0..6cb0061 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
@@ -7,13 +7,13 @@
class C<T> {
// List<T> is covariant in T so it needs checking
- void f1(List<T> /*@covariance=genericImpl*/ x) {}
+ void f1(List<T> x) {}
// () -> T is covariant in T so it needs checking
- void f2(T /*@covariance=genericImpl*/ callback()) {}
+ void f2(T callback()) {}
// (T) -> T is partially covariant in T so it needs checking
- void f3(T /*@covariance=genericImpl*/ callback(T x)) {}
+ void f3(T callback(T x)) {}
// (T) -> void is contravariant in T so it doesn't need checking
void f4(void callback(T x)) {}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.expect
index 072d922..d0cf71d 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(core::List<self::C::T> x) → void {}
- method f2(() → self::C::T callback) → void {}
- method f3((self::C::T) → self::C::T callback) → void {}
+ method f1(generic-covariant-impl core::List<self::C::T> x) → void {}
+ method f2(generic-covariant-impl () → self::C::T callback) → void {}
+ method f3(generic-covariant-impl (self::C::T) → self::C::T callback) → void {}
method f4((self::C::T) → void callback) → void {}
}
static method g1(self::C<core::num> c, core::List<core::num> l) → void {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.transformed.expect
index 072d922..d0cf71d 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.legacy.transformed.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(core::List<self::C::T> x) → void {}
- method f2(() → self::C::T callback) → void {}
- method f3((self::C::T) → self::C::T callback) → void {}
+ method f1(generic-covariant-impl core::List<self::C::T> x) → void {}
+ method f2(generic-covariant-impl () → self::C::T callback) → void {}
+ method f3(generic-covariant-impl (self::C::T) → self::C::T callback) → void {}
method f4((self::C::T) → void callback) → void {}
}
static method g1(self::C<core::num> c, core::List<core::num> l) → void {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.outline.expect
index 831387d..49d3ebd 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.outline.expect
@@ -5,11 +5,11 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f1(core::List<self::C::T> x) → void
+ method f1(generic-covariant-impl core::List<self::C::T> x) → void
;
- method f2(() → self::C::T callback) → void
+ method f2(generic-covariant-impl () → self::C::T callback) → void
;
- method f3((self::C::T) → self::C::T callback) → void
+ method f3(generic-covariant-impl (self::C::T) → self::C::T callback) → void
;
method f4((self::C::T) → void callback) → void
;
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
index 67ebc4d..3ec2d07 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
@@ -6,20 +6,18 @@
library test;
abstract class I<T> {
- void f1(T /*@covariance=genericImpl*/ x);
- void f2(T /*@covariance=genericImpl*/ x);
+ void f1(T x);
+ void f2(T x);
}
class C<U> implements I<int> {
- void f1(int /*@covariance=genericImpl*/ x) {}
- void f2(int /*@covariance=genericImpl*/ x,
- [U /*@covariance=genericImpl*/ y]) {}
+ void f1(int x) {}
+ void f2(int x, [U y]) {}
}
class D<U> extends C<U> {
- void f1(int /*@covariance=genericImpl*/ x) {}
- void f2(int /*@covariance=genericImpl*/ x,
- [U /*@covariance=genericImpl*/ y]) {}
+ void f1(int x) {}
+ void f2(int x, [U y]) {}
}
void g1(C<num> c) {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.expect
index fc22b45..96700b1 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.expect
@@ -6,22 +6,22 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f1(self::I::T x) → void;
- abstract method f2(self::I::T x) → void;
+ abstract method f1(generic-covariant-impl self::I::T x) → void;
+ abstract method f2(generic-covariant-impl self::I::T x) → void;
}
class C<U extends core::Object = dynamic> extends core::Object implements self::I<core::int> {
synthetic constructor •() → self::C<self::C::U>
: super core::Object::•()
;
method f1(core::int x) → void {}
- method f2(core::int x, [self::C::U y = null]) → void {}
+ method f2(core::int x, [generic-covariant-impl self::C::U y = null]) → void {}
}
class D<U extends core::Object = dynamic> extends self::C<self::D::U> {
synthetic constructor •() → self::D<self::D::U>
: super self::C::•()
;
method f1(core::int x) → void {}
- method f2(core::int x, [self::D::U y = null]) → void {}
+ method f2(core::int x, [generic-covariant-impl self::D::U y = null]) → void {}
}
static method g1(self::C<core::num> c) → void {
c.f1(1);
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.transformed.expect
index fc22b45..96700b1 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.legacy.transformed.expect
@@ -6,22 +6,22 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f1(self::I::T x) → void;
- abstract method f2(self::I::T x) → void;
+ abstract method f1(generic-covariant-impl self::I::T x) → void;
+ abstract method f2(generic-covariant-impl self::I::T x) → void;
}
class C<U extends core::Object = dynamic> extends core::Object implements self::I<core::int> {
synthetic constructor •() → self::C<self::C::U>
: super core::Object::•()
;
method f1(core::int x) → void {}
- method f2(core::int x, [self::C::U y = null]) → void {}
+ method f2(core::int x, [generic-covariant-impl self::C::U y = null]) → void {}
}
class D<U extends core::Object = dynamic> extends self::C<self::D::U> {
synthetic constructor •() → self::D<self::D::U>
: super self::C::•()
;
method f1(core::int x) → void {}
- method f2(core::int x, [self::D::U y = null]) → void {}
+ method f2(core::int x, [generic-covariant-impl self::D::U y = null]) → void {}
}
static method g1(self::C<core::num> c) → void {
c.f1(1);
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.outline.expect
index a268782..fe2f698 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.outline.expect
@@ -5,15 +5,15 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f1(self::I::T x) → void;
- abstract method f2(self::I::T x) → void;
+ abstract method f1(generic-covariant-impl self::I::T x) → void;
+ abstract method f2(generic-covariant-impl self::I::T x) → void;
}
class C<U extends core::Object = dynamic> extends core::Object implements self::I<core::int> {
synthetic constructor •() → self::C<self::C::U>
;
method f1(core::int x) → void
;
- method f2(core::int x, [self::C::U y]) → void
+ method f2(core::int x, [generic-covariant-impl self::C::U y]) → void
;
}
class D<U extends core::Object = dynamic> extends self::C<self::D::U> {
@@ -21,7 +21,7 @@
;
method f1(core::int x) → void
;
- method f2(core::int x, [self::D::U y]) → void
+ method f2(core::int x, [generic-covariant-impl self::D::U y]) → void
;
}
static method g1(self::C<core::num> c) → void
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
index 064a9d2..4da2532 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
@@ -10,16 +10,14 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x);
+ void f(T x);
}
class M {
void f(int x) {}
}
-class /*@forwardingStub=void f(covariance=(genericImpl) int x)*/ C = B
- with M
- implements I<int>;
+class C = B with M implements I<int>;
void g1(C c) {
c.f(1);
}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.expect
index 51518db..144807a 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.transformed.expect
index 8fe549e..20d3a2e 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.outline.expect
index c96cbc1..10f6ea9 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
index 84127a1..a869fd9 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
@@ -10,11 +10,10 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x);
+ void f(T x);
}
-class /*@forwardingStub=void f(covariance=(genericImpl) int x)*/ C extends B
- implements I<int> {}
+class C extends B implements I<int> {}
void g1(C c) {
c.f(1);
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.expect
index 67ecc72..ca44867 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.transformed.expect
index 67ecc72..ca44867 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.outline.expect
index 2c50229..ee14e2c 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
index ea42a43..8208926 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
@@ -10,14 +10,12 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x);
+ void f(T x);
}
class M {}
-class /*@forwardingStub=void f(covariance=(genericImpl) int x)*/ C = B
- with M
- implements I<int>;
+class C = B with M implements I<int>;
void g1(C c) {
c.f(1);
}
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.expect
index fff4959..45abbbf 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.transformed.expect
index aca4225..0e61a92 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.outline.expect
index 171a55f..926b281 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → self::M
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
index 260dabe..8261613 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
@@ -10,8 +10,8 @@
typedef U G<T, U>(T x);
class C<T> {
- void f1(T /*@covariance=genericImpl*/ x) {}
- T f2(List<T> /*@covariance=genericImpl*/ x) => x.first;
+ void f1(T x) {}
+ T f2(List<T> x) => x.first;
}
F<num> g1(C<num> c) {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.expect
index cb4340c..173ea04 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.expect
@@ -8,8 +8,8 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(self::C::T x) → void {}
- method f2(core::List<self::C::T> x) → self::C::T
+ method f1(generic-covariant-impl self::C::T x) → void {}
+ method f2(generic-covariant-impl core::List<self::C::T> x) → self::C::T
return x.first;
}
static method g1(self::C<core::num> c) → (core::num) → void {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.transformed.expect
index cb4340c..173ea04 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.legacy.transformed.expect
@@ -8,8 +8,8 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(self::C::T x) → void {}
- method f2(core::List<self::C::T> x) → self::C::T
+ method f1(generic-covariant-impl self::C::T x) → void {}
+ method f2(generic-covariant-impl core::List<self::C::T> x) → self::C::T
return x.first;
}
static method g1(self::C<core::num> c) → (core::num) → void {
diff --git a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.outline.expect
index d426ddb..3983048 100644
--- a/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.outline.expect
@@ -7,9 +7,9 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f1(self::C::T x) → void
+ method f1(generic-covariant-impl self::C::T x) → void
;
- method f2(core::List<self::C::T> x) → self::C::T
+ method f2(generic-covariant-impl core::List<self::C::T> x) → self::C::T
;
}
static method g1(self::C<core::num> c) → (core::num) → void
diff --git a/front_end/testcases/runtime_checks/covariant_keyword.dart b/front_end/testcases/runtime_checks/covariant_keyword.dart
index 1c44f18..02bfdcf 100644
--- a/front_end/testcases/runtime_checks/covariant_keyword.dart
+++ b/front_end/testcases/runtime_checks/covariant_keyword.dart
@@ -12,11 +12,11 @@
}
class D extends C {
- void f(covariant int /*@covariance=explicit*/ x) {}
+ void f(covariant int x) {}
}
class E extends D {
- void f(int /*@covariance=explicit*/ x) {}
+ void f(int x) {}
}
void g1(C c) {
diff --git a/front_end/testcases/runtime_checks/covariant_keyword_field.dart b/front_end/testcases/runtime_checks/covariant_keyword_field.dart
index 5756611..7c7f663 100644
--- a/front_end/testcases/runtime_checks/covariant_keyword_field.dart
+++ b/front_end/testcases/runtime_checks/covariant_keyword_field.dart
@@ -10,11 +10,11 @@
}
class D implements C {
- covariant int /*@covariance=explicit*/ x;
+ covariant int x;
}
class E implements D {
- int /*@covariance=explicit*/ x;
+ int x;
}
main() {}
diff --git a/front_end/testcases/runtime_checks/covariant_keyword_field_inherited_by_setter.dart b/front_end/testcases/runtime_checks/covariant_keyword_field_inherited_by_setter.dart
index 9ad2404..d8f1ceb 100644
--- a/front_end/testcases/runtime_checks/covariant_keyword_field_inherited_by_setter.dart
+++ b/front_end/testcases/runtime_checks/covariant_keyword_field_inherited_by_setter.dart
@@ -10,12 +10,12 @@
}
class D implements C {
- covariant int /*@covariance=explicit*/ x;
+ covariant int x;
}
class E implements D {
int get x => 0;
- void set x(int /*@covariance=explicit*/ value) {}
+ void set x(int value) {}
}
main() {}
diff --git a/front_end/testcases/runtime_checks/covariant_keyword_setter.dart b/front_end/testcases/runtime_checks/covariant_keyword_setter.dart
index 0233e91..d9b8a30 100644
--- a/front_end/testcases/runtime_checks/covariant_keyword_setter.dart
+++ b/front_end/testcases/runtime_checks/covariant_keyword_setter.dart
@@ -10,11 +10,11 @@
}
class D extends C {
- void set x(covariant int /*@covariance=explicit*/ value) {}
+ void set x(covariant int value) {}
}
class E extends D {
- void set x(int /*@covariance=explicit*/ value) {}
+ void set x(int value) {}
}
main() {}
diff --git a/front_end/testcases/runtime_checks/covariant_keyword_setter_inherited_by_field.dart b/front_end/testcases/runtime_checks/covariant_keyword_setter_inherited_by_field.dart
index 3594b79..21bd63d 100644
--- a/front_end/testcases/runtime_checks/covariant_keyword_setter_inherited_by_field.dart
+++ b/front_end/testcases/runtime_checks/covariant_keyword_setter_inherited_by_field.dart
@@ -10,11 +10,11 @@
}
class D extends C {
- void set x(covariant int /*@covariance=explicit*/ value) {}
+ void set x(covariant int value) {}
}
class E implements D {
- int /*@covariance=explicit*/ x;
+ int x;
}
main() {}
diff --git a/front_end/testcases/runtime_checks/covariant_setter.dart b/front_end/testcases/runtime_checks/covariant_setter.dart
index fc2b4f1..029caad 100644
--- a/front_end/testcases/runtime_checks/covariant_setter.dart
+++ b/front_end/testcases/runtime_checks/covariant_setter.dart
@@ -8,9 +8,9 @@
typedef void F<T>(T x);
class C<T> {
- T /*@covariance=genericImpl*/ x;
- void set y(T /*@covariance=genericImpl*/ value) {}
- void f(T /*@covariance=genericImpl*/ value) {
+ T x;
+ void set y(T value) {}
+ void f(T value) {
this.x = value;
this.y = value;
}
diff --git a/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.expect b/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.expect
index fa9d6c9..3fb057f 100644
--- a/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.expect
@@ -4,12 +4,12 @@
typedef F<T extends core::Object = dynamic> = (T) → void;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- set y(self::C::T value) → void {}
- method f(self::C::T value) → void {
+ set y(generic-covariant-impl self::C::T value) → void {}
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::x} = value;
this.{self::C::y} = value;
}
diff --git a/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.transformed.expect
index fa9d6c9..3fb057f 100644
--- a/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/covariant_setter.dart.legacy.transformed.expect
@@ -4,12 +4,12 @@
typedef F<T extends core::Object = dynamic> = (T) → void;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- set y(self::C::T value) → void {}
- method f(self::C::T value) → void {
+ set y(generic-covariant-impl self::C::T value) → void {}
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::x} = value;
this.{self::C::y} = value;
}
diff --git a/front_end/testcases/runtime_checks/covariant_setter.dart.outline.expect b/front_end/testcases/runtime_checks/covariant_setter.dart.outline.expect
index edbba3a..034ccc0 100644
--- a/front_end/testcases/runtime_checks/covariant_setter.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/covariant_setter.dart.outline.expect
@@ -4,12 +4,12 @@
typedef F<T extends core::Object = dynamic> = (T) → void;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T x;
+ generic-covariant-impl field self::C::T x;
synthetic constructor •() → self::C<self::C::T>
;
- set y(self::C::T value) → void
+ set y(generic-covariant-impl self::C::T value) → void
;
- method f(self::C::T value) → void
+ method f(generic-covariant-impl self::C::T value) → void
;
}
static method g(self::C<core::num> c) → void
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation.dart b/front_end/testcases/runtime_checks/dynamic_invocation.dart
index 279e3ba..790dff4 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation.dart
+++ b/front_end/testcases/runtime_checks/dynamic_invocation.dart
@@ -6,12 +6,12 @@
library test;
class C<T> {
- void f1(T /*@covariance=genericImpl*/ x) {}
+ void f1(T x) {}
void f2(int x) {}
}
class D extends C<num> {
- void f1(covariant int /*@covariance=explicit*/ x) {}
+ void f1(covariant int x) {}
}
void g1(dynamic d) {
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.expect b/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.expect
index 92254e8..2efc919 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(self::C::T x) → void {}
+ method f1(generic-covariant-impl self::C::T x) → void {}
method f2(core::int x) → void {}
}
class D extends self::C<core::num> {
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.transformed.expect
index 92254e8..2efc919 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f1(self::C::T x) → void {}
+ method f1(generic-covariant-impl self::C::T x) → void {}
method f2(core::int x) → void {}
}
class D extends self::C<core::num> {
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation.dart.outline.expect b/front_end/testcases/runtime_checks/dynamic_invocation.dart.outline.expect
index e6d2c0e..87b6f89 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation.dart.outline.expect
@@ -5,7 +5,7 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f1(self::C::T x) → void
+ method f1(generic-covariant-impl self::C::T x) → void
;
method f2(core::int x) → void
;
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
index 8f1f075..6206b0e 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
+++ b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
@@ -6,7 +6,7 @@
library test;
class C<T> {
- void f< /*@covariance=genericImpl*/ U extends T>(U x) {}
+ void f<U extends T>(U x) {}
}
void g1(dynamic d) {
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.expect b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.expect
index 8fc21ae..205ca75 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
}
static method g1(dynamic d) → void {
d.f<core::num>(1.5);
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.transformed.expect
index 8fc21ae..205ca75 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
}
static method g1(dynamic d) → void {
d.f<core::num>(1.5);
diff --git a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.outline.expect b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.outline.expect
index 195a9e4..65c7be8 100644
--- a/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.outline.expect
@@ -5,7 +5,7 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f<U extends self::C::T = dynamic>(self::C::f::U x) → void
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void
;
}
static method g1(dynamic d) → void
diff --git a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
index 554eeae..065bd4e 100644
--- a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
+++ b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
@@ -6,14 +6,13 @@
library test;
class B<T> {
- T /*@covariance=genericImpl*/ x;
+ T x;
}
class C {
num x;
}
-class /*@forwardingStub=void set x(covariance=(genericImpl) num _)*/ D extends C
- implements B<num> {}
+class D extends C implements B<num> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.expect b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.expect
index 7f689fb..084024b 100644
--- a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.transformed.expect
index 7f689fb..084024b 100644
--- a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.outline.expect b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.outline.expect
index e67be67..d696974 100644
--- a/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.outline.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x;
+ generic-covariant-impl field self::B::T x;
synthetic constructor •() → self::B<self::B::T>
;
}
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
index b8607ea..816a396 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
@@ -23,14 +23,11 @@
}
abstract class I<T> {
- void f([T /*@covariance=genericImpl*/ x]);
- void g({T /*@covariance=genericImpl*/ x});
+ void f([T x]);
+ void g({T x});
}
-class
-/*@forwardingStub=void f([covariance=(genericImpl) num x])*/
-/*@forwardingStub=void g({covariance=(genericImpl) num x})*/
- C extends B implements I<num> {}
+class C extends B implements I<num> {}
main() {
C c = new C();
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.expect
index 01f712b..82a32ab 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.expect
@@ -23,8 +23,8 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f([self::I::T x = null]) → void;
- abstract method g({self::I::T x = null}) → void;
+ abstract method f([generic-covariant-impl self::I::T x = null]) → void;
+ abstract method g({generic-covariant-impl self::I::T x = null}) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.transformed.expect
index 01f712b..82a32ab 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.legacy.transformed.expect
@@ -23,8 +23,8 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f([self::I::T x = null]) → void;
- abstract method g({self::I::T x = null}) → void;
+ abstract method f([generic-covariant-impl self::I::T x = null]) → void;
+ abstract method g({generic-covariant-impl self::I::T x = null}) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.outline.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.outline.expect
index 596728c..5998e7f 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.outline.expect
@@ -16,8 +16,8 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f([self::I::T x]) → void;
- abstract method g({self::I::T x}) → void;
+ abstract method f([generic-covariant-impl self::I::T x]) → void;
+ abstract method g({generic-covariant-impl self::I::T x}) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
index 2b22cac..2cd0b19 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
@@ -10,10 +10,9 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x, int y);
+ void f(T x, int y);
}
-class /*@forwardingStub=void f(covariance=(genericImpl) int x, covariance=() int y)*/ C
- extends B implements I<int> {}
+class C extends B implements I<int> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.expect
index 049bff0..5486a15 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::int y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.transformed.expect
index 049bff0..5486a15 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::int y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.outline.expect b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.outline.expect
index e33d959..a0b2b04 100644
--- a/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::int y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
index b144c81..d9f6ffd 100644
--- a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
+++ b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
@@ -6,19 +6,19 @@
library test;
class C<T> {
- void set x(T /*@covariance=genericImpl*/ t) {}
- T /*@covariance=genericImpl*/ y;
+ void set x(T t) {}
+ T y;
}
class D implements C<num> {
- num /*@covariance=genericImpl*/ x;
- num /*@covariance=genericImpl*/ y;
+ num x;
+ num y;
}
class E implements C<num> {
- void set x(num /*@covariance=genericImpl*/ t) {}
+ void set x(num t) {}
num get y => null;
- void set y(num /*@covariance=genericImpl*/ t) {}
+ void set y(num t) {}
}
void main() {}
diff --git a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.expect b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.expect
index 8874ff3..121a90b 100644
--- a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T y = null;
+ generic-covariant-impl field self::C::T y = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- set x(self::C::T t) → void {}
+ set x(generic-covariant-impl self::C::T t) → void {}
}
class D extends core::Object implements self::C<core::num> {
field core::num x = null;
diff --git a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.transformed.expect
index 8874ff3..121a90b 100644
--- a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.legacy.transformed.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T y = null;
+ generic-covariant-impl field self::C::T y = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- set x(self::C::T t) → void {}
+ set x(generic-covariant-impl self::C::T t) → void {}
}
class D extends core::Object implements self::C<core::num> {
field core::num x = null;
diff --git a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.outline.expect b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.outline.expect
index f6ab6e3..bf98c8f 100644
--- a/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.outline.expect
@@ -3,10 +3,10 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- field self::C::T y;
+ generic-covariant-impl field self::C::T y;
synthetic constructor •() → self::C<self::C::T>
;
- set x(self::C::T t) → void
+ set x(generic-covariant-impl self::C::T t) → void
;
}
class D extends core::Object implements self::C<core::num> {
diff --git a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
index 6558f2d..54358a5 100644
--- a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
+++ b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
@@ -6,17 +6,17 @@
library test;
abstract class A {
- void set x(covariant Object /*@covariance=explicit*/ value);
+ void set x(covariant Object value);
}
class B implements A {
- void f(covariant Object /*@covariance=explicit*/ x) {}
- Object /*@covariance=explicit*/ x; // covariant
+ void f(covariant Object x) {}
+ Object x; // covariant
}
class C<T> implements B {
- void f(T /*@covariance=explicit*/ x) {}
- T /*@covariance=explicit*/ x;
+ void f(T x) {}
+ T x;
}
main() {}
diff --git a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.expect b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.expect
index 943bf76..fc559f4 100644
--- a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.expect
@@ -16,10 +16,10 @@
method f(covariant core::Object x) → void {}
}
class C<T extends core::Object = dynamic> extends core::Object implements self::B {
- field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method main() → dynamic {}
diff --git a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.transformed.expect
index 943bf76..fc559f4 100644
--- a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.legacy.transformed.expect
@@ -16,10 +16,10 @@
method f(covariant core::Object x) → void {}
}
class C<T extends core::Object = dynamic> extends core::Object implements self::B {
- field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method main() → dynamic {}
diff --git a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.outline.expect b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.outline.expect
index 89789e5..4ed0cca 100644
--- a/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.outline.expect
+++ b/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.outline.expect
@@ -15,10 +15,10 @@
;
}
class C<T extends core::Object = dynamic> extends core::Object implements self::B {
- field self::C::T x;
+ generic-covariant-impl field self::C::T x;
synthetic constructor •() → self::C<self::C::T>
;
- method f(self::C::T x) → void
+ method f(generic-covariant-impl self::C::T x) → void
;
}
static method main() → dynamic
diff --git a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
index ce4aebd..4b4ea07 100644
--- a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
+++ b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
@@ -10,11 +10,11 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x);
+ void f(T x);
}
class C extends B implements I<num> {
- void /*@forwardingStub=semi-stub*/ f(num /*@covariance=genericImpl*/ x);
+ void /*@forwardingStub=semi-stub*/ f(num x);
}
main() {}
diff --git a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.expect b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.expect
index aea0463..95fdf8b 100644
--- a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.transformed.expect
index aea0463..95fdf8b 100644
--- a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.outline.expect b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.outline.expect
index 8a400cf..8b7ff11 100644
--- a/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/call_through_this.dart b/front_end/testcases/runtime_checks_new/call_through_this.dart
index 9cc0c47..fa5945b 100644
--- a/front_end/testcases/runtime_checks_new/call_through_this.dart
+++ b/front_end/testcases/runtime_checks_new/call_through_this.dart
@@ -8,16 +8,16 @@
typedef F<T>(T x);
class C<T> {
- void f(T /*@covariance=genericImpl*/ x) {}
- void g1(T /*@covariance=genericImpl*/ x) {
+ void f(T x) {}
+ void g1(T x) {
this.f(x);
}
- void g2(T /*@covariance=genericImpl*/ x) {
+ void g2(T x) {
f(x);
}
- void g3(C<T> /*@covariance=genericImpl*/ c, T /*@covariance=genericImpl*/ x) {
+ void g3(C<T> c, T x) {
c.f(x);
}
@@ -27,7 +27,7 @@
class D extends C<int> {}
class E extends C<num> {
- void f(covariant int /*@covariance=explicit*/ x) {}
+ void f(covariant int x) {}
}
test() {
diff --git a/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.expect b/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.expect
index f02f1bc..f9eaac1 100644
--- a/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.expect
@@ -7,14 +7,14 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
- method g1(self::C::T x) → void {
+ method f(generic-covariant-impl self::C::T x) → void {}
+ method g1(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g2(self::C::T x) → void {
+ method g2(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g3(self::C<self::C::T> c, self::C::T x) → void {
+ method g3(generic-covariant-impl self::C<self::C::T> c, generic-covariant-impl self::C::T x) → void {
c.f(x);
}
method g4() → (self::C::T) → dynamic
diff --git a/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.transformed.expect
index f02f1bc..f9eaac1 100644
--- a/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/call_through_this.dart.legacy.transformed.expect
@@ -7,14 +7,14 @@
synthetic constructor •() → self::C<self::C::T>
: super core::Object::•()
;
- method f(self::C::T x) → void {}
- method g1(self::C::T x) → void {
+ method f(generic-covariant-impl self::C::T x) → void {}
+ method g1(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g2(self::C::T x) → void {
+ method g2(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g3(self::C<self::C::T> c, self::C::T x) → void {
+ method g3(generic-covariant-impl self::C<self::C::T> c, generic-covariant-impl self::C::T x) → void {
c.f(x);
}
method g4() → (self::C::T) → dynamic
diff --git a/front_end/testcases/runtime_checks_new/call_through_this.dart.outline.expect b/front_end/testcases/runtime_checks_new/call_through_this.dart.outline.expect
index 5b69334..0c9d1ca 100644
--- a/front_end/testcases/runtime_checks_new/call_through_this.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/call_through_this.dart.outline.expect
@@ -6,13 +6,13 @@
class C<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::T>
;
- method f(self::C::T x) → void
+ method f(generic-covariant-impl self::C::T x) → void
;
- method g1(self::C::T x) → void
+ method g1(generic-covariant-impl self::C::T x) → void
;
- method g2(self::C::T x) → void
+ method g2(generic-covariant-impl self::C::T x) → void
;
- method g3(self::C<self::C::T> c, self::C::T x) → void
+ method g3(generic-covariant-impl self::C<self::C::T> c, generic-covariant-impl self::C::T x) → void
;
method g4() → (self::C::T) → dynamic
;
diff --git a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
index c88d47a..0aeccbf 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
+++ b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class B<T> {
- B<T> operator +(B<T> /*@covariance=genericImpl*/ other) => null;
+ B<T> operator +(B<T> other) => null;
}
class C<T> {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.expect b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.expect
index 89d07f9..5b0622b 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.transformed.expect
index 89d07f9..5b0622b 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.legacy.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.outline.expect b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.outline.expect
index c30ef22..2df9ad8 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.outline.expect
@@ -6,7 +6,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
index 47d0002..ea53d03 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
+++ b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class B<T> {
- B<T> operator +(B<T> /*@covariance=genericImpl*/ other) => null;
+ B<T> operator +(B<T> other) => null;
}
class C<T> {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.expect b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.expect
index e7781b1..3345c98 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.transformed.expect
index e7781b1..3345c98 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.legacy.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.outline.expect b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.outline.expect
index 5e2e915..bb5426d 100644
--- a/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.outline.expect
@@ -6,7 +6,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- operator +(self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/derived_class_typed.dart b/front_end/testcases/runtime_checks_new/derived_class_typed.dart
index 0c73221..5d2400e 100644
--- a/front_end/testcases/runtime_checks_new/derived_class_typed.dart
+++ b/front_end/testcases/runtime_checks_new/derived_class_typed.dart
@@ -6,9 +6,9 @@
library test;
class B<T> {
- void f(T /*@covariance=genericImpl*/ x) {}
- void g({T /*@covariance=genericImpl*/ x}) {}
- void h< /*@covariance=genericImpl*/ U extends T>() {}
+ void f(T x) {}
+ void g({T x}) {}
+ void h<U extends T>() {}
}
class C extends B<int> {}
diff --git a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.expect b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.expect
index 1fe58ed..9addeea 100644
--- a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method f(self::B::T x) → void {}
- method g({self::B::T x = null}) → void {}
- method h<U extends self::B::T = dynamic>() → void {}
+ method f(generic-covariant-impl self::B::T x) → void {}
+ method g({generic-covariant-impl self::B::T x = null}) → void {}
+ method h<generic-covariant-impl U extends self::B::T = dynamic>() → void {}
}
class C extends self::B<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.transformed.expect
index 1fe58ed..9addeea 100644
--- a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.legacy.transformed.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method f(self::B::T x) → void {}
- method g({self::B::T x = null}) → void {}
- method h<U extends self::B::T = dynamic>() → void {}
+ method f(generic-covariant-impl self::B::T x) → void {}
+ method g({generic-covariant-impl self::B::T x = null}) → void {}
+ method h<generic-covariant-impl U extends self::B::T = dynamic>() → void {}
}
class C extends self::B<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.outline.expect b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.outline.expect
index b4ae0e0..88a2113 100644
--- a/front_end/testcases/runtime_checks_new/derived_class_typed.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/derived_class_typed.dart.outline.expect
@@ -5,11 +5,11 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- method f(self::B::T x) → void
+ method f(generic-covariant-impl self::B::T x) → void
;
- method g({self::B::T x}) → void
+ method g({generic-covariant-impl self::B::T x}) → void
;
- method h<U extends self::B::T = dynamic>() → void
+ method h<generic-covariant-impl U extends self::B::T = dynamic>() → void
;
}
class C extends self::B<core::int> {
diff --git a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
index 7b9e86e..e454c40 100644
--- a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
+++ b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
@@ -6,7 +6,7 @@
library test;
class B<T> {
- T /*@covariance=genericImpl*/ x;
+ T x;
}
class C extends B<num> {}
diff --git a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.expect b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.expect
index 052b5bf..ff86372 100644
--- a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.transformed.expect
index 052b5bf..ff86372 100644
--- a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.legacy.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.outline.expect b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.outline.expect
index 9318356..8403e2a 100644
--- a/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.outline.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x;
+ generic-covariant-impl field self::B::T x;
synthetic constructor •() → self::B<self::B::T>
;
}
diff --git a/front_end/testcases/runtime_checks_new/field_forwarding_stub_explicit_covariant.dart b/front_end/testcases/runtime_checks_new/field_forwarding_stub_explicit_covariant.dart
index 5f52760..aa86636 100644
--- a/front_end/testcases/runtime_checks_new/field_forwarding_stub_explicit_covariant.dart
+++ b/front_end/testcases/runtime_checks_new/field_forwarding_stub_explicit_covariant.dart
@@ -6,14 +6,13 @@
library test;
class B {
- covariant num /*@covariance=explicit*/ x;
+ covariant num x;
}
class C {
int x;
}
-class /*@forwardingStub=void set x(covariance=(explicit) num _)*/ D extends C
- implements B {}
+class D extends C implements B {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
index 1df42eb..72eae8b 100644
--- a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
+++ b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
@@ -6,25 +6,25 @@
library test;
class B<T> {
- T /*@covariance=genericImpl*/ x;
- T /*@covariance=genericImpl*/ y;
+ T x;
+ T y;
}
// This class inherits genericImpl annotations from its superclass, but doesn't
// have any members marked genericInterface because the inferred types of x and
// y do not depend on the type parameter T.
abstract class C<T> implements B<num> {
- var /*@covariance=genericImpl*/ x;
+ var x;
get y;
- set y(/*@covariance=genericImpl*/ value);
+ set y(value);
}
// This class also has members marked genericInterface, since the inferred types
// of x and y *do* depend on the type parameter T.
abstract class D<T> implements B<T> {
- var /*@covariance=genericImpl*/ x;
+ var x;
get y;
- set y(/*@covariance=genericImpl*/ value);
+ set y(value);
}
main() {}
diff --git a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.expect b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.expect
index 29d74ce..a959413 100644
--- a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
- field self::B::T y = null;
+ generic-covariant-impl field self::B::T x = null;
+ generic-covariant-impl field self::B::T y = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.transformed.expect
index 29d74ce..a959413 100644
--- a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.legacy.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x = null;
- field self::B::T y = null;
+ generic-covariant-impl field self::B::T x = null;
+ generic-covariant-impl field self::B::T y = null;
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
diff --git a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.outline.expect b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.outline.expect
index e9bcb8a..60525b9 100644
--- a/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.outline.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- field self::B::T x;
- field self::B::T y;
+ generic-covariant-impl field self::B::T x;
+ generic-covariant-impl field self::B::T y;
synthetic constructor •() → self::B<self::B::T>
;
}
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
index f38c741..261d869 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
@@ -38,9 +38,9 @@
abstract class I<T> {
T get x;
- void set x(T /*@covariance=genericImpl*/ value);
+ void set x(T value);
Object get y;
- void set y(covariant Object /*@covariance=explicit*/ value);
+ void set y(covariant Object value);
}
class M {
@@ -48,10 +48,7 @@
int y;
}
-class
-/*@forwardingStub=void set y(covariance=(explicit) Object value)*/
-/*@forwardingStub=void set x(covariance=(genericImpl) int _)*/
- C = B with M implements I<int>;
+class C = B with M implements I<int>;
void test(I<Object> i) {
expectTypeError(() {
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.outline.expect b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.outline.expect
index 2c1118b..4978034 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.outline.expect
@@ -18,7 +18,7 @@
synthetic constructor •() → self::I<self::I::T>
;
abstract get x() → self::I::T;
- abstract set x(self::I::T value) → void;
+ abstract set x(generic-covariant-impl self::I::T value) → void;
abstract get y() → core::Object;
abstract set y(covariant core::Object value) → void;
}
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
index 5fceebe..79e85ab 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
@@ -8,11 +8,11 @@
// int y;
// ^
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:43:12: Context: This is the overridden method ('y').
-// void set y(covariant Object /*@covariance=explicit*/ value);
+// void set y(covariant Object value);
// ^
-// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:54:5: Context: Override was introduced in the mixin application class 'C'.
-// C = B with M implements I<int>;
-// ^
+// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:51:7: Context: Override was introduced in the mixin application class 'C'.
+// class C = B with M implements I<int>;
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
index 8eeb4d8..574153f 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
@@ -38,9 +38,9 @@
abstract class I<T> {
T get x;
- void set x(T /*@covariance=genericImpl*/ value);
+ void set x(T value);
Object get y;
- void set y(covariant Object /*@covariance=explicit*/ value);
+ void set y(covariant Object value);
}
class M {
@@ -55,10 +55,7 @@
}
}
-class
-/*@forwardingStub=void set y(covariance=(explicit) Object value)*/
-/*@forwardingStub=void set x(covariance=(genericImpl) int value)*/
- C = B with M implements I<int>;
+class C = B with M implements I<int>;
void test(I<Object> i) {
expectTypeError(() {
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.outline.expect b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.outline.expect
index 4195710..4b6371a 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.outline.expect
@@ -18,7 +18,7 @@
synthetic constructor •() → self::I<self::I::T>
;
abstract get x() → self::I::T;
- abstract set x(self::I::T value) → void;
+ abstract set x(generic-covariant-impl self::I::T value) → void;
abstract get y() → core::Object;
abstract set y(covariant core::Object value) → void;
}
diff --git a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
index 5a1fc12..693230f 100644
--- a/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
+++ b/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
@@ -8,11 +8,11 @@
// void set y(int value) {
// ^
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart:43:12: Context: This is the overridden method ('y').
-// void set y(covariant Object /*@covariance=explicit*/ value);
+// void set y(covariant Object value);
// ^
-// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart:61:5: Context: Override was introduced in the mixin application class 'C'.
-// C = B with M implements I<int>;
-// ^
+// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart:58:7: Context: Override was introduced in the mixin application class 'C'.
+// class C = B with M implements I<int>;
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/front_end/testcases/runtime_checks_new/stub_checked_via_target.dart b/front_end/testcases/runtime_checks_new/stub_checked_via_target.dart
index 0a8e34b..a4fc889 100644
--- a/front_end/testcases/runtime_checks_new/stub_checked_via_target.dart
+++ b/front_end/testcases/runtime_checks_new/stub_checked_via_target.dart
@@ -26,7 +26,7 @@
}
abstract class I {
- int f(covariant Object /*@covariance=explicit*/ x);
+ int f(covariant Object x);
}
// Not a compile time error, because B.f satisfies the interface contract of I.f
@@ -35,8 +35,7 @@
// Note that even though the forwarding stub's type is `(Object) -> int`, it
// must check that `x` is an `int`, since it forwards to a method whose type is
// `(int) -> int`.
-class /*@forwardingStub=int f(covariance=(explicit) Object x)*/ C extends B
- implements I {}
+class C extends B implements I {}
void g(C c) {
// Not a compile time error, because C's interface inherits I.f (since it has
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
index 4c3139d..fc4ec48 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
@@ -15,8 +15,6 @@
T f(Object x);
}
-abstract class
-/*@forwardingStub=abstract (C::T) -> void f(covariance=() Object x)*/
- C<T> extends B<F<T>> implements I<F<T>> {}
+abstract class C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
index ff360dc..bf9a66b 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
@@ -15,8 +15,6 @@
void f(F<T> x, Object y);
}
-abstract class
-/*@forwardingStub=void f(covariance=(genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
- C<T> extends B<F<T>> implements I<F<T>> {}
+abstract class C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
index dc1766a..ef67155 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
@@ -10,11 +10,9 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericImpl*/ x, Object y);
+ void f(T x, Object y);
}
-abstract class
-/*@forwardingStub=void f(covariance=(genericImpl) int x, covariance=() Object y)*/
- C extends B implements I<int> {}
+abstract class C extends B implements I<int> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.expect
index 083d277..3334045 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x, core::Object y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::Object y) → void;
}
abstract class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.transformed.expect
index 083d277..3334045 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.legacy.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → self::I<self::I::T>
: super core::Object::•()
;
- abstract method f(self::I::T x, core::Object y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::Object y) → void;
}
abstract class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.outline.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.outline.expect
index 2fd12fe..205776d 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.outline.expect
@@ -11,7 +11,7 @@
abstract class I<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::I<self::I::T>
;
- abstract method f(self::I::T x, core::Object y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::Object y) → void;
}
abstract class C extends self::B implements self::I<core::int> {
synthetic constructor •() → self::C
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
index 6c7a38e..4d1e82d 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
@@ -6,15 +6,13 @@
library test;
class B<T> {
- void f(T /*@covariance=genericImpl*/ x, int y) {}
+ void f(T x, int y) {}
}
abstract class I {
void f(int x, Object y);
}
-abstract class
-/*@forwardingStub=abstract void f(covariance=(genericImpl) int x, covariance=() Object y)*/
- C extends B<int> implements I {}
+abstract class C extends B<int> implements I {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.expect
index c6e865f..3038f0e 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method f(self::B::T x, core::int y) → void {}
+ method f(generic-covariant-impl self::B::T x, core::int y) → void {}
}
abstract class I extends core::Object {
synthetic constructor •() → self::I
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.transformed.expect
index c6e865f..3038f0e 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.legacy.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → self::B<self::B::T>
: super core::Object::•()
;
- method f(self::B::T x, core::int y) → void {}
+ method f(generic-covariant-impl self::B::T x, core::int y) → void {}
}
abstract class I extends core::Object {
synthetic constructor •() → self::I
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.outline.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.outline.expect
index a447e02..9e7de41 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.outline.expect
@@ -5,7 +5,7 @@
class B<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::B<self::B::T>
;
- method f(self::B::T x, core::int y) → void
+ method f(generic-covariant-impl self::B::T x, core::int y) → void
;
}
abstract class I extends core::Object {
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
index 4b5e2b0..3b2bac1 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
@@ -8,19 +8,17 @@
typedef void F<T>(T t);
abstract class A<T> {
- void f(T /*@covariance=genericImpl*/ x, int y);
+ void f(T x, int y);
}
class B<T> implements A<F<T>> {
- void f(F<T> /*@covariance=genericImpl*/ x, int y) {}
+ void f(F<T> x, int y) {}
}
abstract class I<T> implements A<F<T>> {
- void f(F<T> /*@covariance=genericImpl*/ x, Object y);
+ void f(F<T> x, Object y);
}
-abstract class
-/*@forwardingStub=abstract void f(covariance=(genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
- C<T> extends B<F<T>> implements I<F<T>> {}
+abstract class C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.expect
index 8455164..df1249c 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- abstract method f(self::A::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::A::T x, core::int y) → void;
}
class B<T extends core::Object = dynamic> extends core::Object implements self::A<(self::B::T) → void> {
synthetic constructor •() → self::B<self::B::T>
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.transformed.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.transformed.expect
index 8455164..df1249c 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.transformed.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.legacy.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → self::A<self::A::T>
: super core::Object::•()
;
- abstract method f(self::A::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::A::T x, core::int y) → void;
}
class B<T extends core::Object = dynamic> extends core::Object implements self::A<(self::B::T) → void> {
synthetic constructor •() → self::B<self::B::T>
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.outline.expect b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.outline.expect
index 5313aae..c638537 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.outline.expect
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.outline.expect
@@ -6,7 +6,7 @@
abstract class A<T extends core::Object = dynamic> extends core::Object {
synthetic constructor •() → self::A<self::A::T>
;
- abstract method f(self::A::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::A::T x, core::int y) → void;
}
class B<T extends core::Object = dynamic> extends core::Object implements self::A<(self::B::T) → void> {
synthetic constructor •() → self::B<self::B::T>
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_interface.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_interface.dart
index 2de34db..57a9f99 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_interface.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_interface.dart
@@ -10,11 +10,9 @@
}
abstract class I {
- void f(covariant int /*@covariance=explicit*/ x, Object y);
+ void f(covariant int x, Object y);
}
-abstract class
-/*@forwardingStub=void f(covariance=(explicit) int x, covariance=() Object y)*/
- C extends B implements I {}
+abstract class C extends B implements I {}
void main() {}
diff --git a/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_super.dart b/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_super.dart
index f6e26ca..3daf251 100644
--- a/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_super.dart
+++ b/front_end/testcases/runtime_checks_new/stub_from_interface_covariant_from_super.dart
@@ -6,15 +6,13 @@
library test;
class B {
- void f(covariant int /*@covariance=explicit*/ x, int y) {}
+ void f(covariant int x, int y) {}
}
abstract class I {
void f(int x, Object y);
}
-abstract class
-/*@forwardingStub=abstract void f(covariance=(explicit) int x, covariance=() Object y)*/
- C extends B implements I {}
+abstract class C extends B implements I {}
void main() {}
diff --git a/front_end/testcases/spread_collection_inference.dart b/front_end/testcases/spread_collection_inference.dart
index 6225eca..60c1032 100644
--- a/front_end/testcases/spread_collection_inference.dart
+++ b/front_end/testcases/spread_collection_inference.dart
@@ -5,13 +5,18 @@
// This test case checks that inference works for spread collections, and that
// the errors are reported when necessary.
-/*@testedFeatures=inference,error*/
+/*@testedFeatures=inference*/
-foo() {
+Map<K, V> bar<K, V>() => null;
+
+foo(dynamic dynVar) {
List<int> spread = <int>[1, 2, 3];
Map<String, int> mapSpread = <String, int>{"foo": 4, "bar": 2};
int notSpreadInt = 42;
int Function() notSpreadFunction = null;
+ // Note that all values are actually ints.
+ Map<int, num> mapIntNum = <int, num>{42: 42};
+ List<num> listNum = <num>[42];
var /*@type=List<dynamic>*/ lhs10 = /*@typeArgs=dynamic*/ [...
/*@typeArgs=dynamic*/ []];
@@ -45,7 +50,7 @@
var /*@type=Map<dynamic, dynamic>*/ map21 = /*@typeArgs=dynamic, dynamic*/
{...(mapSpread as dynamic), "baz": 42};
- dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
+ dynamic map21ambiguous = {...
(mapSpread as dynamic)};
List<int> lhs22 = /*@typeArgs=int*/ [... /*@typeArgs=int*/ []];
@@ -69,60 +74,60 @@
Map<String, List<int>> map23 = /*@typeArgs=String, List<int>*/
{... /*@typeArgs=String, List<int>*/ {"baz": /*@typeArgs=int*/ []}};
- dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
+ dynamic map24ambiguous = {...
spread, ...mapSpread};
- int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
+ int lhs30 = /*@typeArgs=int*/ [...spread];
- int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
+ int set30 = /*@typeArgs=int*/ {...spread, 42};
- int set30ambiguous = /*@error=InvalidAssignment*/ /*@typeArgs=int*/
+ int set30ambiguous = /*@typeArgs=int*/
{...spread};
- int map30 = /*@error=InvalidAssignment*/ /*@typeArgs=String, int*/
+ int map30 = /*@typeArgs=String, int*/
{...mapSpread, "baz": 42};
- int map30ambiguous = /*@error=InvalidAssignment*/ /*@typeArgs=String, int*/
+ int map30ambiguous = /*@typeArgs=String, int*/
{...mapSpread};
- List<dynamic> lhs40 = <dynamic>[... /*@error=SpreadTypeMismatch*/
+ List<dynamic> lhs40 = <dynamic>[...
notSpreadInt];
- Set<dynamic> set40 = <dynamic>{... /*@error=SpreadTypeMismatch*/
+ Set<dynamic> set40 = <dynamic>{...
notSpreadInt};
Map<dynamic, dynamic> map40 = <dynamic, dynamic>{...
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadInt};
+ notSpreadInt};
- List<dynamic> lhs50 = <dynamic> [... /*@error=SpreadTypeMismatch*/
+ List<dynamic> lhs50 = <dynamic> [...
notSpreadFunction];
- Set<dynamic> set50 = <dynamic> {... /*@error=SpreadTypeMismatch*/
+ Set<dynamic> set50 = <dynamic> {...
notSpreadFunction};
Map<dynamic, dynamic> map50 = <dynamic, dynamic>{...
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadFunction};
+ notSpreadFunction};
- List<String> lhs60 = <String>[... /*@error=SpreadElementTypeMismatch*/
+ List<String> lhs60 = <String>[...
spread];
- Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
+ Set<String> set60 = <String>{... spread};
Map<int, int> map60 = <int, int>{...
- /*@error=SpreadMapEntryElementKeyTypeMismatch*/ mapSpread};
+ mapSpread};
Map<String, String> map61 = <String, String>{...
- /*@error=SpreadMapEntryElementValueTypeMismatch*/ mapSpread};
+ mapSpread};
- List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
+ List<int> lhs70 = <int>[... null];
- Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
+ Set<int> set70 = <int>{... null};
var /*@type=Set<dynamic>*/ set71ambiguous = /*@typeArgs=dynamic*/
- {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
+ {... null, ... /*@typeArgs=dynamic*/
[]};
- Map<String, int> map70 = <String, int>{... /*@error=NonNullAwareSpreadIsNull*/
+ Map<String, int> map70 = <String, int>{...
null};
List<int> lhs80 = <int>[...?null];
@@ -133,6 +138,16 @@
{...?null, ... /*@typeArgs=dynamic*/ []};
Map<String, int> map80 = <String, int>{...?null};
+
+ var /*@type=Map<String, int>*/ map90 = <String, int>{... /*@typeArgs=String, int*/ bar()};
+
+ List<int> list100 = <int>[...listNum];
+
+ Map<num, int> map100 = <num, int>{...mapIntNum};
+
+ List<int> list110 = <int>[...dynVar];
+
+ Map<num, int> map110 = <num, int>{...dynVar};
}
main() {}
diff --git a/front_end/testcases/spread_collection_inference.dart.legacy.expect b/front_end/testcases/spread_collection_inference.dart.legacy.expect
index b419aeb..4eac9e2 100644
--- a/front_end/testcases/spread_collection_inference.dart.legacy.expect
+++ b/front_end/testcases/spread_collection_inference.dart.legacy.expect
@@ -2,206 +2,230 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/spread_collection_inference.dart:16:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:21:62: Error: Unexpected token '...'.
// var /*@type=List<dynamic>*/ lhs10 = /*@typeArgs=dynamic*/ [...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:19:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:24:48: Error: Unexpected token '...'.
// var /*@type=Set<dynamic>*/ set10 = <dynamic>{... /*@typeArgs=dynamic*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:21:66: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:26:66: Error: Unexpected token '...'.
// var /*@type=Map<dynamic, dynamic>*/ map10 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:25:37: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:30:37: Error: Unexpected token '...'.
// /*@typeArgs=dynamic, dynamic*/ {... /*@typeArgs=dynamic, dynamic*/ {}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:27:54: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:32:54: Error: Unexpected token '...'.
// var /*@type=List<int>*/ lhs20 = /*@typeArgs=int*/ [...spread];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:29:53: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:34:53: Error: Unexpected token '...'.
// var /*@type=Set<int>*/ set20 = /*@typeArgs=int*/ {...spread, 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:31:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:36:62: Error: Unexpected token '...'.
// var /*@type=Set<int>*/ set20ambiguous = /*@typeArgs=int*/ {...spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:34:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:39:6: Error: Unexpected token '...'.
// {...mapSpread, "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:37:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:42:6: Error: Unexpected token '...'.
// {...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:39:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:44:62: Error: Unexpected token '...'.
// var /*@type=List<dynamic>*/ lhs21 = /*@typeArgs=dynamic*/ [...(spread as
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:42:61: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:47:61: Error: Unexpected token '...'.
// var /*@type=Set<dynamic>*/ set21 = /*@typeArgs=dynamic*/ {...(spread as
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:46:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:51:6: Error: Unexpected token '...'.
// {...(mapSpread as dynamic), "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:48:77: Error: Unexpected token '...'.
-// dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:53:29: Error: Unexpected token '...'.
+// dynamic map21ambiguous = {...
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:51:40: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:56:40: Error: Unexpected token '...'.
// List<int> lhs22 = /*@typeArgs=int*/ [... /*@typeArgs=int*/ []];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:53:39: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:58:39: Error: Unexpected token '...'.
// Set<int> set22 = /*@typeArgs=int*/ {... /*@typeArgs=int*/ [], 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:55:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:60:48: Error: Unexpected token '...'.
// Set<int> set22ambiguous = /*@typeArgs=int*/ {... /*@typeArgs=int*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:58:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:63:6: Error: Unexpected token '...'.
// {... /*@typeArgs=String, int*/ {}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:60:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:65:52: Error: Unexpected token '...'.
// List<List<int>> lhs23 = /*@typeArgs=List<int>*/ [... /*@typeArgs=List<int>*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:63:51: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:68:51: Error: Unexpected token '...'.
// Set<List<int>> set23 = /*@typeArgs=List<int>*/ {... /*@typeArgs=List<int>*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:67:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:72:6: Error: Unexpected token '...'.
// {... /*@typeArgs=List<int>*/ [/*@typeArgs=int*/ []]};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:70:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:75:6: Error: Unexpected token '...'.
// {... /*@typeArgs=String, List<int>*/ {"baz": /*@typeArgs=int*/ []}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:72:77: Error: Unexpected token '...'.
-// dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:77:29: Error: Unexpected token '...'.
+// dynamic map24ambiguous = {...
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:73:13: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:78:13: Error: Unexpected token '...'.
// spread, ...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:75:63: Error: Unexpected token '...'.
-// int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:80:34: Error: Unexpected token '...'.
+// int lhs30 = /*@typeArgs=int*/ [...spread];
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:77:63: Error: Unexpected token '...'.
-// int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:82:34: Error: Unexpected token '...'.
+// int set30 = /*@typeArgs=int*/ {...spread, 42};
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:80:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:85:6: Error: Unexpected token '...'.
// {...spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:83:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:88:6: Error: Unexpected token '...'.
// {...mapSpread, "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:86:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:91:6: Error: Unexpected token '...'.
// {...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:88:35: Error: Unexpected token '...'.
-// List<dynamic> lhs40 = <dynamic>[... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:93:35: Error: Unexpected token '...'.
+// List<dynamic> lhs40 = <dynamic>[...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:91:34: Error: Unexpected token '...'.
-// Set<dynamic> set40 = <dynamic>{... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:96:34: Error: Unexpected token '...'.
+// Set<dynamic> set40 = <dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:94:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:99:52: Error: Unexpected token '...'.
// Map<dynamic, dynamic> map40 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:97:36: Error: Unexpected token '...'.
-// List<dynamic> lhs50 = <dynamic> [... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:102:36: Error: Unexpected token '...'.
+// List<dynamic> lhs50 = <dynamic> [...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:100:35: Error: Unexpected token '...'.
-// Set<dynamic> set50 = <dynamic> {... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:105:35: Error: Unexpected token '...'.
+// Set<dynamic> set50 = <dynamic> {...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:103:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:108:52: Error: Unexpected token '...'.
// Map<dynamic, dynamic> map50 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:106:33: Error: Unexpected token '...'.
-// List<String> lhs60 = <String>[... /*@error=SpreadElementTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:111:33: Error: Unexpected token '...'.
+// List<String> lhs60 = <String>[...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:109:32: Error: Unexpected token '...'.
-// Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
+// pkg/front_end/testcases/spread_collection_inference.dart:114:32: Error: Unexpected token '...'.
+// Set<String> set60 = <String>{... spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:111:36: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:116:36: Error: Unexpected token '...'.
// Map<int, int> map60 = <int, int>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:114:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:119:48: Error: Unexpected token '...'.
// Map<String, String> map61 = <String, String>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:117:27: Error: Unexpected token '...'.
-// List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
+// pkg/front_end/testcases/spread_collection_inference.dart:122:27: Error: Unexpected token '...'.
+// List<int> lhs70 = <int>[... null];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:119:26: Error: Unexpected token '...'.
-// Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
+// pkg/front_end/testcases/spread_collection_inference.dart:124:26: Error: Unexpected token '...'.
+// Set<int> set70 = <int>{... null};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:6: Error: Unexpected token '...'.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
+// pkg/front_end/testcases/spread_collection_inference.dart:127:6: Error: Unexpected token '...'.
+// {... null, ... /*@typeArgs=dynamic*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:52: Error: Unexpected token '...'.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:127:16: Error: Unexpected token '...'.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:125:42: Error: Unexpected token '...'.
-// Map<String, int> map70 = <String, int>{... /*@error=NonNullAwareSpreadIsNull*/
+// pkg/front_end/testcases/spread_collection_inference.dart:130:42: Error: Unexpected token '...'.
+// Map<String, int> map70 = <String, int>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:128:27: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:133:27: Error: Unexpected token '...?'.
// List<int> lhs80 = <int>[...?null];
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:130:26: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:135:26: Error: Unexpected token '...?'.
// Set<int> set80 = <int>{...?null};
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:133:6: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:138:6: Error: Unexpected token '...?'.
// {...?null, ... /*@typeArgs=dynamic*/ []};
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:133:16: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:138:16: Error: Unexpected token '...'.
// {...?null, ... /*@typeArgs=dynamic*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:135:42: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:140:42: Error: Unexpected token '...?'.
// Map<String, int> map80 = <String, int>{...?null};
// ^^^^
//
+// pkg/front_end/testcases/spread_collection_inference.dart:142:56: Error: Unexpected token '...'.
+// var /*@type=Map<String, int>*/ map90 = <String, int>{... /*@typeArgs=String, int*/ bar()};
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:144:29: Error: Unexpected token '...'.
+// List<int> list100 = <int>[...listNum];
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:146:37: Error: Unexpected token '...'.
+// Map<num, int> map100 = <num, int>{...mapIntNum};
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:148:29: Error: Unexpected token '...'.
+// List<int> list110 = <int>[...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:150:37: Error: Unexpected token '...'.
+// Map<num, int> map110 = <num, int>{...dynVar};
+// ^^^
+//
import self as self;
import "dart:core" as core;
-static method foo() → dynamic {
+static method bar<K extends core::Object = dynamic, V extends core::Object = dynamic>() → core::Map<self::bar::K, self::bar::V>
+ return null;
+static method foo(dynamic dynVar) → dynamic {
core::List<core::int> spread = <core::int>[1, 2, 3];
core::Map<core::String, core::int> mapSpread = <core::String, core::int>{"foo": 4, "bar": 2};
core::int notSpreadInt = 42;
() → core::int notSpreadFunction = null;
+ core::Map<core::int, core::num> mapIntNum = <core::int, core::num>{42: 42};
+ core::List<core::num> listNum = <core::num>[42];
dynamic lhs10 = <dynamic>[];
dynamic set10 = <dynamic>{};
dynamic map10 = <dynamic, dynamic>{};
@@ -247,5 +271,10 @@
core::Set<core::int> set80 = <core::int>{};
dynamic set81ambiguous = <dynamic, dynamic>{};
core::Map<core::String, core::int> map80 = <core::String, core::int>{};
+ dynamic map90 = <core::String, core::int>{};
+ core::List<core::int> list100 = <core::int>[];
+ core::Map<core::num, core::int> map100 = <core::num, core::int>{};
+ core::List<core::int> list110 = <core::int>[];
+ core::Map<core::num, core::int> map110 = <core::num, core::int>{};
}
static method main() → dynamic {}
diff --git a/front_end/testcases/spread_collection_inference.dart.legacy.transformed.expect b/front_end/testcases/spread_collection_inference.dart.legacy.transformed.expect
index b419aeb..4eac9e2 100644
--- a/front_end/testcases/spread_collection_inference.dart.legacy.transformed.expect
+++ b/front_end/testcases/spread_collection_inference.dart.legacy.transformed.expect
@@ -2,206 +2,230 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/spread_collection_inference.dart:16:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:21:62: Error: Unexpected token '...'.
// var /*@type=List<dynamic>*/ lhs10 = /*@typeArgs=dynamic*/ [...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:19:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:24:48: Error: Unexpected token '...'.
// var /*@type=Set<dynamic>*/ set10 = <dynamic>{... /*@typeArgs=dynamic*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:21:66: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:26:66: Error: Unexpected token '...'.
// var /*@type=Map<dynamic, dynamic>*/ map10 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:25:37: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:30:37: Error: Unexpected token '...'.
// /*@typeArgs=dynamic, dynamic*/ {... /*@typeArgs=dynamic, dynamic*/ {}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:27:54: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:32:54: Error: Unexpected token '...'.
// var /*@type=List<int>*/ lhs20 = /*@typeArgs=int*/ [...spread];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:29:53: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:34:53: Error: Unexpected token '...'.
// var /*@type=Set<int>*/ set20 = /*@typeArgs=int*/ {...spread, 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:31:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:36:62: Error: Unexpected token '...'.
// var /*@type=Set<int>*/ set20ambiguous = /*@typeArgs=int*/ {...spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:34:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:39:6: Error: Unexpected token '...'.
// {...mapSpread, "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:37:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:42:6: Error: Unexpected token '...'.
// {...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:39:62: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:44:62: Error: Unexpected token '...'.
// var /*@type=List<dynamic>*/ lhs21 = /*@typeArgs=dynamic*/ [...(spread as
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:42:61: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:47:61: Error: Unexpected token '...'.
// var /*@type=Set<dynamic>*/ set21 = /*@typeArgs=dynamic*/ {...(spread as
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:46:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:51:6: Error: Unexpected token '...'.
// {...(mapSpread as dynamic), "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:48:77: Error: Unexpected token '...'.
-// dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:53:29: Error: Unexpected token '...'.
+// dynamic map21ambiguous = {...
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:51:40: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:56:40: Error: Unexpected token '...'.
// List<int> lhs22 = /*@typeArgs=int*/ [... /*@typeArgs=int*/ []];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:53:39: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:58:39: Error: Unexpected token '...'.
// Set<int> set22 = /*@typeArgs=int*/ {... /*@typeArgs=int*/ [], 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:55:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:60:48: Error: Unexpected token '...'.
// Set<int> set22ambiguous = /*@typeArgs=int*/ {... /*@typeArgs=int*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:58:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:63:6: Error: Unexpected token '...'.
// {... /*@typeArgs=String, int*/ {}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:60:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:65:52: Error: Unexpected token '...'.
// List<List<int>> lhs23 = /*@typeArgs=List<int>*/ [... /*@typeArgs=List<int>*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:63:51: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:68:51: Error: Unexpected token '...'.
// Set<List<int>> set23 = /*@typeArgs=List<int>*/ {... /*@typeArgs=List<int>*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:67:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:72:6: Error: Unexpected token '...'.
// {... /*@typeArgs=List<int>*/ [/*@typeArgs=int*/ []]};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:70:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:75:6: Error: Unexpected token '...'.
// {... /*@typeArgs=String, List<int>*/ {"baz": /*@typeArgs=int*/ []}};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:72:77: Error: Unexpected token '...'.
-// dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:77:29: Error: Unexpected token '...'.
+// dynamic map24ambiguous = {...
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:73:13: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:78:13: Error: Unexpected token '...'.
// spread, ...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:75:63: Error: Unexpected token '...'.
-// int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:80:34: Error: Unexpected token '...'.
+// int lhs30 = /*@typeArgs=int*/ [...spread];
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:77:63: Error: Unexpected token '...'.
-// int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:82:34: Error: Unexpected token '...'.
+// int set30 = /*@typeArgs=int*/ {...spread, 42};
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:80:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:85:6: Error: Unexpected token '...'.
// {...spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:83:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:88:6: Error: Unexpected token '...'.
// {...mapSpread, "baz": 42};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:86:6: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:91:6: Error: Unexpected token '...'.
// {...mapSpread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:88:35: Error: Unexpected token '...'.
-// List<dynamic> lhs40 = <dynamic>[... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:93:35: Error: Unexpected token '...'.
+// List<dynamic> lhs40 = <dynamic>[...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:91:34: Error: Unexpected token '...'.
-// Set<dynamic> set40 = <dynamic>{... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:96:34: Error: Unexpected token '...'.
+// Set<dynamic> set40 = <dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:94:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:99:52: Error: Unexpected token '...'.
// Map<dynamic, dynamic> map40 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:97:36: Error: Unexpected token '...'.
-// List<dynamic> lhs50 = <dynamic> [... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:102:36: Error: Unexpected token '...'.
+// List<dynamic> lhs50 = <dynamic> [...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:100:35: Error: Unexpected token '...'.
-// Set<dynamic> set50 = <dynamic> {... /*@error=SpreadTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:105:35: Error: Unexpected token '...'.
+// Set<dynamic> set50 = <dynamic> {...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:103:52: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:108:52: Error: Unexpected token '...'.
// Map<dynamic, dynamic> map50 = <dynamic, dynamic>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:106:33: Error: Unexpected token '...'.
-// List<String> lhs60 = <String>[... /*@error=SpreadElementTypeMismatch*/
+// pkg/front_end/testcases/spread_collection_inference.dart:111:33: Error: Unexpected token '...'.
+// List<String> lhs60 = <String>[...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:109:32: Error: Unexpected token '...'.
-// Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
+// pkg/front_end/testcases/spread_collection_inference.dart:114:32: Error: Unexpected token '...'.
+// Set<String> set60 = <String>{... spread};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:111:36: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:116:36: Error: Unexpected token '...'.
// Map<int, int> map60 = <int, int>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:114:48: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:119:48: Error: Unexpected token '...'.
// Map<String, String> map61 = <String, String>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:117:27: Error: Unexpected token '...'.
-// List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
+// pkg/front_end/testcases/spread_collection_inference.dart:122:27: Error: Unexpected token '...'.
+// List<int> lhs70 = <int>[... null];
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:119:26: Error: Unexpected token '...'.
-// Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
+// pkg/front_end/testcases/spread_collection_inference.dart:124:26: Error: Unexpected token '...'.
+// Set<int> set70 = <int>{... null};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:6: Error: Unexpected token '...'.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
+// pkg/front_end/testcases/spread_collection_inference.dart:127:6: Error: Unexpected token '...'.
+// {... null, ... /*@typeArgs=dynamic*/
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:52: Error: Unexpected token '...'.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
-// ^^^
+// pkg/front_end/testcases/spread_collection_inference.dart:127:16: Error: Unexpected token '...'.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:125:42: Error: Unexpected token '...'.
-// Map<String, int> map70 = <String, int>{... /*@error=NonNullAwareSpreadIsNull*/
+// pkg/front_end/testcases/spread_collection_inference.dart:130:42: Error: Unexpected token '...'.
+// Map<String, int> map70 = <String, int>{...
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:128:27: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:133:27: Error: Unexpected token '...?'.
// List<int> lhs80 = <int>[...?null];
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:130:26: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:135:26: Error: Unexpected token '...?'.
// Set<int> set80 = <int>{...?null};
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:133:6: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:138:6: Error: Unexpected token '...?'.
// {...?null, ... /*@typeArgs=dynamic*/ []};
// ^^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:133:16: Error: Unexpected token '...'.
+// pkg/front_end/testcases/spread_collection_inference.dart:138:16: Error: Unexpected token '...'.
// {...?null, ... /*@typeArgs=dynamic*/ []};
// ^^^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:135:42: Error: Unexpected token '...?'.
+// pkg/front_end/testcases/spread_collection_inference.dart:140:42: Error: Unexpected token '...?'.
// Map<String, int> map80 = <String, int>{...?null};
// ^^^^
//
+// pkg/front_end/testcases/spread_collection_inference.dart:142:56: Error: Unexpected token '...'.
+// var /*@type=Map<String, int>*/ map90 = <String, int>{... /*@typeArgs=String, int*/ bar()};
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:144:29: Error: Unexpected token '...'.
+// List<int> list100 = <int>[...listNum];
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:146:37: Error: Unexpected token '...'.
+// Map<num, int> map100 = <num, int>{...mapIntNum};
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:148:29: Error: Unexpected token '...'.
+// List<int> list110 = <int>[...dynVar];
+// ^^^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:150:37: Error: Unexpected token '...'.
+// Map<num, int> map110 = <num, int>{...dynVar};
+// ^^^
+//
import self as self;
import "dart:core" as core;
-static method foo() → dynamic {
+static method bar<K extends core::Object = dynamic, V extends core::Object = dynamic>() → core::Map<self::bar::K, self::bar::V>
+ return null;
+static method foo(dynamic dynVar) → dynamic {
core::List<core::int> spread = <core::int>[1, 2, 3];
core::Map<core::String, core::int> mapSpread = <core::String, core::int>{"foo": 4, "bar": 2};
core::int notSpreadInt = 42;
() → core::int notSpreadFunction = null;
+ core::Map<core::int, core::num> mapIntNum = <core::int, core::num>{42: 42};
+ core::List<core::num> listNum = <core::num>[42];
dynamic lhs10 = <dynamic>[];
dynamic set10 = <dynamic>{};
dynamic map10 = <dynamic, dynamic>{};
@@ -247,5 +271,10 @@
core::Set<core::int> set80 = <core::int>{};
dynamic set81ambiguous = <dynamic, dynamic>{};
core::Map<core::String, core::int> map80 = <core::String, core::int>{};
+ dynamic map90 = <core::String, core::int>{};
+ core::List<core::int> list100 = <core::int>[];
+ core::Map<core::num, core::int> map100 = <core::num, core::int>{};
+ core::List<core::int> list110 = <core::int>[];
+ core::Map<core::num, core::int> map110 = <core::num, core::int>{};
}
static method main() → dynamic {}
diff --git a/front_end/testcases/spread_collection_inference.dart.outline.expect b/front_end/testcases/spread_collection_inference.dart.outline.expect
index 07ce31d..e8acddb 100644
--- a/front_end/testcases/spread_collection_inference.dart.outline.expect
+++ b/front_end/testcases/spread_collection_inference.dart.outline.expect
@@ -1,7 +1,10 @@
library;
import self as self;
+import "dart:core" as core;
-static method foo() → dynamic
+static method bar<K extends core::Object = dynamic, V extends core::Object = dynamic>() → core::Map<self::bar::K, self::bar::V>
+ ;
+static method foo(dynamic dynVar) → dynamic
;
static method main() → dynamic
;
diff --git a/front_end/testcases/spread_collection_inference.dart.strong.expect b/front_end/testcases/spread_collection_inference.dart.strong.expect
index fa9fa70..27a3664 100644
--- a/front_end/testcases/spread_collection_inference.dart.strong.expect
+++ b/front_end/testcases/spread_collection_inference.dart.strong.expect
@@ -2,104 +2,102 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/spread_collection_inference.dart:48:76: Error: Not enough type information to disambiguate between literal set and literal map.
+// pkg/front_end/testcases/spread_collection_inference.dart:53:28: Error: Not enough type information to disambiguate between literal set and literal map.
// Try providing type arguments for the literal explicitly to disambiguate it.
-// dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
-// ^
+// dynamic map21ambiguous = {...
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:72:76: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
-// dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
-// ^
-// pkg/front_end/testcases/spread_collection_inference.dart:73:5: Context: Iterable spread.
-// spread, ...mapSpread};
-// ^
-// pkg/front_end/testcases/spread_collection_inference.dart:73:16: Context: Map spread.
-// spread, ...mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:77:28: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// dynamic map24ambiguous = {...
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:75:62: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:80:33: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
// - 'List' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
-// ^
+// int lhs30 = /*@typeArgs=int*/ [...spread];
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:77:62: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:82:33: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
// - 'Set' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
-// ^
+// int set30 = /*@typeArgs=int*/ {...spread, 42};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:80:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:85:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
// - 'Set' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...spread};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:83:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:88:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
// - 'Map' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...mapSpread, "baz": 42};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:86:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:91:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
// - 'Map' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...mapSpread};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:89:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:94:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadInt];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:92:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:97:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadInt};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:95:43: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
-// /*@error=SpreadMapEntryTypeMismatch*/ notSpreadInt};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:100:2: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// notSpreadInt};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:98:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:103:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadFunction];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:101:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:106:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadFunction};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:104:43: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
-// /*@error=SpreadMapEntryTypeMismatch*/ notSpreadFunction};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:109:2: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
+// notSpreadFunction};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:107:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+// pkg/front_end/testcases/spread_collection_inference.dart:112:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
// spread];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:109:73: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
-// Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:114:36: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+// Set<String> set60 = <String>{... spread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:112:53: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
-// /*@error=SpreadMapEntryElementKeyTypeMismatch*/ mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:117:2: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
+// mapSpread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:115:55: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
-// /*@error=SpreadMapEntryElementValueTypeMismatch*/ mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:120:2: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
+// mapSpread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:117:67: Error: Can't spread a value with static type Null.
-// List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:122:31: Error: Can't spread a value with static type Null.
+// List<int> lhs70 = <int>[... null];
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:119:66: Error: Can't spread a value with static type Null.
-// Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:124:30: Error: Can't spread a value with static type Null.
+// Set<int> set70 = <int>{... null};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:46: Error: Can't spread a value with static type Null.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Can't spread a value with static type Null.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:126:5: Error: Can't spread a value with static type Null.
+// pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Expected ',' before this.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:131:5: Error: Can't spread a value with static type Null.
// null};
// ^
//
@@ -107,11 +105,15 @@
import "dart:core" as core;
import "dart:collection" as col;
-static method foo() → dynamic {
+static method bar<K extends core::Object = dynamic, V extends core::Object = dynamic>() → core::Map<self::bar::K, self::bar::V>
+ return null;
+static method foo(dynamic dynVar) → dynamic {
core::List<core::int> spread = <core::int>[1, 2, 3];
core::Map<core::String, core::int> mapSpread = <core::String, core::int>{"foo": 4, "bar": 2};
core::int notSpreadInt = 42;
() → core::int notSpreadFunction = null;
+ core::Map<core::int, core::num> mapIntNum = <core::int, core::num>{42: 42};
+ core::List<core::num> listNum = <core::num>[42];
core::List<dynamic> lhs10 = block {
final core::List<dynamic> #t1 = <dynamic>[];
for (final dynamic #t2 in <dynamic>[])
@@ -145,209 +147,258 @@
} =>#t11;
core::Set<core::int> set20ambiguous = block {
final core::Set<core::int> #t13 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t14 in spread)
- #t13.{core::Set::add}(#t14);
+ for (final dynamic #t14 in spread) {
+ final core::int #t15 = #t14 as{TypeError} core::int;
+ #t13.{core::Set::add}(#t15);
+ }
} =>#t13;
core::Map<core::String, core::int> map20 = block {
- final core::Map<core::String, core::int> #t15 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t16 in mapSpread.{core::Map::entries})
- #t15.{core::Map::[]=}(#t16.{core::MapEntry::key}, #t16.{core::MapEntry::value});
- #t15.{core::Map::[]=}("baz", 42);
- } =>#t15;
+ final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t17 in mapSpread.{core::Map::entries})
+ #t16.{core::Map::[]=}(#t17.{core::MapEntry::key}, #t17.{core::MapEntry::value});
+ #t16.{core::Map::[]=}("baz", 42);
+ } =>#t16;
core::Map<core::String, core::int> map20ambiguous = block {
- final core::Map<core::String, core::int> #t17 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t18 in mapSpread.{core::Map::entries})
- #t17.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
- } =>#t17;
+ final core::Map<core::String, core::int> #t18 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t19 in mapSpread.{core::Map::entries})
+ #t18.{core::Map::[]=}(#t19.{core::MapEntry::key}, #t19.{core::MapEntry::value});
+ } =>#t18;
core::List<dynamic> lhs21 = block {
- final core::List<dynamic> #t19 = <dynamic>[];
- for (final dynamic #t20 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
- #t19.{core::List::add}(#t20);
- } =>#t19;
+ final core::List<dynamic> #t20 = <dynamic>[];
+ for (final dynamic #t21 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
+ #t20.{core::List::add}(#t21);
+ } =>#t20;
core::Set<dynamic> set21 = block {
- final core::Set<dynamic> #t21 = col::LinkedHashSet::•<dynamic>();
- for (final dynamic #t22 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
- #t21.{core::Set::add}(#t22);
- #t21.{core::Set::add}(42);
- } =>#t21;
+ final core::Set<dynamic> #t22 = col::LinkedHashSet::•<dynamic>();
+ for (final dynamic #t23 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
+ #t22.{core::Set::add}(#t23);
+ #t22.{core::Set::add}(42);
+ } =>#t22;
core::Map<dynamic, dynamic> map21 = block {
- final core::Map<dynamic, dynamic> #t23 = <dynamic, dynamic>{};
- for (final core::MapEntry<dynamic, dynamic> #t24 in ((mapSpread as dynamic) as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
- #t23.{core::Map::[]=}(#t24.{core::MapEntry::key}, #t24.{core::MapEntry::value});
- #t23.{core::Map::[]=}("baz", 42);
- } =>#t23;
- dynamic map21ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:48:76: Error: Not enough type information to disambiguate between literal set and literal map.
+ final core::Map<dynamic, dynamic> #t24 = <dynamic, dynamic>{};
+ for (final core::MapEntry<dynamic, dynamic> #t25 in ((mapSpread as dynamic) as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
+ #t24.{core::Map::[]=}(#t25.{core::MapEntry::key}, #t25.{core::MapEntry::value});
+ #t24.{core::Map::[]=}("baz", 42);
+ } =>#t24;
+ dynamic map21ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:53:28: Error: Not enough type information to disambiguate between literal set and literal map.
Try providing type arguments for the literal explicitly to disambiguate it.
- dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
- ^";
+ dynamic map21ambiguous = {...
+ ^";
core::List<core::int> lhs22 = block {
- final core::List<core::int> #t25 = <core::int>[];
- for (final core::int #t26 in <core::int>[])
- #t25.{core::List::add}(#t26);
- } =>#t25;
+ final core::List<core::int> #t26 = <core::int>[];
+ for (final core::int #t27 in <core::int>[])
+ #t26.{core::List::add}(#t27);
+ } =>#t26;
core::Set<core::int> set22 = block {
- final core::Set<core::int> #t27 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t28 in <core::int>[])
- #t27.{core::Set::add}(#t28);
- #t27.{core::Set::add}(42);
- } =>#t27;
+ final core::Set<core::int> #t28 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t29 in <core::int>[])
+ #t28.{core::Set::add}(#t29);
+ #t28.{core::Set::add}(42);
+ } =>#t28;
core::Set<core::int> set22ambiguous = block {
- final core::Set<core::int> #t29 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t30 in <core::int>[])
- #t29.{core::Set::add}(#t30);
- } =>#t29;
+ final core::Set<core::int> #t30 = col::LinkedHashSet::•<core::int>();
+ for (final dynamic #t31 in <core::int>[]) {
+ final core::int #t32 = #t31 as{TypeError} core::int;
+ #t30.{core::Set::add}(#t32);
+ }
+ } =>#t30;
core::Map<core::String, core::int> map22 = block {
- final core::Map<core::String, core::int> #t31 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t32 in <core::String, core::int>{}.{core::Map::entries})
- #t31.{core::Map::[]=}(#t32.{core::MapEntry::key}, #t32.{core::MapEntry::value});
- } =>#t31;
- core::List<core::List<core::int>> lhs23 = block {
- final core::List<core::List<core::int>> #t33 = <core::List<core::int>>[];
- for (final core::List<core::int> #t34 in <core::List<core::int>>[<core::int>[]])
- #t33.{core::List::add}(#t34);
+ final core::Map<core::String, core::int> #t33 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t34 in <core::String, core::int>{}.{core::Map::entries})
+ #t33.{core::Map::[]=}(#t34.{core::MapEntry::key}, #t34.{core::MapEntry::value});
} =>#t33;
- core::Set<core::List<core::int>> set23 = block {
- final core::Set<core::List<core::int>> #t35 = col::LinkedHashSet::•<core::List<core::int>>();
+ core::List<core::List<core::int>> lhs23 = block {
+ final core::List<core::List<core::int>> #t35 = <core::List<core::int>>[];
for (final core::List<core::int> #t36 in <core::List<core::int>>[<core::int>[]])
- #t35.{core::Set::add}(#t36);
- #t35.{core::Set::add}(<core::int>[42]);
+ #t35.{core::List::add}(#t36);
} =>#t35;
- core::Set<core::List<core::int>> set23ambiguous = block {
+ core::Set<core::List<core::int>> set23 = block {
final core::Set<core::List<core::int>> #t37 = col::LinkedHashSet::•<core::List<core::int>>();
for (final core::List<core::int> #t38 in <core::List<core::int>>[<core::int>[]])
#t37.{core::Set::add}(#t38);
+ #t37.{core::Set::add}(<core::int>[42]);
} =>#t37;
- core::Map<core::String, core::List<core::int>> map23 = block {
- final core::Map<core::String, core::List<core::int>> #t39 = <core::String, core::List<core::int>>{};
- for (final core::MapEntry<core::String, core::List<core::int>> #t40 in <core::String, core::List<core::int>>{"baz": <core::int>[]}.{core::Map::entries})
- #t39.{core::Map::[]=}(#t40.{core::MapEntry::key}, #t40.{core::MapEntry::value});
+ core::Set<core::List<core::int>> set23ambiguous = block {
+ final core::Set<core::List<core::int>> #t39 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (final dynamic #t40 in <core::List<core::int>>[<core::int>[]]) {
+ final core::List<core::int> #t41 = #t40 as{TypeError} core::List<core::int>;
+ #t39.{core::Set::add}(#t41);
+ }
} =>#t39;
- dynamic map24ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:72:76: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
- dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
- ^";
- core::int lhs30 = let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:75:62: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
+ core::Map<core::String, core::List<core::int>> map23 = block {
+ final core::Map<core::String, core::List<core::int>> #t42 = <core::String, core::List<core::int>>{};
+ for (final core::MapEntry<core::String, core::List<core::int>> #t43 in <core::String, core::List<core::int>>{"baz": <core::int>[]}.{core::Map::entries})
+ #t42.{core::Map::[]=}(#t43.{core::MapEntry::key}, #t43.{core::MapEntry::value});
+ } =>#t42;
+ dynamic map24ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:77:28: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ dynamic map24ambiguous = {...
+ ^";
+ core::int lhs30 = let final<BottomType> #t44 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:80:33: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
- 'List' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
- ^" in ( block {
- final core::List<core::int> #t42 = <core::int>[];
- for (final core::int #t43 in spread)
- #t42.{core::List::add}(#t43);
- } =>#t42) as{TypeError} core::int;
- core::int set30 = let final<BottomType> #t44 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:77:62: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+ int lhs30 = /*@typeArgs=int*/ [...spread];
+ ^" in ( block {
+ final core::List<core::int> #t45 = <core::int>[];
+ for (final core::int #t46 in spread)
+ #t45.{core::List::add}(#t46);
+ } =>#t45) as{TypeError} core::int;
+ core::int set30 = let final<BottomType> #t47 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:82:33: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
- 'Set' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
- ^" in ( block {
- final core::Set<core::int> #t45 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t46 in spread)
- #t45.{core::Set::add}(#t46);
- #t45.{core::Set::add}(42);
- } =>#t45) as{TypeError} core::int;
- core::int set30ambiguous = let final<BottomType> #t47 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:80:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+ int set30 = /*@typeArgs=int*/ {...spread, 42};
+ ^" in ( block {
+ final core::Set<core::int> #t48 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t49 in spread)
+ #t48.{core::Set::add}(#t49);
+ #t48.{core::Set::add}(42);
+ } =>#t48) as{TypeError} core::int;
+ core::int set30ambiguous = let final<BottomType> #t50 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:85:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
- 'Set' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...spread};
^" in ( block {
- final core::Set<core::int> #t48 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t49 in spread)
- #t48.{core::Set::add}(#t49);
- } =>#t48) as{TypeError} core::int;
- core::int map30 = let final<BottomType> #t50 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:83:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+ final core::Set<core::int> #t51 = col::LinkedHashSet::•<core::int>();
+ for (final dynamic #t52 in spread) {
+ final core::int #t53 = #t52 as{TypeError} core::int;
+ #t51.{core::Set::add}(#t53);
+ }
+ } =>#t51) as{TypeError} core::int;
+ core::int map30 = let final<BottomType> #t54 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:88:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
- 'Map' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...mapSpread, \"baz\": 42};
^" in ( block {
- final core::Map<core::String, core::int> #t51 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t52 in mapSpread.{core::Map::entries})
- #t51.{core::Map::[]=}(#t52.{core::MapEntry::key}, #t52.{core::MapEntry::value});
- #t51.{core::Map::[]=}("baz", 42);
- } =>#t51) as{TypeError} core::int;
- core::int map30ambiguous = let final<BottomType> #t53 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:86:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+ final core::Map<core::String, core::int> #t55 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t56 in mapSpread.{core::Map::entries})
+ #t55.{core::Map::[]=}(#t56.{core::MapEntry::key}, #t56.{core::MapEntry::value});
+ #t55.{core::Map::[]=}("baz", 42);
+ } =>#t55) as{TypeError} core::int;
+ core::int map30ambiguous = let final<BottomType> #t57 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:91:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
- 'Map' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...mapSpread};
^" in ( block {
- final core::Map<core::String, core::int> #t54 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t55 in mapSpread.{core::Map::entries})
- #t54.{core::Map::[]=}(#t55.{core::MapEntry::key}, #t55.{core::MapEntry::value});
- } =>#t54) as{TypeError} core::int;
- core::List<dynamic> lhs40 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:89:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+ final core::Map<core::String, core::int> #t58 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t59 in mapSpread.{core::Map::entries})
+ #t58.{core::Map::[]=}(#t59.{core::MapEntry::key}, #t59.{core::MapEntry::value});
+ } =>#t58) as{TypeError} core::int;
+ core::List<dynamic> lhs40 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:94:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
notSpreadInt];
^"];
- core::Set<dynamic> set40 = let final core::Set<dynamic> #t56 = col::LinkedHashSet::•<dynamic>() in let final dynamic #t57 = #t56.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:92:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+ core::Set<dynamic> set40 = let final core::Set<dynamic> #t60 = col::LinkedHashSet::•<dynamic>() in let final dynamic #t61 = #t60.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:97:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
notSpreadInt};
- ^") in #t56;
- core::Map<dynamic, dynamic> map40 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:95:43: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadInt};
- ^": null};
- core::List<dynamic> lhs50 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:98:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+ ^") in #t60;
+ core::Map<dynamic, dynamic> map40 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:100:2: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+ notSpreadInt};
+ ^": null};
+ core::List<dynamic> lhs50 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:103:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
notSpreadFunction];
^"];
- core::Set<dynamic> set50 = let final core::Set<dynamic> #t58 = col::LinkedHashSet::•<dynamic>() in let final dynamic #t59 = #t58.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:101:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+ core::Set<dynamic> set50 = let final core::Set<dynamic> #t62 = col::LinkedHashSet::•<dynamic>() in let final dynamic #t63 = #t62.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:106:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
notSpreadFunction};
- ^") in #t58;
- core::Map<dynamic, dynamic> map50 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:104:43: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadFunction};
- ^": null};
- core::List<core::String> lhs60 = <core::String>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:107:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+ ^") in #t62;
+ core::Map<dynamic, dynamic> map50 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:109:2: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
+ notSpreadFunction};
+ ^": null};
+ core::List<core::String> lhs60 = <core::String>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:112:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
spread];
^"];
- core::Set<core::String> set60 = let final core::Set<core::String> #t60 = col::LinkedHashSet::•<core::String>() in let final dynamic #t61 = #t60.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:109:73: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
- Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
- ^") in #t60;
- core::Map<core::int, core::int> map60 = <core::int, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:112:53: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
- /*@error=SpreadMapEntryElementKeyTypeMismatch*/ mapSpread};
- ^": null};
- core::Map<core::String, core::String> map61 = <core::String, core::String>{null: invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:115:55: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
- /*@error=SpreadMapEntryElementValueTypeMismatch*/ mapSpread};
- ^"};
- core::List<core::int> lhs70 = <core::int>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:117:67: Error: Can't spread a value with static type Null.
- List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
- ^"];
- core::Set<core::int> set70 = let final core::Set<core::int> #t62 = col::LinkedHashSet::•<core::int>() in let final dynamic #t63 = #t62.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:119:66: Error: Can't spread a value with static type Null.
- Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
- ^") in #t62;
+ core::Set<core::String> set60 = let final core::Set<core::String> #t64 = col::LinkedHashSet::•<core::String>() in let final dynamic #t65 = #t64.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:114:36: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+ Set<String> set60 = <String>{... spread};
+ ^") in #t64;
+ core::Map<core::int, core::int> map60 = <core::int, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:117:2: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
+ mapSpread};
+ ^": null};
+ core::Map<core::String, core::String> map61 = <core::String, core::String>{null: invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:120:2: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
+ mapSpread};
+ ^"};
+ core::List<core::int> lhs70 = <core::int>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:122:31: Error: Can't spread a value with static type Null.
+ List<int> lhs70 = <int>[... null];
+ ^"];
+ core::Set<core::int> set70 = let final core::Set<core::int> #t66 = col::LinkedHashSet::•<core::int>() in let final dynamic #t67 = #t66.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:124:30: Error: Can't spread a value with static type Null.
+ Set<int> set70 = <int>{... null};
+ ^") in #t66;
core::Set<dynamic> set71ambiguous = block {
- final core::Set<dynamic> #t64 = col::LinkedHashSet::•<dynamic>();
- #t64.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:122:46: Error: Can't spread a value with static type Null.
- {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
- ^");
- for (final dynamic #t65 in <dynamic>[])
- #t64.{core::Set::add}(#t65);
- } =>#t64;
- core::Map<core::String, core::int> map70 = <core::String, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:126:5: Error: Can't spread a value with static type Null.
+ final core::Set<dynamic> #t68 = col::LinkedHashSet::•<dynamic>();
+ #t68.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Expected ',' before this.
+ {... null, ... /*@typeArgs=dynamic*/
+ ^");
+ for (final dynamic #t69 in <dynamic>[]) {
+ final dynamic #t70 = #t69 as{TypeError} dynamic;
+ #t68.{core::Set::add}(#t70);
+ }
+ } =>#t68;
+ core::Map<core::String, core::int> map70 = <core::String, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:131:5: Error: Can't spread a value with static type Null.
null};
^": null};
core::List<core::int> lhs80 = block {
- final core::List<core::int> #t66 = <core::int>[];
- final dynamic #t67 = null;
- if(!#t67.{core::Object::==}(null))
- for (final core::int #t68 in #t67)
- #t66.{core::List::add}(#t68);
- } =>#t66;
+ final core::List<core::int> #t71 = <core::int>[];
+ final dynamic #t72 = null;
+ if(!#t72.{core::Object::==}(null))
+ for (final core::int #t73 in #t72)
+ #t71.{core::List::add}(#t73);
+ } =>#t71;
core::Set<core::int> set80 = block {
- final core::Set<core::int> #t69 = col::LinkedHashSet::•<core::int>();
- final dynamic #t70 = null;
- if(!#t70.{core::Object::==}(null))
- for (final core::int #t71 in #t70)
- #t69.{core::Set::add}(#t71);
- } =>#t69;
+ final core::Set<core::int> #t74 = col::LinkedHashSet::•<core::int>();
+ final dynamic #t75 = null;
+ if(!#t75.{core::Object::==}(null))
+ for (final core::int #t76 in #t75)
+ #t74.{core::Set::add}(#t76);
+ } =>#t74;
core::Set<dynamic> set81ambiguous = block {
- final core::Set<dynamic> #t72 = col::LinkedHashSet::•<dynamic>();
- final dynamic #t73 = null;
- if(!#t73.{core::Object::==}(null))
- for (final dynamic #t74 in #t73)
- #t72.{core::Set::add}(#t74);
- for (final dynamic #t75 in <dynamic>[])
- #t72.{core::Set::add}(#t75);
- } =>#t72;
+ final core::Set<dynamic> #t77 = col::LinkedHashSet::•<dynamic>();
+ final dynamic #t78 = null;
+ if(!#t78.{core::Object::==}(null))
+ for (final dynamic #t79 in #t78) {
+ final dynamic #t80 = #t79 as{TypeError} dynamic;
+ #t77.{core::Set::add}(#t80);
+ }
+ for (final dynamic #t81 in <dynamic>[]) {
+ final dynamic #t82 = #t81 as{TypeError} dynamic;
+ #t77.{core::Set::add}(#t82);
+ }
+ } =>#t77;
core::Map<core::String, core::int> map80 = block {
- final core::Map<core::String, core::int> #t76 = <core::String, core::int>{};
- final core::Map<dynamic, dynamic> #t77 = null;
- if(!#t77.{core::Object::==}(null))
- for (final core::MapEntry<core::String, core::int> #t78 in #t77.{core::Map::entries})
- #t76.{core::Map::[]=}(#t78.{core::MapEntry::key}, #t78.{core::MapEntry::value});
- } =>#t76;
+ final core::Map<core::String, core::int> #t83 = <core::String, core::int>{};
+ final core::Map<dynamic, dynamic> #t84 = null;
+ if(!#t84.{core::Object::==}(null))
+ for (final core::MapEntry<core::String, core::int> #t85 in #t84.{core::Map::entries})
+ #t83.{core::Map::[]=}(#t85.{core::MapEntry::key}, #t85.{core::MapEntry::value});
+ } =>#t83;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t86 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t87 in self::bar<core::String, core::int>().{core::Map::entries})
+ #t86.{core::Map::[]=}(#t87.{core::MapEntry::key}, #t87.{core::MapEntry::value});
+ } =>#t86;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t88 = <core::int>[];
+ for (final dynamic #t89 in listNum) {
+ final core::int #t90 = #t89 as{TypeError} core::int;
+ #t88.{core::List::add}(#t90);
+ }
+ } =>#t88;
+ core::Map<core::num, core::int> map100 = block {
+ final core::Map<core::num, core::int> #t91 = <core::num, core::int>{};
+ for (final core::MapEntry<dynamic, dynamic> #t92 in mapIntNum.{core::Map::entries}) {
+ final core::num #t93 = #t92.{core::MapEntry::key} as{TypeError} core::num;
+ final core::int #t94 = #t92.{core::MapEntry::value} as{TypeError} core::int;
+ #t91.{core::Map::[]=}(#t93, #t94);
+ }
+ } =>#t91;
+ core::List<core::int> list110 = block {
+ final core::List<core::int> #t95 = <core::int>[];
+ for (final dynamic #t96 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t97 = #t96 as{TypeError} core::int;
+ #t95.{core::List::add}(#t97);
+ }
+ } =>#t95;
+ core::Map<core::num, core::int> map110 = block {
+ final core::Map<core::num, core::int> #t98 = <core::num, core::int>{};
+ for (final core::MapEntry<dynamic, dynamic> #t99 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::num #t100 = #t99.{core::MapEntry::key} as{TypeError} core::num;
+ final core::int #t101 = #t99.{core::MapEntry::value} as{TypeError} core::int;
+ #t98.{core::Map::[]=}(#t100, #t101);
+ }
+ } =>#t98;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/spread_collection_inference.dart.strong.transformed.expect b/front_end/testcases/spread_collection_inference.dart.strong.transformed.expect
index d9fbaef..838f328 100644
--- a/front_end/testcases/spread_collection_inference.dart.strong.transformed.expect
+++ b/front_end/testcases/spread_collection_inference.dart.strong.transformed.expect
@@ -2,104 +2,102 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/spread_collection_inference.dart:48:76: Error: Not enough type information to disambiguate between literal set and literal map.
+// pkg/front_end/testcases/spread_collection_inference.dart:53:28: Error: Not enough type information to disambiguate between literal set and literal map.
// Try providing type arguments for the literal explicitly to disambiguate it.
-// dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
-// ^
+// dynamic map21ambiguous = {...
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:72:76: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
-// dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
-// ^
-// pkg/front_end/testcases/spread_collection_inference.dart:73:5: Context: Iterable spread.
-// spread, ...mapSpread};
-// ^
-// pkg/front_end/testcases/spread_collection_inference.dart:73:16: Context: Map spread.
-// spread, ...mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:77:28: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// dynamic map24ambiguous = {...
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:75:62: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:80:33: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
// - 'List' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
-// ^
+// int lhs30 = /*@typeArgs=int*/ [...spread];
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:77:62: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:82:33: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
// - 'Set' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
-// int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
-// ^
+// int set30 = /*@typeArgs=int*/ {...spread, 42};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:80:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:85:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
// - 'Set' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...spread};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:83:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:88:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
// - 'Map' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...mapSpread, "baz": 42};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:86:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/spread_collection_inference.dart:91:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
// - 'Map' is from 'dart:core'.
// Try changing the type of the left hand side, or casting the right hand side to 'int'.
// {...mapSpread};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:89:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:94:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadInt];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:92:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:97:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadInt};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:95:43: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
-// /*@error=SpreadMapEntryTypeMismatch*/ notSpreadInt};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:100:2: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// notSpreadInt};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:98:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:103:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadFunction];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:101:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+// pkg/front_end/testcases/spread_collection_inference.dart:106:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
// notSpreadFunction};
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:104:43: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
-// /*@error=SpreadMapEntryTypeMismatch*/ notSpreadFunction};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:109:2: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
+// notSpreadFunction};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:107:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+// pkg/front_end/testcases/spread_collection_inference.dart:112:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
// spread];
// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:109:73: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
-// Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:114:36: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+// Set<String> set60 = <String>{... spread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:112:53: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
-// /*@error=SpreadMapEntryElementKeyTypeMismatch*/ mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:117:2: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
+// mapSpread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:115:55: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
-// /*@error=SpreadMapEntryElementValueTypeMismatch*/ mapSpread};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:120:2: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
+// mapSpread};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:117:67: Error: Can't spread a value with static type Null.
-// List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:122:31: Error: Can't spread a value with static type Null.
+// List<int> lhs70 = <int>[... null];
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:119:66: Error: Can't spread a value with static type Null.
-// Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:124:30: Error: Can't spread a value with static type Null.
+// Set<int> set70 = <int>{... null};
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:122:46: Error: Can't spread a value with static type Null.
-// {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
-// ^
+// pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Can't spread a value with static type Null.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^
//
-// pkg/front_end/testcases/spread_collection_inference.dart:126:5: Error: Can't spread a value with static type Null.
+// pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Expected ',' before this.
+// {... null, ... /*@typeArgs=dynamic*/
+// ^
+//
+// pkg/front_end/testcases/spread_collection_inference.dart:131:5: Error: Can't spread a value with static type Null.
// null};
// ^
//
@@ -107,11 +105,15 @@
import "dart:core" as core;
import "dart:collection" as col;
-static method foo() → dynamic {
+static method bar<K extends core::Object = dynamic, V extends core::Object = dynamic>() → core::Map<self::bar::K, self::bar::V>
+ return null;
+static method foo(dynamic dynVar) → dynamic {
core::List<core::int> spread = <core::int>[1, 2, 3];
core::Map<core::String, core::int> mapSpread = <core::String, core::int>{"foo": 4, "bar": 2};
core::int notSpreadInt = 42;
() → core::int notSpreadFunction = null;
+ core::Map<core::int, core::num> mapIntNum = <core::int, core::num>{42: 42};
+ core::List<core::num> listNum = <core::num>[42];
core::List<dynamic> lhs10 = block {
final core::List<dynamic> #t1 = <dynamic>[];
for (final dynamic #t2 in <dynamic>[])
@@ -145,209 +147,258 @@
} =>#t11;
core::Set<core::int> set20ambiguous = block {
final core::Set<core::int> #t13 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t14 in spread)
- #t13.{core::Set::add}(#t14);
+ for (final dynamic #t14 in spread) {
+ final core::int #t15 = #t14 as{TypeError} core::int;
+ #t13.{core::Set::add}(#t15);
+ }
} =>#t13;
core::Map<core::String, core::int> map20 = block {
- final core::Map<core::String, core::int> #t15 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t16 in mapSpread.{core::Map::entries})
- #t15.{core::Map::[]=}(#t16.{core::MapEntry::key}, #t16.{core::MapEntry::value});
- #t15.{core::Map::[]=}("baz", 42);
- } =>#t15;
+ final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t17 in mapSpread.{core::Map::entries})
+ #t16.{core::Map::[]=}(#t17.{core::MapEntry::key}, #t17.{core::MapEntry::value});
+ #t16.{core::Map::[]=}("baz", 42);
+ } =>#t16;
core::Map<core::String, core::int> map20ambiguous = block {
- final core::Map<core::String, core::int> #t17 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t18 in mapSpread.{core::Map::entries})
- #t17.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
- } =>#t17;
+ final core::Map<core::String, core::int> #t18 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t19 in mapSpread.{core::Map::entries})
+ #t18.{core::Map::[]=}(#t19.{core::MapEntry::key}, #t19.{core::MapEntry::value});
+ } =>#t18;
core::List<dynamic> lhs21 = block {
- final core::List<dynamic> #t19 = <dynamic>[];
- for (final dynamic #t20 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
- #t19.{core::List::add}(#t20);
- } =>#t19;
+ final core::List<dynamic> #t20 = <dynamic>[];
+ for (final dynamic #t21 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
+ #t20.{core::List::add}(#t21);
+ } =>#t20;
core::Set<dynamic> set21 = block {
- final core::Set<dynamic> #t21 = col::LinkedHashSet::•<dynamic>();
- for (final dynamic #t22 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
- #t21.{core::Set::add}(#t22);
- #t21.{core::Set::add}(42);
- } =>#t21;
+ final core::Set<dynamic> #t22 = col::LinkedHashSet::•<dynamic>();
+ for (final dynamic #t23 in (spread as dynamic) as{TypeError} core::Iterable<dynamic>)
+ #t22.{core::Set::add}(#t23);
+ #t22.{core::Set::add}(42);
+ } =>#t22;
core::Map<dynamic, dynamic> map21 = block {
- final core::Map<dynamic, dynamic> #t23 = <dynamic, dynamic>{};
- for (final core::MapEntry<dynamic, dynamic> #t24 in ((mapSpread as dynamic) as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
- #t23.{core::Map::[]=}(#t24.{core::MapEntry::key}, #t24.{core::MapEntry::value});
- #t23.{core::Map::[]=}("baz", 42);
- } =>#t23;
- dynamic map21ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:48:76: Error: Not enough type information to disambiguate between literal set and literal map.
+ final core::Map<dynamic, dynamic> #t24 = <dynamic, dynamic>{};
+ for (final core::MapEntry<dynamic, dynamic> #t25 in ((mapSpread as dynamic) as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries})
+ #t24.{core::Map::[]=}(#t25.{core::MapEntry::key}, #t25.{core::MapEntry::value});
+ #t24.{core::Map::[]=}("baz", 42);
+ } =>#t24;
+ dynamic map21ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:53:28: Error: Not enough type information to disambiguate between literal set and literal map.
Try providing type arguments for the literal explicitly to disambiguate it.
- dynamic map21ambiguous = /*@error=CantDisambiguateNotEnoughInformation*/ {...
- ^";
+ dynamic map21ambiguous = {...
+ ^";
core::List<core::int> lhs22 = block {
- final core::List<core::int> #t25 = <core::int>[];
- for (final core::int #t26 in <core::int>[])
- #t25.{core::List::add}(#t26);
- } =>#t25;
+ final core::List<core::int> #t26 = <core::int>[];
+ for (final core::int #t27 in <core::int>[])
+ #t26.{core::List::add}(#t27);
+ } =>#t26;
core::Set<core::int> set22 = block {
- final core::Set<core::int> #t27 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t28 in <core::int>[])
- #t27.{core::Set::add}(#t28);
- #t27.{core::Set::add}(42);
- } =>#t27;
+ final core::Set<core::int> #t28 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t29 in <core::int>[])
+ #t28.{core::Set::add}(#t29);
+ #t28.{core::Set::add}(42);
+ } =>#t28;
core::Set<core::int> set22ambiguous = block {
- final core::Set<core::int> #t29 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t30 in <core::int>[])
- #t29.{core::Set::add}(#t30);
- } =>#t29;
+ final core::Set<core::int> #t30 = col::LinkedHashSet::•<core::int>();
+ for (final dynamic #t31 in <core::int>[]) {
+ final core::int #t32 = #t31 as{TypeError} core::int;
+ #t30.{core::Set::add}(#t32);
+ }
+ } =>#t30;
core::Map<core::String, core::int> map22 = block {
- final core::Map<core::String, core::int> #t31 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t32 in <core::String, core::int>{}.{core::Map::entries})
- #t31.{core::Map::[]=}(#t32.{core::MapEntry::key}, #t32.{core::MapEntry::value});
- } =>#t31;
- core::List<core::List<core::int>> lhs23 = block {
- final core::List<core::List<core::int>> #t33 = <core::List<core::int>>[];
- for (final core::List<core::int> #t34 in <core::List<core::int>>[<core::int>[]])
- #t33.{core::List::add}(#t34);
+ final core::Map<core::String, core::int> #t33 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t34 in <core::String, core::int>{}.{core::Map::entries})
+ #t33.{core::Map::[]=}(#t34.{core::MapEntry::key}, #t34.{core::MapEntry::value});
} =>#t33;
- core::Set<core::List<core::int>> set23 = block {
- final core::Set<core::List<core::int>> #t35 = col::LinkedHashSet::•<core::List<core::int>>();
+ core::List<core::List<core::int>> lhs23 = block {
+ final core::List<core::List<core::int>> #t35 = <core::List<core::int>>[];
for (final core::List<core::int> #t36 in <core::List<core::int>>[<core::int>[]])
- #t35.{core::Set::add}(#t36);
- #t35.{core::Set::add}(<core::int>[42]);
+ #t35.{core::List::add}(#t36);
} =>#t35;
- core::Set<core::List<core::int>> set23ambiguous = block {
+ core::Set<core::List<core::int>> set23 = block {
final core::Set<core::List<core::int>> #t37 = col::LinkedHashSet::•<core::List<core::int>>();
for (final core::List<core::int> #t38 in <core::List<core::int>>[<core::int>[]])
#t37.{core::Set::add}(#t38);
+ #t37.{core::Set::add}(<core::int>[42]);
} =>#t37;
- core::Map<core::String, core::List<core::int>> map23 = block {
- final core::Map<core::String, core::List<core::int>> #t39 = <core::String, core::List<core::int>>{};
- for (final core::MapEntry<core::String, core::List<core::int>> #t40 in <core::String, core::List<core::int>>{"baz": <core::int>[]}.{core::Map::entries})
- #t39.{core::Map::[]=}(#t40.{core::MapEntry::key}, #t40.{core::MapEntry::value});
+ core::Set<core::List<core::int>> set23ambiguous = block {
+ final core::Set<core::List<core::int>> #t39 = col::LinkedHashSet::•<core::List<core::int>>();
+ for (final dynamic #t40 in <core::List<core::int>>[<core::int>[]]) {
+ final core::List<core::int> #t41 = #t40 as{TypeError} core::List<core::int>;
+ #t39.{core::Set::add}(#t41);
+ }
} =>#t39;
- dynamic map24ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:72:76: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
- dynamic map24ambiguous = /*@error=CantDisambiguateAmbiguousInformation*/ {...
- ^";
- core::int lhs30 = let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:75:62: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
+ core::Map<core::String, core::List<core::int>> map23 = block {
+ final core::Map<core::String, core::List<core::int>> #t42 = <core::String, core::List<core::int>>{};
+ for (final core::MapEntry<core::String, core::List<core::int>> #t43 in <core::String, core::List<core::int>>{"baz": <core::int>[]}.{core::Map::entries})
+ #t42.{core::Map::[]=}(#t43.{core::MapEntry::key}, #t43.{core::MapEntry::value});
+ } =>#t42;
+ dynamic map24ambiguous = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:77:28: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+ dynamic map24ambiguous = {...
+ ^";
+ core::int lhs30 = let final<BottomType> #t44 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:80:33: Error: A value of type 'List<int>' can't be assigned to a variable of type 'int'.
- 'List' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- int lhs30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ [...spread];
- ^" in ( block {
- final core::List<core::int> #t42 = <core::int>[];
- for (final core::int #t43 in spread)
- #t42.{core::List::add}(#t43);
- } =>#t42) as{TypeError} core::int;
- core::int set30 = let final<BottomType> #t44 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:77:62: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+ int lhs30 = /*@typeArgs=int*/ [...spread];
+ ^" in ( block {
+ final core::List<core::int> #t45 = <core::int>[];
+ for (final core::int #t46 in spread)
+ #t45.{core::List::add}(#t46);
+ } =>#t45) as{TypeError} core::int;
+ core::int set30 = let final<BottomType> #t47 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:82:33: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
- 'Set' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
- int set30 = /*@error=InvalidAssignment*/ /*@typeArgs=int*/ {...spread, 42};
- ^" in ( block {
- final core::Set<core::int> #t45 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t46 in spread)
- #t45.{core::Set::add}(#t46);
- #t45.{core::Set::add}(42);
- } =>#t45) as{TypeError} core::int;
- core::int set30ambiguous = let final<BottomType> #t47 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:80:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
+ int set30 = /*@typeArgs=int*/ {...spread, 42};
+ ^" in ( block {
+ final core::Set<core::int> #t48 = col::LinkedHashSet::•<core::int>();
+ for (final core::int #t49 in spread)
+ #t48.{core::Set::add}(#t49);
+ #t48.{core::Set::add}(42);
+ } =>#t48) as{TypeError} core::int;
+ core::int set30ambiguous = let final<BottomType> #t50 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:85:5: Error: A value of type 'Set<int>' can't be assigned to a variable of type 'int'.
- 'Set' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...spread};
^" in ( block {
- final core::Set<core::int> #t48 = col::LinkedHashSet::•<core::int>();
- for (final core::int #t49 in spread)
- #t48.{core::Set::add}(#t49);
- } =>#t48) as{TypeError} core::int;
- core::int map30 = let final<BottomType> #t50 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:83:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+ final core::Set<core::int> #t51 = col::LinkedHashSet::•<core::int>();
+ for (final dynamic #t52 in spread) {
+ final core::int #t53 = #t52 as{TypeError} core::int;
+ #t51.{core::Set::add}(#t53);
+ }
+ } =>#t51) as{TypeError} core::int;
+ core::int map30 = let final<BottomType> #t54 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:88:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
- 'Map' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...mapSpread, \"baz\": 42};
^" in ( block {
- final core::Map<core::String, core::int> #t51 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t52 in mapSpread.{core::Map::entries})
- #t51.{core::Map::[]=}(#t52.{core::MapEntry::key}, #t52.{core::MapEntry::value});
- #t51.{core::Map::[]=}("baz", 42);
- } =>#t51) as{TypeError} core::int;
- core::int map30ambiguous = let final<BottomType> #t53 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:86:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
+ final core::Map<core::String, core::int> #t55 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t56 in mapSpread.{core::Map::entries})
+ #t55.{core::Map::[]=}(#t56.{core::MapEntry::key}, #t56.{core::MapEntry::value});
+ #t55.{core::Map::[]=}("baz", 42);
+ } =>#t55) as{TypeError} core::int;
+ core::int map30ambiguous = let final<BottomType> #t57 = invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:91:5: Error: A value of type 'Map<String, int>' can't be assigned to a variable of type 'int'.
- 'Map' is from 'dart:core'.
Try changing the type of the left hand side, or casting the right hand side to 'int'.
{...mapSpread};
^" in ( block {
- final core::Map<core::String, core::int> #t54 = <core::String, core::int>{};
- for (final core::MapEntry<core::String, core::int> #t55 in mapSpread.{core::Map::entries})
- #t54.{core::Map::[]=}(#t55.{core::MapEntry::key}, #t55.{core::MapEntry::value});
- } =>#t54) as{TypeError} core::int;
- core::List<dynamic> lhs40 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:89:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+ final core::Map<core::String, core::int> #t58 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t59 in mapSpread.{core::Map::entries})
+ #t58.{core::Map::[]=}(#t59.{core::MapEntry::key}, #t59.{core::MapEntry::value});
+ } =>#t58) as{TypeError} core::int;
+ core::List<dynamic> lhs40 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:94:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
notSpreadInt];
^"];
- core::Set<dynamic> set40 = let final core::Set<dynamic> #t56 = col::LinkedHashSet::•<dynamic>() in let final core::bool #t57 = #t56.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:92:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+ core::Set<dynamic> set40 = let final core::Set<dynamic> #t60 = col::LinkedHashSet::•<dynamic>() in let final core::bool #t61 = #t60.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:97:5: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
notSpreadInt};
- ^") in #t56;
- core::Map<dynamic, dynamic> map40 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:95:43: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadInt};
- ^": null};
- core::List<dynamic> lhs50 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:98:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+ ^") in #t60;
+ core::Map<dynamic, dynamic> map40 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:100:2: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+ notSpreadInt};
+ ^": null};
+ core::List<dynamic> lhs50 = <dynamic>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:103:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
notSpreadFunction];
^"];
- core::Set<dynamic> set50 = let final core::Set<dynamic> #t58 = col::LinkedHashSet::•<dynamic>() in let final core::bool #t59 = #t58.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:101:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
+ core::Set<dynamic> set50 = let final core::Set<dynamic> #t62 = col::LinkedHashSet::•<dynamic>() in let final core::bool #t63 = #t62.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:106:5: Error: Unexpected type 'int Function()' of a spread. Expected 'dynamic' or an Iterable.
notSpreadFunction};
- ^") in #t58;
- core::Map<dynamic, dynamic> map50 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:104:43: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
- /*@error=SpreadMapEntryTypeMismatch*/ notSpreadFunction};
- ^": null};
- core::List<core::String> lhs60 = <core::String>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:107:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+ ^") in #t62;
+ core::Map<dynamic, dynamic> map50 = <dynamic, dynamic>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:109:2: Error: Unexpected type 'int Function()' of a map spread entry. Expected 'dynamic' or a Map.
+ notSpreadFunction};
+ ^": null};
+ core::List<core::String> lhs60 = <core::String>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:112:5: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
spread];
^"];
- core::Set<core::String> set60 = let final core::Set<core::String> #t60 = col::LinkedHashSet::•<core::String>() in let final core::bool #t61 = #t60.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:109:73: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
- Set<String> set60 = <String>{... /*@error=SpreadElementTypeMismatch*/ spread};
- ^") in #t60;
- core::Map<core::int, core::int> map60 = <core::int, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:112:53: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
- /*@error=SpreadMapEntryElementKeyTypeMismatch*/ mapSpread};
- ^": null};
- core::Map<core::String, core::String> map61 = <core::String, core::String>{null: invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:115:55: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
- /*@error=SpreadMapEntryElementValueTypeMismatch*/ mapSpread};
- ^"};
- core::List<core::int> lhs70 = <core::int>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:117:67: Error: Can't spread a value with static type Null.
- List<int> lhs70 = <int>[... /*@error=NonNullAwareSpreadIsNull*/ null];
- ^"];
- core::Set<core::int> set70 = let final core::Set<core::int> #t62 = col::LinkedHashSet::•<core::int>() in let final core::bool #t63 = #t62.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:119:66: Error: Can't spread a value with static type Null.
- Set<int> set70 = <int>{... /*@error=NonNullAwareSpreadIsNull*/ null};
- ^") in #t62;
+ core::Set<core::String> set60 = let final core::Set<core::String> #t64 = col::LinkedHashSet::•<core::String>() in let final core::bool #t65 = #t64.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:114:36: Error: Can't assign spread elements of type 'int' to collection elements of type 'String'.
+ Set<String> set60 = <String>{... spread};
+ ^") in #t64;
+ core::Map<core::int, core::int> map60 = <core::int, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:117:2: Error: Can't assign spread entry keys of type 'String' to map entry keys of type 'int'.
+ mapSpread};
+ ^": null};
+ core::Map<core::String, core::String> map61 = <core::String, core::String>{null: invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:120:2: Error: Can't assign spread entry values of type 'int' to map entry values of type 'String'.
+ mapSpread};
+ ^"};
+ core::List<core::int> lhs70 = <core::int>[invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:122:31: Error: Can't spread a value with static type Null.
+ List<int> lhs70 = <int>[... null];
+ ^"];
+ core::Set<core::int> set70 = let final core::Set<core::int> #t66 = col::LinkedHashSet::•<core::int>() in let final core::bool #t67 = #t66.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:124:30: Error: Can't spread a value with static type Null.
+ Set<int> set70 = <int>{... null};
+ ^") in #t66;
core::Set<dynamic> set71ambiguous = block {
- final core::Set<dynamic> #t64 = col::LinkedHashSet::•<dynamic>();
- #t64.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:122:46: Error: Can't spread a value with static type Null.
- {... /*@error=NonNullAwareSpreadIsNull*/ null, ... /*@typeArgs=dynamic*/
- ^");
- for (final dynamic #t65 in <dynamic>[])
- #t64.{core::Set::add}(#t65);
- } =>#t64;
- core::Map<core::String, core::int> map70 = <core::String, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:126:5: Error: Can't spread a value with static type Null.
+ final core::Set<dynamic> #t68 = col::LinkedHashSet::•<dynamic>();
+ #t68.{core::Set::add}(invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:127:10: Error: Expected ',' before this.
+ {... null, ... /*@typeArgs=dynamic*/
+ ^");
+ for (final dynamic #t69 in <dynamic>[]) {
+ final dynamic #t70 = #t69 as{TypeError} dynamic;
+ #t68.{core::Set::add}(#t70);
+ }
+ } =>#t68;
+ core::Map<core::String, core::int> map70 = <core::String, core::int>{invalid-expression "pkg/front_end/testcases/spread_collection_inference.dart:131:5: Error: Can't spread a value with static type Null.
null};
^": null};
core::List<core::int> lhs80 = block {
- final core::List<core::int> #t66 = <core::int>[];
- final dynamic #t67 = null;
- if(!#t67.{core::Object::==}(null))
- for (final core::int #t68 in #t67)
- #t66.{core::List::add}(#t68);
- } =>#t66;
+ final core::List<core::int> #t71 = <core::int>[];
+ final dynamic #t72 = null;
+ if(!#t72.{core::Object::==}(null))
+ for (final core::int #t73 in #t72)
+ #t71.{core::List::add}(#t73);
+ } =>#t71;
core::Set<core::int> set80 = block {
- final core::Set<core::int> #t69 = col::LinkedHashSet::•<core::int>();
- final dynamic #t70 = null;
- if(!#t70.{core::Object::==}(null))
- for (final core::int #t71 in #t70)
- #t69.{core::Set::add}(#t71);
- } =>#t69;
+ final core::Set<core::int> #t74 = col::LinkedHashSet::•<core::int>();
+ final dynamic #t75 = null;
+ if(!#t75.{core::Object::==}(null))
+ for (final core::int #t76 in #t75)
+ #t74.{core::Set::add}(#t76);
+ } =>#t74;
core::Set<dynamic> set81ambiguous = block {
- final core::Set<dynamic> #t72 = col::LinkedHashSet::•<dynamic>();
- final dynamic #t73 = null;
- if(!#t73.{core::Object::==}(null))
- for (final dynamic #t74 in #t73)
- #t72.{core::Set::add}(#t74);
- for (final dynamic #t75 in <dynamic>[])
- #t72.{core::Set::add}(#t75);
- } =>#t72;
+ final core::Set<dynamic> #t77 = col::LinkedHashSet::•<dynamic>();
+ final dynamic #t78 = null;
+ if(!#t78.{core::Object::==}(null))
+ for (final dynamic #t79 in #t78) {
+ final dynamic #t80 = #t79 as{TypeError} dynamic;
+ #t77.{core::Set::add}(#t80);
+ }
+ for (final dynamic #t81 in <dynamic>[]) {
+ final dynamic #t82 = #t81 as{TypeError} dynamic;
+ #t77.{core::Set::add}(#t82);
+ }
+ } =>#t77;
core::Map<core::String, core::int> map80 = block {
- final core::Map<core::String, core::int> #t76 = <core::String, core::int>{};
- final core::Map<dynamic, dynamic> #t77 = null;
- if(!#t77.{core::Object::==}(null))
- for (final core::MapEntry<core::String, core::int> #t78 in #t77.{core::Map::entries})
- #t76.{core::Map::[]=}(#t78.{core::MapEntry::key}, #t78.{core::MapEntry::value});
- } =>#t76;
+ final core::Map<core::String, core::int> #t83 = <core::String, core::int>{};
+ final core::Map<dynamic, dynamic> #t84 = null;
+ if(!#t84.{core::Object::==}(null))
+ for (final core::MapEntry<core::String, core::int> #t85 in #t84.{core::Map::entries})
+ #t83.{core::Map::[]=}(#t85.{core::MapEntry::key}, #t85.{core::MapEntry::value});
+ } =>#t83;
+ core::Map<core::String, core::int> map90 = block {
+ final core::Map<core::String, core::int> #t86 = <core::String, core::int>{};
+ for (final core::MapEntry<core::String, core::int> #t87 in self::bar<core::String, core::int>().{core::Map::entries})
+ #t86.{core::Map::[]=}(#t87.{core::MapEntry::key}, #t87.{core::MapEntry::value});
+ } =>#t86;
+ core::List<core::int> list100 = block {
+ final core::List<core::int> #t88 = <core::int>[];
+ for (final dynamic #t89 in listNum) {
+ final core::int #t90 = #t89 as{TypeError} core::int;
+ #t88.{core::List::add}(#t90);
+ }
+ } =>#t88;
+ core::Map<core::num, core::int> map100 = block {
+ final core::Map<core::num, core::int> #t91 = <core::num, core::int>{};
+ for (final core::MapEntry<dynamic, dynamic> #t92 in mapIntNum.{core::Map::entries}) {
+ final core::num #t93 = #t92.{core::MapEntry::key} as{TypeError} core::num;
+ final core::int #t94 = #t92.{core::MapEntry::value} as{TypeError} core::int;
+ #t91.{core::Map::[]=}(#t93, #t94);
+ }
+ } =>#t91;
+ core::List<core::int> list110 = block {
+ final core::List<core::int> #t95 = <core::int>[];
+ for (final dynamic #t96 in dynVar as{TypeError} core::Iterable<dynamic>) {
+ final core::int #t97 = #t96 as{TypeError} core::int;
+ #t95.{core::List::add}(#t97);
+ }
+ } =>#t95;
+ core::Map<core::num, core::int> map110 = block {
+ final core::Map<core::num, core::int> #t98 = <core::num, core::int>{};
+ for (final core::MapEntry<dynamic, dynamic> #t99 in (dynVar as{TypeError} core::Map<dynamic, dynamic>).{core::Map::entries}) {
+ final core::num #t100 = #t99.{core::MapEntry::key} as{TypeError} core::num;
+ final core::int #t101 = #t99.{core::MapEntry::value} as{TypeError} core::int;
+ #t98.{core::Map::[]=}(#t100, #t101);
+ }
+ } =>#t98;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/strong.status b/front_end/testcases/strong.status
index d89dded..79ac736 100644
--- a/front_end/testcases/strong.status
+++ b/front_end/testcases/strong.status
@@ -33,6 +33,7 @@
inference/constructors_too_many_positional_arguments: InstrumentationMismatch # Issue #30040
inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer: TypeCheckError
inference/downwards_inference_annotations_type_variable: InstrumentationMismatch # Issue 28981
+inference/downwards_inference_for_each: RuntimeError # Issue #36382
inference/downwards_inference_on_function_of_t_using_the_t: InstrumentationMismatch # Issue #29798
inference/downwards_inference_on_list_literals_infer_downwards: RuntimeError
inference/future_then_explicit_future: InstrumentationMismatch # Issue #30040
@@ -58,9 +59,8 @@
inference/override_equals: RuntimeError
inference/unresolved_super: TypeCheckError
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: InstrumentationMismatch # Issue #25824
-inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: InstrumentationMismatch # Issue #25824
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1: InstrumentationMismatch # Issue #25824
-inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: InstrumentationMismatch # Issue #25824
+inference_new/dependency_only_if_overloaded: TypeCheckError
inference_new/infer_assign_to_index_super_upwards: TypeCheckError
inference_new/infer_assign_to_index_this_upwards: TypeCheckError
inference_new/infer_assign_to_index_upwards: TypeCheckError
@@ -68,13 +68,15 @@
inference_new/infer_field_getter_setter_mismatch: TypeCheckError
inference_new/infer_field_override_getter_overrides_setter: TypeCheckError
inference_new/invalid_assignment_during_toplevel_inference: TypeCheckError
-instantiate_to_bound/non_simple_generic_function_in_bound_regress: RuntimeError # Expected
+inference_new/strongly_connected_component: TypeCheckError
instantiate_to_bound/non_simple_class_parametrized_typedef_cycle: RuntimeError # Expected
+instantiate_to_bound/non_simple_generic_function_in_bound_regress: RuntimeError # Expected
invalid_type: TypeCheckError
invocations: RuntimeError
issue34899: TypeCheckError
micro: RuntimeError
mixin_application_override: TypeCheckError
+operator_method_not_found: RuntimeError # Expected
optional: TypeCheckError
override_check_accessor_after_inference: TypeCheckError # Issue #31620
override_check_accessor_basic: TypeCheckError # Issue #31620
@@ -85,7 +87,7 @@
rasta/abstract_constructor: RuntimeError
rasta/bad_constructor_redirection: RuntimeError
rasta/bad_continue: RuntimeError
-rasta/bad_default_constructor: VerificationError
+rasta/bad_default_constructor: RuntimeError
rasta/bad_explicit_super_constructor: RuntimeError
rasta/bad_implicit_super_constructor: RuntimeError
rasta/bad_interpolation: RuntimeError
@@ -104,7 +106,7 @@
rasta/issue_000032: RuntimeError
rasta/issue_000034: RuntimeError
rasta/issue_000036: RuntimeError
-rasta/issue_000039: VerificationError
+rasta/issue_000039: RuntimeError
rasta/issue_000041: RuntimeError
rasta/issue_000042: RuntimeError
rasta/issue_000043: RuntimeError
@@ -131,7 +133,6 @@
regress/issue_29982: RuntimeError # Tests runtime behavior of error recovery.
regress/issue_30836: RuntimeError # Issue 30836.
regress/issue_31299: TypeCheckError
-regress/issue_32200: RuntimeError # Invalid type.
regress/issue_32972: TypeCheckError
regress/issue_33452: RuntimeError # Test has an intentional error
regress/issue_34225: RuntimeError
@@ -141,6 +142,10 @@
regress/issue_35259: RuntimeError # Expected
regress/issue_35260: RuntimeError # Expected
regress/issue_35266: RuntimeError # Expected
+regress/issue_36400: RuntimeError
+regress/issue_36647: RuntimeError # Expected
+regress/issue_36647_2: RuntimeError # Expected
+regress/issue_36669: RuntimeError
reject_generic_function_types_in_bounds: RuntimeError # Expected
runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast: RuntimeError
runtime_checks_new/mixin_forwarding_stub_field: TypeCheckError
@@ -149,8 +154,8 @@
set_literals/disambiguation_rule: RuntimeError
spread_collection: RuntimeError
statements: Crash
+type_parameter_type_named_int: RuntimeError # Expected
type_variable_as_super: RuntimeError
-type_variable_prefix: RuntimeError
unsound_promotion: RuntimeError
void_methods: ExpectationFileMismatch
warn_unresolved_sends: InstrumentationMismatch # Test assumes Dart 1.0 semantics
diff --git a/front_end/testcases/text_serialization.status b/front_end/testcases/text_serialization.status
index 4d5dc75..25584dc 100644
--- a/front_end/testcases/text_serialization.status
+++ b/front_end/testcases/text_serialization.status
@@ -67,6 +67,8 @@
constructor_initializer_invalid: TextSerializationFailure # Was: RuntimeError # Fails execution after recovery
continue_inference_after_error: TextSerializationFailure # Was: Pass
continue_inference_after_error_lib: TextSerializationFailure # Was: Pass
+control_flow_collection: TextSerializationFailure
+control_flow_collection_inference: TextSerializationFailure
covariant_generic: TextSerializationFailure # Was: RuntimeError
cycles: TextSerializationFailure # Was: Pass
default_values: TextSerializationFailure # Was: Pass
@@ -525,9 +527,11 @@
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param: TextSerializationFailure # Was: Pass
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: InstrumentationMismatch # Issue #25824
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: InstrumentationMismatch # Issue #25824
+inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: TextSerializationFailure
inference/unsafe_block_closure_inference_function_call_explicit_type_param: TextSerializationFailure # Was: Pass
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1: InstrumentationMismatch # Issue #25824
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: InstrumentationMismatch # Issue #25824
+inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: TextSerializationFailure
inference/unsafe_block_closure_inference_function_call_implicit_type_param: TextSerializationFailure # Was: Pass
inference/unsafe_block_closure_inference_function_call_implicit_type_param_via_expr: TextSerializationFailure # Was: Pass
inference/unsafe_block_closure_inference_function_call_no_type_param: TextSerializationFailure # Was: Pass
@@ -546,6 +550,7 @@
inference_new/const_invocation: TextSerializationFailure # Was: Pass
inference_new/dependency_only_if_generic_method: TextSerializationFailure # Was: Pass
inference_new/dependency_only_if_overloaded: TextSerializationFailure # Was: Pass
+inference_new/dependency_only_if_overloaded: TypeCheckError
inference_new/do_loop: TextSerializationFailure # Was: Pass
inference_new/downwards_inference_inside_top_level: TextSerializationFailure # Was: Pass
inference_new/downwards_inference_inside_top_level_2: TextSerializationFailure # Was: Pass
@@ -593,6 +598,7 @@
inference_new/property_get_toplevel: TextSerializationFailure # Was: Pass
inference_new/static_assign_combiner: TextSerializationFailure # Was: Pass
inference_new/strongly_connected_component: TextSerializationFailure # Was: Pass
+inference_new/strongly_connected_component: TypeCheckError
inference_new/super_index_get: TextSerializationFailure # Was: Pass
inference_new/super_index_get_substitution: TextSerializationFailure # Was: Pass
inference_new/switch: TextSerializationFailure # Was: Pass
@@ -716,6 +722,7 @@
no_such_method_private_setter: TextSerializationFailure # Was: Pass
no_such_method_private_setter_lib: TextSerializationFailure # Was: Pass
null_aware: TextSerializationFailure # Was: Pass
+operator_method_not_found: TextSerializationFailure
operators: TextSerializationFailure # Was: Pass
optional: TypeCheckError
override: TextSerializationFailure # Was: Pass
@@ -745,7 +752,7 @@
rasta/abstract_constructor: TextSerializationFailure # Was: RuntimeError
rasta/bad_constructor_redirection: TextSerializationFailure # Was: RuntimeError
rasta/bad_continue: TextSerializationFailure # Was: RuntimeError
-rasta/bad_default_constructor: VerificationError
+rasta/bad_default_constructor: TextSerializationFailure
rasta/bad_explicit_super_constructor: TextSerializationFailure # Was: RuntimeError
rasta/bad_implicit_super_constructor: TextSerializationFailure # Was: RuntimeError
rasta/bad_interpolation: TextSerializationFailure # Was: RuntimeError
@@ -785,7 +792,7 @@
rasta/issue_000035: TextSerializationFailure # Was: Pass
rasta/issue_000035a: TextSerializationFailure # Was: Pass
rasta/issue_000036: TextSerializationFailure # Was: RuntimeError
-rasta/issue_000039: VerificationError
+rasta/issue_000039: TextSerializationFailure
rasta/issue_000041: TextSerializationFailure # Was: RuntimeError
rasta/issue_000042: TextSerializationFailure # Was: RuntimeError
rasta/issue_000043: TextSerializationFailure # Was: RuntimeError
@@ -912,6 +919,11 @@
regress/issue_35260: TextSerializationFailure # Was: RuntimeError # Expected
regress/issue_35266: TextSerializationFailure # Was: RuntimeError # Expected
regress/issue_35900: TextSerializationFailure
+regress/issue_36400: TextSerializationFailure
+regress/issue_36647: TextSerializationFailure
+regress/issue_36647_2: TextSerializationFailure
+regress/issue_36793: TextSerializationFailure
+regress/issue_36669: TextSerializationFailure
reject_generic_function_types_in_bounds: TextSerializationFailure # Was: RuntimeError # Expected
return_with_unknown_type_in_context: TextSerializationFailure # Was: Pass
runtime_checks/call_kinds: TextSerializationFailure # Was: Pass
@@ -996,6 +1008,7 @@
top_level_accessors_part: TextSerializationFailure # Was: Pass
top_level_library_method: TextSerializationFailure # Was: Pass
type_of_null: TextSerializationFailure
+type_parameter_type_named_int: TextSerializationFailure
type_variable_as_super: TextSerializationFailure # Was: RuntimeError
type_variable_prefix: TextSerializationFailure # Was: RuntimeError
type_variable_uses: TextSerializationFailure # Was: Pass
diff --git a/front_end/testcases/type_parameter_type_named_int.dart b/front_end/testcases/type_parameter_type_named_int.dart
new file mode 100644
index 0000000..af96c11
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2019, 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.
+
+abstract class Foo<T> {
+ List<T> get list;
+ void setList<T>(List<T> value);
+}
+
+class Bar implements Foo<int> {
+ List<int> list;
+ void setList<int>(List<int> value) {
+ list = value;
+ }
+}
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.hierarchy.expect b/front_end/testcases/type_parameter_type_named_int.dart.hierarchy.expect
new file mode 100644
index 0000000..e128e2e
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.hierarchy.expect
@@ -0,0 +1,74 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+Foo:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Foo.list
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Foo.setList
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+Bar:
+ Longest path to Object: 2
+ superclasses:
+ Object
+ interfaces: Foo<int>
+ classMembers:
+ Bar.list
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Bar.setList
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+ Bar.list
+ interfaceMembers:
+ Bar.list
+ Object.toString
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._identityHashCode
+ Object.hashCode
+ Bar.setList
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ interfaceSetters:
+ Bar.list
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.legacy.expect b/front_end/testcases/type_parameter_type_named_int.dart.legacy.expect
new file mode 100644
index 0000000..1e2cdd2
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.legacy.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo<T extends core::Object = dynamic> extends core::Object {
+ synthetic constructor •() → self::Foo<self::Foo::T>
+ : super core::Object::•()
+ ;
+ abstract get list() → core::List<self::Foo::T>;
+ abstract method setList<T extends core::Object = dynamic>(core::List<self::Foo::setList::T> value) → void;
+}
+class Bar extends core::Object implements self::Foo<core::int> {
+ field core::List<core::int> list = null;
+ synthetic constructor •() → self::Bar
+ : super core::Object::•()
+ ;
+ method setList<int extends core::Object = dynamic>(core::List<self::Bar::setList::int> value) → void {
+ this.{self::Bar::list} = value;
+ }
+}
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.legacy.transformed.expect b/front_end/testcases/type_parameter_type_named_int.dart.legacy.transformed.expect
new file mode 100644
index 0000000..1e2cdd2
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.legacy.transformed.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo<T extends core::Object = dynamic> extends core::Object {
+ synthetic constructor •() → self::Foo<self::Foo::T>
+ : super core::Object::•()
+ ;
+ abstract get list() → core::List<self::Foo::T>;
+ abstract method setList<T extends core::Object = dynamic>(core::List<self::Foo::setList::T> value) → void;
+}
+class Bar extends core::Object implements self::Foo<core::int> {
+ field core::List<core::int> list = null;
+ synthetic constructor •() → self::Bar
+ : super core::Object::•()
+ ;
+ method setList<int extends core::Object = dynamic>(core::List<self::Bar::setList::int> value) → void {
+ this.{self::Bar::list} = value;
+ }
+}
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.outline.expect b/front_end/testcases/type_parameter_type_named_int.dart.outline.expect
new file mode 100644
index 0000000..c6ca162
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.outline.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo<T extends core::Object = dynamic> extends core::Object {
+ synthetic constructor •() → self::Foo<self::Foo::T>
+ ;
+ abstract get list() → core::List<self::Foo::T>;
+ abstract method setList<T extends core::Object = dynamic>(core::List<self::Foo::setList::T> value) → void;
+}
+class Bar extends core::Object implements self::Foo<core::int> {
+ field core::List<core::int> list;
+ synthetic constructor •() → self::Bar
+ ;
+ method setList<int extends core::Object = dynamic>(core::List<self::Bar::setList::int> value) → void
+ ;
+}
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.strong.expect b/front_end/testcases/type_parameter_type_named_int.dart.strong.expect
new file mode 100644
index 0000000..37066d6
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.strong.expect
@@ -0,0 +1,37 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/type_parameter_type_named_int.dart:13:12: Error: A value of type 'List<int/*1*/>' can't be assigned to a variable of type 'List<int/*2*/>'.
+// - 'List' is from 'dart:core'.
+// - 'int/*1*/' is from 'pkg/front_end/testcases/type_parameter_type_named_int.dart'.
+// - 'int/*2*/' is from 'dart:core'.
+// Try changing the type of the left hand side, or casting the right hand side to 'List<int/*2*/>'.
+// list = value;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo<T extends core::Object = dynamic> extends core::Object {
+ synthetic constructor •() → self::Foo<self::Foo::T>
+ : super core::Object::•()
+ ;
+ abstract get list() → core::List<self::Foo::T>;
+ abstract method setList<T extends core::Object = dynamic>(core::List<self::Foo::setList::T> value) → void;
+}
+class Bar extends core::Object implements self::Foo<core::int> {
+ field core::List<core::int> list = null;
+ synthetic constructor •() → self::Bar
+ : super core::Object::•()
+ ;
+ method setList<int extends core::Object = dynamic>(core::List<self::Bar::setList::int> value) → void {
+ this.{self::Bar::list} = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/type_parameter_type_named_int.dart:13:12: Error: A value of type 'List<int/*1*/>' can't be assigned to a variable of type 'List<int/*2*/>'.
+ - 'List' is from 'dart:core'.
+ - 'int/*1*/' is from 'pkg/front_end/testcases/type_parameter_type_named_int.dart'.
+ - 'int/*2*/' is from 'dart:core'.
+Try changing the type of the left hand side, or casting the right hand side to 'List<int/*2*/>'.
+ list = value;
+ ^" in value as{TypeError} core::List<core::int>;
+ }
+}
diff --git a/front_end/testcases/type_parameter_type_named_int.dart.strong.transformed.expect b/front_end/testcases/type_parameter_type_named_int.dart.strong.transformed.expect
new file mode 100644
index 0000000..37066d6
--- /dev/null
+++ b/front_end/testcases/type_parameter_type_named_int.dart.strong.transformed.expect
@@ -0,0 +1,37 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/type_parameter_type_named_int.dart:13:12: Error: A value of type 'List<int/*1*/>' can't be assigned to a variable of type 'List<int/*2*/>'.
+// - 'List' is from 'dart:core'.
+// - 'int/*1*/' is from 'pkg/front_end/testcases/type_parameter_type_named_int.dart'.
+// - 'int/*2*/' is from 'dart:core'.
+// Try changing the type of the left hand side, or casting the right hand side to 'List<int/*2*/>'.
+// list = value;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo<T extends core::Object = dynamic> extends core::Object {
+ synthetic constructor •() → self::Foo<self::Foo::T>
+ : super core::Object::•()
+ ;
+ abstract get list() → core::List<self::Foo::T>;
+ abstract method setList<T extends core::Object = dynamic>(core::List<self::Foo::setList::T> value) → void;
+}
+class Bar extends core::Object implements self::Foo<core::int> {
+ field core::List<core::int> list = null;
+ synthetic constructor •() → self::Bar
+ : super core::Object::•()
+ ;
+ method setList<int extends core::Object = dynamic>(core::List<self::Bar::setList::int> value) → void {
+ this.{self::Bar::list} = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/type_parameter_type_named_int.dart:13:12: Error: A value of type 'List<int/*1*/>' can't be assigned to a variable of type 'List<int/*2*/>'.
+ - 'List' is from 'dart:core'.
+ - 'int/*1*/' is from 'pkg/front_end/testcases/type_parameter_type_named_int.dart'.
+ - 'int/*2*/' is from 'dart:core'.
+Try changing the type of the left hand side, or casting the right hand side to 'List<int/*2*/>'.
+ list = value;
+ ^" in value as{TypeError} core::List<core::int>;
+ }
+}
diff --git a/front_end/testcases/type_variable_prefix.dart.strong.expect b/front_end/testcases/type_variable_prefix.dart.strong.expect
index 1ca7685..019571a 100644
--- a/front_end/testcases/type_variable_prefix.dart.strong.expect
+++ b/front_end/testcases/type_variable_prefix.dart.strong.expect
@@ -6,16 +6,6 @@
// T.String method() => "Hello, World!";
// ^^^^^^^^
//
-// pkg/front_end/testcases/type_variable_prefix.dart:8:24: Error: A value of type 'String' can't be assigned to a variable of type 'invalid-type'.
-// Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
-// T.String method() => "Hello, World!";
-// ^
-//
-// pkg/front_end/testcases/type_variable_prefix.dart:12:24: Error: A value of type 'invalid-type' can't be assigned to a variable of type 'String'.
-// Try changing the type of the left hand side, or casting the right hand side to 'String'.
-// T.String s = new C().method();
-// ^
-//
import self as self;
import "dart:core" as core;
@@ -26,15 +16,9 @@
: super core::Object::•()
;
method method() → invalid-type
- return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/type_variable_prefix.dart:8:24: Error: A value of type 'String' can't be assigned to a variable of type 'invalid-type'.
-Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
- T.String method() => \"Hello, World!\";
- ^" in "Hello, World!" as{TypeError} invalid-type;
+ return "Hello, World!" as{TypeError} invalid-type;
}
static method main() → dynamic {
- core::String s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/type_variable_prefix.dart:12:24: Error: A value of type 'invalid-type' can't be assigned to a variable of type 'String'.
-Try changing the type of the left hand side, or casting the right hand side to 'String'.
- T.String s = new C().method();
- ^" in new self::C::•<dynamic>().{self::C::method}() as{TypeError} core::String;
+ core::String s = new self::C::•<dynamic>().{self::C::method}() as{TypeError} core::String;
core::print(s);
}
diff --git a/front_end/testcases/type_variable_prefix.dart.strong.transformed.expect b/front_end/testcases/type_variable_prefix.dart.strong.transformed.expect
index 1ca7685..019571a 100644
--- a/front_end/testcases/type_variable_prefix.dart.strong.transformed.expect
+++ b/front_end/testcases/type_variable_prefix.dart.strong.transformed.expect
@@ -6,16 +6,6 @@
// T.String method() => "Hello, World!";
// ^^^^^^^^
//
-// pkg/front_end/testcases/type_variable_prefix.dart:8:24: Error: A value of type 'String' can't be assigned to a variable of type 'invalid-type'.
-// Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
-// T.String method() => "Hello, World!";
-// ^
-//
-// pkg/front_end/testcases/type_variable_prefix.dart:12:24: Error: A value of type 'invalid-type' can't be assigned to a variable of type 'String'.
-// Try changing the type of the left hand side, or casting the right hand side to 'String'.
-// T.String s = new C().method();
-// ^
-//
import self as self;
import "dart:core" as core;
@@ -26,15 +16,9 @@
: super core::Object::•()
;
method method() → invalid-type
- return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/type_variable_prefix.dart:8:24: Error: A value of type 'String' can't be assigned to a variable of type 'invalid-type'.
-Try changing the type of the left hand side, or casting the right hand side to 'invalid-type'.
- T.String method() => \"Hello, World!\";
- ^" in "Hello, World!" as{TypeError} invalid-type;
+ return "Hello, World!" as{TypeError} invalid-type;
}
static method main() → dynamic {
- core::String s = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/type_variable_prefix.dart:12:24: Error: A value of type 'invalid-type' can't be assigned to a variable of type 'String'.
-Try changing the type of the left hand side, or casting the right hand side to 'String'.
- T.String s = new C().method();
- ^" in new self::C::•<dynamic>().{self::C::method}() as{TypeError} core::String;
+ core::String s = new self::C::•<dynamic>().{self::C::method}() as{TypeError} core::String;
core::print(s);
}
diff --git a/front_end/testcases/undefined.dart b/front_end/testcases/undefined.dart
index d94de88..6e2fc23 100644
--- a/front_end/testcases/undefined.dart
+++ b/front_end/testcases/undefined.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.
-/*@testedFeatures=error*/
-
class C {
var x;
void f() {}
@@ -11,11 +9,11 @@
void test(C c) {
c.x;
- c. /*@error=UndefinedGetter*/ y;
+ c.y;
c.f();
- c. /*@error=UndefinedMethod*/ g();
+ c.g();
c.x = null;
- c. /*@error=UndefinedSetter*/ y = null;
+ c.y = null;
}
main() {}
diff --git a/front_end/testcases/undefined.dart.strong.expect b/front_end/testcases/undefined.dart.strong.expect
index acd6f2d..cf77098 100644
--- a/front_end/testcases/undefined.dart.strong.expect
+++ b/front_end/testcases/undefined.dart.strong.expect
@@ -2,23 +2,23 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/undefined.dart:14:33: Error: The getter 'y' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:12:5: Error: The getter 'y' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'y'.
-// c. /*@error=UndefinedGetter*/ y;
-// ^
+// c.y;
+// ^
//
-// pkg/front_end/testcases/undefined.dart:16:33: Error: The method 'g' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:14:5: Error: The method 'g' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing method, or defining a method named 'g'.
-// c. /*@error=UndefinedMethod*/ g();
-// ^
+// c.g();
+// ^
//
-// pkg/front_end/testcases/undefined.dart:18:33: Error: The setter 'y' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:16:5: Error: The setter 'y' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'y'.
-// c. /*@error=UndefinedSetter*/ y = null;
-// ^
+// c.y = null;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -32,22 +32,22 @@
}
static method test(self::C c) → void {
c.{self::C::x};
- invalid-expression "pkg/front_end/testcases/undefined.dart:14:33: Error: The getter 'y' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:12:5: Error: The getter 'y' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'y'.
- c. /*@error=UndefinedGetter*/ y;
- ^";
+ c.y;
+ ^";
c.{self::C::f}();
- invalid-expression "pkg/front_end/testcases/undefined.dart:16:33: Error: The method 'g' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:14:5: Error: The method 'g' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'g'.
- c. /*@error=UndefinedMethod*/ g();
- ^";
+ c.g();
+ ^";
c.{self::C::x} = null;
- invalid-expression "pkg/front_end/testcases/undefined.dart:18:33: Error: The setter 'y' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:16:5: Error: The setter 'y' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'y'.
- c. /*@error=UndefinedSetter*/ y = null;
- ^";
+ c.y = null;
+ ^";
}
static method main() → dynamic {}
diff --git a/front_end/testcases/undefined.dart.strong.transformed.expect b/front_end/testcases/undefined.dart.strong.transformed.expect
index acd6f2d..cf77098 100644
--- a/front_end/testcases/undefined.dart.strong.transformed.expect
+++ b/front_end/testcases/undefined.dart.strong.transformed.expect
@@ -2,23 +2,23 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/undefined.dart:14:33: Error: The getter 'y' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:12:5: Error: The getter 'y' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'y'.
-// c. /*@error=UndefinedGetter*/ y;
-// ^
+// c.y;
+// ^
//
-// pkg/front_end/testcases/undefined.dart:16:33: Error: The method 'g' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:14:5: Error: The method 'g' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing method, or defining a method named 'g'.
-// c. /*@error=UndefinedMethod*/ g();
-// ^
+// c.g();
+// ^
//
-// pkg/front_end/testcases/undefined.dart:18:33: Error: The setter 'y' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined.dart:16:5: Error: The setter 'y' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'y'.
-// c. /*@error=UndefinedSetter*/ y = null;
-// ^
+// c.y = null;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -32,22 +32,22 @@
}
static method test(self::C c) → void {
c.{self::C::x};
- invalid-expression "pkg/front_end/testcases/undefined.dart:14:33: Error: The getter 'y' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:12:5: Error: The getter 'y' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'y'.
- c. /*@error=UndefinedGetter*/ y;
- ^";
+ c.y;
+ ^";
c.{self::C::f}();
- invalid-expression "pkg/front_end/testcases/undefined.dart:16:33: Error: The method 'g' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:14:5: Error: The method 'g' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'g'.
- c. /*@error=UndefinedMethod*/ g();
- ^";
+ c.g();
+ ^";
c.{self::C::x} = null;
- invalid-expression "pkg/front_end/testcases/undefined.dart:18:33: Error: The setter 'y' isn't defined for the class 'C'.
+ invalid-expression "pkg/front_end/testcases/undefined.dart:16:5: Error: The setter 'y' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'y'.
- c. /*@error=UndefinedSetter*/ y = null;
- ^";
+ c.y = null;
+ ^";
}
static method main() → dynamic {}
diff --git a/front_end/testcases/undefined_getter_in_compound_assignment.dart b/front_end/testcases/undefined_getter_in_compound_assignment.dart
index 1da15ad..c6b5b4d 100644
--- a/front_end/testcases/undefined_getter_in_compound_assignment.dart
+++ b/front_end/testcases/undefined_getter_in_compound_assignment.dart
@@ -2,16 +2,14 @@
// 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=error*/
-
class C {
void set x(value) {}
}
void test(C c) {
c.x = 1; // Ok
- c. /*@error=UndefinedGetter*/ x += 1;
- c. /*@error=UndefinedGetter*/ x ??= 1;
+ c.x += 1;
+ c.x ??= 1;
}
main() {}
diff --git a/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect b/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
index a86da13..35fb71c 100644
--- a/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
+++ b/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:13:33: Error: The getter 'x' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:11:5: Error: The getter 'x' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
-// c. /*@error=UndefinedGetter*/ x += 1;
-// ^
+// c.x += 1;
+// ^
//
-// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:12:5: Error: The getter 'x' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
-// c. /*@error=UndefinedGetter*/ x ??= 1;
-// ^
+// c.x ??= 1;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -25,15 +25,15 @@
}
static method test(self::C c) → void {
c.{self::C::x} = 1;
- let final self::C #t1 = c in #t1.{self::C::x} = invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:13:33: Error: The getter 'x' isn't defined for the class 'C'.
+ let final self::C #t1 = c in #t1.{self::C::x} = invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:11:5: Error: The getter 'x' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
- c. /*@error=UndefinedGetter*/ x += 1;
- ^".+(1);
- let final self::C #t2 = c in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class 'C'.
+ c.x += 1;
+ ^".+(1);
+ let final self::C #t2 = c in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:12:5: Error: The getter 'x' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
- c. /*@error=UndefinedGetter*/ x ??= 1;
- ^".{core::Object::==}(null) ?{dynamic} #t2.{self::C::x} = 1 : null;
+ c.x ??= 1;
+ ^".{core::Object::==}(null) ?{dynamic} #t2.{self::C::x} = 1 : null;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.transformed.expect b/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.transformed.expect
index a86da13..35fb71c 100644
--- a/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.transformed.expect
+++ b/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.transformed.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:13:33: Error: The getter 'x' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:11:5: Error: The getter 'x' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
-// c. /*@error=UndefinedGetter*/ x += 1;
-// ^
+// c.x += 1;
+// ^
//
-// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class 'C'.
+// pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:12:5: Error: The getter 'x' isn't defined for the class 'C'.
// - 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
-// c. /*@error=UndefinedGetter*/ x ??= 1;
-// ^
+// c.x ??= 1;
+// ^
//
import self as self;
import "dart:core" as core;
@@ -25,15 +25,15 @@
}
static method test(self::C c) → void {
c.{self::C::x} = 1;
- let final self::C #t1 = c in #t1.{self::C::x} = invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:13:33: Error: The getter 'x' isn't defined for the class 'C'.
+ let final self::C #t1 = c in #t1.{self::C::x} = invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:11:5: Error: The getter 'x' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
- c. /*@error=UndefinedGetter*/ x += 1;
- ^".+(1);
- let final self::C #t2 = c in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class 'C'.
+ c.x += 1;
+ ^".+(1);
+ let final self::C #t2 = c in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:12:5: Error: The getter 'x' isn't defined for the class 'C'.
- 'C' is from 'pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'x'.
- c. /*@error=UndefinedGetter*/ x ??= 1;
- ^".{core::Object::==}(null) ?{dynamic} #t2.{self::C::x} = 1 : null;
+ c.x ??= 1;
+ ^".{core::Object::==}(null) ?{dynamic} #t2.{self::C::x} = 1 : null;
}
static method main() → dynamic {}
diff --git a/front_end/testcases/warn_unresolved_sends.dart b/front_end/testcases/warn_unresolved_sends.dart
index a5be7f4..9591e28 100644
--- a/front_end/testcases/warn_unresolved_sends.dart
+++ b/front_end/testcases/warn_unresolved_sends.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.
-/*@testedFeatures=warning*/
class C {
var superField;
superMethod() {}
diff --git a/front_end/testcases/warn_unresolved_sends.dart.legacy.expect b/front_end/testcases/warn_unresolved_sends.dart.legacy.expect
index 6a98a24..a170b83 100644
--- a/front_end/testcases/warn_unresolved_sends.dart.legacy.expect
+++ b/front_end/testcases/warn_unresolved_sends.dart.legacy.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:49:39: Warning: Getter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:48:39: Warning: Getter not found: 'missingField'.
// this. /*@warning=GetterNotFound*/ missingField;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:50:39: Warning: Setter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:49:39: Warning: Setter not found: 'missingField'.
// this. /*@warning=SetterNotFound*/ missingField = 0;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:51:39: Warning: Method not found: 'missingMethod'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:50:39: Warning: Method not found: 'missingMethod'.
// this. /*@warning=MethodNotFound*/ missingMethod();
// ^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:53:33: Warning: Getter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:52:33: Warning: Getter not found: 'missingField'.
// /*@warning=GetterNotFound*/ missingField;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:54:33: Warning: Setter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:53:33: Warning: Setter not found: 'missingField'.
// /*@warning=SetterNotFound*/ missingField = 0;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:55:33: Warning: Method not found: 'missingMethod'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:54:33: Warning: Method not found: 'missingMethod'.
// /*@warning=MethodNotFound*/ missingMethod();
// ^^^^^^^^^^^^^
//
diff --git a/front_end/testcases/warn_unresolved_sends.dart.legacy.transformed.expect b/front_end/testcases/warn_unresolved_sends.dart.legacy.transformed.expect
index 6a98a24..a170b83 100644
--- a/front_end/testcases/warn_unresolved_sends.dart.legacy.transformed.expect
+++ b/front_end/testcases/warn_unresolved_sends.dart.legacy.transformed.expect
@@ -2,27 +2,27 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:49:39: Warning: Getter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:48:39: Warning: Getter not found: 'missingField'.
// this. /*@warning=GetterNotFound*/ missingField;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:50:39: Warning: Setter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:49:39: Warning: Setter not found: 'missingField'.
// this. /*@warning=SetterNotFound*/ missingField = 0;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:51:39: Warning: Method not found: 'missingMethod'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:50:39: Warning: Method not found: 'missingMethod'.
// this. /*@warning=MethodNotFound*/ missingMethod();
// ^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:53:33: Warning: Getter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:52:33: Warning: Getter not found: 'missingField'.
// /*@warning=GetterNotFound*/ missingField;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:54:33: Warning: Setter not found: 'missingField'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:53:33: Warning: Setter not found: 'missingField'.
// /*@warning=SetterNotFound*/ missingField = 0;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/warn_unresolved_sends.dart:55:33: Warning: Method not found: 'missingMethod'.
+// pkg/front_end/testcases/warn_unresolved_sends.dart:54:33: Warning: Method not found: 'missingMethod'.
// /*@warning=MethodNotFound*/ missingMethod();
// ^^^^^^^^^^^^^
//
diff --git a/front_end/tool/fasta b/front_end/tool/fasta
index 465f05b..65b9ec4 100755
--- a/front_end/tool/fasta
+++ b/front_end/tool/fasta
@@ -62,4 +62,4 @@
shift
-exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" -c "${SCRIPT}" "$@"
+exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" --enable-asserts "${SCRIPT}" "$@"
diff --git a/front_end/tool/perf.dart b/front_end/tool/perf.dart
index 553ffc6..b216937 100644
--- a/front_end/tool/perf.dart
+++ b/front_end/tool/perf.dart
@@ -18,6 +18,7 @@
import 'dart:async';
import 'dart:io' show Directory, File, Platform, exit;
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/physical_file_system.dart'
@@ -100,9 +101,9 @@
/// Uses the diet-parser to parse only directives in [source].
CompilationUnit parseDirectives(Source source) {
var token = tokenize(source);
- // TODO(jcollins-g): Make parser work with Fasta
- var parser =
- new Parser(source, AnalysisErrorListener.NULL_LISTENER, useFasta: false);
+ var featureSet = FeatureSet.fromEnableFlags([]);
+ var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER,
+ featureSet: featureSet);
return parser.parseDirectives(token);
}
@@ -122,7 +123,9 @@
CompilationUnit parseFull(Source source) {
var token = tokenize(source);
parseTimer.start();
- var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER);
+ var featureSet = FeatureSet.fromEnableFlags([]);
+ var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER,
+ featureSet: featureSet);
var unit = parser.parseCompilationUnit(token);
parseTimer.stop();
return unit;
diff --git a/http_multi_server/BUILD.gn b/http_multi_server/BUILD.gn
index 5c028ab..ef2df22 100644
--- a/http_multi_server/BUILD.gn
+++ b/http_multi_server/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for http_multi_server-2.0.5
+# This file is generated by importer.py for http_multi_server-2.0.6
import("//build/dart/dart_library.gni")
diff --git a/http_multi_server/CHANGELOG.md b/http_multi_server/CHANGELOG.md
index 2b737e1..c03d636 100644
--- a/http_multi_server/CHANGELOG.md
+++ b/http_multi_server/CHANGELOG.md
@@ -1,6 +1,11 @@
+## 2.0.6
+
+* If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4
+ server open when throwing the exception.
+
## 2.0.5
-* Update SDK to 2.0.0-dev.
+* Update SDK constraints to `>=2.0.0-dev <3.0.0`.
## 2.0.4
diff --git a/http_multi_server/analysis_options.yaml b/http_multi_server/analysis_options.yaml
index a10d4c5..6f476fe 100644
--- a/http_multi_server/analysis_options.yaml
+++ b/http_multi_server/analysis_options.yaml
@@ -1,2 +1,44 @@
+include: package:pedantic/analysis_options.yaml
analyzer:
- strong-mode: true
+ strong-mode:
+ implicit-casts: false
+linter:
+ rules:
+ - avoid_empty_else
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_unused_constructor_parameters
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ - constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - hash_and_equals
+ - implementation_imports
+ - iterable_contains_unrelated_type
+ - library_names
+ - library_prefixes
+ - list_remove_unrelated_type
+ - non_constant_identifier_names
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - prefer_equal_for_default_values
+ - prefer_final_fields
+ - prefer_generic_function_type_aliases
+ - prefer_is_not_empty
+ - slash_for_doc_comments
+ - super_goes_last
+ - test_types_in_equals
+ - throw_in_finally
+ - type_init_formals
+ - unnecessary_brace_in_string_interps
+ - unnecessary_const
+ - unnecessary_new
+ - unrelated_type_equality_checks
+ - valid_regexps
diff --git a/http_multi_server/lib/http_multi_server.dart b/http_multi_server/lib/http_multi_server.dart
index 309e57f..562092d 100644
--- a/http_multi_server/lib/http_multi_server.dart
+++ b/http_multi_server/lib/http_multi_server.dart
@@ -86,7 +86,7 @@
/// listened to when this is called.
HttpMultiServer(Iterable<HttpServer> servers)
: _servers = servers.toSet(),
- defaultResponseHeaders = new MultiHeaders(
+ defaultResponseHeaders = MultiHeaders(
servers.map((server) => server.defaultResponseHeaders)),
super(StreamGroup.merge(servers));
@@ -95,7 +95,7 @@
///
/// See [HttpServer.bind].
static Future<HttpServer> loopback(int port,
- {int backlog, bool v6Only: false, bool shared: false}) {
+ {int backlog, bool v6Only = false, bool shared = false}) {
if (backlog == null) backlog = 0;
return _loopback(
@@ -109,9 +109,9 @@
/// See [HttpServer.bindSecure].
static Future<HttpServer> loopbackSecure(int port, SecurityContext context,
{int backlog,
- bool v6Only: false,
- bool requestClientCertificate: false,
- bool shared: false}) {
+ bool v6Only = false,
+ bool requestClientCertificate = false,
+ bool shared = false}) {
if (backlog == null) backlog = 0;
return _loopback(
@@ -143,8 +143,12 @@
// Reuse the IPv4 server's port so that if [port] is 0, both servers use
// the same ephemeral port.
var v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port);
- return new HttpMultiServer([v4Server, v6Server]);
+ return HttpMultiServer([v4Server, v6Server]);
} on SocketException catch (error) {
+ // If there is already a server listening we'll lose the reference on a
+ // rethrow.
+ await v4Server.close();
+
if (error.osError.errorCode != _addressInUseErrno) rethrow;
if (port != 0) rethrow;
if (remainingRetries == 0) rethrow;
@@ -152,18 +156,17 @@
// A port being available on IPv4 doesn't necessarily mean that the same
// port is available on IPv6. If it's not (which is rare in practice),
// we try again until we find one that's available on both.
- v4Server.close();
return await _loopback(port, bind, remainingRetries - 1);
}
}
- Future close({bool force: false}) =>
+ Future close({bool force = false}) =>
Future.wait(_servers.map((server) => server.close(force: force)));
/// Returns an HttpConnectionsInfo object summarizing the total number of
/// current connections handled by all the servers.
HttpConnectionsInfo connectionsInfo() {
- var info = new HttpConnectionsInfo();
+ var info = HttpConnectionsInfo();
for (var server in _servers) {
var subInfo = server.connectionsInfo();
info.total += subInfo.total;
diff --git a/http_multi_server/lib/src/utils.dart b/http_multi_server/lib/src/utils.dart
index 3d24a03..2709dab 100644
--- a/http_multi_server/lib/src/utils.dart
+++ b/http_multi_server/lib/src/utils.dart
@@ -9,7 +9,7 @@
final Future<bool> supportsIPv6 = () async {
try {
var socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0);
- socket.close();
+ await socket.close();
return true;
} on SocketException catch (_) {
return false;
@@ -20,7 +20,7 @@
final Future<bool> supportsIPv4 = () async {
try {
var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
- socket.close();
+ await socket.close();
return true;
} on SocketException catch (_) {
return false;
diff --git a/http_multi_server/pubspec.yaml b/http_multi_server/pubspec.yaml
index ad1bfcc..175c5bc 100644
--- a/http_multi_server/pubspec.yaml
+++ b/http_multi_server/pubspec.yaml
@@ -1,13 +1,17 @@
name: http_multi_server
-version: 2.0.5
-author: "Dart Team <misc@dartlang.org>"
+version: 2.0.6
+
+description: A dart:io HttpServer wrapper that handles requests from multiple servers.
+author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/http_multi_server
-description:
- A dart:io HttpServer wrapper that handles requests from multiple servers.
+
environment:
- sdk: ">=2.0.0-dev.55.0 <3.0.0"
+ sdk: '>=2.0.0-dev.55.0 <3.0.0'
+
dependencies:
- async: ">=1.2.0 <3.0.0"
+ async: '>=1.2.0 <3.0.0'
+
dev_dependencies:
- test: ">=0.12.0 <0.13.0"
- http: ">=0.11.0 <0.12.0"
+ http: ^0.12.0
+ pedantic: ^1.4.0
+ test: ^1.5.2
diff --git a/kernel/BUILD.gn b/kernel/BUILD.gn
index f402fed..4a5222a 100644
--- a/kernel/BUILD.gn
+++ b/kernel/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for kernel-0.3.14
+# This file is generated by importer.py for kernel-0.3.18
import("//build/dart/dart_library.gni")
@@ -12,7 +12,6 @@
disable_analysis = true
deps = [
- "//third_party/dart-pkg/pub/path",
"//third_party/dart-pkg/pub/args",
]
}
diff --git a/kernel/bin/transform.dart b/kernel/bin/transform.dart
index 5f792a5..f384400 100755
--- a/kernel/bin/transform.dart
+++ b/kernel/bin/transform.dart
@@ -6,6 +6,9 @@
import 'dart:async';
import 'dart:io';
+import 'package:front_end/src/api_prototype/constant_evaluator.dart'
+ as constants show SimpleErrorReporter, transformComponent;
+
import 'package:args/args.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
@@ -13,9 +16,6 @@
import 'package:kernel/src/tool/batch_util.dart';
import 'package:kernel/target/targets.dart';
-import 'package:kernel/transformations/constants.dart' as constants
- show SimpleErrorReporter, transformComponent;
-
import 'package:kernel/transformations/continuation.dart' as cont;
import 'package:kernel/transformations/empty.dart' as empty;
import 'package:kernel/transformations/method_call.dart' as method_call;
@@ -102,7 +102,8 @@
case 'constants':
final VmConstantsBackend backend = new VmConstantsBackend(coreTypes);
component = constants.transformComponent(
- component, backend, defines, const constants.SimpleErrorReporter());
+ component, backend, defines, const constants.SimpleErrorReporter(),
+ enableAsserts: true);
break;
case 'methodcall':
component =
diff --git a/kernel/binary.md b/kernel/binary.md
index 613741e..6b247af 100644
--- a/kernel/binary.md
+++ b/kernel/binary.md
@@ -87,7 +87,7 @@
}
type ConstantReference {
- UInt index; // Index into the Component's constants.
+ UInt offset; // Byte offset into the Component's constants.
}
type SourceInfo {
@@ -97,6 +97,8 @@
// Line starts are delta-encoded (they are encoded as line lengths). The list
// [0, 10, 25, 32, 42] is encoded as [0, 10, 15, 7, 10].
List<UInt> lineStarts;
+
+ List<Byte> importUriUtf8Bytes;
}
type UriSource {
@@ -137,7 +139,7 @@
type ComponentFile {
UInt32 magic = 0x90ABCDEF;
- UInt32 formatVersion = 21;
+ UInt32 formatVersion = 25;
List<String> problemsAsJson; // Described in problems.md.
Library[] libraries;
UriSource sourceMap;
@@ -236,8 +238,11 @@
List<Field> fields;
List<Procedure> procedures;
+ List<UInt> sourceReferences; // list of sources owned by library, indexes into UriSource on Component.
+
// Library index. Offsets are used to get start (inclusive) and end (exclusive) byte positions for
// a specific class or procedure. Note the "+1" to account for needing the end of the last entry.
+ UInt32 sourceReferencesOffset;
UInt32[classes.length + 1] classOffsets;
UInt32 classCount = classes.length;
UInt32[procedures.length + 1] procedureOffsets;
@@ -718,6 +723,15 @@
List<Expression> maps;
}
+type InstanceCreation extends Expression {
+ Byte tag = 114;
+ FileOffset fileOffset;
+ CanonicalNameReference class;
+ List<DartType> typeArguments;
+ List<[FieldReference, Expression]> fieldValues;
+ List<AssertStatement> asserts;
+}
+
type IsExpression extends Expression {
Byte tag = 37;
FileOffset fileOffset;
@@ -890,6 +904,13 @@
}
type ConstantExpression extends Expression {
+ Byte tag = 106;
+ FileOffset fileOffset;
+ DartType type;
+ ConstantReference constantReference;
+}
+
+type Deprecated_ConstantExpression extends Expression {
Byte tag = 107;
ConstantReference constantReference;
}
diff --git a/kernel/lib/ast.dart b/kernel/lib/ast.dart
index 2d7e3a1..5d366a5 100644
--- a/kernel/lib/ast.dart
+++ b/kernel/lib/ast.dart
@@ -661,6 +661,10 @@
annotations.add(node);
node.parent = this;
}
+
+ Location _getLocationInEnclosingFile(int offset) {
+ return _getLocationInComponent(enclosingComponent, fileUri, offset);
+ }
}
/// The degree to which the contents of a class have been loaded into memory.
@@ -2211,6 +2215,9 @@
while (type is TypeParameterType) {
type = (type as TypeParameterType).parameter.bound;
}
+ if (type == types.nullType) {
+ return superclass.bottomType;
+ }
if (type is InterfaceType) {
var upcastType = types.getTypeAsInstanceOf(type, superclass);
if (upcastType != null) return upcastType;
@@ -3314,6 +3321,56 @@
}
}
+/// Create an instance directly from the field values.
+///
+/// This expression arises from const constructor calls when one or more field
+/// initializing expressions, field initializers or assert initializers contain
+/// unevaluated expressions. They only ever occur within unevaluated constants
+/// in constant expressions.
+class InstanceCreation extends Expression {
+ final Reference classReference;
+ final List<DartType> typeArguments;
+ final Map<Reference, Expression> fieldValues;
+ final List<AssertStatement> asserts;
+
+ InstanceCreation(
+ this.classReference, this.typeArguments, this.fieldValues, this.asserts);
+
+ Class get classNode => classReference.asClass;
+
+ DartType getStaticType(TypeEnvironment types) {
+ return typeArguments.isEmpty
+ ? classNode.rawType
+ : new InterfaceType(classNode, typeArguments);
+ }
+
+ accept(ExpressionVisitor v) => v.visitInstanceCreation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitInstanceCreation(this, arg);
+
+ visitChildren(Visitor v) {
+ classReference.asClass.acceptReference(v);
+ visitList(typeArguments, v);
+ for (final Reference reference in fieldValues.keys) {
+ reference.asField.acceptReference(v);
+ }
+ for (final Expression value in fieldValues.values) {
+ value.accept(v);
+ }
+ visitList(asserts, v);
+ }
+
+ transformChildren(Transformer v) {
+ fieldValues.forEach((Reference fieldRef, Expression value) {
+ Expression transformed = value.accept(v);
+ if (transformed != null && !identical(value, transformed)) {
+ fieldValues[fieldRef] = transformed;
+ transformed.parent = this;
+ }
+ });
+ transformList(asserts, v, this);
+ }
+}
+
/// Expression of form `x is T`.
class IsExpression extends Expression {
Expression operand;
@@ -3443,7 +3500,7 @@
class NullLiteral extends BasicLiteral {
Object get value => null;
- DartType getStaticType(TypeEnvironment types) => const BottomType();
+ DartType getStaticType(TypeEnvironment types) => types.nullType;
accept(ExpressionVisitor v) => v.visitNullLiteral(this);
accept1(ExpressionVisitor1 v, arg) => v.visitNullLiteral(this, arg);
@@ -3703,22 +3760,25 @@
class ConstantExpression extends Expression {
Constant constant;
+ DartType type;
- ConstantExpression(this.constant) {
+ ConstantExpression(this.constant, [this.type = const DynamicType()]) {
assert(constant != null);
}
- DartType getStaticType(TypeEnvironment types) => constant.getType(types);
+ DartType getStaticType(TypeEnvironment types) => type;
accept(ExpressionVisitor v) => v.visitConstantExpression(this);
accept1(ExpressionVisitor1 v, arg) => v.visitConstantExpression(this, arg);
visitChildren(Visitor v) {
constant?.acceptReference(v);
+ type?.accept(v);
}
transformChildren(Transformer v) {
constant = v.visitConstant(constant);
+ type = v.visitDartType(type);
}
}
@@ -5951,15 +6011,22 @@
final List<int> source;
+ final Uri importUri;
+
+ final Uri fileUri;
+
String cachedText;
- Source(this.lineStarts, this.source);
+ Source(this.lineStarts, this.source, this.importUri, this.fileUri);
/// Return the text corresponding to [line] which is a 1-based line
/// number. The returned line contains no line separators.
String getTextLine(int line) {
+ if (source == null ||
+ source.isEmpty ||
+ lineStarts == null ||
+ lineStarts.isEmpty) return null;
RangeError.checkValueInInterval(line, 1, lineStarts.length, 'line');
- if (source == null || source.isEmpty) return null;
cachedText ??= utf8.decode(source, allowMalformed: true);
// -1 as line numbers start at 1.
@@ -5983,6 +6050,9 @@
/// Translates an offset to line and column numbers in the given file.
Location getLocation(Uri file, int offset) {
+ if (lineStarts == null || lineStarts.isEmpty) {
+ return new Location(file, TreeNode.noOffset, TreeNode.noOffset);
+ }
RangeError.checkValueInInterval(offset, 0, lineStarts.last, 'offset');
int low = 0, high = lineStarts.length - 1;
while (low < high) {
@@ -6112,7 +6182,7 @@
/// This function will return "S with M1" and "S with M1, M2", respectively.
String demangleMixinApplicationName(String name) {
List<String> nameParts = name.split('&');
- if (nameParts.length < 2) return name;
+ if (nameParts.length < 2 || name == "&") return name;
String demangledName = nameParts[1];
for (int i = 2; i < nameParts.length; i++) {
demangledName += (i == 2 ? " with " : ", ") + nameParts[i];
diff --git a/kernel/lib/binary/ast_from_binary.dart b/kernel/lib/binary/ast_from_binary.dart
index f5b7c33..31c621d 100644
--- a/kernel/lib/binary/ast_from_binary.dart
+++ b/kernel/lib/binary/ast_from_binary.dart
@@ -76,14 +76,19 @@
List<String> debugPath = <String>[];
bool _isReadingLibraryImplementation = false;
+ final bool alwaysCreateNewNamedNodes;
/// If binary contains metadata section with payloads referencing other nodes
/// such Kernel binary can't be read lazily because metadata cross references
/// will not be resolved correctly.
bool _disableLazyReading = false;
- BinaryBuilder(this._bytes, {this.filename, disableLazyReading = false})
- : _disableLazyReading = disableLazyReading;
+ BinaryBuilder(this._bytes,
+ {this.filename,
+ bool disableLazyReading = false,
+ bool alwaysCreateNewNamedNodes})
+ : _disableLazyReading = disableLazyReading,
+ this.alwaysCreateNewNamedNodes = alwaysCreateNewNamedNodes ?? false;
fail(String message) {
throw ParseError(message,
@@ -696,7 +701,11 @@
lineStarts[j] = lineStart;
previousLineStart = lineStart;
}
- uriToSource[uri] = new Source(lineStarts, sourceCode);
+ List<int> importUriBytes = readByteList();
+ Uri importUri = importUriBytes.isEmpty
+ ? null
+ : Uri.parse(const Utf8Decoder().convert(importUriBytes));
+ uriToSource[uri] = new Source(lineStarts, sourceCode, importUri, uri);
}
// Read index.
@@ -799,6 +808,9 @@
var canonicalName = readCanonicalNameReference();
Reference reference = canonicalName.getReference();
Library library = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ library = null;
+ }
bool shouldWriteData = library == null || _isReadingLibraryImplementation;
if (library == null) {
library =
@@ -919,6 +931,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
Typedef node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new Typedef(null, null, reference: reference);
@@ -964,6 +979,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
Class node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new Class(reference: reference)..level = ClassLevel.Temporary;
@@ -1036,6 +1054,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
Field node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new Field(null, reference: reference);
@@ -1075,6 +1096,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
Constructor node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new Constructor(null, reference: reference);
@@ -1121,6 +1145,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
Procedure node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new Procedure(null, null, null, reference: reference);
@@ -1180,6 +1207,9 @@
var canonicalName = readCanonicalNameReference();
var reference = canonicalName.getReference();
RedirectingFactoryConstructor node = reference.node;
+ if (alwaysCreateNewNamedNodes) {
+ node = null;
+ }
bool shouldWriteData = node == null || _isReadingLibraryImplementation;
if (node == null) {
node = new RedirectingFactoryConstructor(null, reference: reference);
@@ -1530,6 +1560,26 @@
return new MapConcatenation(readExpressionList(),
keyType: keyType, valueType: valueType)
..fileOffset = offset;
+ case Tag.InstanceCreation:
+ int offset = readOffset();
+ Reference classReference = readClassReference();
+ List<DartType> typeArguments = readDartTypeList();
+ int fieldValueCount = readUInt();
+ Map<Reference, Expression> fieldValues = <Reference, Expression>{};
+ for (int i = 0; i < fieldValueCount; i++) {
+ final Reference fieldRef =
+ readCanonicalNameReference().getReference();
+ final Expression value = readExpression();
+ fieldValues[fieldRef] = value;
+ }
+ int assertCount = readUInt();
+ List<AssertStatement> asserts = new List<AssertStatement>(assertCount);
+ for (int i = 0; i < assertCount; i++) {
+ asserts[i] = readStatement();
+ }
+ return new InstanceCreation(
+ classReference, typeArguments, fieldValues, asserts)
+ ..fileOffset = offset;
case Tag.IsExpression:
int offset = readOffset();
return new IsExpression(readExpression(), readDartType())
@@ -1632,7 +1682,10 @@
var typeArguments = readDartTypeList();
return new Instantiation(expression, typeArguments);
case Tag.ConstantExpression:
- return new ConstantExpression(readConstantReference());
+ int offset = readOffset();
+ DartType type = readDartType();
+ Constant constant = readConstantReference();
+ return new ConstantExpression(constant, type)..fileOffset = offset;
default:
throw fail('unexpected expression tag: $tag');
}
diff --git a/kernel/lib/binary/ast_to_binary.dart b/kernel/lib/binary/ast_to_binary.dart
index db91bfb..4b3434c 100644
--- a/kernel/lib/binary/ast_to_binary.dart
+++ b/kernel/lib/binary/ast_to_binary.dart
@@ -25,6 +25,7 @@
final UriIndexer _sourceUriIndexer = new UriIndexer();
bool _currentlyInNonimplementation = false;
final List<bool> _sourcesFromRealImplementation = new List<bool>();
+ final List<bool> _sourcesFromRealImplementationInLibrary = new List<bool>();
Map<LibraryDependency, int> _libraryDependencyIndex =
<LibraryDependency, int>{};
@@ -263,16 +264,19 @@
}
// Returns the new active file uri.
- Uri writeUriReference(Uri uri) {
+ void writeUriReference(Uri uri) {
final int index = _sourceUriIndexer.put(uri);
writeUInt30(index);
if (!_currentlyInNonimplementation) {
+ if (_sourcesFromRealImplementationInLibrary.length <= index) {
+ _sourcesFromRealImplementationInLibrary.length = index + 1;
+ }
+ _sourcesFromRealImplementationInLibrary[index] = true;
if (_sourcesFromRealImplementation.length <= index) {
_sourcesFromRealImplementation.length = index + 1;
}
_sourcesFromRealImplementation[index] = true;
}
- return uri;
}
void writeList<T>(List<T> items, void writeItem(T x)) {
@@ -740,31 +744,20 @@
Uint8List buffer = new Uint8List(1 << 16);
for (Uri uri in _sourceUriIndexer.index.keys) {
index[i] = getBufferOffset();
- Source source = ((includeSources &&
- _sourcesFromRealImplementation.length > i &&
- _sourcesFromRealImplementation[i] == true)
- ? uriToSource[uri]
- : null) ??
- new Source(<int>[], const <int>[]);
-
- String uriAsString = uri == null ? "" : "$uri";
- if (uriAsString.length * 3 < buffer.length) {
- int length = NotQuiteString.writeUtf8(buffer, 0, uriAsString);
- if (length < 0) {
- // Utf8 encoding failed.
- writeByteList(utf8.encoder.convert(uriAsString));
- } else {
- writeUInt30(length);
- for (int j = 0; j < length; j++) {
- writeByte(buffer[j]);
- }
- }
- } else {
- // Uncommon case with very long url.
- writeByteList(utf8.encoder.convert(uriAsString));
+ Source source = uriToSource[uri];
+ if (source == null ||
+ !(includeSources &&
+ _sourcesFromRealImplementation.length > i &&
+ _sourcesFromRealImplementation[i] == true)) {
+ source = new Source(
+ <int>[], const <int>[], source?.importUri, source?.fileUri);
}
+ String uriAsString = uri == null ? "" : "$uri";
+ outputStringViaBuffer(uriAsString, buffer);
+
writeByteList(source.source);
+
List<int> lineStarts = source.lineStarts;
writeUInt30(lineStarts.length);
int previousLineStart = 0;
@@ -773,6 +766,11 @@
writeUInt30(lineStart - previousLineStart);
previousLineStart = lineStart;
}
+
+ String importUriAsString =
+ source.importUri == null ? "" : "${source.importUri}";
+ outputStringViaBuffer(importUriAsString, buffer);
+
i++;
}
@@ -782,6 +780,24 @@
}
}
+ void outputStringViaBuffer(String uriAsString, Uint8List buffer) {
+ if (uriAsString.length * 3 < buffer.length) {
+ int length = NotQuiteString.writeUtf8(buffer, 0, uriAsString);
+ if (length < 0) {
+ // Utf8 encoding failed.
+ writeByteList(utf8.encoder.convert(uriAsString));
+ } else {
+ writeUInt30(length);
+ for (int j = 0; j < length; j++) {
+ writeByte(buffer[j]);
+ }
+ }
+ } else {
+ // Uncommon case with very long url.
+ writeByteList(utf8.encoder.convert(uriAsString));
+ }
+ }
+
void writeLibraryDependencyReference(LibraryDependency node) {
int index = _libraryDependencyIndex[node];
if (index == null) {
@@ -909,7 +925,26 @@
writeProcedureNodeList(node.procedures);
procedureOffsets.add(getBufferOffset());
+ // Dump all source-references used in this library; used by the VM.
+ int sourceReferencesOffset = getBufferOffset();
+ int sourceReferencesCount = 0;
+ // Note: We start at 1 because 0 is the null-entry and we don't want to
+ // include that.
+ for (int i = 1; i < _sourcesFromRealImplementationInLibrary.length; i++) {
+ if (_sourcesFromRealImplementationInLibrary[i] == true) {
+ sourceReferencesCount++;
+ }
+ }
+ writeUInt30(sourceReferencesCount);
+ for (int i = 1; i < _sourcesFromRealImplementationInLibrary.length; i++) {
+ if (_sourcesFromRealImplementationInLibrary[i] == true) {
+ writeUInt30(i);
+ _sourcesFromRealImplementationInLibrary[i] = false;
+ }
+ }
+
// Fixed-size ints at the end used as an index.
+ writeUInt32(sourceReferencesOffset);
assert(classOffsets.length > 0);
for (int i = 0; i < classOffsets.length; ++i) {
int offset = classOffsets[i];
@@ -1491,6 +1526,20 @@
}
@override
+ void visitInstanceCreation(InstanceCreation node) {
+ writeByte(Tag.InstanceCreation);
+ writeOffset(node.fileOffset);
+ writeNonNullReference(node.classReference);
+ writeNodeList(node.typeArguments);
+ writeUInt30(node.fieldValues.length);
+ node.fieldValues.forEach((Reference fieldRef, Expression value) {
+ writeNonNullReference(fieldRef);
+ writeNode(value);
+ });
+ writeNodeList(node.asserts);
+ }
+
+ @override
void visitIsExpression(IsExpression node) {
writeByte(Tag.IsExpression);
writeOffset(node.fileOffset);
@@ -1732,6 +1781,8 @@
@override
void visitConstantExpression(ConstantExpression node) {
writeByte(Tag.ConstantExpression);
+ writeOffset(node.fileOffset);
+ writeDartType(node.type);
writeConstantReference(node.constant);
}
diff --git a/kernel/lib/binary/tag.dart b/kernel/lib/binary/tag.dart
index ba6cc4e..8e52b70 100644
--- a/kernel/lib/binary/tag.dart
+++ b/kernel/lib/binary/tag.dart
@@ -53,6 +53,7 @@
static const int ListConcatenation = 111;
static const int SetConcatenation = 112;
static const int MapConcatenation = 113;
+ static const int InstanceCreation = 114;
static const int IsExpression = 37;
static const int AsExpression = 38;
static const int StringLiteral = 39;
@@ -121,7 +122,10 @@
static const int ClassReference = 100;
static const int MemberReference = 101;
- static const int ConstantExpression = 107;
+ static const int ConstantExpression = 106;
+
+ // Tag is deprecated since version 24.
+ static const int Deprecated_ConstantExpression = 107;
/// 108 is occupied by [RedirectingFactoryConstructor] (member).
/// 109 is occupied by [SetLiteral] (expression).
@@ -129,6 +133,7 @@
/// 111 is occupied by [ListConcatenation] (expression).
/// 112 is occupied by [SetConcatenation] (expression).
/// 113 is occupied by [MapConcatenation] (expression).
+ /// 114 is occupied by [InstanceCreation] (expression).
static const int SpecializedTagHighBit = 0x80; // 10000000
static const int SpecializedTagMask = 0xF8; // 11111000
@@ -145,7 +150,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, pkg/kernel/binary.md.
- static const int BinaryFormatVersion = 21;
+ static const int BinaryFormatVersion = 25;
}
abstract class ConstantTag {
diff --git a/kernel/lib/canonical_name.dart b/kernel/lib/canonical_name.dart
index 20bf36c..76fd5d8 100644
--- a/kernel/lib/canonical_name.dart
+++ b/kernel/lib/canonical_name.dart
@@ -123,6 +123,10 @@
.getChildFromQualifiedName(member.name);
}
+ CanonicalName getChildFromFieldWithName(Name name) {
+ return getChild('@fields').getChildFromQualifiedName(name);
+ }
+
CanonicalName getChildFromTypedef(Typedef typedef_) {
return getChild('@typedefs').getChild(typedef_.name);
}
diff --git a/kernel/lib/clone.dart b/kernel/lib/clone.dart
index 4105a43..d5f1940 100644
--- a/kernel/lib/clone.dart
+++ b/kernel/lib/clone.dart
@@ -205,6 +205,18 @@
keyType: visitType(node.keyType), valueType: visitType(node.valueType));
}
+ visitInstanceCreation(InstanceCreation node) {
+ final Map<Reference, Expression> fieldValues = <Reference, Expression>{};
+ node.fieldValues.forEach((Reference fieldRef, Expression value) {
+ fieldValues[fieldRef] = clone(value);
+ });
+ return new InstanceCreation(
+ node.classReference,
+ node.typeArguments.map(visitType).toList(),
+ fieldValues,
+ node.asserts.map(clone).toList());
+ }
+
visitIsExpression(IsExpression node) {
return new IsExpression(clone(node.operand), visitType(node.type));
}
@@ -264,7 +276,8 @@
}
visitConstantExpression(ConstantExpression node) {
- return new ConstantExpression(visitConstant(node.constant));
+ return new ConstantExpression(
+ visitConstant(node.constant), visitType(node.type));
}
visitStringLiteral(StringLiteral node) {
diff --git a/kernel/lib/import_table.dart b/kernel/lib/import_table.dart
index ae2829c..f549933 100644
--- a/kernel/lib/import_table.dart
+++ b/kernel/lib/import_table.dart
@@ -4,7 +4,6 @@
library kernel.import_table;
import 'ast.dart';
-import 'package:path/path.dart' as path;
abstract class ImportTable {
int getImportIndex(Library library);
@@ -89,12 +88,8 @@
bool isTargetSchemeFileOrCustom = isFileOrCustomScheme(targetUri);
bool isReferenceSchemeFileOrCustom = isFileOrCustomScheme(referenceUri);
if (isTargetSchemeFileOrCustom && isReferenceSchemeFileOrCustom) {
- var targetDirectory = path.dirname(targetUri.path);
- var currentDirectory = path.dirname(referenceUri.path);
- var relativeDirectory =
- path.relative(targetDirectory, from: currentDirectory);
- var filename = path.basename(targetUri.path);
- table.addImport(target, '$relativeDirectory/$filename');
+ String relativeUri = relativeUriPath(targetUri, referenceUri);
+ table.addImport(target, relativeUri);
} else if (isTargetSchemeFileOrCustom) {
// Cannot import a file:URI from a dart:URI or package:URI.
// We may want to remove this restriction, but for now it's just a sanity
@@ -126,3 +121,36 @@
}
}
}
+
+String relativeUriPath(Uri target, Uri ref) {
+ List<String> targetSegments = target.pathSegments;
+ List<String> refSegments = ref.pathSegments;
+ int to = refSegments.length;
+ if (targetSegments.length < to) to = targetSegments.length;
+ to--; // The last entry is the filename, here we compare only directories.
+ int same = -1;
+ for (int i = 0; i < to; i++) {
+ if (targetSegments[i] == refSegments[i]) {
+ same = i;
+ } else {
+ break;
+ }
+ }
+ if (same == targetSegments.length - 2 &&
+ targetSegments.length == refSegments.length) {
+ // Both parts have the same number of segments,
+ // and they agree on all directories.
+ if (targetSegments.last == "") return ".";
+ return targetSegments.last;
+ }
+ List<String> path = new List<String>();
+ int oked = same + 1;
+ while (oked < refSegments.length - 1) {
+ path.add("..");
+ oked++;
+ }
+ path.addAll(targetSegments.skip(same + 1));
+
+ if (path.isEmpty) path.add(".");
+ return path.join("/");
+}
diff --git a/kernel/lib/target/targets.dart b/kernel/lib/target/targets.dart
index 3472254..47521ca 100644
--- a/kernel/lib/target/targets.dart
+++ b/kernel/lib/target/targets.dart
@@ -6,7 +6,6 @@
import '../ast.dart';
import '../class_hierarchy.dart';
import '../core_types.dart';
-import '../transformations/constants.dart' show ConstantsBackend;
final List<String> targetNames = targets.keys.toList();
@@ -33,6 +32,32 @@
{List<C> context});
}
+/// The different kinds of number semantics supported by the constant evaluator.
+enum NumberSemantics {
+ /// Dart VM number semantics.
+ vm,
+
+ /// JavaScript (Dart2js and DDC) number semantics.
+ js,
+}
+
+// Backend specific constant evaluation behavior
+class ConstantsBackend {
+ const ConstantsBackend();
+
+ /// Lowering of a list constant to a backend-specific representation.
+ Constant lowerListConstant(ListConstant constant) => constant;
+
+ /// Lowering of a set constant to a backend-specific representation.
+ Constant lowerSetConstant(SetConstant constant) => constant;
+
+ /// Lowering of a map constant to a backend-specific representation.
+ Constant lowerMapConstant(MapConstant constant) => constant;
+
+ /// Number semantics to use for this backend.
+ NumberSemantics get numberSemantics => NumberSemantics.vm;
+}
+
/// A target provides backend-specific options for generating kernel IR.
abstract class Target {
String get name;
diff --git a/kernel/lib/text/ast_to_text.dart b/kernel/lib/text/ast_to_text.dart
index 29af291..5862b83 100644
--- a/kernel/lib/text/ast_to_text.dart
+++ b/kernel/lib/text/ast_to_text.dart
@@ -477,6 +477,9 @@
}
writeWord('external');
}
+ if (showMetadata) {
+ inner.writeMetadata(library);
+ }
writeAnnotationList(library.annotations);
writeWord('library');
if (library.name != null) {
@@ -1299,6 +1302,39 @@
}
}
+ visitInstanceCreation(InstanceCreation node) {
+ write('${node.classNode}');
+ if (node.typeArguments.isNotEmpty) {
+ writeSymbol('<');
+ writeList(node.typeArguments, writeType);
+ writeSymbol('>');
+ }
+ write(' {');
+ bool first = true;
+ node.fieldValues.forEach((Reference fieldRef, Expression value) {
+ if (!first) {
+ writeComma();
+ }
+ write('${fieldRef.asField.name}: ');
+ writeExpression(value);
+ first = false;
+ });
+ for (AssertStatement assert_ in node.asserts) {
+ if (!first) {
+ writeComma();
+ }
+ write('assert(');
+ writeExpression(assert_.condition);
+ if (assert_.message != null) {
+ writeComma();
+ writeExpression(assert_.message);
+ }
+ write(')');
+ }
+
+ write('}');
+ }
+
visitIsExpression(IsExpression node) {
writeExpression(node.operand, Precedence.BITWISE_OR);
writeSpaced('is');
@@ -2011,10 +2047,10 @@
node.fieldValues.forEach((Reference fieldRef, Constant constant) {
final String name = syntheticNames.nameConstant(constant);
if (!first) {
- first = false;
sb.write(', ');
}
sb.write('${fieldRef.asField.name}: $name');
+ first = false;
});
sb.write('}');
endLine(sb.toString());
diff --git a/kernel/lib/text/text_serialization_verifier.dart b/kernel/lib/text/text_serialization_verifier.dart
index b9f2662..3fed367 100644
--- a/kernel/lib/text/text_serialization_verifier.dart
+++ b/kernel/lib/text/text_serialization_verifier.dart
@@ -390,6 +390,12 @@
}
@override
+ void visitInstanceCreation(InstanceCreation node) {
+ storeLastSeenUriAndOffset(node);
+ node.visitChildren(this);
+ }
+
+ @override
void visitSymbolConstant(SymbolConstant node) {
storeLastSeenUriAndOffset(node);
node.visitChildren(this);
diff --git a/kernel/lib/transformations/async.dart b/kernel/lib/transformations/async.dart
index 31fe3f3..3ea9fe2 100644
--- a/kernel/lib/transformations/async.dart
+++ b/kernel/lib/transformations/async.dart
@@ -90,12 +90,12 @@
/// surrounding context.
Expression rewrite(Expression expression, List<Statement> outer) {
assert(statements.isEmpty);
- assert(nameIndex == 0);
+ var saved = seenAwait;
seenAwait = false;
Expression result = expression.accept(this);
outer.addAll(statements.reversed);
statements.clear();
- nameIndex = 0;
+ seenAwait = seenAwait || saved;
return result;
}
@@ -503,4 +503,42 @@
new RecursiveContinuationRewriter(continuationRewriter.helper);
return node.accept(nestedRewriter);
}
+
+ TreeNode visitBlockExpression(BlockExpression expr) {
+ return transform(expr, () {
+ expr.value = expr.value.accept(this)..parent = expr;
+ List<Statement> body = <Statement>[];
+ for (Statement stmt in expr.body.statements.reversed) {
+ Statement translation = stmt.accept(this);
+ if (translation != null) body.add(translation);
+ }
+ expr.body = new Block(body.reversed.toList())..parent = expr;
+ });
+ }
+
+ TreeNode defaultStatement(Statement stmt) {
+ // This method translates a statement nested in an expression (e.g., in a
+ // block expression). It produces a translated statement, a list of
+ // statements which are side effects necessary for any await, and a flag
+ // indicating whether there was an await in the statement or to its right.
+ // The translated statement can be null in the case where there was already
+ // an await to the right.
+
+ // The translation is accumulating two lists of statements, an inner list
+ // which is a reversed list of effects needed for the current expression and
+ // an outer list which represents the block containing the current
+ // statement. We need to preserve both of those from side effects.
+ List<Statement> savedInner = statements;
+ List<Statement> savedOuter = continuationRewriter.statements;
+ statements = <Statement>[];
+ continuationRewriter.statements = <Statement>[];
+ stmt.accept(continuationRewriter);
+
+ List<Statement> results = continuationRewriter.statements;
+ statements = savedInner;
+ continuationRewriter.statements = savedOuter;
+ if (!seenAwait && results.length == 1) return results.first;
+ statements.addAll(results.reversed);
+ return null;
+ }
}
diff --git a/kernel/lib/transformations/constants.dart b/kernel/lib/transformations/constants.dart
deleted file mode 100644
index e7c77df..0000000
--- a/kernel/lib/transformations/constants.dart
+++ /dev/null
@@ -1,1904 +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.
-
-/// This library implements a kernel2kernel constant evaluation transformation.
-///
-/// Even though it is expected that the frontend does not emit kernel AST which
-/// contains compile-time errors, this transformation still performs some
-/// valiation and throws a [ConstantEvaluationError] if there was a compile-time
-/// errors.
-///
-/// Due to the lack information which is is only available in the front-end,
-/// this validation is incomplete (e.g. whether an integer literal used the
-/// hexadecimal syntax or not).
-///
-/// Furthermore due to the lowering of certain constructs in the front-end
-/// (e.g. '??') we need to support a super-set of the normal constant expression
-/// language. Issue(http://dartbug.com/31799)
-library kernel.transformations.constants;
-
-import 'dart:io' as io;
-
-import '../ast.dart';
-import '../class_hierarchy.dart';
-import '../clone.dart';
-import '../core_types.dart';
-import '../kernel.dart';
-import '../type_algebra.dart';
-import '../type_environment.dart';
-
-Component transformComponent(Component component, ConstantsBackend backend,
- Map<String, String> environmentDefines, ErrorReporter errorReporter,
- {bool keepFields: false,
- bool enableAsserts: false,
- bool evaluateAnnotations: true,
- CoreTypes coreTypes,
- ClassHierarchy hierarchy}) {
- coreTypes ??= new CoreTypes(component);
- hierarchy ??= new ClassHierarchy(component);
-
- final typeEnvironment = new TypeEnvironment(coreTypes, hierarchy);
-
- transformLibraries(component.libraries, backend, environmentDefines,
- typeEnvironment, errorReporter,
- keepFields: keepFields,
- enableAsserts: enableAsserts,
- evaluateAnnotations: evaluateAnnotations);
- return component;
-}
-
-void transformLibraries(
- List<Library> libraries,
- ConstantsBackend backend,
- Map<String, String> environmentDefines,
- TypeEnvironment typeEnvironment,
- ErrorReporter errorReporter,
- {bool keepFields: false,
- bool keepVariables: false,
- bool evaluateAnnotations: true,
- bool enableAsserts: false}) {
- final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
- backend,
- environmentDefines,
- keepFields,
- keepVariables,
- evaluateAnnotations,
- typeEnvironment,
- enableAsserts,
- errorReporter);
- for (final Library library in libraries) {
- constantsTransformer.convertLibrary(library);
- }
-}
-
-class ConstantsTransformer extends Transformer {
- final ConstantEvaluator constantEvaluator;
- final TypeEnvironment typeEnvironment;
-
- /// Whether to preserve constant [Field]s. All use-sites will be rewritten.
- final bool keepFields;
- final bool keepVariables;
- final bool evaluateAnnotations;
-
- ConstantsTransformer(
- ConstantsBackend backend,
- Map<String, String> environmentDefines,
- this.keepFields,
- this.keepVariables,
- this.evaluateAnnotations,
- this.typeEnvironment,
- bool enableAsserts,
- ErrorReporter errorReporter)
- : constantEvaluator = new ConstantEvaluator(backend, environmentDefines,
- typeEnvironment, enableAsserts, errorReporter);
-
- // Transform the library/class members:
-
- void convertLibrary(Library library) {
- transformAnnotations(library.annotations, library);
-
- transformList(library.dependencies, this, library);
- transformList(library.parts, this, library);
- transformList(library.typedefs, this, library);
- transformList(library.classes, this, library);
- transformList(library.procedures, this, library);
- transformList(library.fields, this, library);
-
- if (!keepFields) {
- // The transformer API does not iterate over `Library.additionalExports`,
- // so we manually delete the references to shaken nodes.
- library.additionalExports.removeWhere((Reference reference) {
- return reference.canonicalName == null;
- });
- }
- }
-
- visitLibraryPart(LibraryPart node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- });
- return node;
- }
-
- visitLibraryDependency(LibraryDependency node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- });
- return node;
- }
-
- visitClass(Class node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- transformList(node.fields, this, node);
- transformList(node.typeParameters, this, node);
- transformList(node.constructors, this, node);
- transformList(node.procedures, this, node);
- transformList(node.redirectingFactoryConstructors, this, node);
- });
- return node;
- }
-
- visitProcedure(Procedure node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- node.function = node.function.accept(this)..parent = node;
- });
- return node;
- }
-
- visitConstructor(Constructor node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- transformList(node.initializers, this, node);
- node.function = node.function.accept(this)..parent = node;
- });
- return node;
- }
-
- visitTypedef(Typedef node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- transformList(node.typeParameters, this, node);
- transformList(node.typeParametersOfFunctionType, this, node);
- transformList(node.positionalParameters, this, node);
- transformList(node.namedParameters, this, node);
- });
- return node;
- }
-
- visitRedirectingFactoryConstructor(RedirectingFactoryConstructor node) {
- constantEvaluator.withNewEnvironment(() {
- transformAnnotations(node.annotations, node);
- transformList(node.typeParameters, this, node);
- transformList(node.positionalParameters, this, node);
- transformList(node.namedParameters, this, node);
- });
- return node;
- }
-
- visitTypeParameter(TypeParameter node) {
- transformAnnotations(node.annotations, node);
- return node;
- }
-
- void transformAnnotations(List<Expression> nodes, TreeNode parent) {
- if (evaluateAnnotations && nodes.length > 0) {
- transformExpressions(nodes, parent);
- }
- }
-
- void transformExpressions(List<Expression> nodes, TreeNode parent) {
- constantEvaluator.withNewEnvironment(() {
- for (int i = 0; i < nodes.length; ++i) {
- nodes[i] = tryEvaluateAndTransformWithContext(parent, nodes[i])
- ..parent = parent;
- }
- });
- }
-
- // Handle definition of constants:
-
- visitFunctionNode(FunctionNode node) {
- final positionalParameterCount = node.positionalParameters.length;
- for (int i = 0; i < positionalParameterCount; ++i) {
- final VariableDeclaration variable = node.positionalParameters[i];
- transformAnnotations(variable.annotations, variable);
- if (variable.initializer != null) {
- variable.initializer =
- tryEvaluateAndTransformWithContext(variable, variable.initializer)
- ..parent = node;
- }
- }
- for (final VariableDeclaration variable in node.namedParameters) {
- transformAnnotations(variable.annotations, variable);
- if (variable.initializer != null) {
- variable.initializer =
- tryEvaluateAndTransformWithContext(variable, variable.initializer)
- ..parent = node;
- }
- }
- if (node.body != null) {
- node.body = node.body.accept(this)..parent = node;
- }
- return node;
- }
-
- visitVariableDeclaration(VariableDeclaration node) {
- transformAnnotations(node.annotations, node);
-
- if (node.initializer != null) {
- if (node.isConst) {
- final Constant constant =
- tryEvaluateWithContext(node, node.initializer);
-
- // If there was a constant evaluation error we will not continue and
- // simply keep the old [node].
- if (constant != null) {
- constantEvaluator.env.addVariableValue(node, constant);
-
- if (keepVariables) {
- // So the value of the variable is still available for debugging
- // purposes we convert the constant variable to be a final variable
- // initialized to the evaluated constant expression.
- node.initializer = new ConstantExpression(constant)..parent = node;
- node.isFinal = true;
- node.isConst = false;
- } else {
- // Since we convert all use-sites of constants, the constant
- // [VariableDeclaration] is unused and we'll therefore remove it.
- return null;
- }
- }
- } else {
- node.initializer = node.initializer.accept(this)..parent = node;
- }
- }
- return node;
- }
-
- visitField(Field node) {
- return constantEvaluator.withNewEnvironment(() {
- if (node.isConst) {
- // Since we convert all use-sites of constants, the constant [Field]
- // cannot be referenced anymore. We therefore get rid of it if
- // [keepFields] was not specified.
- if (!keepFields) {
- return null;
- }
-
- // Otherwise we keep the constant [Field] and convert it's initializer.
- transformAnnotations(node.annotations, node);
- if (node.initializer != null) {
- node.initializer =
- tryEvaluateAndTransformWithContext(node, node.initializer)
- ..parent = node;
- }
- } else {
- transformAnnotations(node.annotations, node);
- if (node.initializer != null) {
- node.initializer = node.initializer.accept(this)..parent = node;
- }
- }
- return node;
- });
- }
-
- // Handle use-sites of constants (and "inline" constant expressions):
-
- visitSymbolLiteral(SymbolLiteral node) {
- return new ConstantExpression(constantEvaluator.evaluate(node));
- }
-
- visitStaticGet(StaticGet node) {
- final Member target = node.target;
- if (target is Field && target.isConst) {
- final Constant constant =
- tryEvaluateWithContext(node, target.initializer);
- return constant != null ? new ConstantExpression(constant) : node;
- } else if (target is Procedure && target.kind == ProcedureKind.Method) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitStaticGet(node);
- }
-
- visitSwitchCase(SwitchCase node) {
- transformExpressions(node.expressions, node);
- return super.visitSwitchCase(node);
- }
-
- visitVariableGet(VariableGet node) {
- if (node.variable.isConst) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitVariableGet(node);
- }
-
- visitListLiteral(ListLiteral node) {
- if (node.isConst) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitListLiteral(node);
- }
-
- visitMapLiteral(MapLiteral node) {
- if (node.isConst) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitMapLiteral(node);
- }
-
- visitConstructorInvocation(ConstructorInvocation node) {
- if (node.isConst) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitConstructorInvocation(node);
- }
-
- visitStaticInvocation(StaticInvocation node) {
- if (node.isConst) {
- return tryEvaluateAndTransformWithContext(node, node);
- }
- return super.visitStaticInvocation(node);
- }
-
- visitConstantExpression(ConstantExpression node) {
- Constant constant = node.constant;
- if (constant is UnevaluatedConstant) {
- Expression expression = constant.expression;
- return tryEvaluateAndTransformWithContext(expression, expression);
- } else {
- node.constant = constantEvaluator.canonicalize(constant);
- return node;
- }
- }
-
- tryEvaluateAndTransformWithContext(TreeNode treeContext, Expression node) {
- final Constant constant = tryEvaluateWithContext(treeContext, node);
- return constant != null ? new ConstantExpression(constant) : node;
- }
-
- tryEvaluateWithContext(TreeNode treeContext, Expression node) {
- if (treeContext == node) {
- return constantEvaluator.evaluate(node);
- }
-
- return constantEvaluator.runInsideContext(treeContext, () {
- return constantEvaluator.evaluate(node);
- });
- }
-}
-
-class ConstantEvaluator extends RecursiveVisitor {
- final ConstantsBackend backend;
- final NumberSemantics numberSemantics;
- Map<String, String> environmentDefines;
- final CoreTypes coreTypes;
- final TypeEnvironment typeEnvironment;
- final bool enableAsserts;
- final ErrorReporter errorReporter;
-
- final isInstantiated = new IsInstantiatedVisitor().isInstantiated;
-
- final Map<Constant, Constant> canonicalizationCache;
- final Map<Node, Object> nodeCache;
- final CloneVisitor cloner = new CloneVisitor();
-
- final NullConstant nullConstant = new NullConstant();
- final BoolConstant trueConstant = new BoolConstant(true);
- final BoolConstant falseConstant = new BoolConstant(false);
-
- final List<TreeNode> contextChain = [];
-
- InstanceBuilder instanceBuilder;
- EvaluationEnvironment env;
- Expression evaluationRoot;
- Set<TreeNode> unevaluatedNodes;
- Set<Expression> replacementNodes;
-
- bool get targetingJavaScript => numberSemantics == NumberSemantics.js;
-
- ConstantEvaluator(this.backend, this.environmentDefines, this.typeEnvironment,
- this.enableAsserts, this.errorReporter)
- : numberSemantics = backend.numberSemantics,
- coreTypes = typeEnvironment.coreTypes,
- canonicalizationCache = <Constant, Constant>{},
- nodeCache = <Node, Constant>{},
- env = new EvaluationEnvironment();
-
- /// Evaluates [node] and possibly cache the evaluation result.
- Constant evaluate(Expression node) {
- evaluationRoot = node;
- try {
- return _evaluateSubexpression(node);
- } on _AbortCurrentEvaluation catch (e) {
- return new UnevaluatedConstant(new InvalidExpression(e.message));
- } finally {
- // Release collections used to keep track of unevaluated nodes.
- evaluationRoot = null;
- unevaluatedNodes = null;
- replacementNodes = null;
- }
- }
-
- /// Produce an unevaluated constant node for an expression.
- /// Mark all ancestors (up to the root of the constant evaluation) to
- /// indicate that they should also be unevaluated.
- Constant unevaluated(Expression original, Expression replacement) {
- assert(evaluationRoot != null);
- replacement.fileOffset = original.fileOffset;
- unevaluatedNodes ??= new Set<TreeNode>.identity();
- TreeNode mark = original;
- while (unevaluatedNodes.add(mark)) {
- if (identical(mark, evaluationRoot)) break;
- mark = mark.parent;
- }
- return new UnevaluatedConstant(replacement);
- }
-
- /// Called whenever an expression is extracted from an unevaluated constant
- /// to become part of the expression tree of another unevaluated constant.
- /// Makes sure a particular expression occurs only once in the tree by
- /// cloning further instances.
- Expression unique(Expression expression) {
- replacementNodes ??= new Set<Expression>.identity();
- if (!replacementNodes.add(expression)) {
- expression = cloner.clone(expression);
- replacementNodes.add(expression);
- }
- return expression;
- }
-
- /// Should this node become unevaluated because of an unevaluated child?
- bool hasUnevaluatedChild(TreeNode node) {
- return unevaluatedNodes != null && unevaluatedNodes.contains(node);
- }
-
- /// Evaluates [node] and possibly cache the evaluation result.
- /// @throws _AbortCurrentEvaluation if expression can't be evaluated.
- Constant _evaluateSubexpression(Expression node) {
- if (node == null) return nullConstant;
- if (env.isEmpty) {
- // We only try to evaluate the same [node] *once* within an empty
- // environment.
- if (nodeCache.containsKey(node)) {
- final Constant constant = nodeCache[node];
- if (constant == null)
- throw new _AbortCurrentEvaluation(
- errorReporter.circularity(contextChain, node));
- return constant;
- }
-
- nodeCache[node] = null;
- return nodeCache[node] = node.accept(this);
- }
- return node.accept(this);
- }
-
- Constant runInsideContext(TreeNode node, Constant fun()) {
- try {
- pushContext(node);
- return fun();
- } finally {
- popContext(node);
- }
- }
-
- Constant runInsideContextIfNoContext(TreeNode node, Constant fun()) {
- if (contextChain.isEmpty) {
- return runInsideContext(node, fun);
- } else {
- return fun();
- }
- }
-
- pushContext(TreeNode contextNode) {
- contextChain.add(contextNode);
- }
-
- popContext(TreeNode contextNode) {
- assert(contextChain.last == contextNode);
- contextChain.length = contextChain.length - 1;
- }
-
- defaultTreeNode(Node node) {
- // Only a subset of the expression language is valid for constant
- // evaluation.
- throw 'Constant evaluation has no support for ${node.runtimeType} yet!';
- }
-
- visitNullLiteral(NullLiteral node) => nullConstant;
-
- visitBoolLiteral(BoolLiteral node) {
- return node.value ? trueConstant : falseConstant;
- }
-
- visitIntLiteral(IntLiteral node) {
- // The frontend will ensure the integer literals are in signed 64-bit
- // range.
- return canonicalize(new IntConstant(node.value));
- }
-
- visitDoubleLiteral(DoubleLiteral node) {
- return canonicalize(makeDoubleConstant(node.value));
- }
-
- visitStringLiteral(StringLiteral node) {
- return canonicalize(new StringConstant(node.value));
- }
-
- visitTypeLiteral(TypeLiteral node) {
- final DartType type = evaluateDartType(node, node.type);
- return canonicalize(new TypeLiteralConstant(type));
- }
-
- visitConstantExpression(ConstantExpression node) {
- // If there were already constants in the AST then we make sure we
- // re-canonicalize them. After running the transformer we will therefore
- // have a fully-canonicalized constant DAG with roots coming from the
- // [ConstantExpression] nodes in the AST.
- return canonicalize(node.constant);
- }
-
- visitListLiteral(ListLiteral node) {
- if (!node.isConst) {
- throw new _AbortCurrentEvaluation(
- errorReporter.nonConstLiteral(contextChain, node, 'List'));
- }
- final List<Constant> entries = new List<Constant>(node.expressions.length);
- for (int i = 0; i < node.expressions.length; ++i) {
- entries[i] = _evaluateSubexpression(node.expressions[i]);
- }
- if (hasUnevaluatedChild(node)) {
- final expressions = new List<Expression>(node.expressions.length);
- for (int i = 0; i < node.expressions.length; ++i) {
- expressions[i] = unique(entries[i].asExpression());
- }
- return unevaluated(
- node,
- new ListLiteral(expressions,
- typeArgument: node.typeArgument, isConst: true));
- }
- final DartType typeArgument = evaluateDartType(node, node.typeArgument);
- return canonicalize(
- backend.lowerListConstant(new ListConstant(typeArgument, entries)));
- }
-
- visitSetLiteral(SetLiteral node) {
- if (!node.isConst) {
- throw new _AbortCurrentEvaluation(
- errorReporter.nonConstLiteral(contextChain, node, 'Set'));
- }
- final List<Constant> entries = new List<Constant>(node.expressions.length);
- for (int i = 0; i < node.expressions.length; ++i) {
- entries[i] = _evaluateSubexpression(node.expressions[i]);
- }
- if (hasUnevaluatedChild(node)) {
- final expressions = new List<Expression>(node.expressions.length);
- for (int i = 0; i < node.expressions.length; ++i) {
- expressions[i] = unique(entries[i].asExpression());
- }
- return unevaluated(
- node,
- new SetLiteral(expressions,
- typeArgument: node.typeArgument, isConst: true));
- }
- final DartType typeArgument = evaluateDartType(node, node.typeArgument);
- return canonicalize(
- backend.lowerSetConstant(new SetConstant(typeArgument, entries)));
- }
-
- visitMapLiteral(MapLiteral node) {
- if (!node.isConst) {
- throw new _AbortCurrentEvaluation(
- errorReporter.nonConstLiteral(contextChain, node, 'Map'));
- }
- final Set<Constant> usedKeys = new Set<Constant>();
- final List<ConstantMapEntry> entries =
- new List<ConstantMapEntry>(node.entries.length);
- for (int i = 0; i < node.entries.length; ++i) {
- final key = _evaluateSubexpression(node.entries[i].key);
- final value = _evaluateSubexpression(node.entries[i].value);
- if (!usedKeys.add(key)) {
- // TODO(kustermann): We should change the context handling from just
- // capturing the `TreeNode`s to a `(TreeNode, String message)` tuple and
- // report where the first key with the same value was.
- throw new _AbortCurrentEvaluation(
- errorReporter.duplicateKey(contextChain, node.entries[i], key));
- }
- entries[i] = new ConstantMapEntry(key, value);
- }
- if (hasUnevaluatedChild(node)) {
- final mapEntries = new List<MapEntry>(node.entries.length);
- for (int i = 0; i < node.entries.length; ++i) {
- mapEntries[i] = new MapEntry(unique(entries[i].key.asExpression()),
- unique(entries[i].value.asExpression()));
- }
- return unevaluated(
- node,
- new MapLiteral(mapEntries,
- keyType: node.keyType, valueType: node.valueType, isConst: true));
- }
- final DartType keyType = evaluateDartType(node, node.keyType);
- final DartType valueType = evaluateDartType(node, node.valueType);
- return canonicalize(
- backend.lowerMapConstant(new MapConstant(keyType, valueType, entries)));
- }
-
- visitFunctionExpression(FunctionExpression node) {
- throw new _AbortCurrentEvaluation(
- errorReporter.nonConstLiteral(contextChain, node, 'Function'));
- }
-
- visitConstructorInvocation(ConstructorInvocation node) {
- final Constructor constructor = node.target;
- final Class klass = constructor.enclosingClass;
- if (!constructor.isConst) {
- throw 'The front-end should ensure we do not encounter a '
- 'constructor invocation of a non-const constructor.';
- }
- if (constructor.function.body != null &&
- constructor.function.body is! EmptyStatement) {
- throw 'Constructor "$node" has non-trivial body "${constructor.function.body.runtimeType}".';
- }
- if (klass.isAbstract) {
- throw 'Constructor "$node" belongs to abstract class "${klass}".';
- }
-
- final positionals = evaluatePositionalArguments(node.arguments);
- final named = evaluateNamedArguments(node.arguments);
-
- // Is the constructor unavailable due to separate compilation?
- bool isUnavailable = constructor.isInExternalLibrary &&
- constructor.initializers.isEmpty &&
- constructor.enclosingClass.supertype != null;
-
- if (isUnavailable || hasUnevaluatedChild(node)) {
- return unevaluated(
- node,
- new ConstructorInvocation(constructor,
- unevaluatedArguments(positionals, named, node.arguments.types),
- isConst: true));
- }
-
- final typeArguments = evaluateTypeArguments(node, node.arguments);
-
- // Fill in any missing type arguments with "dynamic".
- for (int i = typeArguments.length; i < klass.typeParameters.length; i++) {
- typeArguments.add(const DynamicType());
- }
-
- // Start building a new instance.
- return withNewInstanceBuilder(klass, typeArguments, () {
- return runInsideContextIfNoContext(node, () {
- // "Run" the constructor (and any super constructor calls), which will
- // initialize the fields of the new instance.
- handleConstructorInvocation(
- constructor, typeArguments, positionals, named);
- final InstanceConstant result = instanceBuilder.buildInstance();
-
- // Special case the dart:core's Symbol class here and convert it to a
- // [SymbolConstant]. For invalid values we report a compile-time error.
- if (result.classNode == coreTypes.internalSymbolClass) {
- // The dart:_internal's Symbol class has only the name field.
- assert(coreTypes.internalSymbolClass.fields
- .where((f) => !f.isStatic)
- .length ==
- 1);
- final nameValue = result.fieldValues.values.single;
-
- if (nameValue is StringConstant &&
- isValidSymbolName(nameValue.value)) {
- return canonicalize(new SymbolConstant(nameValue.value, null));
- }
- throw new _AbortCurrentEvaluation(errorReporter.invalidSymbolName(
- contextChain, node.arguments.positional.first, nameValue));
- }
-
- return canonicalize(result);
- });
- });
- }
-
- bool isValidSymbolName(String name) {
- // See https://api.dartlang.org/stable/2.0.0/dart-core/Symbol/Symbol.html:
- //
- // A qualified name is a valid name preceded by a public identifier name and
- // a '.', e.g., foo.bar.baz= is a qualified version of baz=.
- //
- // That means that the content of the name String must be either
- // - a valid public Dart identifier (that is, an identifier not
- // starting with "_"),
- // - such an identifier followed by "=" (a setter name),
- // - the name of a declarable operator,
- // - any of the above preceded by any number of qualifiers, where a
- // qualifier is a non-private identifier followed by '.',
- // - or the empty string (the default name of a library with no library
- // name declaration).
-
- const operatorNames = const <String>[
- '+',
- '-',
- '*',
- '/',
- '%',
- '~/',
- '&',
- '|',
- '^',
- '~',
- '<<',
- '>>',
- '<',
- '<=',
- '>',
- '>=',
- '==',
- '[]',
- '[]=',
- 'unary-'
- ];
-
- if (name == null) return false;
- if (name == '') return true;
-
- final parts = name.split('.');
-
- // Each qualifier must be a public identifier.
- for (int i = 0; i < parts.length - 1; ++i) {
- if (!isValidPublicIdentifier(parts[i])) return false;
- }
-
- String last = parts.last;
- if (operatorNames.contains(last)) {
- return true;
- }
- if (last.endsWith('=')) {
- last = last.substring(0, last.length - 1);
- }
- if (!isValidPublicIdentifier(last)) return false;
-
- return true;
- }
-
- /// From the Dart Language specification:
- ///
- /// IDENTIFIER:
- /// IDENTIFIER_START IDENTIFIER_PART*
- ///
- /// IDENTIFIER_START:
- /// IDENTIFIER_START_NO_DOLLAR | ‘$’
- ///
- /// IDENTIFIER_PART:
- /// IDENTIFIER_START | DIGIT
- ///
- /// IDENTIFIER_NO_DOLLAR:
- /// IDENTIFIER_START_NO_DOLLAR IDENTIFIER_PART_NO_DOLLAR*
- ///
- /// IDENTIFIER_START_NO_DOLLAR:
- /// LETTER | '_'
- ///
- /// IDENTIFIER_PART_NO_DOLLAR:
- /// IDENTIFIER_START_NO_DOLLAR | DIGIT
- ///
- static final publicIdentifierRegExp =
- new RegExp(r'^[a-zA-Z$][a-zA-Z0-9_$]*$');
-
- static const nonUsableKeywords = const <String>[
- 'assert',
- 'break',
- 'case',
- 'catch',
- 'class',
- 'const',
- 'continue',
- 'default',
- 'do',
- 'else',
- 'enum',
- 'extends',
- 'false',
- 'final',
- 'finally',
- 'for',
- 'if',
- 'in',
- 'is',
- 'new',
- 'null',
- 'rethrow',
- 'return',
- 'super',
- 'switch',
- 'this',
- 'throw',
- 'true',
- 'try',
- 'var',
- 'while',
- 'with',
- ];
-
- bool isValidPublicIdentifier(String name) {
- return publicIdentifierRegExp.hasMatch(name) &&
- !nonUsableKeywords.contains(name);
- }
-
- handleConstructorInvocation(
- Constructor constructor,
- List<DartType> typeArguments,
- List<Constant> positionalArguments,
- Map<String, Constant> namedArguments) {
- return runInsideContext(constructor, () {
- return withNewEnvironment(() {
- final Class klass = constructor.enclosingClass;
- final FunctionNode function = constructor.function;
-
- // We simulate now the constructor invocation.
-
- // Step 1) Map type arguments and normal arguments from caller to callee.
- for (int i = 0; i < klass.typeParameters.length; i++) {
- env.addTypeParameterValue(klass.typeParameters[i], typeArguments[i]);
- }
- for (int i = 0; i < function.positionalParameters.length; i++) {
- final VariableDeclaration parameter =
- function.positionalParameters[i];
- final Constant value = (i < positionalArguments.length)
- ? positionalArguments[i]
- : _evaluateSubexpression(parameter.initializer);
- env.addVariableValue(parameter, value);
- }
- for (final VariableDeclaration parameter in function.namedParameters) {
- final Constant value = namedArguments[parameter.name] ??
- _evaluateSubexpression(parameter.initializer);
- env.addVariableValue(parameter, value);
- }
-
- // Step 2) Run all initializers (including super calls) with environment setup.
- for (final Field field in klass.fields) {
- if (!field.isStatic) {
- instanceBuilder.setFieldValue(
- field, _evaluateSubexpression(field.initializer));
- }
- }
- for (final Initializer init in constructor.initializers) {
- if (init is FieldInitializer) {
- instanceBuilder.setFieldValue(
- init.field, _evaluateSubexpression(init.value));
- } else if (init is LocalInitializer) {
- final VariableDeclaration variable = init.variable;
- env.addVariableValue(
- variable, _evaluateSubexpression(variable.initializer));
- } else if (init is SuperInitializer) {
- handleConstructorInvocation(
- init.target,
- evaluateSuperTypeArguments(
- init, constructor.enclosingClass.supertype),
- evaluatePositionalArguments(init.arguments),
- evaluateNamedArguments(init.arguments));
- } else if (init is RedirectingInitializer) {
- // Since a redirecting constructor targets a constructor of the same
- // class, we pass the same [typeArguments].
- handleConstructorInvocation(
- init.target,
- typeArguments,
- evaluatePositionalArguments(init.arguments),
- evaluateNamedArguments(init.arguments));
- } else if (init is AssertInitializer) {
- if (enableAsserts) {
- final Constant condition =
- _evaluateSubexpression(init.statement.condition);
-
- if (condition is BoolConstant) {
- if (!condition.value) {
- if (init.statement.message == null) {
- throw new _AbortCurrentEvaluation(
- errorReporter.failedAssertion(
- contextChain, init.statement.condition, null));
- }
- final Constant message =
- _evaluateSubexpression(init.statement.message);
- if (message is StringConstant) {
- throw new _AbortCurrentEvaluation(
- errorReporter.failedAssertion(contextChain,
- init.statement.condition, message.value));
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidDartType(
- contextChain,
- init.statement.message,
- message,
- typeEnvironment.stringType));
- }
- } else {
- throw new _AbortCurrentEvaluation(errorReporter.invalidDartType(
- contextChain,
- init.statement.condition,
- condition,
- typeEnvironment.boolType));
- }
- }
- } else {
- throw new Exception(
- 'No support for handling initializer of type "${init.runtimeType}".');
- }
- }
- });
- });
- }
-
- visitInvalidExpression(InvalidExpression node) {
- throw new _AbortCurrentEvaluation(node.message);
- }
-
- visitMethodInvocation(MethodInvocation node) {
- // We have no support for generic method invocation atm.
- assert(node.arguments.named.isEmpty);
-
- final Constant receiver = _evaluateSubexpression(node.receiver);
- final List<Constant> arguments =
- evaluatePositionalArguments(node.arguments);
-
- if (hasUnevaluatedChild(node)) {
- return unevaluated(
- node,
- new MethodInvocation(unique(receiver.asExpression()), node.name,
- unevaluatedArguments(arguments, {}, node.arguments.types)));
- }
-
- // TODO(http://dartbug.com/31799): Ensure we only invoke ==/!= on
- // null/bool/int/double/String objects.
-
- // Handle == and != first (it's common between all types).
- if (arguments.length == 1 && node.name.name == '==') {
- final right = arguments[0];
- return receiver == right ? trueConstant : falseConstant;
- }
- if (arguments.length == 1 && node.name.name == '!=') {
- final right = arguments[0];
- return receiver != right ? trueConstant : falseConstant;
- }
-
- // This is a white-listed set of methods we need to support on constants.
- if (receiver is StringConstant) {
- if (arguments.length == 1) {
- switch (node.name.name) {
- case '+':
- final Constant other = arguments[0];
- if (other is StringConstant) {
- return canonicalize(
- new StringConstant(receiver.value + other.value));
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidBinaryOperandType(
- contextChain,
- node,
- receiver,
- '+',
- typeEnvironment.stringType,
- other.getType(typeEnvironment)));
- }
- }
- } else if (receiver is IntConstant) {
- if (arguments.length == 0) {
- switch (node.name.name) {
- case 'unary-':
- return canonicalize(new IntConstant(-receiver.value));
- case '~':
- return canonicalize(new IntConstant(~receiver.value));
- }
- } else if (arguments.length == 1) {
- final Constant other = arguments[0];
- final op = node.name.name;
- if (other is IntConstant) {
- if ((op == '<<' || op == '>>') && other.value < 0) {
- throw new _AbortCurrentEvaluation(errorReporter.negativeShift(
- contextChain,
- node.arguments.positional.first,
- receiver,
- op,
- other));
- }
- switch (op) {
- case '|':
- return canonicalize(
- new IntConstant(receiver.value | other.value));
- case '&':
- return canonicalize(
- new IntConstant(receiver.value & other.value));
- case '^':
- return canonicalize(
- new IntConstant(receiver.value ^ other.value));
- case '<<':
- return canonicalize(
- new IntConstant(receiver.value << other.value));
- case '>>':
- return canonicalize(
- new IntConstant(receiver.value >> other.value));
- }
- }
-
- if (other is IntConstant) {
- if (other.value == 0 && (op == '%' || op == '~/')) {
- throw new _AbortCurrentEvaluation(errorReporter.zeroDivisor(
- contextChain, node.arguments.positional.first, receiver, op));
- }
-
- return evaluateBinaryNumericOperation(
- node.name.name, receiver.value, other.value, node);
- } else if (other is DoubleConstant) {
- return evaluateBinaryNumericOperation(
- node.name.name, receiver.value, other.value, node);
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidBinaryOperandType(
- contextChain,
- node,
- receiver,
- '${node.name.name}',
- typeEnvironment.numType,
- other.getType(typeEnvironment)));
- }
- } else if (receiver is DoubleConstant) {
- if (arguments.length == 0) {
- switch (node.name.name) {
- case 'unary-':
- return canonicalize(makeDoubleConstant(-receiver.value));
- }
- } else if (arguments.length == 1) {
- final Constant other = arguments[0];
-
- if (other is IntConstant || other is DoubleConstant) {
- final num value = (other is IntConstant)
- ? other.value
- : (other as DoubleConstant).value;
- return evaluateBinaryNumericOperation(
- node.name.name, receiver.value, value, node);
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidBinaryOperandType(
- contextChain,
- node,
- receiver,
- '${node.name.name}',
- typeEnvironment.numType,
- other.getType(typeEnvironment)));
- }
- }
- throw new _AbortCurrentEvaluation(errorReporter.invalidMethodInvocation(
- contextChain, node, receiver, node.name.name));
- }
-
- visitLogicalExpression(LogicalExpression node) {
- final Constant left = _evaluateSubexpression(node.left);
- if (left is UnevaluatedConstant) {
- return unevaluated(
- node,
- new LogicalExpression(unique(left.expression), node.operator,
- cloner.clone(node.right)));
- }
- switch (node.operator) {
- case '||':
- if (left is BoolConstant) {
- if (left.value) return trueConstant;
-
- final Constant right = _evaluateSubexpression(node.right);
- if (right is BoolConstant || right is UnevaluatedConstant) {
- return right;
- }
-
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidBinaryOperandType(
- contextChain,
- node,
- left,
- '${node.operator}',
- typeEnvironment.boolType,
- right.getType(typeEnvironment)));
- }
- throw new _AbortCurrentEvaluation(errorReporter.invalidMethodInvocation(
- contextChain, node, left, '${node.operator}'));
- case '&&':
- if (left is BoolConstant) {
- if (!left.value) return falseConstant;
-
- final Constant right = _evaluateSubexpression(node.right);
- if (right is BoolConstant || right is UnevaluatedConstant) {
- return right;
- }
-
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidBinaryOperandType(
- contextChain,
- node,
- left,
- '${node.operator}',
- typeEnvironment.boolType,
- right.getType(typeEnvironment)));
- }
- throw new _AbortCurrentEvaluation(errorReporter.invalidMethodInvocation(
- contextChain, node, left, '${node.operator}'));
- case '??':
- return (left is! NullConstant)
- ? left
- : _evaluateSubexpression(node.right);
- default:
- throw new _AbortCurrentEvaluation(errorReporter.invalidMethodInvocation(
- contextChain, node, left, '${node.operator}'));
- }
- }
-
- visitConditionalExpression(ConditionalExpression node) {
- final Constant condition = _evaluateSubexpression(node.condition);
- if (condition == trueConstant) {
- return _evaluateSubexpression(node.then);
- } else if (condition == falseConstant) {
- return _evaluateSubexpression(node.otherwise);
- } else if (condition is UnevaluatedConstant) {
- return unevaluated(
- node,
- new ConditionalExpression(
- unique(condition.expression),
- cloner.clone(node.then),
- cloner.clone(node.otherwise),
- node.staticType));
- } else {
- throw new _AbortCurrentEvaluation(errorReporter.invalidDartType(
- contextChain, node, condition, typeEnvironment.boolType));
- }
- }
-
- visitPropertyGet(PropertyGet node) {
- if (node.receiver is ThisExpression) {
- // Access "this" during instance creation.
- for (final Field field in instanceBuilder.fields.keys) {
- if (field.name == node.name) {
- return instanceBuilder.fields[field];
- }
- }
- throw 'Could not evaluate field get ${node.name} on incomplete instance';
- }
-
- final Constant receiver = _evaluateSubexpression(node.receiver);
- if (receiver is StringConstant && node.name.name == 'length') {
- return canonicalize(new IntConstant(receiver.value.length));
- } else if (receiver is InstanceConstant) {
- for (final Reference fieldRef in receiver.fieldValues.keys) {
- if (fieldRef.asField.name == node.name) {
- return receiver.fieldValues[fieldRef];
- }
- }
- } else if (receiver is UnevaluatedConstant) {
- return unevaluated(
- node,
- new PropertyGet(
- unique(receiver.expression), node.name, node.interfaceTarget));
- }
- throw 'Could not evaluate property get on $receiver.';
- }
-
- visitLet(Let node) {
- env.addVariableValue(
- node.variable, _evaluateSubexpression(node.variable.initializer));
- return _evaluateSubexpression(node.body);
- }
-
- visitVariableGet(VariableGet node) {
- // Not every variable which a [VariableGet] refers to must be marked as
- // constant. For example function parameters as well as constructs
- // desugared to [Let] expressions are ok.
- //
- // TODO(kustermann): The heuristic of allowing all [VariableGet]s on [Let]
- // variables might allow more than it should.
- final VariableDeclaration variable = node.variable;
- if (variable.parent is Let || _isFormalParameter(variable)) {
- final Constant constant = env.lookupVariable(node.variable);
- if (constant == null) {
- throw new _AbortCurrentEvaluation(errorReporter.nonConstantVariableGet(
- contextChain, node, variable.name));
- }
- return constant;
- }
- if (variable.isConst) {
- return _evaluateSubexpression(variable.initializer);
- }
- throw new Exception('The front-end should ensure we do not encounter a '
- 'variable get of a non-const variable.');
- }
-
- visitStaticGet(StaticGet node) {
- return withNewEnvironment(() {
- final Member target = node.target;
- if (target is Field) {
- if (target.isConst) {
- if (target.isInExternalLibrary && target.initializer == null) {
- // The variable is unavailable due to separate compilation.
- return unevaluated(node, new StaticGet(target));
- }
- return runInsideContext(target, () {
- return _evaluateSubexpression(target.initializer);
- });
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidStaticInvocation(contextChain, node, target));
- } else if (target is Procedure) {
- if (target.kind == ProcedureKind.Method) {
- return canonicalize(new TearOffConstant(target));
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidStaticInvocation(contextChain, node, target));
- } else {
- throw new Exception(
- 'No support for ${target.runtimeType} in a static-get.');
- }
- });
- }
-
- visitStringConcatenation(StringConcatenation node) {
- final List<Object> concatenated = <Object>[new StringBuffer()];
- for (int i = 0; i < node.expressions.length; i++) {
- Constant constant = _evaluateSubexpression(node.expressions[i]);
- if (constant is PrimitiveConstant) {
- String value = constant.value.toString();
- Object last = concatenated.last;
- if (last is StringBuffer) {
- last.write(value);
- } else {
- concatenated.add(new StringBuffer(value));
- }
- } else if (constant is UnevaluatedConstant) {
- concatenated.add(constant);
- } else {
- throw new _AbortCurrentEvaluation(errorReporter
- .invalidStringInterpolationOperand(contextChain, node, constant));
- }
- }
- if (concatenated.length > 1) {
- final expressions = new List<Expression>(concatenated.length);
- for (int i = 0; i < concatenated.length; i++) {
- Object value = concatenated[i];
- if (value is UnevaluatedConstant) {
- expressions[i] = unique(value.expression);
- } else {
- expressions[i] = new ConstantExpression(
- canonicalize(new StringConstant(value.toString())));
- }
- }
- return unevaluated(node, new StringConcatenation(expressions));
- }
- return canonicalize(new StringConstant(concatenated.single.toString()));
- }
-
- visitStaticInvocation(StaticInvocation node) {
- final Procedure target = node.target;
- final Arguments arguments = node.arguments;
- final positionals = evaluatePositionalArguments(arguments);
- final named = evaluateNamedArguments(arguments);
- if (hasUnevaluatedChild(node)) {
- return unevaluated(
- node,
- new StaticInvocation(
- target, unevaluatedArguments(positionals, named, arguments.types),
- isConst: true));
- }
- if (target.kind == ProcedureKind.Factory) {
- if (target.isConst &&
- target.name.name == "fromEnvironment" &&
- target.enclosingLibrary == coreTypes.coreLibrary &&
- positionals.length == 1) {
- if (environmentDefines != null) {
- // Evaluate environment constant.
- Constant name = positionals.single;
- if (name is StringConstant) {
- String value = environmentDefines[name.value];
- Constant defaultValue = named["defaultValue"];
-
- if (target.enclosingClass == coreTypes.boolClass) {
- Constant boolConstant = value == "true"
- ? trueConstant
- : value == "false"
- ? falseConstant
- : defaultValue is BoolConstant
- ? defaultValue.value ? trueConstant : falseConstant
- : defaultValue is NullConstant
- ? nullConstant
- : falseConstant;
- return boolConstant;
- } else if (target.enclosingClass == coreTypes.intClass) {
- int intValue = value != null ? int.tryParse(value) : null;
- intValue ??=
- defaultValue is IntConstant ? defaultValue.value : null;
- if (intValue == null) return nullConstant;
- return canonicalize(new IntConstant(intValue));
- } else if (target.enclosingClass == coreTypes.stringClass) {
- value ??=
- defaultValue is StringConstant ? defaultValue.value : null;
- if (value == null) return nullConstant;
- return canonicalize(new StringConstant(value));
- }
- }
- // TODO(askesc): Give more meaningful error message if name is null.
- } else {
- // Leave environment constant unevaluated.
- return unevaluated(
- node,
- new StaticInvocation(target,
- unevaluatedArguments(positionals, named, arguments.types),
- isConst: true));
- }
- }
- } else if (target.name.name == 'identical') {
- // Ensure the "identical()" function comes from dart:core.
- final parent = target.parent;
- if (parent is Library && parent == coreTypes.coreLibrary) {
- final Constant left = positionals[0];
- final Constant right = positionals[1];
- // Since we canonicalize constants during the evaluation, we can use
- // identical here.
- return identical(left, right) ? trueConstant : falseConstant;
- }
- }
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidStaticInvocation(contextChain, node, target));
- }
-
- visitAsExpression(AsExpression node) {
- final Constant constant = _evaluateSubexpression(node.operand);
- if (constant is UnevaluatedConstant) {
- return unevaluated(
- node, new AsExpression(unique(constant.expression), node.type));
- }
- ensureIsSubtype(constant, evaluateDartType(node, node.type), node);
- return constant;
- }
-
- visitNot(Not node) {
- final Constant constant = _evaluateSubexpression(node.operand);
- if (constant is BoolConstant) {
- return constant == trueConstant ? falseConstant : trueConstant;
- }
- if (constant is UnevaluatedConstant) {
- return unevaluated(node, new Not(unique(constant.expression)));
- }
- throw new _AbortCurrentEvaluation(errorReporter.invalidDartType(
- contextChain, node, constant, typeEnvironment.boolType));
- }
-
- visitSymbolLiteral(SymbolLiteral node) {
- final libraryReference =
- node.value.startsWith('_') ? libraryOf(node).reference : null;
- return canonicalize(new SymbolConstant(node.value, libraryReference));
- }
-
- visitInstantiation(Instantiation node) {
- final Constant constant = _evaluateSubexpression(node.expression);
- if (constant is TearOffConstant) {
- if (node.typeArguments.length ==
- constant.procedure.function.typeParameters.length) {
- final typeArguments = evaluateDartTypes(node, node.typeArguments);
- return canonicalize(
- new PartialInstantiationConstant(constant, typeArguments));
- }
- throw new Exception(
- 'The number of type arguments supplied in the partial instantiation '
- 'does not match the number of type arguments of the $constant.');
- }
- if (constant is UnevaluatedConstant) {
- return unevaluated(node,
- new Instantiation(unique(constant.expression), node.typeArguments));
- }
- throw new Exception(
- 'Only tear-off constants can be partially instantiated.');
- }
-
- @override
- visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) {
- throw new _AbortCurrentEvaluation(
- errorReporter.deferredLibrary(contextChain, node, node.import.name));
- }
-
- // Helper methods:
-
- Constant makeDoubleConstant(double value) {
- if (targetingJavaScript) {
- // Convert to an integer when possible (matching the runtime behavior
- // of `is int`).
- if (value.isFinite) {
- var i = value.toInt();
- if (value == i.toDouble()) return new IntConstant(i);
- }
- }
- return new DoubleConstant(value);
- }
-
- void ensureIsSubtype(Constant constant, DartType type, TreeNode node) {
- DartType constantType = constant.getType(typeEnvironment);
-
- if (!typeEnvironment.isSubtypeOf(constantType, type)) {
- throw new _AbortCurrentEvaluation(
- errorReporter.invalidDartType(contextChain, node, constant, type));
- }
- }
-
- List<DartType> evaluateTypeArguments(TreeNode node, Arguments arguments) {
- return evaluateDartTypes(node, arguments.types);
- }
-
- List<DartType> evaluateSuperTypeArguments(TreeNode node, Supertype type) {
- return evaluateDartTypes(node, type.typeArguments);
- }
-
- List<DartType> evaluateDartTypes(TreeNode node, List<DartType> types) {
- // TODO: Once the frontend gurantees that there are no free type variables
- // left over after stubstitution, we can enable this shortcut again:
- // if (env.isEmpty) return types;
- return types.map((t) => evaluateDartType(node, t)).toList();
- }
-
- DartType evaluateDartType(TreeNode node, DartType type) {
- final result = env.subsituteType(type);
-
- if (!isInstantiated(result)) {
- throw new _AbortCurrentEvaluation(
- errorReporter.freeTypeParameter(contextChain, node, type));
- }
-
- return result;
- }
-
- List<Constant> evaluatePositionalArguments(Arguments arguments) {
- return arguments.positional.map((Expression node) {
- return _evaluateSubexpression(node);
- }).toList();
- }
-
- Map<String, Constant> evaluateNamedArguments(Arguments arguments) {
- if (arguments.named.isEmpty) return const <String, Constant>{};
-
- final Map<String, Constant> named = {};
- arguments.named.forEach((NamedExpression pair) {
- named[pair.name] = _evaluateSubexpression(pair.value);
- });
- return named;
- }
-
- Arguments unevaluatedArguments(List<Constant> positionalArgs,
- Map<String, Constant> namedArgs, List<DartType> types) {
- final positional = new List<Expression>(positionalArgs.length);
- final named = new List<NamedExpression>(namedArgs.length);
- for (int i = 0; i < positionalArgs.length; ++i) {
- positional[i] = unique(positionalArgs[i].asExpression());
- }
- int i = 0;
- namedArgs.forEach((String name, Constant value) {
- named[i++] = new NamedExpression(name, unique(value.asExpression()));
- });
- return new Arguments(positional, named: named, types: types);
- }
-
- Constant canonicalize(Constant constant) {
- return canonicalizationCache.putIfAbsent(constant, () => constant);
- }
-
- withNewInstanceBuilder(Class klass, List<DartType> typeArguments, fn()) {
- InstanceBuilder old = instanceBuilder;
- try {
- instanceBuilder = new InstanceBuilder(klass, typeArguments);
- return fn();
- } finally {
- instanceBuilder = old;
- }
- }
-
- withNewEnvironment(fn()) {
- final EvaluationEnvironment oldEnv = env;
- try {
- env = new EvaluationEnvironment();
- return fn();
- } finally {
- env = oldEnv;
- }
- }
-
- Constant evaluateBinaryNumericOperation(
- String op, num a, num b, TreeNode node) {
- if (targetingJavaScript) {
- a = a.toDouble();
- b = b.toDouble();
- }
- num result;
- switch (op) {
- case '+':
- result = a + b;
- break;
- case '-':
- result = a - b;
- break;
- case '*':
- result = a * b;
- break;
- case '/':
- result = a / b;
- break;
- case '~/':
- result = a ~/ b;
- break;
- case '%':
- result = a % b;
- break;
- }
-
- if (result is int) {
- return canonicalize(new IntConstant(result.toSigned(64)));
- }
- if (result is double) {
- return canonicalize(makeDoubleConstant(result));
- }
-
- switch (op) {
- case '<':
- return a < b ? trueConstant : falseConstant;
- case '<=':
- return a <= b ? trueConstant : falseConstant;
- case '>=':
- return a >= b ? trueConstant : falseConstant;
- case '>':
- return a > b ? trueConstant : falseConstant;
- }
-
- throw new Exception("Unexpected binary numeric operation '$op'.");
- }
-
- Library libraryOf(TreeNode node) {
- // The tree structure of the kernel AST ensures we always have an enclosing
- // library.
- while (true) {
- if (node is Library) return node;
- node = node.parent;
- }
- }
-}
-
-/// Holds the necessary information for a constant object, namely
-/// * the [klass] being instantiated
-/// * the [typeArguments] used for the instantiation
-/// * the [fields] the instance will obtain (all fields from the
-/// instantiated [klass] up to the [Object] klass).
-class InstanceBuilder {
- /// The class of the new instance.
- final Class klass;
-
- /// The values of the type parameters of the new instance.
- final List<DartType> typeArguments;
-
- /// The field values of the new instance.
- final Map<Field, Constant> fields = <Field, Constant>{};
-
- InstanceBuilder(this.klass, this.typeArguments);
-
- void setFieldValue(Field field, Constant constant) {
- fields[field] = constant;
- }
-
- InstanceConstant buildInstance() {
- final Map<Reference, Constant> fieldValues = <Reference, Constant>{};
- fields.forEach((Field field, Constant value) {
- fieldValues[field.reference] = value;
- });
- return new InstanceConstant(klass.reference, typeArguments, fieldValues);
- }
-}
-
-/// Holds an environment of type parameters, parameters and variables.
-class EvaluationEnvironment {
- /// The values of the type parameters in scope.
- final Map<TypeParameter, DartType> _typeVariables =
- <TypeParameter, DartType>{};
-
- /// The values of the parameters/variables in scope.
- final Map<VariableDeclaration, Constant> _variables =
- <VariableDeclaration, Constant>{};
-
- /// Whether the current environment is empty.
- bool get isEmpty => _typeVariables.isEmpty && _variables.isEmpty;
-
- void addTypeParameterValue(TypeParameter parameter, DartType value) {
- assert(!_typeVariables.containsKey(parameter));
- _typeVariables[parameter] = value;
- }
-
- void addVariableValue(VariableDeclaration variable, Constant value) {
- assert(!_variables.containsKey(variable));
- _variables[variable] = value;
- }
-
- DartType lookupParameterValue(TypeParameter parameter) {
- final DartType value = _typeVariables[parameter];
- assert(value != null);
- return value;
- }
-
- Constant lookupVariable(VariableDeclaration variable) {
- return _variables[variable];
- }
-
- DartType subsituteType(DartType type) {
- if (_typeVariables.isEmpty) return type;
- return substitute(type, _typeVariables);
- }
-}
-
-/// The different kinds of number semantics supported by the constant evaluator.
-enum NumberSemantics {
- /// Dart VM number semantics.
- vm,
-
- /// JavaScript (Dart2js and DDC) number semantics.
- js,
-}
-
-// Backend specific constant evaluation behavior
-class ConstantsBackend {
- const ConstantsBackend();
-
- /// Lowering of a list constant to a backend-specific representation.
- Constant lowerListConstant(ListConstant constant) => constant;
-
- /// Lowering of a set constant to a backend-specific representation.
- Constant lowerSetConstant(SetConstant constant) => constant;
-
- /// Lowering of a map constant to a backend-specific representation.
- Constant lowerMapConstant(MapConstant constant) => constant;
-
- /// Number semantics to use for this backend.
- NumberSemantics get numberSemantics => NumberSemantics.vm;
-}
-
-// Used as control-flow to abort the current evaluation.
-class _AbortCurrentEvaluation {
- final String message;
- _AbortCurrentEvaluation(this.message);
-}
-
-abstract class ErrorReporter {
- const ErrorReporter();
-
- Uri getFileUri(TreeNode node) {
- while (node is! FileUriNode) {
- node = node.parent;
- }
- return (node as FileUriNode).fileUri;
- }
-
- int getFileOffset(TreeNode node) {
- while (node.fileOffset == TreeNode.noOffset) {
- node = node.parent;
- }
- return node == null ? TreeNode.noOffset : node.fileOffset;
- }
-
- String freeTypeParameter(
- List<TreeNode> context, TreeNode node, DartType type);
- String invalidDartType(List<TreeNode> context, TreeNode node,
- Constant receiver, DartType expectedType);
- String invalidBinaryOperandType(List<TreeNode> context, TreeNode node,
- Constant receiver, String op, DartType expectedType, DartType actualType);
- String invalidMethodInvocation(
- List<TreeNode> context, TreeNode node, Constant receiver, String op);
- String invalidStaticInvocation(
- List<TreeNode> context, TreeNode node, Member target);
- String invalidStringInterpolationOperand(
- List<TreeNode> context, TreeNode node, Constant constant);
- String invalidSymbolName(
- List<TreeNode> context, TreeNode node, Constant constant);
- String zeroDivisor(
- List<TreeNode> context, TreeNode node, IntConstant receiver, String op);
- String negativeShift(List<TreeNode> context, TreeNode node,
- IntConstant receiver, String op, IntConstant argument);
- String nonConstLiteral(List<TreeNode> context, TreeNode node, String klass);
- String duplicateKey(List<TreeNode> context, TreeNode node, Constant key);
- String failedAssertion(List<TreeNode> context, TreeNode node, String message);
- String nonConstantVariableGet(
- List<TreeNode> context, TreeNode node, String variableName);
- String deferredLibrary(
- List<TreeNode> context, TreeNode node, String importName);
- String circularity(List<TreeNode> context, TreeNode node);
-}
-
-class SimpleErrorReporter extends ErrorReporter {
- const SimpleErrorReporter();
-
- String report(List<TreeNode> context, String what, TreeNode node) {
- io.exitCode = 42;
- final Uri uri = getFileUri(node);
- final int fileOffset = getFileOffset(node);
- final String message = '$uri:$fileOffset Constant evaluation error: $what';
- io.stderr.writeln(message);
- return message;
- }
-
- @override
- String freeTypeParameter(
- List<TreeNode> context, TreeNode node, DartType type) {
- return report(
- context, 'Expected type to be instantiated but was ${type}', node);
- }
-
- @override
- String invalidDartType(List<TreeNode> context, TreeNode node,
- Constant receiver, DartType expectedType) {
- return report(
- context,
- 'Expected expression to evaluate to "$expectedType" but got "$receiver.',
- node);
- }
-
- @override
- String invalidBinaryOperandType(
- List<TreeNode> context,
- TreeNode node,
- Constant receiver,
- String op,
- DartType expectedType,
- DartType actualType) {
- return report(
- context,
- 'Calling "$op" on "$receiver" needs operand of type '
- '"$expectedType" (but got "$actualType")',
- node);
- }
-
- @override
- String invalidMethodInvocation(
- List<TreeNode> context, TreeNode node, Constant receiver, String op) {
- return report(context,
- 'Cannot call "$op" on "$receiver" in constant expression', node);
- }
-
- @override
- String invalidStaticInvocation(
- List<TreeNode> context, TreeNode node, Member target) {
- return report(
- context, 'Cannot invoke "$target" inside a constant expression', node);
- }
-
- @override
- String invalidStringInterpolationOperand(
- List<TreeNode> context, TreeNode node, Constant constant) {
- return report(
- context,
- 'Only null/bool/int/double/String values are allowed as string '
- 'interpolation expressions during constant evaluation (was: "$constant").',
- node);
- }
-
- @override
- String invalidSymbolName(
- List<TreeNode> context, TreeNode node, Constant constant) {
- return report(
- context,
- 'The symbol name must be a valid public Dart member name, public '
- 'constructor name, or library name, optionally qualified.',
- node);
- }
-
- @override
- String zeroDivisor(
- List<TreeNode> context, TreeNode node, IntConstant receiver, String op) {
- return report(
- context,
- "Binary operator '$op' on '${receiver.value}' requires non-zero "
- "divisor, but divisor was '0'.",
- node);
- }
-
- @override
- String negativeShift(List<TreeNode> context, TreeNode node,
- IntConstant receiver, String op, IntConstant argument) {
- return report(
- context,
- "Binary operator '$op' on '${receiver.value}' requires non-negative "
- "operand, but was '${argument.value}'.",
- node);
- }
-
- @override
- String nonConstLiteral(List<TreeNode> context, TreeNode node, String klass) {
- return report(
- context,
- 'Cannot have a non-constant $klass literal within a const context.',
- node);
- }
-
- @override
- String duplicateKey(List<TreeNode> context, TreeNode node, Constant key) {
- return report(
- context,
- 'Duplicate keys are not allowed in constant maps (found duplicate key "$key")',
- node);
- }
-
- @override
- String failedAssertion(
- List<TreeNode> context, TreeNode node, String message) {
- return report(
- context,
- 'The assertion condition evaluated to "false" with message "$message"',
- node);
- }
-
- @override
- String nonConstantVariableGet(
- List<TreeNode> context, TreeNode node, String variableName) {
- return report(
- context,
- 'The variable "$variableName" cannot be used inside a constant '
- 'expression.',
- node);
- }
-
- @override
- String deferredLibrary(
- List<TreeNode> context, TreeNode node, String importName) {
- return report(
- context,
- 'Deferred "$importName" cannot be used inside a constant '
- 'expression',
- node);
- }
-
- @override
- String circularity(List<TreeNode> context, TreeNode node) {
- return report(context, 'Constant expression depends on itself.', node);
- }
-}
-
-class IsInstantiatedVisitor extends DartTypeVisitor<bool> {
- final _availableVariables = new Set<TypeParameter>();
-
- bool isInstantiated(DartType type) {
- return type.accept(this);
- }
-
- bool defaultDartType(DartType node) {
- throw 'A visitor method seems to be unimplemented!';
- }
-
- bool visitInvalidType(InvalidType node) => true;
- bool visitDynamicType(DynamicType node) => true;
- bool visitVoidType(VoidType node) => true;
- bool visitBottomType(BottomType node) => true;
-
- bool visitTypeParameterType(TypeParameterType node) {
- return _availableVariables.contains(node.parameter);
- }
-
- bool visitInterfaceType(InterfaceType node) {
- return node.typeArguments
- .every((DartType typeArgument) => typeArgument.accept(this));
- }
-
- bool visitFunctionType(FunctionType node) {
- final parameters = node.typeParameters;
- _availableVariables.addAll(parameters);
- final bool result = node.returnType.accept(this) &&
- node.positionalParameters.every((p) => p.accept(this)) &&
- node.namedParameters.every((p) => p.type.accept(this));
- _availableVariables.removeAll(parameters);
- return result;
- }
-
- bool visitTypedefType(TypedefType node) {
- return node.unalias.accept(this);
- }
-}
-
-bool _isFormalParameter(VariableDeclaration variable) {
- final parent = variable.parent;
- if (parent is FunctionNode) {
- return parent.positionalParameters.contains(variable) ||
- parent.namedParameters.contains(variable);
- }
- return false;
-}
diff --git a/kernel/lib/transformations/continuation.dart b/kernel/lib/transformations/continuation.dart
index a78a3ab..b599cdf 100644
--- a/kernel/lib/transformations/continuation.dart
+++ b/kernel/lib/transformations/continuation.dart
@@ -747,7 +747,8 @@
new VariableGet(iteratorVariable),
new Name('moveNext'),
new Arguments(<Expression>[]),
- helper.streamIteratorMoveNext));
+ helper.streamIteratorMoveNext))
+ ..fileOffset = stmt.fileOffset;
// _asyncStarMoveNextHelper(:stream)
var asyncStarMoveNextCall = new StaticInvocation(
diff --git a/kernel/lib/type_checker.dart b/kernel/lib/type_checker.dart
index 7f04bce..8faae52 100644
--- a/kernel/lib/type_checker.dart
+++ b/kernel/lib/type_checker.dart
@@ -713,6 +713,18 @@
}
@override
+ DartType visitInstanceCreation(InstanceCreation node) {
+ Substitution substitution = Substitution.fromPairs(
+ node.classNode.typeParameters, node.typeArguments);
+ node.fieldValues.forEach((Reference fieldRef, Expression value) {
+ DartType fieldType = substitution.substituteType(fieldRef.asField.type);
+ DartType valueType = visitExpression(value);
+ checkAssignable(node, fieldType, valueType);
+ });
+ return new InterfaceType(node.classNode, node.typeArguments);
+ }
+
+ @override
DartType visitStringLiteral(StringLiteral node) {
return environment.stringType;
}
@@ -799,6 +811,11 @@
}
@override
+ visitConstantExpression(ConstantExpression node) {
+ return node.type;
+ }
+
+ @override
visitAssertStatement(AssertStatement node) {
visitExpression(node.condition);
if (node.message != null) {
@@ -1022,11 +1039,4 @@
@override
visitInvalidInitializer(InvalidInitializer node) {}
-
- @override
- visitConstantExpression(ConstantExpression node) {
- // Without explicitly running the "constants" transformation, we should
- // never get here!
- throw 'unreachable';
- }
}
diff --git a/kernel/lib/visitor.dart b/kernel/lib/visitor.dart
index 0cecee1..b1a9938 100644
--- a/kernel/lib/visitor.dart
+++ b/kernel/lib/visitor.dart
@@ -41,6 +41,7 @@
R visitListConcatenation(ListConcatenation node) => defaultExpression(node);
R visitSetConcatenation(SetConcatenation node) => defaultExpression(node);
R visitMapConcatenation(MapConcatenation node) => defaultExpression(node);
+ R visitInstanceCreation(InstanceCreation node) => defaultExpression(node);
R visitIsExpression(IsExpression node) => defaultExpression(node);
R visitAsExpression(AsExpression node) => defaultExpression(node);
R visitSymbolLiteral(SymbolLiteral node) => defaultExpression(node);
@@ -167,6 +168,7 @@
R visitListConcatenation(ListConcatenation node) => defaultExpression(node);
R visitSetConcatenation(SetConcatenation node) => defaultExpression(node);
R visitMapConcatenation(MapConcatenation node) => defaultExpression(node);
+ R visitInstanceCreation(InstanceCreation node) => defaultExpression(node);
R visitIsExpression(IsExpression node) => defaultExpression(node);
R visitAsExpression(AsExpression node) => defaultExpression(node);
R visitSymbolLiteral(SymbolLiteral node) => defaultExpression(node);
@@ -288,6 +290,8 @@
}
class ConstantVisitor<R> {
+ const ConstantVisitor();
+
R defaultConstant(Constant node) => null;
R visitNullConstant(NullConstant node) => defaultConstant(node);
@@ -508,6 +512,8 @@
defaultExpression(node, arg);
R visitMapConcatenation(MapConcatenation node, T arg) =>
defaultExpression(node, arg);
+ R visitInstanceCreation(InstanceCreation node, T arg) =>
+ defaultExpression(node, arg);
R visitIsExpression(IsExpression node, T arg) => defaultExpression(node, arg);
R visitAsExpression(AsExpression node, T arg) => defaultExpression(node, arg);
R visitSymbolLiteral(SymbolLiteral node, T arg) =>
diff --git a/kernel/lib/vm/constants_native_effects.dart b/kernel/lib/vm/constants_native_effects.dart
index 9a9c9c8..2dc607d 100644
--- a/kernel/lib/vm/constants_native_effects.dart
+++ b/kernel/lib/vm/constants_native_effects.dart
@@ -5,7 +5,7 @@
library vm.constants_native_effects;
import '../ast.dart';
-import '../transformations/constants.dart';
+import '../target/targets.dart';
import '../core_types.dart';
class VmConstantsBackend extends ConstantsBackend {
diff --git a/kernel/pubspec.yaml b/kernel/pubspec.yaml
index 6072c7e..eeb40cc 100644
--- a/kernel/pubspec.yaml
+++ b/kernel/pubspec.yaml
@@ -1,21 +1,16 @@
name: kernel
# Currently, kernel API is not stable and users should
# not depend on semver semantics when depending on this package.
-version: 0.3.14
+version: 0.3.18
author: Dart Team <misc@dartlang.org>
description: Dart IR (Intermediate Representation)
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/kernel
environment:
sdk: '>=2.0.0-dev.48.0 <3.0.0'
dependencies:
- path: ^1.3.9
args: '>=0.13.4 <2.0.0'
dev_dependencies:
- expect:
- path: ../expect
- front_end:
- path: ../front_end
- test:
- path: ../../third_party/pkg/test
- testing:
- path: ../testing
+ expect: any
+ front_end: any
+ test: any
+ testing: any
diff --git a/linter/.travis.yml b/linter/.travis.yml
index 9b86eca..e56babd 100644
--- a/linter/.travis.yml
+++ b/linter/.travis.yml
@@ -7,6 +7,7 @@
- LINTER_BOT=main
- LINTER_BOT=benchmark
- LINTER_BOT=pana_baseline
+ - LINTER_BOT=release
# Only building master means that we don't run two builds for each pull request.
branches:
diff --git a/linter/BUILD.gn b/linter/BUILD.gn
index c920aee..81f84b6 100644
--- a/linter/BUILD.gn
+++ b/linter/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for linter-0.1.83
+# This file is generated by importer.py for linter-0.1.87
import("//build/dart/dart_library.gni")
diff --git a/linter/CHANGELOG.md b/linter/CHANGELOG.md
index 8e6804d..94114c5 100644
--- a/linter/CHANGELOG.md
+++ b/linter/CHANGELOG.md
@@ -1,3 +1,30 @@
+# 0.1.87
+
+* change: `prefer_const_constructors_in_immutables` is currently overly permissive, pending analyzer changes (#1537)
+* fixed `unnecessary_await_in_return` false positive
+* fixed `unrelated_type_equality_checks` false negative with functions
+* fixed `prefer_spread_collections` to not lint in const contexts
+* fixed false positive in `prefer_iterable_whereType` for `is!`
+* fixed false positive in `prefer_collection_literals` for constructors with params
+
+# 0.1.86
+
+* updated `prefer_spread_collections` to ignore calls to `addAll` that could be inlined
+* new lint: `prefer_inlined_adds`
+
+# 0.1.85
+
+* (**BREAKING**) renamed `spread_collections` to `prefer_spread_collections`
+* new lint: `prefer_for_elements_to_map_fromIterable`
+* new lint: `prefer_if_elements_to_conditional_expressions`
+* new lint: `diagnostic_describe_all_properties`
+
+# 0.1.84
+
+* new lint: `spread_collections`
+* (internal) update to analyzer 0.36.0 APIs
+* new lint: `prefer_asserts_with_message`
+
# 0.1.83
* updated `file_names` to skip prefixed-extension Dart files (e.g., `.css.dart`, `.g.dart`)
diff --git a/linter/PULL_REQUEST_TEMPLATE.md b/linter/PULL_REQUEST_TEMPLATE.md
index 89b9187..7194f6a 100644
--- a/linter/PULL_REQUEST_TEMPLATE.md
+++ b/linter/PULL_REQUEST_TEMPLATE.md
@@ -5,6 +5,6 @@
the name of the rule in the pull request.
If this is a new lint or feature and there is not an existing tracking bug, please
-consider opening one to better facilate conversation.
+consider opening one to better facilitate conversation.
Fixes # (issue)
diff --git a/linter/doc/WritingLints.MD b/linter/doc/WritingLints.MD
index 40f72fe..47786cd 100644
--- a/linter/doc/WritingLints.MD
+++ b/linter/doc/WritingLints.MD
@@ -64,7 +64,7 @@
helper script and documentation gets generated with [doc.dart](https://github.com/dart-lang/linter/blob/master/tool/doc.dart).
Helper scripts can be invoked via `dart` or grinder (`pub run grinder docs --dir=doc_location` and `pub run grinder rule --name=my_new_rule` respectively). Using grinder, for example
- $ pub run grinder rule --name=my_new_test
+ $ pub run grinder rule --name=my_new_lint
generates lint and test stubs in `lib/src/rules` and `test/rules`.
diff --git a/linter/example/all.yaml b/linter/example/all.yaml
index bbb6dc7..8abbe3d 100644
--- a/linter/example/all.yaml
+++ b/linter/example/all.yaml
@@ -48,6 +48,7 @@
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
+ - diagnostic_describe_all_properties
- directives_ordering
- empty_catches
- empty_constructor_bodies
@@ -78,6 +79,7 @@
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
+ - prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
@@ -91,10 +93,13 @@
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
+ - prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
+ - prefer_if_elements_to_conditional_expressions
- prefer_initializing_formals
+ - prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
@@ -103,6 +108,7 @@
- prefer_mixin
- prefer_null_aware_operators
- prefer_single_quotes
+ - prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
diff --git a/linter/lib/src/ast.dart b/linter/lib/src/ast.dart
index e41e007..e8643e7 100644
--- a/linter/lib/src/ast.dart
+++ b/linter/lib/src/ast.dart
@@ -337,7 +337,6 @@
CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT,
CompileTimeErrorCode.NON_CONSTANT_MAP_KEY,
CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
];
bool hasConstError = false;
diff --git a/linter/lib/src/rules.dart b/linter/lib/src/rules.dart
index 407f9df..bbfadc6 100644
--- a/linter/lib/src/rules.dart
+++ b/linter/lib/src/rules.dart
@@ -49,6 +49,7 @@
import 'package:linter/src/rules/constant_identifier_names.dart';
import 'package:linter/src/rules/control_flow_in_finally.dart';
import 'package:linter/src/rules/curly_braces_in_flow_control_structures.dart';
+import 'package:linter/src/rules/diagnostic_describe_all_properties.dart';
import 'package:linter/src/rules/directives_ordering.dart';
import 'package:linter/src/rules/empty_catches.dart';
import 'package:linter/src/rules/empty_constructor_bodies.dart';
@@ -78,6 +79,7 @@
import 'package:linter/src/rules/parameter_assignments.dart';
import 'package:linter/src/rules/prefer_adjacent_string_concatenation.dart';
import 'package:linter/src/rules/prefer_asserts_in_initializer_lists.dart';
+import 'package:linter/src/rules/prefer_asserts_with_message.dart';
import 'package:linter/src/rules/prefer_bool_in_asserts.dart';
import 'package:linter/src/rules/prefer_collection_literals.dart';
import 'package:linter/src/rules/prefer_conditional_assignment.dart';
@@ -92,10 +94,13 @@
import 'package:linter/src/rules/prefer_final_fields.dart';
import 'package:linter/src/rules/prefer_final_in_for_each.dart';
import 'package:linter/src/rules/prefer_final_locals.dart';
+import 'package:linter/src/rules/prefer_for_elements_to_map_fromIterable.dart';
import 'package:linter/src/rules/prefer_foreach.dart';
import 'package:linter/src/rules/prefer_function_declarations_over_variables.dart';
import 'package:linter/src/rules/prefer_generic_function_type_aliases.dart';
+import 'package:linter/src/rules/prefer_if_elements_to_conditional_expressions.dart';
import 'package:linter/src/rules/prefer_initializing_formals.dart';
+import 'package:linter/src/rules/prefer_inlined_adds.dart';
import 'package:linter/src/rules/prefer_int_literals.dart';
import 'package:linter/src/rules/prefer_interpolation_to_compose_strings.dart';
import 'package:linter/src/rules/prefer_is_empty.dart';
@@ -104,6 +109,7 @@
import 'package:linter/src/rules/prefer_mixin.dart';
import 'package:linter/src/rules/prefer_null_aware_operators.dart';
import 'package:linter/src/rules/prefer_single_quotes.dart';
+import 'package:linter/src/rules/prefer_spread_collections.dart';
import 'package:linter/src/rules/prefer_typing_uninitialized_variables.dart';
import 'package:linter/src/rules/prefer_void_to_null.dart';
import 'package:linter/src/rules/provide_deprecation_message.dart';
@@ -191,6 +197,7 @@
..register(new ControlFlowInFinally())
..register(new ConstantIdentifierNames())
..register(new CurlyBracesInFlowControlStructures())
+ ..register(new DiagnosticsDescribeAllProperties())
..register(new DirectivesOrdering())
..register(new EmptyCatches())
..register(new EmptyConstructorBodies())
@@ -219,6 +226,7 @@
..register(new PackagePrefixedLibraryNames())
..register(new ParameterAssignments())
..register(new PreferAdjacentStringConcatenation())
+ ..register(new PreferAssertsWithMessage())
..register(new PreferBoolInAsserts())
..register(new PreferCollectionLiterals())
..register(new PreferConditionalAssignment())
@@ -235,9 +243,12 @@
..register(new PreferFinalInForEach())
..register(new PreferFinalLocals())
..register(new PreferForeach())
+ ..register(new PreferForElementsToMapFromIterable())
..register(new PreferFunctionDeclarationsOverVariables())
..register(new PreferGenericFunctionTypeAliases())
+ ..register(new PreferIfElementsToConditionalExpressions())
..register(new PreferInitializingFormals())
+ ..register(new PreferInlinedAdds())
..register(new PreferIntLiterals())
..register(new PreferInterpolationToComposeStrings())
..register(new PreferIterableWhereType())
@@ -246,6 +257,7 @@
..register(new PreferMixin())
..register(new PreferNullAwareOperators())
..register(new PreferSingleQuotes())
+ ..register(new PreferSpreadCollections())
..register(new PreferTypingUninitializedVariables())
..register(new PreferVoidToNull())
..register(new ProvideDeprecationMessage())
diff --git a/linter/lib/src/rules/always_put_control_body_on_new_line.dart b/linter/lib/src/rules/always_put_control_body_on_new_line.dart
index ab7c6df..ffd0516 100644
--- a/linter/lib/src/rules/always_put_control_body_on_new_line.dart
+++ b/linter/lib/src/rules/always_put_control_body_on_new_line.dart
@@ -58,7 +58,7 @@
[LinterContext context]) {
final visitor = new _Visitor(this);
registry.addDoStatement(this, visitor);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addIfStatement(this, visitor);
registry.addWhileStatement(this, visitor);
}
@@ -75,7 +75,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement(ForStatement node) {
_checkNodeOnNextLine(node.body, node.rightParenthesis.end);
}
diff --git a/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart b/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart
index 949fa5e..2f262d7 100644
--- a/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart
+++ b/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart
@@ -63,7 +63,7 @@
[LinterContext context]) {
final visitor = new _Visitor(this);
registry.addDoStatement(this, visitor);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addIfStatement(this, visitor);
registry.addWhileStatement(this, visitor);
}
@@ -80,7 +80,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
_check(node.body);
}
diff --git a/linter/lib/src/rules/diagnostic_describe_all_properties.dart b/linter/lib/src/rules/diagnostic_describe_all_properties.dart
new file mode 100644
index 0000000..7fe989d
--- /dev/null
+++ b/linter/lib/src/rules/diagnostic_describe_all_properties.dart
@@ -0,0 +1,244 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:linter/src/analyzer.dart';
+import 'package:linter/src/ast.dart';
+import 'package:linter/src/util/dart_type_utilities.dart';
+
+const _desc = r'DO reference all public properties in debug methods.';
+
+const _details = r'''
+**DO** reference all public properties in `debug` method implementations.
+
+Implementers of `Diagnosticable` should reference all public properties in
+a `debugFillProperties(...)` or `debugDescribeChildren(...)` method
+implementation to improve debuggability at runtime.
+
+Public properties are defined as fields and getters that are
+
+* not package-private (e.g., prefixed with `_`)
+* not `static` or overriding
+* not themselves `Widget`s or collections of `Widget`s
+
+In addition, the "debug" prefix is treated specially for properties in Flutter.
+For the purposes of diagnostics, a property `foo` and a prefixed property
+`debugFoo` are treated as effectively describing the same property and it is
+sufficient to refer to one or the other.
+
+**BAD:**
+```
+class Absorber extends Widget {
+ bool get absorbing => _absorbing;
+ bool _absorbing;
+ bool get ignoringSemantics => _ignoringSemantics;
+ bool _ignoringSemantics;
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(DiagnosticsProperty<bool>('absorbing', absorbing));
+ // Missing reference to ignoringSemantics
+ }
+}
+```
+
+**GOOD:**
+```
+class Absorber extends Widget {
+ bool get absorbing => _absorbing;
+ bool _absorbing;
+ bool get ignoringSemantics => _ignoringSemantics;
+ bool _ignoringSemantics;
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(DiagnosticsProperty<bool>('absorbing', absorbing));
+ properties.add(DiagnosticsProperty<bool>('ignoringSemantics', ignoringSemantics));
+ }
+}
+```
+''';
+
+class DiagnosticsDescribeAllProperties extends LintRule
+ implements NodeLintRule {
+ DiagnosticsDescribeAllProperties()
+ : super(
+ name: 'diagnostic_describe_all_properties',
+ description: _desc,
+ details: _details,
+ maturity: Maturity.experimental,
+ group: Group.errors,
+ );
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this, context);
+ registry.addCompilationUnit(this, visitor);
+ registry.addClassDeclaration(this, visitor);
+ }
+}
+
+// for experiments and book-keeping
+//int fileCount = 0;
+//int debugPropertyCount = 0;
+//int classesWithPropertiesButNoDebugFill = 0;
+
+class _Visitor extends SimpleAstVisitor {
+ final LintRule rule;
+ final InheritanceManager2 inheritanceManager;
+
+ _Visitor(this.rule, LinterContext context)
+ : inheritanceManager = new InheritanceManager2(context.typeSystem);
+
+ // todo (pq): for experiments and book-keeping; remove before landing
+ LineInfo lineInfo;
+
+ @override
+ visitCompilationUnit(CompilationUnit node) {
+ lineInfo = node.lineInfo;
+ }
+
+// static int noMethods = 0;
+// static int totalClasses = 0;
+
+ bool _isOverridingMember(Element member) {
+ if (member == null) {
+ return false;
+ }
+
+ ClassElement classElement =
+ member.getAncestor((element) => element is ClassElement);
+ if (classElement == null) {
+ return false;
+ }
+ Uri libraryUri = classElement.library.source.uri;
+ return inheritanceManager.getInherited(
+ classElement.type, new Name(libraryUri, member.name)) !=
+ null;
+ }
+
+ @override
+ visitClassDeclaration(ClassDeclaration node) {
+// ++totalClasses;
+
+ // We only care about Diagnosticables.
+ var type = node.declaredElement.type;
+ if (!DartTypeUtilities.implementsInterface(type, 'Diagnosticable', '')) {
+ return;
+ }
+
+ var properties = <SimpleIdentifier>[];
+ for (var member in node.members) {
+ if (member is MethodDeclaration && member.isGetter) {
+ if (!member.isStatic &&
+ !skipForDiagnostic(
+ element: member.declaredElement,
+ name: member.name,
+ type: member.returnType?.type,
+ )) {
+ properties.add(member.name);
+ }
+ } else if (member is FieldDeclaration) {
+ for (var v in member.fields.variables) {
+ if (!v.declaredElement.isStatic &&
+ !skipForDiagnostic(
+ element: v.declaredElement,
+ name: v.name,
+ type: v.declaredElement.type,
+ )) {
+ properties.add(v.name);
+ }
+ }
+ }
+ }
+
+ if (properties.isEmpty) {
+ return;
+ }
+
+ // todo (pq): move up to top when we're not counting anymore.
+ var debugFillProperties = node.getMethod('debugFillProperties');
+// if (debugFillProperties == null) {
+// ++classesWithPropertiesButNoDebugFill;
+// }
+
+ var debugDescribeChildren = node.getMethod('debugDescribeChildren');
+ if (debugFillProperties == null && debugDescribeChildren == null) {
+ return;
+ }
+
+ // Remove any defined in debugFillProperties.
+ removeReferences(debugFillProperties, properties);
+
+ // Remove any defined in debugDescribeChildren.
+ removeReferences(debugDescribeChildren, properties);
+
+ // Flag the rest.
+ properties.forEach(rule.reportLint);
+
+// uncomment for data gathering
+// for (var prop in properties) {
+// var line = lineInfo.getLocation(prop.offset).lineNumber;
+// var prefix =
+// 'https://github.com/flutter/flutter/blob/master/packages/flutter/';
+// var path = node.element.source.fullName.split('packages/flutter/')[1];
+// print('| [$path:$line]($prefix$path#L$line) | ${node.name}.$prop |');
+// ++debugPropertyCount;
+// }
+ }
+
+ void removeReferences(
+ MethodDeclaration method, List<SimpleIdentifier> properties) {
+ if (method == null) {
+ return;
+ }
+ DartTypeUtilities.traverseNodesInDFS(method.body)
+ .whereType<SimpleIdentifier>()
+ .forEach((p) {
+ var debugName;
+ var name;
+ const debugPrefix = 'debug';
+ if (p.name.startsWith(debugPrefix) &&
+ p.name.length > debugPrefix.length) {
+ debugName = p.name;
+ name =
+ '${p.name[debugPrefix.length].toLowerCase()}${p.name.substring(debugPrefix.length + 1)}';
+ } else {
+ name = p.name;
+ debugName =
+ '$debugPrefix${p.name[0].toUpperCase()}${p.name.substring(1)}';
+ }
+ properties.removeWhere(
+ (property) => property.name == debugName || property.name == name);
+ });
+ }
+
+ var collectionInterfaces = <InterfaceTypeDefinition>[
+ new InterfaceTypeDefinition('List', 'dart.core'),
+ new InterfaceTypeDefinition('Map', 'dart.core'),
+ new InterfaceTypeDefinition('LinkedHashMap', 'dart.collection'),
+ new InterfaceTypeDefinition('Set', 'dart.core'),
+ new InterfaceTypeDefinition('LinkedHashSet', 'dart.collection'),
+ ];
+
+ bool isWidgetProperty(DartType type) {
+ if (DartTypeUtilities.implementsInterface(type, 'Widget', '')) {
+ return true;
+ }
+ if (type is ParameterizedType &&
+ DartTypeUtilities.implementsAnyInterface(type, collectionInterfaces)) {
+ return type.typeParameters.length == 1 &&
+ isWidgetProperty(type.typeArguments.first);
+ }
+ return false;
+ }
+
+ bool skipForDiagnostic(
+ {Element element, DartType type, SimpleIdentifier name}) =>
+ isPrivate(name) || _isOverridingMember(element) || isWidgetProperty(type);
+}
diff --git a/linter/lib/src/rules/literal_only_boolean_expressions.dart b/linter/lib/src/rules/literal_only_boolean_expressions.dart
index b4ccaf1..6a7e3d9 100644
--- a/linter/lib/src/rules/literal_only_boolean_expressions.dart
+++ b/linter/lib/src/rules/literal_only_boolean_expressions.dart
@@ -111,7 +111,7 @@
[LinterContext context]) {
final visitor = new _Visitor(this);
registry.addDoStatement(this, visitor);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addIfStatement(this, visitor);
registry.addWhileStatement(this, visitor);
}
@@ -130,7 +130,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
final loopParts = node.forLoopParts;
if (loopParts is ForParts) {
if (_onlyLiterals(loopParts.condition)) {
diff --git a/linter/lib/src/rules/no_adjacent_strings_in_list.dart b/linter/lib/src/rules/no_adjacent_strings_in_list.dart
index 4bf30f5..7be89c9 100644
--- a/linter/lib/src/rules/no_adjacent_strings_in_list.dart
+++ b/linter/lib/src/rules/no_adjacent_strings_in_list.dart
@@ -57,7 +57,7 @@
@override
void visitListLiteral(ListLiteral node) {
- node.elements2.forEach((CollectionElement e) {
+ node.elements.forEach((CollectionElement e) {
if (e is AdjacentStrings) {
rule.reportLint(e);
}
diff --git a/linter/lib/src/rules/omit_local_variable_types.dart b/linter/lib/src/rules/omit_local_variable_types.dart
index 5ffcc0e..b9c8a73 100644
--- a/linter/lib/src/rules/omit_local_variable_types.dart
+++ b/linter/lib/src/rules/omit_local_variable_types.dart
@@ -55,7 +55,7 @@
void registerNodeProcessors(NodeLintRegistry registry,
[LinterContext context]) {
final visitor = new _Visitor(this);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addVariableDeclarationStatement(this, visitor);
}
}
@@ -66,7 +66,7 @@
_Visitor(this.rule);
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
final loopParts = node.forLoopParts;
if (loopParts is ForPartsWithDeclarations) {
_visitVariableDeclarationList(loopParts.variables);
diff --git a/linter/lib/src/rules/prefer_asserts_with_message.dart b/linter/lib/src/rules/prefer_asserts_with_message.dart
new file mode 100644
index 0000000..91c638a
--- /dev/null
+++ b/linter/lib/src/rules/prefer_asserts_with_message.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:linter/src/analyzer.dart';
+
+const _desc = r'Prefer asserts with message.';
+
+const _details = r'''
+
+When assertions fail it's not always simple to understand why. Adding a message
+to the `assert` helps the developer to understand why the AssertionError occurs.
+
+**BAD:**
+```
+f(a) {
+ assert(a != null);
+}
+
+class A {
+ A(a) : assert(a != null);
+}
+```
+
+**GOOD:**
+```
+f(a) {
+ assert(a != null, 'a must not be null');
+}
+
+class A {
+ A(a) : assert(a != null, 'a must not be null');
+}
+```
+
+''';
+
+class PreferAssertsWithMessage extends LintRule implements NodeLintRule {
+ PreferAssertsWithMessage()
+ : super(
+ name: 'prefer_asserts_with_message',
+ description: _desc,
+ details: _details,
+ group: Group.style);
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this);
+ registry.addAssertInitializer(this, visitor);
+ registry.addAssertStatement(this, visitor);
+ }
+}
+
+class _Visitor extends SimpleAstVisitor<void> {
+ final LintRule rule;
+
+ _Visitor(this.rule);
+
+ @override
+ void visitAssertInitializer(AssertInitializer node) {
+ if (node.message == null) {
+ rule.reportLint(node);
+ }
+ }
+
+ @override
+ void visitAssertStatement(AssertStatement node) {
+ if (node.message == null) {
+ rule.reportLint(node);
+ }
+ }
+}
diff --git a/linter/lib/src/rules/prefer_collection_literals.dart b/linter/lib/src/rules/prefer_collection_literals.dart
index 4c7d50d..101737f 100644
--- a/linter/lib/src/rules/prefer_collection_literals.dart
+++ b/linter/lib/src/rules/prefer_collection_literals.dart
@@ -96,10 +96,13 @@
}
}
+ var args = node.argumentList.arguments;
if (constructorName == null) {
- rule.reportLint(node);
+ // Skip: LinkedHashSet(equals: (a, b) => false, hashCode: (o) => 13)
+ if (args.isEmpty) {
+ rule.reportLint(node);
+ }
} else if (constructorName == 'from' || constructorName == 'of') {
- var args = node.argumentList.arguments;
if (args.length != 1) {
return;
}
diff --git a/linter/lib/src/rules/prefer_final_in_for_each.dart b/linter/lib/src/rules/prefer_final_in_for_each.dart
index 700e190..3c6f5bc 100644
--- a/linter/lib/src/rules/prefer_final_in_for_each.dart
+++ b/linter/lib/src/rules/prefer_final_in_for_each.dart
@@ -54,7 +54,7 @@
void registerNodeProcessors(NodeLintRegistry registry,
[LinterContext context]) {
final visitor = new _Visitor(this);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
}
}
@@ -64,7 +64,7 @@
_Visitor(this.rule);
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
var forLoopParts = node.forLoopParts;
// If the following `if` test fails, then either the statement is not a
// for-each loop, or it is something like `for(a in b) { ... }`. In the
diff --git a/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart b/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart
new file mode 100644
index 0000000..5403c48
--- /dev/null
+++ b/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart
@@ -0,0 +1,118 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:linter/src/analyzer.dart';
+
+const _desc = r'Prefer for elements when building maps from iterables.';
+
+const _details = r'''
+When building maps from iterables, it is preferable to use for elements.
+
+**BAD:**
+```
+Map<String, WidgetBuilder>.fromIterable(
+ kAllGalleryDemos,
+ key: (demo) => '${demo.routeName}',
+ value: (demo) => demo.buildRoute,
+);
+
+```
+
+**GOOD:**
+```
+return {
+ for (var demo in kAllGalleryDemos)
+ '${demo.routeName}': demo.buildRoute,
+};
+```
+''';
+
+class PreferForElementsToMapFromIterable extends LintRule
+ implements NodeLintRule {
+ PreferForElementsToMapFromIterable()
+ : super(
+ name: 'prefer_for_elements_to_map_fromIterable',
+ description: _desc,
+ details: _details,
+ group: Group.style);
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this, context);
+ registry.addInstanceCreationExpression(this, visitor);
+ }
+}
+
+class _Visitor extends SimpleAstVisitor<void> {
+ final LintRule rule;
+ final LinterContext context;
+
+ _Visitor(this.rule, this.context);
+
+ @override
+ void visitInstanceCreationExpression(InstanceCreationExpression creation) {
+ ConstructorElement element = creation.staticElement;
+ if (element?.name != 'fromIterable' ||
+ element.enclosingElement != context.typeProvider.mapType.element) {
+ return;
+ }
+
+ //
+ // Ensure that the arguments have the right form.
+ //
+ NodeList<Expression> arguments = creation.argumentList.arguments;
+ if (arguments.length != 3) {
+ return;
+ }
+
+ Expression secondArg = arguments[1];
+ Expression thirdArg = arguments[2];
+
+ Expression extractBody(FunctionExpression expression) {
+ FunctionBody body = expression.body;
+ if (body is ExpressionFunctionBody) {
+ return body.expression;
+ } else if (body is BlockFunctionBody) {
+ NodeList<Statement> statements = body.block.statements;
+ if (statements.length == 1) {
+ Statement statement = statements[0];
+ if (statement is ReturnStatement) {
+ return statement.expression;
+ }
+ }
+ }
+ return null;
+ }
+
+ FunctionExpression extractClosure(String name, Expression argument) {
+ if (argument is NamedExpression && argument.name.label.name == name) {
+ Expression expression = argument.expression.unParenthesized;
+ if (expression is FunctionExpression) {
+ NodeList<FormalParameter> parameters =
+ expression.parameters.parameters;
+ if (parameters.length == 1 && parameters[0].isRequired) {
+ if (extractBody(expression) != null) {
+ return expression;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ FunctionExpression keyClosure =
+ extractClosure('key', secondArg) ?? extractClosure('key', thirdArg);
+ FunctionExpression valueClosure =
+ extractClosure('value', thirdArg) ?? extractClosure('value', secondArg);
+ if (keyClosure == null || valueClosure == null) {
+ return;
+ }
+
+ rule.reportLint(creation);
+ }
+}
diff --git a/linter/lib/src/rules/prefer_foreach.dart b/linter/lib/src/rules/prefer_foreach.dart
index 5feb3ad..b14a015 100644
--- a/linter/lib/src/rules/prefer_foreach.dart
+++ b/linter/lib/src/rules/prefer_foreach.dart
@@ -55,14 +55,14 @@
void registerNodeProcessors(NodeLintRegistry registry,
[LinterContext context]) {
final visitor = new _Visitor(this);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
}
}
class _PreferForEachVisitor extends SimpleAstVisitor {
final LintRule rule;
LocalVariableElement element;
- ForStatement2 forEachStatement;
+ ForStatement forEachStatement;
_PreferForEachVisitor(this.rule);
@@ -79,7 +79,7 @@
}
@override
- visitForStatement2(ForStatement2 node) {
+ visitForStatement2(ForStatement node) {
final loopParts = node.forLoopParts;
if (loopParts is ForEachPartsWithDeclaration) {
final element = loopParts.loopVariable?.declaredElement;
@@ -128,7 +128,7 @@
_Visitor(this.rule);
@override
- visitForStatement2(ForStatement2 node) {
+ visitForStatement2(ForStatement node) {
final loopParts = node.forLoopParts;
if (loopParts is ForEachParts) {
final visitor = new _PreferForEachVisitor(rule);
diff --git a/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart b/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart
new file mode 100644
index 0000000..b7ac8ab
--- /dev/null
+++ b/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:linter/src/analyzer.dart';
+
+const _desc = r'Prefer if elements to conditional expressions where possible.';
+
+const _details = r'''
+When building collections, it is preferable to use `if` elements rather than
+conditionals.
+
+**BAD:**
+```
+Widget build(BuildContext context) {
+ return Row(
+ children: [
+ IconButton(icon: Icon(Icons.menu)),
+ Expanded(child: title),
+ isAndroid ? IconButton(icon: Icon(Icons.search)) : null,
+ ].where((child) => child != null).toList(),
+ );
+}
+```
+
+**GOOD:**
+```
+Widget build(BuildContext context) {
+ return Row(
+ children: [
+ IconButton(icon: Icon(Icons.menu)),
+ Expanded(child: title),
+ if (isAndroid) IconButton(icon: Icon(Icons.search)),
+ ]
+ );
+}
+''';
+
+class PreferIfElementsToConditionalExpressions extends LintRule
+ implements NodeLintRule {
+ PreferIfElementsToConditionalExpressions()
+ : super(
+ name: 'prefer_if_elements_to_conditional_expressions',
+ description: _desc,
+ details: _details,
+ group: Group.style);
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this);
+ registry.addConditionalExpression(this, visitor);
+ }
+}
+
+class _Visitor extends SimpleAstVisitor<void> {
+ final LintRule rule;
+
+ _Visitor(this.rule);
+
+ @override
+ void visitConditionalExpression(ConditionalExpression node) {
+ AstNode nodeToReplace = node;
+ AstNode parent = node.parent;
+ while (parent is ParenthesizedExpression) {
+ nodeToReplace = parent;
+ parent = parent.parent;
+ }
+ if (parent is ListLiteral || (parent is SetOrMapLiteral && parent.isSet)) {
+ rule.reportLint(nodeToReplace);
+ }
+ }
+}
diff --git a/linter/lib/src/rules/prefer_inlined_adds.dart b/linter/lib/src/rules/prefer_inlined_adds.dart
new file mode 100644
index 0000000..8ee6d82
--- /dev/null
+++ b/linter/lib/src/rules/prefer_inlined_adds.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:linter/src/analyzer.dart';
+
+const _desc = r'Inline list item declarations where possible.';
+
+const _details = r'''
+Declare elements in list literals inline, rather than using `add` and
+`addAll` methods where possible.
+
+
+**BAD:**
+```
+var l = ['a']..add('b')..add('c');
+var l2 = ['a']..addAll(['b', 'c'])
+```
+
+**GOOD:**
+```
+var l = ['a', 'b', 'c'];
+var 2 = ['a', 'b', 'c'];
+```
+''';
+
+class PreferInlinedAdds extends LintRule implements NodeLintRule {
+ PreferInlinedAdds()
+ : super(
+ name: 'prefer_inlined_adds',
+ description: _desc,
+ details: _details,
+ group: Group.style);
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this);
+ registry.addMethodInvocation(this, visitor);
+ }
+}
+
+class _Visitor extends SimpleAstVisitor {
+ final LintRule rule;
+
+ _Visitor(this.rule);
+
+ @override
+ void visitMethodInvocation(MethodInvocation invocation) {
+ bool addAll = invocation.methodName.name == 'addAll';
+ if ((invocation.methodName.name != 'add' && !addAll) ||
+ !invocation.isCascaded ||
+ invocation.argumentList.arguments.length != 1) {
+ return;
+ }
+
+ CascadeExpression cascade = invocation.thisOrAncestorOfType();
+ NodeList<Expression> sections = cascade.cascadeSections;
+ Expression target = cascade.target;
+ if (target is! ListLiteral || sections[0] != invocation) {
+ // todo (pq): consider extending to handle set literals.
+ return;
+ }
+
+ if (addAll && invocation.argumentList.arguments[0] is! ListLiteral) {
+ // Handled by: prefer_spread_collections
+ return;
+ }
+
+ rule.reportLint(invocation.methodName);
+ }
+}
diff --git a/linter/lib/src/rules/prefer_iterable_whereType.dart b/linter/lib/src/rules/prefer_iterable_whereType.dart
index 2206963..2ebc879 100644
--- a/linter/lib/src/rules/prefer_iterable_whereType.dart
+++ b/linter/lib/src/rules/prefer_iterable_whereType.dart
@@ -76,7 +76,7 @@
expression = body.expression;
}
expression = expression?.unParenthesized;
- if (expression is IsExpression) {
+ if (expression is IsExpression && expression.notOperator == null) {
final target = expression.expression;
if (target is SimpleIdentifier &&
target.name == arg.parameters.parameters.first.identifier.name) {
diff --git a/linter/lib/src/rules/prefer_spread_collections.dart b/linter/lib/src/rules/prefer_spread_collections.dart
new file mode 100644
index 0000000..e3d45ff
--- /dev/null
+++ b/linter/lib/src/rules/prefer_spread_collections.dart
@@ -0,0 +1,118 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/src/dart/ast/ast.dart'; // ignore: implementation_imports
+import 'package:linter/src/analyzer.dart';
+
+const _desc = r'Use spread collections when possible.';
+
+const _details = r'''
+
+Use spread collections when possible.
+
+Collection literals are excellent when you want to create a new collection out
+of individual items. But, when existing items are already stored in another
+collection, spread collection syntax leads to simpler code.
+
+**BAD:**
+
+```
+Widget build(BuildContext context) {
+ return CupertinoPageScaffold(
+ child: ListView(
+ children: [
+ Tab2Header(),
+ ]..addAll(buildTab2Conversation()),
+ ),
+ );
+}
+```
+
+```
+var ints = [1, 2, 3];
+print(['a']..addAll(ints.map((i) => i.toString()))..addAll(['c']));
+```
+
+```
+var things;
+var l = ['a']..addAll(things ?? const []);
+```
+
+
+**GOOD:**
+
+```
+Widget build(BuildContext context) {
+ return CupertinoPageScaffold(
+ child: ListView(
+ children: [
+ Tab2Header(),
+ ...buildTab2Conversation(),
+ ],
+ ),
+ );
+}
+```
+
+```
+var ints = [1, 2, 3];
+print(['a', ...ints.map((i) => i.toString()), 'c');
+```
+
+```
+var things;
+var l = ['a', ...?things];
+```
+''';
+
+class PreferSpreadCollections extends LintRule implements NodeLintRule {
+ PreferSpreadCollections()
+ : super(
+ name: 'prefer_spread_collections',
+ description: _desc,
+ details: _details,
+ group: Group.style);
+
+ @override
+ void registerNodeProcessors(NodeLintRegistry registry,
+ [LinterContext context]) {
+ final visitor = new _Visitor(this);
+ registry.addMethodInvocation(this, visitor);
+ }
+}
+
+class _Visitor extends SimpleAstVisitor<void> {
+ final LintRule rule;
+
+ _Visitor(this.rule);
+
+ @override
+ void visitMethodInvocation(MethodInvocation invocation) {
+ if (invocation.methodName.name != 'addAll' ||
+ !invocation.isCascaded ||
+ invocation.argumentList.arguments.length != 1) {
+ return;
+ }
+
+ CascadeExpression cascade = invocation.thisOrAncestorOfType();
+ NodeList<Expression> sections = cascade.cascadeSections;
+ Expression target = cascade.target;
+ // todo (pq): add support for Set literals.
+ if (target is! ListLiteral ||
+ (target is ListLiteralImpl && target.inConstantContext) ||
+ sections[0] != invocation) {
+ return;
+ }
+
+ Expression argument = invocation.argumentList.arguments[0];
+ if (argument is ListLiteral) {
+ // Handled by: prefer_inlined_adds
+ return;
+ }
+
+ rule.reportLint(invocation.methodName);
+ }
+}
diff --git a/linter/lib/src/rules/prefer_void_to_null.dart b/linter/lib/src/rules/prefer_void_to_null.dart
index a409c59..767a684 100644
--- a/linter/lib/src/rules/prefer_void_to_null.dart
+++ b/linter/lib/src/rules/prefer_void_to_null.dart
@@ -90,9 +90,9 @@
// <Null>[] or <Null, Null>{}
if (parent is TypeArgumentList) {
final literal = parent.parent;
- if (literal is ListLiteral && literal.elements2.isEmpty) {
+ if (literal is ListLiteral && literal.elements.isEmpty) {
return;
- } else if (literal is SetOrMapLiteral && literal.elements2.isEmpty) {
+ } else if (literal is SetOrMapLiteral && literal.elements.isEmpty) {
return;
}
}
diff --git a/linter/lib/src/rules/unnecessary_await_in_return.dart b/linter/lib/src/rules/unnecessary_await_in_return.dart
index d411989..9d926f5 100644
--- a/linter/lib/src/rules/unnecessary_await_in_return.dart
+++ b/linter/lib/src/rules/unnecessary_await_in_return.dart
@@ -96,7 +96,7 @@
}
if (returnType != null &&
returnType.isDartAsyncFuture &&
- type.isAssignableTo(returnType)) {
+ type.isSubtypeOf(returnType)) {
rule.reportLintForToken((expression as AwaitExpression).awaitKeyword);
}
}
diff --git a/linter/lib/src/rules/unnecessary_parenthesis.dart b/linter/lib/src/rules/unnecessary_parenthesis.dart
index 44746e8..1dd2f35 100644
--- a/linter/lib/src/rules/unnecessary_parenthesis.dart
+++ b/linter/lib/src/rules/unnecessary_parenthesis.dart
@@ -97,7 +97,7 @@
_expressionStartsWithWhitespace(node.expression)) return;
}
- if (parent.precedence2 < node.expression.precedence2) {
+ if (parent.precedence < node.expression.precedence) {
rule.reportLint(node);
return;
}
diff --git a/linter/lib/src/rules/unnecessary_statements.dart b/linter/lib/src/rules/unnecessary_statements.dart
index d65720d..649f8c0 100644
--- a/linter/lib/src/rules/unnecessary_statements.dart
+++ b/linter/lib/src/rules/unnecessary_statements.dart
@@ -58,7 +58,7 @@
[LinterContext context]) {
final visitor = new _Visitor(new _ReportNoClearEffectVisitor(this));
registry.addExpressionStatement(this, visitor);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addCascadeExpression(this, visitor);
}
}
@@ -213,7 +213,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
final loopParts = node.forLoopParts;
if (loopParts is ForPartsWithExpression) {
loopParts.initialization?.accept(reportNoClearEffect);
diff --git a/linter/lib/src/rules/use_string_buffers.dart b/linter/lib/src/rules/use_string_buffers.dart
index aeab7fb..2e032d8 100644
--- a/linter/lib/src/rules/use_string_buffers.dart
+++ b/linter/lib/src/rules/use_string_buffers.dart
@@ -69,7 +69,7 @@
[LinterContext context]) {
final visitor = new _Visitor(this);
registry.addDoStatement(this, visitor);
- registry.addForStatement2(this, visitor);
+ registry.addForStatement(this, visitor);
registry.addWhileStatement(this, visitor);
}
}
@@ -175,7 +175,7 @@
}
@override
- void visitForStatement2(ForStatement2 node) {
+ void visitForStatement2(ForStatement node) {
final visitor = new _UseStringBufferVisitor(rule);
node.body.accept(visitor);
}
diff --git a/linter/lib/src/util/condition_scope_visitor.dart b/linter/lib/src/util/condition_scope_visitor.dart
index 9b2cc7d..ac70709 100644
--- a/linter/lib/src/util/condition_scope_visitor.dart
+++ b/linter/lib/src/util/condition_scope_visitor.dart
@@ -93,10 +93,10 @@
/// When add a new local scope:
/// - Visiting a non-empty function body: [BlockFunctionBody] [ExpressionFunctionBody].
/// - Visiting a flow-control statement: [IfStatement] ElseStatement.
-/// - Visiting loop statements: [DoStatement] [WhileStatement] [ForStatement] [ForStatement2].
+/// - Visiting loop statements: [DoStatement] [WhileStatement] [ForStatement].
///
/// When call the abstract method visitCondition(node.condition):
-/// - After visiting a conditional statements: [IfStatement] [DoStatement] [WhileStatement] [ForStatement2].
+/// - After visiting a conditional statements: [IfStatement] [DoStatement] [WhileStatement].
///
/// When undefine an element:
/// - Visiting reassignments of variables: [AssignmentExpression] [PrefixExpression] [PostfixExpression].
@@ -108,7 +108,7 @@
///
/// When propagate undefined elements:
/// - After visiting a flow-control statement: [IfStatement] ElseStatement.
-/// - After visiting loop statements: [DoStatement] [WhileStatement] [ForStatement] [ForStatement2].
+/// - After visiting loop statements: [DoStatement] [WhileStatement] [ForStatement].
///
/// When add a Condition as true condition:
/// - Inside an if body and after an else body with exit clause.
@@ -180,7 +180,7 @@
}
@override
- visitForStatement2(ForStatement2 node) {
+ visitForStatement(ForStatement node) {
_addScope();
final loopParts = node.forLoopParts;
if (loopParts is ForParts) {
@@ -332,7 +332,7 @@
/// If any of the variables is declared inside the for statement then it does
/// not mean anything afterwards.
- bool _isRelevantOutsideOfForStatement(ForStatement2 node) {
+ bool _isRelevantOutsideOfForStatement(ForStatement node) {
if (breakScope.hasBreak(node)) {
return false;
}
diff --git a/linter/lib/src/util/dart_type_utilities.dart b/linter/lib/src/util/dart_type_utilities.dart
index 226851a..d6af55f 100644
--- a/linter/lib/src/util/dart_type_utilities.dart
+++ b/linter/lib/src/util/dart_type_utilities.dart
@@ -324,7 +324,7 @@
/// * Two types, each representing a type variable, are related if their
/// bounds are related.
/// * Otherwise, the types are related.
- // TODO(srawlins): typedefs :D
+ // TODO(srawlins): typedefs and functions in general.
static bool unrelatedTypes(DartType leftType, DartType rightType) {
// If we don't have enough information, or can't really compare the types,
// return false as they _might_ be related.
@@ -373,9 +373,30 @@
} else if (leftElement is TypeParameterElement &&
rightElement is TypeParameterElement) {
return unrelatedTypes(leftElement.bound, rightElement.bound);
+ } else if (leftType is FunctionType) {
+ if (_isFunctionTypeUnrelatedToType(leftType, rightType)) {
+ return true;
+ }
+ } else if (rightType is FunctionType) {
+ if (_isFunctionTypeUnrelatedToType(rightType, leftType)) {
+ return true;
+ }
}
return false;
}
+
+ static bool _isFunctionTypeUnrelatedToType(
+ FunctionType type1, DartType type2) {
+ if (type2 is FunctionType) {
+ return false;
+ }
+ Element element2 = type2.element;
+ if (element2 is ClassElement &&
+ element2.lookUpConcreteMethod('call', element2.library) != null) {
+ return false;
+ }
+ return true;
+ }
}
class InterfaceTypeDefinition {
diff --git a/linter/lib/src/version.dart b/linter/lib/src/version.dart
index 5deccb1..d2f7505 100644
--- a/linter/lib/src/version.dart
+++ b/linter/lib/src/version.dart
@@ -3,4 +3,4 @@
// BSD-style license that can be found in the LICENSE file.
/// Package version. Synchronized w/ pubspec.yaml.
-const String version = '0.1.83';
+const String version = '0.1.87';
diff --git a/linter/pubspec.yaml b/linter/pubspec.yaml
index e7f478f..e85f8fe 100644
--- a/linter/pubspec.yaml
+++ b/linter/pubspec.yaml
@@ -1,5 +1,5 @@
name: linter
-version: 0.1.83
+version: 0.1.87
author: Dart Team <misc@dartlang.org>
@@ -13,7 +13,7 @@
sdk: '>=2.2.0 <3.0.0'
dependencies:
- analyzer: ^0.35.3
+ analyzer: ^0.36.0
args: '>=1.4.0 <2.0.0'
glob: ^1.0.3
meta: ^1.0.2
@@ -22,9 +22,10 @@
dev_dependencies:
cli_util: ^0.1.2
- dart_style: ^1.1.0
+ dart_style: ^1.2.5
github: ^4.0.1
grinder: ^0.8.0
+ http: ^0.12.0
markdown: ^2.0.0
matcher: ^0.12.0
path: ^1.2.0
diff --git a/linter/tool/bot/version_check.dart b/linter/tool/bot/version_check.dart
new file mode 100644
index 0000000..1fc0e0a
--- /dev/null
+++ b/linter/tool/bot/version_check.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2019, 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:convert';
+import 'dart:io';
+
+import 'package:http/http.dart' as http;
+
+main() async {
+ print('Getting latest linter package info from pub...');
+
+ final packageInfo =
+ jsonDecode(await getBody('https://pub.dartlang.org/api/packages/linter'));
+ final latestVersion = packageInfo['latest']['pubspec']['version'];
+ print('Found: $latestVersion.');
+ print('Checking for a git release tag corresponding to $latestVersion...');
+
+ var client = http.Client();
+ var req = await client
+ .get('https://github.com/dart-lang/linter/releases/tag/$latestVersion');
+
+ if (req.statusCode == 404) {
+ print(
+ 'No tagged release for $latestVersion found; this will cause problems when included in SDK DEPS.');
+ print(
+ 'Be sure a $latestVersion release is tagged in https://github.com/dart-lang/linter/releases and re-run.');
+ exit(1);
+ } else {
+ print('Tag found 👍.');
+ }
+}
+
+final _client = http.Client();
+
+Future<String> getBody(String url) async => (await getResponse(url)).body;
+
+Future<http.Response> getResponse(String url) async => _client.get(url);
diff --git a/linter/tool/scorecard.dart b/linter/tool/scorecard.dart
index 8d31093..c6eea7c 100644
--- a/linter/tool/scorecard.dart
+++ b/linter/tool/scorecard.dart
@@ -136,7 +136,7 @@
void visitNamedExpression(NamedExpression node) {
if (node.name.toString() == 'associatedErrorCodes:') {
ListLiteral list = node.expression;
- for (var element in list.elements2) {
+ for (var element in list.elements) {
var name =
element.toString().substring(1, element.toString().length - 1);
lintNames.add(name);
diff --git a/linter/tool/since/dart_sdk.yaml b/linter/tool/since/dart_sdk.yaml
index 10ef5ce..17269b7 100644
--- a/linter/tool/since/dart_sdk.yaml
+++ b/linter/tool/since/dart_sdk.yaml
@@ -1,3 +1,7 @@
+2.2.1-dev.3.1 : 0.1.83
+2.2.1-dev.3.0 : 0.1.83
+2.2.1-dev.2.1 : 0.1.82
+2.2.1-dev.2.0 : 0.1.82
2.2.1-dev.1.1 : 0.1.82
2.2.1-dev.1.0 : 0.1.82
2.2.1-dev.0.0 : 0.1.82
diff --git a/linter/tool/travis.sh b/linter/tool/travis.sh
index 4f56bfc..f9ad6a8 100755
--- a/linter/tool/travis.sh
+++ b/linter/tool/travis.sh
@@ -7,14 +7,12 @@
# Fast fail the script on failures.
set -e
-# Verify that the libraries are error free.
-dartanalyzer --fatal-warnings \
- bin/linter.dart \
- test/all.dart
-echo ""
+if [ "$LINTER_BOT" = "release" ]; then
+ echo "Validating release..."
+ dart tool/bot/version_check.dart
-if [ "$LINTER_BOT" = "benchmark" ]; then
+elif [ "$LINTER_BOT" = "benchmark" ]; then
echo "Running the linter benchmark..."
# The actual lints can have errors - we don't want to fail the benchmark bot.
@@ -38,6 +36,13 @@
else
echo "Running main linter bot"
+ # Verify that the libraries are error free.
+ dartanalyzer --fatal-warnings \
+ bin/linter.dart \
+ test/all.dart
+
+ echo ""
+
# Run the tests.
dart --enable-asserts test/all.dart
diff --git a/multicast_dns/BUILD.gn b/multicast_dns/BUILD.gn
index ae02c63..a455dbe 100644
--- a/multicast_dns/BUILD.gn
+++ b/multicast_dns/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for multicast_dns-0.1.0+1
+# This file is generated by importer.py for multicast_dns-0.1.1
import("//build/dart/dart_library.gni")
diff --git a/multicast_dns/CHANGELOG.md b/multicast_dns/CHANGELOG.md
index 9d66683..03dcad8 100644
--- a/multicast_dns/CHANGELOG.md
+++ b/multicast_dns/CHANGELOG.md
@@ -1,5 +1,9 @@
+## 0.1.1
+
+* Fixes [flutter/issue/31854](https://github.com/flutter/flutter/issues/31854) where `decodeMDnsResponse` advanced to incorrect code points and ignored some records.
+
## 0.1.0
* Initial Open Source release.
* Migrates the dartino-sdk's mDNS client to Dart 2.0 and Flutter's analysis rules
-* Breaks from original Dartino code, as it does not use native libraries for macOS and overhauls the `ResourceRecord` class.
\ No newline at end of file
+* Breaks from original Dartino code, as it does not use native libraries for macOS and overhauls the `ResourceRecord` class.
diff --git a/multicast_dns/lib/src/native_protocol_client.dart b/multicast_dns/lib/src/native_protocol_client.dart
index bef02bc..553d564 100644
--- a/multicast_dns/lib/src/native_protocol_client.dart
+++ b/multicast_dns/lib/src/native_protocol_client.dart
@@ -42,7 +42,9 @@
// Clear the cache for all name/type combinations to be updated.
final Map<int, Set<String>> seenRecordTypes = <int, Set<String>>{};
for (ResourceRecord record in records) {
- seenRecordTypes[record.resourceRecordType] ??= Set<String>();
+ // TODO(dnfield): Update this to use set literal syntax when we're able to bump the SDK constraint.
+ seenRecordTypes[record.resourceRecordType] ??=
+ Set<String>(); // ignore: prefer_collection_literals
if (seenRecordTypes[record.resourceRecordType].add(record.name)) {
_cache[record.resourceRecordType] ??=
SplayTreeMap<String, List<ResourceRecord>>();
diff --git a/multicast_dns/lib/src/packet.dart b/multicast_dns/lib/src/packet.dart
index 8614f45..eac3f67 100644
--- a/multicast_dns/lib/src/packet.dart
+++ b/multicast_dns/lib/src/packet.dart
@@ -222,11 +222,15 @@
final ByteData packetBytes = ByteData.view(data.buffer);
final int answerCount = packetBytes.getUint16(_kAncountOffset);
- if (answerCount == 0) {
+ final int authorityCount = packetBytes.getUint16(_kNscountOffset);
+ final int additionalCount = packetBytes.getUint16(_kArcountOffset);
+ final int remainingCount = answerCount + authorityCount + additionalCount;
+
+ if (remainingCount == 0) {
return null;
}
- final int answerRecordCount = packetBytes.getUint16(_kArcountOffset);
+ final int questionCount = packetBytes.getUint16(_kQdcountOffset);
int offset = _kHeaderSize;
void checkLength(int required) {
@@ -346,7 +350,14 @@
final List<ResourceRecord> result = <ResourceRecord>[];
try {
- for (int i = 0; i < answerCount + answerRecordCount; i++) {
+ for (int i = 0; i < questionCount; i++) {
+ final _FQDNReadResult result =
+ _readFQDN(data, packetBytes, offset, length);
+ offset += result.bytesRead;
+ checkLength(offset + 4);
+ offset += 4;
+ }
+ for (int i = 0; i < remainingCount; i++) {
final ResourceRecord record = readResourceRecord();
if (record != null) {
result.add(record);
diff --git a/multicast_dns/pubspec.yaml b/multicast_dns/pubspec.yaml
index 8820dff..c1a1174 100644
--- a/multicast_dns/pubspec.yaml
+++ b/multicast_dns/pubspec.yaml
@@ -2,7 +2,7 @@
description: Dart package for mDNS queries (e.g. Bonjour, Avahi).
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/packages/tree/master/packages/multicast_dns
-version: 0.1.0+1
+version: 0.1.1
dependencies:
meta: ^1.1.6
diff --git a/stream_transform/BUILD.gn b/stream_transform/BUILD.gn
index 530ce2d..1e4e037 100644
--- a/stream_transform/BUILD.gn
+++ b/stream_transform/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for stream_transform-0.0.17
+# This file is generated by importer.py for stream_transform-0.0.19
import("//build/dart/dart_library.gni")
diff --git a/stream_transform/CHANGELOG.md b/stream_transform/CHANGELOG.md
index 9b8ab29..e631a97 100644
--- a/stream_transform/CHANGELOG.md
+++ b/stream_transform/CHANGELOG.md
@@ -1,3 +1,12 @@
+## 0.0.19
+
+- Add `asyncMapSample` transform.
+
+## 0.0.18
+
+- Internal cleanup. Passed "trigger" streams or futures now allow `<void>`
+ generic type rather than an implicit `dynamic>`
+
## 0.0.17
- Add concrete types to the `onError` callback in `tap`.
@@ -47,7 +56,7 @@
- Updates to support Dart 2.0 core library changes (wave
2.2). See [issue 31847][sdk#31847] for details.
-
+
[sdk#31847]: https://github.com/dart-lang/sdk/issues/31847
## 0.0.9
diff --git a/stream_transform/README.md b/stream_transform/README.md
index 5d24caf..fc44207 100644
--- a/stream_transform/README.md
+++ b/stream_transform/README.md
@@ -5,6 +5,11 @@
Like `asyncMap` but events are buffered in a List until previous events have
been processed rather than being called for each element individually.
+# asyncMapSample
+
+Like `asyncMap` but events are discarded, keeping only the latest, until
+previous events have been processed rather than being called for every element.
+
# asyncWhere
Like `where` but allows an asynchronous predicate.
diff --git a/stream_transform/analysis_options.yaml b/stream_transform/analysis_options.yaml
index 82dd7e8..67baa3e 100644
--- a/stream_transform/analysis_options.yaml
+++ b/stream_transform/analysis_options.yaml
@@ -2,6 +2,8 @@
analyzer:
strong-mode:
implicit-casts: false
+ language:
+ strict-raw-types: true
errors:
todo: ignore
dead_code: error
diff --git a/stream_transform/lib/src/aggregate_sample.dart b/stream_transform/lib/src/aggregate_sample.dart
new file mode 100644
index 0000000..a069af7
--- /dev/null
+++ b/stream_transform/lib/src/aggregate_sample.dart
@@ -0,0 +1,116 @@
+// Copyright (c) 2019, 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';
+
+/// A StreamTransformer which aggregates values and emits when it sees a value
+/// on [_trigger].
+///
+/// If there are no pending values when [_trigger] emits the first value on the
+/// source Stream will immediately flow through. Otherwise, the pending values
+/// and released when [_trigger] emits.
+///
+/// Errors from the source stream or the trigger are immediately forwarded to
+/// the output.
+class AggregateSample<S, T> extends StreamTransformerBase<S, T> {
+ final Stream<void> _trigger;
+ final T Function(S, T) _aggregate;
+
+ AggregateSample(this._trigger, this._aggregate);
+
+ @override
+ Stream<T> bind(Stream<S> values) {
+ var controller = values.isBroadcast
+ ? StreamController<T>.broadcast(sync: true)
+ : StreamController<T>(sync: true);
+
+ T currentResults;
+ var waitingForTrigger = true;
+ var isTriggerDone = false;
+ var isValueDone = false;
+ StreamSubscription<S> valueSub;
+ StreamSubscription<void> triggerSub;
+
+ emit() {
+ controller.add(currentResults);
+ currentResults = null;
+ waitingForTrigger = true;
+ }
+
+ onValue(S value) {
+ currentResults = _aggregate(value, currentResults);
+
+ if (!waitingForTrigger) emit();
+
+ if (isTriggerDone) {
+ valueSub.cancel();
+ controller.close();
+ }
+ }
+
+ onValuesDone() {
+ isValueDone = true;
+ if (currentResults == null) {
+ triggerSub?.cancel();
+ controller.close();
+ }
+ }
+
+ onTrigger(_) {
+ waitingForTrigger = false;
+
+ if (currentResults != null) emit();
+
+ if (isValueDone) {
+ triggerSub.cancel();
+ controller.close();
+ }
+ }
+
+ onTriggerDone() {
+ isTriggerDone = true;
+ if (waitingForTrigger) {
+ valueSub?.cancel();
+ controller.close();
+ }
+ }
+
+ controller.onListen = () {
+ assert(valueSub == null);
+ valueSub = values.listen(onValue,
+ onError: controller.addError, onDone: onValuesDone);
+ if (triggerSub != null) {
+ if (triggerSub.isPaused) triggerSub.resume();
+ } else {
+ triggerSub = _trigger.listen(onTrigger,
+ onError: controller.addError, onDone: onTriggerDone);
+ }
+ if (!values.isBroadcast) {
+ controller
+ ..onPause = () {
+ valueSub?.pause();
+ triggerSub?.pause();
+ }
+ ..onResume = () {
+ valueSub?.resume();
+ triggerSub?.resume();
+ };
+ }
+ controller.onCancel = () {
+ var toCancel = <StreamSubscription<void>>[];
+ if (!isValueDone) toCancel.add(valueSub);
+ valueSub = null;
+ if (_trigger.isBroadcast || !values.isBroadcast) {
+ if (!isTriggerDone) toCancel.add(triggerSub);
+ triggerSub = null;
+ } else {
+ triggerSub.pause();
+ }
+ if (toCancel.isEmpty) return null;
+ return Future.wait(toCancel.map((s) => s.cancel()));
+ };
+ };
+ return controller.stream;
+ }
+}
diff --git a/stream_transform/lib/src/async_map_buffer.dart b/stream_transform/lib/src/async_map_buffer.dart
index fd25a21..70c5bdb 100644
--- a/stream_transform/lib/src/async_map_buffer.dart
+++ b/stream_transform/lib/src/async_map_buffer.dart
@@ -4,6 +4,7 @@
import 'dart:async';
+import 'aggregate_sample.dart';
import 'buffer.dart';
import 'chain_transformers.dart';
import 'from_handlers.dart';
@@ -27,20 +28,49 @@
/// The result stream will not close until the source stream closes and all
/// pending conversions have finished.
StreamTransformer<S, T> asyncMapBuffer<S, T>(
- Future<T> convert(List<S> collected)) {
- var workFinished = StreamController()
+ Future<T> Function(List<S>) convert) {
+ var workFinished = StreamController<void>()
// Let the first event through.
..add(null);
return chainTransformers(
buffer(workFinished.stream), _asyncMapThen(convert, workFinished.add));
}
+/// Like [Stream.asyncMap] but events are discarded while work is happening in
+/// [convert].
+///
+/// If the source stream is a broadcast stream the result will be as well. When
+/// used with a broadcast stream behavior also differs from [Stream.asyncMap] in
+/// that the [convert] function is only called once per event, rather than once
+/// per listener per event.
+///
+/// If no work is happening when an event is emitted it will be immediately
+/// passed to [convert]. If there is ongoing work when an event is emitted it
+/// will be held until the work is finished. New events emitted will replace a
+/// pending event.
+///
+/// Errors from the source stream are forwarded directly to the result stream.
+/// Errors during the conversion are also forwarded to the result stream and are
+/// considered completing work so the next values are let through.
+///
+/// The result stream will not close until the source stream closes and all
+/// pending conversions have finished.
+StreamTransformer<S, T> asyncMapSample<S, T>(Future<T> Function(S) convert) {
+ var workFinished = StreamController<void>()
+ // Let the first event through.
+ ..add(null);
+ return chainTransformers(AggregateSample(workFinished.stream, _dropPrevious),
+ _asyncMapThen(convert, workFinished.add));
+}
+
+T _dropPrevious<T>(T event, _) => event;
+
/// Like [Stream.asyncMap] but the [convert] is only called once per event,
/// rather than once per listener, and [then] is called after completing the
/// work.
StreamTransformer<S, T> _asyncMapThen<S, T>(
- Future<T> convert(S event), void then(Object _)) {
- Future pendingEvent;
+ Future<T> convert(S event), void Function(void) then) {
+ Future<void> pendingEvent;
return fromHandlers(handleData: (event, sink) {
pendingEvent =
convert(event).then(sink.add).catchError(sink.addError).then(then);
diff --git a/stream_transform/lib/src/buffer.dart b/stream_transform/lib/src/buffer.dart
index d09d2da..3478a52 100644
--- a/stream_transform/lib/src/buffer.dart
+++ b/stream_transform/lib/src/buffer.dart
@@ -1,8 +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.
+
import 'dart:async';
+import 'aggregate_sample.dart';
+
/// Creates a [StreamTransformer] which collects values and emits when it sees a
/// value on [trigger].
///
@@ -12,114 +15,7 @@
///
/// Errors from the source stream or the trigger are immediately forwarded to
/// the output.
-StreamTransformer<T, List<T>> buffer<T>(Stream trigger) => _Buffer<T>(trigger);
+StreamTransformer<T, List<T>> buffer<T>(Stream<void> trigger) =>
+ AggregateSample<T, List<T>>(trigger, _collect);
-/// A StreamTransformer which aggregates values and emits when it sees a value
-/// on [_trigger].
-///
-/// If there are no pending values when [_trigger] emits the first value on the
-/// source Stream will immediately flow through. Otherwise, the pending values
-/// and released when [_trigger] emits.
-///
-/// Errors from the source stream or the trigger are immediately forwarded to
-/// the output.
-class _Buffer<T> extends StreamTransformerBase<T, List<T>> {
- final Stream _trigger;
-
- _Buffer(this._trigger);
-
- @override
- Stream<List<T>> bind(Stream<T> values) {
- var controller = values.isBroadcast
- ? StreamController<List<T>>.broadcast(sync: true)
- : StreamController<List<T>>(sync: true);
-
- List<T> currentResults;
- var waitingForTrigger = true;
- var isTriggerDone = false;
- var isValueDone = false;
- StreamSubscription valueSub;
- StreamSubscription triggerSub;
-
- emit() {
- controller.add(currentResults);
- currentResults = null;
- waitingForTrigger = true;
- }
-
- onValue(T value) {
- (currentResults ??= <T>[]).add(value);
-
- if (!waitingForTrigger) emit();
-
- if (isTriggerDone) {
- valueSub.cancel();
- controller.close();
- }
- }
-
- onValuesDone() {
- isValueDone = true;
- if (currentResults == null) {
- triggerSub?.cancel();
- controller.close();
- }
- }
-
- onTrigger(_) {
- waitingForTrigger = false;
-
- if (currentResults != null) emit();
-
- if (isValueDone) {
- triggerSub.cancel();
- controller.close();
- }
- }
-
- onTriggerDone() {
- isTriggerDone = true;
- if (waitingForTrigger) {
- valueSub?.cancel();
- controller.close();
- }
- }
-
- controller.onListen = () {
- assert(valueSub == null);
- valueSub = values.listen(onValue,
- onError: controller.addError, onDone: onValuesDone);
- if (triggerSub != null) {
- if (triggerSub.isPaused) triggerSub.resume();
- } else {
- triggerSub = _trigger.listen(onTrigger,
- onError: controller.addError, onDone: onTriggerDone);
- }
- if (!values.isBroadcast) {
- controller
- ..onPause = () {
- valueSub?.pause();
- triggerSub?.pause();
- }
- ..onResume = () {
- valueSub?.resume();
- triggerSub?.resume();
- };
- }
- controller.onCancel = () {
- var toCancel = <StreamSubscription>[];
- if (!isValueDone) toCancel.add(valueSub);
- valueSub = null;
- if (_trigger.isBroadcast || !values.isBroadcast) {
- if (!isTriggerDone) toCancel.add(triggerSub);
- triggerSub = null;
- } else {
- triggerSub.pause();
- }
- if (toCancel.isEmpty) return null;
- return Future.wait(toCancel.map((s) => s.cancel()));
- };
- };
- return controller.stream;
- }
-}
+List<T> _collect<T>(T event, List<T> soFar) => (soFar ?? <T>[])..add(event);
diff --git a/stream_transform/lib/src/combine_latest.dart b/stream_transform/lib/src/combine_latest.dart
index 1fe7d85..489f344 100644
--- a/stream_transform/lib/src/combine_latest.dart
+++ b/stream_transform/lib/src/combine_latest.dart
@@ -51,8 +51,8 @@
? _other.asBroadcastStream()
: _other;
- StreamSubscription sourceSubscription;
- StreamSubscription otherSubscription;
+ StreamSubscription<S> sourceSubscription;
+ StreamSubscription<T> otherSubscription;
var sourceDone = false;
var otherDone = false;
diff --git a/stream_transform/lib/src/combine_latest_all.dart b/stream_transform/lib/src/combine_latest_all.dart
index 16f2e80..045ccdc 100644
--- a/stream_transform/lib/src/combine_latest_all.dart
+++ b/stream_transform/lib/src/combine_latest_all.dart
@@ -60,7 +60,7 @@
.toList();
}
- List<StreamSubscription> subscriptions;
+ List<StreamSubscription<T>> subscriptions;
controller.onListen = () {
assert(subscriptions == null);
diff --git a/stream_transform/lib/src/followed_by.dart b/stream_transform/lib/src/followed_by.dart
index 779831f..3c5c6b3 100644
--- a/stream_transform/lib/src/followed_by.dart
+++ b/stream_transform/lib/src/followed_by.dart
@@ -33,7 +33,7 @@
? _next.asBroadcastStream()
: _next;
- StreamSubscription subscription;
+ StreamSubscription<T> subscription;
var currentStream = first;
var firstDone = false;
var secondDone = false;
diff --git a/stream_transform/lib/src/merge.dart b/stream_transform/lib/src/merge.dart
index a5b4cf3..74a1e1a 100644
--- a/stream_transform/lib/src/merge.dart
+++ b/stream_transform/lib/src/merge.dart
@@ -39,7 +39,7 @@
.toList();
}
- List<StreamSubscription> subscriptions;
+ List<StreamSubscription<T>> subscriptions;
controller.onListen = () {
assert(subscriptions == null);
diff --git a/stream_transform/lib/src/switch.dart b/stream_transform/lib/src/switch.dart
index 2f24704..e02917d 100644
--- a/stream_transform/lib/src/switch.dart
+++ b/stream_transform/lib/src/switch.dart
@@ -69,7 +69,7 @@
};
}
controller.onCancel = () {
- var toCancel = <StreamSubscription>[];
+ var toCancel = <StreamSubscription<void>>[];
if (!outerStreamDone) toCancel.add(outerSubscription);
if (innerSubscription != null) {
toCancel.add(innerSubscription);
diff --git a/stream_transform/lib/src/take_until.dart b/stream_transform/lib/src/take_until.dart
index 62b1013..ad12ae8 100644
--- a/stream_transform/lib/src/take_until.dart
+++ b/stream_transform/lib/src/take_until.dart
@@ -10,10 +10,11 @@
/// which are emitted before the trigger, but have further asynchronous delays
/// in transformations following the takeUtil, will still go through. Cancelling
/// a subscription immediately stops values.
-StreamTransformer<T, T> takeUntil<T>(Future trigger) => _TakeUntil(trigger);
+StreamTransformer<T, T> takeUntil<T>(Future<void> trigger) =>
+ _TakeUntil(trigger);
class _TakeUntil<T> extends StreamTransformerBase<T, T> {
- final Future _trigger;
+ final Future<void> _trigger;
_TakeUntil(this._trigger);
@@ -23,7 +24,7 @@
? StreamController<T>.broadcast(sync: true)
: StreamController<T>(sync: true);
- StreamSubscription subscription;
+ StreamSubscription<T> subscription;
var isDone = false;
_trigger.then((_) {
if (isDone) return;
diff --git a/stream_transform/pubspec.yaml b/stream_transform/pubspec.yaml
index a9be968..38ad8d5 100644
--- a/stream_transform/pubspec.yaml
+++ b/stream_transform/pubspec.yaml
@@ -2,7 +2,7 @@
description: A collection of utilities to transform and manipulate streams.
author: Dart Team <misc@dartlang.org>
homepage: https://www.github.com/dart-lang/stream_transform
-version: 0.0.17
+version: 0.0.19
environment:
sdk: ">=2.2.0 <3.0.0"
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 02285cd..40e1049 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for test-1.6.2
+# This file is generated by importer.py for test-1.6.3
import("//build/dart/dart_library.gni")
diff --git a/test/CHANGELOG.md b/test/CHANGELOG.md
index ed467e4..954c787 100644
--- a/test/CHANGELOG.md
+++ b/test/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 1.6.3
+
+* Depend on latests `package:test_core`.
+ * This fixes an issue where non-completed tests were considered passing.
+
## 1.6.2
* Avoid `dart:isolate` imports on code loaded in tests.
diff --git a/test/pubspec.yaml b/test/pubspec.yaml
index 9bf320c..862e06e 100644
--- a/test/pubspec.yaml
+++ b/test/pubspec.yaml
@@ -1,5 +1,5 @@
name: test
-version: 1.6.2
+version: 1.6.3
author: Dart Team <misc@dartlang.org>
description: A full featured library for writing and running Dart tests.
homepage: https://github.com/dart-lang/test/blob/master/pkgs/test
@@ -34,7 +34,7 @@
yaml: ^2.0.0
# Use an exact version until the test_api and test_core package are stable.
test_api: 0.2.5
- test_core: 0.2.4
+ test_core: 0.2.5
dev_dependencies:
fake_async: ^1.0.0
@@ -42,8 +42,4 @@
test_descriptor: ^1.0.0
test_process: ^1.0.0
-# dependency_overrides:
-# test_api:
-# path: ./../test_api
-# test_core:
-# path: ./../test_core
+
diff --git a/test_core/BUILD.gn b/test_core/BUILD.gn
index 4752f4d..511082e 100644
--- a/test_core/BUILD.gn
+++ b/test_core/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for test_core-0.2.4
+# This file is generated by importer.py for test_core-0.2.5
import("//build/dart/dart_library.gni")
diff --git a/test_core/CHANGELOG.md b/test_core/CHANGELOG.md
index a02302f..fa53a1c 100644
--- a/test_core/CHANGELOG.md
+++ b/test_core/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.2.5
+
+* Fix an issue where non-completed tests were considered passing.
+* Updated `compact` and `expanded` reporters to display non-completed tests.
+
## 0.2.4
* Avoid `dart:isolate` imports on code loaded in tests.
diff --git a/test_core/lib/src/runner/engine.dart b/test_core/lib/src/runner/engine.dart
index 5f1b2c1..812d47e 100644
--- a/test_core/lib/src/runner/engine.dart
+++ b/test_core/lib/src/runner/engine.dart
@@ -95,7 +95,9 @@
await Future.wait(<Future>[_group.future, _loadPool.done],
eagerError: true);
if (_closedBeforeDone) return null;
- return liveTests.every((liveTest) => liveTest.state.result.isPassing);
+ return liveTests.every((liveTest) =>
+ liveTest.state.result.isPassing &&
+ liveTest.state.status == Status.complete);
}
/// A group of futures for each test suite.
diff --git a/test_core/lib/src/runner/reporter/compact.dart b/test_core/lib/src/runner/reporter/compact.dart
index 30d0356..a0a6507 100644
--- a/test_core/lib/src/runner/reporter/compact.dart
+++ b/test_core/lib/src/runner/reporter/compact.dart
@@ -253,6 +253,12 @@
if (!_printedNewline) stdout.write(" " * (lineLength - message.length));
stdout.writeln();
} else if (!success) {
+ for (var liveTest in _engine.active) {
+ _progressLine(_description(liveTest),
+ truncate: false,
+ suffix: " - did not complete $_bold$_red[E]$_noColor");
+ print('');
+ }
_progressLine('Some tests failed.', color: _red);
print('');
} else if (_engine.passed.isEmpty) {
diff --git a/test_core/lib/src/runner/reporter/expanded.dart b/test_core/lib/src/runner/reporter/expanded.dart
index ef6c225..d2b3454 100644
--- a/test_core/lib/src/runner/reporter/expanded.dart
+++ b/test_core/lib/src/runner/reporter/expanded.dart
@@ -222,6 +222,10 @@
if (_engine.liveTests.isEmpty) {
print("No tests ran.");
} else if (!success) {
+ for (var liveTest in _engine.active) {
+ _progressLine(_description(liveTest),
+ suffix: " - did not complete $_bold$_red[E]$_noColor");
+ }
_progressLine('Some tests failed.', color: _red);
} else if (_engine.passed.isEmpty) {
_progressLine("All tests skipped.");
diff --git a/test_core/pubspec.yaml b/test_core/pubspec.yaml
index d922888..a026fbd 100644
--- a/test_core/pubspec.yaml
+++ b/test_core/pubspec.yaml
@@ -1,5 +1,5 @@
name: test_core
-version: 0.2.4
+version: 0.2.5
author: Dart Team <misc@dartlang.org>
description: A basic library for writing tests and running them on the VM.
homepage: https://github.com/dart-lang/test/blob/master/pkgs/test_core
@@ -33,7 +33,3 @@
matcher: ">=0.12.5 <0.12.6"
# Use an exact version until the test_api package is stable.
test_api: 0.2.5
-
-# dependency_overrides:
-# test_api:
-# path: ./../test_api
diff --git a/video_player/BUILD.gn b/video_player/BUILD.gn
index 745cdfc..26b49a4 100644
--- a/video_player/BUILD.gn
+++ b/video_player/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for video_player-0.10.0+5
+# This file is generated by importer.py for video_player-0.10.0+8
import("//build/dart/dart_library.gni")
diff --git a/video_player/CHANGELOG.md b/video_player/CHANGELOG.md
index 2cc77e4..e3e9d9d 100644
--- a/video_player/CHANGELOG.md
+++ b/video_player/CHANGELOG.md
@@ -1,3 +1,20 @@
+## 0.10.0+8
+
+* iOS: Fix an issue where the player sends initialization message incorrectly.
+
+* Fix a few other IDE warnings.
+
+
+## 0.10.0+7
+
+* Android: Fix issue where buffering status in percentage instead of milliseconds
+
+* Android: Update buffering status everytime we notify for position change
+
+## 0.10.0+6
+
+* Android: Fix missing call to `event.put("event", "completed");` which makes it possible to detect when the video is over.
+
## 0.10.0+5
* Fixed iOS build warnings about implicit retains.
diff --git a/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java b/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
index de4f44c..0be5e77 100644
--- a/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
+++ b/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
@@ -8,16 +8,16 @@
import static com.google.android.exoplayer2.Player.REPEAT_MODE_OFF;
import android.content.Context;
-import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
+import android.util.LongSparseArray;
import android.view.Surface;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.Player;
-import com.google.android.exoplayer2.Player.DefaultEventListener;
+import com.google.android.exoplayer2.Player.EventListener;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
@@ -52,8 +52,6 @@
public class VideoPlayerPlugin implements MethodCallHandler {
- private static final String TAG = "VideoPlayerPlugin";
-
private static class VideoPlayer {
private SimpleExoPlayer exoPlayer;
@@ -83,7 +81,7 @@
Uri uri = Uri.parse(dataSource);
DataSource.Factory dataSourceFactory;
- if (uri.getScheme().equals("asset") || uri.getScheme().equals("file")) {
+ if (isFileOrAsset(uri)) {
dataSourceFactory = new DefaultDataSourceFactory(context, "ExoPlayer");
} else {
dataSourceFactory =
@@ -101,6 +99,14 @@
setupVideoPlayer(eventChannel, textureEntry, result);
}
+ private static boolean isFileOrAsset(Uri uri) {
+ if (uri == null || uri.getScheme() == null) {
+ return false;
+ }
+ String scheme = uri.getScheme();
+ return scheme.equals("file") || scheme.equals("asset");
+ }
+
private MediaSource buildMediaSource(
Uri uri, DataSource.Factory mediaDataSourceFactory, Context context) {
int type = Util.inferContentType(uri.getLastPathSegment());
@@ -151,27 +157,26 @@
setAudioAttributes(exoPlayer);
exoPlayer.addListener(
- new DefaultEventListener() {
+ new EventListener() {
@Override
public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) {
- super.onPlayerStateChanged(playWhenReady, playbackState);
if (playbackState == Player.STATE_BUFFERING) {
+ sendBufferingUpdate();
+ } else if (playbackState == Player.STATE_READY) {
+ if (!isInitialized) {
+ isInitialized = true;
+ sendInitialized();
+ }
+ } else if (playbackState == Player.STATE_ENDED) {
Map<String, Object> event = new HashMap<>();
- event.put("event", "bufferingUpdate");
- List<Integer> range = Arrays.asList(0, exoPlayer.getBufferedPercentage());
- // iOS supports a list of buffered ranges, so here is a list with a single range.
- event.put("values", Collections.singletonList(range));
+ event.put("event", "completed");
eventSink.success(event);
- } else if (playbackState == Player.STATE_READY && !isInitialized) {
- isInitialized = true;
- sendInitialized();
}
}
@Override
public void onPlayerError(final ExoPlaybackException error) {
- super.onPlayerError(error);
if (eventSink != null) {
eventSink.error("VideoError", "Video player had error " + error, null);
}
@@ -183,13 +188,22 @@
result.success(reply);
}
+ private void sendBufferingUpdate() {
+ Map<String, Object> event = new HashMap<>();
+ event.put("event", "bufferingUpdate");
+ List<? extends Number> range = Arrays.asList(0, exoPlayer.getBufferedPosition());
+ // iOS supports a list of buffered ranges, so here is a list with a single range.
+ event.put("values", Collections.singletonList(range));
+ eventSink.success(event);
+ }
+
@SuppressWarnings("deprecation")
private static void setAudioAttributes(SimpleExoPlayer exoPlayer) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
exoPlayer.setAudioAttributes(
new AudioAttributes.Builder().setContentType(C.CONTENT_TYPE_MOVIE).build());
} else {
- exoPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ exoPlayer.setAudioStreamType(C.STREAM_TYPE_MUSIC);
}
}
@@ -218,6 +232,7 @@
return exoPlayer.getCurrentPosition();
}
+ @SuppressWarnings("SuspiciousNameCombination")
private void sendInitialized() {
if (isInitialized) {
Map<String, Object> event = new HashMap<>();
@@ -273,22 +288,26 @@
private VideoPlayerPlugin(Registrar registrar) {
this.registrar = registrar;
- this.videoPlayers = new HashMap<>();
+ this.videoPlayers = new LongSparseArray<>();
}
- private final Map<Long, VideoPlayer> videoPlayers;
+ private final LongSparseArray<VideoPlayer> videoPlayers;
private final Registrar registrar;
- void onDestroy() {
+ private void disposeAllPlayers() {
+ for (int i = 0; i < videoPlayers.size(); i++) {
+ videoPlayers.valueAt(i).dispose();
+ }
+ videoPlayers.clear();
+ }
+
+ private void onDestroy() {
// The whole FlutterView is being destroyed. Here we release resources acquired for all instances
// of VideoPlayer. Once https://github.com/flutter/flutter/issues/19358 is resolved this may
// be replaced with just asserting that videoPlayers.isEmpty().
// https://github.com/flutter/flutter/issues/20989 tracks this.
- for (VideoPlayer player : videoPlayers.values()) {
- player.dispose();
- }
- videoPlayers.clear();
+ disposeAllPlayers();
}
@Override
@@ -300,10 +319,7 @@
}
switch (call.method) {
case "init":
- for (VideoPlayer player : videoPlayers.values()) {
- player.dispose();
- }
- videoPlayers.clear();
+ disposeAllPlayers();
break;
case "create":
{
@@ -317,10 +333,9 @@
String assetLookupKey;
if (call.argument("package") != null) {
assetLookupKey =
- registrar.lookupKeyForAsset(
- (String) call.argument("asset"), (String) call.argument("package"));
+ registrar.lookupKeyForAsset(call.argument("asset"), call.argument("package"));
} else {
- assetLookupKey = registrar.lookupKeyForAsset((String) call.argument("asset"));
+ assetLookupKey = registrar.lookupKeyForAsset(call.argument("asset"));
}
player =
new VideoPlayer(
@@ -333,11 +348,7 @@
} else {
player =
new VideoPlayer(
- registrar.context(),
- eventChannel,
- handle,
- (String) call.argument("uri"),
- result);
+ registrar.context(), eventChannel, handle, call.argument("uri"), result);
videoPlayers.put(handle.id(), player);
}
break;
@@ -362,11 +373,11 @@
private void onMethodCall(MethodCall call, Result result, long textureId, VideoPlayer player) {
switch (call.method) {
case "setLooping":
- player.setLooping((Boolean) call.argument("looping"));
+ player.setLooping(call.argument("looping"));
result.success(null);
break;
case "setVolume":
- player.setVolume((Double) call.argument("volume"));
+ player.setVolume(call.argument("volume"));
result.success(null);
break;
case "play":
@@ -384,6 +395,7 @@
break;
case "position":
result.success(player.getPosition());
+ player.sendBufferingUpdate();
break;
case "dispose":
player.dispose();
diff --git a/video_player/ios/Classes/VideoPlayerPlugin.m b/video_player/ios/Classes/VideoPlayerPlugin.m
index 5554b21..ded94ab 100644
--- a/video_player/ios/Classes/VideoPlayerPlugin.m
+++ b/video_player/ios/Classes/VideoPlayerPlugin.m
@@ -39,7 +39,7 @@
@property(nonatomic) CGAffineTransform preferredTransform;
@property(nonatomic, readonly) bool disposed;
@property(nonatomic, readonly) bool isPlaying;
-@property(nonatomic, readonly) bool isLooping;
+@property(nonatomic) bool isLooping;
@property(nonatomic, readonly) bool isInitialized;
- (instancetype)initWithURL:(NSURL*)url frameUpdater:(FLTFrameUpdater*)frameUpdater;
- (void)play;
@@ -97,6 +97,17 @@
}];
}
+static inline CGFloat radiansToDegrees(CGFloat radians) {
+ // Input range [-pi, pi] or [-180, 180]
+ CGFloat degrees = GLKMathRadiansToDegrees((float)radians);
+ if (degrees < 0) {
+ // Convert -90 to 270 and -180 to 180
+ return degrees + 360;
+ }
+ // Output degrees in between [0, 360[
+ return degrees;
+};
+
- (AVMutableVideoComposition*)getVideoCompositionWithTransform:(CGAffineTransform)transform
withAsset:(AVAsset*)asset
withVideoTrack:(AVAssetTrack*)videoTrack {
@@ -113,8 +124,8 @@
videoComposition.instructions = @[ instruction ];
// If in portrait mode, switch the width and height of the video
- float width = videoTrack.naturalSize.width;
- float height = videoTrack.naturalSize.height;
+ CGFloat width = videoTrack.naturalSize.width;
+ CGFloat height = videoTrack.naturalSize.height;
NSInteger rotationDegrees =
(NSInteger)round(radiansToDegrees(atan2(_preferredTransform.b, _preferredTransform.a)));
if (rotationDegrees == 90 || rotationDegrees == 270) {
@@ -183,7 +194,7 @@
if ([asset statusOfValueForKey:@"tracks" error:nil] == AVKeyValueStatusLoaded) {
NSArray* tracks = [asset tracksWithMediaType:AVMediaTypeVideo];
if ([tracks count] > 0) {
- AVAssetTrack* videoTrack = [tracks objectAtIndex:0];
+ AVAssetTrack* videoTrack = tracks[0];
void (^trackCompletionHandler)(void) = ^{
if (self->_disposed) return;
if ([videoTrack statusOfValueForKey:@"preferredTransform"
@@ -236,7 +247,7 @@
} else if (context == statusContext) {
AVPlayerItem* item = (AVPlayerItem*)object;
switch (item.status) {
- case AVPlayerStatusFailed:
+ case AVPlayerItemStatusFailed:
if (_eventSink != nil) {
_eventSink([FlutterError
errorWithCode:@"VideoError"
@@ -248,7 +259,6 @@
case AVPlayerItemStatusUnknown:
break;
case AVPlayerItemStatusReadyToPlay:
- _isInitialized = true;
[item addOutput:_videoOutput];
[self sendInitialized];
[self updatePlayingState];
@@ -284,23 +294,18 @@
_displayLink.paused = !_isPlaying;
}
-static inline CGFloat radiansToDegrees(CGFloat radians) {
- // Input range [-pi, pi] or [-180, 180]
- CGFloat degrees = GLKMathRadiansToDegrees(radians);
- if (degrees < 0) {
- // Convert -90 to 270 and -180 to 180
- return degrees + 360;
- }
- // Output degrees in between [0, 360[
- return degrees;
-};
-
- (void)sendInitialized {
- if (_eventSink && _isInitialized) {
+ if (_eventSink && !_isInitialized) {
CGSize size = [self.player currentItem].presentationSize;
CGFloat width = size.width;
CGFloat height = size.height;
+ // The player has not yet initialized.
+ if (height == CGSizeZero.height && width == CGSizeZero.width) {
+ return;
+ }
+
+ _isInitialized = true;
_eventSink(@{
@"event" : @"initialized",
@"duration" : @([self duration]),
@@ -339,7 +344,7 @@
}
- (void)setVolume:(double)volume {
- _player.volume = (volume < 0.0) ? 0.0 : ((volume > 1.0) ? 1.0 : volume);
+ _player.volume = (float)((volume < 0.0) ? 0.0 : ((volume > 1.0) ? 1.0 : volume));
}
- (CVPixelBufferRef)copyPixelBuffer {
@@ -440,7 +445,7 @@
for (NSNumber* textureId in _players) {
[_registry unregisterTexture:[textureId unsignedIntegerValue]];
- [[_players objectForKey:textureId] dispose];
+ [_players[textureId] dispose];
}
[_players removeAllObjects];
result(nil);
@@ -478,10 +483,10 @@
[player dispose];
result(nil);
} else if ([@"setLooping" isEqualToString:call.method]) {
- [player setIsLooping:[[argsMap objectForKey:@"looping"] boolValue]];
+ [player setIsLooping:[argsMap[@"looping"] boolValue]];
result(nil);
} else if ([@"setVolume" isEqualToString:call.method]) {
- [player setVolume:[[argsMap objectForKey:@"volume"] doubleValue]];
+ [player setVolume:[argsMap[@"volume"] doubleValue]];
result(nil);
} else if ([@"play" isEqualToString:call.method]) {
[player play];
@@ -489,7 +494,7 @@
} else if ([@"position" isEqualToString:call.method]) {
result(@([player position]));
} else if ([@"seekTo" isEqualToString:call.method]) {
- [player seekTo:[[argsMap objectForKey:@"location"] intValue]];
+ [player seekTo:[argsMap[@"location"] intValue]];
result(nil);
} else if ([@"pause" isEqualToString:call.method]) {
[player pause];
diff --git a/video_player/lib/video_player.dart b/video_player/lib/video_player.dart
index 441057d..ce4ac70 100644
--- a/video_player/lib/video_player.dart
+++ b/video_player/lib/video_player.dart
@@ -242,7 +242,7 @@
_applyPlayPause();
break;
case 'completed':
- value = value.copyWith(isPlaying: false);
+ value = value.copyWith(isPlaying: false, position: value.duration);
_timer?.cancel();
break;
case 'bufferingUpdate':
diff --git a/video_player/pubspec.yaml b/video_player/pubspec.yaml
index 8cae1f2..e469a12 100644
--- a/video_player/pubspec.yaml
+++ b/video_player/pubspec.yaml
@@ -2,7 +2,7 @@
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android and iOS.
author: Flutter Team <flutter-dev@googlegroups.com>
-version: 0.10.0+5
+version: 0.10.0+8
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player
flutter:
diff --git a/vm_service_client/BUILD.gn b/vm_service_client/BUILD.gn
index fd45d89..cab548b 100644
--- a/vm_service_client/BUILD.gn
+++ b/vm_service_client/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for vm_service_client-0.2.6+1
+# This file is generated by importer.py for vm_service_client-0.2.6+2
import("//build/dart/dart_library.gni")
diff --git a/vm_service_client/CHANGELOG.md b/vm_service_client/CHANGELOG.md
index b98e767..75ea04d 100644
--- a/vm_service_client/CHANGELOG.md
+++ b/vm_service_client/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.2.6+2
+
+* Do not override path during `VMServiceClient.connect`.
+ * Fixes issues with connecting to Dart `2.3` observatory URIs.
+
## 0.2.6+1
* Allow `stream_channel` version 2.x
diff --git a/vm_service_client/lib/src/instance.dart b/vm_service_client/lib/src/instance.dart
index e27df49..aa60a75 100644
--- a/vm_service_client/lib/src/instance.dart
+++ b/vm_service_client/lib/src/instance.dart
@@ -7,7 +7,6 @@
import 'dart:convert';
import 'dart:typed_data';
-import 'package:async/async.dart';
import 'package:stack_trace/stack_trace.dart';
import 'bound_field.dart';
@@ -299,7 +298,7 @@
Future<VMValueInstance<T>> load();
Future<T> getValue({onUnknownValue(value)}) =>
- DelegatingFuture.typed(super.getValue(onUnknownValue: onUnknownValue));
+ super.getValue(onUnknownValue: onUnknownValue).then((v) => v as T);
Future<T> _getValue(onUnknownValue(value)) async => value;
diff --git a/vm_service_client/lib/src/isolate.dart b/vm_service_client/lib/src/isolate.dart
index a7621b5..9d06391 100644
--- a/vm_service_client/lib/src/isolate.dart
+++ b/vm_service_client/lib/src/isolate.dart
@@ -484,7 +484,8 @@
Future<VMRunnableIsolate> loadRunnable() => load();
- Future<VMRunnableIsolate> load() => DelegatingFuture.typed(super.load());
+ Future<VMRunnableIsolate> load() =>
+ super.load().then((v) => v as VMRunnableIsolate);
String toString() => "Isolate running $rootLibrary";
}
diff --git a/vm_service_client/lib/vm_service_client.dart b/vm_service_client/lib/vm_service_client.dart
index 9bdb474..18177aa 100644
--- a/vm_service_client/lib/vm_service_client.dart
+++ b/vm_service_client/lib/vm_service_client.dart
@@ -109,7 +109,10 @@
}
var uri = url is String ? Uri.parse(url) : url;
- if (uri.scheme == 'http') uri = uri.replace(scheme: 'ws', path: '/ws');
+ if (uri.scheme == 'http') {
+ var path = uri.path.endsWith('/') ? uri.path : uri.path + '/';
+ uri = uri.replace(scheme: 'ws', path: '${path}ws');
+ }
// TODO(nweiz): Just use [WebSocketChannel.connect] when cross-platform
// libraries work.
diff --git a/vm_service_client/pubspec.yaml b/vm_service_client/pubspec.yaml
index 246c64f..6b3b5fb 100644
--- a/vm_service_client/pubspec.yaml
+++ b/vm_service_client/pubspec.yaml
@@ -1,5 +1,5 @@
name: vm_service_client
-version: 0.2.6+1
+version: 0.2.6+2
description: A client for the Dart VM service.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/vm_service_client
@@ -18,4 +18,4 @@
web_socket_channel: ^1.0.0
dev_dependencies:
- test: ^1.2.0
+ test: ^1.6.0
diff --git a/vm_service_lib/BUILD.gn b/vm_service_lib/BUILD.gn
index 1238f34..0bf2fd5 100644
--- a/vm_service_lib/BUILD.gn
+++ b/vm_service_lib/BUILD.gn
@@ -1,4 +1,4 @@
-# This file is generated by importer.py for vm_service_lib-3.15.1+1
+# This file is generated by importer.py for vm_service_lib-3.15.1+2
import("//build/dart/dart_library.gni")
diff --git a/vm_service_lib/CHANGELOG.md b/vm_service_lib/CHANGELOG.md
index cf33f5c..dfdaf20 100644
--- a/vm_service_lib/CHANGELOG.md
+++ b/vm_service_lib/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 3.15.1+2
+- fix handling of errors in registered service callbacks to return valid
+ JSON-RPC errors and avoid the client getting "Service Disappeared" responses
+
## 3.15.1+1
- rename `getVmWsUriFromObservatoryUri` to `convertToWebSocketUrl`
- fix an assignment issue in `evaluate`
diff --git a/vm_service_lib/lib/vm_service_lib.dart b/vm_service_lib/lib/vm_service_lib.dart
index 281480b..82bf035 100644
--- a/vm_service_lib/lib/vm_service_lib.dart
+++ b/vm_service_lib/lib/vm_service_lib.dart
@@ -1449,13 +1449,15 @@
return {
'error': {
'code': -32601, // Method not found
- 'message': 'Method not found \'${method}\''
+ 'message': 'Method not found \'$method\''
}
};
- } catch (e, s) {
- return <String, dynamic>{
- 'code': -32000, // SERVER ERROR
- 'message': 'Unexpected Server Error ${e}\n${s}'
+ } catch (e, st) {
+ return {
+ 'error': {
+ 'code': -32000, // SERVER ERROR
+ 'message': 'Unexpected Server Error $e\n$st'
+ }
};
}
}
diff --git a/vm_service_lib/pubspec.yaml b/vm_service_lib/pubspec.yaml
index 40de4b9..1e8309f 100644
--- a/vm_service_lib/pubspec.yaml
+++ b/vm_service_lib/pubspec.yaml
@@ -1,6 +1,6 @@
name: vm_service_lib
description: A library to access the VM Service API.
-version: 3.15.1+1
+version: 3.15.1+2
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/vm_service_drivers
diff --git a/vm_service_lib/tool/dart/generate_dart.dart b/vm_service_lib/tool/dart/generate_dart.dart
index 3bf4469..1391d7e 100644
--- a/vm_service_lib/tool/dart/generate_dart.dart
+++ b/vm_service_lib/tool/dart/generate_dart.dart
@@ -220,13 +220,15 @@
return {
'error': {
'code': -32601, // Method not found
- 'message': 'Method not found \'${method}\''
+ 'message': 'Method not found \'$method\''
}
};
- } catch (e, s) {
- return <String, dynamic>{
- 'code': -32000, // SERVER ERROR
- 'message': 'Unexpected Server Error ${e}\n${s}'
+ } catch (e, st) {
+ return {
+ 'error': {
+ 'code': -32000, // SERVER ERROR
+ 'message': 'Unexpected Server Error $e\n$st'
+ }
};
}
}