public final class ClassElement extends PropertyNode
computed, getter, isAnonymousFunctionDefinition, isStatic, key, setter, value| Modifier and Type | Method and Description |
|---|---|
Node |
accept(NodeVisitor<? extends LexicalContext> visitor)
Provides a means to navigate the IR.
|
<R> R |
accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Provides a means to navigate the IR.
|
static ClassElement |
createAccessor(long token,
int finish,
Expression key,
FunctionNode get,
FunctionNode set,
List<Expression> decorators,
boolean isPrivate,
boolean isStatic,
boolean hasComputedKey)
Create an Accessor (i.e., get/set) element.
|
static ClassElement |
createAutoAccessor(long token,
int finish,
Expression key,
FunctionNode initializer,
List<Expression> classElementDecorators,
boolean isStatic,
boolean hasComputedKey,
boolean anonymousFunctionDefinition)
Create an auto-accessor class element.
|
static ClassElement |
createDefaultConstructor(long token,
int finish,
Expression key,
Expression value)
Create the class default constructor.
|
static ClassElement |
createField(long token,
int finish,
Expression key,
Expression initialize,
List<Expression> decorators,
boolean isStatic,
boolean hasComputedKey,
boolean anonymousFunctionDefinition)
Create a class field element.
|
static ClassElement |
createMethod(long token,
int finish,
Expression key,
Expression value,
List<Expression> decorators,
boolean isStatic,
boolean hasComputedKey)
Create a Method class element.
|
static ClassElement |
createStaticInitializer(long token,
int finish,
FunctionNode functionNode)
Create a static initializer element.
|
List<Expression> |
getDecorators() |
boolean |
isAccessor() |
boolean |
isAutoAccessor() |
boolean |
isClassField() |
boolean |
isClassFieldOrAutoAccessor()
Returns true if the class element is one of: field, auto accessor.
|
boolean |
isClassStaticBlock() |
boolean |
isMethod() |
boolean |
isMethodOrAccessor()
Returns true if the class element is one of: method, getter, setter, auto accessor.
|
boolean |
isPrivate() |
boolean |
isStatic() |
ClassElement |
setDecorators(List<Expression> decorators) |
ClassElement |
setGetter(FunctionNode get)
Set the getter of this property, null if none
|
ClassElement |
setKey(Expression key) |
ClassElement |
setSetter(FunctionNode set)
Set the setter for this property, null if none
|
ClassElement |
setValue(Expression value)
Set the value of this property
|
void |
toString(StringBuilder sb,
boolean printType)
Print logic that decides whether to show the optimistic type or not - for example it should
not be printed after just parse, when it hasn't been computed, or has been set to a trivially
provable value
|
getGetter, getKey, getKeyName, getKeyNameTS, getPrivateName, getPrivateNameTS, getSetter, getValue, isAnonymousFunctionDefinition, isComputed, isCoverInitializedName, isProto, isRestclone, equals, getFinish, getSourceOrder, getStart, getToken, hashCode, isAssignment, isLoop, isTokenType, tokenType, toString, toStringpublic static ClassElement createMethod(long token, int finish, Expression key, Expression value, List<Expression> decorators, boolean isStatic, boolean hasComputedKey)
token - token.finish - finish.key - The name of the method.value - The value of the method.decorators - The decorators of the method. Optional.isStatic - static method.hasComputedKey - has computed key.public static ClassElement createAccessor(long token, int finish, Expression key, FunctionNode get, FunctionNode set, List<Expression> decorators, boolean isPrivate, boolean isStatic, boolean hasComputedKey)
token - token.finish - finish.key - The name of the accessor.get - The getter of the accessor. Optional.set - The setter of the accessor. Optional.decorators - The decorators of the accessor. Optional.isPrivate - private accessor.isStatic - static accessor.hasComputedKey - has computed key.public static ClassElement createField(long token, int finish, Expression key, Expression initialize, List<Expression> decorators, boolean isStatic, boolean hasComputedKey, boolean anonymousFunctionDefinition)
token - token.finish - finish.key - The name of the field.initialize - The initialization value of the field. Optional.decorators - The decorators of the field. Optional.isStatic - static field,hasComputedKey - has computed key.anonymousFunctionDefinition - is anonymous function definition.public static ClassElement createDefaultConstructor(long token, int finish, Expression key, Expression value)
token - token.finish - finish.key - class name.value - value.public static ClassElement createStaticInitializer(long token, int finish, FunctionNode functionNode)
token - token.finish - finish.functionNode - function node.public static ClassElement createAutoAccessor(long token, int finish, Expression key, FunctionNode initializer, List<Expression> classElementDecorators, boolean isStatic, boolean hasComputedKey, boolean anonymousFunctionDefinition)
token - token.finish - finish.key - key name.initializer - initializer body.classElementDecorators - decorators.isStatic - is static.hasComputedKey - has computed key.anonymousFunctionDefinition - is anonymous function definition.public Node accept(NodeVisitor<? extends LexicalContext> visitor)
Nodeaccept in class PropertyNodevisitor - Node visitor.public <R> R accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Nodeaccept in class PropertyNodevisitor - Node visitor.public List<Expression> getDecorators()
public ClassElement setDecorators(List<Expression> decorators)
public ClassElement setGetter(FunctionNode get)
PropertyNodesetGetter in class PropertyNodeget - getterpublic ClassElement setKey(Expression key)
public ClassElement setSetter(FunctionNode set)
PropertyNodesetSetter in class PropertyNodeset - setterpublic ClassElement setValue(Expression value)
PropertyNodesetValue in class PropertyNodevalue - new valuepublic boolean isAccessor()
isAccessor in class PropertyNodepublic boolean isAutoAccessor()
public boolean isClassField()
isClassField in class PropertyNodepublic boolean isClassFieldOrAutoAccessor()
public boolean isClassStaticBlock()
isClassStaticBlock in class PropertyNodepublic boolean isMethod()
public boolean isMethodOrAccessor()
public boolean isPrivate()
isPrivate in class PropertyNodepublic boolean isStatic()
isStatic in class PropertyNodepublic void toString(StringBuilder sb, boolean printType)
NodetoString in class PropertyNodesb - string builderprintType - print type?