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

Unified Diff: frog/leg/compile_time_constants.dart

Issue 9717035: Handle compile-time constants to interfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/compile_time_constants.dart
diff --git a/frog/leg/compile_time_constants.dart b/frog/leg/compile_time_constants.dart
index f6994b40f7c8ff916c28a4b320ade3b8555d9008..32487beee10d13b3f08a33b29e2c7bc80905a1a3 100644
--- a/frog/leg/compile_time_constants.dart
+++ b/frog/leg/compile_time_constants.dart
@@ -973,11 +973,16 @@ class CompileTimeConstantEvaluator extends AbstractVisitor {
if (!node.isConst()) error(node);
- // TODO(floitsch): get the type from somewhere.
FunctionElement constructor = elements[node.send];
- ClassElement classElement = constructor.enclosingElement;
TreeElements constructorElements =
compiler.resolver.resolveMethodElement(constructor);
+ if (constructor != constructor.defaultImplementation) {
+ constructor = constructor.defaultImplementation;
+ constructorElements =
+ compiler.resolver.resolveMethodElement(constructor);
+ }
+
+ ClassElement classElement = constructor.enclosingElement;
FunctionExpression functionNode = constructor.parseNode(compiler);
NodeList initializerList = functionNode.initializers;
FunctionParameters parameters = constructor.computeParameters(compiler);
@@ -1004,7 +1009,8 @@ class CompileTimeConstantEvaluator extends AbstractVisitor {
buildJsNewArguments(classElement, fieldValues);
compiler.registerInstantiatedClass(classElement);
- Type type = new SimpleType(classElement.name, classElement);
+ // TODO(floitsch): take generic types into account.
+ Type type = classElement.computeType(compiler);
Constant constant = new ConstructedConstant(type, jsNewArguments);
constantHandler.registerCompileTimeConstant(constant);
return constant;
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698