| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// An entrypoint used to run portions of front_end and measure its performance. | 5 /// An entrypoint used to run portions of front_end and measure its performance. |
| 6 library front_end.tool.perf; | 6 library front_end.tool.perf; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io' show Directory, File, Platform, exit; | 9 import 'dart:io' show Directory, File, Platform, exit; |
| 10 | 10 |
| 11 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
| 12 import 'package:analyzer/error/listener.dart'; | 12 import 'package:analyzer/error/listener.dart'; |
| 13 import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver; | 13 import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver; |
| 14 import 'package:analyzer/file_system/physical_file_system.dart' | 14 import 'package:analyzer/file_system/physical_file_system.dart' |
| 15 show PhysicalResourceProvider; | 15 show PhysicalResourceProvider; |
| 16 import 'package:analyzer/source/package_map_resolver.dart'; | 16 import 'package:analyzer/source/package_map_resolver.dart'; |
| 17 import 'package:analyzer/src/context/builder.dart'; | 17 import 'package:analyzer/src/context/builder.dart'; |
| 18 import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk; | 18 import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk; |
| 19 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl; | 19 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl; |
| 20 import 'package:analyzer/src/generated/parser.dart'; | 20 import 'package:analyzer/src/generated/parser.dart'; |
| 21 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
| 22 import 'package:analyzer/src/generated/source_io.dart'; | 22 import 'package:analyzer/src/generated/source_io.dart'; |
| 23 import 'package:analyzer/src/kernel/loader.dart'; | 23 import 'package:analyzer/src/kernel/loader.dart'; |
| 24 import 'package:analyzer/src/summary/format.dart'; | 24 import 'package:analyzer/src/summary/format.dart'; |
| 25 import 'package:analyzer/src/summary/idl.dart'; | 25 import 'package:analyzer/src/summary/idl.dart'; |
| 26 import 'package:analyzer/src/summary/link.dart'; | 26 import 'package:analyzer/src/summary/link.dart'; |
| 27 import 'package:analyzer/src/summary/summarize_ast.dart'; | 27 import 'package:analyzer/src/summary/summarize_ast.dart'; |
| 28 import 'package:front_end/compilation_error.dart'; | 28 import 'package:front_end/compilation_message.dart'; |
| 29 import 'package:front_end/compiler_options.dart'; | 29 import 'package:front_end/compiler_options.dart'; |
| 30 import 'package:front_end/src/scanner/reader.dart'; | 30 import 'package:front_end/src/scanner/reader.dart'; |
| 31 import 'package:front_end/src/scanner/scanner.dart'; | 31 import 'package:front_end/src/scanner/scanner.dart'; |
| 32 import 'package:front_end/src/scanner/token.dart'; | 32 import 'package:front_end/src/scanner/token.dart'; |
| 33 import 'package:kernel/kernel.dart' hide Source; | 33 import 'package:kernel/kernel.dart' hide Source; |
| 34 import 'package:package_config/discovery.dart'; | 34 import 'package:package_config/discovery.dart'; |
| 35 import 'package:path/path.dart' as path; | 35 import 'package:path/path.dart' as path; |
| 36 import 'package:source_span/source_span.dart' show SourceSpan; | 36 import 'package:source_span/source_span.dart' show SourceSpan; |
| 37 | 37 |
| 38 main(List<String> args) async { | 38 main(List<String> args) async { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return uri.toFilePath(); | 194 return uri.toFilePath(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void _reportErrors(List errors, ErrorHandler onError) { | 197 void _reportErrors(List errors, ErrorHandler onError) { |
| 198 if (onError == null) return; | 198 if (onError == null) return; |
| 199 for (var error in errors) { | 199 for (var error in errors) { |
| 200 onError(new _DartkError(error)); | 200 onError(new _DartkError(error)); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 class _DartkError implements CompilationError { | 204 class _DartkError implements CompilationMessage { |
| 205 String get tip => null; | 205 String get tip => null; |
| 206 SourceSpan get span => null; | 206 SourceSpan get span => null; |
| 207 String get analyzerCode => null; |
| 208 String get dart2jsCode => null; |
| 209 Severity get severity => Severity.error; |
| 207 final String message; | 210 final String message; |
| 208 _DartkError(this.message); | 211 _DartkError(this.message); |
| 209 } | 212 } |
| 210 | 213 |
| 211 /// Generates unlinkmed summaries for all files in [files], and returns them in | 214 /// Generates unlinkmed summaries for all files in [files], and returns them in |
| 212 /// an [_UnlinkedSummaries] container. | 215 /// an [_UnlinkedSummaries] container. |
| 213 _UnlinkedSummaries generateUnlinkedSummaries(Set<Source> files) { | 216 _UnlinkedSummaries generateUnlinkedSummaries(Set<Source> files) { |
| 214 var unlinkedSummaries = new _UnlinkedSummaries(); | 217 var unlinkedSummaries = new _UnlinkedSummaries(); |
| 215 for (var source in files) { | 218 for (var source in files) { |
| 216 unlinkedSummaries.summariesByUri[source.uri.toString()] = | 219 unlinkedSummaries.summariesByUri[source.uri.toString()] = |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 class _Scanner extends Scanner { | 434 class _Scanner extends Scanner { |
| 432 _Scanner(String contents) : super.create(new CharSequenceReader(contents)) { | 435 _Scanner(String contents) : super.create(new CharSequenceReader(contents)) { |
| 433 preserveComments = false; | 436 preserveComments = false; |
| 434 } | 437 } |
| 435 | 438 |
| 436 @override | 439 @override |
| 437 void reportError(errorCode, int offset, List<Object> arguments) { | 440 void reportError(errorCode, int offset, List<Object> arguments) { |
| 438 // ignore errors. | 441 // ignore errors. |
| 439 } | 442 } |
| 440 } | 443 } |
| OLD | NEW |