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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 | 279 |
280 // TODO(9631): support noSuchMethod on native classes. | 280 // TODO(9631): support noSuchMethod on native classes. |
281 if (element.isFunction && | 281 if (element.isFunction && |
282 element.isInstanceMember && | 282 element.isInstanceMember && |
283 element.name == Identifiers.noSuchMethod_ && | 283 element.name == Identifiers.noSuchMethod_ && |
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.resolveNativeElement(element, registry.worldImpact); |
| 289 |
288 return registry.worldImpact; | 290 return registry.worldImpact; |
289 }); | 291 }); |
290 } | 292 } |
291 | 293 |
292 WorldImpact resolveMethodElement(FunctionElementX element) { | 294 WorldImpact resolveMethodElement(FunctionElementX element) { |
293 assert(invariant(element, element.isDeclaration)); | 295 assert(invariant(element, element.isDeclaration)); |
294 return reporter.withCurrentElement(element, () { | 296 return reporter.withCurrentElement(element, () { |
295 if (compiler.enqueuer.resolution.hasBeenProcessed(element)) { | 297 if (compiler.enqueuer.resolution.hasBeenProcessed(element)) { |
296 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] | 298 // TODO(karlklose): Remove the check for [isConstructor]. [elememts] |
297 // should never be non-null, not even for constructors. | 299 // should never be non-null, not even for constructors. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // TODO(johnniwinther): Determine the const-ness eagerly to avoid | 409 // TODO(johnniwinther): Determine the const-ness eagerly to avoid |
408 // unnecessary registrations. | 410 // unnecessary registrations. |
409 registry.registerFeature(Feature.LAZY_FIELD); | 411 registry.registerFeature(Feature.LAZY_FIELD); |
410 } | 412 } |
411 } | 413 } |
412 } | 414 } |
413 | 415 |
414 // Perform various checks as side effect of "computing" the type. | 416 // Perform various checks as side effect of "computing" the type. |
415 element.computeType(resolution); | 417 element.computeType(resolution); |
416 | 418 |
| 419 resolution.target.resolveNativeElement(element, registry.worldImpact); |
| 420 |
417 return registry.worldImpact; | 421 return registry.worldImpact; |
418 } | 422 } |
419 | 423 |
420 DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) { | 424 DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) { |
421 DartType type = resolveReturnType(element, annotation); | 425 DartType type = resolveReturnType(element, annotation); |
422 if (type.isVoid) { | 426 if (type.isVoid) { |
423 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED); | 427 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED); |
424 } | 428 } |
425 return type; | 429 return type; |
426 } | 430 } |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 TreeElements get treeElements { | 1121 TreeElements get treeElements { |
1118 assert(invariant(this, _treeElements != null, | 1122 assert(invariant(this, _treeElements != null, |
1119 message: "TreeElements have not been computed for $this.")); | 1123 message: "TreeElements have not been computed for $this.")); |
1120 return _treeElements; | 1124 return _treeElements; |
1121 } | 1125 } |
1122 | 1126 |
1123 void reuseElement() { | 1127 void reuseElement() { |
1124 _treeElements = null; | 1128 _treeElements = null; |
1125 } | 1129 } |
1126 } | 1130 } |
OLD | NEW |