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 class ClosureFieldElement extends Element { | 5 class ClosureFieldElement extends Element { |
6 ClosureFieldElement(SourceString name, ClassElement enclosing) | 6 ClosureFieldElement(SourceString name, ClassElement enclosing) |
7 : super(name, ElementKind.FIELD, enclosing); | 7 : super(name, ElementKind.FIELD, enclosing); |
8 | 8 |
9 bool isInstanceMember() => true; | 9 bool isInstanceMember() => true; |
10 bool isAssignable() => false; | 10 bool isAssignable() => false; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 if (element != closureData.thisElement) { | 187 if (element != closureData.thisElement) { |
188 // TODO(ngeoffray): only do this if the variable is mutated. | 188 // TODO(ngeoffray): only do this if the variable is mutated. |
189 closureData.usedVariablesInTry.add(element); | 189 closureData.usedVariablesInTry.add(element); |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 void declareLocal(Element element) { | 194 void declareLocal(Element element) { |
195 scopeVariables.add(element); | 195 scopeVariables.add(element); |
196 } | 196 } |
197 | 197 |
Lasse Reichstein Nielsen
2012/04/10 12:31:28
Oops, bad edit.
| |
198 | |
198 visit(Node node) => node.accept(this); | 199 visit(Node node) => node.accept(this); |
199 | 200 |
200 visitNode(Node node) => node.visitChildren(this); | 201 visitNode(Node node) => node.visitChildren(this); |
201 | 202 |
202 visitVariableDefinitions(VariableDefinitions node) { | 203 visitVariableDefinitions(VariableDefinitions node) { |
203 for (Link<Node> link = node.definitions.nodes; | 204 for (Link<Node> link = node.definitions.nodes; |
204 !link.isEmpty(); | 205 !link.isEmpty(); |
205 link = link.tail) { | 206 link = link.tail) { |
206 Node definition = link.head; | 207 Node definition = link.head; |
207 Element element = elements[definition]; | 208 Element element = elements[definition]; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 declareLocal(elements[node]); | 409 declareLocal(elements[node]); |
409 } | 410 } |
410 | 411 |
411 visitTryStatement(TryStatement node) { | 412 visitTryStatement(TryStatement node) { |
412 // TODO(ngeoffray): implement finer grain state. | 413 // TODO(ngeoffray): implement finer grain state. |
413 inTryCatchOrFinally = true; | 414 inTryCatchOrFinally = true; |
414 node.visitChildren(this); | 415 node.visitChildren(this); |
415 inTryCatchOrFinally = false; | 416 inTryCatchOrFinally = false; |
416 } | 417 } |
417 } | 418 } |
OLD | NEW |