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

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

Issue 14636002: Make TypeMask an interface and start hiding implementation details of FlatTypeMask. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 final Selector asUntyped; 415 final Selector asUntyped;
416 final TypeMask mask; 416 final TypeMask mask;
417 417
418 TypedSelector(this.mask, Selector selector) 418 TypedSelector(this.mask, Selector selector)
419 : asUntyped = selector.asUntyped, 419 : asUntyped = selector.asUntyped,
420 super(selector.kind, 420 super(selector.kind,
421 selector.name, 421 selector.name,
422 selector.library, 422 selector.library,
423 selector.argumentCount, 423 selector.argumentCount,
424 selector.namedArguments) { 424 selector.namedArguments) {
425 // Invariant: Typed selector can not be based on a malformed type.
426 assert(mask.isEmpty || !identical(mask.base.kind, TypeKind.MALFORMED_TYPE));
427 assert(asUntyped.mask == null); 425 assert(asUntyped.mask == null);
428 } 426 }
429 427
430 TypedSelector.exact(DartType base, Selector selector) 428 TypedSelector.exact(DartType base, Selector selector)
431 : this(new TypeMask.exact(base), selector); 429 : this(new TypeMask.exact(base), selector);
432 430
433 TypedSelector.subclass(DartType base, Selector selector) 431 TypedSelector.subclass(DartType base, Selector selector)
434 : this(new TypeMask.subclass(base), selector); 432 : this(new TypeMask.subclass(base), selector);
435 433
436 TypedSelector.subtype(DartType base, Selector selector) 434 TypedSelector.subtype(DartType base, Selector selector)
437 : this(new TypeMask.subtype(base), selector); 435 : this(new TypeMask.subtype(base), selector);
438 436
439 bool get hasExactMask => mask.isExact;
440 437
441 bool appliesUnnamed(Element element, Compiler compiler) { 438 bool appliesUnnamed(Element element, Compiler compiler) {
442 assert(sameNameHack(element, compiler)); 439 assert(sameNameHack(element, compiler));
443 // [TypedSelector] are only used after resolution. 440 // [TypedSelector] are only used after resolution.
444 assert(compiler.phase > Compiler.PHASE_RESOLVING); 441 assert(compiler.phase > Compiler.PHASE_RESOLVING);
445 if (!element.isMember()) return false; 442 if (!element.isMember()) return false;
446 443
447 // A closure can be called through any typed selector: 444 // A closure can be called through any typed selector:
448 // class A { 445 // class A {
449 // get foo => () => 42; 446 // get foo => () => 42;
450 // bar() => foo(); // The call to 'foo' is a typed selector. 447 // bar() => foo(); // The call to 'foo' is a typed selector.
451 // } 448 // }
452 if (element.getEnclosingClass().isClosure()) { 449 if (element.getEnclosingClass().isClosure()) {
453 return appliesUntyped(element, compiler); 450 return appliesUntyped(element, compiler);
454 } 451 }
455 452
456 if (!mask.canHit(element, this, compiler)) return false; 453 if (!mask.canHit(element, this, compiler)) return false;
457 return appliesUntyped(element, compiler); 454 return appliesUntyped(element, compiler);
458 } 455 }
459 } 456 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/type_mask.dart ('k') | sdk/lib/_internal/compiler/implementation/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698