Skip to content

Commit 1942f43

Browse files
stereotype441Commit Queue
authored andcommitted
[analysis_server] Code generate TransformSetErrorCode constants.
Moving these diagnostic constants to code generation will make it easier to make further improvements to the analyzer diagnostic representation, because I'll be able to make a single adjustment to the code generator and then re-generate all the diagnostics. Change-Id: I6a6a6964b0dd7898bff042451d3f115c172331b9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445281 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 7f5205c commit 1942f43

File tree

4 files changed

+360
-191
lines changed

4 files changed

+360
-191
lines changed

pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart

Lines changed: 3 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -2,194 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:analyzer/error/error.dart';
6-
7-
/// An error code representing a problem in a file containing an encoding of a
8-
/// transform set.
9-
class TransformSetErrorCode extends DiagnosticCode {
10-
/// Parameters:
11-
/// 0: the conflicting key
12-
/// 1: the key that it conflicts with
13-
static const TransformSetErrorCode conflictingKey = TransformSetErrorCode(
14-
'conflicting_key',
15-
"The key '{0}' can't be used when '{1}' is also used.",
16-
);
17-
18-
/// No parameters.
19-
static const TransformSetErrorCode expectedPrimary = TransformSetErrorCode(
20-
'expected_primary',
21-
'Expected either an identifier or a string literal.',
22-
);
23-
24-
/// Parameters:
25-
/// 0: the old kind
26-
/// 1: the new kind
27-
static const TransformSetErrorCode incompatibleElementKind =
28-
TransformSetErrorCode(
29-
'incompatible_element_kind',
30-
"An element of kind '{0}' can't be replaced by "
31-
"an element of kind '{1}'.",
32-
);
33-
34-
/// Parameters:
35-
/// 0: the change kind that is invalid
36-
/// 1: the element kind for the transform
37-
static const TransformSetErrorCode invalidChangeForKind =
38-
TransformSetErrorCode(
39-
'invalid_change_for_kind',
40-
"A change of type '{0}' can't be used for an element of kind '{1}'.",
41-
);
42-
43-
/// Parameters:
44-
/// 0: the character that is invalid
45-
static const TransformSetErrorCode invalidCharacter = TransformSetErrorCode(
46-
'invalid_character',
47-
"Invalid character '{0}'.",
48-
);
49-
50-
/// Parameters:
51-
/// 0: the actual type of the key
52-
static const TransformSetErrorCode invalidKey = TransformSetErrorCode(
53-
'invalid_key',
54-
"Keys must be of type 'String' but found the type '{0}'.",
55-
);
56-
57-
/// No parameters.
58-
static const TransformSetErrorCode invalidRequiredIf = TransformSetErrorCode(
59-
'invalid_required_if',
60-
"The key 'requiredIf' can only be used with optional named parameters.",
61-
);
62-
63-
/// Parameters:
64-
/// 0: the key with which the value is associated
65-
/// 1: the expected type of the value
66-
/// 2: the actual type of the value
67-
static const TransformSetErrorCode invalidValue = TransformSetErrorCode(
68-
'invalid_value',
69-
"The value of '{0}' should be of type '{1}' but is of type '{2}'.",
70-
);
71-
72-
/// Parameters:
73-
/// 0: the list of valid parameter styles
74-
static const TransformSetErrorCode invalidParameterStyle =
75-
TransformSetErrorCode(
76-
'invalid_parameter_style',
77-
'The parameter style must be one of the following: {0}.',
78-
);
79-
80-
/// Parameters:
81-
/// 0: the key with which the value is associated
82-
/// 1: the allowed values as a comma-separated list
83-
static const TransformSetErrorCode invalidValueOneOf = TransformSetErrorCode(
84-
'invalid_value_one_of',
85-
"The value of '{0}' must be one of the following: '{1}'.",
86-
);
87-
88-
/// Parameters:
89-
/// 0: the missing key
90-
static const TransformSetErrorCode missingKey = TransformSetErrorCode(
91-
'missing_key',
92-
"Missing the required key '{0}'.",
93-
);
94-
95-
/// Parameters:
96-
/// 0: the list of valid keys
97-
static const TransformSetErrorCode missingOneOfMultipleKeys =
98-
TransformSetErrorCode(
99-
'missing_one_of_multiple_keys',
100-
'Exactly one of the following keys must be provided: {0}.',
101-
);
102-
103-
/// No parameters.
104-
static const TransformSetErrorCode missingTemplateEnd = TransformSetErrorCode(
105-
'missing_template_end',
106-
'Missing the end brace for the template.',
107-
);
108-
109-
/// Parameters:
110-
/// 0: a description of the expected kinds of tokens
111-
static const TransformSetErrorCode missingToken = TransformSetErrorCode(
112-
'missing_token',
113-
'Expected to find {0}.',
114-
);
115-
116-
/// No parameters.
117-
static const TransformSetErrorCode missingUri = TransformSetErrorCode(
118-
'missing_uri',
119-
'At least one URI must be provided.',
120-
);
121-
122-
/// Parameters:
123-
/// 0: the missing key
124-
static const TransformSetErrorCode undefinedVariable = TransformSetErrorCode(
125-
'undefined_variable',
126-
"The variable '{0}' isn't defined.",
127-
);
128-
129-
/// Parameters:
130-
/// 0: the token that was unexpectedly found
131-
static const TransformSetErrorCode unexpectedToken = TransformSetErrorCode(
132-
'unexpected_token',
133-
"Didn't expect to find {0}.",
134-
);
135-
136-
/// Parameters:
137-
/// 0: a description of the expected kind of token
138-
static const TransformSetErrorCode unknownAccessor = TransformSetErrorCode(
139-
'unknown_accessor',
140-
"The accessor '{0}' is invalid.",
141-
);
142-
143-
/// Parameters:
144-
/// 0: the unsupported key
145-
static const TransformSetErrorCode unsupportedKey = TransformSetErrorCode(
146-
'unsupported_key',
147-
"The key '{0}' isn't supported.",
148-
);
149-
150-
/// No parameters.
151-
static const TransformSetErrorCode unsupportedStatic = TransformSetErrorCode(
152-
'unsupported_static',
153-
"The key 'static' is only supported for elements in a class, enum, "
154-
'extension, or mixin.',
155-
);
156-
157-
/// No parameters.
158-
static const TransformSetErrorCode unsupportedVersion = TransformSetErrorCode(
159-
'unsupported_version',
160-
"Only version '1' is supported at this time.",
161-
);
162-
163-
/// Parameters:
164-
/// 0: a description of the expected kind of token
165-
/// 1: a description of the actual kind of token
166-
static const TransformSetErrorCode wrongToken = TransformSetErrorCode(
167-
'wrong_token',
168-
'Expected to find {0}, but found {1}.',
169-
);
170-
171-
/// Parameters:
172-
/// 0: the message produced by the YAML parser
173-
static const TransformSetErrorCode yamlSyntaxError = TransformSetErrorCode(
174-
'yaml_syntax_error',
175-
'Parse error: {0}',
176-
);
177-
178-
/// Initialize a newly created error code.
179-
const TransformSetErrorCode(
180-
String name,
181-
String problemMessage, {
182-
super.correctionMessage,
183-
super.hasPublishedDocs,
184-
}) : super(
185-
name: name,
186-
problemMessage: problemMessage,
187-
uniqueName: 'TransformSetErrorCode.$name',
188-
);
189-
190-
@override
191-
DiagnosticSeverity get severity => DiagnosticSeverity.ERROR;
192-
193-
@override
194-
DiagnosticType get type => DiagnosticType.COMPILE_TIME_ERROR;
195-
}
5+
// ignore: deprecated_member_use_from_same_package
6+
export 'package:analysis_server/src/services/correction/fix/data_driven/transform_set_error_code.g.dart'
7+
show TransformSetErrorCode;

0 commit comments

Comments
 (0)