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

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

Issue 108613003: != is a shortcut to == true, so it returns a boolean. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/simple_inferrer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../dart2jslib.dart' hide Selector, TypedSelector; 7 import '../dart2jslib.dart' hide Selector, TypedSelector;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 T receiverType = visit(node.receiver); 840 T receiverType = visit(node.receiver);
841 DartType type = elements.getType(node.arguments.head); 841 DartType type = elements.getType(node.arguments.head);
842 return types.narrowType(receiverType, type); 842 return types.narrowType(receiverType, type);
843 } else if (node.argumentsNode is Prefix) { 843 } else if (node.argumentsNode is Prefix) {
844 // Unary operator. 844 // Unary operator.
845 return visitDynamicSend(node); 845 return visitDynamicSend(node);
846 } else if ('===' == op.source 846 } else if ('===' == op.source
847 || '!==' == op.source) { 847 || '!==' == op.source) {
848 node.visitChildren(this); 848 node.visitChildren(this);
849 return types.boolType; 849 return types.boolType;
850 } else if ('!=' == op.source) {
851 visitDynamicSend(node);
852 return types.boolType;
850 } else { 853 } else {
851 // Binary operator. 854 // Binary operator.
852 return visitDynamicSend(node); 855 return visitDynamicSend(node);
853 } 856 }
854 } 857 }
855 858
856 // Because some nodes just visit their children, we may end up 859 // Because some nodes just visit their children, we may end up
857 // visiting a type annotation, that may contain a send in case of a 860 // visiting a type annotation, that may contain a send in case of a
858 // prefixed type. Therefore we explicitly visit the type annotation 861 // prefixed type. Therefore we explicitly visit the type annotation
859 // to avoid confusing the [ResolvedVisitor]. 862 // to avoid confusing the [ResolvedVisitor].
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 return type; 1154 return type;
1152 } 1155 }
1153 1156
1154 T visitCascade(Cascade node) { 1157 T visitCascade(Cascade node) {
1155 // Ignore the result of the cascade send and return the type of the cascade 1158 // Ignore the result of the cascade send and return the type of the cascade
1156 // receiver. 1159 // receiver.
1157 visit(node.expression); 1160 visit(node.expression);
1158 return cascadeReceiverStack.removeLast(); 1161 return cascadeReceiverStack.removeLast();
1159 } 1162 }
1160 } 1163 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/simple_inferrer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698