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

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

Issue 1651933002: Report error on JS-interop operator [] and []= methods. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Sort MessageKinds. Created 4 years, 10 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 INVALID_SOURCE_FILE_LOCATION, 283 INVALID_SOURCE_FILE_LOCATION,
284 INVALID_SYMBOL, 284 INVALID_SYMBOL,
285 INVALID_SYNC_MODIFIER, 285 INVALID_SYNC_MODIFIER,
286 INVALID_TYPE_VARIABLE_BOUND, 286 INVALID_TYPE_VARIABLE_BOUND,
287 INVALID_UNNAMED_CONSTRUCTOR_NAME, 287 INVALID_UNNAMED_CONSTRUCTOR_NAME,
288 INVALID_URI, 288 INVALID_URI,
289 INVALID_USE_OF_SUPER, 289 INVALID_USE_OF_SUPER,
290 INVALID_YIELD, 290 INVALID_YIELD,
291 JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, 291 JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS,
292 JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER, 292 JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER,
293 JS_INTEROP_INDEX_NOT_SUPPORTED,
294 JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
293 JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS, 295 JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
294 JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
295 JS_PLACEHOLDER_CAPTURE, 296 JS_PLACEHOLDER_CAPTURE,
296 LIBRARY_NAME_MISMATCH, 297 LIBRARY_NAME_MISMATCH,
297 LIBRARY_NOT_FOUND, 298 LIBRARY_NOT_FOUND,
298 LIBRARY_NOT_SUPPORTED, 299 LIBRARY_NOT_SUPPORTED,
299 LIBRARY_TAG_MUST_BE_FIRST, 300 LIBRARY_TAG_MUST_BE_FIRST,
300 MAIN_HAS_PART_OF, 301 MAIN_HAS_PART_OF,
301 MAIN_NOT_A_FUNCTION, 302 MAIN_NOT_A_FUNCTION,
302 MAIN_WITH_EXTRA_PARAMETER, 303 MAIN_WITH_EXTRA_PARAMETER,
303 MALFORMED_STRING_LITERAL, 304 MALFORMED_STRING_LITERAL,
304 MEMBER_NOT_FOUND, 305 MEMBER_NOT_FOUND,
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 2330
2330 @JS() 2331 @JS()
2331 class Foo { 2332 class Foo {
2332 external bar(foo, {baz}); 2333 external bar(foo, {baz});
2333 } 2334 }
2334 2335
2335 main() { 2336 main() {
2336 new Foo().bar(4, baz: 5); 2337 new Foo().bar(4, baz: 5);
2337 } 2338 }
2338 """]), 2339 """]),
2340 MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED:
2341 const MessageTemplate(
2342 MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED,
2343 "Js-interop does not support [] and []= operator methods.",
2344 howToFix: "Try replacing [] and []= operator methods with normal "
2345 "methods.",
2346 examples: const [
2347 """
2348 import 'package:js/js.dart';
2349
2350 @JS()
2351 class Foo {
2352 external operator [](arg);
2353 }
2354
2355 main() {
2356 new Foo()[0];
2357 }
2358 """, """
2359 import 'package:js/js.dart';
2360
2361 @JS()
2362 class Foo {
2363 external operator []=(arg, value);
2364 }
2365
2366 main() {
2367 new Foo()[0] = 1;
2368 }
2369 """]),
2339 2370
2340 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS: 2371 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS:
2341 const MessageTemplate( 2372 const MessageTemplate(
2342 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS, 2373 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
2343 "Parameter '#{parameter}' in anonymous js-interop class '#{cls}' " 2374 "Parameter '#{parameter}' in anonymous js-interop class '#{cls}' "
2344 "object literal constructor is positional instead of named." 2375 "object literal constructor is positional instead of named."
2345 ".", 2376 ".",
2346 howToFix: "Make all arguments in external factory object literal " 2377 howToFix: "Make all arguments in external factory object literal "
2347 "constructors named.", 2378 "constructors named.",
2348 examples: const [ 2379 examples: const [
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 static String convertToString(value) { 3757 static String convertToString(value) {
3727 if (value is ErrorToken) { 3758 if (value is ErrorToken) {
3728 // Shouldn't happen. 3759 // Shouldn't happen.
3729 return value.assertionMessage; 3760 return value.assertionMessage;
3730 } else if (value is Token) { 3761 } else if (value is Token) {
3731 value = value.value; 3762 value = value.value;
3732 } 3763 }
3733 return '$value'; 3764 return '$value';
3734 } 3765 }
3735 } 3766 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698