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

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

Issue 2746923002: Implement nested switches and missing switch continue targets. (Closed)
Patch Set: Long line. Created 3 years, 9 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 | « no previous file | pkg/front_end/lib/src/fasta/compile_platform.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/builder/scope.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/scope.dart b/pkg/front_end/lib/src/fasta/builder/scope.dart
index 159d2ba66905d6c0076b4c7c0191503fe5ab7811..10e5c39c864c2817993f03e92f5700b05b310062 100644
--- a/pkg/front_end/lib/src/fasta/builder/scope.dart
+++ b/pkg/front_end/lib/src/fasta/builder/scope.dart
@@ -22,6 +22,8 @@ class Scope {
Map<String, Builder> labels;
+ Map<String, Builder> forwardDeclaredLabels;
+
Scope(this.local, this.parent, {this.isModifiable: true});
Scope createNestedScope({bool isModifiable: true}) {
@@ -99,6 +101,23 @@ class Scope {
}
}
+ void forwardDeclareLabel(String name, Builder target) {
+ declareLabel(name, target);
+ forwardDeclaredLabels ??= <String, Builder>{};
+ forwardDeclaredLabels[name] = target;
+ }
+
+ void claimLabel(String name) {
+ forwardDeclaredLabels.remove(name);
+ if (forwardDeclaredLabels.length == 0) {
+ forwardDeclaredLabels = null;
+ }
+ }
+
+ Map<String, Builder> get unclaimedForwardDeclarations {
+ return forwardDeclaredLabels;
+ }
+
Builder lookupLabel(String name) {
return (labels == null ? null : labels[name]) ?? parent?.lookupLabel(name);
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/compile_platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698