Package org.sonar.python.semantic
Class FunctionSymbolImpl
- java.lang.Object
-
- org.sonar.python.semantic.SymbolImpl
-
- org.sonar.python.semantic.FunctionSymbolImpl
-
- All Implemented Interfaces:
FunctionSymbol,Symbol
public class FunctionSymbolImpl extends SymbolImpl implements FunctionSymbol
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFunctionSymbolImpl.ParameterImpl-
Nested classes/interfaces inherited from interface org.sonar.plugins.python.api.symbols.FunctionSymbol
FunctionSymbol.Parameter
-
Nested classes/interfaces inherited from interface org.sonar.plugins.python.api.symbols.Symbol
Symbol.Kind
-
-
Field Summary
-
Fields inherited from class org.sonar.python.semantic.SymbolImpl
validForPythonVersions
-
-
Constructor Summary
Constructors Constructor Description FunctionSymbolImpl(FunctionDescriptor functionDescriptor, String symbolName)FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, String moduleName)FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, String containerClassFqn, String moduleName)FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, String containerClassFqn, List<String> validFor, String moduleName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(FunctionSymbolImpl.ParameterImpl parameter)StringannotatedReturnTypeName()Returns fully qualified name of the return type if anyFunctionSymbolImplcopyWithoutUsages()InferredTypedeclaredReturnType()List<String>decorators()Returns the known names of the decorators.LocationInFiledefinitionLocation()booleanhasDecorators()booleanhasVariadicParameter()booleanisAsynchronous()booleanisDjangoView()booleanisInstanceMethod()booleanisStub()When true, it denotes a function symbol for a function stub.Symbolowner()List<FunctionSymbol.Parameter>parameters()voidsetDeclaredReturnType(InferredType declaredReturnType)voidsetIsDjangoView(boolean isDjangoView)voidsetOwner(Symbol owner)voidsetParametersWithType(ParameterList parametersList)-
Methods inherited from class org.sonar.python.semantic.SymbolImpl
addChildSymbol, annotatedTypeName, fullyQualifiedName, getChildrenSymbolByName, inferredType, is, kind, name, removeUsages, setAnnotatedTypeName, setInferredType, setKind, usages, validForPythonVersions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sonar.plugins.python.api.symbols.Symbol
annotatedTypeName, fullyQualifiedName, is, kind, name, usages
-
-
-
-
Constructor Detail
-
FunctionSymbolImpl
public FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, String moduleName)
-
FunctionSymbolImpl
public FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, @Nullable String containerClassFqn, String moduleName)
-
FunctionSymbolImpl
public FunctionSymbolImpl(SymbolsProtos.FunctionSymbol functionSymbolProto, @Nullable String containerClassFqn, List<String> validFor, String moduleName)
-
FunctionSymbolImpl
public FunctionSymbolImpl(FunctionDescriptor functionDescriptor, String symbolName)
-
-
Method Detail
-
setParametersWithType
public void setParametersWithType(ParameterList parametersList)
-
addParameter
public void addParameter(FunctionSymbolImpl.ParameterImpl parameter)
-
copyWithoutUsages
public FunctionSymbolImpl copyWithoutUsages()
- Overrides:
copyWithoutUsagesin classSymbolImpl
-
decorators
public List<String> decorators()
Description copied from interface:FunctionSymbolReturns the known names of the decorators. It might not be a reliable way to infer the number of decorators as they can take more complex expressions since Python 3.9- Specified by:
decoratorsin interfaceFunctionSymbol
-
parameters
public List<FunctionSymbol.Parameter> parameters()
- Specified by:
parametersin interfaceFunctionSymbol
-
isStub
public boolean isStub()
Description copied from interface:FunctionSymbolWhen true, it denotes a function symbol for a function stub.def fn(p1, p2): ...
- Specified by:
isStubin interfaceFunctionSymbol
-
isAsynchronous
public boolean isAsynchronous()
- Specified by:
isAsynchronousin interfaceFunctionSymbol
-
hasVariadicParameter
public boolean hasVariadicParameter()
- Specified by:
hasVariadicParameterin interfaceFunctionSymbol
-
isInstanceMethod
public boolean isInstanceMethod()
- Specified by:
isInstanceMethodin interfaceFunctionSymbol
-
hasDecorators
public boolean hasDecorators()
- Specified by:
hasDecoratorsin interfaceFunctionSymbol
-
definitionLocation
public LocationInFile definitionLocation()
- Specified by:
definitionLocationin interfaceFunctionSymbol
-
declaredReturnType
public InferredType declaredReturnType()
-
annotatedReturnTypeName
public String annotatedReturnTypeName()
Description copied from interface:FunctionSymbolReturns fully qualified name of the return type if any- Specified by:
annotatedReturnTypeNamein interfaceFunctionSymbol
-
setDeclaredReturnType
public void setDeclaredReturnType(InferredType declaredReturnType)
-
owner
public Symbol owner()
-
setOwner
public void setOwner(Symbol owner)
-
isDjangoView
public boolean isDjangoView()
-
setIsDjangoView
public void setIsDjangoView(boolean isDjangoView)
-
-