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

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

Issue 2743323003: Don't crash on non-forward labels in switches. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.scope; 5 library fasta.scope;
6 6
7 import 'builder.dart' show Builder, MixedAccessor; 7 import 'builder.dart' show Builder, MixedAccessor;
8 8
9 import '../errors.dart' show internalError; 9 import '../errors.dart' show internalError;
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 } 102 }
103 103
104 void forwardDeclareLabel(String name, Builder target) { 104 void forwardDeclareLabel(String name, Builder target) {
105 declareLabel(name, target); 105 declareLabel(name, target);
106 forwardDeclaredLabels ??= <String, Builder>{}; 106 forwardDeclaredLabels ??= <String, Builder>{};
107 forwardDeclaredLabels[name] = target; 107 forwardDeclaredLabels[name] = target;
108 } 108 }
109 109
110 void claimLabel(String name) { 110 void claimLabel(String name) {
111 if (forwardDeclaredLabels == null) return;
111 forwardDeclaredLabels.remove(name); 112 forwardDeclaredLabels.remove(name);
112 if (forwardDeclaredLabels.length == 0) { 113 if (forwardDeclaredLabels.length == 0) {
113 forwardDeclaredLabels = null; 114 forwardDeclaredLabels = null;
114 } 115 }
115 } 116 }
116 117
117 Map<String, Builder> get unclaimedForwardDeclarations { 118 Map<String, Builder> get unclaimedForwardDeclarations {
118 return forwardDeclaredLabels; 119 return forwardDeclaredLabels;
119 } 120 }
120 121
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 class AmbiguousBuilder extends Builder { 169 class AmbiguousBuilder extends Builder {
169 final Builder builder; 170 final Builder builder;
170 171
171 AmbiguousBuilder(this.builder, int charOffset, Uri fileUri) 172 AmbiguousBuilder(this.builder, int charOffset, Uri fileUri)
172 : super(null, charOffset, fileUri); 173 : super(null, charOffset, fileUri);
173 174
174 get target => null; 175 get target => null;
175 176
176 bool get hasProblem => true; 177 bool get hasProblem => true;
177 } 178 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698