| 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 /** | 7 /** |
| 8 * Core implementation of resolution. | 8 * Core implementation of resolution. |
| 9 * | 9 * |
| 10 * Do not subclass or instantiate this class outside this library | 10 * Do not subclass or instantiate this class outside this library |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 registry.registerSuperUse(node); | 793 registry.registerSuperUse(node); |
| 794 return true; | 794 return true; |
| 795 } | 795 } |
| 796 | 796 |
| 797 /// Check that access to `this` is currently allowed. | 797 /// Check that access to `this` is currently allowed. |
| 798 bool checkThisAccess(Send node) { | 798 bool checkThisAccess(Send node) { |
| 799 if (!inInstanceContext) { | 799 if (!inInstanceContext) { |
| 800 compiler.reportError(node, MessageKind.NO_THIS_AVAILABLE); | 800 compiler.reportError(node, MessageKind.NO_THIS_AVAILABLE); |
| 801 return false; | 801 return false; |
| 802 } | 802 } |
| 803 if (node.isConditional) { | |
| 804 // `this?.foo` is not allowed. | |
| 805 compiler.reportError(node, MessageKind.INVALID_USE_OF_THIS); | |
| 806 return false; | |
| 807 } | |
| 808 return true; | 803 return true; |
| 809 } | 804 } |
| 810 | 805 |
| 811 /// Compute the [AccessSemantics] corresponding to a super access of [target]. | 806 /// Compute the [AccessSemantics] corresponding to a super access of [target]. |
| 812 AccessSemantics computeSuperAccess(Spannable node, Element target) { | 807 AccessSemantics computeSuperAccess(Spannable node, Element target) { |
| 813 if (target.isErroneous) { | 808 if (target.isErroneous) { |
| 814 return new StaticAccess.unresolvedSuper(target); | 809 return new StaticAccess.unresolvedSuper(target); |
| 815 } else if (target.isGetter) { | 810 } else if (target.isGetter) { |
| 816 return new StaticAccess.superGetter(target); | 811 return new StaticAccess.superGetter(target); |
| 817 } else if (target.isSetter) { | 812 } else if (target.isSetter) { |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 visitTypedef(Typedef node) { | 2641 visitTypedef(Typedef node) { |
| 2647 internalError(node, 'typedef'); | 2642 internalError(node, 'typedef'); |
| 2648 } | 2643 } |
| 2649 } | 2644 } |
| 2650 | 2645 |
| 2651 /// Looks up [name] in [scope] and unwraps the result. | 2646 /// Looks up [name] in [scope] and unwraps the result. |
| 2652 Element lookupInScope(Compiler compiler, Node node, | 2647 Element lookupInScope(Compiler compiler, Node node, |
| 2653 Scope scope, String name) { | 2648 Scope scope, String name) { |
| 2654 return Elements.unwrap(scope.lookup(name), compiler, node); | 2649 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 2655 } | 2650 } |
| OLD | NEW |