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

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

Issue 16154021: Implement reflecting on uninstantiated classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update comment in second test. Created 7 years, 6 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
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 StringConstant partString = evaluate(part.string); 437 StringConstant partString = evaluate(part.string);
438 if (partString == null) return null; 438 if (partString == null) return null;
439 accumulator = new DartString.concat(accumulator, partString.value); 439 accumulator = new DartString.concat(accumulator, partString.value);
440 }; 440 };
441 handler.registerStringInstance(elements); 441 handler.registerStringInstance(elements);
442 return constantSystem.createString(accumulator, node); 442 return constantSystem.createString(accumulator, node);
443 } 443 }
444 444
445 Constant makeTypeConstant(Element element) { 445 Constant makeTypeConstant(Element element) {
446 DartType elementType = element.computeType(compiler).asRaw(); 446 DartType elementType = element.computeType(compiler).asRaw();
447 if (compiler.mirrorsEnabled) {
448 handler.registerInstantiatedClass(element, elements);
449 }
447 DartType constantType = 450 DartType constantType =
448 compiler.backend.typeImplementation.computeType(compiler); 451 compiler.backend.typeImplementation.computeType(compiler);
449 Constant constant = new TypeConstant(elementType, constantType); 452 Constant constant = new TypeConstant(elementType, constantType);
450 // If we use a type literal in a constant, the compile time 453 // If we use a type literal in a constant, the compile time
451 // constant emitter will generate a call to the createRuntimeType 454 // constant emitter will generate a call to the createRuntimeType
452 // helper so we register a use of that. 455 // helper so we register a use of that.
453 handler.registerCreateRuntimeTypeFunction(); 456 handler.registerCreateRuntimeTypeFunction();
454 handler.registerCompileTimeConstant(constant, elements); 457 handler.registerCompileTimeConstant(constant, elements);
455 return constant; 458 return constant;
456 } 459 }
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 if (fieldValue == null) { 890 if (fieldValue == null) {
888 // Use the default value. 891 // Use the default value.
889 fieldValue = handler.compileConstant(field); 892 fieldValue = handler.compileConstant(field);
890 } 893 }
891 jsNewArguments.add(fieldValue); 894 jsNewArguments.add(fieldValue);
892 }, 895 },
893 includeSuperAndInjectedMembers: true); 896 includeSuperAndInjectedMembers: true);
894 return jsNewArguments; 897 return jsNewArguments;
895 } 898 }
896 } 899 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698