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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1134063002: dart2js cps: Introduce GetStatic/SetStatic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix SExpression parsing/unparsing Created 5 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../constants/constant_system.dart'; 7 import '../constants/constant_system.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../constants/values.dart' show PrimitiveConstantValue; 9 import '../constants/values.dart' show PrimitiveConstantValue;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 {SourceInformation sourceInformation}) { 1078 {SourceInformation sourceInformation}) {
1079 Selector selector = 1079 Selector selector =
1080 new Selector(SelectorKind.CALL, function.memberName, callStructure); 1080 new Selector(SelectorKind.CALL, function.memberName, callStructure);
1081 return _buildInvokeStatic( 1081 return _buildInvokeStatic(
1082 function, selector, arguments, sourceInformation); 1082 function, selector, arguments, sourceInformation);
1083 } 1083 }
1084 1084
1085 /// Create a read access of the static [field]. 1085 /// Create a read access of the static [field].
1086 ir.Primitive buildStaticFieldGet(FieldElement field, 1086 ir.Primitive buildStaticFieldGet(FieldElement field,
1087 {SourceInformation sourceInformation}) { 1087 {SourceInformation sourceInformation}) {
1088 Selector selector = new Selector.getter(field.name, field.library); 1088 return addPrimitive(new ir.GetStatic(field, sourceInformation));
1089 // TODO(karlklose,sigurdm): build different nodes for getters.
1090 return _buildInvokeStatic(
1091 field, selector, const <ir.Primitive>[], sourceInformation);
1092 } 1089 }
1093 1090
1094 /// Create a getter invocation of the static [getter]. 1091 /// Create a getter invocation of the static [getter].
1095 ir.Primitive buildStaticGetterGet(MethodElement getter, 1092 ir.Primitive buildStaticGetterGet(MethodElement getter,
1096 {SourceInformation sourceInformation}) { 1093 {SourceInformation sourceInformation}) {
1097 Selector selector = new Selector.getter(getter.name, getter.library); 1094 Selector selector = new Selector.getter(getter.name, getter.library);
1098 // TODO(karlklose,sigurdm): build different nodes for getters.
1099 return _buildInvokeStatic( 1095 return _buildInvokeStatic(
1100 getter, selector, const <ir.Primitive>[], sourceInformation); 1096 getter, selector, const <ir.Primitive>[], sourceInformation);
1101 } 1097 }
1102 1098
1103 /// Create a read access of the static [function], i.e. a closurization of 1099 /// Create a read access of the static [function], i.e. a closurization of
1104 /// [function]. 1100 /// [function].
1105 ir.Primitive buildStaticFunctionGet(MethodElement function, 1101 ir.Primitive buildStaticFunctionGet(MethodElement function,
1106 {SourceInformation sourceInformation}) { 1102 {SourceInformation sourceInformation}) {
1107 Selector selector = 1103 return addPrimitive(new ir.GetStatic(function, sourceInformation));
1108 new Selector.getter(function.name, function.library);
1109 // TODO(karlklose,sigurdm): build different nodes for getters.
1110 return _buildInvokeStatic(
1111 function, selector, const <ir.Primitive>[], sourceInformation);
1112 } 1104 }
1113 1105
1114 /// Create a write access to the static [field] with the [value]. 1106 /// Create a write access to the static [field] with the [value].
1115 ir.Primitive buildStaticFieldSet(FieldElement field, 1107 ir.Primitive buildStaticFieldSet(FieldElement field,
1116 ir.Primitive value, 1108 ir.Primitive value,
1117 {SourceInformation sourceInformation}) { 1109 {SourceInformation sourceInformation}) {
1118 Selector selector = new Selector.setter(field.name, field.library); 1110 add(new ir.SetStatic(field, value, sourceInformation));
1119 // TODO(karlklose,sigurdm): build different nodes for setters.
1120 _buildInvokeStatic(
1121 field, selector, <ir.Primitive>[value], sourceInformation);
1122 return value; 1111 return value;
1123 } 1112 }
1124 1113
1125 /// Create a setter invocation of the static [setter] with the [value]. 1114 /// Create a setter invocation of the static [setter] with the [value].
1126 ir.Primitive buildStaticSetterSet(MethodElement setter, 1115 ir.Primitive buildStaticSetterSet(MethodElement setter,
1127 ir.Primitive value, 1116 ir.Primitive value,
1128 {SourceInformation sourceInformation}) { 1117 {SourceInformation sourceInformation}) {
1129 Selector selector = new Selector.setter(setter.name, setter.library); 1118 Selector selector = new Selector.setter(setter.name, setter.library);
1130 // TODO(karlklose,sigurdm): build different nodes for setters.
1131 _buildInvokeStatic( 1119 _buildInvokeStatic(
1132 setter, selector, <ir.Primitive>[value], sourceInformation); 1120 setter, selector, <ir.Primitive>[value], sourceInformation);
1133 return value; 1121 return value;
1134 } 1122 }
1135 1123
1136 /// Create an erroneous invocation where argument structure is defined by 1124 /// Create an erroneous invocation where argument structure is defined by
1137 /// [selector] and the argument values are defined by [arguments]. 1125 /// [selector] and the argument values are defined by [arguments].
1138 // TODO(johnniwinther): Make this more fine-grained. 1126 // TODO(johnniwinther): Make this more fine-grained.
1139 ir.Primitive buildErroneousInvocation( 1127 ir.Primitive buildErroneousInvocation(
1140 Element element, 1128 Element element,
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 } 2721 }
2734 2722
2735 /// Synthetic parameter to a JavaScript factory method that takes the type 2723 /// Synthetic parameter to a JavaScript factory method that takes the type
2736 /// argument given for the type variable [variable]. 2724 /// argument given for the type variable [variable].
2737 class TypeInformationParameter implements Local { 2725 class TypeInformationParameter implements Local {
2738 final TypeVariableElement variable; 2726 final TypeVariableElement variable;
2739 final ExecutableElement executableContext; 2727 final ExecutableElement executableContext;
2740 TypeInformationParameter(this.variable, this.executableContext); 2728 TypeInformationParameter(this.variable, this.executableContext);
2741 String get name => variable.name; 2729 String get name => variable.name;
2742 } 2730 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/test/sexpr_data.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698