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