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

Side by Side Diff: tests/compiler/dart2js/related_types.dart

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: Created 3 years, 10 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 related_types; 5 library related_types;
6 6
7 import 'package:compiler/src/commandline_options.dart'; 7 import 'package:compiler/src/commandline_options.dart';
8 import 'package:compiler/src/compiler.dart'; 8 import 'package:compiler/src/compiler.dart';
9 import 'package:compiler/src/core_types.dart'; 9 import 'package:compiler/src/core_types.dart';
10 import 'package:compiler/src/elements/resolution_types.dart'; 10 import 'package:compiler/src/elements/resolution_types.dart';
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 ResolutionDartType apply(Node node, [_]) { 256 ResolutionDartType apply(Node node, [_]) {
257 ResolutionDartType type = node.accept(this); 257 ResolutionDartType type = node.accept(this);
258 if (type == null) { 258 if (type == null) {
259 type = const ResolutionDynamicType(); 259 type = const ResolutionDynamicType();
260 } 260 }
261 return type; 261 return type;
262 } 262 }
263 263
264 @override 264 @override
265 ResolutionDartType visitEquals(Send node, Node left, Node right, _) { 265 ResolutionInterfaceType visitEquals(Send node, Node left, Node right, _) {
266 ResolutionDartType leftType = apply(left); 266 ResolutionDartType leftType = apply(left);
267 ResolutionDartType rightType = apply(right); 267 ResolutionDartType rightType = apply(right);
268 checkRelated(node, leftType, rightType); 268 checkRelated(node, leftType, rightType);
269 return commonElements.boolType; 269 return commonElements.boolType;
270 } 270 }
271 271
272 @override 272 @override
273 ResolutionDartType visitNotEquals(Send node, Node left, Node right, _) { 273 ResolutionInterfaceType visitNotEquals(Send node, Node left, Node right, _) {
274 ResolutionDartType leftType = apply(left); 274 ResolutionDartType leftType = apply(left);
275 ResolutionDartType rightType = apply(right); 275 ResolutionDartType rightType = apply(right);
276 checkRelated(node, leftType, rightType); 276 checkRelated(node, leftType, rightType);
277 return commonElements.boolType; 277 return commonElements.boolType;
278 } 278 }
279 279
280 @override 280 @override
281 ResolutionDartType visitIndex(Send node, Node receiver, Node index, _) { 281 ResolutionDartType visitIndex(Send node, Node receiver, Node index, _) {
282 ResolutionDartType receiverType = apply(receiver); 282 ResolutionDartType receiverType = apply(receiver);
283 ResolutionDartType indexType = apply(index); 283 ResolutionDartType indexType = apply(index);
284 ResolutionInterfaceType mapType = findMapType(receiverType); 284 ResolutionInterfaceType mapType = findMapType(receiverType);
285 ResolutionDartType keyType = findMapKeyType(mapType); 285 ResolutionDartType keyType = findMapKeyType(mapType);
286 ResolutionDartType valueType = findMapValueType(mapType); 286 ResolutionDartType valueType = findMapValueType(mapType);
287 checkRelated(index, keyType, indexType); 287 checkRelated(index, keyType, indexType);
288 return valueType; 288 return valueType;
289 } 289 }
290 290
291 @override 291 @override
292 ResolutionDartType visitLiteralInt(LiteralInt node) { 292 ResolutionInterfaceType visitLiteralInt(LiteralInt node) {
293 return commonElements.intType; 293 return commonElements.intType;
294 } 294 }
295 295
296 @override 296 @override
297 ResolutionDartType visitLiteralString(LiteralString node) { 297 ResolutionInterfaceType visitLiteralString(LiteralString node) {
298 return commonElements.stringType; 298 return commonElements.stringType;
299 } 299 }
300 300
301 @override 301 @override
302 ResolutionDartType visitLiteralBool(LiteralBool node) { 302 ResolutionInterfaceType visitLiteralBool(LiteralBool node) {
303 return commonElements.boolType; 303 return commonElements.boolType;
304 } 304 }
305 305
306 @override 306 @override
307 ResolutionDartType visitLiteralMap(LiteralMap node) { 307 ResolutionDartType visitLiteralMap(LiteralMap node) {
308 return elements.getType(node); 308 return elements.getType(node);
309 } 309 }
310 310
311 @override 311 @override
312 ResolutionDartType visitLiteralList(LiteralList node) { 312 ResolutionDartType visitLiteralList(LiteralList node) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 ClassElement findClass(ResolutionDartType type) => type.accept(this, null); 429 ClassElement findClass(ResolutionDartType type) => type.accept(this, null);
430 430
431 @override 431 @override
432 ClassElement visitType(ResolutionDartType type, _) => null; 432 ClassElement visitType(ResolutionDartType type, _) => null;
433 433
434 @override 434 @override
435 ClassElement visitInterfaceType(ResolutionInterfaceType type, _) { 435 ClassElement visitInterfaceType(ResolutionInterfaceType type, _) {
436 return type.element; 436 return type.element;
437 } 437 }
438 } 438 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698