| 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 /// A [ConstantEnvironment] provides access for constants compiled for variable | 7 /// A [ConstantEnvironment] provides access for constants compiled for variable |
| 8 /// initializers. | 8 /// initializers. |
| 9 abstract class ConstantEnvironment { | 9 abstract class ConstantEnvironment { |
| 10 /// Returns the constant for the initializer of [element]. | 10 /// Returns the constant for the initializer of [element]. |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 Function compileArgument = evaluateConstant; | 623 Function compileArgument = evaluateConstant; |
| 624 Function compileConstant = handler.compileConstant; | 624 Function compileConstant = handler.compileConstant; |
| 625 bool succeeded = selector.addArgumentsToList(arguments, | 625 bool succeeded = selector.addArgumentsToList(arguments, |
| 626 compiledArguments, | 626 compiledArguments, |
| 627 target, | 627 target, |
| 628 compileArgument, | 628 compileArgument, |
| 629 compileConstant, | 629 compileConstant, |
| 630 compiler); | 630 compiler); |
| 631 if (!succeeded) { | 631 if (!succeeded) { |
| 632 String name = Elements.constructorNameForDiagnostics( |
| 633 target.enclosingClass.name, target.name); |
| 632 compiler.reportFatalError( | 634 compiler.reportFatalError( |
| 633 node, | 635 node, |
| 634 MessageKind.INVALID_ARGUMENTS, {'methodName': target.name}); | 636 MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS, |
| 637 {'constructorName': name}); |
| 635 } | 638 } |
| 636 return compiledArguments; | 639 return compiledArguments; |
| 637 } | 640 } |
| 638 | 641 |
| 639 Constant visitNewExpression(NewExpression node) { | 642 Constant visitNewExpression(NewExpression node) { |
| 640 if (!node.isConst) { | 643 if (!node.isConst) { |
| 641 return signalNotCompileTimeConstant(node); | 644 return signalNotCompileTimeConstant(node); |
| 642 } | 645 } |
| 643 | 646 |
| 644 Send send = node.send; | 647 Send send = node.send; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 if (fieldValue == null) { | 974 if (fieldValue == null) { |
| 972 // Use the default value. | 975 // Use the default value. |
| 973 fieldValue = handler.compileConstant(field); | 976 fieldValue = handler.compileConstant(field); |
| 974 } | 977 } |
| 975 jsNewArguments.add(fieldValue); | 978 jsNewArguments.add(fieldValue); |
| 976 }, | 979 }, |
| 977 includeSuperAndInjectedMembers: true); | 980 includeSuperAndInjectedMembers: true); |
| 978 return jsNewArguments; | 981 return jsNewArguments; |
| 979 } | 982 } |
| 980 } | 983 } |
| OLD | NEW |