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

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

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 part of types;
6
7 /**
8 * A type mask that wraps an other one, and delegate all its
9 * implementation methods to it.
10 */
11 abstract class ForwardingTypeMask implements TypeMask {
12
13 TypeMask get forwardTo;
14
15 ForwardingTypeMask();
16
17 bool get isEmpty => forwardTo.isEmpty;
18 bool get isNullable => forwardTo.isNullable;
19 bool get isExact => forwardTo.isExact;
20
21 bool get isUnion => false;
22 bool get isContainer => false;
23 bool get isMap => false;
24 bool get isDictionary => false;
25 bool get isValue => false;
26 bool get isForwarding => true;
27
28 bool isInMask(TypeMask other, ClassWorld classWorld) {
29 return forwardTo.isInMask(other, classWorld);
30 }
31
32 bool containsMask(TypeMask other, ClassWorld classWorld) {
33 return forwardTo.containsMask(other, classWorld);
34 }
35
36 bool containsOnlyInt(ClassWorld classWorld) {
37 return forwardTo.containsOnlyInt(classWorld);
38 }
39
40 bool containsOnlyDouble(ClassWorld classWorld) {
41 return forwardTo.containsOnlyDouble(classWorld);
42 }
43
44 bool containsOnlyNum(ClassWorld classWorld) {
45 return forwardTo.containsOnlyNum(classWorld);
46 }
47
48 bool containsOnlyBool(ClassWorld classWorld) {
49 return forwardTo.containsOnlyBool(classWorld);
50 }
51
52 bool containsOnlyString(ClassWorld classWorld) {
53 return forwardTo.containsOnlyString(classWorld);
54 }
55
56 bool containsOnly(ClassElement element) {
57 return forwardTo.containsOnly(element);
58 }
59
60 bool satisfies(ClassElement cls, ClassWorld classWorld) {
61 return forwardTo.satisfies(cls, classWorld);
62 }
63
64 bool contains(ClassElement type, ClassWorld classWorld) {
65 return forwardTo.contains(type, classWorld);
66 }
67
68 bool containsAll(ClassWorld classWorld) {
69 return forwardTo.containsAll(classWorld);
70 }
71
72 ClassElement singleClass(ClassWorld classWorld) {
73 return forwardTo.singleClass(classWorld);
74 }
75
76 TypeMask union(other, ClassWorld classWorld) {
77 if (this == other) {
78 return this;
79 } else if (equalsDisregardNull(other)) {
80 return other.isNullable ? other : this;
81 } else if (other.isEmpty) {
82 return other.isNullable ? this.nullable() : this;
83 }
84 return forwardTo.union(other, classWorld);
85 }
86
87 TypeMask intersection(TypeMask other, ClassWorld classWorld) {
88 return forwardTo.intersection(other, classWorld);
89 }
90
91 bool needsNoSuchMethodHandling(Selector selector, ClassWorld classWorld) {
92 return forwardTo.needsNoSuchMethodHandling(selector, classWorld);
93 }
94
95 bool canHit(Element element, Selector selector, ClassWorld classWorld) {
96 return forwardTo.canHit(element, selector, classWorld);
97 }
98
99 Element locateSingleElement(Selector selector, Compiler compiler) {
100 return forwardTo.locateSingleElement(selector, compiler);
101 }
102
103 bool equalsDisregardNull(other) {
104 if (other is! ForwardingTypeMask) return false;
105 if (forwardTo.isNullable) {
106 return forwardTo == other.forwardTo.nullable();
107 } else {
108 return forwardTo == other.forwardTo.nonNullable();
109 }
110 }
111
112 bool operator==(other) {
113 return equalsDisregardNull(other) && isNullable == other.isNullable;
114 }
115
116 int get hashCode => throw "Subclass should implement hashCode getter";
117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698