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

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

Issue 12079098: Revert "Take type arguments into account in interface type subtype check." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_types.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (!node.isConst()) { 330 if (!node.isConst()) {
331 return signalNotCompileTimeConstant(node); 331 return signalNotCompileTimeConstant(node);
332 } 332 }
333 List<Constant> arguments = <Constant>[]; 333 List<Constant> arguments = <Constant>[];
334 for (Link<Node> link = node.elements.nodes; 334 for (Link<Node> link = node.elements.nodes;
335 !link.isEmpty; 335 !link.isEmpty;
336 link = link.tail) { 336 link = link.tail) {
337 arguments.add(evaluateConstant(link.head)); 337 arguments.add(evaluateConstant(link.head));
338 } 338 }
339 // TODO(floitsch): get type parameters. 339 // TODO(floitsch): get type parameters.
340 compiler.listClass.computeType(compiler); 340 DartType type = new InterfaceType(compiler.listClass);
341 DartType type = compiler.listClass.rawType;
342 Constant constant = new ListConstant(type, arguments); 341 Constant constant = new ListConstant(type, arguments);
343 handler.registerCompileTimeConstant(constant); 342 handler.registerCompileTimeConstant(constant);
344 return constant; 343 return constant;
345 } 344 }
346 345
347 Constant visitLiteralMap(LiteralMap node) { 346 Constant visitLiteralMap(LiteralMap node) {
348 if (!node.isConst()) { 347 if (!node.isConst()) {
349 return signalNotCompileTimeConstant(node); 348 return signalNotCompileTimeConstant(node);
350 } 349 }
351 List<StringConstant> keys = <StringConstant>[]; 350 List<StringConstant> keys = <StringConstant>[];
(...skipping 15 matching lines...) Expand all
367 Constant protoValue = null; 366 Constant protoValue = null;
368 for (StringConstant key in keys) { 367 for (StringConstant key in keys) {
369 if (key.value == MapConstant.PROTO_PROPERTY) { 368 if (key.value == MapConstant.PROTO_PROPERTY) {
370 protoValue = map[key]; 369 protoValue = map[key];
371 } else { 370 } else {
372 values.add(map[key]); 371 values.add(map[key]);
373 } 372 }
374 } 373 }
375 bool hasProtoKey = (protoValue != null); 374 bool hasProtoKey = (protoValue != null);
376 // TODO(floitsch): this should be a List<String> type. 375 // TODO(floitsch): this should be a List<String> type.
377 compiler.listClass.computeType(compiler); 376 DartType keysType = new InterfaceType(compiler.listClass);
378 DartType keysType = compiler.listClass.rawType;
379 ListConstant keysList = new ListConstant(keysType, keys); 377 ListConstant keysList = new ListConstant(keysType, keys);
380 handler.registerCompileTimeConstant(keysList); 378 handler.registerCompileTimeConstant(keysList);
381 SourceString className = hasProtoKey 379 SourceString className = hasProtoKey
382 ? MapConstant.DART_PROTO_CLASS 380 ? MapConstant.DART_PROTO_CLASS
383 : MapConstant.DART_CLASS; 381 : MapConstant.DART_CLASS;
384 ClassElement classElement = compiler.jsHelperLibrary.find(className); 382 ClassElement classElement = compiler.jsHelperLibrary.find(className);
385 classElement.ensureResolved(compiler); 383 classElement.ensureResolved(compiler);
386 // TODO(floitsch): copy over the generic type. 384 // TODO(floitsch): copy over the generic type.
387 DartType type = classElement.rawType; 385 DartType type = new InterfaceType(classElement);
388 handler.registerInstantiatedClass(classElement); 386 handler.registerInstantiatedClass(classElement);
389 Constant constant = new MapConstant(type, keysList, values, protoValue); 387 Constant constant = new MapConstant(type, keysList, values, protoValue);
390 handler.registerCompileTimeConstant(constant); 388 handler.registerCompileTimeConstant(constant);
391 return constant; 389 return constant;
392 } 390 }
393 391
394 Constant visitLiteralNull(LiteralNull node) { 392 Constant visitLiteralNull(LiteralNull node) {
395 return constantSystem.createNull(); 393 return constantSystem.createNull();
396 } 394 }
397 395
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // Use the default value. 879 // Use the default value.
882 fieldValue = handler.compileConstant(field); 880 fieldValue = handler.compileConstant(field);
883 } 881 }
884 jsNewArguments.add(fieldValue); 882 jsNewArguments.add(fieldValue);
885 }, 883 },
886 includeBackendMembers: true, 884 includeBackendMembers: true,
887 includeSuperMembers: true); 885 includeSuperMembers: true);
888 return jsNewArguments; 886 return jsNewArguments;
889 } 887 }
890 } 888 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698