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 6c324d898e1b3b6f195660e20a5192579e1eccfc..cca5f7b06477020bf2f21580b9c850083414f057 100644 |
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
@@ -624,12 +624,13 @@ class IrBuilder { |
ir.Primitive _buildInvokeSuper(Element target, |
Selector selector, |
- List<ir.Primitive> arguments) { |
+ List<ir.Primitive> arguments, |
+ SourceInformation sourceInformation) { |
assert(target.isInstanceMember); |
assert(isOpen); |
return _continueWithExpression( |
(k) => new ir.InvokeMethodDirectly( |
- buildThis(), target, selector, arguments, k)); |
+ buildThis(), target, selector, arguments, k, sourceInformation)); |
} |
ir.Primitive _buildInvokeDynamic(ir.Primitive receiver, |
@@ -655,9 +656,11 @@ class IrBuilder { |
/// Create a [ir.Constant] from [value] and add it to the CPS term. |
- ir.Constant buildConstant(ConstantValue value) { |
+ ir.Constant buildConstant(ConstantValue value, |
+ {SourceInformation sourceInformation}) { |
assert(isOpen); |
- return addPrimitive(new ir.Constant(value)); |
+ return addPrimitive( |
+ new ir.Constant(value, sourceInformation: sourceInformation)); |
} |
/// Create an integer constant and add it to the CPS term. |
@@ -793,63 +796,74 @@ class IrBuilder { |
/// Create a invocation of the [method] on the super class where the call |
/// structure is defined [callStructure] and the argument values are defined |
/// by [arguments]. |
- ir.Primitive buildSuperMethodInvocation(MethodElement method, |
- CallStructure callStructure, |
- List<ir.Primitive> arguments) { |
+ ir.Primitive buildSuperMethodInvocation( |
+ MethodElement method, |
+ CallStructure callStructure, |
+ List<ir.Primitive> arguments, |
+ {SourceInformation sourceInformation}) { |
// TODO(johnniwinther): This shouldn't be necessary. |
SelectorKind kind = Elements.isOperatorName(method.name) |
? SelectorKind.OPERATOR : SelectorKind.CALL; |
Selector selector = |
new Selector(kind, method.memberName, callStructure); |
- return _buildInvokeSuper(method, selector, arguments); |
+ return _buildInvokeSuper(method, selector, arguments, sourceInformation); |
} |
/// Create a read access of the [method] on the super class, i.e. a |
/// closurization of [method]. |
- ir.Primitive buildSuperMethodGet(MethodElement method) { |
+ ir.Primitive buildSuperMethodGet(MethodElement method, |
+ {SourceInformation sourceInformation}) { |
// TODO(johnniwinther): This should have its own ir node. |
return _buildInvokeSuper( |
method, |
new Selector.getter(method.name, method.library), |
- const <ir.Primitive>[]); |
+ const <ir.Primitive>[], |
+ sourceInformation); |
} |
/// Create a getter invocation of the [getter] on the super class. |
- ir.Primitive buildSuperGetterGet(MethodElement getter) { |
+ ir.Primitive buildSuperGetterGet(MethodElement getter, |
+ SourceInformation sourceInformation) { |
// TODO(johnniwinther): This should have its own ir node. |
return _buildInvokeSuper( |
getter, |
new Selector.getter(getter.name, getter.library), |
- const <ir.Primitive>[]); |
+ const <ir.Primitive>[], |
+ sourceInformation); |
} |
/// Create an setter invocation of the [setter] on the super class with |
/// [value]. |
ir.Primitive buildSuperSetterSet(MethodElement setter, |
- ir.Primitive value) { |
+ ir.Primitive value, |
+ {SourceInformation sourceInformation}) { |
// TODO(johnniwinther): This should have its own ir node. |
_buildInvokeSuper( |
setter, |
new Selector.setter(setter.name, setter.library), |
- <ir.Primitive>[value]); |
+ <ir.Primitive>[value], |
+ sourceInformation); |
return value; |
} |
/// Create an invocation of the index [method] on the super class with |
/// the provided [index]. |
ir.Primitive buildSuperIndex(MethodElement method, |
- ir.Primitive index) { |
+ ir.Primitive index, |
+ {SourceInformation sourceInformation}) { |
return _buildInvokeSuper( |
- method, new Selector.index(), <ir.Primitive>[index]); |
+ method, new Selector.index(), <ir.Primitive>[index], |
+ sourceInformation); |
} |
/// Create an invocation of the index set [method] on the super class with |
/// the provided [index] and [value]. |
ir.Primitive buildSuperIndexSet(MethodElement method, |
ir.Primitive index, |
- ir.Primitive value) { |
+ ir.Primitive value, |
+ {SourceInformation sourceInformation}) { |
_buildInvokeSuper(method, new Selector.indexSet(), |
- <ir.Primitive>[index, value]); |
+ <ir.Primitive>[index, value], sourceInformation); |
return value; |
} |
@@ -859,8 +873,11 @@ class IrBuilder { |
ir.Primitive buildDynamicInvocation(ir.Primitive receiver, |
Selector selector, |
TypeMask mask, |
- List<ir.Primitive> arguments) { |
- return _buildInvokeDynamic(receiver, selector, mask, arguments); |
+ List<ir.Primitive> arguments, |
+ {SourceInformation sourceInformation}) { |
+ return _buildInvokeDynamic( |
+ receiver, selector, mask, arguments, |
+ sourceInformation: sourceInformation); |
} |
/// Create a dynamic getter invocation on [receiver] where the getter name is |
@@ -925,11 +942,14 @@ class IrBuilder { |
/// Create an invocation of the the [local] variable or parameter where |
/// argument structure is defined by [callStructure] and the argument values |
/// are defined by [arguments]. |
- ir.Primitive buildLocalVariableInvocation(LocalVariableElement local, |
- CallStructure callStructure, |
- List<ir.Primitive> arguments) { |
+ ir.Primitive buildLocalVariableInvocation( |
+ LocalVariableElement local, |
+ CallStructure callStructure, |
+ List<ir.Primitive> arguments, |
+ {SourceInformation callSourceInformation}) { |
return buildCallInvocation( |
- buildLocalVariableGet(local), callStructure, arguments); |
+ buildLocalVariableGet(local), callStructure, arguments, |
+ sourceInformation: callSourceInformation); |
} |
/// Create an invocation of the local [function] where argument structure is |
@@ -938,10 +958,12 @@ class IrBuilder { |
ir.Primitive buildLocalFunctionInvocation( |
LocalFunctionElement function, |
CallStructure callStructure, |
- List<ir.Primitive> arguments) { |
+ List<ir.Primitive> arguments, |
+ SourceInformation sourceInformation) { |
// TODO(johnniwinther): Maybe this should have its own ir node. |
return buildCallInvocation( |
- buildLocalFunctionGet(function), callStructure, arguments); |
+ buildLocalFunctionGet(function), callStructure, arguments, |
+ sourceInformation: sourceInformation); |
} |
/// Create a static invocation of [function] where argument structure is |
@@ -974,7 +996,7 @@ class IrBuilder { |
/// Create a getter invocation of the static [getter]. |
ir.Primitive buildStaticGetterGet(MethodElement getter, |
- {SourceInformation sourceInformation}) { |
+ SourceInformation sourceInformation) { |
Selector selector = new Selector.getter(getter.name, getter.library); |
return _buildInvokeStatic( |
getter, selector, const <ir.Primitive>[], sourceInformation); |
@@ -1958,7 +1980,7 @@ class IrBuilder { |
IrBuilder builder = makeDelimitedBuilder(newReturn.environment); |
ir.Primitive value = builder.environment.discard(1); |
buildFinallyBlock(builder); |
- if (builder.isOpen) builder.buildReturn(value); |
+ if (builder.isOpen) builder.buildReturn(value: value); |
newReturn.continuation.body = builder._root; |
exits.add(newReturn.continuation); |
} |
@@ -1973,7 +1995,7 @@ class IrBuilder { |
/// Create a return statement `return value;` or `return;` if [value] is |
/// null. |
- void buildReturn([ir.Primitive value]) { |
+ void buildReturn({ir.Primitive value, SourceInformation sourceInformation}) { |
// Build(Return(e), C) = C'[InvokeContinuation(return, x)] |
// where (C', x) = Build(e, C) |
// |
@@ -1983,7 +2005,8 @@ class IrBuilder { |
value = buildNullConstant(); |
} |
if (state.returnCollector == null) { |
- add(new ir.InvokeContinuation(state.returnContinuation, [value])); |
+ add(new ir.InvokeContinuation(state.returnContinuation, [value], |
+ sourceInformation: sourceInformation)); |
_current = null; |
} else { |
// Inside the try block of try/finally, all returns go to a join-point |
@@ -2305,12 +2328,15 @@ class IrBuilder { |
/// Add [functionElement] to the environment with provided [definition]. |
void declareLocalFunction(LocalFunctionElement functionElement, |
- ClosureClassElement classElement) { |
- ir.Primitive closure = buildFunctionExpression(classElement); |
+ ClosureClassElement classElement, |
+ SourceInformation sourceInformation) { |
+ ir.Primitive closure = |
+ buildFunctionExpression(classElement, sourceInformation); |
declareLocalVariable(functionElement, initialValue: closure); |
} |
- ir.Primitive buildFunctionExpression(ClosureClassElement classElement) { |
+ ir.Primitive buildFunctionExpression(ClosureClassElement classElement, |
+ SourceInformation sourceInformation) { |
List<ir.Primitive> arguments = <ir.Primitive>[]; |
for (ClosureFieldElement field in classElement.closureFields) { |
// Captured 'this' is not available as a local in the current environment, |
@@ -2320,8 +2346,8 @@ class IrBuilder { |
: environment.lookup(field.local); |
arguments.add(value); |
} |
- return addPrimitive( |
- new ir.CreateInstance(classElement, arguments, const <ir.Primitive>[])); |
+ return addPrimitive(new ir.CreateInstance( |
+ classElement, arguments, const <ir.Primitive>[], sourceInformation)); |
} |
/// Create a read access of [local] variable or parameter. |
@@ -2430,13 +2456,14 @@ class IrBuilder { |
ir.Primitive buildInvokeDirectly(FunctionElement target, |
ir.Primitive receiver, |
- List<ir.Primitive> arguments) { |
+ List<ir.Primitive> arguments, |
+ {SourceInformation sourceInformation}) { |
assert(isOpen); |
Selector selector = |
new Selector.call(target.name, target.library, arguments.length); |
return _continueWithExpression( |
(k) => new ir.InvokeMethodDirectly( |
- receiver, target, selector, arguments, k)); |
+ receiver, target, selector, arguments, k, sourceInformation)); |
} |
/// Loads parameters to a constructor body into the environment. |
@@ -2459,10 +2486,12 @@ class IrBuilder { |
/// Create a constructor invocation of [element] on [type] where the |
/// constructor name and argument structure are defined by [callStructure] and |
/// the argument values are defined by [arguments]. |
- ir.Primitive buildConstructorInvocation(ConstructorElement element, |
- CallStructure callStructure, |
- DartType type, |
- List<ir.Primitive> arguments) { |
+ ir.Primitive buildConstructorInvocation( |
+ ConstructorElement element, |
+ CallStructure callStructure, |
+ DartType type, |
+ List<ir.Primitive> arguments, |
+ SourceInformation sourceInformation) { |
assert(isOpen); |
Selector selector = |
new Selector(SelectorKind.CALL, element.memberName, callStructure); |
@@ -2479,8 +2508,8 @@ class IrBuilder { |
..addAll(typeArguments); |
} |
return _continueWithExpression( |
- (k) => new ir.InvokeConstructor(type, element, selector, |
- arguments, k)); |
+ (k) => new ir.InvokeConstructor( |
+ type, element, selector, arguments, k, sourceInformation)); |
} |
ir.Primitive buildTypeExpression(DartType type) { |
@@ -2508,7 +2537,8 @@ class IrBuilder { |
/// 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.Primitive buildTypeVariableAccess(TypeVariableType variable, |
+ {SourceInformation sourceInformation}) { |
// If the local exists in the environment, use that. |
// This is put here when we are inside a constructor or field initializer, |
// (or possibly a closure inside one of these). |
@@ -2520,7 +2550,8 @@ class IrBuilder { |
// If the type variable is not in a local, read its value from the |
// receiver object. |
ir.Primitive target = buildThis(); |
- return addPrimitive(new ir.ReadTypeVariable(variable, target)); |
+ return addPrimitive( |
+ new ir.ReadTypeVariable(variable, target, sourceInformation)); |
} |
/// Make the given type variable accessible through the local environment |
@@ -2532,9 +2563,12 @@ class IrBuilder { |
} |
/// Reifies the value of [variable] on the current receiver object. |
- ir.Primitive buildReifyTypeVariable(TypeVariableType variable) { |
- ir.Primitive typeArgument = buildTypeVariableAccess(variable); |
- return addPrimitive(new ir.ReifyRuntimeType(typeArgument)); |
+ ir.Primitive buildReifyTypeVariable(TypeVariableType variable, |
+ SourceInformation sourceInformation) { |
+ ir.Primitive typeArgument = |
+ buildTypeVariableAccess(variable, sourceInformation: sourceInformation); |
+ return addPrimitive( |
+ new ir.ReifyRuntimeType(typeArgument, sourceInformation)); |
} |
ir.Primitive buildInvocationMirror(Selector selector, |