| 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fasta.testing.suite; | 5 library fasta.testing.suite; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:convert' show | 10 import 'dart:convert' show |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 Future<Program> createPlatform() { | 122 Future<Program> createPlatform() { |
| 123 return platform ??= new Future<Program>(() async { | 123 return platform ??= new Future<Program>(() async { |
| 124 DartLoader loader = await createLoader(); | 124 DartLoader loader = await createLoader(); |
| 125 Target target = getTarget( | 125 Target target = getTarget( |
| 126 "vm", new TargetFlags(strongMode: options.strongMode)); | 126 "vm", new TargetFlags(strongMode: options.strongMode)); |
| 127 Program program = loader.loadProgram( | 127 Program program = loader.loadProgram( |
| 128 Uri.base.resolve("pkg/fasta/test/platform.dart"), target: target); | 128 Uri.base.resolve("pkg/fasta/test/platform.dart"), target: target); |
| 129 target.performModularTransformations(program); | |
| 130 target.performGlobalTransformations(program); | |
| 131 if (loader.errors.isNotEmpty) { | 129 if (loader.errors.isNotEmpty) { |
| 132 throw loader.errors.join("\n"); | 130 throw loader.errors.join("\n"); |
| 133 } | 131 } |
| 134 Library mainLibrary = program.mainMethod.enclosingLibrary; | 132 Library mainLibrary = program.mainMethod.enclosingLibrary; |
| 135 program.uriToSource.remove(mainLibrary.fileUri); | 133 program.uriToSource.remove(mainLibrary.fileUri); |
| 136 return new Program( | 134 program = new Program( |
| 137 program.libraries.where((Library l) => l != mainLibrary).toList(), | 135 program.libraries.where((Library l) => l != mainLibrary).toList(), |
| 138 program.uriToSource); | 136 program.uriToSource); |
| 137 target.performModularTransformations(program); |
| 138 target.performGlobalTransformations(program); |
| 139 return program; |
| 139 }); | 140 }); |
| 140 } | 141 } |
| 141 | 142 |
| 142 static Future<FeContext> create(Chain suite, Map<String, String> environment, | 143 static Future<FeContext> create(Chain suite, Map<String, String> environment, |
| 143 Uri sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, | 144 Uri sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, |
| 144 bool updateExpectations) async { | 145 bool updateExpectations) async { |
| 145 TranslateUri uriTranslator = await TranslateUri.parse(packages); | 146 TranslateUri uriTranslator = await TranslateUri.parse(packages); |
| 146 String astKindString = environment[AST_KIND_INDEX]; | 147 String astKindString = environment[AST_KIND_INDEX]; |
| 147 AstKind astKind = astKindString == null | 148 AstKind astKind = astKindString == null |
| 148 ? null : AstKind.values[int.parse(astKindString)]; | 149 ? null : AstKind.values[int.parse(astKindString)]; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 p = await sourceTarget.writeOutline(null); | 183 p = await sourceTarget.writeOutline(null); |
| 183 if (fullCompile) { | 184 if (fullCompile) { |
| 184 p = await sourceTarget.writeProgram(null, astKind); | 185 p = await sourceTarget.writeProgram(null, astKind); |
| 185 } | 186 } |
| 186 } on InputError catch (e, s) { | 187 } on InputError catch (e, s) { |
| 187 return fail(null, e.error, s); | 188 return fail(null, e.error, s); |
| 188 } | 189 } |
| 189 return pass(p); | 190 return pass(p); |
| 190 } | 191 } |
| 191 } | 192 } |
| OLD | NEW |