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

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

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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 | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.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_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index 2c4fa8edf7c115c5065b881114174ca169c2e5d5..37081b896368622a55aecf4f2252fc37bfa55cf4 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -660,7 +660,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return irBuilder.buildDynamicGet(
translateReceiver(receiver),
selector,
- elements.getTypeMask(node));
+ elements.getTypeMask(node),
+ sourceInformationBuilder.buildGet(node));
}
@override
@@ -673,7 +674,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return irBuilder.buildIfNotNullSend(
target,
nested(() => irBuilder.buildDynamicGet(
- target, selector, elements.getTypeMask(node))));
+ target, selector, elements.getTypeMask(node),
+ sourceInformationBuilder.buildGet(node))));
}
@override
@@ -881,7 +883,9 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
List<ir.Primitive> arguments = <ir.Primitive>[visit(index)];
arguments = normalizeDynamicArguments(selector.callStructure, arguments);
return irBuilder.buildDynamicInvocation(
- target, selector, elements.getTypeMask(node), arguments);
+ target, selector, elements.getTypeMask(node), arguments,
+ sourceInformation:
+ sourceInformationBuilder.buildCall(receiver, node.selector));
}
ir.Primitive translateSuperBinary(FunctionElement function,
@@ -966,7 +970,9 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
Selector selector = operator.selector;
ir.Primitive receiver = translateReceiver(expression);
return irBuilder.buildDynamicInvocation(
- receiver, selector, elements.getTypeMask(node), const []);
+ receiver, selector, elements.getTypeMask(node), const [],
+ sourceInformation: sourceInformationBuilder.buildCall(
+ expression, node));
}
@override
@@ -1249,10 +1255,10 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
ir.Primitive translateCompounds(
+ ast.SendSet node,
{ir.Primitive getValue(),
CompoundRhs rhs,
- void setValue(ir.Primitive value),
- TypeMask operatorTypeMask}) {
+ void setValue(ir.Primitive value)}) {
ir.Primitive value = getValue();
op.BinaryOperator operator = rhs.operator;
if (operator.kind == op.BinaryOperatorKind.IF_NULL) {
@@ -1276,9 +1282,13 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
List<ir.Primitive> arguments = <ir.Primitive>[rhsValue];
arguments = normalizeDynamicArguments(
operatorSelector.callStructure, arguments);
- ir.Primitive result =
- irBuilder.buildDynamicInvocation(
- value, operatorSelector, operatorTypeMask, arguments);
+ TypeMask operatorTypeMask =
+ elements.getOperatorTypeMaskInComplexSendSet(node);
+ SourceInformation operatorSourceInformation =
+ sourceInformationBuilder.buildCall(node, node.assignmentOperator);
+ ir.Primitive result = irBuilder.buildDynamicInvocation(
+ value, operatorSelector, operatorTypeMask, arguments,
+ sourceInformation: operatorSourceInformation);
setValue(result);
return rhs.kind == CompoundKind.POSTFIX ? value : result;
}
@@ -1373,13 +1383,13 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
CompoundRhs rhs,
arg) {
return translateCompounds(
+ node,
getValue: () {
return buildConstantExpression(constant,
sourceInformationBuilder.buildGet(node));
},
rhs: rhs,
- setValue: (value) {}, // The binary operator will throw before this.
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ setValue: (value) {}); // The binary operator will throw before this.
}
@override
@@ -1393,16 +1403,17 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ir.Primitive target = translateReceiver(receiver);
ir.Primitive helper() {
return translateCompounds(
+ node,
getValue: () => irBuilder.buildDynamicGet(
target,
getterSelector,
- elements.getGetterTypeMaskInComplexSendSet(node)),
+ elements.getGetterTypeMaskInComplexSendSet(node),
+ sourceInformationBuilder.buildGet(node)),
rhs: rhs,
setValue: (ir.Primitive result) {
irBuilder.buildDynamicSet(
target, setterSelector, elements.getTypeMask(node), result);
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
return node.isConditional
? irBuilder.buildIfNotNullSend(target, nested(helper))
@@ -1422,6 +1433,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
arg,
{bool isSetterValid}) {
return translateCompounds(
+ node,
getValue: () {
if (local.isFunction) {
return irBuilder.buildLocalFunctionGet(local);
@@ -1436,8 +1448,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
} else {
return buildLocalNoSuchSetter(local, result);
}
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
ir.Primitive buildStaticNoSuchGetter(Element element) {
@@ -1462,6 +1473,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
CompoundRhs rhs,
arg) {
return translateCompounds(
+ node,
getValue: () {
switch (getterKind) {
case CompoundGetter.FIELD:
@@ -1488,8 +1500,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return buildStaticNoSuchSetter(
setter != null ? setter : getter, result);
}
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
ir.Primitive buildSuperNoSuchGetter(Element element, TypeMask mask) {
@@ -1518,6 +1529,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
CompoundRhs rhs,
arg) {
return translateCompounds(
+ node,
getValue: () {
switch (getterKind) {
case CompoundGetter.FIELD:
@@ -1545,8 +1557,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return buildSuperNoSuchSetter(
setter, elements.getTypeMask(node), result);
}
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
@override
@@ -1556,14 +1567,14 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
CompoundRhs rhs,
arg) {
return translateCompounds(
+ node,
getValue: () {
return irBuilder.buildReifyTypeVariable(
typeVariable.type,
sourceInformationBuilder.buildGet(node));
},
rhs: rhs,
- setValue: (value) {}, // The binary operator will throw before this.
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ setValue: (value) {}); // The binary operator will throw before this.
}
@override
@@ -1576,6 +1587,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ir.Primitive target = visit(receiver);
ir.Primitive indexValue = visit(index);
return translateCompounds(
+ node,
getValue: () {
Selector selector = new Selector.index();
List<ir.Primitive> arguments = <ir.Primitive>[indexValue];
@@ -1585,7 +1597,9 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
target,
selector,
elements.getGetterTypeMaskInComplexSendSet(node),
- arguments);
+ arguments,
+ sourceInformation:
+ sourceInformationBuilder.buildCall(receiver, node));
},
rhs: rhs,
setValue: (ir.Primitive result) {
@@ -1594,8 +1608,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
elements.getTypeMask(node),
indexValue,
result);
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
@override
@@ -1610,6 +1623,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
bool isSetterValid}) {
ir.Primitive indexValue = visit(index);
return translateCompounds(
+ node,
getValue: () {
if (isGetterValid) {
return irBuilder.buildSuperIndex(indexFunction, indexValue);
@@ -1630,8 +1644,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
elements.getTypeMask(node),
<ir.Primitive>[indexValue, result]);
}
- },
- operatorTypeMask: elements.getOperatorTypeMaskInComplexSendSet(node));
+ });
}
/// Evaluates a string interpolation and appends each part to [accumulator]
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698