Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Side by Side Diff: tests/compiler/dart2js/embedded_category_api_boundary_test.dart

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
12 import 'package:compiler/src/compiler.dart'; 11 import 'package:compiler/src/compiler.dart';
13 import 'package:compiler/src/elements/elements.dart'; 12 import 'package:compiler/src/elements/elements.dart';
14 import 'package:sdk_library_metadata/libraries.dart'; 13 import 'package:sdk_library_metadata/libraries.dart';
15 14
16 import 'analyze_helper.dart'; 15 import 'analyze_helper.dart';
17 16
18 main() async { 17 main() async {
19 List<Uri> uriList = new List<Uri>(); 18 List<Uri> uriList = new List<Uri>();
20 libraries.forEach((String name, LibraryInfo info) { 19 libraries.forEach((String name, LibraryInfo info) {
21 if (info.categories.contains(Category.embedded)) { 20 if (info.categories.contains(Category.embedded)) {
22 uriList.add(new Uri(scheme: 'dart', path: name)); 21 uriList.add(new Uri(scheme: 'dart', path: name));
23 } 22 }
24 }); 23 });
25 asyncTest(() async { 24 asyncTest(() async {
26 await analyze(uriList, {}, 25 await analyze(uriList, {},
27 checkResults: checkResults, mode: AnalysisMode.MAIN); 26 checkResults: checkResults, mode: AnalysisMode.MAIN);
28 }); 27 });
29 } 28 }
30 29
31 /// These elements are currently escaping from dart:async via 30 /// These elements are currently escaping from dart:async via
32 /// `core._Resource#_readAsStream`. 31 /// `core._Resource#_readAsStream`.
33 Set<String> whiteList = new Set.from([ 32 Set<String> whiteList = new Set.from([
34 "function(StreamController#addError)", 33 "function(StreamController#addError)",
35 "getter(StreamController#stream)", 34 "getter(StreamController#stream)",
36 "setter(StreamController#onListen)" 35 "setter(StreamController#onListen)"
37 ]); 36 ]);
38 37
39 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) { 38 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) {
40 return compiler.enqueuer.resolution.processedEntities 39 return compiler.enqueuer.resolution.processedEntities.every((_element) {
41 .every((MemberElement element) { 40 MemberElement element = _element;
42 if (whiteList.contains("$element")) return true; 41 if (whiteList.contains("$element")) return true;
43 LibraryInfo info = libraries[element.library.canonicalUri.path]; 42 LibraryInfo info = libraries[element.library.canonicalUri.path];
44 bool isAllowedInEmbedded = 43 bool isAllowedInEmbedded =
45 info.isInternal || info.categories.contains(Category.embedded); 44 info.isInternal || info.categories.contains(Category.embedded);
46 if (!isAllowedInEmbedded) { 45 if (!isAllowedInEmbedded) {
47 print( 46 print(
48 'Disallowed element: $element from ${element.library.canonicalUri}'); 47 'Disallowed element: $element from ${element.library.canonicalUri}');
49 } 48 }
50 return isAllowedInEmbedded; 49 return isAllowedInEmbedded;
51 }); 50 });
52 } 51 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/diagnostic_reporter_helper.dart ('k') | tests/compiler/dart2js/equivalence/check_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698