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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/types/value_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) 2014, 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 class ValueTypeMask extends ForwardingTypeMask {
8 final TypeMask forwardTo;
9 final value;
10
11 ValueTypeMask(this.forwardTo, this.value);
12
13 TypeMask nullable() {
14 return isNullable
15 ? this
16 : new ValueTypeMask(forwardTo.nullable(), value);
17 }
18
19 TypeMask nonNullable() {
20 return isNullable
21 ? new ValueTypeMask(forwardTo.nonNullable(), value)
22 : this;
23 }
24
25 bool get isValue => true;
26
27 bool equalsDisregardNull(other) {
28 if (other is! ValueTypeMask) return false;
29 return super.equalsDisregardNull(other) && value == other.value;
30 }
31
32 TypeMask intersection(TypeMask other, ClassWorld classWorld) {
33 TypeMask forwardIntersection = forwardTo.intersection(other, classWorld);
34 if (forwardIntersection.isEmpty) return forwardIntersection;
35 return forwardIntersection.isNullable
36 ? nullable()
37 : nonNullable();
38 }
39
40 bool operator==(other) => super == other;
41
42 int get hashCode {
43 return computeHashCode(value, isNullable, forwardTo);
44 }
45
46 String toString() {
47 return 'Value mask: [$value] type: $forwardTo';
48 }
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698