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

Side by Side Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 1338783002: Show import chains for unsupported dart:* library imports. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup. Created 5 years, 3 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 5
6 /** 6 /**
7 * The messages in this file should meet the following guide lines: 7 * The messages in this file should meet the following guide lines:
8 * 8 *
9 * 1. The message should be a complete sentence starting with an uppercase 9 * 1. The message should be a complete sentence starting with an uppercase
10 * letter, and ending with a period. 10 * letter, and ending with a period.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 DART_EXT_NOT_SUPPORTED, 159 DART_EXT_NOT_SUPPORTED,
160 DEFERRED_COMPILE_TIME_CONSTANT, 160 DEFERRED_COMPILE_TIME_CONSTANT,
161 DEFERRED_COMPILE_TIME_CONSTANT_CONSTRUCTION, 161 DEFERRED_COMPILE_TIME_CONSTANT_CONSTRUCTION,
162 DEFERRED_LIBRARY_DART_2_DART, 162 DEFERRED_LIBRARY_DART_2_DART,
163 DEFERRED_LIBRARY_DUPLICATE_PREFIX, 163 DEFERRED_LIBRARY_DUPLICATE_PREFIX,
164 DEFERRED_LIBRARY_WITHOUT_PREFIX, 164 DEFERRED_LIBRARY_WITHOUT_PREFIX,
165 DEFERRED_OLD_SYNTAX, 165 DEFERRED_OLD_SYNTAX,
166 DEFERRED_TYPE_ANNOTATION, 166 DEFERRED_TYPE_ANNOTATION,
167 DEPRECATED_TYPEDEF_MIXIN_SYNTAX, 167 DEPRECATED_TYPEDEF_MIXIN_SYNTAX,
168 DIRECTLY_THROWING_NSM, 168 DIRECTLY_THROWING_NSM,
169 DISALLOWED_LIBRARY_IMPORT,
169 DUPLICATE_DEFINITION, 170 DUPLICATE_DEFINITION,
170 DUPLICATE_EXPORT, 171 DUPLICATE_EXPORT,
171 DUPLICATE_EXPORT_CONT, 172 DUPLICATE_EXPORT_CONT,
172 DUPLICATE_EXPORT_DECL, 173 DUPLICATE_EXPORT_DECL,
173 DUPLICATE_EXTENDS_IMPLEMENTS, 174 DUPLICATE_EXTENDS_IMPLEMENTS,
174 DUPLICATE_IMPLEMENTS, 175 DUPLICATE_IMPLEMENTS,
175 DUPLICATE_IMPORT, 176 DUPLICATE_IMPORT,
176 DUPLICATE_INITIALIZER, 177 DUPLICATE_INITIALIZER,
177 DUPLICATE_LABEL, 178 DUPLICATE_LABEL,
178 DUPLICATE_SUPER_INITIALIZER, 179 DUPLICATE_SUPER_INITIALIZER,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 INVALID_RECEIVER_IN_INITIALIZER, 267 INVALID_RECEIVER_IN_INITIALIZER,
267 INVALID_SOURCE_FILE_LOCATION, 268 INVALID_SOURCE_FILE_LOCATION,
268 INVALID_SYMBOL, 269 INVALID_SYMBOL,
269 INVALID_SYNC_MODIFIER, 270 INVALID_SYNC_MODIFIER,
270 INVALID_TYPE_VARIABLE_BOUND, 271 INVALID_TYPE_VARIABLE_BOUND,
271 INVALID_UNNAMED_CONSTRUCTOR_NAME, 272 INVALID_UNNAMED_CONSTRUCTOR_NAME,
272 INVALID_URI, 273 INVALID_URI,
273 INVALID_USE_OF_SUPER, 274 INVALID_USE_OF_SUPER,
274 LIBRARY_NAME_MISMATCH, 275 LIBRARY_NAME_MISMATCH,
275 LIBRARY_NOT_FOUND, 276 LIBRARY_NOT_FOUND,
277 LIBRARY_NOT_SUPPORTED,
276 LIBRARY_TAG_MUST_BE_FIRST, 278 LIBRARY_TAG_MUST_BE_FIRST,
277 MAIN_NOT_A_FUNCTION, 279 MAIN_NOT_A_FUNCTION,
278 MAIN_WITH_EXTRA_PARAMETER, 280 MAIN_WITH_EXTRA_PARAMETER,
279 MALFORMED_STRING_LITERAL, 281 MALFORMED_STRING_LITERAL,
280 MEMBER_NOT_FOUND, 282 MEMBER_NOT_FOUND,
281 MEMBER_NOT_STATIC, 283 MEMBER_NOT_STATIC,
282 MEMBER_USES_CLASS_NAME, 284 MEMBER_USES_CLASS_NAME,
283 METHOD_NOT_FOUND, 285 METHOD_NOT_FOUND,
284 MINUS_OPERATOR_BAD_ARITY, 286 MINUS_OPERATOR_BAD_ARITY,
285 MIRROR_BLOAT, 287 MIRROR_BLOAT,
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 "'#{importingUri}'."), 2090 "'#{importingUri}'."),
2089 2091
2090 MessageKind.INTERNAL_LIBRARY: 2092 MessageKind.INTERNAL_LIBRARY:
2091 const MessageTemplate(MessageKind.INTERNAL_LIBRARY, 2093 const MessageTemplate(MessageKind.INTERNAL_LIBRARY,
2092 "Internal library '#{resolvedUri}' is not accessible."), 2094 "Internal library '#{resolvedUri}' is not accessible."),
2093 2095
2094 MessageKind.LIBRARY_NOT_FOUND: 2096 MessageKind.LIBRARY_NOT_FOUND:
2095 const MessageTemplate(MessageKind.LIBRARY_NOT_FOUND, 2097 const MessageTemplate(MessageKind.LIBRARY_NOT_FOUND,
2096 "Library not found '#{resolvedUri}'."), 2098 "Library not found '#{resolvedUri}'."),
2097 2099
2100 MessageKind.LIBRARY_NOT_SUPPORTED:
2101 const MessageTemplate(MessageKind.LIBRARY_NOT_SUPPORTED,
2102 "Library not supported '#{resolvedUri}'.",
2103 howToFix: "Try removing the dependency or enabling support using "
2104 "the '--categories' option.",
2105 examples: const [/*
2106 """
2107 import 'dart:io';
2108 main() {}
2109 """
2110 */]),
2111 // TODO(johnniwinther): Enable example when message_kind_test.dart
2112 // supports library loader callbacks.
2113
2098 MessageKind.UNSUPPORTED_EQ_EQ_EQ: 2114 MessageKind.UNSUPPORTED_EQ_EQ_EQ:
2099 const MessageTemplate(MessageKind.UNSUPPORTED_EQ_EQ_EQ, 2115 const MessageTemplate(MessageKind.UNSUPPORTED_EQ_EQ_EQ,
2100 "'===' is not an operator. " 2116 "'===' is not an operator. "
2101 "Did you mean '#{lhs} == #{rhs}' or 'identical(#{lhs}, #{rhs})'?"), 2117 "Did you mean '#{lhs} == #{rhs}' or 'identical(#{lhs}, #{rhs})'?"),
2102 2118
2103 MessageKind.UNSUPPORTED_BANG_EQ_EQ: 2119 MessageKind.UNSUPPORTED_BANG_EQ_EQ:
2104 const MessageTemplate(MessageKind.UNSUPPORTED_BANG_EQ_EQ, 2120 const MessageTemplate(MessageKind.UNSUPPORTED_BANG_EQ_EQ,
2105 "'!==' is not an operator. " 2121 "'!==' is not an operator. "
2106 "Did you mean '#{lhs} != #{rhs}' or '!identical(#{lhs}, #{rhs})'?"), 2122 "Did you mean '#{lhs} != #{rhs}' or '!identical(#{lhs}, #{rhs})'?"),
2107 2123
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 $IMPORT_EXPERIMENTAL_MIRRORS_PADDING#{importChain} 3283 $IMPORT_EXPERIMENTAL_MIRRORS_PADDING#{importChain}
3268 * 3284 *
3269 * You can disable this message by using the --enable-experimental-mirrors 3285 * You can disable this message by using the --enable-experimental-mirrors
3270 * command-line flag. 3286 * command-line flag.
3271 * 3287 *
3272 * To learn what to do next, please visit: 3288 * To learn what to do next, please visit:
3273 * http://dartlang.org/dart2js-reflection 3289 * http://dartlang.org/dart2js-reflection
3274 **************************************************************** 3290 ****************************************************************
3275 '''), 3291 '''),
3276 3292
3293 MessageKind.DISALLOWED_LIBRARY_IMPORT:
3294 const MessageTemplate(MessageKind.DISALLOWED_LIBRARY_IMPORT, r'''
3295 Your app imports the unsupported library '#{uri}' via:''''''
3296
3297 $DISALLOWED_LIBRARY_IMPORT_PADDING#{importChain}
sigurdm 2015/09/14 12:34:58 Consider reformatting
Johnni Winther 2015/09/14 13:23:39 Done.
3298
3299 Use the --categories option to support import of '#{uri}'.
3300 '''),
3277 3301
3278 MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND: 3302 MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND:
3279 const MessageTemplate( 3303 const MessageTemplate(
3280 MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND, 3304 MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND,
3281 "dart:mirrors library is not supported when using this backend."), 3305 "dart:mirrors library is not supported when using this backend."),
3282 3306
3283 MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS: 3307 MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS:
3284 const MessageTemplate(MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS, 3308 const MessageTemplate(MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS,
3285 "Non-supported 'call' member on a native class, or a " 3309 "Non-supported 'call' member on a native class, or a "
3286 "subclass of a native class."), 3310 "subclass of a native class."),
(...skipping 21 matching lines...) Expand all
3308 howToFix: "Consider removing this 'noSuchMethod' implementation."), 3332 howToFix: "Consider removing this 'noSuchMethod' implementation."),
3309 3333
3310 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP: 3334 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP:
3311 const MessageTemplate(MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP, 3335 const MessageTemplate(MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP,
3312 "Unsupported version of package:lookup_map.", 3336 "Unsupported version of package:lookup_map.",
3313 howToFix: DONT_KNOW_HOW_TO_FIX), 3337 howToFix: DONT_KNOW_HOW_TO_FIX),
3314 3338
3315 }; // End of TEMPLATES. 3339 }; // End of TEMPLATES.
3316 3340
3317 static const String IMPORT_EXPERIMENTAL_MIRRORS_PADDING = '\n* '; 3341 static const String IMPORT_EXPERIMENTAL_MIRRORS_PADDING = '\n* ';
3342 static const String DISALLOWED_LIBRARY_IMPORT_PADDING = '\n ';
3318 3343
3319 toString() => template; 3344 toString() => template;
3320 3345
3321 Message message([Map arguments = const {}, bool terse = false]) { 3346 Message message([Map arguments = const {}, bool terse = false]) {
3322 return new Message(this, arguments, terse); 3347 return new Message(this, arguments, terse);
3323 } 3348 }
3324 3349
3325 bool get hasHowToFix => howToFix != null && howToFix != DONT_KNOW_HOW_TO_FIX; 3350 bool get hasHowToFix => howToFix != null && howToFix != DONT_KNOW_HOW_TO_FIX;
3326 } 3351 }
3327 3352
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 static String convertToString(value) { 3398 static String convertToString(value) {
3374 if (value is ErrorToken) { 3399 if (value is ErrorToken) {
3375 // Shouldn't happen. 3400 // Shouldn't happen.
3376 return value.assertionMessage; 3401 return value.assertionMessage;
3377 } else if (value is Token) { 3402 } else if (value is Token) {
3378 value = value.value; 3403 value = value.value;
3379 } 3404 }
3380 return '$value'; 3405 return '$value';
3381 } 3406 }
3382 } 3407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698