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

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

Issue 1409033005: Add @anonymous annotation and restrict object literal constructors to only anonymous classes. This … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ptal Created 5 years, 1 month 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend_helpers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 INVALID_RECEIVER_IN_INITIALIZER, 271 INVALID_RECEIVER_IN_INITIALIZER,
272 INVALID_SOURCE_FILE_LOCATION, 272 INVALID_SOURCE_FILE_LOCATION,
273 INVALID_SYMBOL, 273 INVALID_SYMBOL,
274 INVALID_SYNC_MODIFIER, 274 INVALID_SYNC_MODIFIER,
275 INVALID_TYPE_VARIABLE_BOUND, 275 INVALID_TYPE_VARIABLE_BOUND,
276 INVALID_UNNAMED_CONSTRUCTOR_NAME, 276 INVALID_UNNAMED_CONSTRUCTOR_NAME,
277 INVALID_URI, 277 INVALID_URI,
278 INVALID_USE_OF_SUPER, 278 INVALID_USE_OF_SUPER,
279 JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, 279 JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS,
280 JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER, 280 JS_INTEROP_CLASS_NON_EXTERNAL_MEMBER,
281 JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
282 JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
281 LIBRARY_NAME_MISMATCH, 283 LIBRARY_NAME_MISMATCH,
282 LIBRARY_NOT_FOUND, 284 LIBRARY_NOT_FOUND,
283 LIBRARY_NOT_SUPPORTED, 285 LIBRARY_NOT_SUPPORTED,
284 LIBRARY_TAG_MUST_BE_FIRST, 286 LIBRARY_TAG_MUST_BE_FIRST,
285 MAIN_NOT_A_FUNCTION, 287 MAIN_NOT_A_FUNCTION,
286 MAIN_WITH_EXTRA_PARAMETER, 288 MAIN_WITH_EXTRA_PARAMETER,
287 MALFORMED_STRING_LITERAL, 289 MALFORMED_STRING_LITERAL,
288 MEMBER_NOT_FOUND, 290 MEMBER_NOT_FOUND,
289 MEMBER_NOT_STATIC, 291 MEMBER_NOT_STATIC,
290 MEMBER_USES_CLASS_NAME, 292 MEMBER_USES_CLASS_NAME,
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 @JS() 2167 @JS()
2166 class Foo { 2168 class Foo {
2167 bar() {} 2169 bar() {}
2168 } 2170 }
2169 2171
2170 main() { 2172 main() {
2171 new Foo().bar(); 2173 new Foo().bar();
2172 } 2174 }
2173 """]), 2175 """]),
2174 2176
2177 MessageKind.JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS:
2178 const MessageTemplate(
2179 MessageKind.JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
2180 "Js-interop method '#{method}' has named arguments but is not "
2181 "a factory constructor of an @anonymous @JS class.",
2182 howToFix: "Remove all named arguments from js-interop method or "
2183 "in the case of a factory constructor annotate the class "
2184 "as @anonymous.",
2185 examples: const [
2186 """
2187 import 'package:js/js.dart';
2188
2189 @JS()
2190 class Foo {
2191 external bar(foo, {baz});
2192 }
2193
2194 main() {
2195 new Foo().bar(4, baz: 5);
2196 }
2197 """]),
2198
2199 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS:
2200 const MessageTemplate(
2201 MessageKind.JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
2202 "Parameter '#{parameter}' in anonymous js-interop class '#{cls}' "
2203 "object literal constructor is positional instead of named."
2204 ".",
2205 howToFix: "Make all arguments in external factory object literal "
2206 "constructors named.",
2207 examples: const [
2208 """
2209 import 'package:js/js.dart';
2210
2211 @anonymous
2212 @JS()
2213 class Foo {
2214 external factory Foo(foo, {baz});
2215 }
2216
2217 main() {
2218 new Foo(5, baz: 5);
2219 }
2220 """]),
2221
2175 MessageKind.LIBRARY_NOT_FOUND: 2222 MessageKind.LIBRARY_NOT_FOUND:
2176 const MessageTemplate(MessageKind.LIBRARY_NOT_FOUND, 2223 const MessageTemplate(MessageKind.LIBRARY_NOT_FOUND,
2177 "Library not found '#{resolvedUri}'."), 2224 "Library not found '#{resolvedUri}'."),
2178 2225
2179 MessageKind.LIBRARY_NOT_SUPPORTED: 2226 MessageKind.LIBRARY_NOT_SUPPORTED:
2180 const MessageTemplate(MessageKind.LIBRARY_NOT_SUPPORTED, 2227 const MessageTemplate(MessageKind.LIBRARY_NOT_SUPPORTED,
2181 "Library not supported '#{resolvedUri}'.", 2228 "Library not supported '#{resolvedUri}'.",
2182 howToFix: "Try removing the dependency or enabling support using " 2229 howToFix: "Try removing the dependency or enabling support using "
2183 "the '--categories' option.", 2230 "the '--categories' option.",
2184 examples: const [/* 2231 examples: const [/*
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3507 static String convertToString(value) { 3554 static String convertToString(value) {
3508 if (value is ErrorToken) { 3555 if (value is ErrorToken) {
3509 // Shouldn't happen. 3556 // Shouldn't happen.
3510 return value.assertionMessage; 3557 return value.assertionMessage;
3511 } else if (value is Token) { 3558 } else if (value is Token) {
3512 value = value.value; 3559 value = value.value;
3513 } 3560 }
3514 return '$value'; 3561 return '$value';
3515 } 3562 }
3516 } 3563 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698