| 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 library analyzer.test.src.summary.prelinker_test; | 5 library analyzer.test.src.summary.prelinker_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/utilities_dart.dart'; | |
| 8 import 'package:analyzer/src/summary/format.dart'; | |
| 9 import 'package:analyzer/src/summary/idl.dart'; | 7 import 'package:analyzer/src/summary/idl.dart'; |
| 10 import 'package:analyzer/src/summary/prelink.dart'; | 8 import 'package:analyzer/src/summary/prelink.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 | 10 |
| 13 import 'summarize_ast_test.dart'; | 11 import 'summarize_ast_test.dart'; |
| 14 import 'summary_common.dart'; | 12 import 'summary_common.dart'; |
| 15 | 13 |
| 16 main() { | 14 main() { |
| 17 defineReflectiveSuite(() { | 15 defineReflectiveSuite(() { |
| 18 defineReflectiveTests(PrelinkerTest); | 16 defineReflectiveTests(PrelinkerTest); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 @override | 27 @override |
| 30 bool get skipFullyLinkedData => true; | 28 bool get skipFullyLinkedData => true; |
| 31 | 29 |
| 32 @override | 30 @override |
| 33 bool get strongMode => false; | 31 bool get strongMode => false; |
| 34 | 32 |
| 35 @override | 33 @override |
| 36 void serializeLibraryText(String text, {bool allowErrors: false}) { | 34 void serializeLibraryText(String text, {bool allowErrors: false}) { |
| 37 super.serializeLibraryText(text, allowErrors: allowErrors); | 35 super.serializeLibraryText(text, allowErrors: allowErrors); |
| 38 | 36 |
| 39 UnlinkedUnit getPart(String relativeUriStr) { | 37 UnlinkedUnit getPart(String absoluteUri) { |
| 40 Uri relativeUri; | |
| 41 try { | |
| 42 relativeUri = Uri.parse(relativeUriStr); | |
| 43 } on FormatException { | |
| 44 return new UnlinkedUnitBuilder(); | |
| 45 } | |
| 46 | |
| 47 String absoluteUri = | |
| 48 resolveRelativeUri(linkerInputs.testDartUri, relativeUri).toString(); | |
| 49 return linkerInputs.getUnit(absoluteUri); | 38 return linkerInputs.getUnit(absoluteUri); |
| 50 } | 39 } |
| 51 | 40 |
| 52 UnlinkedPublicNamespace getImport(String relativeUri) { | 41 UnlinkedPublicNamespace getImport(String absoluteUri) { |
| 53 return getPart(relativeUri)?.publicNamespace; | 42 return getPart(absoluteUri)?.publicNamespace; |
| 54 } | 43 } |
| 55 | 44 |
| 56 linked = new LinkedLibrary.fromBuffer(prelink( | 45 linked = new LinkedLibrary.fromBuffer(prelink( |
| 46 linkerInputs.testDartUri.toString(), |
| 57 linkerInputs.unlinkedDefiningUnit, | 47 linkerInputs.unlinkedDefiningUnit, |
| 58 getPart, | 48 getPart, |
| 59 getImport, | 49 getImport, |
| 60 (String declaredVariable) => null).toBuffer()); | 50 (String declaredVariable) => null).toBuffer()); |
| 61 validateLinkedLibrary(linked); | 51 validateLinkedLibrary(linked); |
| 62 } | 52 } |
| 63 } | 53 } |
| OLD | NEW |