| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
| 9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
| 10 | 10 |
| (...skipping 3580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3591 registry.useLabel(node, label); | 3591 registry.useLabel(node, label); |
| 3592 } | 3592 } |
| 3593 registry.registerTargetOf(node, target); | 3593 registry.registerTargetOf(node, target); |
| 3594 } | 3594 } |
| 3595 | 3595 |
| 3596 registerImplicitInvocation(String name, int arity) { | 3596 registerImplicitInvocation(String name, int arity) { |
| 3597 Selector selector = new Selector.call(name, null, arity); | 3597 Selector selector = new Selector.call(name, null, arity); |
| 3598 registry.registerDynamicInvocation(selector); | 3598 registry.registerDynamicInvocation(selector); |
| 3599 } | 3599 } |
| 3600 | 3600 |
| 3601 visitForIn(ForIn node) { | 3601 visitAsyncForIn(AsyncForIn node) { |
| 3602 LibraryElement library = enclosingElement.library; | 3602 registry.registerAsyncForIn(node); |
| 3603 registry.setCurrentSelector(node, compiler.currentSelector); |
| 3604 registry.registerDynamicGetter(compiler.currentSelector); |
| 3605 registry.setMoveNextSelector(node, compiler.moveNextSelector); |
| 3606 registry.registerDynamicInvocation(compiler.moveNextSelector); |
| 3607 |
| 3608 visit(node.expression); |
| 3609 |
| 3610 Scope blockScope = new BlockScope(scope); |
| 3611 visitForInDeclaredIdentifierIn(node.declaredIdentifier, node, blockScope); |
| 3612 visitLoopBodyIn(node, node.body, blockScope); |
| 3613 } |
| 3614 |
| 3615 visitSyncForIn(SyncForIn node) { |
| 3603 registry.setIteratorSelector(node, compiler.iteratorSelector); | 3616 registry.setIteratorSelector(node, compiler.iteratorSelector); |
| 3604 registry.registerDynamicGetter(compiler.iteratorSelector); | 3617 registry.registerDynamicGetter(compiler.iteratorSelector); |
| 3605 registry.setCurrentSelector(node, compiler.currentSelector); | 3618 registry.setCurrentSelector(node, compiler.currentSelector); |
| 3606 registry.registerDynamicGetter(compiler.currentSelector); | 3619 registry.registerDynamicGetter(compiler.currentSelector); |
| 3607 registry.setMoveNextSelector(node, compiler.moveNextSelector); | 3620 registry.setMoveNextSelector(node, compiler.moveNextSelector); |
| 3608 registry.registerDynamicInvocation(compiler.moveNextSelector); | 3621 registry.registerDynamicInvocation(compiler.moveNextSelector); |
| 3609 | 3622 |
| 3610 visit(node.expression); | 3623 visit(node.expression); |
| 3624 |
| 3611 Scope blockScope = new BlockScope(scope); | 3625 Scope blockScope = new BlockScope(scope); |
| 3612 Node declaration = node.declaredIdentifier; | 3626 visitForInDeclaredIdentifierIn(node.declaredIdentifier, node, blockScope); |
| 3627 visitLoopBodyIn(node, node.body, blockScope); |
| 3628 } |
| 3629 |
| 3630 visitForInDeclaredIdentifierIn(Node declaration, ForIn node, |
| 3631 Scope blockScope) { |
| 3632 LibraryElement library = enclosingElement.library; |
| 3613 | 3633 |
| 3614 bool oldAllowFinalWithoutInitializer = allowFinalWithoutInitializer; | 3634 bool oldAllowFinalWithoutInitializer = allowFinalWithoutInitializer; |
| 3615 allowFinalWithoutInitializer = true; | 3635 allowFinalWithoutInitializer = true; |
| 3616 visitIn(declaration, blockScope); | 3636 visitIn(declaration, blockScope); |
| 3617 allowFinalWithoutInitializer = oldAllowFinalWithoutInitializer; | 3637 allowFinalWithoutInitializer = oldAllowFinalWithoutInitializer; |
| 3618 | 3638 |
| 3619 Send send = declaration.asSend(); | 3639 Send send = declaration.asSend(); |
| 3620 VariableDefinitions variableDefinitions = | 3640 VariableDefinitions variableDefinitions = |
| 3621 declaration.asVariableDefinitions(); | 3641 declaration.asVariableDefinitions(); |
| 3622 Element loopVariable; | 3642 Element loopVariable; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3652 registry.setSelector(declaration, loopVariableSelector); | 3672 registry.setSelector(declaration, loopVariableSelector); |
| 3653 registerSend(loopVariableSelector, loopVariable); | 3673 registerSend(loopVariableSelector, loopVariable); |
| 3654 } else { | 3674 } else { |
| 3655 // The selector may only be null if we reported an error. | 3675 // The selector may only be null if we reported an error. |
| 3656 assert(invariant(declaration, compiler.compilationFailed)); | 3676 assert(invariant(declaration, compiler.compilationFailed)); |
| 3657 } | 3677 } |
| 3658 if (loopVariable != null) { | 3678 if (loopVariable != null) { |
| 3659 // loopVariable may be null if it could not be resolved. | 3679 // loopVariable may be null if it could not be resolved. |
| 3660 registry.setForInVariable(node, loopVariable); | 3680 registry.setForInVariable(node, loopVariable); |
| 3661 } | 3681 } |
| 3662 visitLoopBodyIn(node, node.body, blockScope); | |
| 3663 } | 3682 } |
| 3664 | 3683 |
| 3665 visitLabel(Label node) { | 3684 visitLabel(Label node) { |
| 3666 // Labels are handled by their containing statements/cases. | 3685 // Labels are handled by their containing statements/cases. |
| 3667 } | 3686 } |
| 3668 | 3687 |
| 3669 visitLabeledStatement(LabeledStatement node) { | 3688 visitLabeledStatement(LabeledStatement node) { |
| 3670 Statement body = node.statement; | 3689 Statement body = node.statement; |
| 3671 JumpTarget targetElement = getOrDefineTarget(body); | 3690 JumpTarget targetElement = getOrDefineTarget(body); |
| 3672 Map<String, LabelDefinition> labelElements = <String, LabelDefinition>{}; | 3691 Map<String, LabelDefinition> labelElements = <String, LabelDefinition>{}; |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5077 } | 5096 } |
| 5078 | 5097 |
| 5079 /// The result for the resolution of the `assert` method. | 5098 /// The result for the resolution of the `assert` method. |
| 5080 class AssertResult implements ResolutionResult { | 5099 class AssertResult implements ResolutionResult { |
| 5081 const AssertResult(); | 5100 const AssertResult(); |
| 5082 | 5101 |
| 5083 Element get element => null; | 5102 Element get element => null; |
| 5084 | 5103 |
| 5085 String toString() => 'AssertResult()'; | 5104 String toString() => 'AssertResult()'; |
| 5086 } | 5105 } |
| OLD | NEW |