| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 type.setTypeArguments(typeParameterTypes); | 77 type.setTypeArguments(typeParameterTypes); |
| 78 } | 78 } |
| 79 | 79 |
| 80 return element; | 80 return element; |
| 81 } | 81 } |
| 82 | 82 |
| 83 public static ClassElementImpl classElement(String typeName, String... paramet
erNames) { | 83 public static ClassElementImpl classElement(String typeName, String... paramet
erNames) { |
| 84 return classElement(typeName, getObject().getType(), parameterNames); | 84 return classElement(typeName, getObject().getType(), parameterNames); |
| 85 } | 85 } |
| 86 | 86 |
| 87 public static ConstructorElementImpl constructorElement(ClassElement definingC
lass, String name) { | 87 public static ConstructorElementImpl constructorElement(ClassElement definingC
lass, String name, |
| 88 boolean isConst, Type... argumentTypes) { |
| 88 Type type = definingClass.getType(); | 89 Type type = definingClass.getType(); |
| 89 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null | 90 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null |
| 90 : identifier(name)); | 91 : identifier(name)); |
| 92 constructor.setConst(isConst); |
| 93 int count = argumentTypes.length; |
| 94 ParameterElement[] parameters = new ParameterElement[count]; |
| 95 for (int i = 0; i < count; i++) { |
| 96 ParameterElementImpl parameter = new ParameterElementImpl(identifier("a" +
i)); |
| 97 parameter.setType(argumentTypes[i]); |
| 98 parameter.setParameterKind(ParameterKind.REQUIRED); |
| 99 parameters[i] = parameter; |
| 100 } |
| 101 constructor.setParameters(parameters); |
| 91 constructor.setReturnType(type); | 102 constructor.setReturnType(type); |
| 92 | 103 |
| 93 FunctionTypeImpl constructorType = new FunctionTypeImpl(constructor); | 104 FunctionTypeImpl constructorType = new FunctionTypeImpl(constructor); |
| 94 constructor.setType(constructorType); | 105 constructor.setType(constructorType); |
| 95 | 106 |
| 96 return constructor; | 107 return constructor; |
| 97 } | 108 } |
| 98 | 109 |
| 110 public static ConstructorElementImpl constructorElement(ClassElement definingC
lass, String name, |
| 111 Type... argumentTypes) { |
| 112 return constructorElement(definingClass, name, false, argumentTypes); |
| 113 } |
| 114 |
| 99 public static ExportElementImpl exportFor(LibraryElement exportedLibrary, | 115 public static ExportElementImpl exportFor(LibraryElement exportedLibrary, |
| 100 NamespaceCombinator... combinators) { | 116 NamespaceCombinator... combinators) { |
| 101 ExportElementImpl spec = new ExportElementImpl(); | 117 ExportElementImpl spec = new ExportElementImpl(); |
| 102 spec.setExportedLibrary(exportedLibrary); | 118 spec.setExportedLibrary(exportedLibrary); |
| 103 spec.setCombinators(combinators); | 119 spec.setCombinators(combinators); |
| 104 return spec; | 120 return spec; |
| 105 } | 121 } |
| 106 | 122 |
| 107 public static FieldElementImpl fieldElement(String name, boolean isStatic, boo
lean isFinal, | 123 public static FieldElementImpl fieldElement(String name, boolean isStatic, boo
lean isFinal, |
| 108 boolean isConst, Type type) { | 124 boolean isConst, Type type) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 403 } |
| 388 | 404 |
| 389 public static TopLevelVariableElementImpl topLevelVariableElement(Identifier n
ame) { | 405 public static TopLevelVariableElementImpl topLevelVariableElement(Identifier n
ame) { |
| 390 return new TopLevelVariableElementImpl(name); | 406 return new TopLevelVariableElementImpl(name); |
| 391 } | 407 } |
| 392 | 408 |
| 393 public static TopLevelVariableElementImpl topLevelVariableElement(String name)
{ | 409 public static TopLevelVariableElementImpl topLevelVariableElement(String name)
{ |
| 394 return new TopLevelVariableElementImpl(name); | 410 return new TopLevelVariableElementImpl(name); |
| 395 } | 411 } |
| 396 | 412 |
| 397 public static TopLevelVariableElementImpl topLevelVariableElement(String name,
boolean isFinal, | 413 public static TopLevelVariableElementImpl topLevelVariableElement(String name,
boolean isConst, |
| 398 Type type) { | 414 boolean isFinal, Type type) { |
| 399 TopLevelVariableElementImpl variable = new TopLevelVariableElementImpl(name)
; | 415 TopLevelVariableElementImpl variable = new TopLevelVariableElementImpl(name)
; |
| 416 variable.setConst(isConst); |
| 400 variable.setFinal(isFinal); | 417 variable.setFinal(isFinal); |
| 401 | 418 |
| 402 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl(variabl
e); | 419 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl(variabl
e); |
| 403 getter.setGetter(true); | 420 getter.setGetter(true); |
| 404 getter.setStatic(true); | 421 getter.setStatic(true); |
| 405 getter.setSynthetic(true); | 422 getter.setSynthetic(true); |
| 406 getter.setVariable(variable); | 423 getter.setVariable(variable); |
| 407 getter.setReturnType(type); | 424 getter.setReturnType(type); |
| 408 variable.setGetter(getter); | 425 variable.setGetter(getter); |
| 409 | 426 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 424 | 441 |
| 425 return variable; | 442 return variable; |
| 426 } | 443 } |
| 427 | 444 |
| 428 /** | 445 /** |
| 429 * Prevent the creation of instances of this class. | 446 * Prevent the creation of instances of this class. |
| 430 */ | 447 */ |
| 431 private ElementFactory() { | 448 private ElementFactory() { |
| 432 } | 449 } |
| 433 } | 450 } |
| OLD | NEW |