| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 class FeContext extends TestContext { | 92 class FeContext extends TestContext { |
| 93 final TranslateUri uriTranslator; | 93 final TranslateUri uriTranslator; |
| 94 | 94 |
| 95 final List<Step> steps; | 95 final List<Step> steps; |
| 96 | 96 |
| 97 final ExpectationSet expectationSet = | 97 final ExpectationSet expectationSet = |
| 98 new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS)); | 98 new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS)); |
| 99 | 99 |
| 100 Future<Program> platform; | 100 Future<Program> platform; |
| 101 | 101 |
| 102 FeContext(String sdk, Uri vm, Uri packages, bool strongMode, | 102 FeContext(Uri sdk, Uri vm, Uri packages, bool strongMode, |
| 103 DartSdk dartSdk, bool updateExpectations, this.uriTranslator, | 103 DartSdk dartSdk, bool updateExpectations, this.uriTranslator, |
| 104 bool fullCompile, AstKind astKind) | 104 bool fullCompile, AstKind astKind) |
| 105 : steps = <Step>[ | 105 : steps = <Step>[ |
| 106 new Outline(fullCompile, astKind), | 106 new Outline(fullCompile, astKind), |
| 107 const Print(), | 107 const Print(), |
| 108 new Verify(fullCompile), | 108 new Verify(fullCompile), |
| 109 new MatchExpectation( | 109 new MatchExpectation( |
| 110 fullCompile | 110 fullCompile |
| 111 ? ".${shortenAstKindName(astKind)}.expect" | 111 ? ".${shortenAstKindName(astKind)}.expect" |
| 112 : ".outline.expect", | 112 : ".outline.expect", |
| (...skipping 20 matching lines...) Expand all Loading... |
| 133 } | 133 } |
| 134 Library mainLibrary = program.mainMethod.enclosingLibrary; | 134 Library mainLibrary = program.mainMethod.enclosingLibrary; |
| 135 program.uriToSource.remove(mainLibrary.fileUri); | 135 program.uriToSource.remove(mainLibrary.fileUri); |
| 136 return new Program( | 136 return new Program( |
| 137 program.libraries.where((Library l) => l != mainLibrary).toList(), | 137 program.libraries.where((Library l) => l != mainLibrary).toList(), |
| 138 program.uriToSource); | 138 program.uriToSource); |
| 139 }); | 139 }); |
| 140 } | 140 } |
| 141 | 141 |
| 142 static Future<FeContext> create(Chain suite, Map<String, String> environment, | 142 static Future<FeContext> create(Chain suite, Map<String, String> environment, |
| 143 String sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, | 143 Uri sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, |
| 144 bool updateExpectations) async { | 144 bool updateExpectations) async { |
| 145 TranslateUri uriTranslator = await TranslateUri.parse(packages); | 145 TranslateUri uriTranslator = await TranslateUri.parse(packages); |
| 146 String astKindString = environment[AST_KIND_INDEX]; | 146 String astKindString = environment[AST_KIND_INDEX]; |
| 147 AstKind astKind = astKindString == null | 147 AstKind astKind = astKindString == null |
| 148 ? null : AstKind.values[int.parse(astKindString)]; | 148 ? null : AstKind.values[int.parse(astKindString)]; |
| 149 return new FeContext( | 149 return new FeContext( |
| 150 sdk, vm, packages, strongMode, dartSdk, updateExpectations, | 150 sdk, vm, packages, strongMode, dartSdk, updateExpectations, |
| 151 uriTranslator, environment.containsKey(ENABLE_FULL_COMPILE), astKind); | 151 uriTranslator, environment.containsKey(ENABLE_FULL_COMPILE), astKind); |
| 152 } | 152 } |
| 153 } | 153 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 182 p = await sourceTarget.writeOutline(null); | 182 p = await sourceTarget.writeOutline(null); |
| 183 if (fullCompile) { | 183 if (fullCompile) { |
| 184 p = await sourceTarget.writeProgram(null, astKind); | 184 p = await sourceTarget.writeProgram(null, astKind); |
| 185 } | 185 } |
| 186 } on InputError catch (e, s) { | 186 } on InputError catch (e, s) { |
| 187 return fail(null, e.error, s); | 187 return fail(null, e.error, s); |
| 188 } | 188 } |
| 189 return pass(p); | 189 return pass(p); |
| 190 } | 190 } |
| 191 } | 191 } |
| OLD | NEW |