| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.cmdline; | 5 library dart2js.cmdline; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
| 8 import 'dart:convert' show UTF8, LineSplitter; | 8 import 'dart:convert' show UTF8, LineSplitter; |
| 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; | 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 FormattingDiagnosticHandler diagnosticHandler; | 104 FormattingDiagnosticHandler diagnosticHandler; |
| 105 | 105 |
| 106 Future<api.CompilationResult> compile(List<String> argv) { | 106 Future<api.CompilationResult> compile(List<String> argv) { |
| 107 stackTraceFilePrefix = '$currentDirectory'; | 107 stackTraceFilePrefix = '$currentDirectory'; |
| 108 Uri libraryRoot = currentDirectory; | 108 Uri libraryRoot = currentDirectory; |
| 109 Uri out = currentDirectory.resolve('out.js'); | 109 Uri out = currentDirectory.resolve('out.js'); |
| 110 Uri sourceMapOut = currentDirectory.resolve('out.js.map'); | 110 Uri sourceMapOut = currentDirectory.resolve('out.js.map'); |
| 111 List<Uri> resolutionInputs; | 111 List<Uri> resolutionInputs; |
| 112 List<String> bazelPaths; |
| 112 Uri packageConfig = null; | 113 Uri packageConfig = null; |
| 113 Uri packageRoot = null; | 114 Uri packageRoot = null; |
| 114 List<String> options = new List<String>(); | 115 List<String> options = new List<String>(); |
| 115 List<String> explicitOutputArguments = <String>[]; | 116 List<String> explicitOutputArguments = <String>[]; |
| 116 bool wantHelp = false; | 117 bool wantHelp = false; |
| 117 bool wantVersion = false; | 118 bool wantVersion = false; |
| 118 bool analyzeOnly = false; | 119 bool analyzeOnly = false; |
| 119 bool analyzeAll = false; | 120 bool analyzeAll = false; |
| 120 bool resolveOnly = false; | 121 bool resolveOnly = false; |
| 121 Uri resolutionOutput = currentDirectory.resolve('out.data'); | 122 Uri resolutionOutput = currentDirectory.resolve('out.data'); |
| 122 bool dumpInfo = false; | |
| 123 bool allowNativeExtensions = false; | 123 bool allowNativeExtensions = false; |
| 124 bool trustTypeAnnotations = false; | 124 bool trustTypeAnnotations = false; |
| 125 bool trustJSInteropTypeAnnotations = false; | 125 bool trustJSInteropTypeAnnotations = false; |
| 126 bool checkedMode = false; | 126 bool checkedMode = false; |
| 127 List<String> hints = <String>[]; |
| 128 bool verbose; |
| 129 bool throwOnError; |
| 130 int throwOnErrorCount; |
| 131 bool showWarnings; |
| 132 bool showHints; |
| 133 bool enableColors; |
| 127 // List of provided options that imply that output is expected. | 134 // List of provided options that imply that output is expected. |
| 128 List<String> optionsImplyCompilation = <String>[]; | 135 List<String> optionsImplyCompilation = <String>[]; |
| 129 bool hasDisallowUnsafeEval = false; | 136 bool hasDisallowUnsafeEval = false; |
| 130 // TODO(johnniwinther): Measure time for reading files. | |
| 131 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); | |
| 132 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); | |
| 133 Map<String, dynamic> environment = new Map<String, dynamic>(); | 137 Map<String, dynamic> environment = new Map<String, dynamic>(); |
| 134 | 138 |
| 135 void passThrough(String argument) => options.add(argument); | 139 void passThrough(String argument) => options.add(argument); |
| 136 | 140 |
| 137 if (BUILD_ID != null) { | 141 if (BUILD_ID != null) { |
| 138 passThrough("--build-id=$BUILD_ID"); | 142 passThrough("--build-id=$BUILD_ID"); |
| 139 } | 143 } |
| 140 | 144 |
| 141 void setLibraryRoot(String argument) { | 145 void setLibraryRoot(String argument) { |
| 142 libraryRoot = currentDirectory.resolve(extractPath(argument)); | 146 libraryRoot = currentDirectory.resolve(extractPath(argument)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 182 } |
| 179 | 183 |
| 180 void setResolutionInput(String argument) { | 184 void setResolutionInput(String argument) { |
| 181 resolutionInputs = <Uri>[]; | 185 resolutionInputs = <Uri>[]; |
| 182 String parts = extractParameter(argument); | 186 String parts = extractParameter(argument); |
| 183 for (String part in parts.split(',')) { | 187 for (String part in parts.split(',')) { |
| 184 resolutionInputs.add(currentDirectory.resolve(nativeToUriPath(part))); | 188 resolutionInputs.add(currentDirectory.resolve(nativeToUriPath(part))); |
| 185 } | 189 } |
| 186 } | 190 } |
| 187 | 191 |
| 192 void setBazelPaths(String argument) { |
| 193 String paths = extractParameter(argument); |
| 194 bazelPaths = <String>[]..addAll(paths.split(',')); |
| 195 } |
| 196 |
| 188 void setResolveOnly(String argument) { | 197 void setResolveOnly(String argument) { |
| 189 resolveOnly = true; | 198 resolveOnly = true; |
| 190 passThrough(argument); | 199 passThrough(argument); |
| 191 } | 200 } |
| 192 | 201 |
| 193 String getDepsOutput(Map<Uri, SourceFile> sourceFiles) { | 202 String getDepsOutput(Map<Uri, SourceFile> sourceFiles) { |
| 194 var filenames = sourceFiles.keys.map((uri) => '$uri').toList(); | 203 var filenames = sourceFiles.keys.map((uri) => '$uri').toList(); |
| 195 filenames.sort(); | 204 filenames.sort(); |
| 196 return filenames.join("\n"); | 205 return filenames.join("\n"); |
| 197 } | 206 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 215 analyzeAll = true; | 224 analyzeAll = true; |
| 216 passThrough(argument); | 225 passThrough(argument); |
| 217 } | 226 } |
| 218 | 227 |
| 219 void setAllowNativeExtensions(String argument) { | 228 void setAllowNativeExtensions(String argument) { |
| 220 allowNativeExtensions = true; | 229 allowNativeExtensions = true; |
| 221 passThrough(argument); | 230 passThrough(argument); |
| 222 } | 231 } |
| 223 | 232 |
| 224 void setVerbose(_) { | 233 void setVerbose(_) { |
| 225 diagnosticHandler.verbose = true; | 234 verbose = true; |
| 226 passThrough('--verbose'); | 235 passThrough('--verbose'); |
| 227 } | 236 } |
| 228 | 237 |
| 229 void setDumpInfo(String argument) { | |
| 230 implyCompilation(argument); | |
| 231 dumpInfo = true; | |
| 232 } | |
| 233 | |
| 234 void setTrustTypeAnnotations(String argument) { | 238 void setTrustTypeAnnotations(String argument) { |
| 235 trustTypeAnnotations = true; | 239 trustTypeAnnotations = true; |
| 236 implyCompilation(argument); | 240 implyCompilation(argument); |
| 237 } | 241 } |
| 238 | 242 |
| 239 void setTrustJSInteropTypeAnnotations(String argument) { | 243 void setTrustJSInteropTypeAnnotations(String argument) { |
| 240 trustJSInteropTypeAnnotations = true; | 244 trustJSInteropTypeAnnotations = true; |
| 241 implyCompilation(argument); | 245 implyCompilation(argument); |
| 242 } | 246 } |
| 243 | 247 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 266 if (!["Client", "Server"].contains(category)) { | 270 if (!["Client", "Server"].contains(category)) { |
| 267 fail('Unsupported library category "$category", ' | 271 fail('Unsupported library category "$category", ' |
| 268 'supported categories are: Client, Server, all'); | 272 'supported categories are: Client, Server, all'); |
| 269 } | 273 } |
| 270 } | 274 } |
| 271 } | 275 } |
| 272 passThrough('--categories=${categories.join(",")}'); | 276 passThrough('--categories=${categories.join(",")}'); |
| 273 } | 277 } |
| 274 | 278 |
| 275 void handleThrowOnError(String argument) { | 279 void handleThrowOnError(String argument) { |
| 276 diagnosticHandler.throwOnError = true; | 280 throwOnError = true; |
| 277 String parameter = extractParameter(argument, isOptionalArgument: true); | 281 String parameter = extractParameter(argument, isOptionalArgument: true); |
| 278 if (parameter != null) { | 282 if (parameter != null) { |
| 279 diagnosticHandler.throwOnErrorCount = int.parse(parameter); | 283 var count = int.parse(parameter); |
| 284 throwOnErrorCount = count; |
| 280 } | 285 } |
| 281 } | 286 } |
| 282 | 287 |
| 283 void handleShortOptions(String argument) { | 288 void handleShortOptions(String argument) { |
| 284 var shortOptions = argument.substring(1).split(""); | 289 var shortOptions = argument.substring(1).split(""); |
| 285 for (var shortOption in shortOptions) { | 290 for (var shortOption in shortOptions) { |
| 286 switch (shortOption) { | 291 switch (shortOption) { |
| 287 case 'v': | 292 case 'v': |
| 288 setVerbose(null); | 293 setVerbose(null); |
| 289 break; | 294 break; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 301 throw 'Internal error: "$shortOption" did not match'; | 306 throw 'Internal error: "$shortOption" did not match'; |
| 302 } | 307 } |
| 303 } | 308 } |
| 304 } | 309 } |
| 305 | 310 |
| 306 List<String> arguments = <String>[]; | 311 List<String> arguments = <String>[]; |
| 307 List<OptionHandler> handlers = <OptionHandler>[ | 312 List<OptionHandler> handlers = <OptionHandler>[ |
| 308 new OptionHandler('-[chvm?]+', handleShortOptions), | 313 new OptionHandler('-[chvm?]+', handleShortOptions), |
| 309 new OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError), | 314 new OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError), |
| 310 new OptionHandler(Flags.suppressWarnings, (_) { | 315 new OptionHandler(Flags.suppressWarnings, (_) { |
| 311 diagnosticHandler.showWarnings = false; | 316 showWarnings = false; |
| 312 passThrough(Flags.suppressWarnings); | 317 passThrough(Flags.suppressWarnings); |
| 313 }), | 318 }), |
| 314 new OptionHandler(Flags.fatalWarnings, passThrough), | 319 new OptionHandler(Flags.fatalWarnings, passThrough), |
| 315 new OptionHandler( | 320 new OptionHandler(Flags.suppressHints, (_) { |
| 316 Flags.suppressHints, (_) => diagnosticHandler.showHints = false), | 321 showHints = false; |
| 322 }), |
| 317 // TODO(sigmund): remove entirely after Dart 1.20 | 323 // TODO(sigmund): remove entirely after Dart 1.20 |
| 318 new OptionHandler( | 324 new OptionHandler( |
| 319 '--output-type=dart|--output-type=dart-multi|--output-type=js', | 325 '--output-type=dart|--output-type=dart-multi|--output-type=js', |
| 320 setOutputType), | 326 setOutputType), |
| 321 new OptionHandler(Flags.noFrequencyBasedMinification, passThrough), | 327 new OptionHandler(Flags.noFrequencyBasedMinification, passThrough), |
| 322 new OptionHandler(Flags.verbose, setVerbose), | 328 new OptionHandler(Flags.verbose, setVerbose), |
| 323 new OptionHandler(Flags.version, (_) => wantVersion = true), | 329 new OptionHandler(Flags.version, (_) => wantVersion = true), |
| 324 new OptionHandler('--library-root=.+', setLibraryRoot), | 330 new OptionHandler('--library-root=.+', setLibraryRoot), |
| 325 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), | 331 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), |
| 326 new OptionHandler(Flags.allowMockCompilation, passThrough), | 332 new OptionHandler(Flags.allowMockCompilation, passThrough), |
| 327 new OptionHandler(Flags.fastStartup, passThrough), | 333 new OptionHandler(Flags.fastStartup, passThrough), |
| 328 new OptionHandler(Flags.genericMethodSyntax, passThrough), | 334 new OptionHandler(Flags.genericMethodSyntax, passThrough), |
| 329 new OptionHandler(Flags.initializingFormalAccess, passThrough), | 335 new OptionHandler(Flags.initializingFormalAccess, passThrough), |
| 330 new OptionHandler('${Flags.minify}|-m', implyCompilation), | 336 new OptionHandler('${Flags.minify}|-m', implyCompilation), |
| 331 new OptionHandler(Flags.preserveUris, passThrough), | 337 new OptionHandler(Flags.preserveUris, passThrough), |
| 332 new OptionHandler('--force-strip=.*', setStrip), | 338 new OptionHandler('--force-strip=.*', setStrip), |
| 333 new OptionHandler(Flags.disableDiagnosticColors, | 339 new OptionHandler(Flags.disableDiagnosticColors, (_) { |
| 334 (_) => diagnosticHandler.enableColors = false), | 340 enableColors = false; |
| 335 new OptionHandler(Flags.enableDiagnosticColors, | 341 }), |
| 336 (_) => diagnosticHandler.enableColors = true), | 342 new OptionHandler(Flags.enableDiagnosticColors, (_) { |
| 343 enableColors = true; |
| 344 }), |
| 337 new OptionHandler('--enable[_-]checked[_-]mode|--checked', | 345 new OptionHandler('--enable[_-]checked[_-]mode|--checked', |
| 338 (_) => setCheckedMode(Flags.enableCheckedMode)), | 346 (_) => setCheckedMode(Flags.enableCheckedMode)), |
| 339 new OptionHandler(Flags.trustTypeAnnotations, | 347 new OptionHandler(Flags.trustTypeAnnotations, |
| 340 (_) => setTrustTypeAnnotations(Flags.trustTypeAnnotations)), | 348 (_) => setTrustTypeAnnotations(Flags.trustTypeAnnotations)), |
| 341 new OptionHandler(Flags.trustPrimitives, | 349 new OptionHandler(Flags.trustPrimitives, |
| 342 (_) => setTrustPrimitives(Flags.trustPrimitives)), | 350 (_) => setTrustPrimitives(Flags.trustPrimitives)), |
| 343 new OptionHandler( | 351 new OptionHandler( |
| 344 Flags.trustJSInteropTypeAnnotations, | 352 Flags.trustJSInteropTypeAnnotations, |
| 345 (_) => setTrustJSInteropTypeAnnotations( | 353 (_) => setTrustJSInteropTypeAnnotations( |
| 346 Flags.trustJSInteropTypeAnnotations)), | 354 Flags.trustJSInteropTypeAnnotations)), |
| 347 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), | 355 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), |
| 348 new OptionHandler('--packages=.+', setPackageConfig), | 356 new OptionHandler('--packages=.+', setPackageConfig), |
| 349 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), | 357 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), |
| 350 new OptionHandler(Flags.analyzeAll, setAnalyzeAll), | 358 new OptionHandler(Flags.analyzeAll, setAnalyzeAll), |
| 351 new OptionHandler(Flags.analyzeOnly, setAnalyzeOnly), | 359 new OptionHandler(Flags.analyzeOnly, setAnalyzeOnly), |
| 352 new OptionHandler(Flags.noSourceMaps, passThrough), | 360 new OptionHandler(Flags.noSourceMaps, passThrough), |
| 353 new OptionHandler(Option.resolutionInput, setResolutionInput), | 361 new OptionHandler(Option.resolutionInput, setResolutionInput), |
| 362 new OptionHandler(Option.bazelPaths, setBazelPaths), |
| 354 new OptionHandler(Flags.resolveOnly, setResolveOnly), | 363 new OptionHandler(Flags.resolveOnly, setResolveOnly), |
| 355 new OptionHandler(Flags.analyzeSignaturesOnly, setAnalyzeOnly), | 364 new OptionHandler(Flags.analyzeSignaturesOnly, setAnalyzeOnly), |
| 356 new OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough), | 365 new OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough), |
| 357 new OptionHandler('--categories=.*', setCategories), | 366 new OptionHandler('--categories=.*', setCategories), |
| 358 new OptionHandler(Flags.disableTypeInference, implyCompilation), | 367 new OptionHandler(Flags.disableTypeInference, implyCompilation), |
| 359 new OptionHandler(Flags.terse, passThrough), | 368 new OptionHandler(Flags.terse, passThrough), |
| 360 new OptionHandler('--deferred-map=.+', implyCompilation), | 369 new OptionHandler('--deferred-map=.+', implyCompilation), |
| 361 new OptionHandler(Flags.dumpInfo, implyCompilation), | 370 new OptionHandler(Flags.dumpInfo, implyCompilation), |
| 362 new OptionHandler( | 371 new OptionHandler( |
| 363 '--disallow-unsafe-eval', (_) => hasDisallowUnsafeEval = true), | 372 '--disallow-unsafe-eval', (_) => hasDisallowUnsafeEval = true), |
| 364 new OptionHandler(Option.showPackageWarnings, passThrough), | 373 new OptionHandler(Option.showPackageWarnings, passThrough), |
| 365 new OptionHandler(Flags.useContentSecurityPolicy, passThrough), | 374 new OptionHandler(Flags.useContentSecurityPolicy, passThrough), |
| 366 new OptionHandler(Flags.enableExperimentalMirrors, passThrough), | 375 new OptionHandler(Flags.enableExperimentalMirrors, passThrough), |
| 367 new OptionHandler(Flags.enableAssertMessage, passThrough), | 376 new OptionHandler(Flags.enableAssertMessage, passThrough), |
| 368 | 377 |
| 369 // TODO(floitsch): remove conditional directives flag. | 378 // TODO(floitsch): remove conditional directives flag. |
| 370 // We don't provide the info-message yet, since we haven't publicly | 379 // We don't provide the info-message yet, since we haven't publicly |
| 371 // launched the feature yet. | 380 // launched the feature yet. |
| 372 new OptionHandler(Flags.conditionalDirectives, (_) {}), | 381 new OptionHandler(Flags.conditionalDirectives, (_) {}), |
| 373 new OptionHandler('--enable-async', (_) { | 382 new OptionHandler('--enable-async', (_) { |
| 374 diagnosticHandler.info( | 383 hints.add("Option '--enable-async' is no longer needed. " |
| 375 "Option '--enable-async' is no longer needed. " | 384 "Async-await is supported by default."); |
| 376 "Async-await is supported by default.", | |
| 377 api.Diagnostic.HINT); | |
| 378 }), | 385 }), |
| 379 new OptionHandler('--enable-null-aware-operators', (_) { | 386 new OptionHandler('--enable-null-aware-operators', (_) { |
| 380 diagnosticHandler.info( | 387 hints.add("Option '--enable-null-aware-operators' is no longer needed. " |
| 381 "Option '--enable-null-aware-operators' is no longer needed. " | 388 "Null aware operators are supported by default."); |
| 382 "Null aware operators are supported by default.", | |
| 383 api.Diagnostic.HINT); | |
| 384 }), | 389 }), |
| 385 new OptionHandler('--enable-enum', (_) { | 390 new OptionHandler('--enable-enum', (_) { |
| 386 diagnosticHandler.info( | 391 hints.add("Option '--enable-enum' is no longer needed. " |
| 387 "Option '--enable-enum' is no longer needed. " | 392 "Enums are supported by default."); |
| 388 "Enums are supported by default.", | |
| 389 api.Diagnostic.HINT); | |
| 390 }), | 393 }), |
| 391 new OptionHandler(Flags.allowNativeExtensions, setAllowNativeExtensions), | 394 new OptionHandler(Flags.allowNativeExtensions, setAllowNativeExtensions), |
| 392 new OptionHandler(Flags.generateCodeWithCompileTimeErrors, passThrough), | 395 new OptionHandler(Flags.generateCodeWithCompileTimeErrors, passThrough), |
| 393 new OptionHandler(Flags.testMode, passThrough), | 396 new OptionHandler(Flags.testMode, passThrough), |
| 394 | 397 |
| 395 // The following three options must come last. | 398 // The following three options must come last. |
| 396 new OptionHandler('-D.+=.*', addInEnvironment), | 399 new OptionHandler('-D.+=.*', addInEnvironment), |
| 397 new OptionHandler('-.*', (String argument) { | 400 new OptionHandler('-.*', (String argument) { |
| 398 helpAndFail("Unknown option '$argument'."); | 401 helpAndFail("Unknown option '$argument'."); |
| 399 }), | 402 }), |
| 400 new OptionHandler('.*', (String argument) { | 403 new OptionHandler('.*', (String argument) { |
| 401 arguments.add(nativeToUriPath(argument)); | 404 arguments.add(nativeToUriPath(argument)); |
| 402 }) | 405 }) |
| 403 ]; | 406 ]; |
| 404 | 407 |
| 405 parseCommandLine(handlers, argv); | 408 parseCommandLine(handlers, argv); |
| 409 |
| 410 // TODO(johnniwinther): Measure time for reading files. |
| 411 SourceFileProvider inputProvider; |
| 412 if (bazelPaths != null) { |
| 413 inputProvider = new BazelInputProvider(bazelPaths); |
| 414 } else { |
| 415 inputProvider = new CompilerSourceFileProvider(); |
| 416 } |
| 417 |
| 418 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); |
| 419 if (verbose != null) { |
| 420 diagnosticHandler.verbose = verbose; |
| 421 } |
| 422 if (throwOnError != null) { |
| 423 diagnosticHandler.throwOnError = throwOnError; |
| 424 } |
| 425 if (throwOnErrorCount != null) { |
| 426 diagnosticHandler.throwOnErrorCount = throwOnErrorCount; |
| 427 } |
| 428 if (showWarnings != null) { |
| 429 diagnosticHandler.showWarnings = showWarnings; |
| 430 } |
| 431 if (showHints != null) { |
| 432 diagnosticHandler.showHints = showHints; |
| 433 } |
| 434 if (enableColors != null) { |
| 435 diagnosticHandler.enableColors = enableColors; |
| 436 } |
| 437 for (String hint in hints) { |
| 438 diagnosticHandler.info(hint, api.Diagnostic.HINT); |
| 439 } |
| 440 |
| 406 if (wantHelp || wantVersion) { | 441 if (wantHelp || wantVersion) { |
| 407 helpAndExit(wantHelp, wantVersion, diagnosticHandler.verbose); | 442 helpAndExit(wantHelp, wantVersion, diagnosticHandler.verbose); |
| 408 } | 443 } |
| 409 | 444 |
| 410 if (hasDisallowUnsafeEval) { | 445 if (hasDisallowUnsafeEval) { |
| 411 String precompiledName = relativize( | 446 String precompiledName = relativize( |
| 412 currentDirectory, | 447 currentDirectory, |
| 413 RandomAccessFileOutputProvider.computePrecompiledUri(out), | 448 RandomAccessFileOutputProvider.computePrecompiledUri(out), |
| 414 Platform.isWindows); | 449 Platform.isWindows); |
| 415 helpAndFail("Option '--disallow-unsafe-eval' has been removed." | 450 helpAndFail("Option '--disallow-unsafe-eval' has been removed." |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 879 } |
| 845 input = new _CompilerInput(input, dataMap); | 880 input = new _CompilerInput(input, dataMap); |
| 846 List<Uri> resolutionInputs = dataMap.keys.toList(); | 881 List<Uri> resolutionInputs = dataMap.keys.toList(); |
| 847 if (compilerOptions.resolutionInputs != null) { | 882 if (compilerOptions.resolutionInputs != null) { |
| 848 for (Uri uri in compilerOptions.resolutionInputs) { | 883 for (Uri uri in compilerOptions.resolutionInputs) { |
| 849 if (!dataMap.containsKey(uri)) { | 884 if (!dataMap.containsKey(uri)) { |
| 850 resolutionInputs.add(uri); | 885 resolutionInputs.add(uri); |
| 851 } | 886 } |
| 852 } | 887 } |
| 853 } | 888 } |
| 854 options = | 889 options = CompilerOptions.copy(options, |
| 855 CompilerOptions.copy(options, | 890 resolutionInputs: resolutionInputs, compileOnly: compileOnly); |
| 856 resolutionInputs: resolutionInputs, | |
| 857 compileOnly: compileOnly); | |
| 858 } | 891 } |
| 859 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput); | 892 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput); |
| 860 } | 893 } |
| 861 | 894 |
| 862 /// Serialize [entryPoint] using [serializedData] if provided. | 895 /// Serialize [entryPoint] using [serializedData] if provided. |
| 863 Future<api.CompilationResult> serialize( | 896 Future<api.CompilationResult> serialize( |
| 864 Uri entryPoint, | 897 Uri entryPoint, |
| 865 Uri serializedUri, | 898 Uri serializedUri, |
| 866 CompilerOptions compilerOptions, | 899 CompilerOptions compilerOptions, |
| 867 api.CompilerInput compilerInput, | 900 api.CompilerInput compilerInput, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 @override | 1028 @override |
| 996 void close() { | 1029 void close() { |
| 997 // Do nothing. | 1030 // Do nothing. |
| 998 } | 1031 } |
| 999 | 1032 |
| 1000 @override | 1033 @override |
| 1001 void addError(errorEvent, [StackTrace stackTrace]) { | 1034 void addError(errorEvent, [StackTrace stackTrace]) { |
| 1002 // Ignore | 1035 // Ignore |
| 1003 } | 1036 } |
| 1004 } | 1037 } |
| OLD | NEW |