| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 5 |
| 6 class BlockScope { | 6 class BlockScope { |
| 7 MethodGenerator enclosingMethod; | 7 MethodGenerator enclosingMethod; |
| 8 BlockScope parent; | 8 BlockScope parent; |
| 9 | 9 |
| 10 // TODO(jimhug): Using a list or tree-based map may improve perf; the list | 10 // TODO(jimhug): Using a list or tree-based map may improve perf; the list |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (name != jsName) _jsNames.add(jsName); | 165 if (name != jsName) _jsNames.add(jsName); |
| 166 return ret; | 166 return ret; |
| 167 } | 167 } |
| 168 | 168 |
| 169 Value declareParameter(Parameter p) { | 169 Value declareParameter(Parameter p) { |
| 170 return create(p.name, p.type, p.definition.span, isParameter:true); | 170 return create(p.name, p.type, p.definition.span, isParameter:true); |
| 171 } | 171 } |
| 172 | 172 |
| 173 /** Declares a variable in the current scope for this identifier. */ | 173 /** Declares a variable in the current scope for this identifier. */ |
| 174 Value declare(DeclaredIdentifier id) { | 174 Value declare(DeclaredIdentifier id) { |
| 175 var type = enclosingMethod.method.resolveType(id.type, false); | 175 var type = enclosingMethod.method.resolveType(id.type, false, true); |
| 176 return create(id.name.name, type, id.span); | 176 return create(id.name.name, type, id.span); |
| 177 } | 177 } |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * Finds the first lexically enclosing catch block, if any, and returns its | 180 * Finds the first lexically enclosing catch block, if any, and returns its |
| 181 * exception variable. | 181 * exception variable. |
| 182 */ | 182 */ |
| 183 String getRethrow() { | 183 String getRethrow() { |
| 184 var scope = this; | 184 var scope = this; |
| 185 while (scope.rethrow == null && scope.parent != null) { | 185 while (scope.rethrow == null && scope.parent != null) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 213 if (myVar.value !== v) { | 213 if (myVar.value !== v) { |
| 214 _vars[key] = myVar.replaceValue(v); | 214 _vars[key] = myVar.replaceValue(v); |
| 215 changed = true; | 215 changed = true; |
| 216 } | 216 } |
| 217 }); | 217 }); |
| 218 } | 218 } |
| 219 | 219 |
| 220 return changed; | 220 return changed; |
| 221 } | 221 } |
| 222 } | 222 } |
| OLD | NEW |