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

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

Issue 13084013: Handle assignability for Send and SendSet (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Debug code removed. Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 analyze_api; 5 library analyze_api;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:uri'; 8 import 'dart:uri';
9 import 'dart:io'; 9 import 'dart:io';
10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
11 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; 11 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart';
12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' 12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
13 hide Compiler; 13 hide Compiler;
14 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; 14 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
15 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider. dart'; 15 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider. dart';
16 import '../../../sdk/lib/_internal/libraries.dart'; 16 import '../../../sdk/lib/_internal/libraries.dart';
17 17
18 /** 18 /**
19 * Map of white-listed warnings and errors. 19 * Map of white-listed warnings and errors.
20 * 20 *
21 * Only add a white-listing together with a bug report to dartbug.com and add 21 * Only add a white-listing together with a bug report to dartbug.com and add
22 * the bug issue number as a comment on the white-listing. 22 * the bug issue number as a comment on the white-listing.
23 * 23 *
24 * Use an identifiable suffix of the file uri as key. Use a fixed substring of 24 * Use an identifiable suffix of the file uri as key. Use a fixed substring of
25 * the error/warning message in the list of white-listings for each file. 25 * the error/warning message in the list of white-listings for each file.
26 */ 26 */
27 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as 27 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as
28 // values. 28 // values.
29 const Map<String,List<String>> WHITE_LIST = const { 29 const Map<String,List<String>> WHITE_LIST = const {
30 'html_dart2js.dart': const ['Warning: Using "new Symbol"', // Issue 10565. 30 'html_dart2js.dart':
31 'Warning: unreachable code'], // Issue 10617. 31 const ['Warning: Using "new Symbol"', // Issue 10565.
32 'Warning: unreachable code', // Issue 10617.
33 // Issue 10688:
34 'Warning: no property named',
35 'Warning: WindowBase is not assignable to EventTarget',
36 "Warning: 'UnsupportedError' is not callable",
37 "Warning: no method named getBoundingClientRect",
38 "Warning: no operator [] in class Iterable"],
32 }; 39 };
33 40
34 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { 41 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler {
35 bool hasWarnings = false; 42 bool hasWarnings = false;
36 bool hasErrors = false; 43 bool hasErrors = false;
37 44
38 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>(); 45 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>();
39 46
40 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) { 47 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) {
41 WHITE_LIST.forEach((String file, List<String> messageParts) { 48 WHITE_LIST.forEach((String file, List<String> messageParts) {
(...skipping 30 matching lines...) Expand all
72 } 79 }
73 80
74 bool checkWhiteList(Uri uri, String message) { 81 bool checkWhiteList(Uri uri, String message) {
75 if (uri == null) { 82 if (uri == null) {
76 return false; 83 return false;
77 } 84 }
78 String path = uri.path; 85 String path = uri.path;
79 for (String file in whiteListMap.keys) { 86 for (String file in whiteListMap.keys) {
80 if (path.endsWith(file)) { 87 if (path.endsWith(file)) {
81 for (String messagePart in whiteListMap[file].keys) { 88 for (String messagePart in whiteListMap[file].keys) {
82 if (message.contains(messagePart)) { 89 if (message != null && message.contains(messagePart)) {
karlklose 2013/05/17 09:36:53 Where are empty messages coming from? Is this nece
Johnni Winther 2013/05/17 11:46:33 Not anymore. Removed.
83 whiteListMap[file][messagePart]++; 90 whiteListMap[file][messagePart]++;
84 return true; 91 return true;
85 } 92 }
86 } 93 }
87 } 94 }
88 } 95 }
89 return false; 96 return false;
90 } 97 }
91 98
92 void diagnosticHandler(Uri uri, int begin, int end, String message, 99 void diagnosticHandler(Uri uri, int begin, int end, String message,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 libraryRoot, libraryRoot, 133 libraryRoot, libraryRoot,
127 <String>['--analyze-only', '--analyze-all', 134 <String>['--analyze-only', '--analyze-all',
128 '--categories=Client,Server']); 135 '--categories=Client,Server']);
129 compiler.librariesToAnalyzeWhenRun = uriList; 136 compiler.librariesToAnalyzeWhenRun = uriList;
130 compiler.run(null); 137 compiler.run(null);
131 Expect.isFalse(handler.hasWarnings); 138 Expect.isFalse(handler.hasWarnings);
132 Expect.isFalse(handler.hasErrors); 139 Expect.isFalse(handler.hasErrors);
133 Expect.isTrue(handler.checkWhiteListUse()); 140 Expect.isTrue(handler.checkWhiteListUse());
134 handler.reportWhiteListUse(); 141 handler.reportWhiteListUse();
135 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698