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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 1371193004: Add bool value types to type inference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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 inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import 'dart:collection' show 7 import 'dart:collection' show
8 IterableMixin; 8 IterableMixin;
9 9
10 import '../compiler.dart' show 10 import '../compiler.dart' show
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 T get listType; 51 T get listType;
52 T get constListType; 52 T get constListType;
53 T get fixedListType; 53 T get fixedListType;
54 T get growableListType; 54 T get growableListType;
55 T get mapType; 55 T get mapType;
56 T get constMapType; 56 T get constMapType;
57 T get stringType; 57 T get stringType;
58 T get typeType; 58 T get typeType;
59 59
60 T stringLiteralType(DartString value); 60 T stringLiteralType(DartString value);
61 T boolLiteralType(LiteralBool value);
61 62
62 T nonNullSubtype(ClassElement type); 63 T nonNullSubtype(ClassElement type);
63 T nonNullSubclass(ClassElement type); 64 T nonNullSubclass(ClassElement type);
64 T nonNullExact(ClassElement type); 65 T nonNullExact(ClassElement type);
65 T nonNullEmpty(); 66 T nonNullEmpty();
66 bool isNull(T type); 67 bool isNull(T type);
67 TypeMask newTypedSelector(T receiver, TypeMask mask); 68 TypeMask newTypedSelector(T receiver, TypeMask mask);
68 69
69 T allocateList(T type, 70 T allocateList(T type,
70 Node node, 71 Node node,
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 node.visitChildren(this); 826 node.visitChildren(this);
826 return types.stringType; 827 return types.stringType;
827 } 828 }
828 829
829 T visitStringJuxtaposition(StringJuxtaposition node) { 830 T visitStringJuxtaposition(StringJuxtaposition node) {
830 node.visitChildren(this); 831 node.visitChildren(this);
831 return types.stringType; 832 return types.stringType;
832 } 833 }
833 834
834 T visitLiteralBool(LiteralBool node) { 835 T visitLiteralBool(LiteralBool node) {
835 return types.boolType; 836 return types.boolLiteralType(node);
836 } 837 }
837 838
838 T visitLiteralDouble(LiteralDouble node) { 839 T visitLiteralDouble(LiteralDouble node) {
839 ConstantSystem constantSystem = compiler.backend.constantSystem; 840 ConstantSystem constantSystem = compiler.backend.constantSystem;
840 // The JavaScript backend may turn this literal into an integer at 841 // The JavaScript backend may turn this literal into an integer at
841 // runtime. 842 // runtime.
842 return types.getConcreteTypeFor( 843 return types.getConcreteTypeFor(
843 computeTypeMask(compiler, constantSystem.createDouble(node.value))); 844 computeTypeMask(compiler, constantSystem.createDouble(node.value)));
844 } 845 }
845 846
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 return type; 1534 return type;
1534 } 1535 }
1535 1536
1536 T visitCascade(Cascade node) { 1537 T visitCascade(Cascade node) {
1537 // Ignore the result of the cascade send and return the type of the cascade 1538 // Ignore the result of the cascade send and return the type of the cascade
1538 // receiver. 1539 // receiver.
1539 visit(node.expression); 1540 visit(node.expression);
1540 return cascadeReceiverStack.removeLast(); 1541 return cascadeReceiverStack.removeLast();
1541 } 1542 }
1542 } 1543 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698