OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Command line tool to run the checker on a Dart program. | 5 /// Command line tool to run the checker on a Dart program. |
6 library dev_compiler.src.compiler; | 6 library dev_compiler.src.compiler; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 abstract class AbstractCompiler { | 348 abstract class AbstractCompiler { |
349 final CompilerOptions options; | 349 final CompilerOptions options; |
350 final AnalysisContext context; | 350 final AnalysisContext context; |
351 final CodeChecker checker; | 351 final CodeChecker checker; |
352 | 352 |
353 AbstractCompiler(AnalysisContext context, CompilerOptions options, | 353 AbstractCompiler(AnalysisContext context, CompilerOptions options, |
354 [AnalysisErrorListener reporter]) | 354 [AnalysisErrorListener reporter]) |
355 : context = context, | 355 : context = context, |
356 options = options, | 356 options = options, |
357 checker = createChecker(context.typeProvider, options.strongOptions, | 357 checker = new CodeChecker( |
| 358 new RestrictedRules(context.typeProvider, |
| 359 options: options.strongOptions), |
358 reporter ?? AnalysisErrorListener.NULL_LISTENER); | 360 reporter ?? AnalysisErrorListener.NULL_LISTENER); |
359 | 361 |
360 static CodeChecker createChecker(TypeProvider typeProvider, | |
361 StrongModeOptions options, AnalysisErrorListener reporter) { | |
362 return new CodeChecker( | |
363 new RestrictedRules(typeProvider, options: options), reporter, options); | |
364 } | |
365 | |
366 String get outputDir => options.codegenOptions.outputDir; | 362 String get outputDir => options.codegenOptions.outputDir; |
367 TypeRules get rules => checker.rules; | 363 TypeRules get rules => checker.rules; |
368 AnalysisErrorListener get reporter => checker.reporter; | 364 AnalysisErrorListener get reporter => checker.reporter; |
369 | 365 |
370 Uri stringToUri(String uriString) { | 366 Uri stringToUri(String uriString) { |
371 var uri = uriString.startsWith('dart:') || uriString.startsWith('package:') | 367 var uri = uriString.startsWith('dart:') || uriString.startsWith('package:') |
372 ? Uri.parse(uriString) | 368 ? Uri.parse(uriString) |
373 : new Uri.file(path.absolute(uriString)); | 369 : new Uri.file(path.absolute(uriString)); |
374 return uri; | 370 return uri; |
375 } | 371 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 '_rtti.js', | 516 '_rtti.js', |
521 '_classes.js', | 517 '_classes.js', |
522 '_operations.js', | 518 '_operations.js', |
523 'dart_runtime.js', | 519 'dart_runtime.js', |
524 ]; | 520 ]; |
525 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); | 521 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); |
526 return files; | 522 return files; |
527 }(); | 523 }(); |
528 | 524 |
529 final _log = new Logger('dev_compiler.src.compiler'); | 525 final _log = new Logger('dev_compiler.src.compiler'); |
OLD | NEW |