Package org.sonar.python.tree
Class FunctionDefImpl
- java.lang.Object
-
- org.sonar.python.tree.PyTree
-
- org.sonar.python.tree.FunctionDefImpl
-
- All Implemented Interfaces:
FunctionDef,FunctionLike,Statement,Tree
public class FunctionDefImpl extends PyTree implements FunctionDef
-
-
Field Summary
-
Fields inherited from class org.sonar.python.tree.PyTree
firstToken, lastToken
-
-
Constructor Summary
Constructors Constructor Description FunctionDefImpl(List<Decorator> decorators, Token asyncKeyword, Token defKeyword, Name name, Token leftPar, ParameterList parameters, Token rightPar, TypeAnnotation returnType, Token colon, Token newLine, Token indent, StatementList body, Token dedent, boolean isMethodDefinition, StringLiteral docstring)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(TreeVisitor visitor)voidaddLocalVariableSymbol(Symbol symbol)TokenasyncKeyword()StatementListbody()Tokencolon()List<Tree>computeChildren()List<Decorator>decorators()TokendefKeyword()StringLiteraldocstring()FunctionSymbolfunctionSymbol()Tree.KindgetKind()booleanisMethodDefinition()TokenleftPar()Set<Symbol>localVariables()Namename()ParameterListparameters()TypeAnnotationreturnTypeAnnotation()-> returnTypeTokenrightPar()voidsetFunctionSymbol(FunctionSymbol functionSymbol)-
Methods inherited from class org.sonar.python.tree.PyTree
children, firstToken, is, lastToken, parent, setParent
-
-
-
-
Constructor Detail
-
FunctionDefImpl
public FunctionDefImpl(List<Decorator> decorators, @Nullable Token asyncKeyword, Token defKeyword, Name name, Token leftPar, @Nullable ParameterList parameters, Token rightPar, @Nullable TypeAnnotation returnType, Token colon, @Nullable Token newLine, @Nullable Token indent, StatementList body, @Nullable Token dedent, boolean isMethodDefinition, @Nullable StringLiteral docstring)
-
-
Method Detail
-
decorators
public List<Decorator> decorators()
- Specified by:
decoratorsin interfaceFunctionDef
-
defKeyword
public Token defKeyword()
- Specified by:
defKeywordin interfaceFunctionDef
-
asyncKeyword
@CheckForNull public Token asyncKeyword()
- Specified by:
asyncKeywordin interfaceFunctionDef
-
name
public Name name()
- Specified by:
namein interfaceFunctionDef
-
leftPar
public Token leftPar()
- Specified by:
leftParin interfaceFunctionDef
-
parameters
@CheckForNull public ParameterList parameters()
- Specified by:
parametersin interfaceFunctionLike
-
rightPar
public Token rightPar()
- Specified by:
rightParin interfaceFunctionDef
-
returnTypeAnnotation
@CheckForNull public TypeAnnotation returnTypeAnnotation()
Description copied from interface:FunctionDef-> returnType- Specified by:
returnTypeAnnotationin interfaceFunctionDef
-
colon
public Token colon()
- Specified by:
colonin interfaceFunctionDef
-
body
public StatementList body()
- Specified by:
bodyin interfaceFunctionDef
-
isMethodDefinition
public boolean isMethodDefinition()
- Specified by:
isMethodDefinitionin interfaceFunctionLike
-
docstring
@CheckForNull public StringLiteral docstring()
- Specified by:
docstringin interfaceFunctionDef
-
localVariables
public Set<Symbol> localVariables()
- Specified by:
localVariablesin interfaceFunctionLike- Returns:
- symbols of local variables and parameters
-
addLocalVariableSymbol
public void addLocalVariableSymbol(Symbol symbol)
-
accept
public void accept(TreeVisitor visitor)
-
setFunctionSymbol
public void setFunctionSymbol(FunctionSymbol functionSymbol)
-
functionSymbol
@CheckForNull public FunctionSymbol functionSymbol()
-
-