| Index: dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
|
| index e4758a2ec1b2fc4e36c6f617a616034e3792395c..87927b0abc889a3b8fe7a080bc98776035119d99 100644
|
| --- a/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
|
| @@ -42,8 +42,8 @@ class ConstantHandler extends CompilerTask {
|
|
|
| String get name => 'ConstantHandler';
|
|
|
| - void registerCompileTimeConstant(Constant constant) {
|
| - registerInstantiatedClass(constant.computeType(compiler).element);
|
| + void registerCompileTimeConstant(Constant constant, TreeElements elements) {
|
| + registerInstantiatedClass(constant.computeType(compiler).element, elements);
|
| if (constant.isFunction()) {
|
| FunctionConstant function = constant;
|
| registerGetOfStaticFunction(function.element);
|
| @@ -51,9 +51,9 @@ class ConstantHandler extends CompilerTask {
|
| compiledConstants.add(constant);
|
| }
|
|
|
| - void registerInstantiatedClass(ClassElement element) {
|
| + void registerInstantiatedClass(ClassElement element, TreeElements elements) {
|
| if (isMetadata) return;
|
| - compiler.enqueuer.codegen.registerInstantiatedClass(element);
|
| + compiler.enqueuer.codegen.registerInstantiatedClass(element, elements);
|
| }
|
|
|
| void registerStaticUse(Element element) {
|
| @@ -66,8 +66,8 @@ class ConstantHandler extends CompilerTask {
|
| compiler.enqueuer.codegen.registerGetOfStaticFunction(element);
|
| }
|
|
|
| - void registerStringInstance() {
|
| - registerInstantiatedClass(compiler.stringClass);
|
| + void registerStringInstance(TreeElements elements) {
|
| + registerInstantiatedClass(compiler.stringClass, elements);
|
| }
|
|
|
| void registerCreateRuntimeTypeFunction() {
|
| @@ -312,17 +312,17 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| }
|
|
|
| Constant visitLiteralBool(LiteralBool node) {
|
| - handler.registerInstantiatedClass(compiler.boolClass);
|
| + handler.registerInstantiatedClass(compiler.boolClass, elements);
|
| return constantSystem.createBool(node.value);
|
| }
|
|
|
| Constant visitLiteralDouble(LiteralDouble node) {
|
| - handler.registerInstantiatedClass(compiler.doubleClass);
|
| + handler.registerInstantiatedClass(compiler.doubleClass, elements);
|
| return constantSystem.createDouble(node.value);
|
| }
|
|
|
| Constant visitLiteralInt(LiteralInt node) {
|
| - handler.registerInstantiatedClass(compiler.intClass);
|
| + handler.registerInstantiatedClass(compiler.intClass, elements);
|
| return constantSystem.createInt(node.value);
|
| }
|
|
|
| @@ -340,7 +340,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| compiler.listClass.computeType(compiler);
|
| DartType type = compiler.listClass.rawType;
|
| Constant constant = new ListConstant(type, arguments);
|
| - handler.registerCompileTimeConstant(constant);
|
| + handler.registerCompileTimeConstant(constant, elements);
|
| return constant;
|
| }
|
|
|
| @@ -377,7 +377,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| compiler.listClass.computeType(compiler);
|
| DartType keysType = compiler.listClass.rawType;
|
| ListConstant keysList = new ListConstant(keysType, keys);
|
| - handler.registerCompileTimeConstant(keysList);
|
| + handler.registerCompileTimeConstant(keysList, elements);
|
| SourceString className = hasProtoKey
|
| ? MapConstant.DART_PROTO_CLASS
|
| : MapConstant.DART_CLASS;
|
| @@ -385,9 +385,9 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| classElement.ensureResolved(compiler);
|
| // TODO(floitsch): copy over the generic type.
|
| DartType type = classElement.rawType;
|
| - handler.registerInstantiatedClass(classElement);
|
| + handler.registerInstantiatedClass(classElement, elements);
|
| Constant constant = new MapConstant(type, keysList, values, protoValue);
|
| - handler.registerCompileTimeConstant(constant);
|
| + handler.registerCompileTimeConstant(constant, elements);
|
| return constant;
|
| }
|
|
|
| @@ -396,7 +396,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| }
|
|
|
| Constant visitLiteralString(LiteralString node) {
|
| - handler.registerStringInstance();
|
| + handler.registerStringInstance(elements);
|
| return constantSystem.createString(node.dartString, node);
|
| }
|
|
|
| @@ -404,7 +404,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| StringConstant left = evaluate(node.first);
|
| StringConstant right = evaluate(node.second);
|
| if (left == null || right == null) return null;
|
| - handler.registerStringInstance();
|
| + handler.registerStringInstance(elements);
|
| return constantSystem.createString(
|
| new DartString.concat(left.value, right.value), node);
|
| }
|
| @@ -432,7 +432,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| if (partString == null) return null;
|
| accumulator = new DartString.concat(accumulator, partString.value);
|
| };
|
| - handler.registerStringInstance();
|
| + handler.registerStringInstance(elements);
|
| return constantSystem.createString(accumulator, node);
|
| }
|
|
|
| @@ -444,7 +444,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| // constant emitter will generate a call to the createRuntimeType
|
| // helper so we register a use of that.
|
| handler.registerCreateRuntimeTypeFunction();
|
| - handler.registerCompileTimeConstant(constant);
|
| + handler.registerCompileTimeConstant(constant, elements);
|
| return constant;
|
| }
|
|
|
| @@ -454,7 +454,7 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| if (send.isPropertyAccess) {
|
| if (Elements.isStaticOrTopLevelFunction(element)) {
|
| Constant constant = new FunctionConstant(element);
|
| - handler.registerCompileTimeConstant(constant);
|
| + handler.registerCompileTimeConstant(constant, elements);
|
| return constant;
|
| } else if (Elements.isStaticOrTopLevelField(element)) {
|
| Constant result;
|
| @@ -660,12 +660,12 @@ class CompileTimeConstantEvaluator extends Visitor {
|
| evaluator.evaluateConstructorFieldValues(arguments);
|
| List<Constant> jsNewArguments = evaluator.buildJsNewArguments(classElement);
|
|
|
| - handler.registerInstantiatedClass(classElement);
|
| + handler.registerInstantiatedClass(classElement, elements);
|
| // TODO(floitsch): take generic types into account.
|
| classElement.computeType(compiler);
|
| DartType type = classElement.rawType;
|
| Constant constant = new ConstructedConstant(type, jsNewArguments);
|
| - handler.registerCompileTimeConstant(constant);
|
| + handler.registerCompileTimeConstant(constant, elements);
|
| return constant;
|
| }
|
|
|
|
|