| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library analyzer.test.src.summary.prelinker_test; |
| 6 |
| 7 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 8 import 'package:analyzer/src/summary/idl.dart'; |
| 9 import 'package:analyzer/src/summary/prelink.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 11 import 'package:unittest/unittest.dart'; |
| 12 |
| 13 import 'summarize_ast_test.dart'; |
| 14 import 'summary_common.dart'; |
| 15 |
| 16 main() { |
| 17 groupSep = ' | '; |
| 18 defineReflectiveTests(PrelinkerTest); |
| 19 } |
| 20 |
| 21 /** |
| 22 * Override of [SummaryTest] which verifies the correctness of the prelinker by |
| 23 * creating summaries from the element model, discarding their prelinked |
| 24 * information, and then recreating it using the prelinker. |
| 25 */ |
| 26 @reflectiveTest |
| 27 class PrelinkerTest extends LinkedSummarizeAstTest { |
| 28 @override |
| 29 bool get skipFullyLinkedData => true; |
| 30 |
| 31 @override |
| 32 bool get strongMode => false; |
| 33 |
| 34 @override |
| 35 void serializeLibraryText(String text, {bool allowErrors: false}) { |
| 36 super.serializeLibraryText(text, allowErrors: allowErrors); |
| 37 |
| 38 UnlinkedUnit getPart(String relativeUri) { |
| 39 String absoluteUri = |
| 40 resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri)) |
| 41 .toString(); |
| 42 return linkerInputs.getUnit(absoluteUri); |
| 43 } |
| 44 |
| 45 UnlinkedPublicNamespace getImport(String relativeUri) { |
| 46 return getPart(relativeUri)?.publicNamespace; |
| 47 } |
| 48 |
| 49 linked = new LinkedLibrary.fromBuffer(prelink( |
| 50 linkerInputs.unlinkedDefiningUnit, |
| 51 getPart, |
| 52 getImport, |
| 53 (String declaredVariable) => null).toBuffer()); |
| 54 validateLinkedLibrary(linked); |
| 55 } |
| 56 } |
| OLD | NEW |