Skip to content

Commit

Permalink
Initialize ScopedVisitor.nameScope in a constructor initializer
Browse files Browse the repository at this point in the history
Change-Id: I1ca06ce421e48be3ef743589276cc039cef5eddc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
  • Loading branch information
stereotype441 authored and commit-bot@chromium.org committed May 20, 2021
1 parent 29f6965 commit 64b2a1b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/analyzer/lib/src/generated/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,7 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<void> {
final ErrorReporter errorReporter;

/// The scope used to resolve identifiers.
late Scope nameScope;
Scope nameScope;

/// The scope used to resolve unlabeled `break` and `continue` statements.
ImplicitLabelScope _implicitLabelScope = ImplicitLabelScope.ROOT;
Expand Down Expand Up @@ -2518,13 +2518,8 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<void> {
errorListener,
source,
isNonNullableByDefault: definingLibrary.isNonNullableByDefault,
) {
if (nameScope == null) {
this.nameScope = LibraryScope(definingLibrary);
} else {
this.nameScope = nameScope;
}
}
),
nameScope = nameScope ?? LibraryScope(definingLibrary);

/// Return the implicit label scope in which the current node is being
/// resolved.
Expand Down

0 comments on commit 64b2a1b

Please sign in to comment.