Skip to content

Commit 1451e9e

Browse files
nshahancommit-bot@chromium.org
authored andcommitted
[dartdevc] Respect the NNBD experiment flag setting more often when patching SDK
Tested with the dart:math migration. https://dart-review.googlesource.com/c/sdk/+/120060 Change-Id: Id62dd197dfa4d4e744ae581c6cd423444baeb1dc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122521 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
1 parent 17ed3cb commit 1451e9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/dev_compiler/tool/patch_sdk.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void main(List<String> argv) {
102102
libraryFile.lastModifiedSync().millisecondsSinceEpoch);
103103
var partFiles = <File>[];
104104
for (var part
105-
in _parseString(libraryContents, useNnbd: false).unit.directives) {
105+
in _parseString(libraryContents, useNnbd: useNnbd).unit.directives) {
106106
if (part is PartDirective) {
107107
var partPath = part.uri.stringValue;
108108
outPaths.add(p.join(p.dirname(libraryOut), partPath));
@@ -328,7 +328,7 @@ class PatchFinder extends GeneralizingAstVisitor {
328328

329329
PatchFinder.parseAndVisit(String contents, {bool useNnbd})
330330
: contents = contents,
331-
unit = _parseString(contents, useNnbd: false).unit {
331+
unit = _parseString(contents, useNnbd: useNnbd).unit {
332332
visitCompilationUnit(unit);
333333
}
334334

@@ -495,7 +495,7 @@ List<SdkLibrary> _getSdkLibraries(String contents, {bool useNnbd}) {
495495
// It doesn't understand optional new/const in Dart 2. For now, we keep
496496
// redundant `const` in tool/input_sdk/libraries.dart as a workaround.
497497
var libraryBuilder = SdkLibrariesReader_LibraryBuilder();
498-
_parseString(contents, useNnbd: false).unit.accept(libraryBuilder);
498+
_parseString(contents, useNnbd: useNnbd).unit.accept(libraryBuilder);
499499
return libraryBuilder.librariesMap.sdkLibraries;
500500
}
501501

0 commit comments

Comments
 (0)