OLD | NEW |
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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 class MessageKind { | 7 class MessageKind { |
8 final String template; | 8 final String template; |
9 const MessageKind(this.template); | 9 const MessageKind(this.template); |
10 | 10 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 'Error: directive not allowed here.'); | 353 'Error: directive not allowed here.'); |
354 | 354 |
355 static const DUPLICATED_LIBRARY_NAME = const MessageKind( | 355 static const DUPLICATED_LIBRARY_NAME = const MessageKind( |
356 'Warning: duplicated library name "#{libraryName}".'); | 356 'Warning: duplicated library name "#{libraryName}".'); |
357 | 357 |
358 static const INVALID_SOURCE_FILE_LOCATION = const MessageKind(''' | 358 static const INVALID_SOURCE_FILE_LOCATION = const MessageKind(''' |
359 Invalid offset (#{offset}) in source map. | 359 Invalid offset (#{offset}) in source map. |
360 File: #{fileName} | 360 File: #{fileName} |
361 Length: #{length}'''); | 361 Length: #{length}'''); |
362 | 362 |
363 static const PATCH_RETURN_TYPE_MISMATCH = const MessageKind( | |
364 "Patch return type '#{patchReturnType}' doesn't match " | |
365 "'#{originReturnType}' on origin method '#{methodName}'."); | |
366 | |
367 static const PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH = const MessageKind( | |
368 "Required parameter count of patch method (#{patchParameterCount}) " | |
369 "doesn't match parameter count on origin method '#{methodName}' " | |
370 "(#{originParameterCount})."); | |
371 | |
372 static const PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH = const MessageKind( | |
373 "Optional parameter count of patch method (#{patchParameterCount}) " | |
374 "doesn't match parameter count on origin method '#{methodName}' " | |
375 "(#{originParameterCount})."); | |
376 | |
377 static const PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH = const MessageKind( | |
378 "Optional parameters of origin and patch method '#{methodName}' must " | |
379 "both be either named or positional."); | |
380 | |
381 static const PATCH_PARAMETER_MISMATCH = const MessageKind( | |
382 "Patch method parameter '#{patchParameter}' doesn't match " | |
383 "'#{originParameter}' on origin method #{methodName}."); | |
384 | |
385 static const EXTERNAL_WITHOUT_IMPLEMENTATION = const MessageKind( | |
386 "External method without an implementation."); | |
387 | |
388 static const TOP_LEVEL_VARIABLE_DECLARED_STATIC = const MessageKind( | 363 static const TOP_LEVEL_VARIABLE_DECLARED_STATIC = const MessageKind( |
389 "Top-level variable cannot be declared static."); | 364 "Top-level variable cannot be declared static."); |
390 | 365 |
391 static const WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = const MessageKind( | 366 static const WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = const MessageKind( |
392 "Wrong number of arguments to assert. Should be 1, but given " | 367 "Wrong number of arguments to assert. Should be 1, but given " |
393 "#{argumentCount}."); | 368 "#{argumentCount}."); |
394 | 369 |
395 static const ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( | 370 static const ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( |
396 "assert takes no named arguments, but given #{argumentCount}."); | 371 "assert takes no named arguments, but given #{argumentCount}."); |
397 | 372 |
(...skipping 19 matching lines...) Expand all Loading... |
417 Please include the following information: | 392 Please include the following information: |
418 | 393 |
419 * the name and version of your operating system, | 394 * the name and version of your operating system, |
420 | 395 |
421 * the Dart SDK build number (#{buildId}), and | 396 * the Dart SDK build number (#{buildId}), and |
422 | 397 |
423 * the entire message you see here (including the full stack trace | 398 * the entire message you see here (including the full stack trace |
424 below as well as the source location above). | 399 below as well as the source location above). |
425 '''); | 400 '''); |
426 | 401 |
| 402 |
| 403 ////////////////////////////////////////////////////////////////////////////// |
| 404 // Patch errors start. |
| 405 ////////////////////////////////////////////////////////////////////////////// |
| 406 |
| 407 static const PATCH_RETURN_TYPE_MISMATCH = const MessageKind( |
| 408 "Patch return type '#{patchReturnType}' doesn't match " |
| 409 "'#{originReturnType}' on origin method '#{methodName}'."); |
| 410 |
| 411 static const PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH = const MessageKind( |
| 412 "Required parameter count of patch method (#{patchParameterCount}) " |
| 413 "doesn't match parameter count on origin method '#{methodName}' " |
| 414 "(#{originParameterCount})."); |
| 415 |
| 416 static const PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH = const MessageKind( |
| 417 "Optional parameter count of patch method (#{patchParameterCount}) " |
| 418 "doesn't match parameter count on origin method '#{methodName}' " |
| 419 "(#{originParameterCount})."); |
| 420 |
| 421 static const PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH = const MessageKind( |
| 422 "Optional parameters of origin and patch method '#{methodName}' must " |
| 423 "both be either named or positional."); |
| 424 |
| 425 static const PATCH_PARAMETER_MISMATCH = const MessageKind( |
| 426 "Patch method parameter '#{patchParameter}' doesn't match " |
| 427 "'#{originParameter}' on origin method #{methodName}."); |
| 428 |
| 429 static const PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION = const MessageKind( |
| 430 "External method without an implementation."); |
| 431 |
| 432 static const PATCH_POINT_TO_FUNCTION = const MessageKind( |
| 433 "Info: This is the function patch '#{functionName}'."); |
| 434 |
| 435 static const PATCH_POINT_TO_CLASS = const MessageKind( |
| 436 "Info: This is the class patch '#{className}'."); |
| 437 |
| 438 static const PATCH_POINT_TO_GETTER = const MessageKind( |
| 439 "Info: This is the getter patch '#{getterName}'."); |
| 440 |
| 441 static const PATCH_POINT_TO_SETTER = const MessageKind( |
| 442 "Info: This is the setter patch '#{setterName}'."); |
| 443 |
| 444 static const PATCH_POINT_TO_CONSTRUCTOR = const MessageKind( |
| 445 "Info: This is the constructor patch '#{constructorName}'."); |
| 446 |
| 447 static const PATCH_NON_EXISTING = const MessageKind( |
| 448 "Error: Origin does not exist for patch '#{name}'."); |
| 449 |
| 450 static const PATCH_NONPATCHABLE = const MessageKind( |
| 451 "Error: Only classes and functions can be patched."); |
| 452 |
| 453 static const PATCH_NON_EXTERNAL = const MessageKind( |
| 454 "Error: Only external functions can be patched."); |
| 455 |
| 456 static const PATCH_NON_CLASS = const MessageKind( |
| 457 "Error: Patching non-class with class patch '#{className}'."); |
| 458 |
| 459 static const PATCH_NON_GETTER = const MessageKind( |
| 460 "Error: Cannot patch non-getter '#{name}' with getter patch."); |
| 461 |
| 462 static const PATCH_NO_GETTER = const MessageKind( |
| 463 "Error: No getter found for getter patch '#{getterName}'."); |
| 464 |
| 465 static const PATCH_NON_SETTER = const MessageKind( |
| 466 "Error: Cannot patch non-setter '#{name}' with setter patch."); |
| 467 |
| 468 static const PATCH_NO_SETTER = const MessageKind( |
| 469 "Error: No setter found for setter patch '#{setterName}'."); |
| 470 |
| 471 static const PATCH_NON_CONSTRUCTOR = const MessageKind( |
| 472 "Error: Cannot patch non-constructor with constructor patch " |
| 473 "'#{constructorName}'."); |
| 474 |
| 475 static const PATCH_NON_FUNCTION = const MessageKind( |
| 476 "Error: Cannot patch non-function with function patch " |
| 477 "'#{functionName}'."); |
| 478 |
| 479 ////////////////////////////////////////////////////////////////////////////// |
| 480 // Patch errors end. |
| 481 ////////////////////////////////////////////////////////////////////////////// |
| 482 |
427 toString() => template; | 483 toString() => template; |
428 | 484 |
429 Message message([Map arguments = const {}]) { | 485 Message message([Map arguments = const {}]) { |
430 return new Message(this, arguments); | 486 return new Message(this, arguments); |
431 } | 487 } |
432 | 488 |
433 CompilationError error([Map arguments = const {}]) { | 489 CompilationError error([Map arguments = const {}]) { |
434 return new CompilationError(this, arguments); | 490 return new CompilationError(this, arguments); |
435 } | 491 } |
436 } | 492 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 557 |
502 class CompileTimeConstantError extends Diagnostic { | 558 class CompileTimeConstantError extends Diagnostic { |
503 CompileTimeConstantError(MessageKind kind, [Map arguments = const {}]) | 559 CompileTimeConstantError(MessageKind kind, [Map arguments = const {}]) |
504 : super(kind, arguments); | 560 : super(kind, arguments); |
505 } | 561 } |
506 | 562 |
507 class CompilationError extends Diagnostic { | 563 class CompilationError extends Diagnostic { |
508 CompilationError(MessageKind kind, [Map arguments = const {}]) | 564 CompilationError(MessageKind kind, [Map arguments = const {}]) |
509 : super(kind, arguments); | 565 : super(kind, arguments); |
510 } | 566 } |
OLD | NEW |