| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fletchc.debug_info; | 5 library fletchc.debug_info; |
| 6 | 6 |
| 7 import 'dart:math' show | 7 import 'dart:math' show |
| 8 min; | 8 min; |
| 9 | 9 |
| 10 import 'package:compiler/src/colors.dart' as colors; | 10 import 'package:compiler/src/colors.dart' as colors; |
| 11 | 11 |
| 12 import 'package:compiler/src/dart2jslib.dart' show | 12 import 'package:compiler/src/diagnostics/source_span.dart' show |
| 13 SourceSpan; | 13 SourceSpan; |
| 14 | 14 |
| 15 import 'package:compiler/src/elements/elements.dart'; | 15 import 'package:compiler/src/elements/elements.dart'; |
| 16 | 16 |
| 17 import 'package:compiler/src/io/source_file.dart'; | 17 import 'package:compiler/src/io/source_file.dart'; |
| 18 | 18 |
| 19 import 'package:compiler/src/tree/tree.dart' show | 19 import 'package:compiler/src/tree/tree.dart' show |
| 20 Node, | 20 Node, |
| 21 unparse; | 21 unparse; |
| 22 | 22 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 final FletchFunction function; | 84 final FletchFunction function; |
| 85 final List<SourceLocation> locations = <SourceLocation>[]; | 85 final List<SourceLocation> locations = <SourceLocation>[]; |
| 86 final List<ScopeInfo> scopeInfos = <ScopeInfo>[ScopeInfo.sentinel]; | 86 final List<ScopeInfo> scopeInfos = <ScopeInfo>[ScopeInfo.sentinel]; |
| 87 | 87 |
| 88 DebugInfo(this.function); | 88 DebugInfo(this.function); |
| 89 | 89 |
| 90 void addLocation( | 90 void addLocation( |
| 91 FletchCompilerImplementation compiler, | 91 FletchCompilerImplementation compiler, |
| 92 int bytecodeIndex, | 92 int bytecodeIndex, |
| 93 Node node) { | 93 Node node) { |
| 94 SourceSpan span = compiler.spanFromSpannable(node); | 94 SourceSpan span = compiler.reporter.spanFromSpannable(node); |
| 95 SourceFile file = null; | 95 SourceFile file = null; |
| 96 // TODO(ahe): What to do if compiler.provider isn't a SourceFileProvider? | 96 // TODO(ahe): What to do if compiler.provider isn't a SourceFileProvider? |
| 97 // Perhaps we can create a new type of diagnostic, see | 97 // Perhaps we can create a new type of diagnostic, see |
| 98 // package:compiler/compiler.dart. The class Diagnostic is an "extensible" | 98 // package:compiler/compiler.dart. The class Diagnostic is an "extensible" |
| 99 // enum class. This way, the debugger doesn't hold on to files. | 99 // enum class. This way, the debugger doesn't hold on to files. |
| 100 // Alternatively, source files should be obtained by iterating through the | 100 // Alternatively, source files should be obtained by iterating through the |
| 101 // compilation units. | 101 // compilation units. |
| 102 if (span != null && compiler.provider is SourceFileProvider) { | 102 if (span != null && compiler.provider is SourceFileProvider) { |
| 103 SourceFileProvider provider = compiler.provider; | 103 SourceFileProvider provider = compiler.provider; |
| 104 Uri resourceUri = compiler.translateUri(span, span.uri); | 104 Uri resourceUri = compiler.translateUri(span, span.uri); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 buffer.write('${startLine + 1}'.padRight(5) + l); | 224 buffer.write('${startLine + 1}'.padRight(5) + l); |
| 225 } | 225 } |
| 226 | 226 |
| 227 return buffer.toString(); | 227 return buffer.toString(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 SourceLocation sourceLocationFor(int bytecodeIndex) { | 230 SourceLocation sourceLocationFor(int bytecodeIndex) { |
| 231 return locationFor(bytecodeIndex); | 231 return locationFor(bytecodeIndex); |
| 232 } | 232 } |
| 233 } | 233 } |
| OLD | NEW |