Skip to content

Commit d59cb89

Browse files
author
Dart CI
committed
Version 2.14.0-108.0.dev
Merge commit '3a3b3e480baf3750ec22e5a482ee5930ad55fb9b' into 'dev'
2 parents 5aa5aba + 3a3b3e4 commit d59cb89

File tree

49 files changed

+319
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+319
-430
lines changed

.dart_tool/package_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"constraint, update this by running tools/generate_package_config.dart."
1212
],
1313
"configVersion": 2,
14-
"generated": "2021-05-10T19:21:13.245788",
14+
"generated": "2021-05-11T11:47:02.674706",
1515
"generator": "tools/generate_package_config.dart",
1616
"packages": [
1717
{
@@ -635,7 +635,7 @@
635635
"name": "sse",
636636
"rootUri": "../third_party/pkg/sse",
637637
"packageUri": "lib/",
638-
"languageVersion": "2.2"
638+
"languageVersion": "2.12"
639639
},
640640
{
641641
"name": "stack_trace",

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ vars = {
155155
"source_maps-0.9.4_rev": "38524",
156156
"source_maps_rev": "53eb92ccfe6e64924054f83038a534b959b12b3e",
157157
"source_span_rev": "1be3c44045a06dff840d2ed3a13e6082d7a03a23",
158-
"sse_tag": "5da8fedcdc56f306933d202e2d204753eecefd36",
158+
"sse_tag": "adc3ac8027784ed9783d066dccadad44458788e4",
159159
"stack_trace_tag": "6788afc61875079b71b3d1c3e65aeaa6a25cbc2f",
160160
"stream_channel_tag": "d7251e61253ec389ee6e045ee1042311bced8f1d",
161161
"string_scanner_rev": "1b63e6e5db5933d7be0a45da6e1129fe00262734",

pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import 'package:analysis_server/src/utilities/strings.dart';
1010
import 'package:analysis_server/src/utilities/yaml_node_locator.dart';
1111
import 'package:analyzer/dart/analysis/session.dart';
1212
import 'package:analyzer/error/error.dart';
13-
import 'package:analyzer/source/line_info.dart';
1413
import 'package:analyzer/src/analysis_options/error/option_codes.dart';
1514
import 'package:analyzer/src/generated/java_core.dart';
1615
import 'package:analyzer/src/generated/source.dart';

pkg/analysis_server/lib/src/services/correction/util.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:analyzer/dart/analysis/results.dart';
1414
import 'package:analyzer/dart/analysis/session.dart';
1515
import 'package:analyzer/dart/ast/ast.dart';
1616
import 'package:analyzer/dart/ast/precedence.dart';
17-
import 'package:analyzer/dart/ast/token.dart';
1817
import 'package:analyzer/dart/ast/visitor.dart';
1918
import 'package:analyzer/dart/element/element.dart';
2019
import 'package:analyzer/dart/element/type.dart';

pkg/analyzer/lib/src/context/builder.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class ContextBuilder {
5757
/// they can be shared across contexts.
5858
final DartSdkManager sdkManager;
5959

60-
/// The cache containing the contents of overlaid files. If this builder will
61-
/// be used to build analysis drivers, set the [fileContentOverlay] instead.
62-
final ContentCache? contentCache;
63-
6460
/// The options used by the context builder.
6561
final ContextBuilderOptions builderOptions;
6662

@@ -77,10 +73,6 @@ class ContextBuilder {
7773
/// The byte store used by any analysis drivers created through this interface.
7874
late final ByteStore byteStore;
7975

80-
/// The file content overlay used by analysis drivers. If this builder will be
81-
/// used to build analysis contexts, set the [contentCache] instead.
82-
FileContentOverlay? fileContentOverlay;
83-
8476
/// Whether any analysis driver created through this interface should support
8577
/// indexing and search.
8678
bool enableIndex = false;
@@ -92,7 +84,7 @@ class ContextBuilder {
9284

9385
/// Initialize a newly created builder to be ready to build a context rooted in
9486
/// the directory with the given [rootDirectoryPath].
95-
ContextBuilder(this.resourceProvider, this.sdkManager, this.contentCache,
87+
ContextBuilder(this.resourceProvider, this.sdkManager,
9688
{ContextBuilderOptions? options})
9789
: builderOptions = options ?? ContextBuilderOptions();
9890

@@ -123,7 +115,7 @@ class ContextBuilder {
123115
performanceLog,
124116
resourceProvider,
125117
byteStore,
126-
fileContentOverlay,
118+
FileContentOverlay(),
127119
contextRoot,
128120
sf,
129121
options,

pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'package:analyzer/src/dart/analysis/byte_store.dart';
1111
import 'package:analyzer/src/dart/analysis/context_builder.dart';
1212
import 'package:analyzer/src/dart/analysis/driver.dart';
1313
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
14-
import 'package:analyzer/src/dart/analysis/file_state.dart';
1514
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
1615
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
1716
import 'package:cli_util/cli_util.dart';
@@ -57,7 +56,6 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
5756
optionsFile: optionsFile,
5857
packagesFile: packagesFile,
5958
);
60-
var fileContentOverlay = FileContentOverlay();
6159
for (var root in roots) {
6260
var contextBuilder = ContextBuilderImpl(
6361
resourceProvider: this.resourceProvider,
@@ -68,7 +66,6 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
6866
declaredVariables: DeclaredVariables.fromMap(declaredVariables ?? {}),
6967
drainStreams: drainStreams,
7068
enableIndex: enableIndex,
71-
fileContentOverlay: fileContentOverlay,
7269
performanceLog: performanceLog,
7370
retainDataForTesting: retainDataForTesting,
7471
sdkPath: sdkPath,

pkg/analyzer/lib/src/dart/analysis/context_builder.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ import 'package:analyzer/src/dart/analysis/byte_store.dart'
1515
import 'package:analyzer/src/dart/analysis/driver.dart'
1616
show AnalysisDriver, AnalysisDriverScheduler;
1717
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
18-
import 'package:analyzer/src/dart/analysis/file_state.dart'
19-
show FileContentOverlay;
2018
import 'package:analyzer/src/dart/analysis/performance_logger.dart'
2119
show PerformanceLog;
2220
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
2321
import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
24-
import 'package:analyzer/src/generated/source.dart' show ContentCache;
2522
import 'package:cli_util/cli_util.dart';
2623

2724
/// An implementation of a context builder.
@@ -43,7 +40,6 @@ class ContextBuilderImpl implements ContextBuilder {
4340
DeclaredVariables? declaredVariables,
4441
bool drainStreams = true,
4542
bool enableIndex = false,
46-
FileContentOverlay? fileContentOverlay,
4743
List<String>? librarySummaryPaths,
4844
PerformanceLog? performanceLog,
4945
bool retainDataForTesting = false,
@@ -57,7 +53,6 @@ class ContextBuilderImpl implements ContextBuilder {
5753
ArgumentError.checkNotNull(sdkPath, 'sdkPath');
5854

5955
byteStore ??= MemoryByteStore();
60-
fileContentOverlay ??= FileContentOverlay();
6156
performanceLog ??= PerformanceLog(StringBuffer());
6257

6358
DartSdkManager sdkManager = DartSdkManager(sdkPath);
@@ -82,12 +77,10 @@ class ContextBuilderImpl implements ContextBuilder {
8277
options.defaultAnalysisOptionsFilePath = contextRoot.optionsFile?.path;
8378
options.defaultPackageFilePath = contextRoot.packagesFile?.path;
8479

85-
old.ContextBuilder builder = old.ContextBuilder(
86-
resourceProvider, sdkManager, ContentCache(),
87-
options: options);
80+
old.ContextBuilder builder =
81+
old.ContextBuilder(resourceProvider, sdkManager, options: options);
8882
builder.analysisDriverScheduler = scheduler;
8983
builder.byteStore = byteStore;
90-
builder.fileContentOverlay = fileContentOverlay;
9184
builder.enableIndex = enableIndex;
9285
builder.performanceLog = performanceLog;
9386
builder.retainDataForTesting = retainDataForTesting;

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,19 @@ class ConfigurationImpl extends AstNodeImpl implements Configuration {
23082308
}
23092309
}
23102310

2311+
/// This class is used as a marker of constant context for initializers
2312+
/// of constant fields and top-level variables read from summaries.
2313+
class ConstantContextForExpressionImpl extends AstNodeImpl {
2314+
final ExpressionImpl expression;
2315+
2316+
ConstantContextForExpressionImpl(this.expression) {
2317+
_becomeParentOf(expression);
2318+
}
2319+
2320+
@override
2321+
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
2322+
}
2323+
23112324
/// A constructor declaration.
23122325
///
23132326
/// constructorDeclaration ::=
@@ -3446,13 +3459,6 @@ class ExpressionFunctionBodyImpl extends FunctionBodyImpl
34463459
/// | [ThrowExpression]
34473460
abstract class ExpressionImpl extends AstNodeImpl
34483461
implements CollectionElementImpl, Expression {
3449-
/// To support [inConstantContext] we need to know if an expression is
3450-
/// an initializer of a constant variable. But when the initializer is
3451-
/// a part of the element model, there is no parent AST node.
3452-
///
3453-
/// TODO(scheglov) Consider alternative solutions.
3454-
static final inConstContextWithoutParent = Expando<bool>();
3455-
34563462
/// The static type of this expression, or `null` if the AST structure has not
34573463
/// been resolved.
34583464
@override
@@ -3468,8 +3474,8 @@ abstract class ExpressionImpl extends AstNodeImpl
34683474
child is IfElement ||
34693475
child is ForElement) {
34703476
var parent = child.parent;
3471-
if (parent == null) {
3472-
return inConstContextWithoutParent[child] ?? false;
3477+
if (parent is ConstantContextForExpressionImpl) {
3478+
return true;
34733479
} else if (parent is TypedLiteralImpl && parent.constKeyword != null) {
34743480
// Inside an explicitly `const` list or map literal.
34753481
return true;
@@ -3488,6 +3494,8 @@ abstract class ExpressionImpl extends AstNodeImpl
34883494
} else if (parent is SwitchCase) {
34893495
// Inside a switch case.
34903496
return true;
3497+
} else if (parent == null) {
3498+
break;
34913499
}
34923500
child = parent;
34933501
}

pkg/analyzer/lib/src/generated/source.dart

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -43,78 +43,6 @@ abstract class BasicSource extends Source {
4343
bool operator ==(Object object) => object is Source && object.uri == uri;
4444
}
4545

46-
/// A cache used to override the default content of a [Source].
47-
///
48-
/// TODO(scheglov) Remove it.
49-
class ContentCache {
50-
/// A table mapping the full path of sources to the contents of those sources.
51-
/// This is used to override the default contents of a source.
52-
final Map<String, String> _contentMap = {};
53-
54-
/// A table mapping the full path of sources to the modification stamps of
55-
/// those sources. This is used when the default contents of a source has been
56-
/// overridden.
57-
final Map<String, int> _stampMap = {};
58-
59-
int _nextStamp = 0;
60-
61-
/// Visit all entries of this cache.
62-
void accept(ContentCacheVisitor visitor) {
63-
_contentMap.forEach((String fullPath, String contents) {
64-
int stamp = _stampMap[fullPath]!;
65-
visitor(fullPath, stamp, contents);
66-
});
67-
}
68-
69-
/// Return the contents of the given [source], or `null` if this cache does not
70-
/// override the contents of the source.
71-
///
72-
/// <b>Note:</b> This method is not intended to be used except by
73-
/// [AnalysisContext.getContents].
74-
String? getContents(Source source) => _contentMap[source.fullName];
75-
76-
/// Return `true` if the given [source] exists, `false` if it does not exist,
77-
/// or `null` if this cache does not override existence of the source.
78-
///
79-
/// <b>Note:</b> This method is not intended to be used except by
80-
/// [AnalysisContext.exists].
81-
bool? getExists(Source source) {
82-
return _contentMap.containsKey(source.fullName) ? true : null;
83-
}
84-
85-
/// Return the modification stamp of the given [source], or `null` if this
86-
/// cache does not override the contents of the source.
87-
///
88-
/// <b>Note:</b> This method is not intended to be used except by
89-
/// [AnalysisContext.getModificationStamp].
90-
int? getModificationStamp(Source source) => _stampMap[source.fullName];
91-
92-
/// Set the contents of the given [source] to the given [contents]. This has
93-
/// the effect of overriding the default contents of the source. If the
94-
/// contents are `null` the override is removed so that the default contents
95-
/// will be returned.
96-
String? setContents(Source source, String? contents) {
97-
String fullName = source.fullName;
98-
if (contents == null) {
99-
_stampMap.remove(fullName);
100-
return _contentMap.remove(fullName);
101-
} else {
102-
int newStamp = _nextStamp++;
103-
var oldStamp = _stampMap[fullName];
104-
_stampMap[fullName] = newStamp;
105-
// Occasionally, if this method is called in rapid succession, the
106-
// timestamps are equal. Guard against this by artificially incrementing
107-
// the new timestamp.
108-
if (newStamp == oldStamp) {
109-
_stampMap[fullName] = newStamp + 1;
110-
}
111-
var oldContent = _contentMap[fullName];
112-
_contentMap[fullName] = contents;
113-
return oldContent;
114-
}
115-
}
116-
}
117-
11846
/// Instances of the class `DartUriResolver` resolve `dart` URI's.
11947
class DartUriResolver extends UriResolver {
12048
/// The name of the `dart` scheme.

0 commit comments

Comments
 (0)