Create source information from ConstantExpression

(now that it has a fileOffset)

Change-Id: I057ca3cf04a941ccdb03a6d8ca58947650b1cbec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99161
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2019-04-12 07:37:17 +00:00 committed by commit-bot@chromium.org
parent b7b7a63407
commit 394f88d5cf
2 changed files with 12 additions and 2 deletions

View file

@ -1525,15 +1525,18 @@ class KernelSsaGraphBuilder extends ir.Visitor
@override
void visitConstantExpression(ir.ConstantExpression node) {
ConstantValue value = _elementMap.getConstantValue(node);
SourceInformation sourceInformation =
_sourceInformationBuilder.buildGet(node);
if (!closedWorld.outputUnitData
.hasOnlyNonDeferredImportPathsToConstant(targetElement, value)) {
stack.add(graph.addDeferredConstant(
value,
closedWorld.outputUnitData.outputUnitForConstant(value),
_sourceInformationBuilder.buildGet(node),
sourceInformation,
closedWorld));
} else {
stack.add(graph.addConstant(value, closedWorld));
stack.add(graph.addConstant(value, closedWorld,
sourceInformation: sourceInformation));
}
}

View file

@ -63,6 +63,13 @@ Future testAnnotatedCode(String code,
writeJs: writeJs,
verbose: verbose,
inlineData: inlineData);
print('---from kernel with CFE constants-----------------------------------');
await runTest(test, kernelMarker,
printJs: printJs,
writeJs: writeJs,
verbose: verbose,
inlineData: inlineData,
options: ['${Flags.enableLanguageExperiments}=constant-update-2018']);
}
Future runTest(Test test, String config,