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

Side by Side Diff: frog/leg/warnings.dart

Issue 9243011: Implement named constructors and resolving of redirecting constructors and super-initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move constructor name creation to lookup function. Created 8 years, 11 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) 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 class MessageKind { 5 class MessageKind {
6 final String template; 6 final String template;
7 const MessageKind(this.template); 7 const MessageKind(this.template);
8 8
9 static final GENERIC = const MessageKind('#{1}'); 9 static final GENERIC = const MessageKind('#{1}');
10 10
11 static final NOT_ASSIGNABLE = const MessageKind( 11 static final NOT_ASSIGNABLE = const MessageKind(
12 '#{2} is not assignable to #{1}'); 12 '#{2} is not assignable to #{1}');
13 static final VOID_EXPRESSION = const MessageKind( 13 static final VOID_EXPRESSION = const MessageKind(
14 'expression does not yield a value'); 14 'expression does not yield a value');
15 static final VOID_VARIABLE = const MessageKind( 15 static final VOID_VARIABLE = const MessageKind(
16 'variable cannot be of type void'); 16 'variable cannot be of type void');
17 static final RETURN_VALUE_IN_VOID = const MessageKind( 17 static final RETURN_VALUE_IN_VOID = const MessageKind(
18 'cannot return value from void function'); 18 'cannot return value from void function');
19 static final RETURN_NOTHING = const MessageKind( 19 static final RETURN_NOTHING = const MessageKind(
20 'value of type #{1} expected'); 20 'value of type #{1} expected');
21 static final MISSING_ARGUMENT = const MessageKind( 21 static final MISSING_ARGUMENT = const MessageKind(
22 'missing argument of type #{1}'); 22 'missing argument of type #{1}');
23 static final ADDITIONAL_ARGUMENT = const MessageKind( 23 static final ADDITIONAL_ARGUMENT = const MessageKind(
24 'additional argument'); 24 'additional argument');
25 static final METHOD_NOT_FOUND = const MessageKind( 25 static final METHOD_NOT_FOUND = const MessageKind(
26 'no method named #{2} in class #{1}'); 26 'no method named #{2} in class #{1}');
27 static final MEMBER_NOT_STATIC = const MessageKind( 27 static final MEMBER_NOT_STATIC = const MessageKind(
28 '#{1}.#{2} is not static'); 28 '#{1}.#{2} is not static');
29 static final NOT_STATIC = const MessageKind( 29 static final NO_INSTANCE_AVAILABLE = const MessageKind(
30 '#{1} is not static'); 30 '#{1} is only available in instance methods');
31 31
32 static final UNREACHABLE_CODE = const MessageKind( 32 static final UNREACHABLE_CODE = const MessageKind(
33 'unreachable code'); 33 'unreachable code');
34 static final MISSING_RETURN = const MessageKind( 34 static final MISSING_RETURN = const MessageKind(
35 'missing return'); 35 'missing return');
36 static final MAYBE_MISSING_RETURN = const MessageKind( 36 static final MAYBE_MISSING_RETURN = const MessageKind(
37 'not all paths lead to a return or throw statement'); 37 'not all paths lead to a return or throw statement');
38 38
39 static final CANNOT_RESOLVE = const MessageKind( 39 static final CANNOT_RESOLVE = const MessageKind(
40 'cannot resolve #{1}'); 40 'cannot resolve #{1}');
41 static final CANNOT_RESOLVE_CONSTRUCTOR = const MessageKind(
42 'cannot resolve constructor #{1}');
41 static final CANNOT_RESOLVE_TYPE = const MessageKind( 43 static final CANNOT_RESOLVE_TYPE = const MessageKind(
42 'cannot resolve type #{1}'); 44 'cannot resolve type #{1}');
43 static final DUPLICATE_DEFINITION = const MessageKind( 45 static final DUPLICATE_DEFINITION = const MessageKind(
44 'duplicate definition of #{1}'); 46 'duplicate definition of #{1}');
45 static final NOT_A_TYPE = const MessageKind( 47 static final NOT_A_TYPE = const MessageKind(
46 '#{1} is not a type'); 48 '#{1} is not a type');
47 static final NO_SUPER_IN_OBJECT = const MessageKind( 49 static final NO_SUPER_IN_OBJECT = const MessageKind(
48 '\'Object\' does not have a superclass'); 50 "'Object' does not have a superclass");
49 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind( 51 static final CANNOT_FIND_CONSTRUCTOR = const MessageKind(
50 'cannot find constructor #{1}'); 52 'cannot find constructor #{1}');
51 static final INVALID_RECEIVER_IN_INITIALIZER = const MessageKind( 53 static final INVALID_RECEIVER_IN_INITIALIZER = const MessageKind(
52 'field initializer expected'); 54 'field initializer expected');
53 static final NO_THIS_IN_STATIC = const MessageKind(
54 '\'this\' is only available in instance methods');
55 static final NO_SUPER_IN_STATIC = const MessageKind( 55 static final NO_SUPER_IN_STATIC = const MessageKind(
56 '\'super\' is only available in instance methods'); 56 "'super' is only available in instance methods");
57 static final DUPLICATE_INITIALIZER = const MessageKind( 57 static final DUPLICATE_INITIALIZER = const MessageKind(
58 'field #{1} is initialized more than once'); 58 'field #{1} is initialized more than once');
59 static final ALREADY_INITIALIZED = const MessageKind( 59 static final ALREADY_INITIALIZED = const MessageKind(
60 '#{1} was already initialized here'); 60 '#{1} was already initialized here');
61 static final INIT_STATIC_FIELD = const MessageKind( 61 static final INIT_STATIC_FIELD = const MessageKind(
62 'cannot initialize static field #{1}'); 62 'cannot initialize static field #{1}');
63 static final NOT_A_FIELD = const MessageKind( 63 static final NOT_A_FIELD = const MessageKind(
64 '#{1} is not a field'); 64 '#{1} is not a field');
65 static final CONSTRUCTOR_CALL_EXPECTED = const MessageKind(
66 "only call to 'this' or 'super' constructor allowed");
65 static final INVALID_FOR_IN = const MessageKind( 67 static final INVALID_FOR_IN = const MessageKind(
66 'Invalid for-in variable declaration.'); 68 'Invalid for-in variable declaration.');
69 static final REDIRECTING_CTOR_HAS_INITIALIZER = const MessageKind(
70 'redirecting constructor cannot have other initializers');
71 static final SUPER_INITIALIZER_IN_OBJECT = const MessageKind(
72 "'Object' cannot have a super initializer");
73 static final DUPLICATE_SUPER_INITIALIZER = const MessageKind(
74 'cannot have more than one super initializer');
75 static final NO_MATCHING_CONSTRUCTOR = const MessageKind(
76 'no matching constructor found');
77 static final NO_CONSTRUCTOR = const MessageKind(
78 '#{1} is a #{2}, not a constructor');
67 79
68 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( 80 static final NOT_A_COMPILE_TIME_CONSTANT = const MessageKind(
69 '#{1} cannot be used as compile-time constant.'); 81 '#{1} cannot be used as compile-time constant.');
70 82
71 toString() => template; 83 toString() => template;
72 } 84 }
73 85
74 class Message { 86 class Message {
75 final kind; 87 final kind;
76 final List arguments; 88 final List arguments;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 String toString() => message.toString(); 131 String toString() => message.toString();
120 } 132 }
121 133
122 class CompileTimeConstantError { 134 class CompileTimeConstantError {
123 final Message message; 135 final Message message;
124 CompileTimeConstantError.message(this.message); 136 CompileTimeConstantError.message(this.message);
125 CompileTimeConstantError(MessageKind kind, List<Type> arguments) 137 CompileTimeConstantError(MessageKind kind, List<Type> arguments)
126 : message = new Message(kind, arguments); 138 : message = new Message(kind, arguments);
127 String toString() => message.toString(); 139 String toString() => message.toString();
128 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698