-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure we have a scope for variables when visiting fields
Fixes #36864 Change-Id: I66d70cc30b26bd069d4ab5e2b98f0f5954f3ef59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101460 Auto-Submit: Sigmund Cherem <[email protected]> Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
- Loading branch information
1 parent
821c75c
commit 9ac7bd7
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/compiler/dart2js_extra/block_expression_on_field_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// Regression test for #36864 | ||
/// | ||
/// Block expressions in top-level fields used to crash the compiler. | ||
import "package:expect/expect.dart"; | ||
|
||
final _a = { | ||
...{1} | ||
}; | ||
|
||
class B { | ||
static Set _b = { | ||
...{2} | ||
}; | ||
Set _c = { | ||
...{3} | ||
}; | ||
} | ||
|
||
main() { | ||
Expect.setEquals({1}, _a); | ||
Expect.setEquals({2}, B._b); | ||
Expect.setEquals({3}, (new B()._c)); | ||
} |