OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 /// Command line tool to write checker errors as inline comments in the source | 6 /// Command line tool to write checker errors as inline comments in the source |
7 /// code of the program. This tool requires the info.json file created by | 7 /// code of the program. This tool requires the info.json file created by |
8 /// running devc.dart passing the arguments | 8 /// running devc.dart passing the arguments |
9 /// --dump-info --dump-info-file info.json | 9 /// --dump-info --dump-info-file info.json |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 var sdkDir = getSdkDir(argv); | 130 var sdkDir = getSdkDir(argv); |
131 if (sdkDir == null) { | 131 if (sdkDir == null) { |
132 print('Could not automatically find dart sdk path.'); | 132 print('Could not automatically find dart sdk path.'); |
133 print('Please pass in explicitly: --dart-sdk <path>'); | 133 print('Please pass in explicitly: --dart-sdk <path>'); |
134 exit(1); | 134 exit(1); |
135 } | 135 } |
136 | 136 |
137 var filename = args.rest.first; | 137 var filename = args.rest.first; |
138 var options = new CompilerOptions( | 138 var options = new SourceResolverOptions( |
139 dartSdkPath: sdkDir.path, | 139 dartSdkPath: sdkDir.path, |
140 useMultiPackage: args['use-multi-package'], | 140 useMultiPackage: args['use-multi-package'], |
141 packageRoot: args['package-root'], | 141 packageRoot: args['package-root'], |
142 packagePaths: args['package-paths'].split(',')); | 142 packagePaths: args['package-paths'].split(',')); |
143 | 143 |
144 Map json = JSON.decode(new File(filename).readAsStringSync()); | 144 Map json = JSON.decode(new File(filename).readAsStringSync()); |
145 var summary = GlobalSummary.parse(json); | 145 var summary = GlobalSummary.parse(json); |
146 var excludePattern = (args['exclude-pattern'] != null) | 146 var excludePattern = (args['exclude-pattern'] != null) |
147 ? new RegExp(args['exclude-pattern']) | 147 ? new RegExp(args['exclude-pattern']) |
148 : null; | 148 : null; |
149 var includePattern = (args['include-pattern'] != null) | 149 var includePattern = (args['include-pattern'] != null) |
150 ? new RegExp(args['include-pattern']) | 150 ? new RegExp(args['include-pattern']) |
151 : null; | 151 : null; |
152 | 152 |
153 var context = createAnalysisContext(options); | 153 var context = |
| 154 createAnalysisContextWithSources(new StrongModeOptions(), options); |
154 var visitor = new EditFileSummaryVisitor(context, args['level'], | 155 var visitor = new EditFileSummaryVisitor(context, args['level'], |
155 args['checkout-files-executable'], args['checkout-files-arg'], | 156 args['checkout-files-executable'], args['checkout-files-arg'], |
156 includePattern, excludePattern); | 157 includePattern, excludePattern); |
157 summary.accept(visitor); | 158 summary.accept(visitor); |
158 visitor.build(); | 159 visitor.build(); |
159 } | 160 } |
OLD | NEW |