| 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 /// Tests code generation. | 5 /// Tests code generation. |
| 6 /// | 6 /// |
| 7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks | 7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks |
| 8 /// that the output is what we expected. | 8 /// that the output is what we expected. |
| 9 library dev_compiler.test.codegen_test; | 9 library dev_compiler.test.codegen_test; |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 var contents = new File(testFile).readAsStringSync(); | 132 var contents = new File(testFile).readAsStringSync(); |
| 133 var match = testFileOptionsMatcher.firstMatch(contents); | 133 var match = testFileOptionsMatcher.firstMatch(contents); |
| 134 | 134 |
| 135 var args = defaultOptions.toList(); | 135 var args = defaultOptions.toList(); |
| 136 if (match != null) { | 136 if (match != null) { |
| 137 var matchedArgs = match.group(2).split(' '); | 137 var matchedArgs = match.group(2).split(' '); |
| 138 args.addAll(matchedArgs.where((s) => !ignoreOptions.contains(s))); | 138 args.addAll(matchedArgs.where((s) => !ignoreOptions.contains(s))); |
| 139 } | 139 } |
| 140 | 140 |
| 141 var declaredVars = <String, String>{}; | 141 var declaredVars = <String, String>{}; |
| 142 var argResults = | 142 args = args.expand((String arg) => arg.split('=')).toList(); |
| 143 compileArgParser.parse(extractDefinedVariables(args, declaredVars)); | 143 args = extractDefinedVariables(args, declaredVars); |
| 144 ArgResults argResults; |
| 145 try { |
| 146 argResults = compileArgParser.parse(args); |
| 147 } catch (e) { |
| 148 print('Failed to parse $args'); |
| 149 rethrow; |
| 150 } |
| 144 var options = new CompilerOptions.fromArguments(argResults); | 151 var options = new CompilerOptions.fromArguments(argResults); |
| 145 var moduleFormat = parseModuleFormatOption(argResults).first; | 152 var moduleFormat = parseModuleFormatOption(argResults).first; |
| 146 | 153 |
| 147 // Collect any other files we've imported. | 154 // Collect any other files we've imported. |
| 148 var files = new Set<String>(); | 155 var files = new Set<String>(); |
| 149 _collectTransitiveImports(contents, files, from: testFile); | 156 _collectTransitiveImports(contents, files, from: testFile); |
| 150 var unit = new BuildUnit( | 157 var unit = new BuildUnit( |
| 151 name, path.dirname(testFile), files.toList(), _moduleForLibrary); | 158 name, path.dirname(testFile), files.toList(), _moduleForLibrary); |
| 152 | 159 |
| 153 var compiler = sharedCompiler; | 160 var compiler = sharedCompiler; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 StringLiteral uriLiteral = directive.uri; | 364 StringLiteral uriLiteral = directive.uri; |
| 358 String uriContent = uriLiteral.stringValue; | 365 String uriContent = uriLiteral.stringValue; |
| 359 if (uriContent != null) { | 366 if (uriContent != null) { |
| 360 uriContent = uriContent.trim(); | 367 uriContent = uriContent.trim(); |
| 361 directive.uriContent = uriContent; | 368 directive.uriContent = uriContent; |
| 362 } | 369 } |
| 363 return (directive as UriBasedDirectiveImpl).validate() == null | 370 return (directive as UriBasedDirectiveImpl).validate() == null |
| 364 ? uriContent | 371 ? uriContent |
| 365 : null; | 372 : null; |
| 366 } | 373 } |
| OLD | NEW |