Chromium Code Reviews| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 // If we are inside a named closure we have to declare ourselve. For | 369 // If we are inside a named closure we have to declare ourselve. For |
| 370 // simplicity we declare the local even if the closure does not have a name | 370 // simplicity we declare the local even if the closure does not have a name |
| 371 // It will simply not be used. | 371 // It will simply not be used. |
| 372 if (insideClosure) { | 372 if (insideClosure) { |
| 373 declareLocal(element); | 373 declareLocal(element); |
| 374 } | 374 } |
| 375 | 375 |
| 376 // TODO(ahe): This is problematic. The backend should not repeat | 376 // TODO(ahe): This is problematic. The backend should not repeat |
| 377 // the work of the resolver. It is the resolver's job to create | 377 // the work of the resolver. It is the resolver's job to create |
| 378 // parameters, etc. Other phases should only visit statements. | 378 // parameters, etc. Other phases should only visit statements. |
| 379 node.visitChildren(this); | 379 // TODO(floitsch): we avoid visiting the initializers on purpose so that we |
| 380 // get an error-message later in the builder. | |
| 381 if (node.parameters !== null) node.parameters.accept(this); | |
|
ahe
2012/03/20 21:12:30
Visiting the parameters is also problematic. Long
| |
| 382 if (node.body !== null) node.body.accept(this); | |
| 380 | 383 |
| 381 attachCapturedScopeVariables(node); | 384 attachCapturedScopeVariables(node); |
| 382 | 385 |
| 383 closureDataCache[node] = closureData; | 386 closureDataCache[node] = closureData; |
| 384 | 387 |
| 385 ClosureData savedClosureData = closureData; | 388 ClosureData savedClosureData = closureData; |
| 386 bool savedInsideClosure = insideClosure; | 389 bool savedInsideClosure = insideClosure; |
| 387 | 390 |
| 388 // Restore old values. | 391 // Restore old values. |
| 389 scopeVariables = oldScopeVariables; | 392 scopeVariables = oldScopeVariables; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 410 declareLocal(elements[node]); | 413 declareLocal(elements[node]); |
| 411 } | 414 } |
| 412 | 415 |
| 413 visitTryStatement(TryStatement node) { | 416 visitTryStatement(TryStatement node) { |
| 414 // TODO(ngeoffray): implement finer grain state. | 417 // TODO(ngeoffray): implement finer grain state. |
| 415 inTryCatchOrFinally = true; | 418 inTryCatchOrFinally = true; |
| 416 node.visitChildren(this); | 419 node.visitChildren(this); |
| 417 inTryCatchOrFinally = false; | 420 inTryCatchOrFinally = false; |
| 418 } | 421 } |
| 419 } | 422 } |
| OLD | NEW |