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
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private Expression[]
private IType[]
private IConstructorInfo
private int
private IInitializerExpression
private int[]
private List<Expression>
private ITypeLiteralExpression
private List<Expression>
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
ConstructorsConstructorDescriptionConstructs a BeanMethodCallExpression given an ISymbolTable instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSizeExpression
(Expression sizeExpression) The size expression for the new array operation.evaluate()
Evaluates this Expression and returns the result.int
getArgs()
IType[]
private Class<?>
getArrayClass
(IType type) private Class<?>
private Class<?>
getComponentClass
(IType type) int[]
boolean
boolean
void
setAnonymousClass
(boolean anonymous) void
setArgPosition
(int iArgPos) void
setArgs
(Expression[] args) void
setArgTypes
(IType... argTypes) void
setConstructor
(IConstructorInfo constructor) The constructor for the new operation.void
setInitializer
(IInitializerExpression initializerExpression) void
setNamedArgOrder
(int[] namedArgOrder) void
setTypeLiteral
(ITypeLiteralExpression typeLiteral) void
setValueExpressions
(List<Expression> valueExpressions) The value expression for the new array operation.toString()
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
-
Field Details
-
_argTypes
-
_args
-
_constructor
-
_valueExpressions
-
_sizeExpressions
-
_iArgPos
private int _iArgPos -
_typeLiteral
-
_initExpr
-
_anonymous
private boolean _anonymous -
_namedArgOrder
private int[] _namedArgOrder
-
-
Constructor Details
-
NewExpression
public NewExpression()Constructs a BeanMethodCallExpression given an ISymbolTable instance.
-
-
Method Details
-
getArgTypes
- Specified by:
getArgTypes
in interfaceINewExpression
- Returns:
- An array of IType for the arguments of the method call.
-
setArgTypes
- Parameters:
argTypes
- An array of IType for the arguments of the method call.
-
getArgs
- Specified by:
getArgs
in interfaceIHasArguments
- Specified by:
getArgs
in interfaceINewExpression
- Returns:
- An array of expressions for corresponding to the arguments in the expression.
-
setArgs
- Parameters:
args
- An array of expressions for corresponding to the arguments in the expression.
-
getConstructor
- Specified by:
getConstructor
in interfaceINewExpression
-
getArgPosition
public int getArgPosition()- Specified by:
getArgPosition
in interfaceIHasArguments
-
setArgPosition
public void setArgPosition(int iArgPos) -
setConstructor
The constructor for the new operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
setValueExpressions
The value expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
getValueExpressions
- Specified by:
getValueExpressions
in interfaceINewExpression
-
setInitializer
-
getInitializer
- Specified by:
getInitializer
in interfaceINewExpression
-
addSizeExpression
The size expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
getSizeExpressions
- Specified by:
getSizeExpressions
in interfaceINewExpression
-
isCompileTimeConstant
public boolean isCompileTimeConstant()- Specified by:
isCompileTimeConstant
in interfaceIParsedElement
- Overrides:
isCompileTimeConstant
in classParsedElement
-
evaluate
Description copied from interface:IExpression
Evaluates this Expression and returns the result.- Specified by:
evaluate
in interfaceIExpression
- Overrides:
evaluate
in classExpression
-
getArrayClass
-
getComponentClass
-
getClassForRareCaseWhenRunningIJEditorProjectWhereGosuCoreJavaTypesAreSourceBased
-
toString
Description copied from class:Expression
Subclasses should return a String representing the parsed expression.- Specified by:
toString
in classExpression
-
isAnonymousClass
public boolean isAnonymousClass()- Specified by:
isAnonymousClass
in interfaceINewExpression
-
setAnonymousClass
public void setAnonymousClass(boolean anonymous) -
getTypeLiteral
- Specified by:
getTypeLiteral
in interfaceINewExpression
-
setTypeLiteral
-
getNamedArgOrder
public int[] getNamedArgOrder() -
setNamedArgOrder
public void setNamedArgOrder(int[] namedArgOrder)
-