OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 // This code was auto-generated, is not intended to be edited, and is subject to | |
6 // significant change. Please see the README file for more information. | |
7 | |
8 library engine.testing.element_factory; | |
9 | |
10 import 'dart:collection'; | |
11 | |
12 import 'package:analyzer/src/generated/ast.dart'; | |
13 import 'package:analyzer/src/generated/constant.dart'; | |
14 import 'package:analyzer/src/generated/element.dart'; | |
15 import 'package:analyzer/src/generated/engine.dart'; | |
16 import 'package:analyzer/src/generated/java_core.dart'; | |
17 import 'package:analyzer/src/generated/resolver.dart'; | |
18 import 'package:analyzer/src/generated/scanner.dart'; | |
19 import 'package:analyzer/src/generated/source.dart'; | |
20 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | |
21 import 'package:analyzer/src/generated/utilities_dart.dart'; | |
22 import 'package:path/path.dart'; | |
23 | |
24 /** | |
25 * The class `ElementFactory` defines utility methods used to create elements fo
r testing | |
26 * purposes. The elements that are created are complete in the sense that as muc
h of the element | |
27 * model as can be created, given the provided information, has been created. | |
28 */ | |
29 class ElementFactory { | |
30 /** | |
31 * The element representing the class 'Object'. | |
32 */ | |
33 static ClassElementImpl _objectElement; | |
34 | |
35 static ClassElementImpl get object { | |
36 if (_objectElement == null) { | |
37 _objectElement = classElement("Object", null); | |
38 } | |
39 return _objectElement; | |
40 } | |
41 | |
42 static InterfaceType get objectType => object.type; | |
43 | |
44 static ClassElementImpl classElement( | |
45 String typeName, InterfaceType superclassType, | |
46 [List<String> parameterNames]) { | |
47 ClassElementImpl element = new ClassElementImpl(typeName, 0); | |
48 element.supertype = superclassType; | |
49 InterfaceTypeImpl type = new InterfaceTypeImpl(element); | |
50 element.type = type; | |
51 if (parameterNames != null) { | |
52 int count = parameterNames.length; | |
53 if (count > 0) { | |
54 List<TypeParameterElementImpl> typeParameters = | |
55 new List<TypeParameterElementImpl>(count); | |
56 List<TypeParameterTypeImpl> typeParameterTypes = | |
57 new List<TypeParameterTypeImpl>(count); | |
58 for (int i = 0; i < count; i++) { | |
59 TypeParameterElementImpl typeParameter = | |
60 typeParameterElement(parameterNames[i]); | |
61 typeParameters[i] = typeParameter; | |
62 typeParameterTypes[i] = new TypeParameterTypeImpl(typeParameter); | |
63 typeParameter.type = typeParameterTypes[i]; | |
64 } | |
65 element.typeParameters = typeParameters; | |
66 type.typeArguments = typeParameterTypes; | |
67 } | |
68 } | |
69 return element; | |
70 } | |
71 | |
72 static ClassElementImpl classElement2(String typeName, | |
73 [List<String> parameterNames]) => | |
74 classElement(typeName, objectType, parameterNames); | |
75 | |
76 static classTypeAlias(String typeName, InterfaceType superclassType, | |
77 [List<String> parameterNames]) { | |
78 ClassElementImpl element = | |
79 classElement(typeName, superclassType, parameterNames); | |
80 element.mixinApplication = true; | |
81 return element; | |
82 } | |
83 | |
84 static ClassElementImpl classTypeAlias2(String typeName, | |
85 [List<String> parameterNames]) => | |
86 classTypeAlias(typeName, objectType, parameterNames); | |
87 | |
88 static CompilationUnitElementImpl compilationUnit(String fileName, | |
89 [Source librarySource]) { | |
90 Source source = | |
91 new NonExistingSource(fileName, toUri(fileName), UriKind.FILE_URI); | |
92 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); | |
93 unit.source = source; | |
94 if (librarySource == null) { | |
95 librarySource = source; | |
96 } | |
97 unit.librarySource = librarySource; | |
98 return unit; | |
99 } | |
100 | |
101 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => | |
102 new ConstLocalVariableElementImpl(name, 0); | |
103 | |
104 static ConstructorElementImpl constructorElement( | |
105 ClassElement definingClass, String name, bool isConst, | |
106 [List<DartType> argumentTypes]) { | |
107 DartType type = definingClass.type; | |
108 ConstructorElementImpl constructor = name == null | |
109 ? new ConstructorElementImpl("", -1) | |
110 : new ConstructorElementImpl(name, 0); | |
111 constructor.const2 = isConst; | |
112 if (argumentTypes != null) { | |
113 int count = argumentTypes.length; | |
114 List<ParameterElement> parameters = new List<ParameterElement>(count); | |
115 for (int i = 0; i < count; i++) { | |
116 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | |
117 parameter.type = argumentTypes[i]; | |
118 parameter.parameterKind = ParameterKind.REQUIRED; | |
119 parameters[i] = parameter; | |
120 } | |
121 constructor.parameters = parameters; | |
122 } else { | |
123 constructor.parameters = <ParameterElement>[]; | |
124 } | |
125 constructor.returnType = type; | |
126 FunctionTypeImpl constructorType = new FunctionTypeImpl(constructor); | |
127 constructor.type = constructorType; | |
128 return constructor; | |
129 } | |
130 | |
131 static ConstructorElementImpl constructorElement2( | |
132 ClassElement definingClass, String name, | |
133 [List<DartType> argumentTypes]) => | |
134 constructorElement(definingClass, name, false, argumentTypes); | |
135 | |
136 static ClassElementImpl enumElement( | |
137 TypeProvider typeProvider, String enumName, | |
138 [List<String> constantNames]) { | |
139 // | |
140 // Build the enum. | |
141 // | |
142 ClassElementImpl enumElement = new ClassElementImpl(enumName, -1); | |
143 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement); | |
144 enumElement.type = enumType; | |
145 enumElement.supertype = objectType; | |
146 enumElement.enum2 = true; | |
147 // | |
148 // Populate the fields. | |
149 // | |
150 List<FieldElement> fields = new List<FieldElement>(); | |
151 InterfaceType intType = typeProvider.intType; | |
152 InterfaceType stringType = typeProvider.stringType; | |
153 String indexFieldName = "index"; | |
154 FieldElementImpl indexField = new FieldElementImpl(indexFieldName, -1); | |
155 indexField.final2 = true; | |
156 indexField.type = intType; | |
157 fields.add(indexField); | |
158 String nameFieldName = "_name"; | |
159 FieldElementImpl nameField = new FieldElementImpl(nameFieldName, -1); | |
160 nameField.final2 = true; | |
161 nameField.type = stringType; | |
162 fields.add(nameField); | |
163 FieldElementImpl valuesField = new FieldElementImpl("values", -1); | |
164 valuesField.static = true; | |
165 valuesField.const3 = true; | |
166 valuesField.type = typeProvider.listType.substitute4(<DartType>[enumType]); | |
167 fields.add(valuesField); | |
168 // | |
169 // Build the enum constants. | |
170 // | |
171 if (constantNames != null) { | |
172 int constantCount = constantNames.length; | |
173 for (int i = 0; i < constantCount; i++) { | |
174 String constantName = constantNames[i]; | |
175 FieldElementImpl constantElement = | |
176 new ConstFieldElementImpl(constantName, -1); | |
177 constantElement.static = true; | |
178 constantElement.const3 = true; | |
179 constantElement.type = enumType; | |
180 HashMap<String, DartObjectImpl> fieldMap = | |
181 new HashMap<String, DartObjectImpl>(); | |
182 fieldMap[indexFieldName] = new DartObjectImpl(intType, new IntState(i)); | |
183 fieldMap[nameFieldName] = | |
184 new DartObjectImpl(stringType, new StringState(constantName)); | |
185 DartObjectImpl value = | |
186 new DartObjectImpl(enumType, new GenericState(fieldMap)); | |
187 constantElement.evaluationResult = new EvaluationResultImpl(value); | |
188 fields.add(constantElement); | |
189 } | |
190 } | |
191 // | |
192 // Finish building the enum. | |
193 // | |
194 enumElement.fields = fields; | |
195 // Client code isn't allowed to invoke the constructor, so we do not model i
t. | |
196 return enumElement; | |
197 } | |
198 | |
199 static ExportElementImpl exportFor(LibraryElement exportedLibrary, | |
200 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ | |
201 ExportElementImpl spec = new ExportElementImpl(-1); | |
202 spec.exportedLibrary = exportedLibrary; | |
203 spec.combinators = combinators; | |
204 return spec; | |
205 } | |
206 | |
207 static FieldElementImpl fieldElement( | |
208 String name, bool isStatic, bool isFinal, bool isConst, DartType type) { | |
209 FieldElementImpl field = new FieldElementImpl(name, 0); | |
210 field.const3 = isConst; | |
211 field.final2 = isFinal; | |
212 field.static = isStatic; | |
213 field.type = type; | |
214 PropertyAccessorElementImpl getter = | |
215 new PropertyAccessorElementImpl.forVariable(field); | |
216 getter.getter = true; | |
217 getter.synthetic = true; | |
218 getter.variable = field; | |
219 getter.returnType = type; | |
220 field.getter = getter; | |
221 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); | |
222 getter.type = getterType; | |
223 if (!isConst && !isFinal) { | |
224 PropertyAccessorElementImpl setter = | |
225 new PropertyAccessorElementImpl.forVariable(field); | |
226 setter.setter = true; | |
227 setter.synthetic = true; | |
228 setter.variable = field; | |
229 setter.parameters = | |
230 <ParameterElement>[requiredParameter2("_$name", type)]; | |
231 setter.returnType = VoidTypeImpl.instance; | |
232 setter.type = new FunctionTypeImpl(setter); | |
233 field.setter = setter; | |
234 } | |
235 return field; | |
236 } | |
237 | |
238 static FieldFormalParameterElementImpl fieldFormalParameter( | |
239 Identifier name) => new FieldFormalParameterElementImpl(name); | |
240 | |
241 static FunctionElementImpl functionElement(String functionName) => | |
242 functionElement4(functionName, null, null, null, null); | |
243 | |
244 static FunctionElementImpl functionElement2( | |
245 String functionName, ClassElement returnElement) => | |
246 functionElement3(functionName, returnElement, null, null); | |
247 | |
248 static FunctionElementImpl functionElement3(String functionName, | |
249 ClassElement returnElement, List<ClassElement> normalParameters, | |
250 List<ClassElement> optionalParameters) { | |
251 // We don't create parameter elements because we don't have parameter names | |
252 FunctionElementImpl functionElement = | |
253 new FunctionElementImpl(functionName, 0); | |
254 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement); | |
255 functionElement.type = functionType; | |
256 // return type | |
257 if (returnElement == null) { | |
258 functionElement.returnType = VoidTypeImpl.instance; | |
259 } else { | |
260 functionElement.returnType = returnElement.type; | |
261 } | |
262 // parameters | |
263 int normalCount = normalParameters == null ? 0 : normalParameters.length; | |
264 int optionalCount = | |
265 optionalParameters == null ? 0 : optionalParameters.length; | |
266 int totalCount = normalCount + optionalCount; | |
267 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); | |
268 for (int i = 0; i < totalCount; i++) { | |
269 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | |
270 if (i < normalCount) { | |
271 parameter.type = normalParameters[i].type; | |
272 parameter.parameterKind = ParameterKind.REQUIRED; | |
273 } else { | |
274 parameter.type = optionalParameters[i - normalCount].type; | |
275 parameter.parameterKind = ParameterKind.POSITIONAL; | |
276 } | |
277 parameters[i] = parameter; | |
278 } | |
279 functionElement.parameters = parameters; | |
280 // done | |
281 return functionElement; | |
282 } | |
283 | |
284 static FunctionElementImpl functionElement4(String functionName, | |
285 ClassElement returnElement, List<ClassElement> normalParameters, | |
286 List<String> names, List<ClassElement> namedParameters) { | |
287 FunctionElementImpl functionElement = | |
288 new FunctionElementImpl(functionName, 0); | |
289 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement); | |
290 functionElement.type = functionType; | |
291 // parameters | |
292 int normalCount = normalParameters == null ? 0 : normalParameters.length; | |
293 int nameCount = names == null ? 0 : names.length; | |
294 int typeCount = namedParameters == null ? 0 : namedParameters.length; | |
295 if (names != null && nameCount != typeCount) { | |
296 throw new IllegalStateException( | |
297 "The passed String[] and ClassElement[] arrays had different lengths."
); | |
298 } | |
299 int totalCount = normalCount + nameCount; | |
300 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); | |
301 for (int i = 0; i < totalCount; i++) { | |
302 if (i < normalCount) { | |
303 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | |
304 parameter.type = normalParameters[i].type; | |
305 parameter.parameterKind = ParameterKind.REQUIRED; | |
306 parameters[i] = parameter; | |
307 } else { | |
308 ParameterElementImpl parameter = | |
309 new ParameterElementImpl(names[i - normalCount], i); | |
310 parameter.type = namedParameters[i - normalCount].type; | |
311 parameter.parameterKind = ParameterKind.NAMED; | |
312 parameters[i] = parameter; | |
313 } | |
314 } | |
315 functionElement.parameters = parameters; | |
316 // return type | |
317 if (returnElement == null) { | |
318 functionElement.returnType = VoidTypeImpl.instance; | |
319 } else { | |
320 functionElement.returnType = returnElement.type; | |
321 } | |
322 return functionElement; | |
323 } | |
324 | |
325 static FunctionElementImpl functionElement5( | |
326 String functionName, List<ClassElement> normalParameters) => | |
327 functionElement3(functionName, null, normalParameters, null); | |
328 | |
329 static FunctionElementImpl functionElement6(String functionName, | |
330 List<ClassElement> normalParameters, | |
331 List<ClassElement> optionalParameters) => functionElement3( | |
332 functionName, null, normalParameters, optionalParameters); | |
333 | |
334 static FunctionElementImpl functionElement7(String functionName, | |
335 List<ClassElement> normalParameters, List<String> names, | |
336 List<ClassElement> namedParameters) => functionElement4( | |
337 functionName, null, normalParameters, names, namedParameters); | |
338 | |
339 static FunctionElementImpl functionElementWithParameters(String functionName, | |
340 DartType returnType, List<ParameterElement> parameters) { | |
341 FunctionElementImpl functionElement = | |
342 new FunctionElementImpl(functionName, 0); | |
343 functionElement.returnType = | |
344 returnType == null ? VoidTypeImpl.instance : returnType; | |
345 functionElement.parameters = parameters; | |
346 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement); | |
347 functionElement.type = functionType; | |
348 return functionElement; | |
349 } | |
350 | |
351 static FunctionTypeAliasElementImpl functionTypeAliasElement(String name) { | |
352 FunctionTypeAliasElementImpl functionTypeAliasElement = | |
353 new FunctionTypeAliasElementImpl(name, -1); | |
354 functionTypeAliasElement.type = | |
355 new FunctionTypeImpl.forTypedef(functionTypeAliasElement); | |
356 return functionTypeAliasElement; | |
357 } | |
358 | |
359 static PropertyAccessorElementImpl getterElement( | |
360 String name, bool isStatic, DartType type) { | |
361 FieldElementImpl field = new FieldElementImpl(name, -1); | |
362 field.static = isStatic; | |
363 field.synthetic = true; | |
364 field.type = type; | |
365 PropertyAccessorElementImpl getter = | |
366 new PropertyAccessorElementImpl.forVariable(field); | |
367 getter.getter = true; | |
368 getter.variable = field; | |
369 getter.returnType = type; | |
370 field.getter = getter; | |
371 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); | |
372 getter.type = getterType; | |
373 return getter; | |
374 } | |
375 | |
376 @deprecated | |
377 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { | |
378 Source source = | |
379 new NonExistingSource(fileName, toUri(fileName), UriKind.FILE_URI); | |
380 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); | |
381 unit.source = source; | |
382 return unit; | |
383 } | |
384 | |
385 static ImportElementImpl importFor( | |
386 LibraryElement importedLibrary, PrefixElement prefix, | |
387 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ | |
388 ImportElementImpl spec = new ImportElementImpl(0); | |
389 spec.importedLibrary = importedLibrary; | |
390 spec.prefix = prefix; | |
391 spec.combinators = combinators; | |
392 return spec; | |
393 } | |
394 | |
395 static LibraryElementImpl library( | |
396 AnalysisContext context, String libraryName) { | |
397 String fileName = "/$libraryName.dart"; | |
398 CompilationUnitElementImpl unit = compilationUnit(fileName); | |
399 LibraryElementImpl library = | |
400 new LibraryElementImpl(context, libraryName, 0); | |
401 library.definingCompilationUnit = unit; | |
402 return library; | |
403 } | |
404 | |
405 static LocalVariableElementImpl localVariableElement(Identifier name) => | |
406 new LocalVariableElementImpl.forNode(name); | |
407 | |
408 static LocalVariableElementImpl localVariableElement2(String name) => | |
409 new LocalVariableElementImpl(name, 0); | |
410 | |
411 static MethodElementImpl methodElement(String methodName, DartType returnType, | |
412 [List<DartType> argumentTypes]) { | |
413 MethodElementImpl method = new MethodElementImpl(methodName, 0); | |
414 if (argumentTypes == null) { | |
415 method.parameters = ParameterElement.EMPTY_LIST; | |
416 } else { | |
417 int count = argumentTypes.length; | |
418 List<ParameterElement> parameters = new List<ParameterElement>(count); | |
419 for (int i = 0; i < count; i++) { | |
420 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | |
421 parameter.type = argumentTypes[i]; | |
422 parameter.parameterKind = ParameterKind.REQUIRED; | |
423 parameters[i] = parameter; | |
424 } | |
425 method.parameters = parameters; | |
426 } | |
427 method.returnType = returnType; | |
428 FunctionTypeImpl methodType = new FunctionTypeImpl(method); | |
429 method.type = methodType; | |
430 return method; | |
431 } | |
432 | |
433 static MethodElementImpl methodElementWithParameters(String methodName, | |
434 List<DartType> typeArguments, DartType returnType, | |
435 List<ParameterElement> parameters) { | |
436 MethodElementImpl method = new MethodElementImpl(methodName, 0); | |
437 method.parameters = parameters; | |
438 method.returnType = returnType; | |
439 FunctionTypeImpl methodType = new FunctionTypeImpl(method); | |
440 methodType.typeArguments = typeArguments; | |
441 method.type = methodType; | |
442 return method; | |
443 } | |
444 | |
445 static ParameterElementImpl namedParameter(String name) { | |
446 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
447 parameter.parameterKind = ParameterKind.NAMED; | |
448 return parameter; | |
449 } | |
450 | |
451 static ParameterElementImpl namedParameter2(String name, DartType type) { | |
452 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
453 parameter.parameterKind = ParameterKind.NAMED; | |
454 parameter.type = type; | |
455 return parameter; | |
456 } | |
457 | |
458 static ParameterElementImpl positionalParameter(String name) { | |
459 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
460 parameter.parameterKind = ParameterKind.POSITIONAL; | |
461 return parameter; | |
462 } | |
463 | |
464 static ParameterElementImpl positionalParameter2(String name, DartType type) { | |
465 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
466 parameter.parameterKind = ParameterKind.POSITIONAL; | |
467 parameter.type = type; | |
468 return parameter; | |
469 } | |
470 | |
471 static PrefixElementImpl prefix(String name) => | |
472 new PrefixElementImpl(name, 0); | |
473 | |
474 static ParameterElementImpl requiredParameter(String name) { | |
475 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
476 parameter.parameterKind = ParameterKind.REQUIRED; | |
477 return parameter; | |
478 } | |
479 | |
480 static ParameterElementImpl requiredParameter2(String name, DartType type) { | |
481 ParameterElementImpl parameter = new ParameterElementImpl(name, 0); | |
482 parameter.parameterKind = ParameterKind.REQUIRED; | |
483 parameter.type = type; | |
484 return parameter; | |
485 } | |
486 | |
487 static PropertyAccessorElementImpl setterElement( | |
488 String name, bool isStatic, DartType type) { | |
489 FieldElementImpl field = new FieldElementImpl(name, -1); | |
490 field.static = isStatic; | |
491 field.synthetic = true; | |
492 field.type = type; | |
493 PropertyAccessorElementImpl getter = | |
494 new PropertyAccessorElementImpl.forVariable(field); | |
495 getter.getter = true; | |
496 getter.variable = field; | |
497 getter.returnType = type; | |
498 field.getter = getter; | |
499 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); | |
500 getter.type = getterType; | |
501 ParameterElementImpl parameter = requiredParameter2("a", type); | |
502 PropertyAccessorElementImpl setter = | |
503 new PropertyAccessorElementImpl.forVariable(field); | |
504 setter.setter = true; | |
505 setter.synthetic = true; | |
506 setter.variable = field; | |
507 setter.parameters = <ParameterElement>[parameter]; | |
508 setter.returnType = VoidTypeImpl.instance; | |
509 setter.type = new FunctionTypeImpl(setter); | |
510 field.setter = setter; | |
511 return setter; | |
512 } | |
513 | |
514 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => | |
515 new TopLevelVariableElementImpl.forNode(name); | |
516 | |
517 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => | |
518 topLevelVariableElement3(name, false, false, null); | |
519 | |
520 static TopLevelVariableElementImpl topLevelVariableElement3( | |
521 String name, bool isConst, bool isFinal, DartType type) { | |
522 TopLevelVariableElementImpl variable; | |
523 if (isConst) { | |
524 ConstTopLevelVariableElementImpl constant = | |
525 new ConstTopLevelVariableElementImpl(AstFactory.identifier3(name)); | |
526 constant.constantInitializer = AstFactory.instanceCreationExpression2( | |
527 Keyword.CONST, AstFactory.typeName(type.element)); | |
528 variable = constant; | |
529 } else { | |
530 variable = new TopLevelVariableElementImpl(name, -1); | |
531 } | |
532 variable.const3 = isConst; | |
533 variable.final2 = isFinal; | |
534 variable.synthetic = true; | |
535 PropertyAccessorElementImpl getter = | |
536 new PropertyAccessorElementImpl.forVariable(variable); | |
537 getter.getter = true; | |
538 getter.synthetic = true; | |
539 getter.variable = variable; | |
540 getter.returnType = type; | |
541 variable.getter = getter; | |
542 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); | |
543 getter.type = getterType; | |
544 if (!isConst && !isFinal) { | |
545 PropertyAccessorElementImpl setter = | |
546 new PropertyAccessorElementImpl.forVariable(variable); | |
547 setter.setter = true; | |
548 setter.static = true; | |
549 setter.synthetic = true; | |
550 setter.variable = variable; | |
551 setter.parameters = | |
552 <ParameterElement>[requiredParameter2("_$name", type)]; | |
553 setter.returnType = VoidTypeImpl.instance; | |
554 setter.type = new FunctionTypeImpl(setter); | |
555 variable.setter = setter; | |
556 } | |
557 return variable; | |
558 } | |
559 | |
560 static TypeParameterElementImpl typeParameterElement(String name) { | |
561 TypeParameterElementImpl element = new TypeParameterElementImpl(name, 0); | |
562 element.type = new TypeParameterTypeImpl(element); | |
563 return element; | |
564 } | |
565 } | |
OLD | NEW |