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 library dart2js.compile_time_constant_evaluator; | 5 library dart2js.compile_time_constant_evaluator; |
6 | 6 |
7 import 'constant_system_dart.dart'; | 7 import 'constant_system_dart.dart'; |
8 import 'constants/constant_system.dart'; | 8 import 'constants/constant_system.dart'; |
9 import 'constants/expressions.dart'; | 9 import 'constants/expressions.dart'; |
10 import 'constants/values.dart'; | 10 import 'constants/values.dart'; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 Link<Node> arguments, | 782 Link<Node> arguments, |
783 FunctionElement target, | 783 FunctionElement target, |
784 {AstConstant compileArgument(Node node)}) { | 784 {AstConstant compileArgument(Node node)}) { |
785 assert(invariant(node, target.isImplementation)); | 785 assert(invariant(node, target.isImplementation)); |
786 | 786 |
787 AstConstant compileDefaultValue(VariableElement element) { | 787 AstConstant compileDefaultValue(VariableElement element) { |
788 ConstantExpression constant = handler.compileConstant(element); | 788 ConstantExpression constant = handler.compileConstant(element); |
789 return new AstConstant.fromDefaultValue( | 789 return new AstConstant.fromDefaultValue( |
790 element, constant, handler.getConstantValue(constant)); | 790 element, constant, handler.getConstantValue(constant)); |
791 } | 791 } |
792 target.computeSignature(compiler); | 792 target.computeType(compiler); |
793 | 793 |
794 if (!callStructure.signatureApplies(target)) { | 794 if (!callStructure.signatureApplies(target)) { |
795 String name = Elements.constructorNameForDiagnostics( | 795 String name = Elements.constructorNameForDiagnostics( |
796 target.enclosingClass.name, target.name); | 796 target.enclosingClass.name, target.name); |
797 compiler.reportError( | 797 compiler.reportError( |
798 node, | 798 node, |
799 MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS, | 799 MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS, |
800 {'constructorName': name}); | 800 {'constructorName': name}); |
801 | 801 |
802 return new List<AstConstant>.filled( | 802 return new List<AstConstant>.filled( |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // TODO(johnniwinther): Return a [NonConstantValue] instead. | 1331 // TODO(johnniwinther): Return a [NonConstantValue] instead. |
1332 new ErroneousConstantExpression(), new NullConstantValue()); | 1332 new ErroneousConstantExpression(), new NullConstantValue()); |
1333 } | 1333 } |
1334 | 1334 |
1335 // TODO(johnniwinther): Avoid the need for this hack. | 1335 // TODO(johnniwinther): Avoid the need for this hack. |
1336 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { | 1336 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { |
1337 WorldImpact worldImpact = compiler.analyzeElement(element.declaration); | 1337 WorldImpact worldImpact = compiler.analyzeElement(element.declaration); |
1338 compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact); | 1338 compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact); |
1339 return element.resolvedAst.elements; | 1339 return element.resolvedAst.elements; |
1340 } | 1340 } |
OLD | NEW |