| 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.fletch_compiler; | 5 library fletchc.fletch_compiler; |
| 6 | 6 |
| 7 import 'package:_internal/libraries.dart' show | 7 import 'package:_internal/libraries.dart' show |
| 8 LIBRARIES, | 8 LIBRARIES, |
| 9 LibraryInfo; | 9 LibraryInfo; |
| 10 | 10 |
| 11 import 'package:compiler/compiler.dart' as api; | 11 import 'package:compiler/compiler.dart' as api; |
| 12 | 12 |
| 13 import 'package:compiler/src/apiimpl.dart' as apiimpl; | 13 import 'package:compiler/src/apiimpl.dart' as apiimpl; |
| 14 | 14 |
| 15 import 'package:compiler/src/io/source_file.dart'; | 15 import 'package:compiler/src/io/source_file.dart'; |
| 16 | 16 |
| 17 import 'package:compiler/src/elements/modelx.dart' show | 17 import 'package:compiler/src/elements/modelx.dart' show |
| 18 CompilationUnitElementX, | 18 CompilationUnitElementX, |
| 19 LibraryElementX; | 19 LibraryElementX; |
| 20 | 20 |
| 21 import 'package:compiler/src/util/uri_extras.dart' show | 21 import 'package:compiler/src/util/uri_extras.dart' show |
| 22 relativize; | 22 relativize; |
| 23 | 23 |
| 24 import 'compiled_function.dart'; | 24 import 'fletch_function_builder.dart'; |
| 25 import 'debug_info.dart'; | 25 import 'debug_info.dart'; |
| 26 import 'find_position_visitor.dart'; | 26 import 'find_position_visitor.dart'; |
| 27 import 'fletch_context.dart'; | 27 import 'fletch_context.dart'; |
| 28 | 28 |
| 29 part 'fletch_compiler_hack.dart'; | 29 part 'fletch_compiler_hack.dart'; |
| 30 | 30 |
| 31 const EXTRA_DART2JS_OPTIONS = const <String>[ | 31 const EXTRA_DART2JS_OPTIONS = const <String>[ |
| 32 // TODO(ahe): This doesn't completely disable type inference. Investigate. | 32 // TODO(ahe): This doesn't completely disable type inference. Investigate. |
| 33 '--disable-type-inference', | 33 '--disable-type-inference', |
| 34 '--output-type=dart', | 34 '--output-type=dart', |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 return compilationUnits[uri]; | 173 return compilationUnits[uri]; |
| 174 } | 174 } |
| 175 | 175 |
| 176 DebugInfo debugInfoForPosition(String file, int position) { | 176 DebugInfo debugInfoForPosition(String file, int position) { |
| 177 Uri uri = Uri.base.resolve(file); | 177 Uri uri = Uri.base.resolve(file); |
| 178 CompilationUnitElementX unit = compilationUnitForUri(uri); | 178 CompilationUnitElementX unit = compilationUnitForUri(uri); |
| 179 if (unit == null) return null; | 179 if (unit == null) return null; |
| 180 FindPositionVisitor visitor = new FindPositionVisitor(position, unit); | 180 FindPositionVisitor visitor = new FindPositionVisitor(position, unit); |
| 181 unit.accept(visitor, null); | 181 unit.accept(visitor, null); |
| 182 CompiledFunction function = | 182 FletchFunctionBuilder function = |
| 183 _NO_WARN(backend).compiledFunctions[visitor.element]; | 183 _NO_WARN(backend).functionBuilders[visitor.element]; |
| 184 if (function == null) return null; | 184 if (function == null) return null; |
| 185 _NO_WARN(backend).ensureDebugInfo(function); | 185 _NO_WARN(backend).ensureDebugInfo(function); |
| 186 return function.debugInfo; | 186 return function.debugInfo; |
| 187 } | 187 } |
| 188 | 188 |
| 189 int positionInFileFromPattern(String file, int line, String pattern) { | 189 int positionInFileFromPattern(String file, int line, String pattern) { |
| 190 Uri uri = Uri.base.resolve(file); | 190 Uri uri = Uri.base.resolve(file); |
| 191 SourceFile sourceFile = _NO_WARN(provider).sourceFiles[uri]; | 191 SourceFile sourceFile = _NO_WARN(provider).sourceFiles[uri]; |
| 192 if (sourceFile == null) return null; | 192 if (sourceFile == null) return null; |
| 193 List<int> lineStarts = sourceFile.lineStarts; | 193 List<int> lineStarts = sourceFile.lineStarts; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 208 if (sourceFile == null) return null; | 208 if (sourceFile == null) return null; |
| 209 if (line >= sourceFile.lineStarts.length) return null; | 209 if (line >= sourceFile.lineStarts.length) return null; |
| 210 return sourceFile.lineStarts[line] + column; | 210 return sourceFile.lineStarts[line] + column; |
| 211 } | 211 } |
| 212 | 212 |
| 213 bool inUserCode(element, {bool assumeInUserCode: false}) => true; | 213 bool inUserCode(element, {bool assumeInUserCode: false}) => true; |
| 214 } | 214 } |
| 215 | 215 |
| 216 // TODO(ahe): Remove this method. | 216 // TODO(ahe): Remove this method. |
| 217 _NO_WARN(object) => object; | 217 _NO_WARN(object) => object; |
| OLD | NEW |