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

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

Issue 10910088: Fix host-checked + checked by registering when a class is being instantiated, not when being proces… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 class Constant implements Hashable { 5 class Constant implements Hashable {
6 const Constant(); 6 const Constant();
7 7
8 bool isNull() => false; 8 bool isNull() => false;
9 bool isBool() => false; 9 bool isBool() => false;
10 bool isTrue() => false; 10 bool isTrue() => false;
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 DartType keysType = null; 910 DartType keysType = null;
911 ListConstant keysList = new ListConstant(keysType, keys); 911 ListConstant keysList = new ListConstant(keysType, keys);
912 compiler.constantHandler.registerCompileTimeConstant(keysList); 912 compiler.constantHandler.registerCompileTimeConstant(keysList);
913 SourceString className = hasProtoKey 913 SourceString className = hasProtoKey
914 ? MapConstant.DART_PROTO_CLASS 914 ? MapConstant.DART_PROTO_CLASS
915 : MapConstant.DART_CLASS; 915 : MapConstant.DART_CLASS;
916 ClassElement classElement = compiler.jsHelperLibrary.find(className); 916 ClassElement classElement = compiler.jsHelperLibrary.find(className);
917 classElement.ensureResolved(compiler); 917 classElement.ensureResolved(compiler);
918 // TODO(floitsch): copy over the generic type. 918 // TODO(floitsch): copy over the generic type.
919 DartType type = new InterfaceType(classElement); 919 DartType type = new InterfaceType(classElement);
920 compiler.registerInstantiatedClass(classElement); 920 compiler.enqueuer.codegen.registerInstantiatedClass(classElement);
921 Constant constant = new MapConstant(type, keysList, values, protoValue); 921 Constant constant = new MapConstant(type, keysList, values, protoValue);
922 compiler.constantHandler.registerCompileTimeConstant(constant); 922 compiler.constantHandler.registerCompileTimeConstant(constant);
923 return constant; 923 return constant;
924 } 924 }
925 925
926 Constant visitLiteralNull(LiteralNull node) { 926 Constant visitLiteralNull(LiteralNull node) {
927 return new NullConstant(); 927 return new NullConstant();
928 } 928 }
929 929
930 Constant visitLiteralString(LiteralString node) { 930 Constant visitLiteralString(LiteralString node) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 } 1141 }
1142 1142
1143 Selector selector = elements.getSelector(send); 1143 Selector selector = elements.getSelector(send);
1144 List<Constant> arguments = 1144 List<Constant> arguments =
1145 evaluateArgumentsToConstructor(selector, send.arguments, constructor); 1145 evaluateArgumentsToConstructor(selector, send.arguments, constructor);
1146 ConstructorEvaluator evaluator = 1146 ConstructorEvaluator evaluator =
1147 new ConstructorEvaluator(constructor, compiler); 1147 new ConstructorEvaluator(constructor, compiler);
1148 evaluator.evaluateConstructorFieldValues(arguments); 1148 evaluator.evaluateConstructorFieldValues(arguments);
1149 List<Constant> jsNewArguments = evaluator.buildJsNewArguments(classElement); 1149 List<Constant> jsNewArguments = evaluator.buildJsNewArguments(classElement);
1150 1150
1151 compiler.registerInstantiatedClass(classElement); 1151 compiler.enqueuer.codegen.registerInstantiatedClass(classElement);
1152 // TODO(floitsch): take generic types into account. 1152 // TODO(floitsch): take generic types into account.
1153 DartType type = classElement.computeType(compiler); 1153 DartType type = classElement.computeType(compiler);
1154 Constant constant = new ConstructedConstant(type, jsNewArguments); 1154 Constant constant = new ConstructedConstant(type, jsNewArguments);
1155 compiler.constantHandler.registerCompileTimeConstant(constant); 1155 compiler.constantHandler.registerCompileTimeConstant(constant);
1156 return constant; 1156 return constant;
1157 } 1157 }
1158 1158
1159 Constant visitParenthesizedExpression(ParenthesizedExpression node) { 1159 Constant visitParenthesizedExpression(ParenthesizedExpression node) {
1160 return node.expression.accept(this); 1160 return node.expression.accept(this);
1161 } 1161 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 Constant fieldValue = fieldValues[field]; 1328 Constant fieldValue = fieldValues[field];
1329 if (fieldValue === null) { 1329 if (fieldValue === null) {
1330 // Use the default value. 1330 // Use the default value.
1331 fieldValue = compiler.compileConstant(field); 1331 fieldValue = compiler.compileConstant(field);
1332 } 1332 }
1333 jsNewArguments.add(fieldValue); 1333 jsNewArguments.add(fieldValue);
1334 }); 1334 });
1335 return jsNewArguments; 1335 return jsNewArguments;
1336 } 1336 }
1337 } 1337 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/compiler.dart » ('j') | lib/compiler/implementation/enqueue.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698