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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1779153002: Make source information on conditions mandatory in CPS (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 46565ab0cb7bd11dadb8fea619e1ec73944a3251..851638fca83fcc8fc74d29e761dd3e02c01027a9 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -105,7 +105,8 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ {
/// referred to by [reference].
/// This increments the reference count for the given variable, so the
/// returned expression must be used in the tree.
- Expression getVariableUse(cps_ir.Reference<cps_ir.Primitive> reference) {
+ Expression getVariableUse(cps_ir.Reference<cps_ir.Primitive> reference,
+ {SourceInformation sourceInformation}) {
cps_ir.Primitive prim = reference.definition.effectiveDefinition;
if (prim is cps_ir.Constant && inlinedConstants.contains(prim)) {
return new Constant(prim.value);
@@ -113,7 +114,8 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ {
if (thisParameter != null && prim == thisParameter) {
return new This();
}
- return new VariableUse(getVariable(prim));
+ return new VariableUse(
+ getVariable(prim), sourceInformation: sourceInformation);
}
Expression getVariableUseOrNull(
@@ -451,11 +453,13 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ {
/// Translates a branch condition to a tree expression.
Expression translateCondition(cps_ir.Branch branch) {
- Expression value = getVariableUse(branch.conditionRef);
+ Expression value = getVariableUse(
+ branch.conditionRef, sourceInformation: branch.sourceInformation);
if (branch.isStrictCheck) {
return new ApplyBuiltinOperator(
BuiltinOperator.StrictEq,
- <Expression>[value, new Constant(new TrueConstantValue())]);
+ <Expression>[value, new Constant(new TrueConstantValue())],
+ branch.sourceInformation);
} else {
return value;
}
@@ -474,7 +478,8 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ {
elseStatement = cont.hasExactlyOneUse
? translateExpression(cont.body)
: new Break(labels[cont]);
- return new If(condition, thenStatement, elseStatement);
+ return new If(
+ condition, thenStatement, elseStatement, node.sourceInformation);
}
@@ -586,8 +591,10 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ {
if (node.operator == BuiltinOperator.IsFalsy) {
return new Not(getVariableUse(node.argumentRefs.single));
}
- return new ApplyBuiltinOperator(node.operator,
- translateArguments(node.argumentRefs));
+ return new ApplyBuiltinOperator(
+ node.operator,
+ translateArguments(node.argumentRefs),
+ node.sourceInformation);
}
Expression visitApplyBuiltinMethod(cps_ir.ApplyBuiltinMethod node) {
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698