| 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 library analyze_helper; | 5 library analyze_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:compiler/compiler.dart' as api; | 9 import 'package:compiler/compiler.dart' as api; |
| 10 import 'package:compiler/src/apiimpl.dart'; | 10 import 'package:compiler/src/apiimpl.dart'; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 | 214 |
| 215 === | 215 === |
| 216 === NOTE: If this test fails, update [WHITE_LIST] in $testFileName | 216 === NOTE: If this test fails, update [WHITE_LIST] in $testFileName |
| 217 === | 217 === |
| 218 | 218 |
| 219 | 219 |
| 220 """); | 220 """); |
| 221 | 221 |
| 222 var libraryRoot = currentDirectory.resolve('sdk/'); | 222 var libraryRoot = currentDirectory.resolve('sdk/'); |
| 223 var packageRoot = | 223 var packageConfig = currentDirectory.resolve('.packages'); |
| 224 currentDirectory.resolve(Platform.packageRoot); | |
| 225 var provider = new CompilerSourceFileProvider(); | 224 var provider = new CompilerSourceFileProvider(); |
| 226 var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider); | 225 var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider); |
| 227 options = <String>[Flags.analyzeOnly, '--categories=Client,Server', | 226 options = <String>[Flags.analyzeOnly, '--categories=Client,Server', |
| 228 Flags.showPackageWarnings]..addAll(options); | 227 Flags.showPackageWarnings]..addAll(options); |
| 229 switch (mode) { | 228 switch (mode) { |
| 230 case AnalysisMode.URI: | 229 case AnalysisMode.URI: |
| 231 case AnalysisMode.MAIN: | 230 case AnalysisMode.MAIN: |
| 232 options.add(Flags.analyzeMain); | 231 options.add(Flags.analyzeMain); |
| 233 break; | 232 break; |
| 234 case AnalysisMode.ALL: | 233 case AnalysisMode.ALL: |
| 235 options.add(Flags.analyzeAll); | 234 options.add(Flags.analyzeAll); |
| 236 break; | 235 break; |
| 237 case AnalysisMode.TREE_SHAKING: | 236 case AnalysisMode.TREE_SHAKING: |
| 238 break; | 237 break; |
| 239 } | 238 } |
| 240 if (options.contains(Flags.verbose)) { | 239 if (options.contains(Flags.verbose)) { |
| 241 handler.verbose = true; | 240 handler.verbose = true; |
| 242 } | 241 } |
| 243 if (options.contains(HIDE_WHITELISTED)) { | 242 if (options.contains(HIDE_WHITELISTED)) { |
| 244 handler.showWhitelisted = false; | 243 handler.showWhitelisted = false; |
| 245 } | 244 } |
| 246 var compiler = new CompilerImpl( | 245 var compiler = new CompilerImpl( |
| 247 provider, | 246 provider, |
| 248 null, | 247 null, |
| 249 handler, | 248 handler, |
| 250 new CompilerOptions.parse( | 249 new CompilerOptions.parse( |
| 251 libraryRoot: libraryRoot, | 250 libraryRoot: libraryRoot, |
| 252 packageRoot: packageRoot, | 251 packageConfig: packageConfig, |
| 253 options: options, | 252 options: options, |
| 254 environment: {})); | 253 environment: {})); |
| 255 String MESSAGE = """ | 254 String MESSAGE = """ |
| 256 | 255 |
| 257 | 256 |
| 258 === | 257 === |
| 259 === ERROR: Unexpected result of analysis. | 258 === ERROR: Unexpected result of analysis. |
| 260 === | 259 === |
| 261 === Please update [WHITE_LIST] in $testFileName | 260 === Please update [WHITE_LIST] in $testFileName |
| 262 === | 261 === |
| (...skipping 17 matching lines...) Expand all Loading... |
| 280 if (checkResults != null) { | 279 if (checkResults != null) { |
| 281 result = checkResults(compiler, handler); | 280 result = checkResults(compiler, handler); |
| 282 } else { | 281 } else { |
| 283 result = handler.checkResults(); | 282 result = handler.checkResults(); |
| 284 } | 283 } |
| 285 if (!result) { | 284 if (!result) { |
| 286 print(MESSAGE); | 285 print(MESSAGE); |
| 287 exit(1); | 286 exit(1); |
| 288 } | 287 } |
| 289 } | 288 } |
| OLD | NEW |