Chromium Code Reviews| 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; |