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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/universe/universe.dart

Issue 12764005: Get rid of old code for union/intersection in HType. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused factory methods. Created 7 years, 9 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 | Annotate | Revision Log
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 '../closure.dart'; 7 import '../closure.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../dart2jslib.dart'; 9 import '../dart2jslib.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 final TypeMask mask; 452 final TypeMask mask;
453 453
454 TypedSelector(this.mask, Selector selector) 454 TypedSelector(this.mask, Selector selector)
455 : asUntyped = selector.asUntyped, 455 : asUntyped = selector.asUntyped,
456 super(selector.kind, 456 super(selector.kind,
457 selector.name, 457 selector.name,
458 selector.library, 458 selector.library,
459 selector.argumentCount, 459 selector.argumentCount,
460 selector.namedArguments) { 460 selector.namedArguments) {
461 // Invariant: Typed selector can not be based on a malformed type. 461 // Invariant: Typed selector can not be based on a malformed type.
462 assert(!identical(mask.base.kind, TypeKind.MALFORMED_TYPE)); 462 assert(mask.isEmpty || !identical(mask.base.kind, TypeKind.MALFORMED_TYPE));
463 assert(asUntyped.mask == null); 463 assert(asUntyped.mask == null);
464 } 464 }
465 465
466 TypedSelector.exact(DartType base, Selector selector) 466 TypedSelector.exact(DartType base, Selector selector)
467 : this(new TypeMask.exact(base), selector); 467 : this(new TypeMask.exact(base), selector);
468 468
469 TypedSelector.subclass(DartType base, Selector selector) 469 TypedSelector.subclass(DartType base, Selector selector)
470 : this(new TypeMask.subclass(base), selector); 470 : this(new TypeMask.subclass(base), selector);
471 471
472 TypedSelector.subtype(DartType base, Selector selector) 472 TypedSelector.subtype(DartType base, Selector selector)
(...skipping 18 matching lines...) Expand all
491 // A closure can be called through any typed selector: 491 // A closure can be called through any typed selector:
492 // class A { 492 // class A {
493 // get foo => () => 42; 493 // get foo => () => 42;
494 // bar() => foo(); // The call to 'foo' is a typed selector. 494 // bar() => foo(); // The call to 'foo' is a typed selector.
495 // } 495 // }
496 ClassElement other = element.getEnclosingClass(); 496 ClassElement other = element.getEnclosingClass();
497 if (identical(other.superclass, compiler.closureClass)) { 497 if (identical(other.superclass, compiler.closureClass)) {
498 return appliesUntyped(element, compiler); 498 return appliesUntyped(element, compiler);
499 } 499 }
500 500
501 if (mask.isEmpty) {
502 if (!mask.isNullable) return false;
503 return hasElementIn(compiler.backend.jsNullClass, element)
504 && appliesUntyped(element, compiler);
505 }
506
501 // TODO(kasperl): Can't we just avoid creating typed selectors 507 // TODO(kasperl): Can't we just avoid creating typed selectors
502 // based of function types? 508 // based of function types?
503 Element self = mask.base.element; 509 Element self = mask.base.element;
504 if (self.isTypedef()) { 510 if (self.isTypedef()) {
505 // A typedef is a function type that doesn't have any 511 // A typedef is a function type that doesn't have any
506 // user-defined members. 512 // user-defined members.
507 return false; 513 return false;
508 } 514 }
509 515
510 if (mask.isNullable && compiler.backend.isNullImplementation(other)) { 516 if (mask.isNullable && compiler.backend.isNullImplementation(other)) {
(...skipping 19 matching lines...) Expand all
530 ClassElement cls = self; 536 ClassElement cls = self;
531 if (cls.isSubclassOf(other)) { 537 if (cls.isSubclassOf(other)) {
532 // Resolve an invocation of [element.name] on [self]. If it 538 // Resolve an invocation of [element.name] on [self]. If it
533 // is found, this selector is a candidate. 539 // is found, this selector is a candidate.
534 return hasElementIn(cls, element) && appliesUntyped(element, compiler); 540 return hasElementIn(cls, element) && appliesUntyped(element, compiler);
535 } 541 }
536 } 542 }
537 return false; 543 return false;
538 } 544 }
539 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698