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

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: 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') | tests/language/src/CompileTimeConstantHTest.dart » ('J')
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..c19fdaafce71e27de8ef8c2bee799a63f111220e 100644
--- a/frog/leg/compile_time_constants.dart
+++ b/frog/leg/compile_time_constants.dart
@@ -973,9 +973,13 @@ class CompileTimeConstantEvaluator extends AbstractVisitor {
if (!node.isConst()) error(node);
- // TODO(floitsch): get the type from somewhere.
FunctionElement constructor = elements[node.send];
+ compiler.resolver.resolveMethodElement(constructor);
+ constructor = constructor.defaultImplementation;
+
ClassElement classElement = constructor.enclosingElement;
+ // TODO(floitsch): get the type from somewhere.
ngeoffray 2012/03/18 13:56:04 Why is classElement.computeType(compiler) not suff
floitsch 2012/03/18 18:44:15 It doesn't take generic types into account. But be
+ Type type = new SimpleType(classElement.name, classElement);
TreeElements constructorElements =
compiler.resolver.resolveMethodElement(constructor);
ngeoffray 2012/03/18 13:56:04 You could avoid calling resolveMethodElement twice
floitsch 2012/03/18 18:44:15 Done.
FunctionExpression functionNode = constructor.parseNode(compiler);
@@ -1004,7 +1008,6 @@ class CompileTimeConstantEvaluator extends AbstractVisitor {
buildJsNewArguments(classElement, fieldValues);
compiler.registerInstantiatedClass(classElement);
- Type type = new SimpleType(classElement.name, classElement);
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') | tests/language/src/CompileTimeConstantHTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698