Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: pkg/front_end/lib/src/fasta/scope.dart

Issue 2790923002: Special scope for labelled statements. (Closed)
Patch Set: Update status file. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/scope.dart
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index 4f3537c93ef7d304ac4e8a5b45ea83e528d4d299..c1b884cb0225388dd854264c7585cc3cdf207aad 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -46,6 +46,17 @@ class Scope {
return new Scope.nested(this, isModifiable: isModifiable);
}
+ /// Create a special scope for use by labeled staments. This scope doesn't
+ /// introduce a new scope for local variables, only for labels. This deals
+ /// with corner cases like this:
+ ///
+ /// L: var x;
+ /// x = 42;
+ /// print("The answer is $x.");
+ Scope createNestedLabelScope() {
+ return new Scope(local, setters, parent, isModifiable: true);
+ }
+
Builder lookup(String name, int charOffset, Uri fileUri,
{bool isInstanceScope: true}) {
Builder builder = local[name];
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698