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; |
} |