Class NewExpression
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- gw.internal.gosu.parser.expressions.NewExpression
-
- All Implemented Interfaces:
INewExpression,IExpression,IHasArguments,IHasType,IParsedElement
- Direct Known Subclasses:
AnnotationExpression,InferredNewExpression
public class NewExpression extends Expression implements INewExpression
The 'new' operator as an expression:new-expression new <type-expression> ( [<argument-list>] ) [ {...} ] new <type-expression> [ <expression> ] new <type-expression> [] { [<array-value-list>] }- See Also:
IGosuParser
-
-
Field Summary
-
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 NewExpression()Constructs a BeanMethodCallExpression given an ISymbolTable instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSizeExpression(Expression sizeExpression)The size expression for the new array operation.Objectevaluate()intgetArgPosition()Expression[]getArgs()IType[]getArgTypes()IConstructorInfogetConstructor()IInitializerExpressiongetInitializer()int[]getNamedArgOrder()List<Expression>getSizeExpressions()ITypeLiteralExpressiongetTypeLiteral()List<Expression>getValueExpressions()booleanisAnonymousClass()booleanisCompileTimeConstant()voidsetAnonymousClass(boolean anonymous)voidsetArgPosition(int iArgPos)voidsetArgs(Expression[] args)voidsetArgTypes(IType... argTypes)voidsetConstructor(IConstructorInfo constructor)The constructor for the new operation.voidsetInitializer(IInitializerExpression initializerExpression)voidsetNamedArgOrder(int[] namedArgOrder)voidsetTypeLiteral(ITypeLiteralExpression typeLiteral)voidsetValueExpressions(List<Expression> valueExpressions)The value expression for the new array operation.StringtoString()Subclasses should return a String representing the parsed expression.-
Methods inherited from class gw.internal.gosu.parser.Expression
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, 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, 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, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Method Detail
-
getArgTypes
public IType[] getArgTypes()
- Specified by:
getArgTypesin interfaceINewExpression- Returns:
- An array of IType for the arguments of the method call.
-
setArgTypes
public void setArgTypes(IType... argTypes)
- Parameters:
argTypes- An array of IType for the arguments of the method call.
-
getArgs
public Expression[] getArgs()
- Specified by:
getArgsin interfaceIHasArguments- Specified by:
getArgsin interfaceINewExpression- Returns:
- An array of expressions for corresponding to the arguments in the expression.
-
setArgs
public void setArgs(Expression[] args)
- Parameters:
args- An array of expressions for corresponding to the arguments in the expression.
-
getConstructor
public IConstructorInfo getConstructor()
- Specified by:
getConstructorin interfaceINewExpression
-
getArgPosition
public int getArgPosition()
- Specified by:
getArgPositionin interfaceIHasArguments
-
setArgPosition
public void setArgPosition(int iArgPos)
-
setConstructor
public void setConstructor(IConstructorInfo constructor)
The constructor for the new operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
setValueExpressions
public void setValueExpressions(List<Expression> valueExpressions)
The value expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
getValueExpressions
public List<Expression> getValueExpressions()
- Specified by:
getValueExpressionsin interfaceINewExpression
-
setInitializer
public void setInitializer(IInitializerExpression initializerExpression)
-
getInitializer
public IInitializerExpression getInitializer()
- Specified by:
getInitializerin interfaceINewExpression
-
addSizeExpression
public void addSizeExpression(Expression sizeExpression)
The size expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
getSizeExpressions
public List<Expression> getSizeExpressions()
- Specified by:
getSizeExpressionsin interfaceINewExpression
-
isCompileTimeConstant
public boolean isCompileTimeConstant()
- Specified by:
isCompileTimeConstantin interfaceIParsedElement- Overrides:
isCompileTimeConstantin classParsedElement
-
evaluate
public Object evaluate()
- Specified by:
evaluatein interfaceIExpression- Overrides:
evaluatein classExpression
-
toString
public String toString()
Description copied from class:ExpressionSubclasses should return a String representing the parsed expression.- Specified by:
toStringin classExpression
-
isAnonymousClass
public boolean isAnonymousClass()
- Specified by:
isAnonymousClassin interfaceINewExpression
-
setAnonymousClass
public void setAnonymousClass(boolean anonymous)
-
getTypeLiteral
public ITypeLiteralExpression getTypeLiteral()
- Specified by:
getTypeLiteralin interfaceINewExpression
-
setTypeLiteral
public void setTypeLiteral(ITypeLiteralExpression typeLiteral)
-
getNamedArgOrder
public int[] getNamedArgOrder()
-
setNamedArgOrder
public void setNamedArgOrder(int[] namedArgOrder)
-
-