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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 values[index]._createStructuredText(sb); | 477 values[index]._createStructuredText(sb); |
478 } | 478 } |
479 sb.write('])'); | 479 sb.write('])'); |
480 } | 480 } |
481 | 481 |
482 @override | 482 @override |
483 ConstantValue evaluate( | 483 ConstantValue evaluate( |
484 Environment environment, ConstantSystem constantSystem) { | 484 Environment environment, ConstantSystem constantSystem) { |
485 Map<ConstantValue, ConstantValue> valueMap = | 485 Map<ConstantValue, ConstantValue> valueMap = |
486 <ConstantValue, ConstantValue>{}; | 486 <ConstantValue, ConstantValue>{}; |
487 for (int index = 0; index < keys.length; index++) { | 487 for (int index = 0; index < keys.length; index++) { |
Johnni Winther
2016/07/04 13:40:36
dartfmt
| |
488 ConstantValue key = | 488 ConstantValue key = keys[index].evaluate(environment, constantSystem); |
489 keys[index].evaluate(environment, constantSystem); | 489 ConstantValue value = values[index].evaluate(environment, constantSystem); |
490 ConstantValue value = | |
491 values[index].evaluate(environment, constantSystem); | |
492 valueMap[key] = value; | 490 valueMap[key] = value; |
493 } | 491 } |
494 return constantSystem.createMap( | 492 return constantSystem.createMap(environment.compiler, type, |
495 environment.compiler, | 493 valueMap.keys.toList(), valueMap.values.toList()); |
496 type, | |
497 valueMap.keys.toList(), | |
498 valueMap.values.toList()); | |
499 } | 494 } |
500 | 495 |
501 ConstantExpression apply(NormalizedArguments arguments) { | 496 ConstantExpression apply(NormalizedArguments arguments) { |
502 return new MapConstantExpression( | 497 return new MapConstantExpression( |
503 type, | 498 type, |
504 keys.map((k) => k.apply(arguments)).toList(), | 499 keys.map((k) => k.apply(arguments)).toList(), |
505 values.map((v) => v.apply(arguments)).toList()); | 500 values.map((v) => v.apply(arguments)).toList()); |
506 } | 501 } |
507 | 502 |
508 @override | 503 @override |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1891 visit(exp.name); | 1886 visit(exp.name); |
1892 if (exp.defaultValue != null) { | 1887 if (exp.defaultValue != null) { |
1893 sb.write(', defaultValue: '); | 1888 sb.write(', defaultValue: '); |
1894 visit(exp.defaultValue); | 1889 visit(exp.defaultValue); |
1895 } | 1890 } |
1896 sb.write(')'); | 1891 sb.write(')'); |
1897 } | 1892 } |
1898 | 1893 |
1899 String toString() => sb.toString(); | 1894 String toString() => sb.toString(); |
1900 } | 1895 } |
OLD | NEW |