| 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 library dart2js.resolution; | 5 library dart2js.resolution; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 _isNativeClassOrExtendsNativeClass(enclosingClass)) { | 284 _isNativeClassOrExtendsNativeClass(enclosingClass)) { |
| 285 reporter.reportErrorMessage(tree, MessageKind.NO_SUCH_METHOD_IN_NATIVE); | 285 reporter.reportErrorMessage(tree, MessageKind.NO_SUCH_METHOD_IN_NATIVE); |
| 286 } | 286 } |
| 287 | 287 |
| 288 resolution.target.resolveNativeMember(element, registry.impactBuilder); | 288 resolution.target.resolveNativeMember(element, registry.impactBuilder); |
| 289 | 289 |
| 290 return registry.impactBuilder; | 290 return registry.impactBuilder; |
| 291 }); | 291 }); |
| 292 } | 292 } |
| 293 | 293 |
| 294 /// Returns `true` if [element] has been processed by the resolution enqueuer. |
| 295 bool _hasBeenProcessed(MemberElement element) { |
| 296 assert(invariant(element, element == element.analyzableElement.declaration, |
| 297 message: "Unexpected element $element")); |
| 298 return enqueuer.processedEntities.contains(element); |
| 299 } |
| 300 |
| 294 WorldImpact resolveMethodElement(FunctionElementX element) { | 301 WorldImpact resolveMethodElement(FunctionElementX element) { |
| 295 assert(invariant(element, element.isDeclaration)); | 302 assert(invariant(element, element.isDeclaration)); |
| 296 return reporter.withCurrentElement(element, () { | 303 return reporter.withCurrentElement(element, () { |
| 297 if (enqueuer.hasBeenProcessed(element)) { | 304 if (_hasBeenProcessed(element)) { |
| 298 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] | 305 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] |
| 299 // should never be non-null, not even for constructors. | 306 // should never be non-null, not even for constructors. |
| 300 assert(invariant(element, element.isConstructor, | 307 assert(invariant(element, element.isConstructor, |
| 301 message: 'Non-constructor element $element ' | 308 message: 'Non-constructor element $element ' |
| 302 'has already been analyzed.')); | 309 'has already been analyzed.')); |
| 303 return const ResolutionImpact(); | 310 return const ResolutionImpact(); |
| 304 } | 311 } |
| 305 if (element.isSynthesized) { | 312 if (element.isSynthesized) { |
| 306 if (element.isGenerativeConstructor) { | 313 if (element.isGenerativeConstructor) { |
| 307 ResolutionRegistry registry = | 314 ResolutionRegistry registry = |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (member.isGenerativeConstructor && !member.isSynthesized) { | 769 if (member.isGenerativeConstructor && !member.isSynthesized) { |
| 763 reporter.reportErrorMessage( | 770 reporter.reportErrorMessage( |
| 764 member, MessageKind.ILLEGAL_MIXIN_CONSTRUCTOR); | 771 member, MessageKind.ILLEGAL_MIXIN_CONSTRUCTOR); |
| 765 } else { | 772 } else { |
| 766 // Get the resolution tree and check that the resolved member | 773 // Get the resolution tree and check that the resolved member |
| 767 // doesn't use 'super'. This is the part of the 'super' mixin | 774 // doesn't use 'super'. This is the part of the 'super' mixin |
| 768 // check that happens when a function is resolved before the | 775 // check that happens when a function is resolved before the |
| 769 // mixin application has been performed. | 776 // mixin application has been performed. |
| 770 // TODO(johnniwinther): Obtain the [TreeElements] for [member] | 777 // TODO(johnniwinther): Obtain the [TreeElements] for [member] |
| 771 // differently. | 778 // differently. |
| 772 if (resolution.enqueuer.hasBeenProcessed(member)) { | 779 if (_hasBeenProcessed(member)) { |
| 773 if (member.resolvedAst.kind == ResolvedAstKind.PARSED) { | 780 if (member.resolvedAst.kind == ResolvedAstKind.PARSED) { |
| 774 checkMixinSuperUses( | 781 checkMixinSuperUses( |
| 775 member.resolvedAst.elements, mixinApplication, mixin); | 782 member.resolvedAst.elements, mixinApplication, mixin); |
| 776 } | 783 } |
| 777 } | 784 } |
| 778 } | 785 } |
| 779 }); | 786 }); |
| 780 } | 787 } |
| 781 | 788 |
| 782 void checkMixinSuperUses(TreeElements elements, | 789 void checkMixinSuperUses(TreeElements elements, |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 TreeElements get treeElements { | 1150 TreeElements get treeElements { |
| 1144 assert(invariant(this, _treeElements != null, | 1151 assert(invariant(this, _treeElements != null, |
| 1145 message: "TreeElements have not been computed for $this.")); | 1152 message: "TreeElements have not been computed for $this.")); |
| 1146 return _treeElements; | 1153 return _treeElements; |
| 1147 } | 1154 } |
| 1148 | 1155 |
| 1149 void reuseElement() { | 1156 void reuseElement() { |
| 1150 _treeElements = null; | 1157 _treeElements = null; |
| 1151 } | 1158 } |
| 1152 } | 1159 } |
| OLD | NEW |