| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.constants.expressions; | 5 library dart2js.constants.expressions; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; |
| 9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 int _computeHashCode() => 13 * name.hashCode; | 673 int _computeHashCode() => 13 * name.hashCode; |
| 674 | 674 |
| 675 @override | 675 @override |
| 676 bool _equals(SymbolConstantExpression other) { | 676 bool _equals(SymbolConstantExpression other) { |
| 677 return name == other.name; | 677 return name == other.name; |
| 678 } | 678 } |
| 679 | 679 |
| 680 @override | 680 @override |
| 681 ConstantValue evaluate( | 681 ConstantValue evaluate( |
| 682 Environment environment, ConstantSystem constantSystem) { | 682 Environment environment, ConstantSystem constantSystem) { |
| 683 // TODO(johnniwinther): Implement this. | 683 return constantSystem.createSymbol(environment.compiler, name); |
| 684 throw new UnsupportedError('SymbolConstantExpression.evaluate'); | |
| 685 } | 684 } |
| 686 | 685 |
| 687 @override | 686 @override |
| 688 DartType getKnownType(CoreTypes coreTypes) => coreTypes.symbolType; | 687 DartType getKnownType(CoreTypes coreTypes) => coreTypes.symbolType; |
| 689 } | 688 } |
| 690 | 689 |
| 691 /// Type literal. | 690 /// Type literal. |
| 692 class TypeConstantExpression extends ConstantExpression { | 691 class TypeConstantExpression extends ConstantExpression { |
| 693 /// Either [DynamicType] or a raw [GenericType]. | 692 /// Either [DynamicType] or a raw [GenericType]. |
| 694 final DartType type; | 693 final DartType type; |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 @override | 1430 @override |
| 1432 void _createStructuredText(StringBuffer sb) { | 1431 void _createStructuredText(StringBuffer sb) { |
| 1433 sb.write('Deferred(prefix=$prefix,expression='); | 1432 sb.write('Deferred(prefix=$prefix,expression='); |
| 1434 expression._createStructuredText(sb); | 1433 expression._createStructuredText(sb); |
| 1435 sb.write(')'); | 1434 sb.write(')'); |
| 1436 } | 1435 } |
| 1437 | 1436 |
| 1438 @override | 1437 @override |
| 1439 ConstantValue evaluate( | 1438 ConstantValue evaluate( |
| 1440 Environment environment, ConstantSystem constantSystem) { | 1439 Environment environment, ConstantSystem constantSystem) { |
| 1441 return expression.evaluate(environment, constantSystem); | 1440 return new DeferredConstantValue( |
| 1441 expression.evaluate(environment, constantSystem), |
| 1442 prefix); |
| 1442 } | 1443 } |
| 1443 | 1444 |
| 1444 @override | 1445 @override |
| 1445 int _computeHashCode() { | 1446 int _computeHashCode() { |
| 1446 return 13 * expression.hashCode; | 1447 return 13 * expression.hashCode; |
| 1447 } | 1448 } |
| 1448 | 1449 |
| 1449 ConstantExpression apply(NormalizedArguments arguments) { | 1450 ConstantExpression apply(NormalizedArguments arguments) { |
| 1450 return new DeferredConstantExpression(expression.apply(arguments), prefix); | 1451 return new DeferredConstantExpression(expression.apply(arguments), prefix); |
| 1451 } | 1452 } |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 visit(exp.name); | 1761 visit(exp.name); |
| 1761 if (exp.defaultValue != null) { | 1762 if (exp.defaultValue != null) { |
| 1762 sb.write(', defaultValue: '); | 1763 sb.write(', defaultValue: '); |
| 1763 visit(exp.defaultValue); | 1764 visit(exp.defaultValue); |
| 1764 } | 1765 } |
| 1765 sb.write(')'); | 1766 sb.write(')'); |
| 1766 } | 1767 } |
| 1767 | 1768 |
| 1768 String toString() => sb.toString(); | 1769 String toString() => sb.toString(); |
| 1769 } | 1770 } |
| OLD | NEW |