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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1130813002: dart2js cps: Handle error cases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Whitelist unused API due to semantic visitor being WIP 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index d511047e94cea2655050a253f9616fc0f995083e..e4dddbead46e807cb6902c856fe8c0cef128f74a 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -457,6 +457,9 @@ abstract class IrBuilder {
void _createFunctionParameter(Local parameterElement);
void _createThisParameter();
+ /// Reifies the value of [variable] on the current receiver object.
+ ir.Primitive buildReifyTypeVariable(TypeVariableType variable);
+
/// Creates an access to the receiver from the current (or enclosing) method.
///
/// If inside a closure class, [buildThis] will redirect access through
@@ -2258,6 +2261,11 @@ class DartIrBuilder extends IrBuilder {
(k) => new ir.InvokeConstructor(type, element, selector,
arguments, k));
}
+
+ @override
+ ir.Primitive buildReifyTypeVariable(TypeVariableType variable) {
+ return addPrimitive(new ir.ReifyTypeVar(variable.element));
+ }
}
/// State shared between JsIrBuilders within the same function.
@@ -2485,6 +2493,7 @@ class JsIrBuilder extends IrBuilder {
ir.Primitive buildThis() {
if (jsState.receiver != null) return jsState.receiver;
+ assert(state.thisParameter != null);
return state.thisParameter;
}
@@ -2554,11 +2563,11 @@ class JsIrBuilder extends IrBuilder {
ir.Primitive buildTypeExpression(DartType type) {
if (type is TypeVariableType) {
- return buildTypeVariableAccess(buildThis(), type);
+ return buildTypeVariableAccess(type);
} else if (type is InterfaceType) {
List<ir.Primitive> arguments = <ir.Primitive>[];
type.forEachTypeVariable((TypeVariableType variable) {
- ir.Primitive value = buildTypeVariableAccess(buildThis(), variable);
+ ir.Primitive value = buildTypeVariableAccess(variable);
arguments.add(value);
});
return addPrimitive(new ir.TypeExpression(type, arguments));
@@ -2568,8 +2577,13 @@ class JsIrBuilder extends IrBuilder {
}
}
- ir.Primitive buildTypeVariableAccess(ir.Primitive target,
- TypeVariableType variable) {
+ /// Obtains the internal type representation of the type held in [variable].
+ ///
+ /// The value of [variable] is taken from the current receiver object, or
+ /// if we are currently building a constructor field initializer, from the
+ /// corresponding type argument (field initializers are evaluated before the
+ /// receiver object is created).
+ ir.Primitive buildTypeVariableAccess(TypeVariableType variable) {
ir.Parameter accessTypeArgumentParameter() {
for (int i = 0; i < environment.length; i++) {
Local local = environment.index2variable[i];
@@ -2584,9 +2598,21 @@ class JsIrBuilder extends IrBuilder {
if (jsState.inInitializers) {
return accessTypeArgumentParameter();
} else {
+ ir.Primitive target = buildThis();
return addPrimitive(new ir.ReadTypeVariable(variable, target));
}
}
+
+ @override
+ ir.Primitive buildReifyTypeVariable(TypeVariableType variable) {
+ ir.Primitive typeArgument = buildTypeVariableAccess(variable);
+ return addPrimitive(new ir.ReifyRuntimeType(typeArgument));
+ }
+
+ ir.Primitive buildInvocationMirror(Selector selector,
+ List<ir.Primitive> arguments) {
+ return addPrimitive(new ir.CreateInvocationMirror(selector, arguments));
+ }
}
« no previous file with comments | « no previous file | 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