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

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

Issue 19754002: Rewrite how we handle synthesized constructors in the compiler. This was motivated by issue https:/… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 25147)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -18,21 +18,28 @@
js.Fun buildJavaScriptFunction(FunctionElement element,
List<js.Parameter> parameters,
js.Block body) {
- FunctionExpression expression =
- element.implementation.parseNode(backend.compiler);
js.Fun result = new js.Fun(parameters, body);
// TODO(johnniwinther): remove the 'element.patch' hack.
Element sourceElement = element.patch == null ? element : element.patch;
SourceFile sourceFile = sourceElement.getCompilationUnit().script.file;
+ 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
// below.
- if (expression.getBeginToken().charOffset < sourceFile.text.length) {
- result.sourcePosition = new SourceFileLocation(
- sourceFile, expression.getBeginToken());
+ if (beginToken.charOffset < sourceFile.text.length) {
+ result.sourcePosition = new SourceFileLocation(sourceFile, beginToken);
}
- if (expression.getEndToken().charOffset < sourceFile.text.length) {
- result.endSourcePosition = new SourceFileLocation(
- sourceFile, expression.getEndToken());
+ if (endToken.charOffset < sourceFile.text.length) {
+ result.endSourcePosition = new SourceFileLocation(sourceFile, endToken);
}
return result;
}

Powered by Google App Engine
This is Rietveld 408576698