OLD | NEW |
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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 /// Tests that analyzing everything from the libraries that are public from the | 5 /// Tests that analyzing everything from the libraries that are public from the |
6 /// embedded category does not cause elements from other libraries to be | 6 /// embedded category does not cause elements from other libraries to be |
7 /// processed. | 7 /// processed. |
8 library embedded_category_boundary_test; | 8 library embedded_category_boundary_test; |
9 | 9 |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// These elements are currently escaping from dart:async via | 31 /// These elements are currently escaping from dart:async via |
32 /// `core._Resource#_readAsStream`. | 32 /// `core._Resource#_readAsStream`. |
33 Set<String> whiteList = new Set.from([ | 33 Set<String> whiteList = new Set.from([ |
34 "function(StreamController#addError)", | 34 "function(StreamController#addError)", |
35 "getter(StreamController#stream)", | 35 "getter(StreamController#stream)", |
36 "setter(StreamController#onListen)" | 36 "setter(StreamController#onListen)" |
37 ]); | 37 ]); |
38 | 38 |
39 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) { | 39 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) { |
40 return compiler.enqueuer.resolution.processedEntities | 40 return compiler.enqueuer.resolution.processedEntities |
41 .every((Element element) { | 41 .every((MemberElement element) { |
42 if (whiteList.contains("$element")) return true; | 42 if (whiteList.contains("$element")) return true; |
43 LibraryInfo info = libraries[element.library.canonicalUri.path]; | 43 LibraryInfo info = libraries[element.library.canonicalUri.path]; |
44 bool isAllowedInEmbedded = | 44 bool isAllowedInEmbedded = |
45 info.isInternal || info.categories.contains(Category.embedded); | 45 info.isInternal || info.categories.contains(Category.embedded); |
46 if (!isAllowedInEmbedded) { | 46 if (!isAllowedInEmbedded) { |
47 print( | 47 print( |
48 'Disallowed element: $element from ${element.library.canonicalUri}'); | 48 'Disallowed element: $element from ${element.library.canonicalUri}'); |
49 } | 49 } |
50 return isAllowedInEmbedded; | 50 return isAllowedInEmbedded; |
51 }); | 51 }); |
52 } | 52 } |
OLD | NEW |