| OLD | NEW |
| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 InterfaceType type = elements.getType(node); | 628 InterfaceType type = elements.getType(node); |
| 629 List<Constant> evaluateArguments(FunctionElement constructor) { | 629 List<Constant> evaluateArguments(FunctionElement constructor) { |
| 630 Selector selector = elements.getSelector(send); | 630 Selector selector = elements.getSelector(send); |
| 631 return evaluateArgumentsToConstructor( | 631 return evaluateArgumentsToConstructor( |
| 632 node, selector, send.arguments, constructor); | 632 node, selector, send.arguments, constructor); |
| 633 } | 633 } |
| 634 return makeConstructedConstant(node, type, constructor, evaluateArguments); | 634 return makeConstructedConstant(node, type, constructor, evaluateArguments); |
| 635 } | 635 } |
| 636 | 636 |
| 637 Constant makeConstructedConstant( | 637 Constant makeConstructedConstant( |
| 638 Node node, InterfaceType type, FunctionElement constructor, | 638 Spannable node, InterfaceType type, FunctionElement constructor, |
| 639 List<Constant> getArguments(FunctionElement constructor)) { | 639 List<Constant> getArguments(FunctionElement constructor)) { |
| 640 if (constructor.isRedirectingFactory) { | 640 if (constructor.isRedirectingFactory) { |
| 641 type = constructor.computeTargetType(compiler, type); | 641 type = constructor.computeTargetType(compiler, type); |
| 642 } | 642 } |
| 643 | 643 |
| 644 // The redirection chain of this element may not have been resolved through | 644 // The redirection chain of this element may not have been resolved through |
| 645 // a post-process action, so we have to make sure it is done here. | 645 // a post-process action, so we have to make sure it is done here. |
| 646 compiler.resolver.resolveRedirectionChain(constructor, node); | 646 compiler.resolver.resolveRedirectionChain(constructor, node); |
| 647 constructor = constructor.redirectionTarget; | 647 constructor = constructor.redirectionTarget; |
| 648 ClassElement classElement = constructor.getEnclosingClass(); | 648 ClassElement classElement = constructor.getEnclosingClass(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 if (fieldValue == null) { | 878 if (fieldValue == null) { |
| 879 // Use the default value. | 879 // Use the default value. |
| 880 fieldValue = handler.compileConstant(field); | 880 fieldValue = handler.compileConstant(field); |
| 881 } | 881 } |
| 882 jsNewArguments.add(fieldValue); | 882 jsNewArguments.add(fieldValue); |
| 883 }, | 883 }, |
| 884 includeSuperAndInjectedMembers: true); | 884 includeSuperAndInjectedMembers: true); |
| 885 return jsNewArguments; | 885 return jsNewArguments; |
| 886 } | 886 } |
| 887 } | 887 } |
| OLD | NEW |