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

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 2974663002: Compute source spans for IR nodes and J/K-elements (Closed)
Patch Set: Updated cf. comments Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'backend_strategy.dart'; 10 import 'backend_strategy.dart';
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 (ex.message != null) ? tryToString(ex.message) : tryToString(ex); 1133 (ex.message != null) ? tryToString(ex.message) : tryToString(ex);
1134 reportDiagnosticInternal( 1134 reportDiagnosticInternal(
1135 createMessage(ex.node, MessageKind.GENERIC, {'text': message}), 1135 createMessage(ex.node, MessageKind.GENERIC, {'text': message}),
1136 const <DiagnosticMessage>[], 1136 const <DiagnosticMessage>[],
1137 api.Diagnostic.CRASH); 1137 api.Diagnostic.CRASH);
1138 } 1138 }
1139 1139
1140 /// Using [frontendStrategy] to compute a [SourceSpan] from spannable using 1140 /// Using [frontendStrategy] to compute a [SourceSpan] from spannable using
1141 /// the [currentElement] as context. 1141 /// the [currentElement] as context.
1142 SourceSpan _spanFromStrategy(Spannable spannable) { 1142 SourceSpan _spanFromStrategy(Spannable spannable) {
1143 SourceSpan span = 1143 SourceSpan span;
1144 compiler.frontendStrategy.spanFromSpannable(spannable, currentElement); 1144 if (compiler.phase == Compiler.PHASE_COMPILING) {
1145 span =
1146 compiler.backendStrategy.spanFromSpannable(spannable, currentElement);
1147 } else {
1148 span = compiler.frontendStrategy
1149 .spanFromSpannable(spannable, currentElement);
1150 }
1145 if (span != null) return span; 1151 if (span != null) return span;
1146 throw 'No error location.'; 1152 throw 'No error location.';
1147 } 1153 }
1148 1154
1149 SourceSpan spanFromSpannable(Spannable spannable) { 1155 SourceSpan spanFromSpannable(Spannable spannable) {
1150 if (spannable == CURRENT_ELEMENT_SPANNABLE) { 1156 if (spannable == CURRENT_ELEMENT_SPANNABLE) {
1151 spannable = currentElement; 1157 spannable = currentElement;
1152 } else if (spannable == NO_LOCATION_SPANNABLE) { 1158 } else if (spannable == NO_LOCATION_SPANNABLE) {
1153 if (currentElement == null) return null; 1159 if (currentElement == null) return null;
1154 spannable = currentElement; 1160 spannable = currentElement;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 _ElementScanner(this.scanner); 1600 _ElementScanner(this.scanner);
1595 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 1601 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
1596 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 1602 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
1597 } 1603 }
1598 1604
1599 class _EmptyEnvironment implements Environment { 1605 class _EmptyEnvironment implements Environment {
1600 const _EmptyEnvironment(); 1606 const _EmptyEnvironment();
1601 1607
1602 String valueOf(String key) => null; 1608 String valueOf(String key) => null;
1603 } 1609 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/backend_strategy.dart ('k') | pkg/compiler/lib/src/js_backend/element_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698