| 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 'common/resolution.dart' show Resolution; | 7 import 'common/resolution.dart' show Resolution; |
| 8 import 'common/tasks.dart' show CompilerTask, Measurer; | 8 import 'common/tasks.dart' show CompilerTask, Measurer; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 630 } |
| 631 return signalNotCompileTimeConstant(node); | 631 return signalNotCompileTimeConstant(node); |
| 632 } | 632 } |
| 633 | 633 |
| 634 // TODO(floitsch): provide better error-messages. | 634 // TODO(floitsch): provide better error-messages. |
| 635 AstConstant visitSend(Send send) { | 635 AstConstant visitSend(Send send) { |
| 636 Element element = elements[send]; | 636 Element element = elements[send]; |
| 637 if (send.isPropertyAccess) { | 637 if (send.isPropertyAccess) { |
| 638 AstConstant result; | 638 AstConstant result; |
| 639 if (Elements.isStaticOrTopLevelFunction(element)) { | 639 if (Elements.isStaticOrTopLevelFunction(element)) { |
| 640 FunctionElement function = element; | 640 MethodElement function = element; |
| 641 function.computeType(resolution); | 641 function.computeType(resolution); |
| 642 result = new AstConstant( | 642 result = new AstConstant( |
| 643 context, | 643 context, |
| 644 send, | 644 send, |
| 645 new FunctionConstantExpression(function), | 645 new FunctionConstantExpression(function), |
| 646 new FunctionConstantValue(function)); | 646 new FunctionConstantValue(function, function.type)); |
| 647 } else if (Elements.isStaticOrTopLevelField(element)) { | 647 } else if (Elements.isStaticOrTopLevelField(element)) { |
| 648 ConstantExpression elementExpression; | 648 ConstantExpression elementExpression; |
| 649 if (element.isConst) { | 649 if (element.isConst) { |
| 650 elementExpression = handler.compileConstant(element); | 650 elementExpression = handler.compileConstant(element); |
| 651 } else if (element.isFinal && !isEvaluatingConstant) { | 651 } else if (element.isFinal && !isEvaluatingConstant) { |
| 652 elementExpression = handler.compileVariable(element); | 652 elementExpression = handler.compileVariable(element); |
| 653 } | 653 } |
| 654 if (elementExpression != null) { | 654 if (elementExpression != null) { |
| 655 result = new AstConstant( | 655 result = new AstConstant( |
| 656 context, | 656 context, |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 class _CompilerEnvironment implements Environment { | 1443 class _CompilerEnvironment implements Environment { |
| 1444 final Compiler compiler; | 1444 final Compiler compiler; |
| 1445 | 1445 |
| 1446 _CompilerEnvironment(this.compiler); | 1446 _CompilerEnvironment(this.compiler); |
| 1447 | 1447 |
| 1448 @override | 1448 @override |
| 1449 String readFromEnvironment(String name) { | 1449 String readFromEnvironment(String name) { |
| 1450 return compiler.fromEnvironment(name); | 1450 return compiler.fromEnvironment(name); |
| 1451 } | 1451 } |
| 1452 } | 1452 } |
| OLD | NEW |