Version 2.10.0-43.0.dev
Merge commit 'da2bff9c9610fd7e5319a4d942147e6cc06ca8b6' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/pubspec.yaml b/pkg/_fe_analyzer_shared/pubspec.yaml
index 760e76a..ca8de48 100644
--- a/pkg/_fe_analyzer_shared/pubspec.yaml
+++ b/pkg/_fe_analyzer_shared/pubspec.yaml
@@ -1,5 +1,5 @@
name: _fe_analyzer_shared
-version: 7.0.0
+version: 8.0.0
description: Logic that is shared between the front_end and analyzer packages.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/_fe_analyzer_shared
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index d82ba92..0835f08 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -6,21 +6,24 @@
sdk: '>=2.6.0 <3.0.0'
dependencies:
+ _fe_analyzer_shared:
+ path: ../_fe_analyzer_shared
analyzer: any
analyzer_plugin: any
args: any
- charcode: any
+ cli_util: any
+ collection: any
convert: any
crypto: any
dart_style: any
- front_end: any
+ html: any
+ intl: any
linter: any
- logging: any
meta: any
- pub_semver: any
- source_span: any
stream_channel: any
- package_config: any
+ telemetry:
+ path: ../telemetry
+ test: any
path: any
tflite_native: any
watcher: any
@@ -30,6 +33,8 @@
analysis_tool: any
html: any
http: any
+ logging: any
+ matcher: any
+ mockito: any
pedantic: ^1.8.0
test_reflective_loader: any
- test: any
diff --git a/pkg/analysis_server_client/pubspec.yaml b/pkg/analysis_server_client/pubspec.yaml
index bc8b89f..9ee4b0e 100644
--- a/pkg/analysis_server_client/pubspec.yaml
+++ b/pkg/analysis_server_client/pubspec.yaml
@@ -11,4 +11,8 @@
path: ^1.7.0
pub_semver: ^1.4.4
dev_dependencies:
+ analyzer:
+ path: ../analyzer
+ analysis_server:
+ path: ../analysis_server
test: ^1.14.2
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 57b0902..b6f824d 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,5 +1,44 @@
-## 0.39.18-dev
+## 0.40.0
* Added `LibraryElement.featureSet`.
+* Removed deprecated `EmbedderSdk` and related classes.
+* `FunctionType` returned from `ExecutableElement.type` return `null`
+ as its `element`. Use `ExecutableElement`s directly if necessary.
+* `FunctionTypeAliasElement` does not implement `FunctionTypedElement`
+ anymore, implements `TypeParameterizedElement` instead.
+* Removed deprecated `CustomUriResolver`.
+* Removed deprecated `ExplicitSourceResolver`, `FileUriResolver`,
+ `LocalSourcePredicate`, `PackageUriResolver`, `RelativeFileUriResolver`.
+* Removed deprecated `ErrorCode` instances.
+* The `withNullability` flag in `DartType.getDisplayString()` is now required.
+* Removed deprecated `DartType.substitute2`, and `FunctionType.substitute3`,
+ use `ClassElement.instantiate`, `FunctionTypeAliasElement.instantiate()`,
+ or `FunctionType.instantiate()`.
+* Removed deprecated `FunctionType.boundTypeParameters`, use `typeFormals`
+ for now. Later, it will be deprecated, and replaced with `typeParameters`.
+* Removed `InterfaceType.instantiate()`, `InterfaceType.substitute4`,
+ use `ClassElement.instantiate()`.
+* Removed `typeParameters` and `instantiate()` from `ParameterizedType`.
+ Use `typeParameters` and `instantiate()` from `ClassElement`.
+* Removed deprecated methods from `DeclaredVariables`.
+* Removed deprecated `typeProvider` and `typeSystem` getters.
+ Use corresponding `LibraryElement` getters instead.
+* Removed deprecated options from `AnalysisOptions`.
+* Removed deprecated `ClassElement.hasReferenceToSuper`.
+* Removed deprecated `DartType.isObject`.
+ Use `DartType.isDartCoreObject` instead.
+* Removed deprecated declarations in `AnalysisContext` and `ContextLocator`.
+* Removed deprecated libraries.
+* Removed deprecated declarations from TypeProvider.
+* Removed deprecated `ParseResult` and `ResolveResult`.
+* Removed deprecated `AnalysisContext.typeProvider` and `typeSystem`.
+ Use the corresponding getters of `LibraryElement`.
+* Removed deprecated methods of `AnalysisSession`.
+* Removed deprecated declarations from `dart/ast/ast.dart`.
+* Removed deprecated methods from `AstFactory`.
+* Removed deprecated `parseFile2`..
+* Removed deprecated `TypeDefiningElement.type`.
+* Features in `Feature` are not constants anymore.
+* Replaced `Feature.firstSupportedVersion` with `releaseVersion`.
## 0.39.17
* Depend on cli_util 0.2.0.
diff --git a/pkg/analyzer/lib/context/context_root.dart b/pkg/analyzer/lib/context/context_root.dart
deleted file mode 100644
index df4a4b4..0000000
--- a/pkg/analyzer/lib/context/context_root.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library context.context_root;
-
-export 'package:analyzer/src/context/context_root.dart';
diff --git a/pkg/analyzer/lib/context/declared_variables.dart b/pkg/analyzer/lib/context/declared_variables.dart
deleted file mode 100644
index 74dc187..0000000
--- a/pkg/analyzer/lib/context/declared_variables.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.context.declared_variables;
-
-export 'package:analyzer/dart/analysis/declared_variables.dart';
diff --git a/pkg/analyzer/lib/dart/analysis/analysis_context.dart b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
index f4258ca..37035e4 100644
--- a/pkg/analyzer/lib/dart/analysis/analysis_context.dart
+++ b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
@@ -27,43 +27,6 @@
/// 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`.
- @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`.
- @deprecated
- List<String> get includedPaths;
-
/// Return the workspace for containing the context root.
Workspace get workspace;
-
- /// 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 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/pkg/analyzer/lib/dart/analysis/context_locator.dart b/pkg/analyzer/lib/dart/analysis/context_locator.dart
index 9ee427d..484099e 100644
--- a/pkg/analyzer/lib/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/dart/analysis/context_locator.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:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/context_locator.dart';
@@ -20,29 +19,6 @@
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.
- @deprecated
- List<AnalysisContext> locateContexts(
- {@required List<String> includedPaths,
- List<String> excludedPaths = const <String>[],
- String optionsFile,
- String packagesFile,
- String sdkPath});
-
/// 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].
diff --git a/pkg/analyzer/lib/dart/analysis/declared_variables.dart b/pkg/analyzer/lib/dart/analysis/declared_variables.dart
index 0104180..bb835a4 100644
--- a/pkg/analyzer/lib/dart/analysis/declared_variables.dart
+++ b/pkg/analyzer/lib/dart/analysis/declared_variables.dart
@@ -2,11 +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:analyzer/dart/constant/value.dart';
-import 'package:analyzer/dart/element/type_provider.dart';
-import 'package:analyzer/src/dart/constant/from_environment_evaluator.dart';
-import 'package:analyzer/src/dart/element/type_system.dart';
-
/// An object used to provide access to the values of variables that have been
/// defined on the command line using the `-D` option.
///
@@ -29,59 +24,7 @@
/// 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.
- @deprecated
- void addAll(DeclaredVariables other) {
- _declaredVariables.addAll(other._declaredVariables);
- }
-
- /// 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.
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'.
- @Deprecated("Clients don't need this functionality")
- DartObject getBool(TypeProvider typeProvider, String name) {
- return _evaluator(typeProvider).getBool(name);
- }
-
- /// 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.
- @Deprecated("Clients don't need this functionality")
- DartObject getInt(TypeProvider typeProvider, String name) {
- return _evaluator(typeProvider).getInt(name);
- }
-
- /// 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'.
- @Deprecated("Clients don't need this functionality")
- DartObject getString(TypeProvider typeProvider, String name) {
- return _evaluator(typeProvider).getString(name);
- }
-
- FromEnvironmentEvaluator _evaluator(TypeProvider typeProvider) {
- var typeSystem = TypeSystemImpl(
- implicitCasts: false,
- isNonNullableByDefault: false,
- strictInference: false,
- typeProvider: typeProvider,
- );
- return FromEnvironmentEvaluator(typeSystem, this);
- }
}
diff --git a/pkg/analyzer/lib/dart/analysis/features.dart b/pkg/analyzer/lib/dart/analysis/features.dart
index 1d46e72..7aa01d2 100644
--- a/pkg/analyzer/lib/dart/analysis/features.dart
+++ b/pkg/analyzer/lib/dart/analysis/features.dart
@@ -11,29 +11,29 @@
/// experimental flags.
abstract class Feature {
/// Feature information for the 2018 constant update.
- static const constant_update_2018 = ExperimentalFeatures.constant_update_2018;
+ static final constant_update_2018 = ExperimentalFeatures.constant_update_2018;
/// Feature information for non-nullability by default.
- static const non_nullable = ExperimentalFeatures.non_nullable;
+ static final non_nullable = ExperimentalFeatures.non_nullable;
/// Feature information for control flow collections.
- static const control_flow_collections =
+ static final control_flow_collections =
ExperimentalFeatures.control_flow_collections;
/// Feature information for extension methods.
- static const extension_methods = ExperimentalFeatures.extension_methods;
+ static final extension_methods = ExperimentalFeatures.extension_methods;
/// Feature information for spread collections.
- static const spread_collections = ExperimentalFeatures.spread_collections;
+ static final spread_collections = ExperimentalFeatures.spread_collections;
/// Feature information for set literals.
- static const set_literals = ExperimentalFeatures.set_literals;
+ static final set_literals = ExperimentalFeatures.set_literals;
/// Feature information for the triple-shift operator.
- static const triple_shift = ExperimentalFeatures.triple_shift;
+ static final triple_shift = ExperimentalFeatures.triple_shift;
/// Feature information for variance.
- static const variance = ExperimentalFeatures.variance;
+ static final variance = ExperimentalFeatures.variance;
/// If the feature may be enabled or disabled on the command line, the
/// experimental flag that may be used to enable it. Otherwise `null`.
@@ -41,9 +41,9 @@
/// 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;
+ /// If [status] is not `future`, the first language version in which this
+ /// feature was enabled by default. Otherwise `null`.
+ Version get releaseVersion;
/// The status of the feature.
FeatureStatus get status;
diff --git a/pkg/analyzer/lib/dart/analysis/results.dart b/pkg/analyzer/lib/dart/analysis/results.dart
index 9acd4ad..d76add7 100644
--- a/pkg/analyzer/lib/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/dart/analysis/results.dart
@@ -6,8 +6,8 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type_provider.dart';
+import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/error/error.dart';
-import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/generated/source.dart';
/// The result of performing some kind of analysis on a single file. Every
@@ -90,15 +90,7 @@
/// those discovered during scanning and parsing.
///
/// Clients may not extend, implement or mix-in this class.
-// ignore: deprecated_member_use_from_same_package
-abstract class ParsedUnitResult implements ParseResult {}
-
-/// The result of parsing of a single file. The errors returned include only
-/// those discovered during scanning and parsing.
-///
-/// Clients may not extend, implement or mix-in this class.
-@deprecated
-abstract class ParseResult implements AnalysisResultWithErrors {
+abstract class ParsedUnitResult implements AnalysisResultWithErrors {
/// The content of the file that was scanned and parsed.
String get content;
@@ -150,15 +142,7 @@
/// include both syntactic and semantic errors.
///
/// Clients may not extend, implement or mix-in this class.
-// ignore: deprecated_member_use_from_same_package
-abstract class ResolvedUnitResult implements ResolveResult {}
-
-/// The result of building a resolved AST for a single file. The errors returned
-/// include both syntactic and semantic errors.
-///
-/// Clients may not extend, implement or mix-in this class.
-@deprecated
-abstract class ResolveResult implements AnalysisResultWithErrors {
+abstract class ResolvedUnitResult implements AnalysisResultWithErrors {
/// The content of the file that was scanned, parsed and resolved.
String get content;
diff --git a/pkg/analyzer/lib/dart/analysis/session.dart b/pkg/analyzer/lib/dart/analysis/session.dart
index 28450cb..a4db043 100644
--- a/pkg/analyzer/lib/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/dart/analysis/session.dart
@@ -9,10 +9,8 @@
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/uri_converter.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/generated/source.dart';
/// A consistent view of the results of analyzing one or more files.
@@ -32,21 +30,6 @@
/// Return the [ResourceProvider] that is used to access the file system.
ResourceProvider get resourceProvider;
- /// Return the source factory used to resolve URIs.
- ///
- /// Deprecated: Use the methods on [uriConverter] instead.
- @deprecated
- SourceFactory get sourceFactory;
-
- /// Return a type provider that is consistent with the results returned by
- /// this session.
- @Deprecated('Use LibraryElement.typeProvider')
- Future<TypeProvider> get typeProvider;
-
- /// Return the type system being used by this session.
- @Deprecated('Use LibraryElement.typeSystem')
- Future<TypeSystem> get typeSystem;
-
/// Return the URI converter used to convert between URI's and file paths.
UriConverter get uriConverter;
@@ -65,20 +48,6 @@
/// the library with the given [uri].
Future<LibraryElement> getLibraryByUri(String uri);
- /// Return a future that will complete with information about the results of
- /// parsing the file with the given absolute, normalized [path].
- ///
- /// Deprecated: Use [getParsedUnit] instead.
- @deprecated
- Future<ParseResult> getParsedAst(String path);
-
- /// Return information about the results of parsing the file with the given
- /// absolute, normalized [path].
- ///
- /// Deprecated: Use [getParsedUnit] instead.
- @deprecated
- ParseResult getParsedAstSync(String path);
-
/// Return information about the results of parsing units of the library file
/// with the given absolute, normalized [path].
///
@@ -97,13 +66,6 @@
ParsedUnitResult getParsedUnit(String path);
/// Return a future that will complete with information about the results of
- /// resolving the file with the given absolute, normalized [path].
- ///
- /// Deprecated: Use [getResolvedUnit] instead.
- @deprecated
- Future<ResolveResult> getResolvedAst(String path);
-
- /// Return a future that will complete with information about the results of
/// resolving all of the files in the library with the given absolute,
/// normalized [path].
///
diff --git a/pkg/analyzer/lib/dart/analysis/utilities.dart b/pkg/analyzer/lib/dart/analysis/utilities.dart
index 2103cbb..585da88 100644
--- a/pkg/analyzer/lib/dart/analysis/utilities.dart
+++ b/pkg/analyzer/lib/dart/analysis/utilities.dart
@@ -56,39 +56,6 @@
throwIfDiagnostics: throwIfDiagnostics);
}
-/// Return the result of parsing the file at the given [path].
-///
-/// If a [resourceProvider] is given, it will be used to access the file system.
-///
-/// [featureSet] determines what set of features will be assumed by the parser.
-/// This parameter is required because the analyzer does not yet have a
-/// performant way of computing the correct feature set for a single file to be
-/// parsed. Callers that need the feature set to be strictly correct must
-/// create an [AnalysisContextCollection], query it to get an [AnalysisContext],
-/// query it to get an [AnalysisSession], and then call `getParsedUnit`.
-///
-/// Callers that don't need the feature set to be strictly correct can pass in
-/// `FeatureSet.fromEnableFlags([])` to enable the default set of features; this
-/// is much more performant than using an analysis session, because it doesn't
-/// require the analyzer to process the SDK.
-///
-/// If [throwIfDiagnostics] is `true` (the default), then if any diagnostics are
-/// produced because of syntactic errors in the [content] an `ArgumentError`
-/// will be thrown. If the parameter is `false`, then the caller can check the
-/// result to see whether there are any errors.
-@Deprecated('Use parseFile')
-ParseStringResult parseFile2(
- {@required String path,
- ResourceProvider resourceProvider,
- @required FeatureSet featureSet,
- bool throwIfDiagnostics = true}) {
- return parseFile(
- path: path,
- resourceProvider: resourceProvider,
- featureSet: featureSet,
- throwIfDiagnostics: throwIfDiagnostics);
-}
-
/// Returns the result of parsing the given [content] as a compilation unit.
///
/// If a [featureSet] is provided, it will be the default set of features that
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 2e621bc..f528230 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -1353,16 +1353,6 @@
/// Set the token for the left parenthesis to the given [token].
set leftParenthesis(Token token);
- /// Return the URI of the implementation library to be used if the condition
- /// is true.
- @deprecated
- StringLiteral get libraryUri;
-
- /// Set the URI of the implementation library to be used if the condition is
- /// true to the given [uri].
- @deprecated
- set libraryUri(StringLiteral uri);
-
/// Return the name of the declared variable whose value is being used in the
/// condition.
DottedName get name;
@@ -1439,9 +1429,6 @@
@override
ConstructorElement get declaredElement;
- /// Set the element associated with this constructor to the given [element].
- set element(ConstructorElement element);
-
/// Return the token for the 'external' keyword to the given [token].
Token get externalKeyword;
@@ -2388,10 +2375,6 @@
/// 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;
@@ -2682,9 +2665,6 @@
/// structure has not been resolved.
ExecutableElement get declaredElement;
- /// Set the element associated with the function to the given [element].
- set element(ExecutableElement element);
-
/// Return the parameters associated with the function, or `null` if the
/// function is part of a top-level getter.
FormalParameterList get parameters;
@@ -3288,8 +3268,7 @@
/// ('new' | 'const')? [TypeName] ('.' [SimpleIdentifier])? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
-abstract class InstanceCreationExpression
- implements Expression, ConstructorReferenceNode {
+abstract class InstanceCreationExpression implements Expression {
/// Return the list of arguments to the constructor.
ArgumentList get argumentList;
@@ -3315,14 +3294,6 @@
/// Set the 'new' or 'const' keyword used to indicate how an object should be
/// created to the given [token].
set keyword(Token token);
-
- @Deprecated('Use constructorName.staticElement')
- @override
- ConstructorElement get staticElement;
-
- @Deprecated('Use constructorName.staticElement')
- @override
- set staticElement(ConstructorElement staticElement);
}
/// An integer literal expression.
@@ -4032,11 +4003,6 @@
/// Return the node that is the parent of each of the elements in the list.
AstNode get owner;
- /// Set the node that is the parent of each of the elements in the list to the
- /// given [node].
- @deprecated // Never intended for public use.
- set owner(AstNode node);
-
/// Return the node at the given [index] in the list or throw a [RangeError]
/// if [index] is out of bounds.
@override
@@ -5186,14 +5152,6 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class UriBasedDirective implements Directive {
- /// Return the source to which the URI was resolved.
- @deprecated
- Source get source;
-
- /// Set the source to which the URI was resolved to the given [source].
- @deprecated
- set source(Source source);
-
/// Return the URI referenced by this directive.
StringLiteral get uri;
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index 632484c..65b253e 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -346,16 +346,6 @@
TypeArgumentList typeArguments,
@required ArgumentList argumentList});
- /// 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
@@ -377,27 +367,6 @@
/// [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,
- List<Annotation> metadata,
- Token keyword,
- TypeAnnotation type,
- Token thisKeyword,
- Token period,
- SimpleIdentifier identifier,
- 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.
FieldFormalParameter fieldFormalParameter2(
{Comment comment,
List<Annotation> metadata,
@@ -512,21 +481,6 @@
/// [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,
- List<Annotation> metadata,
- TypeAnnotation returnType,
- SimpleIdentifier identifier,
- 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.
FunctionTypedFormalParameter functionTypedFormalParameter2(
{Comment comment,
List<Annotation> metadata,
@@ -608,12 +562,6 @@
List<Combinator> combinators,
Token semicolon);
- /// Returns a newly created index expression suitable for use in a cascade
- /// expression.
- @Deprecated('Use indexExpressionForCascade2')
- IndexExpression indexExpressionForCascade(
- Token period, Token leftBracket, Expression index, Token rightBracket);
-
/// Returns a newly created index expression.
IndexExpression indexExpressionForCascade2(
{@required Token period,
@@ -622,12 +570,6 @@
@required Expression index,
@required Token rightBracket});
- /// Returns a newly created index expression suitable for use outside a
- /// cascade expression.
- @Deprecated('Use indexExpressionForTarget2')
- IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
- Expression index, Token rightBracket);
-
/// Returns a newly created index expression.
IndexExpression indexExpressionForTarget2(
{@required Expression target,
@@ -824,20 +766,6 @@
/// [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,
- List<Annotation> metadata,
- Token keyword,
- 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'.
SimpleFormalParameter simpleFormalParameter2(
{Comment comment,
List<Annotation> metadata,
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 8a4d9b9..1370243 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -81,13 +81,6 @@
/// instance field.
bool get hasNonFinalField;
- /// Return `true` if this class has at least one reference to `super` (and
- /// hence cannot be used as a mixin), or `false` if this element represents a
- /// mixin, even if the mixin has a reference to `super`, because it is allowed
- /// to be used as a mixin.
- @Deprecated('It was used internally, should not be part of API')
- bool get hasReferenceToSuper;
-
/// Return `true` if this class declares a static member.
bool get hasStaticMember;
@@ -121,19 +114,6 @@
/// application if it was declared using the syntax "class A = B with C;".
bool get isMixinApplication;
- /// Return `true` if this class [isProxy], or if it inherits the proxy
- /// annotation from a supertype.
- @Deprecated(
- 'The @proxy annotation is deprecated in the langauge, and will be removed',
- )
- bool get isOrInheritsProxy;
-
- /// Return `true` if this element has an annotation of the form '@proxy'.
- @Deprecated(
- 'The @proxy annotation is deprecated in the langauge, and will be removed',
- )
- bool get isProxy;
-
/// Return `true` if this class can validly be used as a mixin when defining
/// another class. For classes defined by a mixin declaration, the result is
/// always `true`. For classes defined by a class declaration or a mixin
@@ -195,10 +175,6 @@
/// nullability status of the declaring library.
InterfaceType get thisType;
- @override
- @deprecated
- InterfaceType get type;
-
/// Return the unnamed constructor declared in this class, or `null` if either
/// this class does not declare an unnamed constructor but does declare named
/// constructors or if this class represents a mixin declaration. The returned
@@ -239,14 +215,6 @@
@required NullabilitySuffix nullabilitySuffix,
});
- /// Create the [InterfaceType] for this class with type arguments that
- /// correspond to the bounds of the type parameters, and the given
- /// [nullabilitySuffix].
- @Deprecated('Use TypeSystem.instantiateToBounds2() instead')
- InterfaceType instantiateToBounds({
- @required NullabilitySuffix nullabilitySuffix,
- });
-
/// Return the element representing the method that results from looking up
/// the given [methodName] in this class with respect to the given [library],
/// ignoring abstract methods, or `null` if the look up fails. The behavior of
@@ -664,12 +632,6 @@
/// by the visitor as a result of visiting this element.
T accept<T>(ElementVisitor<T> visitor);
- /// Return the most immediate ancestor of this element for which the
- /// [predicate] returns `true`, or `null` if there is no such ancestor. Note
- /// that this element will never be returned.
- @Deprecated('Use either thisOrAncestorMatching or thisOrAncestorOfType')
- E getAncestor<E extends Element>(Predicate<Element> predicate);
-
/// Return the presentation of this element as it should appear when
/// presented to users.
///
@@ -1170,7 +1132,7 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionTypeAliasElement
- implements FunctionTypedElement, TypeDefiningElement {
+ implements TypeParameterizedElement, TypeDefiningElement {
@override
CompilationUnitElement get enclosingElement;
@@ -1190,34 +1152,6 @@
@required List<DartType> typeArguments,
@required NullabilitySuffix nullabilitySuffix,
});
-
- /// Produces the function type resulting from instantiating this typedef with
- /// the given [typeArguments] and [nullabilitySuffix].
- ///
- /// Note that this always instantiates the typedef itself, so for a
- /// [GenericTypeAliasElement] the returned [FunctionType] might still be a
- /// generic function, with type formals. For example, if the typedef is:
- /// typedef F<T> = void Function<U>(T, U);
- /// then `F<int>` will produce `void Function<U>(int, U)`.
- @Deprecated('Use instantiate() instead')
- FunctionType instantiate2({
- @required List<DartType> typeArguments,
- @required NullabilitySuffix nullabilitySuffix,
- });
-
- /// Produces the function type resulting from instantiating this typedef with
- /// type arguments that correspond to the bounds of the type parameters, and
- /// the given [nullabilitySuffix].
- ///
- /// Note that this always instantiates the typedef itself, so for a
- /// [GenericTypeAliasElement] the returned [FunctionType] might still be a
- /// generic function, with type formals. For example, if the typedef is:
- /// typedef F<T> = void Function<U>(T, U);
- /// then `F<int>` will produce `void Function<U>(int, U)`.
- @Deprecated('Use TypeSystem.instantiateToBounds2() instead')
- FunctionType instantiateToBounds({
- @required NullabilitySuffix nullabilitySuffix,
- });
}
/// An element that has a [FunctionType] as its [type].
@@ -1364,14 +1298,6 @@
/// The language version for this library.
LibraryLanguageVersion get languageVersion;
- /// The major component of the language version for this library.
- @Deprecated("Use 'languageVersion'")
- int get languageVersionMajor;
-
- /// The minor component of the language version for this library.
- @Deprecated("Use 'languageVersion'")
- int get languageVersionMinor;
-
/// Return the element representing the synthetic function `loadLibrary` that
/// is implicitly defined for this library if the library is imported using a
/// deferred import.
@@ -1479,10 +1405,6 @@
/// Return a list containing all of the elements that were defined within the
/// scope to have the same name.
List<Element> get conflictingElements;
-
- /// Return the type of this element as the dynamic type.
- @deprecated
- DartType get type;
}
/// An [ExecutableElement], with the additional information of a list of
@@ -1710,11 +1632,7 @@
/// An element that defines a type.
///
/// Clients may not extend, implement or mix-in this class.
-abstract class TypeDefiningElement implements Element {
- /// Return the type defined by this element.
- @deprecated
- DartType get type;
-}
+abstract class TypeDefiningElement implements Element {}
/// A type parameter.
///
@@ -1729,10 +1647,6 @@
@override
TypeParameterElement get declaration;
- @override
- @deprecated
- TypeParameterType get type;
-
/// Create the [TypeParameterType] with the given [nullabilitySuffix] for
/// this type parameter.
TypeParameterType instantiate({
diff --git a/pkg/analyzer/lib/dart/element/type.dart b/pkg/analyzer/lib/dart/element/type.dart
index 156470c..326b7a8 100644
--- a/pkg/analyzer/lib/dart/element/type.dart
+++ b/pkg/analyzer/lib/dart/element/type.dart
@@ -23,6 +23,7 @@
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type_visitor.dart';
import 'package:analyzer/src/dart/element/type.dart' show InterfaceTypeImpl;
+import 'package:meta/meta.dart';
/// The type associated with elements in the element model.
///
@@ -108,10 +109,6 @@
/// Return `true` if this type represents the type 'dynamic'.
bool get isDynamic;
- /// Return `true` if this type represents the type 'Object'.
- @Deprecated('Use isDartCoreObject')
- bool get isObject;
-
/// Return `true` if this type represents the type 'void'.
bool get isVoid;
@@ -161,7 +158,7 @@
///
/// Clients should not depend on the content of the returned value as it will
/// be changed if doing so would improve the UX.
- String getDisplayString({bool withNullability = false});
+ String getDisplayString({@required bool withNullability});
/// If this type is a [TypeParameterType], returns its bound if it has one, or
/// [objectType] otherwise.
@@ -169,27 +166,6 @@
/// 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.
- @Deprecated("""
-Use ClassElement.instantiate() or FunctionTypeAliasElement.instantiate()
-""")
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes);
}
/// The type `dynamic` is a type which is a supertype of all other types, just
@@ -212,10 +188,6 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionType implements ParameterizedType {
- /// 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
@@ -260,19 +232,10 @@
/// from the perspective of this function type.
List<TypeParameterElement> get typeFormals;
- @override
+ /// Produces a new function type by substituting type parameters of this
+ /// function type with the given [typeArguments]. The resulting function
+ /// type will have no type parameters.
FunctionType instantiate(List<DartType> argumentTypes);
-
- @Deprecated("Use FunctionTypeAliasElement.instantiate()")
- @override
- 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())`.
- @deprecated // use instantiate
- FunctionType substitute3(List<DartType> argumentTypes);
}
/// The type introduced by either a class or an interface, or a reference to
@@ -337,10 +300,6 @@
/// with the given name.
PropertyAccessorElement getSetter(String name);
- @Deprecated("Use ClassElement.instantiate()")
- @override
- InterfaceType instantiate(List<DartType> argumentTypes);
-
/// 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
@@ -565,17 +524,6 @@
PropertyAccessorElement lookUpSetterInSuperclass(
String name, LibraryElement library);
- @Deprecated("Use ClassElement.instantiate()")
- @override
- 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())`.
- @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
@@ -611,16 +559,6 @@
/// A [FunctionType] has type arguments only if it is a result of a typedef
/// instantiation, otherwise the result is `null`.
List<DartType> get typeArguments;
-
- /// Return a list containing all of the type parameters declared for this
- /// type.
- @Deprecated("Use ClassElement.typeParameters or FunctionType.typeFormals")
- List<TypeParameterElement> get typeParameters;
-
- /// Return the type resulting from instantiating (replacing) the given
- /// [argumentTypes] for this type's bound type parameters.
- @Deprecated("Use ClassElement.instantiate()")
- ParameterizedType instantiate(List<DartType> argumentTypes);
}
/// The type introduced by a type parameter.
@@ -644,9 +582,4 @@
/// The special type `void` is used to indicate that the value of an
/// expression is meaningless, and intended to be discarded.
-abstract class VoidType implements DartType {
- @override
- @deprecated
- VoidType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes);
-}
+abstract class VoidType implements DartType {}
diff --git a/pkg/analyzer/lib/dart/element/type_provider.dart b/pkg/analyzer/lib/dart/element/type_provider.dart
index ecc63f5..f263c27 100644
--- a/pkg/analyzer/lib/dart/element/type_provider.dart
+++ b/pkg/analyzer/lib/dart/element/type_provider.dart
@@ -4,7 +4,6 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/constant/value.dart';
/// The interface `TypeProvider` defines the behavior of objects that provide
/// access to types defined by the language.
@@ -50,14 +49,6 @@
/// Return the type representing 'FutureOr<Null>'.
InterfaceType get futureOrNullType;
- /// Return the type representing the built-in type 'FutureOr'.
- @Deprecated('Use futureOrType2() instead.')
- InterfaceType get futureOrType;
-
- /// Return the type representing the built-in type 'Future'.
- @Deprecated('Use futureType2() instead.')
- InterfaceType get futureType;
-
/// Return the element representing the built-in class 'int'.
ClassElement get intElement;
@@ -73,27 +64,15 @@
/// Return the type representing the type 'Iterable<Object>'.
InterfaceType get iterableObjectType;
- /// Return the type representing the built-in type 'Iterable'.
- @Deprecated('Use iterableType2() instead.')
- InterfaceType get iterableType;
-
/// Return the element representing the built-in class 'List'.
ClassElement get listElement;
- /// Return the type representing the built-in type 'List'.
- @Deprecated('Use listType2() instead.')
- InterfaceType get listType;
-
/// Return the element representing the built-in class 'Map'.
ClassElement get mapElement;
/// Return the type representing 'Map<Object, Object>'.
InterfaceType get mapObjectObjectType;
- /// Return the type representing the built-in type 'Map'.
- @Deprecated('Use mapType2() instead.')
- InterfaceType get mapType;
-
/// Return the type representing the built-in type 'Never'.
DartType get neverType;
@@ -101,18 +80,9 @@
/// or implemented.
Set<ClassElement> get nonSubtypableClasses;
- /// Return a list containing all of the types that cannot be either extended
- /// or implemented.
- @Deprecated('Use nonSubtypableClasses instead.')
- List<InterfaceType> get nonSubtypableTypes;
-
/// Return the element representing the built-in class 'null'.
ClassElement get nullElement;
- /// Return a [DartObjectImpl] representing the `null` object.
- @deprecated
- DartObjectImpl get nullObject;
-
/// Return the type representing the built-in type 'Null'.
InterfaceType get nullType;
@@ -128,10 +98,6 @@
/// Return the element representing the built-in class 'Set'.
ClassElement get setElement;
- /// Return the type representing the built-in type 'Set'.
- @Deprecated('Use setType2() instead.')
- InterfaceType get setType;
-
/// Return the type representing the built-in type 'StackTrace'.
InterfaceType get stackTraceType;
@@ -141,10 +107,6 @@
/// Return the element representing the built-in class 'Stream'.
ClassElement get streamElement;
- /// Return the type representing the built-in type 'Stream'.
- @Deprecated('Use streamType2() instead.')
- InterfaceType get streamType;
-
/// Return the element representing the built-in class 'String'.
ClassElement get stringElement;
diff --git a/pkg/analyzer/lib/plugin/embedded_resolver_provider.dart b/pkg/analyzer/lib/plugin/embedded_resolver_provider.dart
deleted file mode 100644
index 7e7a570..0000000
--- a/pkg/analyzer/lib/plugin/embedded_resolver_provider.dart
+++ /dev/null
@@ -1,15 +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.
-
-@deprecated
-library analyzer.plugin.embedded_resolver_provider;
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/source/embedder.dart';
-
-/// A function that will return a [UriResolver] that can be used to resolve
-/// URI's for embedded libraries within a given folder, or `null` if we should
-/// fall back to the standard URI resolver.
-@deprecated
-typedef EmbeddedResolverProvider = EmbedderUriResolver Function(Folder folder);
diff --git a/pkg/analyzer/lib/source/analysis_options_provider.dart b/pkg/analyzer/lib/source/analysis_options_provider.dart
deleted file mode 100644
index a35bfbc..0000000
--- a/pkg/analyzer/lib/source/analysis_options_provider.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.src.analysis_options.analysis_options_provider;
-
-export 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
diff --git a/pkg/analyzer/lib/source/custom_resolver.dart b/pkg/analyzer/lib/source/custom_resolver.dart
deleted file mode 100644
index 2569313..0000000
--- a/pkg/analyzer/lib/source/custom_resolver.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.source.custom_resolver;
-
-export 'package:analyzer/src/source/custom_resolver.dart';
diff --git a/pkg/analyzer/lib/source/embedder.dart b/pkg/analyzer/lib/source/embedder.dart
deleted file mode 100644
index f2cb675..0000000
--- a/pkg/analyzer/lib/source/embedder.dart
+++ /dev/null
@@ -1,194 +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.
-
-@deprecated
-library analyzer.source.embedder;
-
-import 'dart:collection' show HashMap;
-import 'dart:core';
-import 'dart:io' as io;
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/source/package_map_provider.dart'
- show PackageMapProvider;
-import 'package:analyzer/src/generated/java_io.dart' show JavaFile;
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/sdk_io.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource;
-import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
-import 'package:pub_semver/src/version.dart';
-import 'package:yaml/yaml.dart';
-
-export 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator;
-
-const String _DART_COLON_PREFIX = 'dart:';
-const String _EMBEDDED_LIB_MAP_KEY = 'embedded_libs';
-
-/// Check if this map defines embedded libraries.
-@deprecated
-bool definesEmbeddedLibs(Map map) => map[_EMBEDDED_LIB_MAP_KEY] != null;
-
-/// An SDK backed by URI mappings derived from an `_embedder.yaml` file.
-@deprecated
-class EmbedderSdk extends AbstractDartSdk {
- final Map<String, String> _urlMappings = HashMap<String, String>();
-
- EmbedderSdk([Map<Folder, YamlMap> embedderYamls]) {
- embedderYamls?.forEach(_processEmbedderYaml);
- }
-
- @override
- String get allowedExperimentsJson {
- return null;
- }
-
- @override
- Version get languageVersion => throw UnimplementedError();
-
- @override
- String get sdkVersion => '0';
-
- /// The url mappings for this SDK.
- Map<String, String> get urlMappings => _urlMappings;
-
- @override
- String getRelativePathFromFile(JavaFile file) => file.getAbsolutePath();
-
- @deprecated
- @override
- PackageBundle getSummarySdkBundle(bool _) => null;
-
- @override
- FileBasedSource internalMapDartUri(String dartUri) {
- String libraryName;
- String relativePath;
- int index = dartUri.indexOf('/');
- if (index >= 0) {
- libraryName = dartUri.substring(0, index);
- relativePath = dartUri.substring(index + 1);
- } else {
- libraryName = dartUri;
- relativePath = "";
- }
- SdkLibrary library = getSdkLibrary(libraryName);
- if (library == null) {
- return null;
- }
- String srcPath;
- if (relativePath.isEmpty) {
- srcPath = library.path;
- } else {
- String libraryPath = library.path;
- int index = libraryPath.lastIndexOf(io.Platform.pathSeparator);
- if (index == -1) {
- index = libraryPath.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- }
- String prefix = libraryPath.substring(0, index + 1);
- srcPath = '$prefix$relativePath';
- }
- String filePath = srcPath.replaceAll('/', io.Platform.pathSeparator);
- try {
- JavaFile file = JavaFile(filePath);
- return FileBasedSource(file, Uri.parse(dartUri));
- } on FormatException {
- return null;
- }
- }
-
- /// Install the mapping from [name] to [libDir]/[file].
- void _processEmbeddedLibs(String name, String file, Folder libDir) {
- if (!name.startsWith(_DART_COLON_PREFIX)) {
- // SDK libraries must begin with 'dart:'.
- return;
- }
- String libPath = libDir.canonicalizePath(file);
- _urlMappings[name] = libPath;
- SdkLibraryImpl library = SdkLibraryImpl(name);
- library.path = libPath;
- libraryMap.setLibrary(name, library);
- }
-
- /// Given the 'embedderYamls' from [EmbedderYamlLocator] check each one for the
- /// top level key 'embedded_libs'. Under the 'embedded_libs' key are key value
- /// pairs. Each key is a 'dart:' library uri and each value is a path
- /// (relative to the directory containing `_embedder.yaml`) to a dart script
- /// for the given library. For example:
- ///
- /// embedded_libs:
- /// 'dart:io': '../../sdk/io/io.dart'
- ///
- /// If a key doesn't begin with `dart:` it is ignored.
- void _processEmbedderYaml(Folder libDir, YamlMap map) {
- YamlNode embedded_libs = map[_EMBEDDED_LIB_MAP_KEY];
- if (embedded_libs is YamlMap) {
- embedded_libs.forEach((k, v) => _processEmbeddedLibs(k, v, libDir));
- }
- }
-}
-
-/// Given the 'embedderYamls' from [EmbedderYamlLocator] check each one for the
-/// top level key 'embedded_libs'. Under the 'embedded_libs' key are key value
-/// pairs. Each key is a 'dart:' library uri and each value is a path
-/// (relative to the directory containing `_embedder.yaml`) to a dart script
-/// for the given library. For example:
-///
-/// embedded_libs:
-/// 'dart:io': '../../sdk/io/io.dart'
-///
-/// If a key doesn't begin with `dart:` it is ignored.
-///
-/// This class is deprecated; use DartUriResolver directly. In particular, if
-/// there used to be an instance creation of the form:
-///
-/// ```
-/// new EmbedderUriResolver(embedderMap)
-/// ```
-///
-/// This should be replaced by
-///
-/// ```
-/// new DartUriResolver(new EmbedderSdk(embedderMap))
-/// ```
-@deprecated
-class EmbedderUriResolver implements DartUriResolver {
- EmbedderSdk _embedderSdk;
- DartUriResolver _dartUriResolver;
-
- /// Construct a [EmbedderUriResolver] from a package map
- /// (see [PackageMapProvider]).
- EmbedderUriResolver(Map<Folder, YamlMap> embedderMap)
- : this._forSdk(EmbedderSdk(embedderMap));
-
- /// (Provisional API.)
- EmbedderUriResolver._forSdk(this._embedderSdk) {
- _dartUriResolver = DartUriResolver(_embedderSdk);
- }
-
- @override
- DartSdk get dartSdk => _embedderSdk;
-
- /// Number of embedded libraries.
- int get length => _embedderSdk?.urlMappings?.length ?? 0;
-
- @override
- void clearCache() {}
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) =>
- _dartUriResolver.resolveAbsolute(uri, actualUri);
-
- @override
- Uri restoreAbsolute(Source source) {
- String path = source.fullName;
- if (path.length > 3 && path[1] == ':' && path[2] == '\\') {
- path = '/${path[0]}:${path.substring(2).replaceAll('\\', '/')}';
- }
- Source sdkSource = dartSdk.fromFileUri(Uri.parse('file://$path'));
- return sdkSource?.uri;
- }
-}
diff --git a/pkg/analyzer/lib/source/package_map_provider.dart b/pkg/analyzer/lib/source/package_map_provider.dart
deleted file mode 100644
index 2c33ab5..0000000
--- a/pkg/analyzer/lib/source/package_map_provider.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.source.package_map_provider;
-
-export 'package:analyzer/src/source/package_map_provider.dart';
diff --git a/pkg/analyzer/lib/source/package_map_resolver.dart b/pkg/analyzer/lib/source/package_map_resolver.dart
deleted file mode 100644
index cf65834..0000000
--- a/pkg/analyzer/lib/source/package_map_resolver.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library src.source.package_map_provider;
-
-export 'package:analyzer/src/source/package_map_resolver.dart';
diff --git a/pkg/analyzer/lib/source/path_filter.dart b/pkg/analyzer/lib/source/path_filter.dart
deleted file mode 100644
index 26ecec2..0000000
--- a/pkg/analyzer/lib/source/path_filter.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.source.path_filter;
-
-export 'package:analyzer/src/source/path_filter.dart';
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 6b0199c..8f23b6e 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -54,7 +54,7 @@
}
}
-/// Use the command-line [args] to create a context builder.
+/// Use the command-line [args] to create a context builder options.
ContextBuilderOptions createContextBuilderOptions(
ResourceProvider resourceProvider,
ArgResults args,
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index c5bdfd4..78b0a00 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -40,12 +40,6 @@
throw StateError('Cannot be changed.');
}
- @Deprecated('Use LibraryElement.typeProvider')
- @override
- TypeProvider get typeProvider {
- return _synchronousSession.typeProvider;
- }
-
TypeProviderImpl get typeProviderLegacy {
return _synchronousSession.typeProviderLegacy;
}
@@ -54,12 +48,6 @@
return _synchronousSession.typeProviderNonNullableByDefault;
}
- @Deprecated('Use LibraryElement.typeSystem')
- @override
- TypeSystemImpl get typeSystem {
- return _synchronousSession.typeSystem;
- }
-
TypeSystemImpl get typeSystemLegacy {
return _synchronousSession.typeSystemLegacy;
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index e4c6c31..db71f9e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -4,29 +4,14 @@
import 'dart:collection';
-import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/context_locator.dart';
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart'
show PhysicalResourceProvider;
-import 'package:analyzer/src/context/builder.dart'
- show ContextBuilder, ContextBuilderOptions;
-import 'package:analyzer/src/context/context_root.dart' as old;
-import 'package:analyzer/src/dart/analysis/byte_store.dart'
- show MemoryByteStore;
import 'package:analyzer/src/dart/analysis/context_root.dart';
-import 'package:analyzer/src/dart/analysis/driver.dart'
- show AnalysisDriver, AnalysisDriverScheduler;
-import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
-import 'package:analyzer/src/dart/analysis/file_state.dart'
- show FileContentOverlay;
-import 'package:analyzer/src/dart/analysis/performance_logger.dart'
- show PerformanceLog;
-import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
import 'package:analyzer/src/task/options.dart';
import 'package:analyzer/src/util/yaml.dart';
-import 'package:cli_util/cli_util.dart';
import 'package:glob/glob.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart';
@@ -56,53 +41,6 @@
: resourceProvider =
resourceProvider ?? PhysicalResourceProvider.INSTANCE;
- @deprecated
- @override
- List<AnalysisContext> locateContexts(
- {@required List<String> includedPaths,
- List<String> excludedPaths = const <String>[],
- String optionsFile,
- String packagesFile,
- String sdkPath}) {
- // TODO(scheglov) Remove this, and make `sdkPath` required.
- sdkPath ??= getSdkPath();
- ArgumentError.checkNotNull(sdkPath, 'sdkPath');
-
- List<ContextRoot> roots = locateRoots(
- includedPaths: includedPaths,
- excludedPaths: excludedPaths,
- optionsFile: optionsFile,
- packagesFile: packagesFile);
- if (roots.isEmpty) {
- return const <AnalysisContext>[];
- }
- PerformanceLog performanceLog = PerformanceLog(StringBuffer());
- AnalysisDriverScheduler scheduler = AnalysisDriverScheduler(performanceLog);
- DartSdkManager sdkManager = DartSdkManager(sdkPath);
- scheduler.start();
- ContextBuilderOptions options = ContextBuilderOptions();
- ContextBuilder builder =
- ContextBuilder(resourceProvider, sdkManager, null, options: options);
- if (packagesFile != null) {
- options.defaultPackageFilePath = packagesFile;
- }
- builder.analysisDriverScheduler = scheduler;
- builder.byteStore = MemoryByteStore();
- builder.fileContentOverlay = FileContentOverlay();
- builder.performanceLog = performanceLog;
- List<AnalysisContext> contextList = <AnalysisContext>[];
- for (ContextRoot root in roots) {
- old.ContextRoot contextRoot = old.ContextRoot(
- root.root.path, root.excludedPaths.toList(),
- pathContext: resourceProvider.pathContext);
- AnalysisDriver driver = builder.buildDriver(contextRoot);
- DriverBasedAnalysisContext context =
- DriverBasedAnalysisContext(resourceProvider, root, driver);
- contextList.add(context);
- }
- return contextList;
- }
-
@override
List<ContextRoot> locateRoots(
{@required List<String> includedPaths,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
index 582a366..d02bc2c 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
@@ -39,31 +39,11 @@
@override
AnalysisSession get currentSession => driver.currentSession;
- @deprecated
- @override
- List<String> get excludedPaths => contextRoot.excludedPaths.toList();
-
- @deprecated
- @override
- List<String> get includedPaths => contextRoot.includedPaths.toList();
-
@override
Workspace get workspace {
return _workspace ??= _buildWorkspace();
}
- @deprecated
- @override
- Iterable<String> analyzedFiles() {
- return contextRoot.analyzedFiles();
- }
-
- @deprecated
- @override
- bool isAnalyzed(String path) {
- return contextRoot.isAnalyzed(path);
- }
-
Workspace _buildWorkspace() {
String path = contextRoot.root.path;
ContextBuilder builder = ContextBuilder(
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
index 55d1a34..00f7f52 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
@@ -33,7 +33,7 @@
static final Version currentVersion = Version.parse(_currentVersion);
/// A map containing information about all known experimental flags.
- static const Map<String, ExperimentalFeature> knownFeatures = _knownFeatures;
+ static final Map<String, ExperimentalFeature> knownFeatures = _knownFeatures;
final List<bool> _enableFlags;
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index d09c2fe..17dec4d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -11,7 +11,7 @@
const _currentVersion = '2.10.0';
/// A map containing information about all known experimental flags.
-const _knownFeatures = <String, ExperimentalFeature>{
+final _knownFeatures = <String, ExperimentalFeature>{
EnableString.constant_update_2018: ExperimentalFeatures.constant_update_2018,
EnableString.control_flow_collections:
ExperimentalFeatures.control_flow_collections,
@@ -74,94 +74,104 @@
}
class ExperimentalFeatures {
- static const constant_update_2018 = ExperimentalFeature(
+ static final constant_update_2018 = ExperimentalFeature(
index: 0,
enableString: EnableString.constant_update_2018,
isEnabledByDefault: IsEnabledByDefault.constant_update_2018,
isExpired: IsExpired.constant_update_2018,
documentation: 'Enhanced constant expressions',
- firstSupportedVersion: '2.4.1',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('2.4.1'),
);
- static const control_flow_collections = ExperimentalFeature(
+ static final control_flow_collections = ExperimentalFeature(
index: 1,
enableString: EnableString.control_flow_collections,
isEnabledByDefault: IsEnabledByDefault.control_flow_collections,
isExpired: IsExpired.control_flow_collections,
documentation: 'Control Flow Collections',
- firstSupportedVersion: '2.2.2',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('2.2.2'),
);
- static const extension_methods = ExperimentalFeature(
+ static final extension_methods = ExperimentalFeature(
index: 2,
enableString: EnableString.extension_methods,
isEnabledByDefault: IsEnabledByDefault.extension_methods,
isExpired: IsExpired.extension_methods,
documentation: 'Extension Methods',
- firstSupportedVersion: '2.6.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('2.6.0'),
);
- static const non_nullable = ExperimentalFeature(
+ static final non_nullable = ExperimentalFeature(
index: 3,
enableString: EnableString.non_nullable,
isEnabledByDefault: IsEnabledByDefault.non_nullable,
isExpired: IsExpired.non_nullable,
documentation: 'Non Nullable by default',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
- static const nonfunction_type_aliases = ExperimentalFeature(
+ static final nonfunction_type_aliases = ExperimentalFeature(
index: 4,
enableString: EnableString.nonfunction_type_aliases,
isEnabledByDefault: IsEnabledByDefault.nonfunction_type_aliases,
isExpired: IsExpired.nonfunction_type_aliases,
documentation: 'Type aliases define a <type>, not just a <functionType>',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
- static const set_literals = ExperimentalFeature(
+ static final set_literals = ExperimentalFeature(
index: 5,
enableString: EnableString.set_literals,
isEnabledByDefault: IsEnabledByDefault.set_literals,
isExpired: IsExpired.set_literals,
documentation: 'Set Literals',
- firstSupportedVersion: '2.2.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('2.2.0'),
);
- static const spread_collections = ExperimentalFeature(
+ static final spread_collections = ExperimentalFeature(
index: 6,
enableString: EnableString.spread_collections,
isEnabledByDefault: IsEnabledByDefault.spread_collections,
isExpired: IsExpired.spread_collections,
documentation: 'Spread Collections',
- firstSupportedVersion: '2.2.2',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('2.2.2'),
);
- static const triple_shift = ExperimentalFeature(
+ static final triple_shift = ExperimentalFeature(
index: 7,
enableString: EnableString.triple_shift,
isEnabledByDefault: IsEnabledByDefault.triple_shift,
isExpired: IsExpired.triple_shift,
documentation: 'Triple-shift operator',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
- static const value_class = ExperimentalFeature(
+ static final value_class = ExperimentalFeature(
index: 8,
enableString: EnableString.value_class,
isEnabledByDefault: IsEnabledByDefault.value_class,
isExpired: IsExpired.value_class,
documentation: 'Value class',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
- static const variance = ExperimentalFeature(
+ static final variance = ExperimentalFeature(
index: 9,
enableString: EnableString.variance,
isEnabledByDefault: IsEnabledByDefault.variance,
isExpired: IsExpired.variance,
documentation: 'Sound variance',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
index 7b32e40..d3b9853 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart
@@ -127,8 +127,8 @@
flags = List.from(flags);
for (var feature in _knownFeatures.values) {
- var firstSupportedVersion = feature.firstSupportedVersion;
- if (firstSupportedVersion == null || firstSupportedVersion > version) {
+ var releaseVersion = feature.releaseVersion;
+ if (releaseVersion == null || releaseVersion > version) {
flags[feature.index] = false;
}
}
@@ -299,20 +299,25 @@
/// Documentation for the feature, if known. `null` for expired flags.
final String documentation;
- final String _firstSupportedVersion;
+ /// The first language version in which this feature can be enabled using
+ /// the [enableString] experimental flag.
+ final Version experimentalReleaseVersion;
- const ExperimentalFeature({
+ @override
+ final Version releaseVersion;
+
+ ExperimentalFeature({
@required this.index,
@required this.enableString,
@required this.isEnabledByDefault,
@required this.isExpired,
@required this.documentation,
- @required String firstSupportedVersion,
- }) : _firstSupportedVersion = firstSupportedVersion,
- assert(index != null),
+ @required this.experimentalReleaseVersion,
+ @required this.releaseVersion,
+ }) : assert(index != null),
assert(isEnabledByDefault
- ? firstSupportedVersion != null
- : firstSupportedVersion == null),
+ ? releaseVersion != null
+ : releaseVersion == null),
assert(enableString != null);
/// The string to disable the feature.
@@ -322,15 +327,6 @@
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) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/session.dart b/pkg/analyzer/lib/src/dart/analysis/session.dart
index d343115..78df548 100644
--- a/pkg/analyzer/lib/src/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/session.dart
@@ -16,7 +16,6 @@
import 'package:analyzer/src/dart/analysis/uri_converter.dart';
import 'package:analyzer/src/dart/element/class_hierarchy.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
-import 'package:analyzer/src/dart/element/type_provider.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
import 'package:analyzer/src/generated/source.dart';
@@ -27,12 +26,6 @@
/// The analysis driver performing analysis for this session.
final driver.AnalysisDriver _driver;
- /// The type provider being used by the analysis driver.
- TypeProvider _typeProvider;
-
- /// The type system being used by the analysis driver.
- TypeSystemImpl _typeSystem;
-
/// The URI converter used to convert between URI's and file paths.
UriConverter _uriConverter;
@@ -55,41 +48,6 @@
ResourceProvider get resourceProvider => _driver.resourceProvider;
@override
- SourceFactory get sourceFactory => _driver.sourceFactory;
-
- @Deprecated('Use LibraryElement.typeProvider')
- @override
- Future<TypeProvider> get typeProvider async {
- _checkConsistency();
- if (_typeProvider == null) {
- LibraryElement coreLibrary = await _driver.getLibraryByUri('dart:core');
- LibraryElement asyncLibrary = await _driver.getLibraryByUri('dart:async');
- _typeProvider = TypeProviderImpl(
- coreLibrary: coreLibrary,
- asyncLibrary: asyncLibrary,
- isNonNullableByDefault: false,
- );
- }
- return _typeProvider;
- }
-
- @Deprecated('Use LibraryElement.typeSystem')
- @override
- Future<TypeSystemImpl> get typeSystem async {
- _checkConsistency();
- if (_typeSystem == null) {
- var typeProvider = await this.typeProvider;
- _typeSystem = TypeSystemImpl(
- implicitCasts: true,
- isNonNullableByDefault: false,
- strictInference: false,
- typeProvider: typeProvider,
- );
- }
- return _typeSystem;
- }
-
- @override
UriConverter get uriConverter {
return _uriConverter ??= DriverBasedUriConverter(_driver);
}
@@ -126,14 +84,6 @@
return libraryElement;
}
- @deprecated
- @override
- Future<ParseResult> getParsedAst(String path) async => getParsedUnit(path);
-
- @deprecated
- @override
- ParseResult getParsedAstSync(String path) => getParsedUnit(path);
-
@override
ParsedLibraryResult getParsedLibrary(String path) {
_checkConsistency();
@@ -153,10 +103,6 @@
return _driver.parseFileSync(path);
}
- @deprecated
- @override
- Future<ResolveResult> getResolvedAst(String path) => getResolvedUnit(path);
-
@override
Future<ResolvedLibraryResult> getResolvedLibrary(String path) {
_checkConsistency();
@@ -244,9 +190,6 @@
);
}
- @Deprecated('Use LibraryElement.typeProvider')
- TypeProvider get typeProvider => _typeProviderLegacy;
-
TypeProvider get typeProviderLegacy {
return _typeProviderLegacy;
}
@@ -255,11 +198,6 @@
return _typeProviderNonNullableByDefault;
}
- @Deprecated('Use LibraryElement.typeSystem')
- TypeSystemImpl get typeSystem {
- return typeSystemLegacy;
- }
-
TypeSystemImpl get typeSystemLegacy {
return _typeSystemLegacy;
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 64c12b9..0fb6861 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -2304,16 +2304,6 @@
@override
Token get endToken => _uri.endToken;
- @deprecated
- @override
- StringLiteral get libraryUri => _uri;
-
- @deprecated
- @override
- set libraryUri(StringLiteral libraryUri) {
- _uri = _becomeParentOf(libraryUri as StringLiteralImpl);
- }
-
@override
DottedName get name => _name;
@@ -2485,12 +2475,6 @@
..add(_redirectedConstructor)
..add(_body);
- @deprecated
- @override
- set element(ConstructorElement element) {
- declaredElement = element;
- }
-
@override
Token get endToken {
if (_body != null) {
@@ -4346,7 +4330,7 @@
@override
bool get isRequiredPositional => kind.isRequiredPositional;
- @override
+ /// Return the kind of this parameter.
ParameterKind get kind;
}
@@ -4930,12 +4914,6 @@
Iterable<SyntacticEntity> get childEntities =>
ChildEntities()..add(_parameters)..add(_body);
- @deprecated
- @override
- set element(ExecutableElement element) {
- declaredElement = element;
- }
-
@override
Token get endToken {
if (_body != null) {
@@ -6051,14 +6029,6 @@
@override
Precedence get precedence => Precedence.primary;
- @Deprecated('Use constructorName.staticElement')
- @override
- ConstructorElement get staticElement => constructorName.staticElement;
-
- @Deprecated('Use constructorName.staticElement')
- @override
- set staticElement(ConstructorElement staticElement) {}
-
/// Return the type arguments associated with the constructor, rather than
/// with the class in which the constructor is defined. It is always an error
/// if there are type arguments because Dart doesn't currently support generic
@@ -7384,16 +7354,6 @@
@override
Token get firstTokenAfterCommentAndMetadata => keyword;
- @deprecated
- @override
- Source get source => selectedSource;
-
- @deprecated
- @override
- set source(Source source) {
- selectedSource = source;
- }
-
@override
LibraryElement get uriElement;
}
@@ -7498,7 +7458,7 @@
/// A list of AST nodes that have a common parent.
class NodeListImpl<E extends AstNode> with ListMixin<E> implements NodeList<E> {
/// The node that is the parent of each of the elements in the list.
- AstNodeImpl _owner;
+ final AstNodeImpl _owner;
/// The elements contained in the list.
List<E> _elements = <E>[];
@@ -7530,7 +7490,6 @@
@override
int get length => _elements.length;
- @deprecated // Never intended for public use.
@override
set length(int newLength) {
throw UnsupportedError("Cannot resize NodeList.");
@@ -7540,11 +7499,6 @@
AstNode get owner => _owner;
@override
- set owner(AstNode value) {
- _owner = value as AstNodeImpl;
- }
-
- @override
E operator [](int index) {
if (index < 0 || index >= _elements.length) {
throw RangeError("Index: $index, Size: ${_elements.length}");
@@ -10398,16 +10352,6 @@
_uri = _becomeParentOf(uri);
}
- @deprecated
- @override
- Source get source => uriSource;
-
- @deprecated
- @override
- set source(Source source) {
- uriSource = source;
- }
-
@override
StringLiteral get uri => _uri;
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index c51e550..8e1fd6a 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -387,16 +387,6 @@
ExtensionOverrideImpl(extensionName, typeArguments, argumentList);
@override
- FieldDeclaration fieldDeclaration(
- Comment comment,
- List<Annotation> metadata,
- Token staticKeyword,
- VariableDeclarationList fieldList,
- Token semicolon) =>
- FieldDeclarationImpl(comment, metadata, null, null, null, staticKeyword,
- fieldList, semicolon);
-
- @override
FieldDeclaration fieldDeclaration2(
{Comment comment,
List<Annotation> metadata,
@@ -410,20 +400,6 @@
externalKeyword, staticKeyword, fieldList, semicolon);
@override
- FieldFormalParameter fieldFormalParameter(
- Comment comment,
- List<Annotation> metadata,
- Token keyword,
- TypeAnnotation type,
- Token thisKeyword,
- Token period,
- SimpleIdentifier identifier,
- TypeParameterList typeParameters,
- FormalParameterList parameters) =>
- FieldFormalParameterImpl(comment, metadata, null, null, keyword, type,
- thisKeyword, period, identifier, typeParameters, parameters, null);
-
- @override
FieldFormalParameter fieldFormalParameter2(
{Comment comment,
List<Annotation> metadata,
@@ -559,17 +535,6 @@
typeParameters, parameters, semicolon);
@override
- FunctionTypedFormalParameter functionTypedFormalParameter(
- Comment comment,
- List<Annotation> metadata,
- TypeAnnotation returnType,
- SimpleIdentifier identifier,
- TypeParameterList typeParameters,
- FormalParameterList parameters) =>
- FunctionTypedFormalParameterImpl(comment, metadata, null, null,
- returnType, identifier, typeParameters, parameters, null);
-
- @override
FunctionTypedFormalParameter functionTypedFormalParameter2(
{Comment comment,
List<Annotation> metadata,
@@ -674,13 +639,6 @@
semicolon);
@override
- @Deprecated('Use indexExpressionForCascade2')
- IndexExpression indexExpressionForCascade(Token period, Token leftBracket,
- Expression index, Token rightBracket) =>
- IndexExpressionImpl.forCascade(
- period, null, leftBracket, index, rightBracket);
-
- @override
IndexExpression indexExpressionForCascade2(
{@required Token period,
Token question,
@@ -691,13 +649,6 @@
period, question, leftBracket, index, rightBracket);
@override
- @Deprecated('Use indexExpressionForTarget2')
- IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
- Expression index, Token rightBracket) =>
- IndexExpressionImpl.forTarget(
- target, null, leftBracket, index, rightBracket);
-
- @override
IndexExpression indexExpressionForTarget2(
{@required Expression target,
Token question,
@@ -926,16 +877,6 @@
ShowCombinatorImpl(keyword, shownNames);
@override
- SimpleFormalParameter simpleFormalParameter(
- Comment comment,
- List<Annotation> metadata,
- Token keyword,
- TypeAnnotation type,
- SimpleIdentifier identifier) =>
- SimpleFormalParameterImpl(
- comment, metadata, null, null, keyword, type, identifier);
-
- @override
SimpleFormalParameter simpleFormalParameter2(
{Comment comment,
List<Annotation> metadata,
diff --git a/pkg/analyzer/lib/src/dart/constant/from_environment_evaluator.dart b/pkg/analyzer/lib/src/dart/constant/from_environment_evaluator.dart
index 9ee0a70..c1260a8 100644
--- a/pkg/analyzer/lib/src/dart/constant/from_environment_evaluator.dart
+++ b/pkg/analyzer/lib/src/dart/constant/from_environment_evaluator.dart
@@ -18,40 +18,6 @@
FromEnvironmentEvaluator(this._typeSystem, this._declaredVariables);
/// 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.
- @Deprecated("Clients don't need this functionality")
- DartObject getBool(String name) {
- String value = _declaredVariables.get(name);
- if (value == null) {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.boolType,
- BoolState.UNKNOWN_VALUE,
- );
- }
- if (value == "true") {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.boolType,
- BoolState.TRUE_STATE,
- );
- } else if (value == "false") {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.boolType,
- BoolState.FALSE_STATE,
- );
- }
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.nullType,
- NullState.NULL_STATE,
- );
- }
-
- /// Return the value of the variable with the given [name] interpreted as a
/// 'boolean' value. If the variable is not defined, or the value cannot be
/// parsed as a boolean, return the default value from [namedValues]. If no
/// default value, return the default value of the default value from
@@ -85,37 +51,6 @@
}
/// 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.
- @Deprecated("Clients don't need this functionality")
- DartObject getInt(String name) {
- String value = _declaredVariables.get(name);
- if (value == null) {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.intType,
- IntState.UNKNOWN_VALUE,
- );
- }
- int bigInteger;
- try {
- bigInteger = int.parse(value);
- } on FormatException {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.nullType,
- NullState.NULL_STATE,
- );
- }
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.intType,
- IntState(bigInteger),
- );
- }
-
- /// Return the value of the variable with the given [name] interpreted as an
/// integer value. If the variable is not defined, or the value cannot be
/// parsed as an integer, return the default value from [namedValues]. If no
/// default value, return the default value of the default value from
@@ -158,28 +93,6 @@
}
/// 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.
- @Deprecated("Clients don't need this functionality")
- DartObject getString(String name) {
- String value = _declaredVariables.get(name);
- if (value == null) {
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.stringType,
- StringState.UNKNOWN_VALUE,
- );
- }
- return DartObjectImpl(
- _typeSystem,
- _typeSystem.typeProvider.stringType,
- StringState(value),
- );
- }
-
- /// Return the value of the variable with the given [name] interpreted as a
/// string value. If the variable is not defined, or the value cannot be
/// parsed as a boolean, return the default value from [namedValues]. If no
/// default value, return the default value of the default value from
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index b98042d..de0249e 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -215,20 +215,6 @@
);
}
- @Deprecated('Use TypeSystem.instantiateToBounds2() instead')
- @override
- InterfaceType instantiateToBounds({
- @required NullabilitySuffix nullabilitySuffix,
- }) {
- var typeArguments = typeParameters.map((typeParameter) {
- return (typeParameter as TypeParameterElementImpl).defaultType;
- }).toList();
- return instantiate(
- typeArguments: typeArguments,
- nullabilitySuffix: nullabilitySuffix,
- );
- }
-
@override
MethodElement lookUpConcreteMethod(
String methodName, LibraryElement library) =>
@@ -470,9 +456,6 @@
/// The superclass of the class, or `null` for [Object].
InterfaceType _supertype;
- /// The type defined by the class.
- InterfaceType _type;
-
/// A list containing all of the mixins that are applied to the class being
/// extended in order to derive the superclass of this class.
List<InterfaceType> _mixins;
@@ -688,16 +671,6 @@
return definingClass != null && !definingClass.isDartCoreObject;
}
- @Deprecated('It was used internally, should not be part of API')
- @override
- bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER);
-
- /// Set whether this class references 'super'.
- /// TODO(scheglov) Remove it.
- set hasReferenceToSuper(bool isReferencedSuper) {
- setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper);
- }
-
@override
bool get hasStaticMember {
for (MethodElement method in methods) {
@@ -772,12 +745,6 @@
}
@override
- bool get isOrInheritsProxy => false;
-
- @override
- bool get isProxy => false;
-
- @override
bool get isSimplyBounded {
if (linkedNode != null) {
return linkedContext.isSimplyBounded(linkedNode);
@@ -910,22 +877,6 @@
_supertype = supertype;
}
- @override
- @deprecated
- InterfaceType get type {
- if (_type == null) {
- var typeArguments = typeParameters
- .map((e) => e.instantiate(nullabilitySuffix: _noneOrStarSuffix))
- .toList();
- _type = InterfaceTypeImpl(
- element: this,
- typeArguments: typeArguments,
- nullabilitySuffix: NullabilitySuffix.star,
- );
- }
- return _type;
- }
-
/// Set the type parameters defined for this class to the given
/// [typeParameters].
set typeParameters(List<TypeParameterElement> typeParameters) {
@@ -2177,7 +2128,6 @@
parameters: parameters,
returnType: returnType,
nullabilitySuffix: _noneOrStarSuffix,
- element: this,
);
}
@@ -2318,9 +2268,6 @@
ElementKind get kind => ElementKind.DYNAMIC;
@override
- DartType get type => DynamicTypeImpl.instance;
-
- @override
T accept<T>(ElementVisitor<T> visitor) => null;
}
@@ -3039,16 +2986,6 @@
}
}
- @Deprecated('Use either thisOrAncestorMatching or thisOrAncestorOfType')
- @override
- E getAncestor<E extends Element>(Predicate<Element> predicate) {
- var ancestor = _enclosingElement;
- while (ancestor != null && !predicate(ancestor)) {
- ancestor = ancestor.enclosingElement;
- }
- return ancestor as E;
- }
-
/// Return the child of this element that is uniquely identified by the given
/// [identifier], or `null` if there is no such child.
ElementImpl getChild(String identifier) => null;
@@ -3311,9 +3248,6 @@
/// An [AbstractClassElementImpl] which is an enum.
class EnumElementImpl extends AbstractClassElementImpl {
- /// The type defined by the enum.
- InterfaceType _type;
-
/// 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.
EnumElementImpl(String name, int offset) : super(name, offset);
@@ -3397,10 +3331,6 @@
@override
bool get hasNonFinalField => false;
- @Deprecated('It was used internally, should not be part of API')
- @override
- bool get hasReferenceToSuper => false;
-
@override
bool get hasStaticMember => true;
@@ -3417,12 +3347,6 @@
bool get isMixinApplication => false;
@override
- bool get isOrInheritsProxy => false;
-
- @override
- bool get isProxy => false;
-
- @override
bool get isSimplyBounded => true;
@override
@@ -3465,20 +3389,6 @@
InterfaceType get supertype => library.typeProvider.objectType;
@override
- @deprecated
- InterfaceType get type {
- if (_type == null) {
- var typeArguments = const <DartType>[];
- _type = InterfaceTypeImpl(
- element: this,
- typeArguments: typeArguments,
- nullabilitySuffix: NullabilitySuffix.star,
- );
- }
- return _type;
- }
-
- @override
List<TypeParameterElement> get typeParameters =>
const <TypeParameterElement>[];
@@ -3767,7 +3677,6 @@
FunctionType get typeInternal {
if (_type != null) return _type;
- // TODO(scheglov) Remove "element" in the breaking changes branch.
return _type = FunctionTypeImpl(
typeFormals: typeParameters,
parameters: parameters,
@@ -4570,7 +4479,6 @@
FunctionType get typeInternal {
if (_type != null) return _type;
- // TODO(scheglov) Remove "element" in the breaking changes branch.
return _type = FunctionTypeImpl(
typeFormals: typeParameters,
parameters: parameters,
@@ -4625,13 +4533,10 @@
/// Clients may not extend, implement or mix-in this class.
class GenericTypeAliasElementImpl extends ElementImpl
with TypeParameterizedElementMixin
- implements GenericTypeAliasElement, ElementImplWithFunctionType {
+ implements GenericTypeAliasElement {
/// The element representing the generic function type.
GenericFunctionTypeElementImpl _function;
- /// The type of function defined by this type alias.
- FunctionType _type;
-
/// Initialize a newly created type alias element to have the given [name].
GenericTypeAliasElementImpl(String name, int offset) : super(name, offset);
@@ -4755,48 +4660,6 @@
return super.nameOffset;
}
- @override
- List<ParameterElement> get parameters =>
- function?.parameters ?? const <ParameterElement>[];
-
- @override
- DartType get returnType =>
- ElementTypeProvider.current.getExecutableReturnType(this);
-
- @override
- DartType get returnTypeInternal {
- if (function == null) {
- return DynamicTypeImpl.instance;
- }
- return function?.returnType;
- }
-
- @override
- @deprecated
- FunctionType get type => ElementTypeProvider.current.getExecutableType(this);
-
- set type(FunctionType type) {
- _type = type;
- }
-
- @override
- @deprecated
- FunctionType get typeInternal {
- _type ??= FunctionTypeImpl.synthetic(
- function.returnType,
- typeParameters,
- function.parameters,
- element: this,
- typeArguments: typeParameters.map((e) {
- return e.instantiate(
- nullabilitySuffix: NullabilitySuffix.star,
- );
- }).toList(),
- nullabilitySuffix: NullabilitySuffix.star,
- );
- return _type;
- }
-
/// Set the type parameters defined for this type to the given
/// [typeParameters].
set typeParameters(List<TypeParameterElement> typeParameters) {
@@ -4858,32 +4721,6 @@
}
@override
- @deprecated
- FunctionType instantiate2({
- @required List<DartType> typeArguments,
- @required NullabilitySuffix nullabilitySuffix,
- }) {
- return instantiate(
- typeArguments: typeArguments,
- nullabilitySuffix: nullabilitySuffix,
- );
- }
-
- @Deprecated('Use TypeSystem.instantiateToBounds2() instead')
- @override
- FunctionType instantiateToBounds({
- @required NullabilitySuffix nullabilitySuffix,
- }) {
- var typeArguments = typeParameters.map((typeParameter) {
- return (typeParameter as TypeParameterElementImpl).defaultType;
- }).toList();
- return instantiate(
- typeArguments: typeArguments,
- nullabilitySuffix: nullabilitySuffix,
- );
- }
-
- @override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(typeParameters, visitor);
@@ -5536,18 +5373,6 @@
return _languageVersion;
}
- @Deprecated("Use 'languageVersion'")
- @override
- int get languageVersionMajor {
- return languageVersion.effective.major;
- }
-
- @Deprecated("Use 'languageVersion'")
- @override
- int get languageVersionMinor {
- return languageVersion.effective.minor;
- }
-
@override
LibraryElement get library => this;
@@ -6038,20 +5863,17 @@
/// Indicates that a class is a mixin application.
static const Modifier MIXIN_APPLICATION = Modifier('MIXIN_APPLICATION', 14);
- /// Indicates that a class contains an explicit reference to 'super'.
- static const Modifier REFERENCES_SUPER = Modifier('REFERENCES_SUPER', 15);
-
/// Indicates that the pseudo-modifier 'set' was applied to the element.
- static const Modifier SETTER = Modifier('SETTER', 16);
+ static const Modifier SETTER = Modifier('SETTER', 15);
/// Indicates that the modifier 'static' was applied to the element.
- static const Modifier STATIC = Modifier('STATIC', 17);
+ static const Modifier STATIC = Modifier('STATIC', 16);
/// 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 = Modifier('SYNTHETIC', 18);
+ static const Modifier SYNTHETIC = Modifier('SYNTHETIC', 17);
static const List<Modifier> values = [
ABSTRACT,
@@ -6069,7 +5891,6 @@
IMPLICIT_TYPE,
LATE,
MIXIN_APPLICATION,
- REFERENCES_SUPER,
SETTER,
STATIC,
SYNTHETIC
@@ -6220,16 +6041,9 @@
Source get source => null;
@override
- DartType get type => DynamicTypeImpl.instance;
-
- @override
T accept<T>(ElementVisitor<T> visitor) =>
visitor.visitMultiplyDefinedElement(this);
- @Deprecated('Use either thisOrAncestorMatching or thisOrAncestorOfType')
- @override
- E getAncestor<E extends Element>(Predicate<Element> predicate) => null;
-
@override
String getDisplayString({@required bool withNullability}) {
var elementsStr = conflictingElements.map((e) {
@@ -6312,11 +6126,6 @@
ElementKind get kind => ElementKind.NEVER;
@override
- DartType get type {
- throw StateError('Should not be accessed.');
- }
-
- @override
T accept<T>(ElementVisitor<T> visitor) => null;
DartType instantiate({
@@ -7177,7 +6986,6 @@
FunctionType get typeInternal {
if (_type != null) return _type;
- // TODO(scheglov) Remove "element" in the breaking changes branch.
var type = FunctionTypeImpl(
typeFormals: const <TypeParameterElement>[],
parameters: const <ParameterElement>[],
@@ -7247,7 +7055,6 @@
FunctionType get typeInternal {
if (_type != null) return _type;
- // TODO(scheglov) Remove "element" in the breaking changes branch.
var type = FunctionTypeImpl(
typeFormals: const <TypeParameterElement>[],
parameters: parameters,
@@ -7473,9 +7280,6 @@
/// fall-back type value in type inference.
DartType _defaultType;
- /// The type defined by this type parameter.
- TypeParameterType _type;
-
/// The type representing the bound associated with this parameter, or `null`
/// if this parameter does not have an explicit bound.
DartType _bound;
@@ -7582,23 +7386,6 @@
return super.nameOffset;
}
- @override
- @deprecated
- TypeParameterType get type {
- // Note: TypeParameterElement.type has nullability suffix `star` regardless
- // of whether it appears in a migrated library. This is because for type
- // parameters of synthetic function types, the ancestor chain is broken and
- // we can't find the enclosing library to tell whether it is migrated.
- return _type ??= TypeParameterTypeImpl(
- element: this,
- nullabilitySuffix: NullabilitySuffix.star,
- );
- }
-
- set type(TypeParameterType type) {
- _type = type;
- }
-
Variance get variance {
if (_variance != null) return _variance;
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index 1f388cf..8af1a69 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -540,11 +540,6 @@
/// Append a textual representation of this element to the given [builder].
void appendTo(ElementDisplayStringBuilder builder);
- @Deprecated('Use either thisOrAncestorMatching or thisOrAncestorOfType')
- @override
- E getAncestor<E extends Element>(Predicate<Element> predicate) =>
- declaration.getAncestor(predicate);
-
@override
String getDisplayString({@required bool withNullability}) {
var builder = ElementDisplayStringBuilder(
@@ -819,16 +814,6 @@
builder.writeFormalParameter(this);
}
- @Deprecated('Use either thisOrAncestorMatching or thisOrAncestorOfType')
- @override
- E getAncestor<E extends Element>(Predicate<Element> predicate) {
- Element element = declaration.getAncestor(predicate);
- if (element is ExecutableElement) {
- return ExecutableMember.from2(element, _substitution) as E;
- }
- return element as E;
- }
-
@override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 84de8e0..7c697e2 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -87,19 +87,6 @@
}
@override
- @deprecated
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- int length = parameterTypes.length;
- for (int i = 0; i < length; i++) {
- if (parameterTypes[i] == this) {
- return argumentTypes[i];
- }
- }
- return this;
- }
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
// The dynamic type is always nullable.
return this;
@@ -148,10 +135,6 @@
nullabilitySuffix = nullabilitySuffix,
super(element);
- @deprecated
- @override
- List<TypeParameterElement> get boundTypeParameters => typeFormals;
-
@override
FunctionTypedElement get element {
var element = super.element;
@@ -235,9 +218,6 @@
}
@override
- List<TypeParameterElement> get typeParameters => const [] /*TODO(paulberry)*/;
-
- @override
bool operator ==(Object other) {
if (identical(other, this)) {
return true;
@@ -316,27 +296,6 @@
}
@override
- @deprecated
- FunctionType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- if (argumentTypes.length != parameterTypes.length) {
- throw ArgumentError("argumentTypes.length (${argumentTypes.length}) != "
- "parameterTypes.length (${parameterTypes.length})");
- }
-
- var substitution = Substitution.fromPairs(
- parameterTypes.map<TypeParameterElement>((t) => t.element).toList(),
- argumentTypes,
- );
- return substitution.substituteType(this);
- }
-
- @override
- @deprecated
- FunctionTypeImpl substitute3(List<DartType> argumentTypes) =>
- substitute2(argumentTypes, typeArguments);
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
if (this.nullabilitySuffix == nullabilitySuffix) return this;
return FunctionTypeImpl(
@@ -804,10 +763,6 @@
return element.name == "Symbol" && element.library.isDartCore;
}
- @Deprecated('Use isDartCoreObject')
- @override
- bool get isObject => element.supertype == null && !element.isMixin;
-
@override
List<MethodElement> get methods {
if (_methods == null) {
@@ -847,9 +802,6 @@
return _instantiateSuperTypes(constraints);
}
- @override
- List<TypeParameterElement> get typeParameters => element.typeParameters;
-
InheritanceManager3 get _inheritanceManager =>
(element.library.session as AnalysisSessionImpl).inheritanceManager;
@@ -917,11 +869,6 @@
PropertyAccessorMember.from(element.getSetter(setterName), this);
@override
- @deprecated
- InterfaceTypeImpl instantiate(List<DartType> argumentTypes) =>
- substitute2(argumentTypes, typeArguments);
-
- @override
ConstructorElement lookUpConstructor(
String constructorName, LibraryElement library) {
// prepare base ConstructorElement
@@ -1358,33 +1305,6 @@
}
@override
- @deprecated
- InterfaceTypeImpl substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- if (argumentTypes.length != parameterTypes.length) {
- throw ArgumentError(
- "argumentTypes.length (${argumentTypes.length}) != parameterTypes.length (${parameterTypes.length})");
- }
- if (argumentTypes.isEmpty || typeArguments.isEmpty) {
- return this;
- }
-
- List<DartType> newTypeArguments =
- TypeImpl.substitute(typeArguments, argumentTypes, parameterTypes);
-
- return InterfaceTypeImpl(
- element: element,
- typeArguments: newTypeArguments,
- nullabilitySuffix: nullabilitySuffix,
- );
- }
-
- @deprecated
- @override
- InterfaceTypeImpl substitute4(List<DartType> argumentTypes) =>
- instantiate(argumentTypes);
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
if (this.nullabilitySuffix == nullabilitySuffix) return this;
@@ -1666,12 +1586,6 @@
}
@override
- @deprecated
- NeverTypeImpl substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) =>
- this;
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
switch (nullabilitySuffix) {
case NullabilitySuffix.question:
@@ -1758,10 +1672,6 @@
@override
bool get isDynamic => false;
- @Deprecated('Use isDartCoreObject')
- @override
- bool get isObject => false;
-
@override
bool get isVoid => false;
@@ -1777,7 +1687,7 @@
@override
String getDisplayString({
bool skipAllDynamicArguments = false,
- bool withNullability = false,
+ @required bool withNullability,
}) {
var builder = ElementDisplayStringBuilder(
skipAllDynamicArguments: skipAllDynamicArguments,
@@ -1790,16 +1700,9 @@
@override
DartType resolveToBound(DartType objectType) => this;
- /// Return the type resulting from substituting the given [argumentTypes] for
- /// the given [parameterTypes] in this type.
- @override
- @deprecated
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes);
-
@override
String toString() {
- return getDisplayString(withNullability: false);
+ return getDisplayString(withNullability: true);
}
/// Return the same type, but with the given [nullabilitySuffix].
@@ -1836,23 +1739,6 @@
}
return true;
}
-
- /// Return a list containing the results of using the given [argumentTypes]
- /// and [parameterTypes] to perform a substitution on all of the given
- /// [types].
- @deprecated
- static List<DartType> substitute(List<DartType> types,
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- int length = types.length;
- if (length == 0) {
- return types;
- }
- List<DartType> newTypes = List<DartType>(length);
- for (int i = 0; i < length; i++) {
- newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes);
- }
- return newTypes;
- }
}
/// A concrete implementation of a [TypeParameterType].
@@ -1977,55 +1863,6 @@
}
@override
- @deprecated
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- int length = parameterTypes.length;
- for (int i = 0; i < length; i++) {
- var parameterType = parameterTypes[i];
- if (parameterType is TypeParameterTypeImpl && parameterType == this) {
- TypeImpl argumentType = argumentTypes[i];
-
- // TODO(scheglov) It should not happen, but sometimes arguments are
- // null.
- if (argumentType == null) {
- return argumentType;
- }
-
- // TODO(scheglov) Proposed substitution rules for nullability.
- NullabilitySuffix resultNullability;
- NullabilitySuffix parameterNullability =
- parameterType.nullabilitySuffix;
- NullabilitySuffix argumentNullability = argumentType.nullabilitySuffix;
- if (parameterNullability == NullabilitySuffix.none) {
- if (argumentNullability == NullabilitySuffix.question ||
- nullabilitySuffix == NullabilitySuffix.question) {
- resultNullability = NullabilitySuffix.question;
- } else if (argumentNullability == NullabilitySuffix.star ||
- nullabilitySuffix == NullabilitySuffix.star) {
- resultNullability = NullabilitySuffix.star;
- } else {
- resultNullability = NullabilitySuffix.none;
- }
- } else if (parameterNullability == NullabilitySuffix.star) {
- if (argumentNullability == NullabilitySuffix.question ||
- nullabilitySuffix == NullabilitySuffix.question) {
- resultNullability = NullabilitySuffix.question;
- } else {
- resultNullability = argumentNullability;
- }
- } else {
- // We should never be substituting for `T?`.
- throw StateError('Tried to substitute for T?');
- }
-
- return argumentType.withNullability(resultNullability);
- }
- }
- return this;
- }
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
if (this.nullabilitySuffix == nullabilitySuffix) return this;
return TypeParameterTypeImpl(
@@ -2034,22 +1871,6 @@
promotedBound: promotedBound,
);
}
-
- /// Return a list containing the type parameter types defined by the given
- /// array of type parameter elements ([typeParameters]).
- @deprecated
- static List<TypeParameterType> getTypes(
- List<TypeParameterElement> typeParameters) {
- int count = typeParameters.length;
- if (count == 0) {
- return const <TypeParameterType>[];
- }
- List<TypeParameterType> types = List<TypeParameterType>(count);
- for (int i = 0; i < count; i++) {
- types[i] = typeParameters[i].type;
- }
- return types;
- }
}
/// A concrete implementation of a [VoidType].
@@ -2095,12 +1916,6 @@
}
@override
- @deprecated
- VoidTypeImpl substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) =>
- this;
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) {
// The void type is always nullable.
return this;
diff --git a/pkg/analyzer/lib/src/dart/element/type_algebra.dart b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
index 6d5bf1a..2854f7e 100644
--- a/pkg/analyzer/lib/src/dart/element/type_algebra.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
@@ -249,7 +249,6 @@
var freshType = freshElement.instantiate(
nullabilitySuffix: NullabilitySuffix.none,
);
- freshElement.type = freshType;
substitution[element] = freshType;
if (!element.isLegacyCovariant) {
diff --git a/pkg/analyzer/lib/src/dart/element/type_provider.dart b/pkg/analyzer/lib/src/dart/element/type_provider.dart
index 04e4051..3ce7283 100644
--- a/pkg/analyzer/lib/src/dart/element/type_provider.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_provider.dart
@@ -6,25 +6,13 @@
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_provider.dart';
-import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/type.dart';
-import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:meta/meta.dart';
/// Provide common functionality shared by the various TypeProvider
/// implementations.
abstract class TypeProviderBase implements TypeProvider {
@override
- List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[
- boolType,
- doubleType,
- intType,
- nullType,
- numType,
- stringType
- ];
-
- @override
bool isObjectGetter(String id) {
PropertyAccessorElement element = objectType.element.getGetter(id);
return element != null && !element.isStatic;
@@ -73,23 +61,15 @@
InterfaceType _futureDynamicType;
InterfaceType _futureNullType;
InterfaceType _futureOrNullType;
- InterfaceType _futureOrType;
- InterfaceType _futureType;
InterfaceType _intType;
InterfaceType _iterableDynamicType;
InterfaceType _iterableObjectType;
- InterfaceType _iterableType;
- InterfaceType _listType;
- InterfaceType _mapType;
InterfaceType _mapObjectObjectType;
- DartObjectImpl _nullObject;
InterfaceType _nullType;
InterfaceType _numType;
InterfaceType _objectType;
- InterfaceType _setType;
InterfaceType _stackTraceType;
InterfaceType _streamDynamicType;
- InterfaceType _streamType;
InterfaceType _stringType;
InterfaceType _symbolType;
InterfaceType _typeType;
@@ -218,18 +198,6 @@
}
@override
- InterfaceType get futureOrType {
- _futureOrType ??= _getType(_asyncLibrary, "FutureOr");
- return _futureOrType;
- }
-
- @override
- InterfaceType get futureType {
- _futureType ??= _getType(_asyncLibrary, "Future");
- return _futureType;
- }
-
- @override
ClassElement get intElement {
return _intElement ??= _getClassElement(_coreLibrary, "int");
}
@@ -266,23 +234,11 @@
}
@override
- InterfaceType get iterableType {
- _iterableType ??= _getType(_coreLibrary, "Iterable");
- return _iterableType;
- }
-
- @override
ClassElement get listElement {
return _listElement ??= _getClassElement(_coreLibrary, 'List');
}
@override
- InterfaceType get listType {
- _listType ??= _getType(_coreLibrary, "List");
- return _listType;
- }
-
- @override
ClassElement get mapElement {
return _mapElement ??= _getClassElement(_coreLibrary, 'Map');
}
@@ -298,12 +254,6 @@
}
@override
- InterfaceType get mapType {
- _mapType ??= _getType(_coreLibrary, "Map");
- return _mapType;
- }
-
- @override
DartType get neverType => isNonNullableByDefault
? NeverTypeImpl.instance
: NeverTypeImpl.instanceLegacy;
@@ -324,21 +274,6 @@
return _nullElement ??= _getClassElement(_coreLibrary, 'Null');
}
- @deprecated
- @override
- DartObjectImpl get nullObject {
- return _nullObject ??= DartObjectImpl(
- TypeSystemImpl(
- implicitCasts: false,
- isNonNullableByDefault: false,
- strictInference: false,
- typeProvider: this,
- ),
- nullType,
- NullState.NULL_STATE,
- );
- }
-
InterfaceTypeImpl get nullStar {
return _nullStar ??= nullElement.instantiate(
typeArguments: const [],
@@ -379,11 +314,6 @@
}
@override
- InterfaceType get setType {
- return _setType ??= _getType(_coreLibrary, "Set");
- }
-
- @override
InterfaceType get stackTraceType {
_stackTraceType ??= _getType(_coreLibrary, "StackTrace");
return _stackTraceType;
@@ -405,12 +335,6 @@
}
@override
- InterfaceType get streamType {
- _streamType ??= _getType(_asyncLibrary, "Stream");
- return _streamType;
- }
-
- @override
ClassElement get stringElement {
return _stringElement ??= _getClassElement(_coreLibrary, 'String');
}
diff --git a/pkg/analyzer/lib/src/dart/element/type_schema.dart b/pkg/analyzer/lib/src/dart/element/type_schema.dart
index 1f4b6c4..f65f66c 100644
--- a/pkg/analyzer/lib/src/dart/element/type_schema.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_schema.dart
@@ -66,18 +66,6 @@
}
@override
- DartType substitute2(
- List<DartType> argumentTypes, List<DartType> parameterTypes) {
- int length = parameterTypes.length;
- for (int i = 0; i < length; i++) {
- if (parameterTypes[i] == this) {
- return argumentTypes[i];
- }
- }
- return this;
- }
-
- @override
TypeImpl withNullability(NullabilitySuffix nullabilitySuffix) => this;
/// Given a [type] T, return true if it does not have an unknown type `_`.
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index 37ee42d..b0b3a9cc 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -35,12 +35,12 @@
/// way for a possible future where we may wish to make the type system
/// pluggable.
// TODO(brianwilkerson) Rename this class to TypeSystemImpl.
-abstract class TypeSystem implements public.TypeSystem {
+abstract class TypeSystem2 implements public.TypeSystem {
/// If `true`, then NNBD type rules should be used.
/// If `false`, then legacy type rules should be used.
final bool isNonNullableByDefault;
- TypeSystem({@required this.isNonNullableByDefault});
+ TypeSystem2({@required this.isNonNullableByDefault});
/// The provider of types for the system
TypeProvider get typeProvider;
@@ -394,7 +394,7 @@
}
/// The [public.TypeSystem] implementation.
-class TypeSystemImpl extends TypeSystem {
+class TypeSystemImpl extends TypeSystem2 {
/// False if implicit casts should always be disallowed.
///
/// This affects the behavior of [isAssignableTo].
diff --git a/pkg/analyzer/lib/src/dart/micro/analysis_context.dart b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
index 3a1a6253..667a28d 100644
--- a/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
+++ b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
@@ -140,13 +140,12 @@
class _MicroAnalysisSessionImpl extends AnalysisSessionImpl {
@override
- _MicroAnalysisContextImpl analysisContext;
-
- @override
final DeclaredVariables declaredVariables;
+ final SourceFactory sourceFactory;
+
@override
- SourceFactory sourceFactory;
+ _MicroAnalysisContextImpl analysisContext;
_MicroAnalysisSessionImpl(
this.declaredVariables,
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index 5674c42..7dd4335 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -84,10 +84,6 @@
/// enclosing element.
ElementHolder _elementHolder;
- /// The flag specifying if currently visited class references 'super'
- /// expression.
- bool _hasReferenceToSuper = false;
-
factory ResolutionVisitor({
@required CompilationUnitElementImpl unitElement,
@required AnalysisErrorListener errorListener,
@@ -241,13 +237,9 @@
_resolveWithClause(withClause);
_resolveImplementsClause(node.implementsClause);
- _hasReferenceToSuper = false;
-
_defineElements(element.accessors);
_defineElements(element.methods);
node.members.accept(this);
-
- element.hasReferenceToSuper = _hasReferenceToSuper;
});
});
@@ -905,12 +897,6 @@
}
@override
- void visitSuperExpression(SuperExpression node) {
- _hasReferenceToSuper = true;
- super.visitSuperExpression(node);
- }
-
- @override
void visitSwitchCase(SwitchCase node) {
_buildLabelElements(node.labels, false, true);
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 0421a6d..e0ed8b3 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -3410,7 +3410,7 @@
handleRecoverableError(
templateExperimentNotEnabled.withArguments(
feature.enableString,
- _versionAsString(feature.firstSupportedVersion),
+ _versionAsString(feature.releaseVersion),
),
spreadToken,
spreadToken,
@@ -3633,7 +3633,7 @@
handleRecoverableError(
templateExperimentNotEnabled.withArguments(
feature.enableString,
- _versionAsString(feature.firstSupportedVersion),
+ _versionAsString(feature.releaseVersion),
),
forToken,
forToken,
@@ -3666,7 +3666,7 @@
handleRecoverableError(
templateExperimentNotEnabled.withArguments(
feature.enableString,
- _versionAsString(feature.firstSupportedVersion),
+ _versionAsString(feature.releaseVersion),
),
ifToken,
ifToken,
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
deleted file mode 100644
index ffafbd6..0000000
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ /dev/null
@@ -1,18 +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.
-
-/// This library is deprecated. Please convert all references to this library to
-/// reference one of the following public libraries:
-/// * package:analyzer/dart/ast/ast.dart
-/// * package:analyzer/dart/ast/visitor.dart
-///
-/// If your code is using APIs not available in these public libraries, please
-/// contact the analyzer team to either find an alternate API or have the API
-/// you depend on added to the public API.
-@deprecated
-library analyzer.src.generated.ast;
-
-export 'package:analyzer/dart/ast/ast.dart';
-export 'package:analyzer/dart/ast/visitor.dart';
-export 'package:analyzer/src/dart/ast/utilities.dart';
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
deleted file mode 100644
index a874806..0000000
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ /dev/null
@@ -1,22 +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.
-
-/// This library is deprecated. Please convert all references to this library to
-/// reference one of the following public libraries:
-/// * package:analyzer/dart/element/element.dart
-/// * package:analyzer/dart/element/type.dart
-/// * package:analyzer/dart/element/visitor.dart
-///
-/// If your code is using APIs not available in these public libraries, please
-/// contact the analyzer team to either find an alternate API or have the API
-/// you depend on added to the public API.
-@deprecated
-library analyzer.src.generated.element;
-
-export 'package:analyzer/dart/element/element.dart';
-export 'package:analyzer/dart/element/type.dart';
-export 'package:analyzer/dart/element/visitor.dart';
-export 'package:analyzer/src/dart/element/element.dart';
-export 'package:analyzer/src/dart/element/member.dart';
-export 'package:analyzer/src/dart/element/type.dart';
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 4cb7d34..4bbf974 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -6,13 +6,10 @@
import 'package:_fe_analyzer_shared/src/scanner/token_impl.dart';
import 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/error/error.dart';
-import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/source/error_processor.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
-import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -87,15 +84,6 @@
/// this context to the given source [factory]. Clients can safely assume that
/// all analysis results have been invalidated.
set sourceFactory(SourceFactory factory);
-
- /// Return a type provider for this context or throw [AnalysisException] if
- /// either `dart:core` or `dart:async` cannot be resolved.
- @Deprecated('Use LibraryElement.typeProvider')
- TypeProvider get typeProvider;
-
- /// Return a type system for this context.
- @Deprecated('Use LibraryElement.typeSystem')
- TypeSystem get typeSystem;
}
/// The entry point for the functionality provided by the analysis engine. There
@@ -215,18 +203,6 @@
/// A set of analysis options used to control the behavior of an analysis
/// context.
abstract class AnalysisOptions {
- /// Function that returns `true` if analysis is to parse and analyze function
- /// bodies for a given source.
- @deprecated
- 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.
- @deprecated
- int get cacheSize;
-
/// A flag indicating whether to run checks on AndroidManifest.xml file to
/// see if it is complaint with Chrome OS.
bool get chromeOsManifestChecks;
@@ -234,63 +210,13 @@
/// The set of features that are globally enabled for this context.
FeatureSet get contextFeatures;
- /// 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.
- @deprecated
- bool get disableCacheFlushing;
-
- /// 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).
- @deprecated
- bool get enableAssertMessage;
-
- /// Return `true` to if analysis is to enable async support.
- @deprecated
- bool get enableAsync;
-
- /// Return `true` to enable interface libraries (DEP 40).
- @deprecated
- bool get enableConditionalDirectives;
-
/// 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).
- @deprecated
- bool get enableGenericMethods => null;
-
- /// 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
- /// '||='.
- @deprecated
- bool get enableLazyAssignmentOperators;
-
- /// 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.
bool get enableTiming;
- /// 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.
List<ErrorProcessor> get errorProcessors;
@@ -299,16 +225,6 @@
/// 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`.
- @deprecated
- bool get generateImplicitErrors;
-
- /// Return `true` if errors, warnings and hints should be generated for sources
- /// in the SDK. The default value is `false`.
- @deprecated
- bool get generateSdkErrors;
-
/// Return `true` if analysis is to generate hint results (e.g. type inference
/// based information and pub best practices).
bool get hint;
@@ -320,22 +236,6 @@
/// 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.
- @deprecated
- Map<String, List<String>> get patchPaths;
-
- /// Return `true` if analysis is to parse comments.
- @deprecated
- 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.
- @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.
VersionConstraint get sdkVersionConstraint;
@@ -345,35 +245,12 @@
/// 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.
- @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.
- @deprecated
- bool get trackCacheDependencies;
-
/// Return `true` if analyzer should use the Dart 2.0 Front End parser.
bool get useFastaParser;
/// Return `true` the lint with the given [name] is enabled.
bool isLintEnabled(String name);
- /// Reset the state of this set of analysis options to its original state.
- @deprecated
- void resetToDefaults();
-
- /// 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.
static bool signaturesEqual(Uint32List a, Uint32List b) {
assert(a.length == AnalysisOptionsImpl.signatureLength);
@@ -396,19 +273,6 @@
/// The length of the list returned by `signature` getters.
static const int signatureLength = 4;
- /// 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;
-
- /// A predicate indicating whether analysis is to parse and analyze function
- /// bodies.
- @deprecated
- AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate =
- _analyzeAllFunctionBodies;
-
/// The cached [unlinkedSignature].
Uint32List _unlinkedSignature;
@@ -421,10 +285,6 @@
@override
VersionConstraint sdkVersionConstraint;
- @override
- @deprecated
- int cacheSize = 64;
-
ExperimentStatus _contextFeatures = ExperimentStatus();
/// The set of features to use for libraries that are not in a package.
@@ -437,10 +297,6 @@
@override
List<String> enabledPluginNames = const <String>[];
- @deprecated
- @override
- bool enableLazyAssignmentOperators = false;
-
@override
bool enableTiming = false;
@@ -451,14 +307,6 @@
/// A list of exclude patterns used to exclude some sources from analysis.
List<String> _excludePatterns;
- @deprecated
- @override
- bool generateImplicitErrors = true;
-
- @deprecated
- @override
- bool generateSdkErrors = false;
-
@override
bool hint = true;
@@ -469,25 +317,9 @@
/// `true`.
List<Linter> _lintRules;
- @deprecated
- @override
- Map<String, List<String>> patchPaths = {};
-
- @deprecated
- @override
- bool preserveComments = true;
-
- @deprecated
- @override
- bool trackCacheDependencies = true;
-
@override
bool useFastaParser = true;
- @deprecated
- @override
- bool disableCacheFlushing = false;
-
/// A flag indicating whether implicit casts are allowed in [strongMode]
/// (they are always allowed in Dart 1.0 mode).
///
@@ -526,24 +358,14 @@
/// 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) {
- // ignore: deprecated_member_use_from_same_package
- analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
contextFeatures = options.contextFeatures;
enabledPluginNames = options.enabledPluginNames;
- // ignore: deprecated_member_use_from_same_package
- enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
enableTiming = options.enableTiming;
errorProcessors = options.errorProcessors;
excludePatterns = options.excludePatterns;
- // ignore: deprecated_member_use_from_same_package
- generateImplicitErrors = options.generateImplicitErrors;
- // ignore: deprecated_member_use_from_same_package
- generateSdkErrors = options.generateSdkErrors;
hint = options.hint;
lint = options.lint;
lintRules = options.lintRules;
- // ignore: deprecated_member_use_from_same_package
- preserveComments = options.preserveComments;
useFastaParser = options.useFastaParser;
if (options is AnalysisOptionsImpl) {
implicitCasts = options.implicitCasts;
@@ -551,49 +373,9 @@
strictInference = options.strictInference;
strictRawTypes = options.strictRawTypes;
}
- // ignore: deprecated_member_use_from_same_package
- trackCacheDependencies = options.trackCacheDependencies;
- // ignore: deprecated_member_use_from_same_package
- disableCacheFlushing = options.disableCacheFlushing;
- // ignore: deprecated_member_use_from_same_package
- patchPaths = options.patchPaths;
sdkVersionConstraint = options.sdkVersionConstraint;
}
- @deprecated
- bool get analyzeFunctionBodies {
- if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) {
- return true;
- } else if (identical(
- analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) {
- return false;
- } else {
- throw StateError('analyzeFunctionBodiesPredicate in use');
- }
- }
-
- @deprecated
- set analyzeFunctionBodies(bool value) {
- if (value) {
- analyzeFunctionBodiesPredicate = _analyzeAllFunctionBodies;
- } else {
- analyzeFunctionBodiesPredicate = _analyzeNoFunctionBodies;
- }
- }
-
- @deprecated
- @override
- AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate =>
- _analyzeFunctionBodiesPredicate;
-
- @deprecated
- set analyzeFunctionBodiesPredicate(AnalyzeFunctionBodiesPredicate value) {
- if (value == null) {
- throw ArgumentError.notNull('analyzeFunctionBodiesPredicate');
- }
- _analyzeFunctionBodiesPredicate = value;
- }
-
@override
FeatureSet get contextFeatures => _contextFeatures;
@@ -603,69 +385,11 @@
}
@deprecated
- @override
- bool get enableAssertInitializer => true;
-
- @deprecated
- set enableAssertInitializer(bool enable) {}
-
- @override
- @deprecated
- bool get enableAssertMessage => true;
-
- @deprecated
- set enableAssertMessage(bool enable) {}
-
- @deprecated
- @override
- bool get enableAsync => true;
-
- @deprecated
- set enableAsync(bool enable) {}
-
- /// A flag indicating whether interface libraries are to be supported (DEP 40).
- @override
- bool get enableConditionalDirectives => true;
-
- @deprecated
- set enableConditionalDirectives(_) {}
-
- @deprecated
set enabledExperiments(List<String> enabledExperiments) {
_contextFeatures = ExperimentStatus.fromStrings(enabledExperiments);
}
@override
- @deprecated
- bool get enableGenericMethods => true;
-
- @deprecated
- set enableGenericMethods(bool enable) {}
-
- @deprecated
- @override
- bool get enableInitializingFormalAccess => true;
-
- @deprecated
- set enableInitializingFormalAccess(bool enable) {}
-
- @override
- @deprecated
- bool get enableSuperMixins => false;
-
- @deprecated
- set enableSuperMixins(bool enable) {
- // Ignored.
- }
-
- @deprecated
- @override
- bool get enableUriInPartOf => true;
-
- @deprecated
- set enableUriInPartOf(bool enable) {}
-
- @override
List<ErrorProcessor> get errorProcessors =>
_errorProcessors ??= const <ErrorProcessor>[];
@@ -687,14 +411,6 @@
/// The set of enabled experiments.
ExperimentStatus get experimentStatus => _contextFeatures;
- /// Return `true` to enable mixin declarations.
- /// https://github.com/dart-lang/language/issues/12
- @deprecated
- bool get isMixinSupportEnabled => true;
-
- @deprecated
- set isMixinSupportEnabled(bool value) {}
-
@override
List<Linter> get lintRules => _lintRules ??= const <Linter>[];
@@ -704,13 +420,6 @@
_lintRules = rules;
}
- @deprecated
- @override
- bool get previewDart2 => true;
-
- @deprecated
- set previewDart2(bool value) {}
-
@override
Uint32List get signature {
if (_signature == null) {
@@ -723,7 +432,6 @@
// Append boolean flags.
// ignore: deprecated_member_use_from_same_package
- buffer.addBool(enableLazyAssignmentOperators);
buffer.addBool(implicitCasts);
buffer.addBool(implicitDynamic);
buffer.addBool(strictInference);
@@ -779,13 +487,6 @@
return _signatureForElements;
}
- @override
- bool get strongMode => true;
-
- @Deprecated(
- "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].
@@ -794,8 +495,6 @@
ApiSignature buffer = ApiSignature();
// Append boolean flags.
- // ignore: deprecated_member_use_from_same_package
- buffer.addBool(enableLazyAssignmentOperators);
buffer.addBool(useFastaParser);
// Append the current language version.
@@ -819,45 +518,4 @@
bool isLintEnabled(String name) {
return lintRules.any((rule) => rule.name == name);
}
-
- @deprecated
- @override
- void resetToDefaults() {
- contextFeatures = ExperimentStatus();
- disableCacheFlushing = false;
- enabledPluginNames = const <String>[];
- enableLazyAssignmentOperators = false;
- enableTiming = false;
- _errorProcessors = null;
- _excludePatterns = null;
- generateImplicitErrors = true;
- generateSdkErrors = false;
- hint = true;
- implicitCasts = true;
- implicitDynamic = true;
- strictInference = false;
- strictRawTypes = false;
- lint = false;
- _lintRules = null;
- patchPaths = {};
- preserveComments = true;
- trackCacheDependencies = true;
- useFastaParser = true;
- }
-
- @deprecated
- @override
- void setCrossContextOptionsFrom(AnalysisOptions options) {
- enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
- }
-
- /// Predicate used for [analyzeFunctionBodiesPredicate] when
- /// [analyzeFunctionBodies] is set to `true`.
- @deprecated
- static bool _analyzeAllFunctionBodies(Source _) => true;
-
- /// Predicate used for [analyzeFunctionBodiesPredicate] when
- /// [analyzeFunctionBodies] is set to `false`.
- @deprecated
- static bool _analyzeNoFunctionBodies(Source _) => false;
}
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart
deleted file mode 100644
index fe431d2..0000000
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ /dev/null
@@ -1,10 +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.
-
-@deprecated
-library analyzer.src.generated.error;
-
-export 'package:analyzer/error/error.dart';
-export 'package:analyzer/error/listener.dart';
-export 'package:analyzer/src/error/codes.dart';
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index add5879..df9f795 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -53,12 +53,6 @@
import 'package:analyzer/src/generated/variable_type_provider.dart';
import 'package:meta/meta.dart';
-export 'package:analyzer/dart/element/type_provider.dart';
-export 'package:analyzer/src/dart/constant/constant_verifier.dart';
-export 'package:analyzer/src/dart/element/type_system.dart';
-export 'package:analyzer/src/dart/resolver/exit_detector.dart';
-export 'package:analyzer/src/dart/resolver/scope.dart';
-
/// Maintains and manages contextual type information used for
/// inferring types.
class InferenceContext {
@@ -2013,7 +2007,7 @@
Source source,
TypeProvider typeProvider,
AnalysisErrorListener errorListener,
- TypeSystem typeSystem,
+ TypeSystemImpl typeSystem,
FeatureSet featureSet,
MigrationResolutionHooks migrationResolutionHooks)
: _migrationResolutionHooks = migrationResolutionHooks,
@@ -2427,7 +2421,7 @@
} else if (parent is FunctionTypeAlias) {
nameScope = FormalParameterScope(
nameScope,
- parent.declaredElement.parameters,
+ parent.declaredElement.function.parameters,
);
} else if (parent is MethodDeclaration) {
nameScope = FormalParameterScope(
diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart
deleted file mode 100644
index e1d6904..0000000
--- a/pkg/analyzer/lib/src/generated/scanner.dart
+++ /dev/null
@@ -1,11 +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.
-
-@deprecated
-library analyzer.src.generated.scanner;
-
-export 'package:analyzer/dart/ast/token.dart';
-export 'package:analyzer/src/dart/ast/token.dart' hide SimpleToken;
-export 'package:analyzer/src/dart/scanner/reader.dart';
-export 'package:analyzer/src/dart/scanner/scanner.dart';
diff --git a/pkg/analyzer/lib/src/generated/sdk_io.dart b/pkg/analyzer/lib/src/generated/sdk_io.dart
deleted file mode 100644
index fe7ecc0..0000000
--- a/pkg/analyzer/lib/src/generated/sdk_io.dart
+++ /dev/null
@@ -1,184 +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.
-
-@deprecated
-library analyzer.src.generated.sdk_io;
-
-import 'dart:collection';
-
-import 'package:analyzer/exception/exception.dart';
-import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/java_io.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source_io.dart';
-import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
-
-/// An abstract implementation of a Dart SDK in which the available libraries
-/// are stored in a library map. Subclasses are responsible for populating the
-/// library map.
-@deprecated
-abstract class AbstractDartSdk implements DartSdk {
- /// A mapping from Dart library URI's to the library represented by that URI.
- LibraryMap libraryMap = LibraryMap();
-
- /// The [AnalysisOptions] to use to create the [context].
- AnalysisOptions _analysisOptions;
-
- /// The [AnalysisContext] which is used for all of the sources in this SDK.
- SdkAnalysisContext _analysisContext;
-
- /// The mapping from Dart URI's to the corresponding sources.
- final Map<String, Source> _uriToSourceMap = HashMap<String, Source>();
-
- /// Set the [options] for this SDK analysis context. Throw [StateError] if
- /// the context has been already created.
- set analysisOptions(AnalysisOptions options) {
- if (_analysisContext != null) {
- throw StateError(
- 'Analysis options cannot be changed after context creation.');
- }
- _analysisOptions = options;
- }
-
- @override
- AnalysisContext get context {
- if (_analysisContext == null) {
- var factory = SourceFactory([DartUriResolver(this)]);
- _analysisContext = SdkAnalysisContext(_analysisOptions, factory);
- }
- return _analysisContext;
- }
-
- @override
- List<SdkLibrary> get sdkLibraries => libraryMap.sdkLibraries;
-
- @override
- List<String> get uris => libraryMap.uris;
-
- /// Add the extensions from one or more sdk extension files to this sdk. The
- /// [extensions] should be a table mapping the names of extensions to the
- /// paths where those extensions can be found.
- void addExtensions(Map<String, String> extensions) {
- extensions.forEach((String uri, String path) {
- String shortName = uri.substring(uri.indexOf(':') + 1);
- SdkLibraryImpl library = SdkLibraryImpl(shortName);
- library.path = path;
- libraryMap.setLibrary(uri, library);
- });
- }
-
- @override
- Source fromFileUri(Uri uri) {
- JavaFile file = JavaFile.fromUri(uri);
-
- String path = _getPath(file);
- if (path == null) {
- return null;
- }
- try {
- return FileBasedSource(file, Uri.parse(path));
- } on FormatException catch (exception, stackTrace) {
- AnalysisEngine.instance.instrumentationService.logInfo(
- "Failed to create URI: $path",
- CaughtException(exception, stackTrace));
- }
- return null;
- }
-
- String getRelativePathFromFile(JavaFile file);
-
- @override
- SdkLibrary getSdkLibrary(String dartUri) => libraryMap.getLibrary(dartUri);
-
- /// Return the [PackageBundle] for this SDK, if it exists, or `null`
- /// otherwise. This method should not be used outside of `analyzer` and
- /// `analyzer_cli` packages.
- @deprecated
- PackageBundle getSummarySdkBundle(bool _);
-
- FileBasedSource internalMapDartUri(String dartUri) {
- // TODO(brianwilkerson) Figure out how to unify the implementations in the
- // two subclasses.
- String libraryName;
- String relativePath;
- int index = dartUri.indexOf('/');
- if (index >= 0) {
- libraryName = dartUri.substring(0, index);
- relativePath = dartUri.substring(index + 1);
- } else {
- libraryName = dartUri;
- relativePath = "";
- }
- SdkLibrary library = getSdkLibrary(libraryName);
- if (library == null) {
- return null;
- }
- String srcPath;
- if (relativePath.isEmpty) {
- srcPath = library.path;
- } else {
- String libraryPath = library.path;
- int index = libraryPath.lastIndexOf(JavaFile.separator);
- if (index == -1) {
- index = libraryPath.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- }
- String prefix = libraryPath.substring(0, index + 1);
- srcPath = '$prefix$relativePath';
- }
- String filePath = srcPath.replaceAll('/', JavaFile.separator);
- try {
- JavaFile file = JavaFile(filePath);
- return FileBasedSource(file, Uri.parse(dartUri));
- } on FormatException {
- return null;
- }
- }
-
- @override
- Source mapDartUri(String dartUri) {
- Source source = _uriToSourceMap[dartUri];
- if (source == null) {
- source = internalMapDartUri(dartUri);
- _uriToSourceMap[dartUri] = source;
- }
- return source;
- }
-
- String _getPath(JavaFile file) {
- List<SdkLibrary> libraries = libraryMap.sdkLibraries;
- int length = libraries.length;
- List<String> paths = List(length);
- String filePath = getRelativePathFromFile(file);
- if (filePath == null) {
- return null;
- }
- for (int i = 0; i < length; i++) {
- SdkLibrary library = libraries[i];
- String libraryPath = library.path.replaceAll('/', JavaFile.separator);
- if (filePath == libraryPath) {
- return library.shortName;
- }
- paths[i] = libraryPath;
- }
- for (int i = 0; i < length; i++) {
- SdkLibrary library = libraries[i];
- String libraryPath = paths[i];
- int index = libraryPath.lastIndexOf(JavaFile.separator);
- if (index >= 0) {
- String prefix = libraryPath.substring(0, index + 1);
- if (filePath.startsWith(prefix)) {
- String relPath = filePath
- .substring(prefix.length)
- .replaceAll(JavaFile.separator, '/');
- return '${library.shortName}/$relPath';
- }
- }
- }
- return null;
- }
-}
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index 5c2152e..96a1e96 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -2,14 +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 'dart:collection';
-
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/java_io.dart' show JavaFile;
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
-import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource;
import 'package:analyzer/src/task/api/model.dart';
import 'package:path/path.dart' as pathos;
@@ -53,12 +49,12 @@
class ContentCache {
/// A table mapping the full path of sources to the contents of those sources.
/// This is used to override the default contents of a source.
- final Map<String, String> _contentMap = HashMap<String, String>();
+ final Map<String, String> _contentMap = {};
/// A table mapping the full path of sources to the modification stamps of
/// those sources. This is used when the default contents of a source has been
/// overridden.
- final Map<String, int> _stampMap = HashMap<String, int>();
+ final Map<String, int> _stampMap = {};
int _nextStamp = 0;
@@ -70,8 +66,8 @@
});
}
- /// Return the contents of the given [source], or `null` if this cache does
- /// not override the contents of the source.
+ /// Return the contents of the given [source], or `null` if this cache does not
+ /// override the contents of the source.
///
/// <b>Note:</b> This method is not intended to be used except by
/// [AnalysisContext.getContents].
@@ -119,25 +115,6 @@
}
}
-@deprecated
-class CustomUriResolver extends UriResolver {
- final Map<String, String> _urlMappings;
-
- CustomUriResolver(this._urlMappings);
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- String mapping = _urlMappings[uri.toString()];
- if (mapping == null) return null;
-
- Uri fileUri = Uri.file(mapping);
- if (!fileUri.isAbsolute) return null;
-
- JavaFile javaFile = JavaFile.fromUri(fileUri);
- return FileBasedSource(javaFile, actualUri ?? uri);
- }
-}
-
/// Instances of the class `DartUriResolver` resolve `dart` URI's.
class DartUriResolver extends UriResolver {
/// The name of the `dart` scheme.
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index 533bc34..2188bba 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -4,53 +4,12 @@
import 'dart:collection';
-import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:path/path.dart' as path;
export 'package:analyzer/src/generated/source.dart';
-/// Instances of the class [ExplicitSourceResolver] map URIs to files on disk
-/// using a fixed mapping provided at construction time.
-@deprecated
-class ExplicitSourceResolver extends UriResolver {
- final Map<Uri, JavaFile> uriToFileMap;
- final Map<String, Uri> pathToUriMap;
-
- /// Construct an [ExplicitSourceResolver] based on the given [uriToFileMap].
- ExplicitSourceResolver(Map<Uri, JavaFile> uriToFileMap)
- : uriToFileMap = uriToFileMap,
- pathToUriMap = _computePathToUriMap(uriToFileMap);
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- JavaFile file = uriToFileMap[uri];
- actualUri ??= uri;
- if (file == null) {
- return null;
- } else {
- return FileBasedSource(file, actualUri);
- }
- }
-
- @override
- Uri restoreAbsolute(Source source) {
- return pathToUriMap[source.fullName];
- }
-
- /// Build the inverse mapping of [uriToSourceMap].
- static Map<String, Uri> _computePathToUriMap(
- Map<Uri, JavaFile> uriToSourceMap) {
- Map<String, Uri> pathToUriMap = <String, Uri>{};
- uriToSourceMap.forEach((Uri uri, JavaFile file) {
- pathToUriMap[file.getAbsolutePath()] = uri;
- });
- return pathToUriMap;
- }
-}
-
/// Instances of the class `FileBasedSource` implement a source that represents
/// a file.
class FileBasedSource extends Source {
@@ -158,273 +117,3 @@
return file.getAbsolutePath();
}
}
-
-/// Instances of the class `FileUriResolver` resolve `file` URI's.
-///
-/// This class is now deprecated, 'new FileUriResolver()' is equivalent to
-/// 'new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)'.
-@deprecated
-class FileUriResolver extends UriResolver {
- /// The name of the `file` scheme.
- static String FILE_SCHEME = "file";
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- if (!isFileUri(uri)) {
- return null;
- }
- return FileBasedSource(JavaFile.fromUri(uri), actualUri ?? uri);
- }
-
- @override
- Uri restoreAbsolute(Source source) {
- return Uri.file(source.fullName);
- }
-
- /// Return `true` if the given URI is a `file` URI.
- ///
- /// @param uri the URI being tested
- /// @return `true` if the given URI is a `file` URI
- static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
-}
-
-/// Instances of interface `LocalSourcePredicate` are used to determine if the
-/// given [Source] is "local" in some sense, so can be updated.
-abstract class LocalSourcePredicate {
- /// Instance of [LocalSourcePredicate] that always returns `false`.
- static final LocalSourcePredicate FALSE = LocalSourcePredicate_FALSE();
-
- /// Instance of [LocalSourcePredicate] that always returns `true`.
- static final LocalSourcePredicate TRUE = LocalSourcePredicate_TRUE();
-
- /// Instance of [LocalSourcePredicate] that returns `true` for all [Source]s
- /// except of SDK.
- static final LocalSourcePredicate NOT_SDK = LocalSourcePredicate_NOT_SDK();
-
- /// Determines if the given [Source] is local.
- ///
- /// @param source the [Source] to analyze
- /// @return `true` if the given [Source] is local
- bool isLocal(Source source);
-}
-
-class LocalSourcePredicate_FALSE implements LocalSourcePredicate {
- @override
- bool isLocal(Source source) => false;
-}
-
-class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate {
- @override
- bool isLocal(Source source) => source.uriKind != UriKind.DART_URI;
-}
-
-class LocalSourcePredicate_TRUE implements LocalSourcePredicate {
- @override
- bool isLocal(Source source) => true;
-}
-
-/// Instances of the class `PackageUriResolver` resolve `package` URI's in the
-/// context of an application.
-///
-/// For the purposes of sharing analysis, the path to each package under the
-/// "packages" directory should be canonicalized, but to preserve relative links
-/// within a package, the remainder of the path from the package directory to
-/// the leaf should not.
-@deprecated
-class PackageUriResolver extends UriResolver {
- /// The name of the `package` scheme.
- static String PACKAGE_SCHEME = "package";
-
- /// Log exceptions thrown with the message "Required key not available" only
- /// once.
- static bool _CanLogRequiredKeyIoException = true;
-
- /// The package directories that `package` URI's are assumed to be relative
- /// to.
- final List<JavaFile> _packagesDirectories;
-
- /// Initialize a newly created resolver to resolve `package` URI's relative to
- /// the given package directories.
- ///
- /// @param packagesDirectories the package directories that `package` URI's
- /// are assumed to be relative to
- PackageUriResolver(this._packagesDirectories) {
- if (_packagesDirectories.isEmpty) {
- throw ArgumentError("At least one package directory must be provided");
- }
- }
-
- /// If the list of package directories contains one element, return it.
- /// Otherwise raise an exception. Intended for testing.
- String get packagesDirectory_forTesting {
- int length = _packagesDirectories.length;
- if (length != 1) {
- throw Exception('Expected 1 package directory, found $length');
- }
- return _packagesDirectories[0].getPath();
- }
-
- /// Answer the canonical file for the specified package.
- ///
- /// @param packagesDirectory the "packages" directory (not `null`)
- /// @param pkgName the package name (not `null`, not empty)
- /// @param relPath the path relative to the package directory (not `null`, no
- /// leading slash, but may be empty string)
- /// @return the file (not `null`)
- JavaFile getCanonicalFile(
- JavaFile packagesDirectory, String pkgName, String relPath) {
- JavaFile pkgDir = JavaFile.relative(packagesDirectory, pkgName);
- try {
- pkgDir = pkgDir.getCanonicalFile();
- } catch (exception, stackTrace) {
- if (!exception.toString().contains("Required key not available")) {
- // TODO(39284): should this exception be silent?
- AnalysisEngine.instance.instrumentationService.logException(
- SilentException(
- "Canonical failed: $pkgDir", exception, stackTrace));
- } else if (_CanLogRequiredKeyIoException) {
- _CanLogRequiredKeyIoException = false;
- // TODO(39284): should this exception be silent?
- AnalysisEngine.instance.instrumentationService.logException(
- SilentException(
- "Canonical failed: $pkgDir", exception, stackTrace));
- }
- }
- return JavaFile.relative(pkgDir,
- relPath.replaceAll('/', String.fromCharCode(JavaFile.separatorChar)));
- }
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- if (!isPackageUri(uri)) {
- return null;
- }
- String path = uri.path;
- if (path == null) {
- path = uri.path;
- if (path == null) {
- return null;
- }
- }
- String pkgName;
- String relPath;
- int index = path.indexOf('/');
- if (index == -1) {
- // No slash
- pkgName = path;
- relPath = "";
- } else if (index == 0) {
- // Leading slash is invalid
- return null;
- } else {
- // <pkgName>/<relPath>
- pkgName = path.substring(0, index);
- relPath = path.substring(index + 1);
- }
- for (JavaFile packagesDirectory in _packagesDirectories) {
- JavaFile resolvedFile = JavaFile.relative(packagesDirectory, path);
- if (resolvedFile.exists()) {
- JavaFile canonicalFile =
- getCanonicalFile(packagesDirectory, pkgName, relPath);
- if (actualUri != null) {
- return FileBasedSource(canonicalFile, actualUri);
- }
- if (_isSelfReference(packagesDirectory, canonicalFile)) {
- uri = canonicalFile.toURI();
- }
- return FileBasedSource(canonicalFile, uri);
- }
- }
- return FileBasedSource(
- getCanonicalFile(_packagesDirectories[0], pkgName, relPath),
- actualUri ?? uri);
- }
-
- @override
- Uri restoreAbsolute(Source source) {
- String sourceUri = _toFileUri(source.fullName);
- for (JavaFile packagesDirectory in _packagesDirectories) {
- List<JavaFile> pkgFolders = packagesDirectory.listFiles();
- if (pkgFolders != null) {
- for (JavaFile pkgFolder in pkgFolders) {
- try {
- String pkgCanonicalUri = _toFileUri(pkgFolder.getCanonicalPath());
- if (sourceUri.startsWith(pkgCanonicalUri)) {
- String relPath = sourceUri.substring(pkgCanonicalUri.length);
- return Uri.parse(
- "$PACKAGE_SCHEME:${pkgFolder.getName()}$relPath");
- }
- } catch (_) {}
- }
- }
- }
- return null;
- }
-
- /// @return `true` if "file" was found in "packagesDir", and it is part of
- /// the "lib" folder of the application that contains in this
- /// "packagesDir".
- bool _isSelfReference(JavaFile packagesDir, JavaFile file) {
- JavaFile rootDir = packagesDir.getParentFile();
- if (rootDir == null) {
- return false;
- }
- String rootPath = rootDir.getAbsolutePath();
- String filePath = file.getAbsolutePath();
- return filePath.startsWith("$rootPath/lib");
- }
-
- /// Convert the given file path to a "file:" URI. On Windows, this transforms
- /// backslashes to forward slashes.
- String _toFileUri(String filePath) => path.context.toUri(filePath).toString();
-
- /// Return `true` if the given URI is a `package` URI.
- ///
- /// @param uri the URI being tested
- /// @return `true` if the given URI is a `package` URI
- static bool isPackageUri(Uri uri) => PACKAGE_SCHEME == uri.scheme;
-}
-
-/// Instances of the class `RelativeFileUriResolver` resolve `file` URI's.
-///
-/// This class is now deprecated, file URI resolution should be done with
-/// ResourceUriResolver, i.e.
-/// 'new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)'.
-@deprecated
-class RelativeFileUriResolver extends UriResolver {
- /// The name of the `file` scheme.
- static String FILE_SCHEME = "file";
-
- /// The directories for the relatvie URI's
- final List<JavaFile> _relativeDirectories;
-
- /// The root directory for all the source trees
- final JavaFile _rootDirectory;
-
- /// Initialize a newly created resolver to resolve `file` URI's relative to
- /// the given root directory.
- RelativeFileUriResolver(this._rootDirectory, this._relativeDirectories)
- : super();
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- String rootPath = _rootDirectory.toURI().path;
- String uriPath = uri.path;
- if (uriPath != null && uriPath.startsWith(rootPath)) {
- String filePath = uri.path.substring(rootPath.length);
- for (JavaFile dir in _relativeDirectories) {
- JavaFile file = JavaFile.relative(dir, filePath);
- if (file.exists()) {
- return FileBasedSource(file, actualUri ?? uri);
- }
- }
- }
- return null;
- }
-
- /// Return `true` if the given URI is a `file` URI.
- ///
- /// @param uri the URI being tested
- /// @return `true` if the given URI is a `file` URI
- static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
-}
diff --git a/pkg/analyzer/lib/src/generated/visitors.dart b/pkg/analyzer/lib/src/generated/visitors.dart
deleted file mode 100644
index 62cb61a..0000000
--- a/pkg/analyzer/lib/src/generated/visitors.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library analyzer.src.generated.visitors;
-
-export 'package:analyzer/dart/ast/visitor.dart' show DelegatingAstVisitor;
diff --git a/pkg/analyzer/lib/src/services/available_declarations.dart b/pkg/analyzer/lib/src/services/available_declarations.dart
index c1e1a66..b7ea31c 100644
--- a/pkg/analyzer/lib/src/services/available_declarations.dart
+++ b/pkg/analyzer/lib/src/services/available_declarations.dart
@@ -13,6 +13,7 @@
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/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/session.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/token.dart';
@@ -171,6 +172,12 @@
return _analysisContext.analysisOptions.contextFeatures;
}
+ AnalysisDriver get _analysisDriver {
+ var session = _analysisContext.currentSession as AnalysisSessionImpl;
+ // ignore: deprecated_member_use_from_same_package
+ return session.getDriver();
+ }
+
/// Return libraries that are available to the file with the given [path].
///
/// With `Pub`, files below the `pubspec.yaml` file can access libraries
@@ -434,11 +441,7 @@
}
void _scheduleKnownFiles() {
- var session = _analysisContext.currentSession as AnalysisSessionImpl;
- // ignore: deprecated_member_use_from_same_package
- var analysisDriver = session.getDriver();
-
- for (var path in analysisDriver.knownFiles) {
+ for (var path in _analysisDriver.knownFiles) {
if (_knownPathSet.add(path)) {
if (!path.contains(r'/lib/src/') && !path.contains(r'\lib\src\')) {
_knownPathList.add(path);
@@ -449,8 +452,7 @@
}
void _scheduleSdkLibraries() {
- // ignore: deprecated_member_use_from_same_package
- var sdk = _analysisContext.currentSession.sourceFactory.dartSdk;
+ var sdk = _analysisDriver.sourceFactory.dartSdk;
for (var uriStr in sdk.uris) {
if (!uriStr.startsWith('dart:_')) {
var uri = Uri.parse(uriStr);
diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
deleted file mode 100644
index 6768ca2..0000000
--- a/pkg/analyzer/lib/task/model.dart
+++ /dev/null
@@ -1,8 +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.
-
-@deprecated
-library task.model;
-
-export 'package:analyzer/src/task/api/model.dart';
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 92f288c..e2d78c9 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.39.18-dev
+version: 0.40.0
description: This package provides a library that performs static analysis of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
@@ -7,9 +7,8 @@
sdk: '>=2.7.0 <3.0.0'
dependencies:
- _fe_analyzer_shared: ^7.0.0
+ _fe_analyzer_shared: ^8.0.0
args: ^1.0.0
- charcode: ^1.1.0
cli_util: '>=0.1.4 <0.3.0'
collection: ^1.10.1
convert: ^2.0.0
diff --git a/pkg/analyzer/test/dart/analysis/from_environment_evaluator_test.dart b/pkg/analyzer/test/dart/analysis/from_environment_evaluator_test.dart
index 8ff2783..23deeb1 100644
--- a/pkg/analyzer/test/dart/analysis/from_environment_evaluator_test.dart
+++ b/pkg/analyzer/test/dart/analysis/from_environment_evaluator_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/declared_variables.dart';
-import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/src/dart/constant/from_environment_evaluator.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
@@ -21,133 +20,244 @@
@reflectiveTest
class FromEnvironmentEvaluatorTest {
+ static const String _defaultValue = 'defaultValue';
+
TypeProvider typeProvider;
TypeSystemImpl typeSystem;
+ DartObjectImpl get _boolValueFalse {
+ return DartObjectImpl(
+ typeSystem,
+ typeProvider.boolType,
+ BoolState.FALSE_STATE,
+ );
+ }
+
+ DartObjectImpl get _boolValueTrue {
+ return DartObjectImpl(
+ typeSystem,
+ typeProvider.boolType,
+ BoolState.TRUE_STATE,
+ );
+ }
+
+ DartObjectImpl get _nullValue {
+ return DartObjectImpl(
+ typeSystem,
+ typeProvider.nullType,
+ NullState.NULL_STATE,
+ );
+ }
+
void setUp() {
var analysisContext = TestAnalysisContext();
typeProvider = analysisContext.typeProviderLegacy;
typeSystem = analysisContext.typeSystemLegacy;
}
- @deprecated
+ void test_getBool_default() {
+ var name = 'foo';
+ var variables = FromEnvironmentEvaluator(
+ typeSystem,
+ DeclaredVariables.fromMap({}),
+ );
+ var object = _getBool(
+ variables,
+ name,
+ {_defaultValue: _boolValueFalse},
+ );
+ expect(object, _boolValueFalse);
+ }
+
void test_getBool_false() {
- String variableName = "var";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: 'false'}),
+ DeclaredVariables.fromMap({name: 'false'}),
);
- DartObject object = variables.getBool(variableName);
- expect(object, isNotNull);
- expect(object.toBoolValue(), false);
+ var object = _getBool(
+ variables,
+ name,
+ {_defaultValue: _boolValueFalse},
+ );
+ expect(object, _boolValueFalse);
}
- @deprecated
void test_getBool_invalid() {
- String variableName = "var";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: 'not true'}),
+ DeclaredVariables.fromMap({name: 'not bool'}),
);
- _assertNullDartObject(
- variables.getBool(variableName),
+ var object = _getBool(
+ variables,
+ name,
+ {_defaultValue: _boolValueFalse},
);
+ expect(object, _boolValueFalse);
}
- @deprecated
void test_getBool_true() {
- String variableName = "var";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: 'true'}),
+ DeclaredVariables.fromMap({name: 'true'}),
);
- DartObject object = variables.getBool(variableName);
- expect(object, isNotNull);
- expect(object.toBoolValue(), true);
+ var object = _getBool(
+ variables,
+ name,
+ {_defaultValue: _boolValueFalse},
+ );
+ expect(object, _boolValueTrue);
}
- @deprecated
- void test_getBool_undefined() {
- String variableName = "var";
- var variables = FromEnvironmentEvaluator(
- typeSystem,
- DeclaredVariables(),
- );
- _assertUnknownDartObject(
- typeProvider.boolType,
- variables.getBool(variableName),
- );
- }
-
- @deprecated
void test_getInt_invalid() {
- String variableName = "var";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: 'four score and seven years'}),
+ DeclaredVariables.fromMap({name: 'four score and seven years'}),
);
- _assertNullDartObject(
- variables.getInt(variableName),
+ var object = _getInt(
+ variables,
+ name,
+ {_defaultValue: _intValue(0)},
);
+ expect(object, _intValue(0));
}
- @deprecated
- void test_getInt_undefined() {
- String variableName = "var";
+ void test_getInt_undefined_defaultNull() {
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
DeclaredVariables(),
);
- _assertUnknownDartObject(
- typeProvider.intType,
- variables.getInt(variableName),
+ var object = _getInt(
+ variables,
+ name,
+ {_defaultValue: _nullValue},
);
+ expect(object, _nullValue);
}
- @deprecated
+ void test_getInt_undefined_defaultZero() {
+ var name = 'foo';
+ var variables = FromEnvironmentEvaluator(
+ typeSystem,
+ DeclaredVariables(),
+ );
+ var object = _getInt(
+ variables,
+ name,
+ {_defaultValue: _intValue(0)},
+ );
+ expect(object, _intValue(0));
+ }
+
void test_getInt_valid() {
- String variableName = "var";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: '23'}),
+ DeclaredVariables.fromMap({name: '23'}),
);
- DartObject object = variables.getInt(variableName);
- expect(object, isNotNull);
- expect(object.toIntValue(), 23);
+ var object = _getInt(
+ variables,
+ name,
+ {_defaultValue: _intValue(0)},
+ );
+ expect(object, _intValue(23));
}
- @deprecated
void test_getString_defined() {
- String variableName = "var";
- String value = "value";
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
- DeclaredVariables.fromMap({variableName: value}),
+ DeclaredVariables.fromMap({name: 'bar'}),
);
- DartObject object = variables.getString(variableName);
- expect(object, isNotNull);
- expect(object.toStringValue(), value);
+ var object = _getString(
+ variables,
+ name,
+ {_defaultValue: _nullValue},
+ );
+ expect(object, _stringValue('bar'));
}
- @deprecated
- void test_getString_undefined() {
- String variableName = "var";
+ void test_getString_undefined_defaultEmpty() {
+ var name = 'foo';
var variables = FromEnvironmentEvaluator(
typeSystem,
DeclaredVariables(),
);
- _assertUnknownDartObject(
- typeProvider.stringType,
- variables.getString(variableName),
+ var object = _getString(
+ variables,
+ name,
+ {_defaultValue: _stringValue('')},
+ );
+ expect(object, _stringValue(''));
+ }
+
+ void test_getString_undefined_defaultNull() {
+ var name = 'foo';
+ var variables = FromEnvironmentEvaluator(
+ typeSystem,
+ DeclaredVariables(),
+ );
+ var object = _getString(
+ variables,
+ name,
+ {_defaultValue: _nullValue},
+ );
+ expect(object, _nullValue);
+ }
+
+ DartObjectImpl _getBool(
+ FromEnvironmentEvaluator variables,
+ String name,
+ Map<String, DartObjectImpl> namedValues,
+ ) {
+ return variables.getBool2(
+ name,
+ namedValues,
+ typeProvider.boolElement.getNamedConstructor('fromEnvironment'),
);
}
- void _assertNullDartObject(DartObject result) {
- expect(result.type, typeProvider.nullType);
+ DartObjectImpl _getInt(
+ FromEnvironmentEvaluator variables,
+ String name,
+ Map<String, DartObjectImpl> namedValues,
+ ) {
+ return variables.getInt2(
+ name,
+ namedValues,
+ typeProvider.intElement.getNamedConstructor('fromEnvironment'),
+ );
}
- void _assertUnknownDartObject(DartType expectedType, DartObject result) {
- expect((result as DartObjectImpl).isUnknown, isTrue);
- expect(result.type, expectedType);
+ DartObjectImpl _getString(
+ FromEnvironmentEvaluator variables,
+ String name,
+ Map<String, DartObjectImpl> namedValues,
+ ) {
+ return variables.getString2(
+ name,
+ namedValues,
+ typeProvider.stringElement.getNamedConstructor('fromEnvironment'),
+ );
+ }
+
+ DartObjectImpl _intValue(int value) {
+ return DartObjectImpl(
+ typeSystem,
+ typeProvider.intType,
+ IntState(value),
+ );
+ }
+
+ DartObjectImpl _stringValue(String value) {
+ return DartObjectImpl(
+ typeSystem,
+ typeProvider.stringType,
+ StringState(value),
+ );
}
}
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index b2d7b4d..3dbf51c 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -21,8 +21,6 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ContentCacheTest);
- // ignore: deprecated_member_use_from_same_package
- defineReflectiveTests(CustomUriResolverTest);
defineReflectiveTests(DartUriResolverTest);
defineReflectiveTests(ErrorSeverityTest);
defineReflectiveTests(FileBasedSourceTest);
@@ -50,33 +48,6 @@
}
}
-@deprecated
-@reflectiveTest
-class CustomUriResolverTest {
- void test_creation() {
- expect(CustomUriResolver({}), isNotNull);
- }
-
- void test_resolve_unknown_uri() {
- UriResolver resolver = CustomUriResolver({
- 'custom:library': '/path/to/library.dart',
- });
- Source result = resolver.resolveAbsolute(Uri.parse("custom:non_library"));
- expect(result, isNull);
- }
-
- void test_resolve_uri() {
- String filePath =
- FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath();
- UriResolver resolver = CustomUriResolver({
- 'custom:library': filePath,
- });
- Source result = resolver.resolveAbsolute(Uri.parse("custom:library"));
- expect(result, isNotNull);
- expect(result.fullName, filePath);
- }
-}
-
@reflectiveTest
class DartUriResolverTest extends _SimpleDartSdkTest {
DartUriResolver resolver;
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index d6ce37b..a207e65 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -652,20 +652,6 @@
);
}
- @Deprecated('It was used internally, should not be part of API')
- test_hasReferenceToSuper() async {
- await assertNoErrorsInCode(r'''
-class A {}
-class B {toString() => super.toString();}''');
- verifyTestResolved();
-
- var a = findElement.class_('A');
- expect(a.hasReferenceToSuper, isFalse);
-
- var b = findElement.class_('B');
- expect(b.hasReferenceToSuper, isTrue);
- }
-
test_import_hide() async {
newFile('$testPackageLibPath/lib1.dart', content: r'''
set foo(value) {}
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index b501bfe..5d380c9 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -709,7 +709,10 @@
void _assertType(
InterfaceTypeImpl expectedType, InterfaceTypeImpl actualType) {
- expect(actualType.getDisplayString(), expectedType.getDisplayString());
+ expect(
+ actualType.getDisplayString(withNullability: false),
+ expectedType.getDisplayString(withNullability: false),
+ );
expect(actualType.element, expectedType.element);
List<DartType> expectedArguments = expectedType.typeArguments;
int length = expectedArguments.length;
diff --git a/pkg/analyzer/test/generated/test_analysis_context.dart b/pkg/analyzer/test/generated/test_analysis_context.dart
index b68806a..2f24e5c 100644
--- a/pkg/analyzer/test/generated/test_analysis_context.dart
+++ b/pkg/analyzer/test/generated/test_analysis_context.dart
@@ -68,10 +68,6 @@
AnalysisSessionImpl get analysisSession => _analysisSession;
- @Deprecated('Use LibraryElement.typeProvider')
- @override
- TypeProvider get typeProvider => typeProviderLegacy;
-
TypeProvider get typeProviderLegacy {
return _typeProviderLegacy;
}
@@ -80,10 +76,6 @@
return _typeProviderNonNullableByDefault;
}
- @Deprecated('Use LibraryElement.typeSystem')
- @override
- TypeSystemImpl get typeSystem => typeSystemLegacy;
-
TypeSystemImpl get typeSystemLegacy {
return _typeSystemLegacy;
}
diff --git a/pkg/analyzer/test/source/embedder_test.dart b/pkg/analyzer/test/source/embedder_test.dart
deleted file mode 100644
index d44bc06..0000000
--- a/pkg/analyzer/test/source/embedder_test.dart
+++ /dev/null
@@ -1,168 +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.
-
-@deprecated
-library analyzer.test.source.embedder_test;
-
-import 'dart:core';
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/source/embedder.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../embedder_tests.dart';
-import '../resource_utils.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(DartUriResolverTest);
- defineReflectiveTests(EmbedderSdkTest);
- defineReflectiveTests(EmbedderUriResolverTest);
- });
-}
-
-@reflectiveTest
-class DartUriResolverTest extends EmbedderRelatedTest {
- void test_embedderYaml() {
- EmbedderYamlLocator locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- EmbedderSdk sdk = EmbedderSdk(locator.embedderYamls);
- DartUriResolver resolver = DartUriResolver(sdk);
-
- void expectResolved(dartUri, posixPath) {
- Source source = resolver.resolveAbsolute(Uri.parse(dartUri));
- expect(source, isNotNull, reason: dartUri);
- expect(source.fullName, posixToOSPath(posixPath));
- }
-
- // Check that they map to the correct paths.
- expectResolved('dart:core', '$foxLib/core/core.dart');
- expectResolved('dart:fox', '$foxLib/slippy.dart');
- expectResolved('dart:bear', '$foxLib/grizzly.dart');
- expectResolved('dart:relative', '$foxPath/relative.dart');
- expectResolved('dart:deep', '$foxLib/deep/directory/file.dart');
- }
-}
-
-@reflectiveTest
-class EmbedderSdkTest extends EmbedderRelatedTest {
- void test_creation() {
- EmbedderYamlLocator locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- EmbedderSdk sdk = EmbedderSdk(locator.embedderYamls);
-
- expect(sdk.urlMappings, hasLength(5));
- }
-
- void test_fromFileUri() {
- EmbedderYamlLocator locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- EmbedderSdk sdk = EmbedderSdk(locator.embedderYamls);
-
- expectSource(String posixPath, String dartUri) {
- Uri uri = Uri.parse(posixToOSFileUri(posixPath));
- Source source = sdk.fromFileUri(uri);
- expect(source, isNotNull, reason: posixPath);
- expect(source.uri.toString(), dartUri);
- expect(source.fullName, posixToOSPath(posixPath));
- }
-
- expectSource('$foxLib/slippy.dart', 'dart:fox');
- expectSource('$foxLib/deep/directory/file.dart', 'dart:deep');
- expectSource('$foxLib/deep/directory/part.dart', 'dart:deep/part.dart');
- }
-
- void test_getSdkLibrary() {
- EmbedderYamlLocator locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- EmbedderSdk sdk = EmbedderSdk(locator.embedderYamls);
-
- SdkLibrary lib = sdk.getSdkLibrary('dart:fox');
- expect(lib, isNotNull);
- expect(lib.path, posixToOSPath('$foxLib/slippy.dart'));
- expect(lib.shortName, 'dart:fox');
- }
-
- void test_mapDartUri() {
- EmbedderYamlLocator locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- EmbedderSdk sdk = EmbedderSdk(locator.embedderYamls);
-
- void expectSource(String dartUri, String posixPath) {
- Source source = sdk.mapDartUri(dartUri);
- expect(source, isNotNull, reason: posixPath);
- expect(source.uri.toString(), dartUri);
- expect(source.fullName, posixToOSPath(posixPath));
- }
-
- expectSource('dart:core', '$foxLib/core/core.dart');
- expectSource('dart:fox', '$foxLib/slippy.dart');
- expectSource('dart:deep', '$foxLib/deep/directory/file.dart');
- expectSource('dart:deep/part.dart', '$foxLib/deep/directory/part.dart');
- }
-}
-
-@reflectiveTest
-class EmbedderUriResolverTest extends EmbedderRelatedTest {
- void test_embedderYaml() {
- var locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- var resolver = EmbedderUriResolver(locator.embedderYamls);
-
- expectResolved(dartUri, posixPath) {
- Source source = resolver.resolveAbsolute(Uri.parse(dartUri));
- expect(source, isNotNull, reason: dartUri);
- expect(source.fullName, posixToOSPath(posixPath));
- }
-
- // We have five mappings.
- expect(resolver, hasLength(5));
- // Check that they map to the correct paths.
- expectResolved('dart:core', '$foxLib/core/core.dart');
- expectResolved('dart:fox', '$foxLib/slippy.dart');
- expectResolved('dart:bear', '$foxLib/grizzly.dart');
- expectResolved('dart:relative', '$foxPath/relative.dart');
- expectResolved('dart:deep', '$foxLib/deep/directory/file.dart');
- }
-
- void test_nullEmbedderYamls() {
- var resolver = EmbedderUriResolver(null);
- expect(resolver, hasLength(0));
- }
-
- void test_restoreAbsolute() {
- var locator = EmbedderYamlLocator({
- 'fox': <Folder>[pathTranslator.getResource(foxLib)]
- });
- var resolver = EmbedderUriResolver(locator.embedderYamls);
-
- expectRestore(String dartUri, [String expected]) {
- var parsedUri = Uri.parse(dartUri);
- var source = resolver.resolveAbsolute(parsedUri);
- expect(source, isNotNull);
- // Restore source's uri.
- var restoreUri = resolver.restoreAbsolute(source);
- expect(restoreUri, isNotNull, reason: dartUri);
- // Verify that it is 'dart:fox'.
- expect(restoreUri.toString(), expected ?? dartUri);
- List<String> split = (expected ?? dartUri).split(':');
- expect(restoreUri.scheme, split[0]);
- expect(restoreUri.path, split[1]);
- }
-
- expectRestore('dart:deep');
- expectRestore('dart:deep/file.dart', 'dart:deep');
- expectRestore('dart:deep/part.dart');
- expectRestore('dart:deep/deep/file.dart');
- }
-}
diff --git a/pkg/analyzer/test/source/test_all.dart b/pkg/analyzer/test/source/test_all.dart
index 83fbf29..ec2bcfe 100644
--- a/pkg/analyzer/test/source/test_all.dart
+++ b/pkg/analyzer/test/source/test_all.dart
@@ -5,8 +5,6 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'analysis_options_provider_test.dart' as analysis_options_provider_test;
-import 'embedder_test.dart' // ignore: deprecated_member_use_from_same_package
- as embedder_test;
import 'error_processor_test.dart' as error_processor_test;
import 'package_map_resolver_test.dart' as package_map_resolver_test;
import 'path_filter_test.dart' as path_filter_test;
@@ -14,7 +12,6 @@
main() {
defineReflectiveSuite(() {
analysis_options_provider_test.main();
- embedder_test.main();
error_processor_test.main();
package_map_resolver_test.main();
path_filter_test.main();
diff --git a/pkg/analyzer/test/src/command_line/arguments_test.dart b/pkg/analyzer/test/src/command_line/arguments_test.dart
index 32093f7..e3d502f 100644
--- a/pkg/analyzer/test/src/command_line/arguments_test.dart
+++ b/pkg/analyzer/test/src/command_line/arguments_test.dart
@@ -60,7 +60,6 @@
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.strongMode, true);
expect(defaultOptions.implicitCasts, false);
expect(defaultOptions.implicitDynamic, false);
}
@@ -79,7 +78,6 @@
expect(options.defaultPackageFilePath, isNull);
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.strongMode, true);
expect(defaultOptions.implicitCasts, true);
expect(defaultOptions.implicitDynamic, true);
}
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 73e1ad7..0884c88 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -766,7 +766,6 @@
actual.lintRules.map((l) => l.name),
unorderedEquals(expected.lintRules.map((l) => l.name)),
);
- expect(actual.strongMode, expected.strongMode);
expect(actual.implicitCasts, expected.implicitCasts);
expect(actual.implicitDynamic, expected.implicitDynamic);
expect(actual.strictInference, expected.strictInference);
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index b1dc776..2652a8d 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -949,8 +949,6 @@
itemElement1 = itemElement;
expect(closureElement.returnType, typeProvider.nullType);
- // TODO(scheglov) Make this null.
-// expect(closureElement.type.element, same(closureElement));
assertType(closureElement.type, closureTypeStr);
expect(closure.staticType, same(closureElement.type));
@@ -991,7 +989,6 @@
expect(itemElement, isNot(same(itemElement1)));
expect(closureElement.returnType, typeProvider.nullType);
- expect(closureElement.type.element, same(closureElement));
assertType(closureElement.type, closureTypeStr);
expect(closure.staticType, same(closureElement.type));
diff --git a/pkg/analyzer/test/src/dart/analysis/experiments_test.dart b/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
index d45fd53..f78177e 100644
--- a/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/experiments_test.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/analysis/experiments_impl.dart';
+import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -54,7 +55,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['no-a', 'a'])), [true]);
}
@@ -67,7 +69,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['a', 'no-a'])), [false]);
}
@@ -79,7 +82,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['b'] = ExperimentalFeature(
index: 1,
@@ -87,7 +91,8 @@
isEnabledByDefault: true,
isExpired: false,
documentation: 'b',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getFlags(fromStrings([])), [false, true]);
}
@@ -99,7 +104,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['no-a'])), [false]);
}
@@ -111,7 +117,8 @@
isEnabledByDefault: true,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getFlags(fromStrings(['no-a'])), [false]);
}
@@ -123,7 +130,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['a'])), [true]);
}
@@ -135,7 +143,8 @@
isEnabledByDefault: true,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getFlags(fromStrings(['a'])), [true]);
}
@@ -148,7 +157,8 @@
isEnabledByDefault: true,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getFlags(fromStrings(['no-a'])), [true]);
}
@@ -161,7 +171,8 @@
isEnabledByDefault: false,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['a'])), [false]);
}
@@ -174,7 +185,8 @@
isEnabledByDefault: false,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getFlags(fromStrings(['no-a'])), [false]);
}
@@ -187,7 +199,8 @@
isEnabledByDefault: true,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getFlags(fromStrings(['a'])), [true]);
}
@@ -204,7 +217,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['b'] = ExperimentalFeature(
index: 1,
@@ -212,7 +226,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'b',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['c'] = ExperimentalFeature(
index: 2,
@@ -220,7 +235,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'c',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult =
getValidateCombinationResult(['a', 'no-c'], ['no-b', 'c']);
@@ -237,7 +253,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['b'] = ExperimentalFeature(
index: 1,
@@ -245,7 +262,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'b',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['c'] = ExperimentalFeature(
index: 2,
@@ -253,7 +271,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'c',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult =
getValidateCombinationResult(['a', 'c'], ['no-b', 'no-c']);
@@ -270,7 +289,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['b'] = ExperimentalFeature(
index: 1,
@@ -278,7 +298,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'b',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
knownFeatures['c'] = ExperimentalFeature(
index: 2,
@@ -286,7 +307,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'c',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getValidateCombinationResult(['a', 'c'], ['no-b', 'c']), isEmpty);
}
@@ -298,7 +320,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult = getValidationResult(['no-a', 'a']);
expect(validationResult, hasLength(1));
@@ -318,7 +341,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult = getValidationResult(['a', 'no-a']);
expect(validationResult, hasLength(1));
@@ -338,7 +362,8 @@
isEnabledByDefault: true,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
expect(getValidationResult(['no-a', 'no-a']), isEmpty);
}
@@ -350,7 +375,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
expect(getValidationResult(['a', 'a']), isEmpty);
}
@@ -362,7 +388,8 @@
isEnabledByDefault: true,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
var validationResult = getValidationResult(['no-a']);
expect(validationResult, hasLength(1));
@@ -380,7 +407,8 @@
isEnabledByDefault: false,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult = getValidationResult(['a']);
expect(validationResult, hasLength(1));
@@ -398,7 +426,8 @@
isEnabledByDefault: false,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
);
var validationResult = getValidationResult(['no-a']);
expect(validationResult, hasLength(1));
@@ -416,7 +445,8 @@
isEnabledByDefault: true,
isExpired: true,
documentation: 'a',
- firstSupportedVersion: '1.0.0',
+ experimentalReleaseVersion: null,
+ releaseVersion: Version.parse('1.0.0'),
);
var validationResult = getValidationResult(['a']);
expect(validationResult, hasLength(1));
diff --git a/pkg/analyzer/test/src/dart/analysis/session_test.dart b/pkg/analyzer/test/src/dart/analysis/session_test.dart
index 839533e..5e5655f 100644
--- a/pkg/analyzer/test/src/dart/analysis/session_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/session_test.dart
@@ -493,20 +493,4 @@
test_resourceProvider() async {
expect(session.resourceProvider, resourceProvider);
}
-
- @deprecated
- test_typeProvider() async {
- var typeProvider = await session.typeProvider;
- expect(typeProvider.intType.element.name, 'int');
- }
-
- @deprecated
- test_typeSystem() async {
- var typeSystem = await session.typeSystem;
- var typeProvider = typeSystem.typeProvider;
- expect(
- typeSystem.isSubtypeOf(typeProvider.intType, typeProvider.numType),
- isTrue,
- );
- }
}
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart
index f8fa5e5..b4fda30 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -1191,71 +1191,6 @@
expect(type.resolveToBound(null), same(type));
}
- @deprecated
- void test_substitute2_equal() {
- ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]);
- TypeParameterType parameterType =
- typeParameterTypeStar(definingClass.typeParameters[0]);
- MethodElementImpl functionElement = MethodElementImpl('m', -1);
- String namedParameterName = "c";
- functionElement.parameters = <ParameterElement>[
- ElementFactory.requiredParameter2("a", parameterType),
- ElementFactory.positionalParameter2("b", parameterType),
- ElementFactory.namedParameter2(namedParameterName, parameterType)
- ];
- functionElement.returnType = parameterType;
- definingClass.methods = <MethodElement>[functionElement];
- FunctionTypeImpl functionType = functionElement.type;
- InterfaceTypeImpl argumentType =
- interfaceTypeStar(ClassElementImpl('D', -1));
- FunctionType result = functionType
- .substitute2(<DartType>[argumentType], <DartType>[parameterType]);
- expect(result.returnType, argumentType);
- List<DartType> normalParameters = result.normalParameterTypes;
- expect(normalParameters, hasLength(1));
- expect(normalParameters[0], argumentType);
- List<DartType> optionalParameters = result.optionalParameterTypes;
- expect(optionalParameters, hasLength(1));
- expect(optionalParameters[0], argumentType);
- Map<String, DartType> namedParameters = result.namedParameterTypes;
- expect(namedParameters, hasLength(1));
- expect(namedParameters[namedParameterName], argumentType);
- }
-
- @deprecated
- void test_substitute2_notEqual() {
- DartType returnType = interfaceTypeStar(ClassElementImpl('R', -1));
- DartType normalParameterType = interfaceTypeStar(ClassElementImpl('A', -1));
- DartType optionalParameterType =
- interfaceTypeStar(ClassElementImpl('B', -1));
- DartType namedParameterType = interfaceTypeStar(ClassElementImpl('C', -1));
- FunctionElementImpl functionElement = FunctionElementImpl('f', -1);
- String namedParameterName = "c";
- functionElement.parameters = <ParameterElement>[
- ElementFactory.requiredParameter2("a", normalParameterType),
- ElementFactory.positionalParameter2("b", optionalParameterType),
- ElementFactory.namedParameter2(namedParameterName, namedParameterType)
- ];
- functionElement.returnType = returnType;
- FunctionTypeImpl functionType = functionElement.type;
- InterfaceTypeImpl argumentType =
- interfaceTypeStar(ClassElementImpl('D', -1));
- TypeParameterTypeImpl parameterType =
- typeParameterTypeStar(TypeParameterElementImpl('E', -1));
- FunctionType result = functionType
- .substitute2(<DartType>[argumentType], <DartType>[parameterType]);
- expect(result.returnType, returnType);
- List<DartType> normalParameters = result.normalParameterTypes;
- expect(normalParameters, hasLength(1));
- expect(normalParameters[0], normalParameterType);
- List<DartType> optionalParameters = result.optionalParameterTypes;
- expect(optionalParameters, hasLength(1));
- expect(optionalParameters[0], optionalParameterType);
- Map<String, DartType> namedParameters = result.namedParameterTypes;
- expect(namedParameters, hasLength(1));
- expect(namedParameters[namedParameterName], namedParameterType);
- }
-
void test_toString_recursive() {
var t = ElementFactory.genericTypeAliasElement("t");
var s = ElementFactory.genericTypeAliasElement("s");
@@ -2096,44 +2031,6 @@
// Returns this.
expect(type.resolveToBound(null), same(type));
}
-
- @deprecated
- void test_substitute_exception() {
- try {
- var classA = class_(name: 'A');
- InterfaceTypeImpl type = interfaceTypeStar(classA);
- InterfaceType argumentType = interfaceTypeStar(class_(name: 'B'));
- type.substitute2(<DartType>[argumentType], <DartType>[]);
- fail(
- "Expected to encounter exception, argument and parameter type array lengths not equal.");
- } catch (e) {
- // Expected result
- }
- }
-
- @deprecated
- void test_substitute_notEqual() {
- // The [test_substitute_equals] above has a slightly higher level
- // implementation.
- var classA = class_(name: 'A');
- TypeParameterElementImpl parameterElement =
- TypeParameterElementImpl('E', -1);
- TypeParameterTypeImpl parameter = typeParameterTypeStar(parameterElement);
- InterfaceTypeImpl type = InterfaceTypeImpl(
- element: classA,
- typeArguments: <DartType>[parameter],
- nullabilitySuffix: NullabilitySuffix.star,
- );
- InterfaceType argumentType = interfaceTypeStar(class_(name: 'B'));
- TypeParameterTypeImpl parameterType =
- typeParameterTypeStar(TypeParameterElementImpl('F', -1));
- InterfaceType result =
- type.substitute2(<DartType>[argumentType], <DartType>[parameterType]);
- expect(result.element, classA);
- List<DartType> resultArguments = result.typeArguments;
- expect(resultArguments, hasLength(1));
- expect(resultArguments[0], parameter);
- }
}
@reflectiveTest
@@ -2386,27 +2283,6 @@
same(VoidTypeImpl.instance));
}
- @deprecated
- void test_substitute_equal() {
- TypeParameterElementImpl element = TypeParameterElementImpl('E', -1);
- TypeParameterTypeImpl type = typeParameterTypeStar(element);
- InterfaceTypeImpl argument = interfaceTypeStar(ClassElementImpl('A', -1));
- TypeParameterTypeImpl parameter = typeParameterTypeStar(element);
- expect(type.substitute2(<DartType>[argument], <DartType>[parameter]),
- same(argument));
- }
-
- @deprecated
- void test_substitute_notEqual() {
- TypeParameterTypeImpl type =
- typeParameterTypeStar(TypeParameterElementImpl('E', -1));
- InterfaceTypeImpl argument = interfaceTypeStar(ClassElementImpl('A', -1));
- TypeParameterTypeImpl parameter =
- typeParameterTypeStar(TypeParameterElementImpl('F', -1));
- expect(type.substitute2(<DartType>[argument], <DartType>[parameter]),
- same(type));
- }
-
void _assert_asInstanceOf(
DartType type,
ClassElement element,
diff --git a/pkg/analyzer/test/src/dart/element/function_type_test.dart b/pkg/analyzer/test/src/dart/element/function_type_test.dart
index 9ed2264..72efa9d 100644
--- a/pkg/analyzer/test/src/dart/element/function_type_test.dart
+++ b/pkg/analyzer/test/src/dart/element/function_type_test.dart
@@ -408,55 +408,6 @@
returnType: same(objectType));
}
- @deprecated
- test_synthetic_substitute() {
- // Map<T, U> Function<U extends T>(T x, U y)
- var t = typeParameter('T');
- var u = typeParameter('U', bound: typeParameterTypeNone(t));
- var x = requiredParameter(name: 'x', type: typeParameterTypeNone(t));
- var y = requiredParameter(name: 'y', type: typeParameterTypeNone(u));
- FunctionType f = FunctionTypeImpl.synthetic(
- mapOf(typeParameterTypeNone(t), typeParameterTypeNone(u)), [u], [x, y],
- nullabilitySuffix: NullabilitySuffix.star);
- FunctionType substituted =
- f.substitute2([objectType], [typeParameterTypeNone(t)]);
- var uSubstituted = substituted.typeFormals[0];
- basicChecks(substituted,
- element: isNull,
- displayName: 'Map<Object, U> Function<U extends Object>(Object, U)',
- returnType: mapOf(objectType, typeParameterTypeNone(uSubstituted)),
- typeFormals: [uSubstituted],
- normalParameterNames: ['x', 'y'],
- normalParameterTypes: [
- same(objectType),
- typeParameterTypeNone(uSubstituted)
- ],
- parameters: hasLength(2));
- }
-
- @deprecated
- test_synthetic_substitute_argument_length_mismatch() {
- // dynamic Function()
- var t = typeParameter('T');
- FunctionType f = FunctionTypeImpl.synthetic(dynamicType, [], [],
- nullabilitySuffix: NullabilitySuffix.star);
- expect(() => f.substitute2([], [typeParameterTypeStar(t)]),
- throwsA(TypeMatcher<ArgumentError>()));
- }
-
- @deprecated
- test_synthetic_substitute_unchanged() {
- // dynamic Function<U>(U x)
- var t = typeParameter('T');
- var u = typeParameter('U');
- var x = requiredParameter(name: 'x', type: typeParameterTypeStar(u));
- FunctionType f = FunctionTypeImpl.synthetic(dynamicType, [u], [x],
- nullabilitySuffix: NullabilitySuffix.star);
- FunctionType substituted =
- f.substitute2([objectType], [typeParameterTypeStar(t)]);
- expect(substituted, same(f));
- }
-
test_synthetic_typeFormals() {
var t = typeParameter('T');
FunctionType f = FunctionTypeImpl(
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index 0dc26d5..6c9b81a 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -560,8 +560,10 @@
}
''');
var invocation = findNode.functionExpressionInvocation('1(2)');
- expect(invocation.staticInvokeType.element,
- same(findElement.method('call', of: 'E')));
+ expect(
+ invocation.staticElement,
+ same(findElement.method('call', of: 'E')),
+ );
assertInvokeType(invocation, 'int Function(int)');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
index ab2e0b4..0e2a55e 100644
--- a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
@@ -44,13 +44,13 @@
literal: 0
staticType: int
constructorName: ConstructorName
+ staticElement: self::@class::A::@constructor::•
type: TypeName
name: SimpleIdentifier
staticElement: self::@class::A
staticType: null
token: A
type: A
- staticElement: self::@class::A::@constructor::•
staticType: A
element: self::@class::A::@constructor::•
name: SimpleIdentifier
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index 365aac0..98788a3 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -336,6 +336,7 @@
_writeln('ConstructorName');
_withIndent(() {
_writeNode('name', node.name);
+ _writeElement('staticElement', node.staticElement);
_writeNode('type', node.type);
});
}
@@ -792,7 +793,6 @@
properties.addNode('constructorName', node.constructorName);
properties.addToken('keyword', node.keyword);
_addExpression(properties, node);
- _addConstructorReferenceNode(properties, node);
_writeProperties(properties);
});
}
@@ -1477,14 +1477,6 @@
_addAstNode(properties, node);
}
- void _addConstructorReferenceNode(
- _Properties properties,
- ConstructorReferenceNode node,
- ) {
- properties.addElement('staticElement', node.staticElement);
- _addAstNode(properties, node);
- }
-
void _addDeclaration(_Properties properties, Declaration node) {
properties.addElement('declaredElement', node.declaredElement);
_addAnnotatedNode(properties, node);
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 83bfa1f..a9edb27 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -8,7 +8,6 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/element/element.dart';
@@ -10556,42 +10555,6 @@
annotateNullability: true);
}
- @deprecated
- test_type_param_generic_function_type_nullability_legacy() async {
- featureSet = disableNnbd;
- var library = await checkLibrary('''
-T f<T>(T t) {}
-var g = f;
-''');
- checkElementText(library, '''
-T Function<T>(T) g;
-T f<T>(T t) {}
-''');
- var g = library.definingCompilationUnit.topLevelVariables[0];
- var t = (g.type as FunctionType).typeFormals[0];
- // TypeParameterElement.type has a nullability suffix of `star` regardless
- // of whether it appears in a migrated library.
- expect(t.type.nullabilitySuffix, NullabilitySuffix.star);
- }
-
- @deprecated
- test_type_param_generic_function_type_nullability_migrated() async {
- featureSet = enableNnbd;
- var library = await checkLibrary('''
-T f<T>(T t) {}
-var g = f;
-''');
- checkElementText(library, '''
-T Function<T>(T) g;
-T f<T>(T t) {}
-''');
- var g = library.definingCompilationUnit.topLevelVariables[0];
- var t = (g.type as FunctionType).typeFormals[0];
- // TypeParameterElement.type has a nullability suffix of `star` regardless
- // of whether it appears in a migrated library.
- expect(t.type.nullabilitySuffix, NullabilitySuffix.star);
- }
-
test_type_param_ref_nullability_none() async {
featureSet = enableNnbd;
var library = await checkLibrary('''
@@ -11828,15 +11791,15 @@
InstanceCreationExpression
argumentList: ArgumentList
constructorName: ConstructorName
+ staticElement: ConstructorMember
+ base: self::@class::A::@constructor::•
+ substitution: {T: int}
type: TypeName
name: SimpleIdentifier
staticElement: self::@class::A
staticType: null
token: A
type: A<int>
- staticElement: ConstructorMember
- base: self::@class::A::@constructor::•
- substitution: {T: int}
staticType: A<int>
''',
withFullyResolvedAst: true);
diff --git a/pkg/analyzer/tool/experiments/generate.dart b/pkg/analyzer/tool/experiments/generate.dart
index 02b1a0e..0183ed7 100644
--- a/pkg/analyzer/tool/experiments/generate.dart
+++ b/pkg/analyzer/tool/experiments/generate.dart
@@ -169,18 +169,19 @@
var enabledIn = (features[key] as YamlMap)['enabledIn'];
out.write('''
- static const $id = ExperimentalFeature(
+ static final $id = ExperimentalFeature(
index: $index,
enableString: EnableString.$id,
isEnabledByDefault: IsEnabledByDefault.$id,
isExpired: IsExpired.$id,
documentation: '$help',
''');
+ out.write("experimentalReleaseVersion: null,");
if (enabledIn != null) {
enabledIn = _versionNumberAsString(enabledIn);
- out.write("firstSupportedVersion: '$enabledIn',");
+ out.write("releaseVersion: Version.parse('$enabledIn'),");
} else {
- out.write("firstSupportedVersion: null,");
+ out.write("releaseVersion: null,");
}
out.writeln(');');
++index;
@@ -236,7 +237,7 @@
out.write('''
/// A map containing information about all known experimental flags.
-const _knownFeatures = <String, ExperimentalFeature>{
+final _knownFeatures = <String, ExperimentalFeature>{
''');
for (var key in keysSorted) {
var id = keyToIdentifier(key);
diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml
index b761a0e..7fb1c29 100644
--- a/pkg/analyzer_cli/pubspec.yaml
+++ b/pkg/analyzer_cli/pubspec.yaml
@@ -1,7 +1,9 @@
name: analyzer_cli
description: Command line interface for the Dart Analyzer.
+
# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none
+
environment:
sdk: "^2.7.0"
dependencies:
@@ -9,13 +11,14 @@
args: '>=0.13.0 <2.0.0'
bazel_worker: ^0.1.0
collection: ^1.14.1
+ convert: any
linter: ^0.1.16
- package_config: '>=0.1.5 <2.0.0'
- protobuf: ^0.13.0
+ meta: any
+ path: any
pub_semver: ^1.4.2
yaml: ^2.1.2
dev_dependencies:
pedantic: ^1.9.0
+ protobuf: ^0.13.0
test_reflective_loader: ^0.1.8
test: ^1.0.0
- usage: ^3.2.0+1
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index 9d682ef..7aeb145 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -102,7 +102,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'a',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
),
'b': ExperimentalFeature(
index: 1,
@@ -110,7 +111,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'b',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
),
'c': ExperimentalFeature(
index: 2,
@@ -118,7 +120,8 @@
isEnabledByDefault: false,
isExpired: false,
documentation: 'c',
- firstSupportedVersion: null,
+ experimentalReleaseVersion: null,
+ releaseVersion: null,
),
};
diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml
index df17df9..1c02eab 100644
--- a/pkg/analyzer_plugin/pubspec.yaml
+++ b/pkg/analyzer_plugin/pubspec.yaml
@@ -11,15 +11,12 @@
analyzer: '^0.39.12'
charcode: '^1.1.0'
dart_style: '^1.2.0'
- html: '>=0.13.1 <0.15.0'
- meta: ^1.0.2
- path: '^1.4.1'
pub_semver: '^1.3.2'
dev_dependencies:
analysis_tool:
path: ../analysis_tool
- front_end:
- path: ../front_end
+ html: '>=0.13.1 <0.15.0'
+ path: '^1.4.1'
test_reflective_loader: ^0.1.8
test: ^1.0.0
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 4b78a07..d6a7e2f 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -203,8 +203,7 @@
MessageKind.JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER: const MessageTemplate(
MessageKind.JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER,
"Member '#{member}' in js-interop class '#{cls}' is not external.",
- howToFix: "Try adding 'external' to '#{member}'. If #{member} is a "
- "`late` field, use an `external` getter/setter instead.",
+ howToFix: "Try adding 'external' to '#{member}'.",
examples: const [
"""
import 'package:js/js.dart';
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index c950e0c..811409f 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -3512,7 +3512,7 @@
//
final Selector receiverTypeCheckSelector;
- AbstractValue checkedType; // Not final because we refine it.
+ final AbstractValue checkedType;
HPrimitiveCheck(this.typeExpression, this.kind, AbstractValue type,
HInstruction input, SourceInformation sourceInformation,
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 8e249f8..8c08b62 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -215,51 +215,14 @@
return candidateType;
}
- AbstractValue _numericFixup(AbstractValue outputType, AbstractValue inputType,
- AbstractValue checkedType) {
- if (abstractValueDomain.isEmpty(outputType).isDefinitelyTrue) {
- // Intersection of double and integer conflicts (is empty), but JS numbers
- // can be both int and double at the same time. For example, the input
- // can be a literal double '8.0' that is marked as an integer (because 'is
- // int' will return 'true'). What we really need to do is make the
- // overlap between int and double values explicit in the TypeMask system.
- if (abstractValueDomain.isIntegerOrNull(inputType).isDefinitelyTrue &&
- abstractValueDomain.isDoubleOrNull(checkedType).isDefinitelyTrue) {
- if (abstractValueDomain.isNull(inputType).isPotentiallyTrue &&
- abstractValueDomain.isNull(checkedType).isPotentiallyTrue) {
- outputType =
- abstractValueDomain.includeNull(abstractValueDomain.doubleType);
- } else {
- outputType = abstractValueDomain.doubleType;
- }
- }
- }
- return outputType;
- }
-
@override
AbstractValue visitPrimitiveCheck(HPrimitiveCheck instruction) {
HInstruction input = instruction.checkedInput;
AbstractValue inputType = input.instructionType;
AbstractValue checkedType = instruction.checkedType;
- // We must make sure a receiver or argument check does not try to do an int
- // check, because an int check is not enough. We only do an int check if
- // the input is integer or null.
- if (abstractValueDomain.isNumberOrNull(checkedType).isDefinitelyTrue &&
- abstractValueDomain.isDoubleOrNull(checkedType).isDefinitelyFalse &&
- input.isIntegerOrNull(abstractValueDomain).isDefinitelyTrue) {
- instruction.checkedType = abstractValueDomain.intType;
- } else if (abstractValueDomain
- .isIntegerOrNull(checkedType)
- .isDefinitelyTrue &&
- input.isIntegerOrNull(abstractValueDomain).isPotentiallyFalse) {
- instruction.checkedType = abstractValueDomain.numType;
- }
-
AbstractValue outputType =
abstractValueDomain.intersection(checkedType, inputType);
- outputType = _numericFixup(outputType, inputType, checkedType);
if (inputType != outputType) {
// Replace dominated uses of input with uses of this HPrimitiveCheck so
// the uses benefit from the stronger type.
@@ -501,7 +464,6 @@
AbstractValue inputType = input.instructionType;
AbstractValue outputType =
abstractValueDomain.intersection(checkedType, inputType);
- outputType = _numericFixup(outputType, inputType, checkedType);
if (inputType != outputType) {
// Replace dominated uses of input with uses of this check so the uses
// benefit from the stronger type.
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index f5b9ef8..ba32abd 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -48,11 +48,12 @@
createAnalyticsInstance(args.contains('--disable-dartdev-analytics'));
// If we have not printed the analyticsNoticeOnFirstRunMessage to stdout,
- // and the user is on a terminal, then print the disclosure and set
- // analytics.disclosureShownOnTerminal.
+ // the user is on a terminal, and the machine is not a bot, then print the
+ // disclosure and set analytics.disclosureShownOnTerminal to true.
if (analytics is DartdevAnalytics &&
!analytics.disclosureShownOnTerminal &&
- io.stdout.hasTerminal) {
+ io.stdout.hasTerminal &&
+ !isBot()) {
print(analyticsNoticeOnFirstRunMessage);
analytics.disclosureShownOnTerminal = true;
}
diff --git a/pkg/dartdev/lib/src/analytics.dart b/pkg/dartdev/lib/src/analytics.dart
index fd12e56..f909916 100644
--- a/pkg/dartdev/lib/src/analytics.dart
+++ b/pkg/dartdev/lib/src/analytics.dart
@@ -138,6 +138,10 @@
return Directory(path.join(homeDir.path, _dartDirectoryName));
}
+/// The method used by dartdev to determine if this machine is a bot such as a
+/// CI machine.
+bool isBot() => telemetry.isRunningOnBot();
+
class DartdevAnalytics extends AnalyticsImpl {
DartdevAnalytics(String trackingId, File settingsFile, String appName)
: super(
@@ -152,7 +156,7 @@
bool get enabled {
// Don't enable if the user hasn't been shown the disclosure or if this
// machine is bot.
- if (!disclosureShownOnTerminal || telemetry.isRunningOnBot()) {
+ if (!disclosureShownOnTerminal || isBot()) {
return false;
}
@@ -163,7 +167,7 @@
bool get disclosureShownOnTerminal =>
(properties['disclosureShown'] as bool) ?? false;
- void set disclosureShownOnTerminal(bool value) {
+ set disclosureShownOnTerminal(bool value) {
properties['disclosureShown'] = value;
}
}
diff --git a/pkg/dartdev/lib/src/commands/test.dart b/pkg/dartdev/lib/src/commands/test.dart
index ef2a9a2..ebed5ef 100644
--- a/pkg/dartdev/lib/src/commands/test.dart
+++ b/pkg/dartdev/lib/src/commands/test.dart
@@ -2,6 +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.
+// ignore_for_file: avoid_redundant_argument_values
+// ignore_for_file: lines_longer_than_80_chars
+// ignore_for_file: prefer_initializing_formals
+
import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index a1e7fe2..a42480f 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -6,22 +6,21 @@
environment:
sdk: '>=2.6.0 <3.0.0'
dependencies:
+ analysis_server_client:
+ path: ../analysis_server_client
+ analyzer: any
args: ^1.6.0
cli_util: '>=0.1.4 <0.3.0'
dart2native:
path: ../dart2native
- dds:
- path: ../dds
- intl: ^0.16.1
- nnbd_migration: any # this uses the SDK version
+ dart_style: any
+ nnbd_migration:
+ path: ../nnbd_migration
path: ^1.0.0
- stack_trace: ^1.9.3
stagehand: 3.3.7
telemetry:
path: ../telemetry
usage: ^3.4.0
- watcher: ^0.9.6
- yaml: ^2.2.0
dev_dependencies:
test: ^1.0.0
diff --git a/pkg/dartdev/test/smoke/smoke_test.dart b/pkg/dartdev/test/smoke/smoke_test.dart
index 5f9c604..cb07f32 100644
--- a/pkg/dartdev/test/smoke/smoke_test.dart
+++ b/pkg/dartdev/test/smoke/smoke_test.dart
@@ -52,8 +52,8 @@
});
test(
- 'dart --sound-null-safety --enable-experiment=non-nullable run smoke.dart',
- () async {
+ 'dart --sound-null-safety --enable-experiment=non-nullable '
+ 'run smoke.dart', () async {
final result = await Process.run(
Platform.executable,
[
diff --git a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
index f8dfd83..5a651dc 100644
--- a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
@@ -27,7 +27,7 @@
/// then adds or removes a '?' trailing the named type as appropriate.
class NonNullableFix {
// TODO(srawlins): Refactor to use
- // `Feature.non_nullable.firstSupportedVersion` when this becomes non-null.
+ // `Feature.non_nullable.releaseVersion` when this becomes non-null.
static const String _intendedMinimumSdkVersion = '2.9.0';
// In the package_config.json file, the patch number is omitted.
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index 6b71795..f7d889e 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -44,10 +44,10 @@
bool removeViaComments = false,
bool warnOnWeakCode = false}) async {
for (var path in migratedInput.keys) {
- driver.getFileSync(newFile(path, content: migratedInput[path]).path);
+ newFile(path, content: migratedInput[path]);
}
for (var path in input.keys) {
- driver.getFileSync(newFile(path, content: input[path]).path);
+ newFile(path, content: input[path]);
}
var listener = new TestMigrationListener();
var migration = NullabilityMigration(listener, getLineInfo,
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 4ddeafc..935a637 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -705,19 +705,13 @@
if (_configuration.useElf) ...[
"--snapshot-kind=app-aot-elf",
"--elf=$tempDir/out.aotsnapshot",
+ // Only splitting with a ELF to avoid having to setup compilation of
+ // multiple assembly files in the test harness.
+ "--loading-unit-manifest=$tempDir/ignored.json",
] else ...[
"--snapshot-kind=app-aot-assembly",
"--assembly=$tempDir/out.S",
],
- // Only splitting with a ELF to avoid having to setup compilation of
- // multiple assembly files in the test harness. Only splitting tests of
- // deferred imports because splitting currently requires disable bare
- // instructions mode, and we want to continue testing bare instructions
- // mode.
- if (_configuration.useElf && arguments.last.contains("deferred")) ...[
- "--loading-unit-manifest=$tempDir/ignored.json",
- "--use-table-dispatch=false",
- ],
if (_isAndroid && _isArm) '--no-sim-use-hardfp',
if (_configuration.isMinified) '--obfuscate',
// The SIMARM precompiler assumes support for integer division, but the
diff --git a/runtime/tests/vm/dart/deferred_loading_call_modes_test.dart b/runtime/tests/vm/dart/deferred_loading_call_modes_test.dart
new file mode 100644
index 0000000..8fa1e45
--- /dev/null
+++ b/runtime/tests/vm/dart/deferred_loading_call_modes_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// VMOptions=--use_bare_instructions=false
+// VMOptions=--use_bare_instructions=true --use_table_dispatch=false
+// VMOptions=--use_bare_instructions=true --use_table_dispatch=true
+
+import "splay_test.dart" deferred as splay; // Some non-trivial code.
+
+main() async {
+ await splay.loadLibrary();
+ splay.main();
+}
diff --git a/runtime/tests/vm/dart/incompatible_loading_unit_test.dart b/runtime/tests/vm/dart/incompatible_loading_unit_test.dart
index 5facc47..9adf6e8 100644
--- a/runtime/tests/vm/dart/incompatible_loading_unit_test.dart
+++ b/runtime/tests/vm/dart/incompatible_loading_unit_test.dart
@@ -79,7 +79,6 @@
// Compile kernel to ELF.
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
- "--use-table-dispatch=false",
"--elf=$snapshot1",
"--loading-unit-manifest=$manifest1",
dill1,
@@ -95,7 +94,6 @@
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
- "--use-table-dispatch=false",
"--elf=$snapshot2",
"--loading-unit-manifest=$manifest2",
dill2,
diff --git a/runtime/tests/vm/dart_2/deferred_loading_call_modes_test.dart b/runtime/tests/vm/dart_2/deferred_loading_call_modes_test.dart
new file mode 100644
index 0000000..8fa1e45
--- /dev/null
+++ b/runtime/tests/vm/dart_2/deferred_loading_call_modes_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// VMOptions=--use_bare_instructions=false
+// VMOptions=--use_bare_instructions=true --use_table_dispatch=false
+// VMOptions=--use_bare_instructions=true --use_table_dispatch=true
+
+import "splay_test.dart" deferred as splay; // Some non-trivial code.
+
+main() async {
+ await splay.loadLibrary();
+ splay.main();
+}
diff --git a/runtime/tests/vm/dart_2/incompatible_loading_unit_test.dart b/runtime/tests/vm/dart_2/incompatible_loading_unit_test.dart
index 5facc47..9adf6e8 100644
--- a/runtime/tests/vm/dart_2/incompatible_loading_unit_test.dart
+++ b/runtime/tests/vm/dart_2/incompatible_loading_unit_test.dart
@@ -79,7 +79,6 @@
// Compile kernel to ELF.
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
- "--use-table-dispatch=false",
"--elf=$snapshot1",
"--loading-unit-manifest=$manifest1",
dill1,
@@ -95,7 +94,6 @@
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
- "--use-table-dispatch=false",
"--elf=$snapshot2",
"--loading-unit-manifest=$manifest2",
dill2,
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index f02d468..ba76ca6 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -6206,15 +6206,16 @@
return NULL;
}
-void Deserializer::ReadDispatchTable() {
+void Deserializer::ReadDispatchTable(ReadStream* stream) {
#if defined(DART_PRECOMPILED_RUNTIME)
- const intptr_t length = ReadUnsigned();
+ const uint8_t* table_snapshot_start = stream->AddressOfCurrentPosition();
+ const intptr_t length = stream->ReadUnsigned();
if (length == 0) return;
// Not all Code objects may be in the code_order_table when instructions can
// be deduplicated. Thus, we serialize the reference ID of the first code
// object, from which we can get the reference ID for any code object.
- const intptr_t first_code_id = ReadUnsigned();
+ const intptr_t first_code_id = stream->ReadUnsigned();
auto const I = isolate();
auto code = I->object_store()->dispatch_table_null_error_stub();
@@ -6233,7 +6234,7 @@
repeat_count--;
continue;
}
- auto const encoded = Read<intptr_t>();
+ auto const encoded = stream->Read<intptr_t>();
if (encoded == 0) {
value = null_entry;
} else if (encoded < 0) {
@@ -6254,6 +6255,10 @@
ASSERT(repeat_count == 0);
I->group()->set_dispatch_table(table);
+ intptr_t table_snapshot_size =
+ stream->AddressOfCurrentPosition() - table_snapshot_start;
+ I->group()->set_dispatch_table_snapshot(table_snapshot_start);
+ I->group()->set_dispatch_table_snapshot_size(table_snapshot_size);
#endif
}
@@ -6674,7 +6679,7 @@
}
// Deserialize dispatch table (when applicable)
- ReadDispatchTable();
+ ReadDispatchTable(&stream_);
#if defined(DEBUG)
int32_t section_marker = Read<int32_t>();
@@ -6758,6 +6763,15 @@
code->ptr()->code_source_map_ = static_cast<CodeSourceMapPtr>(ReadRef());
}
+ // Reinitialize the dispatch table by rereading the table's serialization
+ // in the root snapshot.
+ IsolateGroup* group = thread()->isolate()->group();
+ if (group->dispatch_table_snapshot() != nullptr) {
+ ReadStream stream(group->dispatch_table_snapshot(),
+ group->dispatch_table_snapshot_size());
+ ReadDispatchTable(&stream);
+ }
+
#if defined(DEBUG)
int32_t section_marker = Read<int32_t>();
ASSERT(section_marker == kSectionMarker);
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index 4710372..26e3f38 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -704,7 +704,7 @@
DeserializationCluster* ReadCluster();
- void ReadDispatchTable();
+ void ReadDispatchTable(ReadStream* stream);
intptr_t next_index() const { return next_ref_index_; }
Heap* heap() const { return heap_; }
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index a7882d7..6e327e2 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6805,11 +6805,6 @@
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
- if (FLAG_use_bare_instructions && FLAG_use_table_dispatch) {
- return Api::NewError(
- "Splitting is not compatible with --use_table_dispatch.");
- }
-
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
CHECK_NULL(next_callback);
@@ -6887,11 +6882,6 @@
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
- if (FLAG_use_bare_instructions && FLAG_use_table_dispatch) {
- return Api::NewError(
- "Splitting is not compatible with --use_table_dispatch.");
- }
-
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
CHECK_NULL(next_callback);
diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc
index 170f52c..7e81415 100644
--- a/runtime/vm/heap/heap.cc
+++ b/runtime/vm/heap/heap.cc
@@ -65,6 +65,8 @@
barrier_(),
barrier_done_(),
read_only_(false),
+ gc_new_space_in_progress_(false),
+ gc_old_space_in_progress_(false),
last_gc_was_old_space_(false),
assume_scavenge_will_fail_(false),
gc_on_nth_allocation_(kNoForcedGarbageCollection) {
@@ -235,8 +237,6 @@
heap_(isolate()->heap()),
old_space_(heap_->old_space()),
writable_(writable) {
- isolate()->safepoint_handler()->SafepointThreads(thread);
-
{
// It's not safe to iterate over old space when concurrent marking or
// sweeping is in progress, or another thread is iterating the heap, so wait
@@ -255,7 +255,7 @@
ml.Enter();
}
while (old_space_->tasks() > 0) {
- ml.Wait();
+ ml.WaitWithSafepointCheck(thread);
}
}
#if defined(DEBUG)
@@ -265,6 +265,8 @@
old_space_->set_tasks(1);
}
+ isolate()->safepoint_handler()->SafepointThreads(thread);
+
if (writable_) {
heap_->WriteProtectCode(false);
}
@@ -275,18 +277,16 @@
heap_->WriteProtectCode(true);
}
- {
- MonitorLocker ml(old_space_->tasks_lock());
-#if defined(DEBUG)
- ASSERT(old_space_->iterating_thread_ == thread());
- old_space_->iterating_thread_ = NULL;
-#endif
- ASSERT(old_space_->tasks() == 1);
- old_space_->set_tasks(0);
- ml.NotifyAll();
- }
-
isolate()->safepoint_handler()->ResumeThreads(thread());
+
+ MonitorLocker ml(old_space_->tasks_lock());
+#if defined(DEBUG)
+ ASSERT(old_space_->iterating_thread_ == thread());
+ old_space_->iterating_thread_ = NULL;
+#endif
+ ASSERT(old_space_->tasks() == 1);
+ old_space_->set_tasks(0);
+ ml.NotifyAll();
}
void HeapIterationScope::IterateObjects(ObjectVisitor* visitor) const {
@@ -360,14 +360,57 @@
return raw_obj;
}
+bool Heap::BeginNewSpaceGC(Thread* thread) {
+ MonitorLocker ml(&gc_in_progress_monitor_);
+ bool start_gc_on_thread = true;
+ while (gc_new_space_in_progress_ || gc_old_space_in_progress_) {
+ start_gc_on_thread = !gc_new_space_in_progress_;
+ ml.WaitWithSafepointCheck(thread);
+ }
+ if (start_gc_on_thread) {
+ gc_new_space_in_progress_ = true;
+ return true;
+ }
+ return false;
+}
+
+void Heap::EndNewSpaceGC() {
+ MonitorLocker ml(&gc_in_progress_monitor_);
+ ASSERT(gc_new_space_in_progress_);
+ gc_new_space_in_progress_ = false;
+ last_gc_was_old_space_ = false;
+ ml.NotifyAll();
+}
+
+bool Heap::BeginOldSpaceGC(Thread* thread) {
+ MonitorLocker ml(&gc_in_progress_monitor_);
+ bool start_gc_on_thread = true;
+ while (gc_new_space_in_progress_ || gc_old_space_in_progress_) {
+ start_gc_on_thread = !gc_old_space_in_progress_;
+ ml.WaitWithSafepointCheck(thread);
+ }
+ if (start_gc_on_thread) {
+ gc_old_space_in_progress_ = true;
+ return true;
+ }
+ return false;
+}
+
+void Heap::EndOldSpaceGC() {
+ MonitorLocker ml(&gc_in_progress_monitor_);
+ ASSERT(gc_old_space_in_progress_);
+ gc_old_space_in_progress_ = false;
+ last_gc_was_old_space_ = true;
+ assume_scavenge_will_fail_ = false;
+ ml.NotifyAll();
+}
+
void Heap::HintFreed(intptr_t size) {
old_space_.HintFreed(size);
}
void Heap::NotifyIdle(int64_t deadline) {
Thread* thread = Thread::Current();
- SafepointOperationScope safepoint_operation(thread);
-
// Check if we want to collect new-space first, because if we want to collect
// both new-space and old-space, the new-space collection should run first
// to shrink the root set (make old-space GC faster) and avoid
@@ -432,8 +475,7 @@
// visiting pointers.
return;
}
- {
- SafepointOperationScope safepoint_operation(thread);
+ if (BeginNewSpaceGC(thread)) {
RecordBeforeGC(kScavenge, reason);
VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
: VMTag::kGCNewSpaceTagId);
@@ -442,7 +484,7 @@
RecordAfterGC(kScavenge);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
- last_gc_was_old_space_ = false;
+ EndNewSpaceGC();
}
}
@@ -456,8 +498,7 @@
// visiting pointers.
return;
}
- {
- SafepointOperationScope safepoint_operation(thread);
+ if (BeginNewSpaceGC(thread)) {
RecordBeforeGC(kScavenge, reason);
{
VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
@@ -467,7 +508,7 @@
RecordAfterGC(kScavenge);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
- last_gc_was_old_space_ = false;
+ EndNewSpaceGC();
}
if (reason == kNewSpace) {
if (old_space_.ReachedHardThreshold()) {
@@ -496,14 +537,11 @@
// visiting pointers.
return;
}
- {
- SafepointOperationScope safepoint_operation(thread);
- thread->isolate_group()->ForEachIsolate(
- [&](Isolate* isolate) {
- // Discard regexp backtracking stacks to further reduce memory usage.
- isolate->CacheRegexpBacktrackStack(nullptr);
- },
- /*at_safepoint=*/true);
+ if (BeginOldSpaceGC(thread)) {
+ thread->isolate_group()->ForEachIsolate([&](Isolate* isolate) {
+ // Discard regexp backtracking stacks to further reduce memory usage.
+ isolate->CacheRegexpBacktrackStack(nullptr);
+ });
RecordBeforeGC(type, reason);
VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
@@ -515,14 +553,11 @@
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
// Some Code objects may have been collected so invalidate handler cache.
- thread->isolate_group()->ForEachIsolate(
- [&](Isolate* isolate) {
- isolate->handler_info_cache()->Clear();
- isolate->catch_entry_moves_cache()->Clear();
- },
- /*at_safepoint=*/true);
- last_gc_was_old_space_ = true;
- assume_scavenge_will_fail_ = false;
+ thread->isolate_group()->ForEachIsolate([&](Isolate* isolate) {
+ isolate->handler_info_cache()->Clear();
+ isolate->catch_entry_moves_cache()->Clear();
+ });
+ EndOldSpaceGC();
}
}
@@ -602,8 +637,11 @@
}
void Heap::StartConcurrentMarking(Thread* thread) {
- TIMELINE_FUNCTION_GC_DURATION_BASIC(thread, "StartConcurrentMarking");
- old_space_.CollectGarbage(/*compact=*/false, /*finalize=*/false);
+ if (BeginOldSpaceGC(thread)) {
+ TIMELINE_FUNCTION_GC_DURATION_BASIC(thread, "StartConcurrentMarking");
+ old_space_.CollectGarbage(/*compact=*/false, /*finalize=*/false);
+ EndOldSpaceGC();
+ }
}
void Heap::CheckFinishConcurrentMarking(Thread* thread) {
@@ -713,6 +751,8 @@
}
void Heap::MergeFrom(Heap* donor) {
+ ASSERT(!donor->gc_new_space_in_progress_);
+ ASSERT(!donor->gc_old_space_in_progress_);
ASSERT(!donor->read_only_);
ASSERT(donor->old_space()->tasks() == 0);
@@ -981,6 +1021,9 @@
#endif // PRODUCT
void Heap::RecordBeforeGC(GCType type, GCReason reason) {
+ ASSERT((type == kScavenge && gc_new_space_in_progress_) ||
+ (type == kMarkSweep && gc_old_space_in_progress_) ||
+ (type == kMarkCompact && gc_old_space_in_progress_));
stats_.num_++;
stats_.type_ = type;
stats_.reason_ = reason;
@@ -1005,6 +1048,9 @@
}
stats_.after_.new_ = new_space_.GetCurrentUsage();
stats_.after_.old_ = old_space_.GetCurrentUsage();
+ ASSERT((type == kScavenge && gc_new_space_in_progress_) ||
+ (type == kMarkSweep && gc_old_space_in_progress_) ||
+ (type == kMarkCompact && gc_old_space_in_progress_));
#ifndef PRODUCT
// For now we'll emit the same GC events on all isolates.
if (Service::gc_stream.enabled()) {
diff --git a/runtime/vm/heap/heap.h b/runtime/vm/heap/heap.h
index 8982ba3..fa9d733 100644
--- a/runtime/vm/heap/heap.h
+++ b/runtime/vm/heap/heap.h
@@ -383,6 +383,12 @@
void PrintStats();
void PrintStatsToTimeline(TimelineEventScope* event, GCReason reason);
+ // Updates gc in progress flags.
+ bool BeginNewSpaceGC(Thread* thread);
+ void EndNewSpaceGC();
+ bool BeginOldSpaceGC(Thread* thread);
+ void EndOldSpaceGC();
+
void AddRegionsToObjectSet(ObjectSet* set) const;
// Trigger major GC if 'gc_on_nth_allocation_' is set.
@@ -406,6 +412,10 @@
// This heap is in read-only mode: No allocation is allowed.
bool read_only_;
+ // GC on the heap is in progress.
+ Monitor gc_in_progress_monitor_;
+ bool gc_new_space_in_progress_;
+ bool gc_old_space_in_progress_;
bool last_gc_was_old_space_;
bool assume_scavenge_will_fail_;
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index e0f10cb..c0a2597 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -1030,10 +1030,9 @@
}
Thread* thread = Thread::Current();
- const int64_t pre_safe_point = OS::GetCurrentMonotonicMicros();
- SafepointOperationScope safepoint_scope(thread);
const int64_t pre_wait_for_sweepers = OS::GetCurrentMonotonicMicros();
+
// Wait for pending tasks to complete and then account for the driver task.
Phase waited_for;
{
@@ -1046,15 +1045,15 @@
}
while (tasks() > 0) {
- locker.Wait();
+ locker.WaitWithSafepointCheck(thread);
}
ASSERT(phase() == kAwaitingFinalization || phase() == kDone);
set_tasks(1);
}
+ const int64_t pre_safe_point = OS::GetCurrentMonotonicMicros();
if (FLAG_verbose_gc) {
- const int64_t wait =
- OS::GetCurrentMonotonicMicros() - pre_wait_for_sweepers;
+ const int64_t wait = pre_safe_point - pre_wait_for_sweepers;
if (waited_for == kMarking) {
THR_Print("Waited %" Pd64 " us for concurrent marking to finish.\n",
wait);
@@ -1069,8 +1068,9 @@
// to ensure that if two threads are racing to collect at the same time the
// loser skips collection and goes straight to allocation.
{
- CollectGarbageHelper(compact, finalize, pre_wait_for_sweepers,
- pre_safe_point);
+ SafepointOperationScope safepoint_scope(thread);
+ CollectGarbageAtSafepoint(compact, finalize, pre_wait_for_sweepers,
+ pre_safe_point);
}
// Done, reset the task count.
@@ -1081,10 +1081,10 @@
}
}
-void PageSpace::CollectGarbageHelper(bool compact,
- bool finalize,
- int64_t pre_wait_for_sweepers,
- int64_t pre_safe_point) {
+void PageSpace::CollectGarbageAtSafepoint(bool compact,
+ bool finalize,
+ int64_t pre_wait_for_sweepers,
+ int64_t pre_safe_point) {
Thread* thread = Thread::Current();
ASSERT(thread->IsAtSafepoint());
auto isolate_group = heap_->isolate_group();
diff --git a/runtime/vm/heap/pages.h b/runtime/vm/heap/pages.h
index 83c5488..ef5badf 100644
--- a/runtime/vm/heap/pages.h
+++ b/runtime/vm/heap/pages.h
@@ -538,10 +538,10 @@
void FreeLargePage(OldPage* page, OldPage* previous_page);
void FreePages(OldPage* pages);
- void CollectGarbageHelper(bool compact,
- bool finalize,
- int64_t pre_wait_for_sweepers,
- int64_t pre_safe_point);
+ void CollectGarbageAtSafepoint(bool compact,
+ bool finalize,
+ int64_t pre_wait_for_sweepers,
+ int64_t pre_safe_point);
void SweepLarge();
void Sweep();
void ConcurrentSweep(IsolateGroup* isolate_group);
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index b8b23a1..0e175bd1 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -380,6 +380,18 @@
void set_dispatch_table(DispatchTable* table) {
dispatch_table_.reset(table);
}
+ const uint8_t* dispatch_table_snapshot() const {
+ return dispatch_table_snapshot_;
+ }
+ void set_dispatch_table_snapshot(const uint8_t* snapshot) {
+ dispatch_table_snapshot_ = snapshot;
+ }
+ intptr_t dispatch_table_snapshot_size() const {
+ return dispatch_table_snapshot_size_;
+ }
+ void set_dispatch_table_snapshot_size(intptr_t size) {
+ dispatch_table_snapshot_size_ = size;
+ }
SharedClassTable* shared_class_table() const {
return shared_class_table_.get();
@@ -672,6 +684,8 @@
std::unique_ptr<StoreBuffer> store_buffer_;
std::unique_ptr<Heap> heap_;
std::unique_ptr<DispatchTable> dispatch_table_;
+ const uint8_t* dispatch_table_snapshot_ = nullptr;
+ intptr_t dispatch_table_snapshot_size_ = 0;
ArrayPtr saved_unlinked_calls_;
std::shared_ptr<FieldTable> saved_initial_field_table_;
uint32_t isolate_group_flags_ = 0;
diff --git a/tests/lib/html/js_typed_interop_type_test.dart b/tests/lib/html/js_typed_interop_type_test.dart
index a7195ab..6558870 100644
--- a/tests/lib/html/js_typed_interop_type_test.dart
+++ b/tests/lib/html/js_typed_interop_type_test.dart
@@ -26,7 +26,7 @@
@JS()
@anonymous
class C {
- external get foo;
+ external final foo;
external factory C({foo});
}
@@ -34,7 +34,7 @@
@JS()
@anonymous
class D {
- external get foo;
+ external final foo;
external factory D({foo});
}
diff --git a/tools/VERSION b/tools/VERSION
index 433cea6..339772b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 10
PATCH 0
-PRERELEASE 42
+PRERELEASE 43
PRERELEASE_PATCH 0
\ No newline at end of file