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

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

Issue 10870010: Evaluate compile-time constants of metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and use const instead of final Created 8 years, 4 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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 } 1124 }
1125 } 1125 }
1126 1126
1127 if (!foundSuperOrRedirect) { 1127 if (!foundSuperOrRedirect) {
1128 // No super initializer found. Try to find the default constructor if 1128 // No super initializer found. Try to find the default constructor if
1129 // the class is not Object. 1129 // the class is not Object.
1130 ClassElement enclosingClass = constructor.getEnclosingClass(); 1130 ClassElement enclosingClass = constructor.getEnclosingClass();
1131 ClassElement superClass = enclosingClass.superclass; 1131 ClassElement superClass = enclosingClass.superclass;
1132 if (enclosingClass != compiler.objectClass) { 1132 if (enclosingClass != compiler.objectClass) {
1133 assert(superClass !== null); 1133 assert(superClass !== null);
1134 assert(superClass.resolutionState == ClassElement.STATE_DONE); 1134 assert(superClass.resolutionState == STATE_DONE);
1135 FunctionElement targetConstructor = 1135 FunctionElement targetConstructor =
1136 superClass.lookupConstructor(superClass.name); 1136 superClass.lookupConstructor(superClass.name);
1137 if (targetConstructor === null) { 1137 if (targetConstructor === null) {
1138 compiler.internalError("no default constructor available", 1138 compiler.internalError("no default constructor available",
1139 node: functionNode); 1139 node: functionNode);
1140 } 1140 }
1141 1141
1142 Selector selector = new Selector.call(superClass.name, 1142 Selector selector = new Selector.call(superClass.name,
1143 enclosingClass.getLibrary(), 1143 enclosingClass.getLibrary(),
1144 0); 1144 0);
(...skipping 25 matching lines...) Expand all
1170 Constant fieldValue = fieldValues[field]; 1170 Constant fieldValue = fieldValues[field];
1171 if (fieldValue === null) { 1171 if (fieldValue === null) {
1172 // Use the default value. 1172 // Use the default value.
1173 fieldValue = compiler.compileVariable(field); 1173 fieldValue = compiler.compileVariable(field);
1174 } 1174 }
1175 jsNewArguments.add(fieldValue); 1175 jsNewArguments.add(fieldValue);
1176 }); 1176 });
1177 return jsNewArguments; 1177 return jsNewArguments;
1178 } 1178 }
1179 } 1179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698