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

Side by Side Diff: pkg/compiler/lib/src/universe/world_builder.dart

Issue 2423953002: Change TypeInference to handle super calls as direct invocations. (Closed)
Patch Set: Register instance methods from direct invocation. Created 4 years, 2 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
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 universe; 5 library universe;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 break; 372 break;
373 case StaticUseKind.GENERAL: 373 case StaticUseKind.GENERAL:
374 case StaticUseKind.STATIC_TEAR_OFF: 374 case StaticUseKind.STATIC_TEAR_OFF:
375 case StaticUseKind.FIELD_GET: 375 case StaticUseKind.FIELD_GET:
376 case StaticUseKind.CONSTRUCTOR_INVOKE: 376 case StaticUseKind.CONSTRUCTOR_INVOKE:
377 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 377 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
378 break; 378 break;
379 case StaticUseKind.CLOSURE: 379 case StaticUseKind.CLOSURE:
380 allClosures.add(element); 380 allClosures.add(element);
381 break; 381 break;
382 case StaticUseKind.DIRECT_INVOKE:
383 invariant(
384 element, 'Direct static use is not supported for resolution.');
385 break;
382 } 386 }
383 } 387 }
384 388
385 void forgetElement(Element element, Compiler compiler) { 389 void forgetElement(Element element, Compiler compiler) {
386 allClosures.remove(element); 390 allClosures.remove(element);
387 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement); 391 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement);
388 closurizedMembers.remove(element); 392 closurizedMembers.remove(element);
389 fieldSetters.remove(element); 393 fieldSetters.remove(element);
390 _directlyInstantiatedClasses.remove(element); 394 _directlyInstantiatedClasses.remove(element);
391 if (element is ClassElement) { 395 if (element is ClassElement) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 ClassElement cls = type.element; 516 ClassElement cls = type.element;
513 if (!cls.isAbstract 517 if (!cls.isAbstract
514 // We can't use the closed-world assumption with native abstract 518 // We can't use the closed-world assumption with native abstract
515 // classes; a native abstract class may have non-abstract subclasses 519 // classes; a native abstract class may have non-abstract subclasses
516 // not declared to the program. Instances of these classes are 520 // not declared to the program. Instances of these classes are
517 // indistinguishable from the abstract class. 521 // indistinguishable from the abstract class.
518 || 522 ||
519 isNative 523 isNative
520 // Likewise, if this registration comes from the mirror system, 524 // Likewise, if this registration comes from the mirror system,
521 // all bets are off. 525 // all bets are off.
522 // TODO(herhut): Track classes required by mirrors seperately. 526 // TODO(herhut): Track classes required by mirrors separately.
523 || 527 ||
524 byMirrors) { 528 byMirrors) {
525 _directlyInstantiatedClasses.add(cls); 529 _directlyInstantiatedClasses.add(cls);
526 } 530 }
527 531
528 // TODO(johnniwinther): Replace this by separate more specific mappings that 532 // TODO(johnniwinther): Replace this by separate more specific mappings that
529 // include the type arguments. 533 // include the type arguments.
530 if (_implementedClasses.add(cls)) { 534 if (_implementedClasses.add(cls)) {
531 onImplemented(cls); 535 onImplemented(cls);
532 cls.allSupertypes.forEach((InterfaceType supertype) { 536 cls.allSupertypes.forEach((InterfaceType supertype) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 case StaticUseKind.SUPER_TEAR_OFF: 648 case StaticUseKind.SUPER_TEAR_OFF:
645 methodsNeedingSuperGetter.add(element); 649 methodsNeedingSuperGetter.add(element);
646 break; 650 break;
647 case StaticUseKind.SUPER_FIELD_SET: 651 case StaticUseKind.SUPER_FIELD_SET:
648 case StaticUseKind.FIELD_SET: 652 case StaticUseKind.FIELD_SET:
649 case StaticUseKind.GENERAL: 653 case StaticUseKind.GENERAL:
650 case StaticUseKind.CLOSURE: 654 case StaticUseKind.CLOSURE:
651 case StaticUseKind.FIELD_GET: 655 case StaticUseKind.FIELD_GET:
652 case StaticUseKind.CONSTRUCTOR_INVOKE: 656 case StaticUseKind.CONSTRUCTOR_INVOKE:
653 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 657 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
658 case StaticUseKind.DIRECT_INVOKE:
654 break; 659 break;
655 } 660 }
656 } 661 }
657 662
658 void forgetElement(Element element, Compiler compiler) { 663 void forgetElement(Element element, Compiler compiler) {
659 _directlyInstantiatedClasses.remove(element); 664 _directlyInstantiatedClasses.remove(element);
660 if (element is ClassElement) { 665 if (element is ClassElement) {
661 assert(invariant(element, element.thisType.isRaw, 666 assert(invariant(element, element.thisType.isRaw,
662 message: 'Generic classes not supported (${element.thisType}).')); 667 message: 'Generic classes not supported (${element.thisType}).'));
663 _instantiatedTypes..remove(element.rawType)..remove(element.thisType); 668 _instantiatedTypes..remove(element.rawType)..remove(element.thisType);
664 } 669 }
665 } 670 }
666 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698