Class FeatureLiteral
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- gw.internal.gosu.parser.expressions.FeatureLiteral
-
- All Implemented Interfaces:
IFeatureLiteralExpression,ILiteralExpression,IExpression,IHasType,IParsedElement,java.lang.Cloneable
public class FeatureLiteral extends Expression implements IFeatureLiteralExpression
Represents a feature literal expression as defined in the Gosu grammar.- See Also:
IGosuParser
-
-
Field Summary
Fields Modifier and Type Field Description private IBlockType_blockTypeprivate java.util.List<IExpression>_boundArgs(package private) IFeatureInfo_featureprivate IType[]_parameterTypesprivate IExpression_rootprivate static intMAX_BLOCK_ARGS-
Fields inherited from class gw.internal.gosu.parser.Expression
_type
-
Fields inherited from class gw.internal.gosu.parser.ParsedElement
_tokens, UNDEF_FILE, UNDEF_FUNCTION, UNDEF_MODULE
-
Fields inherited from interface gw.lang.parser.IExpression
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description FeatureLiteral(Expression rootExpr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private IType[]adjustParametersForFeature(IHasParameterInfos feature, IType[] params)private java.util.List<java.lang.String>argNames(IHasParameterInfos hasParams)private IType[]boundGenericFunctionTypeVariables(IHasParameterInfos methodInfo, IType[] parametersTypes)private <T extends IHasParameterInfos>
TensureExactMatch(T methodInfo, IType[] argTypes)private java.lang.StringfeatureRepresentation()java.util.List<IExpression>getBoundArgs()private java.util.List<? extends IInvocableType>getConstructorTypes()IFeatureInfogetFeature()private ITypegetFeatureReturnType()IExpressiongetFinalRoot()ITypegetFinalRootType()java.util.List<? extends IInvocableType>getFunctionTypes(java.lang.String name)private java.util.List<IType>getFunctionTypeVarsToBound(IHasParameterInfos methodInfo)java.lang.StringgetMethodName()private java.util.List<? extends IInvocableType>getMethodTypes(java.lang.String name)IType[]getParameterTypes()private IType[]getParameterTypes(IHasParameterInfos hasParameterInfos)java.lang.StringgetPropertyName()IExpressiongetRoot()ITypegetRootType()private ITypegetRootTypeToResolveFeaturesAgainst()private IConstructorInfogetSingleConsructor(IType typeToResolveAgainst, ITypeInfo typeInfo)private IMethodInfogetSingleMethodWithName(java.lang.String methodName, IType typeToResolveAgainst, ITypeInfo typeInfo)private booleanhasBoundArgs(IHasParameterInfos feature)private booleanhasImplicitFirstArg()booleanisBound()booleanisConstructorLiteral()booleanisMethodLiteral()booleanisPropertyLiteral()booleanisStaticish()private IBlockTypemakeBlockType(IType returnType, IType[] params, java.util.List<java.lang.String> argNames)booleanresolveConstructor(java.util.List<IType> typesList)private ITyperesolveConstructorLiteralType(IConstructorInfo constructorInfo)private voidresolveExpressionType()booleanresolveMethod(java.lang.String methodName, java.util.List<IType> typesList)private ITyperesolveMethodLiteralType(IMethodInfo methodInfo)booleanresolveProperty(java.lang.String propName)private ITyperesolvePropertyLiteralType(IPropertyInfo propertyInfo)voidsetFeature(IHasParameterInfos feature, java.util.List<IExpression> arguments)java.lang.StringtoString()Subclasses should return a String representing the parsed expression.-
Methods inherited from class gw.internal.gosu.parser.Expression
evaluate, evaluate, getContextType, getReturnType, getType, getTypeImpl, isNullSafe, isUnchecked, setType
-
Methods inherited from class gw.internal.gosu.parser.ParsedElement
addExceptionsFrom, addParseException, addParseException, addParseException, addParseExceptions, addParseIssues, addParseWarning, addParseWarning, addParseWarnings, addToken, adjustColumn, adjustLineNum, assignTokens, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, compactParseTree, findAncestorParsedElementByType, findDeclaringStatement, findLineNumberOfDeclaration, findRootParsedElement, getAnnotations, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getEnclosingFeatureInfo, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, initEmptyParseTree, initLocation, isCompileTimeConstant, isSuppressed, isSuppressed, isSynthetic, makeDoubleValue, makeFloatValue, makeInteger, makeLong, removeParseException, removeParseWarning, removeParseWarningRecursively, setGosuProgram, setLineNum, setLocation, setParent, setSynthetic, shouldClearParseInfo, visit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.parser.IExpression
evaluate, evaluate, getContextType, isNullSafe, isUnchecked
-
Methods inherited from interface gw.lang.parser.IParsedElement
addExceptionsFrom, addParseException, addParseException, addParseWarning, addParseWarning, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, findAncestorParsedElementByType, findDeclaringStatement, findRootParsedElement, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getReturnType, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, isCompileTimeConstant, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Field Detail
-
MAX_BLOCK_ARGS
private static final int MAX_BLOCK_ARGS
- See Also:
- Constant Field Values
-
_root
private IExpression _root
-
_feature
IFeatureInfo _feature
-
_parameterTypes
private IType[] _parameterTypes
-
_boundArgs
private java.util.List<IExpression> _boundArgs
-
_blockType
private IBlockType _blockType
-
-
Constructor Detail
-
FeatureLiteral
public FeatureLiteral(Expression rootExpr)
-
-
Method Detail
-
resolveProperty
public boolean resolveProperty(java.lang.String propName)
-
resolveMethod
public boolean resolveMethod(java.lang.String methodName, java.util.List<IType> typesList)
-
resolveConstructor
public boolean resolveConstructor(java.util.List<IType> typesList)
-
setFeature
public void setFeature(IHasParameterInfos feature, java.util.List<IExpression> arguments)
-
toString
public java.lang.String toString()
Description copied from class:ExpressionSubclasses should return a String representing the parsed expression.- Specified by:
toStringin classExpression
-
isConstructorLiteral
public boolean isConstructorLiteral()
-
isMethodLiteral
public boolean isMethodLiteral()
-
isPropertyLiteral
public boolean isPropertyLiteral()
-
getRoot
public IExpression getRoot()
-
getFinalRoot
public IExpression getFinalRoot()
- Specified by:
getFinalRootin interfaceIFeatureLiteralExpression- Returns:
- the final root expression of the feature literal
-
getFinalRootType
public IType getFinalRootType()
- Specified by:
getFinalRootTypein interfaceIFeatureLiteralExpression- Returns:
- the root type of the entire literal chain (if one exists)
-
getRootType
public IType getRootType()
- Specified by:
getRootTypein interfaceIFeatureLiteralExpression- Returns:
- the type that the feature that this literal refers to is on
-
getPropertyName
public java.lang.String getPropertyName()
-
getMethodName
public java.lang.String getMethodName()
-
getBoundArgs
public java.util.List<IExpression> getBoundArgs()
- Specified by:
getBoundArgsin interfaceIFeatureLiteralExpression- Returns:
- bound args of this feature, or null if there are no bound args
-
isBound
public boolean isBound()
- Specified by:
isBoundin interfaceIFeatureLiteralExpression- Returns:
- true if this literal is bound at its root
-
getParameterTypes
public IType[] getParameterTypes()
-
isStaticish
public boolean isStaticish()
-
getFeature
public IFeatureInfo getFeature()
- Specified by:
getFeaturein interfaceIFeatureLiteralExpression- Returns:
- the feature associated with this literal
-
getFunctionTypes
public java.util.List<? extends IInvocableType> getFunctionTypes(java.lang.String name)
-
getSingleMethodWithName
private IMethodInfo getSingleMethodWithName(java.lang.String methodName, IType typeToResolveAgainst, ITypeInfo typeInfo)
-
getSingleConsructor
private IConstructorInfo getSingleConsructor(IType typeToResolveAgainst, ITypeInfo typeInfo)
-
ensureExactMatch
private <T extends IHasParameterInfos> T ensureExactMatch(T methodInfo, IType[] argTypes)
-
boundGenericFunctionTypeVariables
private IType[] boundGenericFunctionTypeVariables(IHasParameterInfos methodInfo, IType[] parametersTypes)
-
getFunctionTypeVarsToBound
private java.util.List<IType> getFunctionTypeVarsToBound(IHasParameterInfos methodInfo)
-
makeBlockType
private IBlockType makeBlockType(IType returnType, IType[] params, java.util.List<java.lang.String> argNames)
-
getMethodTypes
private java.util.List<? extends IInvocableType> getMethodTypes(java.lang.String name)
-
getConstructorTypes
private java.util.List<? extends IInvocableType> getConstructorTypes()
-
resolveExpressionType
private void resolveExpressionType()
-
resolvePropertyLiteralType
private IType resolvePropertyLiteralType(IPropertyInfo propertyInfo)
-
resolveMethodLiteralType
private IType resolveMethodLiteralType(IMethodInfo methodInfo)
-
resolveConstructorLiteralType
private IType resolveConstructorLiteralType(IConstructorInfo constructorInfo)
-
argNames
private java.util.List<java.lang.String> argNames(IHasParameterInfos hasParams)
-
adjustParametersForFeature
private IType[] adjustParametersForFeature(IHasParameterInfos feature, IType[] params)
-
hasBoundArgs
private boolean hasBoundArgs(IHasParameterInfos feature)
-
hasImplicitFirstArg
private boolean hasImplicitFirstArg()
-
getParameterTypes
private IType[] getParameterTypes(IHasParameterInfos hasParameterInfos)
-
featureRepresentation
private java.lang.String featureRepresentation()
-
getRootTypeToResolveFeaturesAgainst
private IType getRootTypeToResolveFeaturesAgainst()
-
getFeatureReturnType
private IType getFeatureReturnType()
-
-