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

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

Issue 26470006: Handle missing const constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | tests/language/missing_const_constructor_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return compiledArguments; 613 return compiledArguments;
614 } 614 }
615 615
616 Constant visitNewExpression(NewExpression node) { 616 Constant visitNewExpression(NewExpression node) {
617 if (!node.isConst()) { 617 if (!node.isConst()) {
618 return signalNotCompileTimeConstant(node); 618 return signalNotCompileTimeConstant(node);
619 } 619 }
620 620
621 Send send = node.send; 621 Send send = node.send;
622 FunctionElement constructor = elements[send]; 622 FunctionElement constructor = elements[send];
623 if (Elements.isUnresolved(constructor)) {
624 return signalNotCompileTimeConstant(node);
625 }
623 // TODO(ahe): This is nasty: we must eagerly analyze the 626 // TODO(ahe): This is nasty: we must eagerly analyze the
624 // constructor to ensure the redirectionTarget has been computed 627 // constructor to ensure the redirectionTarget has been computed
625 // correctly. Find a way to avoid this. 628 // correctly. Find a way to avoid this.
626 compiler.analyzeElement(constructor.declaration); 629 compiler.analyzeElement(constructor.declaration);
627 630
628 InterfaceType type = elements.getType(node); 631 InterfaceType type = elements.getType(node);
629 List<Constant> evaluateArguments(FunctionElement constructor) { 632 List<Constant> evaluateArguments(FunctionElement constructor) {
630 Selector selector = elements.getSelector(send); 633 Selector selector = elements.getSelector(send);
631 return evaluateArgumentsToConstructor( 634 return evaluateArgumentsToConstructor(
632 node, selector, send.arguments, constructor); 635 node, selector, send.arguments, constructor);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 if (fieldValue == null) { 881 if (fieldValue == null) {
879 // Use the default value. 882 // Use the default value.
880 fieldValue = handler.compileConstant(field); 883 fieldValue = handler.compileConstant(field);
881 } 884 }
882 jsNewArguments.add(fieldValue); 885 jsNewArguments.add(fieldValue);
883 }, 886 },
884 includeSuperAndInjectedMembers: true); 887 includeSuperAndInjectedMembers: true);
885 return jsNewArguments; 888 return jsNewArguments;
886 } 889 }
887 } 890 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/missing_const_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698