Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 2045223002: Compute and cache element NativeBehavior during resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Temporarily skip compilation subtest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698