Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Side by Side Diff: pkg/compiler/lib/src/constants/expressions.dart

Issue 2813093002: Remove BackendClasses and JavaScriptBackendClasses. (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '../common_elements.dart'; 9 import '../common_elements.dart';
10 import '../elements/types.dart'; 10 import '../elements/types.dart';
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 @override 475 @override
476 ConstantValue evaluate( 476 ConstantValue evaluate(
477 Environment environment, ConstantSystem constantSystem) { 477 Environment environment, ConstantSystem constantSystem) {
478 Map<ConstantValue, ConstantValue> valueMap = 478 Map<ConstantValue, ConstantValue> valueMap =
479 <ConstantValue, ConstantValue>{}; 479 <ConstantValue, ConstantValue>{};
480 for (int index = 0; index < keys.length; index++) { 480 for (int index = 0; index < keys.length; index++) {
481 ConstantValue key = keys[index].evaluate(environment, constantSystem); 481 ConstantValue key = keys[index].evaluate(environment, constantSystem);
482 ConstantValue value = values[index].evaluate(environment, constantSystem); 482 ConstantValue value = values[index].evaluate(environment, constantSystem);
483 valueMap[key] = value; 483 valueMap[key] = value;
484 } 484 }
485 return constantSystem.createMap( 485 return constantSystem.createMap(environment.commonElements, type,
486 environment.commonElements, 486 valueMap.keys.toList(), valueMap.values.toList());
487 environment.backendClasses,
488 type,
489 valueMap.keys.toList(),
490 valueMap.values.toList());
491 } 487 }
492 488
493 ConstantExpression apply(NormalizedArguments arguments) { 489 ConstantExpression apply(NormalizedArguments arguments) {
494 return new MapConstantExpression( 490 return new MapConstantExpression(
495 type, 491 type,
496 keys.map((k) => k.apply(arguments)).toList(), 492 keys.map((k) => k.apply(arguments)).toList(),
497 values.map((v) => v.apply(arguments)).toList()); 493 values.map((v) => v.apply(arguments)).toList());
498 } 494 }
499 495
500 @override 496 @override
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 int _computeHashCode() => 13 * name.hashCode; 727 int _computeHashCode() => 13 * name.hashCode;
732 728
733 @override 729 @override
734 bool _equals(SymbolConstantExpression other) { 730 bool _equals(SymbolConstantExpression other) {
735 return name == other.name; 731 return name == other.name;
736 } 732 }
737 733
738 @override 734 @override
739 ConstantValue evaluate( 735 ConstantValue evaluate(
740 Environment environment, ConstantSystem constantSystem) { 736 Environment environment, ConstantSystem constantSystem) {
741 return constantSystem.createSymbol( 737 return constantSystem.createSymbol(environment.commonElements, name);
742 environment.commonElements, environment.backendClasses, name);
743 } 738 }
744 739
745 @override 740 @override
746 InterfaceType getKnownType(CommonElements commonElements) => 741 InterfaceType getKnownType(CommonElements commonElements) =>
747 commonElements.symbolType; 742 commonElements.symbolType;
748 } 743 }
749 744
750 /// Type literal. 745 /// Type literal.
751 class TypeConstantExpression extends ConstantExpression { 746 class TypeConstantExpression extends ConstantExpression {
752 /// Either [DynamicType] or a raw [GenericType]. 747 /// Either [DynamicType] or a raw [GenericType].
(...skipping 14 matching lines...) Expand all
767 } 762 }
768 763
769 @override 764 @override
770 void _createStructuredText(StringBuffer sb) { 765 void _createStructuredText(StringBuffer sb) {
771 sb.write('Type(type=$type)'); 766 sb.write('Type(type=$type)');
772 } 767 }
773 768
774 @override 769 @override
775 ConstantValue evaluate( 770 ConstantValue evaluate(
776 Environment environment, ConstantSystem constantSystem) { 771 Environment environment, ConstantSystem constantSystem) {
777 return constantSystem.createType( 772 return constantSystem.createType(environment.commonElements, type);
778 environment.commonElements, environment.backendClasses, type);
779 } 773 }
780 774
781 @override 775 @override
782 int _computeHashCode() => 13 * type.hashCode; 776 int _computeHashCode() => 13 * type.hashCode;
783 777
784 @override 778 @override
785 bool _equals(TypeConstantExpression other) { 779 bool _equals(TypeConstantExpression other) {
786 return type == other.type; 780 return type == other.type;
787 } 781 }
788 782
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 visit(exp.name); 1936 visit(exp.name);
1943 if (exp.defaultValue != null) { 1937 if (exp.defaultValue != null) {
1944 sb.write(', defaultValue: '); 1938 sb.write(', defaultValue: ');
1945 visit(exp.defaultValue); 1939 visit(exp.defaultValue);
1946 } 1940 }
1947 sb.write(')'); 1941 sb.write(')');
1948 } 1942 }
1949 1943
1950 String toString() => sb.toString(); 1944 String toString() => sb.toString();
1951 } 1945 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/constants/evaluation.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698