| 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 ddc.devc; | 6 library ddc.devc; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 var codeChecker = new CodeChecker(rules, reporter, options); | 111 var codeChecker = new CodeChecker(rules, reporter, options); |
| 112 var generators = <CodeGenerator>[]; | 112 var generators = <CodeGenerator>[]; |
| 113 if (options.dumpSrcDir != null) { | 113 if (options.dumpSrcDir != null) { |
| 114 generators | 114 generators |
| 115 .add(new EmptyDartGenerator(options.dumpSrcDir, uri, rules, options)); | 115 .add(new EmptyDartGenerator(options.dumpSrcDir, uri, rules, options)); |
| 116 } | 116 } |
| 117 var outputDir = options.outputDir; | 117 var outputDir = options.outputDir; |
| 118 if (outputDir != null) { | 118 if (outputDir != null) { |
| 119 var cg = options.outputDart | 119 var cg = options.outputDart |
| 120 ? new DartGenerator(outputDir, uri, rules, options) | 120 ? new DartGenerator(outputDir, uri, rules, options) |
| 121 : new JSGenerator(outputDir, uri, rules); | 121 : new JSGenerator(outputDir, uri, rules, options); |
| 122 generators.add(cg); | 122 generators.add(cg); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool failure = false; | 125 bool failure = false; |
| 126 var rootSource = resolver.findSource(uri); | 126 var rootSource = resolver.findSource(uri); |
| 127 // TODO(sigmund): switch to use synchronous codegen? | 127 // TODO(sigmund): switch to use synchronous codegen? |
| 128 for (var source in reachableSources(rootSource, resolver.context)) { | 128 for (var source in reachableSources(rootSource, resolver.context)) { |
| 129 var entryUnit = resolver.context.resolveCompilationUnit2(source, source); | 129 var entryUnit = resolver.context.resolveCompilationUnit2(source, source); |
| 130 var lib = entryUnit.element.enclosingElement; | 130 var lib = entryUnit.element.enclosingElement; |
| 131 if (!options.checkSdk && lib.isInSdk) continue; | 131 if (!options.checkSdk && lib.isInSdk) continue; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (options.dumpInfoFile != null) { | 163 if (options.dumpInfoFile != null) { |
| 164 new File(options.dumpInfoFile) | 164 new File(options.dumpInfoFile) |
| 165 .writeAsStringSync(JSON.encode(reporter.result.toJsonMap())); | 165 .writeAsStringSync(JSON.encode(reporter.result.toJsonMap())); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 return new CheckerResults(libraries, rules, failure || options.forceCompile); | 168 return new CheckerResults(libraries, rules, failure || options.forceCompile); |
| 169 } | 169 } |
| 170 | 170 |
| 171 final _log = new Logger('ddc'); | 171 final _log = new Logger('ddc'); |
| 172 final _earlyErrorResult = new CheckerResults(const [], null, true); | 172 final _earlyErrorResult = new CheckerResults(const [], null, true); |
| OLD | NEW |