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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 57873002: Build new IR for functions returning a constant (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: type inference and inlining for new ir nodes Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index ac8ad5977c9c4ddd3e57d1a304ece5d25766a0c2..99acdd19852951f9bc5f584ec67ad432a3bedf44 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -19,23 +19,32 @@ class SsaCodeGeneratorTask extends CompilerTask {
// TODO(sra): Attaching positions might be cleaner if the source position
// was on a wrapping node.
SourceFile sourceFile = sourceFileOfElement(element);
- Node expression = element.implementation.parseNode(backend.compiler);
- Token beginToken;
- Token endToken;
- if (expression == null) {
- // Synthesized node. Use the enclosing element for the location.
- beginToken = endToken = element.position();
+ if (element.hasIrNode(compiler)) {
+ IrFunction function = element.irNode(compiler);
+ node.sourcePosition = new OffsetSourceFileLocation(
+ sourceFile, function.offset, function.sourceName);
+ node.endSourcePosition = new OffsetSourceFileLocation(
+ sourceFile, function.endOffset);
} else {
- beginToken = expression.getBeginToken();
- endToken = expression.getEndToken();
- }
- // TODO(podivilov): find the right sourceFile here and remove offset checks
- // below.
- if (beginToken.charOffset < sourceFile.length) {
- node.sourcePosition = new SourceFileLocation(sourceFile, beginToken);
- }
- if (endToken.charOffset < sourceFile.length) {
- node.endSourcePosition = new SourceFileLocation(sourceFile, endToken);
+ Node expression = element.implementation.parseNode(backend.compiler);
+ Token beginToken;
+ Token endToken;
+ if (expression == null) {
+ // Synthesized node. Use the enclosing element for the location.
+ beginToken = endToken = element.position();
+ } else {
+ beginToken = expression.getBeginToken();
+ endToken = expression.getEndToken();
+ }
+ // TODO(podivilov): find the right sourceFile here and remove offset checks
ngeoffray 2013/11/20 14:55:27 line too long.
lukas 2013/11/21 12:20:21 Done.
+ // below.
+ if (beginToken.charOffset < sourceFile.length) {
+ node.sourcePosition = new TokenSourceFileLocation(sourceFile, beginToken);
ngeoffray 2013/11/20 14:55:27 ditto
lukas 2013/11/21 12:20:21 Done.
+ }
+ if (endToken.charOffset < sourceFile.length) {
+ node.endSourcePosition =
+ new TokenSourceFileLocation(sourceFile, endToken);
+ }
}
return node;
}

Powered by Google App Engine
This is Rietveld 408576698