Package gw.internal.gosu.ir.transform
Class AbstractElementTransformer<T extends IParsedElement>
java.lang.Object
gw.internal.gosu.ir.transform.AbstractElementTransformer<T>
- Direct Known Subclasses:
AbstractExpressionTransformer,AbstractStatementTransformer,CollectionInitializerExpressionTransformer,FunctionStatementTransformer,GosuClassTransformer,GosuFragmentTransformer,MapInitializerExpressionTransformer,ObjectInitializerExpressionTransformer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Map<String, ICustomExpressionRuntime> static final Class[]static final Stringstatic final Stringstatic final Stringstatic final org.objectweb.asm.Typestatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_cc()protected voidassignStructuralTypeOwner(IExpression rootExpr, IRExpression irMethodCall) protected booleanavoidVerifyError(IType owner, IRType rootType, IRelativeTypeInfo.Accessibility accessibility) protected IRExpressionbooleanLiteral(boolean value) boxValue(IRType lhsType, IRExpression root) boxValue(IType lhsType, IRExpression root) boxValueToType(IType toType, IRExpression root) protected IRExpressionbuildAddition(IRExpression lhs, IRExpression rhs) protected IRExpressionbuildArithmetic(IRExpression lhs, IRExpression rhs, IRArithmeticExpression.Operation operation) protected IRExpressionbuildArrayLength(IRExpression root) protected IRExpressionbuildArrayLoad(IRExpression root, int index, IRType componentType) protected IRExpressionbuildArrayLoad(IRExpression root, IRExpression index, IRType componentType) protected IRStatementbuildArrayStore(IRExpression lhs, IRExpression index, IRExpression value, IRType componentType) protected IRAssignmentStatementbuildAssignment(IRSymbol symbol, IRExpression value) protected IRExpressionbuildCast(IRType castType, IRExpression expression) protected IRCompositeExpressionbuildComposite(IRElement... elements) protected IRCompositeExpressionbuildComposite(List<IRElement> elements) protected IREqualityExpressionbuildEquals(IRExpression lhs, IRExpression rhs) protected IRExpressionbuildFieldGet(IRType owner, String fieldName, IRType fieldType, IRExpression root) protected IRStatementbuildFieldSet(IRType owner, String fieldName, IRType fieldType, IRExpression root, IRExpression value) protected IRRelationalExpressionbuildGreaterThan(IRExpression lhs, IRExpression rhs) protected IRIfStatementbuildIf(IRExpression test, IRStatement ifStatement) protected IRIfStatementbuildIfElse(IRExpression test, IRStatement ifStatement, IRStatement elseStatement) protected IRExpressionbuildInitializedArray(IRType componentType, List<IRExpression> values) protected IRMethodCallStatementbuildMethodCall(IRExpression methodCall) protected IRMethodCallExpressionbuildMethodCall(IRType ownersType, String name, boolean isInterface, IRType returnType, List<IRType> paramTypes, IRExpression root, List<IRExpression> args) protected IRMethodCallExpressionbuildMethodCall(Class ownersType, String name, Class returnType, Class[] paramTypes, IRExpression root, List<IRExpression> args) protected IRExpressionbuildNegation(IRExpression root) protected IRNewStatementbuildNewExpression(IRNewExpression newExpression) protected IRExpressionbuildNewExpression(IRType type, List<IRType> parameterTypes, List<IRExpression> args) protected IRExpressionbuildNewExpression(Class type, Class[] parameterTypes, List<IRExpression> args) protected IREqualityExpressionbuildNotEquals(IRExpression lhs, IRExpression rhs) protected IRExpressionbuildNullCheckTernary(IRExpression root, IRExpression ifNull, IRExpression ifNotNull) protected IRStatementprotected IRExpressionbuildSubtraction(IRExpression lhs, IRExpression rhs) protected IRExpressionbuildTernary(IRExpression test, IRExpression trueValue, IRExpression falseValue, IRType resultType) protected IRThrowStatementbuildThrow(IRExpression exception) callMethod(IRMethod method, IRExpression root, List<IRExpression> explicitArgs) callMethod(IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder) callMethod(IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder, boolean special) callMethod(IJavaClassInfo cls, String strMethod, Class[] paramTypes, IRExpression root, List<IRExpression> args) callMethod(Class cls, String strMethod, Class[] paramTypes, IRExpression root, List<IRExpression> args) callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> explicitArgs) callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder) callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> implicitArgs, List<IRExpression> explicitArgs, int[] namedArgOrder) callStaticMethod(Class cls, String strMethod, Class[] paramTypes, List<IRExpression> args) protected IRExpressioncastResultingTypeIfNecessary(IRType expectedType, IRType actualReturnType, IRExpression root) protected IRExpressioncharLiteral(char c) protected IRExpressioncheckCast(IType type, IRExpression expression) protected IRExpressioncheckCast(IType type, IRExpression expression, boolean bGetConcreteTypeForMetaType) protected IRExpressioncheckCast(Class cls, IRExpression expression) protected IRExpressionclassLiteral(IRType value) protected IRExpressionclassLiteral(IJavaClassInfo value) protected IRExpressionclassLiteral(Class value) Deprecated.static voidprotected IRExpressionconvertBoxedNullToPrimitive(IType boxedType) protected IRExpressionconvertNullToPrimitive(IType primitive) protected IRAssignmentStatementconvertOperandToBig(IType bigType, Class bigClass, IType operandType, IRExpression operand, IRSymbol tempRet) protected IRAssignmentStatementconvertOperandToPrimitive(IType primitiveType, IType operandType, IRExpression operand, IRSymbol tempRet) protected IRAssignmentStatementconvertOperandToRational(IType operandType, IRExpression operand, IRSymbol tempRet) protected static List<IRExpression> exprList(IRExpression... expressions) protected IRExpressionfastStringCoercion(IRExpression expr, IType operandType) protected final ITypefindComparableParamType(IType type) static ITypefindDimensionType(IType type) protected IGosuVarPropertyInfoprotected StringgetClassInfos(IType[] parameters) getConcreteType(IType type) protected IRType[]getConstructorParamTypes(IType[] declaredParams, int iTypeParams, IType type) Parameters are order like so: ctor( [OuterThis,] [This,] [CapturedSymbols,] [TypeParams,] params )static ICustomExpressionRuntimegetCustomRuntime(String id, IType enclosingClass) static FieldgetDeclaredField(Class cls, String strName) static FieldgetDeclaredFieldImpl(Class cls, String strName) static IJavaClassMethodgetDeclaredMethod(IJavaClassInfo cls, String strName, Class... params) static MethodgetDeclaredMethod(Class cls, String strName, Class... params) getDefaultConstIns(IType type) static IRTypegetDescriptor(IType type) static IRTypegetDescriptor(IType type, boolean getConcreteTypeForMetaType) static IRTypestatic IRTypegetDescriptor(Class cls) static IDynamicFunctionSymbolgetEnclosingDFS(ICompilableType gsClass) protected IRExpressiongetField(IRProperty field, IRExpression root) protected IRExpressiongetField_new(IRProperty irProp, IRExpression root, IRType expectedType) protected IRExpressiongetInstanceField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root) getIRTypes(IJavaClassInfo[] iJavaClassInfos) getIRTypes(Class[] classes) intgetModifiers(Symbol symbol) protected Tstatic ITypegetRuntimeEnclosingType(IType type) protected IRExpressiongetStaticField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility) static IType[]getTypes(IParameterInfo[] parameters) protected final StringgetTypeVarParamName(IGenericTypeVariable typeVar) static List<IGenericTypeVariable> protected IRExpressionhandleCustomExpressionRuntime(ICustomExpressionRuntime customRuntime, IType expectedType) handleNamedArgs(List<IRExpression> explicitArgs, int[] namedArgOrder) Facilitates evaluation of named args in lexical order.protected IRIdentifieridentifier(IRSymbol symbol) protected IRAssignmentStatementinitLocalVar(Symbol varSym, IRExpression initialValue) protected IRAssignmentStatementinitLocalVarWithDefault(Symbol varSym) static ObjectinitMultiArray(IType componentType, Object instance, int iDimension, int[] sizes) protected booleanstatic booleanstatic booleanisBoxedIntType(IType type) static booleanstatic booleanisBytecodeType(IType type) protected booleanbooleanstatic booleanisEnhancementType(IType type) protected static booleanisEvalProgram(IGosuClassInternal gsClass) static booleanisExecuteMethod(String name) protected booleanisHandledByCustomCoercion(IType operandType) static booleanprotected ICompilableTypeInternalprotected booleanstatic booleanisNonBigBoxedNumberType(IType type) static booleanisNonStaticInnerClass(IType type) static booleanisNumberType(IType type) protected booleanisPrimitiveNumberType(IType type) booleanbooleanstatic List<GosuAnnotationInfo> makeAnnotationInfos(List<IGosuAnnotation> gosuAnnotations, IFeatureInfo fiAnnotated) protected IRExpressionmakeArrayViaTypeInfo(IType atomicType, List<Expression> valueExpressions) protected IRExpressionmakeEmptyArrayViaTypeInfo(IType atomicType, List<Expression> sizeExpressions) protected IRSymbolmakeIRSymbol(Symbol varSym) maybeUnwrapMetaType(IType rootType) protected IRExpressionnewArray(IRType atomicType, IRExpression sizeExpression) nullCheckVar(IRSymbol symbol) protected IRExpressionprotected IRExpressionnumberConvert(IRType from, IRType to, IRExpression root) protected IRExpressionnumberConvert(IType from, IType to, IRExpression root) protected IRExpressionnumericLiteral(Number value) protected IRExpressionpushArrayOfDefValueExpr(IExpression[] array) protected IRExpressionpushArrayOfString(String[] array) pushArrayOfTypes(IType[] types) protected voidpushCapturedSymbols(IType type, List<IRExpression> args, boolean ignoreExternalSymbols) protected IRExpressionpushConstant(Object constant) protected voidprotected IRExpressionpushLazyType(IType type) pushLazyType(IType type, IGenericTypeVariable[] tvs) protected IRExpressionpushNull()protected IRExpressionprotected IRExpressionprotected IRExpressionpushOuter(IType outerTarget, IType currentOuter, IRExpression root) protected IRExpressionpushParamTypes(IParameterInfo[] parameters) protected IRExpressionpushString(IExpression expr) protected IRExpressionpushThis()protected IRExpressionpushThisOrOuter(IType currentType) protected intpushTypeParametersForConstructor(IExpression expr, IType type, List<IRExpression> args, boolean bSuperCall, boolean genericJavaInterop) static booleanstatic booleanstatic booleanprotected voidprotected IRStatementsetField(IRProperty field, IRExpression root, IRExpression value) protected IRStatementsetField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root, IRExpression value) protected IRStatementsetInstanceField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root, IRExpression value) protected IRStatementsetStaticField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression value) protected IRExpressionstringLiteral(String value) unboxValueFromType(IType boxedType, IRExpression root) unboxValueToType(IRType lhsType, IRExpression expression) unboxValueToType(IType lhsType, IRExpression expression) static CharactervalueOf(char c)
-
Field Details
-
CTX_SYMBOL_SUFFIX
- See Also:
-
CTX_SYMBOL
- See Also:
-
CUSTOM_RUNTIMES
-
EMPTY_CLASS_ARRAY
-
OUTER_ACCESS
- See Also:
-
CAPTURED_VAR_PREFIX
- See Also:
-
ENHANCEMENT_TYPE_PARAM_PREFIX
- See Also:
-
TYPE_PARAM_PREFIX
- See Also:
-
ENUM_PARAM_PREFIX
- See Also:
-
OBJECT_TYPE
public static final org.objectweb.asm.Type OBJECT_TYPE -
ENHANCEMENT_THIS_REF
- See Also:
-
-
Constructor Details
-
AbstractElementTransformer
-
-
Method Details
-
clearCustomRuntimes
public static void clearCustomRuntimes() -
_cc
-
setCc
-
getParsedElement
-
getGosuClass
-
callStaticMethod
public IRExpression callStaticMethod(Class cls, String strMethod, Class[] paramTypes, List<IRExpression> args) -
callMethod
public IRExpression callMethod(Class cls, String strMethod, Class[] paramTypes, IRExpression root, List<IRExpression> args) -
callMethod
public IRExpression callMethod(IJavaClassInfo cls, String strMethod, Class[] paramTypes, IRExpression root, List<IRExpression> args) -
callMethod
-
callMethod
public IRExpression callMethod(IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder) -
callMethod
public IRExpression callMethod(IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder, boolean special) -
callSpecialMethod
public IRExpression callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> explicitArgs) -
callSpecialMethod
public IRExpression callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> explicitArgs, int[] namedArgOrder) -
callSpecialMethod
public IRExpression callSpecialMethod(IRType rootType, IRMethod method, IRExpression root, List<IRExpression> implicitArgs, List<IRExpression> explicitArgs, int[] namedArgOrder) -
handleNamedArgs
Facilitates evaluation of named args in lexical order. E.g.,callMe( :param3 = expr1, :param1 = expr2, :param2 = expr3 )
is parsed as:callMe( expr2, expr3, expr1 )
which is compiled to:temp1 = expr1 temp2 = expr2 temp3 = expr3 callMe( temp2, temp3, temp1 )
- Parameters:
explicitArgs- The arg expressions in proper order for the target call. The expressions are replaced with the temp vars.namedArgOrder- The lexical ordering of the args- Returns:
- The temp var assignments in lexical order
-
isExecuteMethod
-
nullCheckVar
-
pushLazyType
-
pushLazyType
-
pushType
-
pushType
-
pushArrayOfString
-
pushArrayOfDefValueExpr
-
pushArrayOfTypes
-
requiresImplicitEnhancementArg
-
requiresImplicitEnhancementArg
-
getClassInfos
-
getConcreteType
-
getDescriptor
-
getDescriptor
-
getDescriptor
-
getDescriptor
-
getDefaultConstIns
-
getModifiers
-
isCompilingEnhancement
public boolean isCompilingEnhancement() -
isProgramOrEnclosedInProgram
-
boxValue
-
valueOf
-
boxValue
-
boxValueToType
-
unboxValueToType
-
unboxValueToType
-
unboxValueFromType
-
isProgram
-
isEnhancementType
-
isBytecodeType
-
isBytecodeType
-
getTypes
-
pushString
-
pushParamTypes
-
pushNull
-
pushConstant
-
convertBoxedNullToPrimitive
-
convertNullToPrimitive
-
checkCast
-
checkCast
-
checkCast
protected IRExpression checkCast(IType type, IRExpression expression, boolean bGetConcreteTypeForMetaType) -
convertOperandToBig
protected IRAssignmentStatement convertOperandToBig(IType bigType, Class bigClass, IType operandType, IRExpression operand, IRSymbol tempRet) -
convertOperandToRational
protected IRAssignmentStatement convertOperandToRational(IType operandType, IRExpression operand, IRSymbol tempRet) -
convertOperandToPrimitive
protected IRAssignmentStatement convertOperandToPrimitive(IType primitiveType, IType operandType, IRExpression operand, IRSymbol tempRet) -
numberConvert
-
numberConvert
-
isIntType
-
isPrimitiveNumberType
-
isBigType
-
isNonBigBoxedNumberType
-
isBoxedIntType
-
isNumberType
-
isMemberOnEnclosingType
-
isMemberOnEnhancementOfEnclosingType
-
pushThis
-
pushThisOrOuter
-
pushOuter
-
pushOuter
-
pushOuter
-
getInstanceField
protected IRExpression getInstanceField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root) -
getStaticField
protected IRExpression getStaticField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility) -
getField
-
setField
-
setInstanceField
protected IRStatement setInstanceField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root, IRExpression value) -
setStaticField
protected IRStatement setStaticField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression value) -
avoidVerifyError
protected boolean avoidVerifyError(IType owner, IRType rootType, IRelativeTypeInfo.Accessibility accessibility) -
setField
protected IRStatement setField(IType owner, String strField, IRType fieldType, IRelativeTypeInfo.Accessibility accessibility, IRExpression root, IRExpression value) -
isEvalProgram
-
getDeclaredField
-
getDeclaredFieldImpl
-
getDeclaredMethod
-
getDeclaredMethod
public static IJavaClassMethod getDeclaredMethod(IJavaClassInfo cls, String strName, Class... params) -
newArray
-
makeArrayViaTypeInfo
-
makeEmptyArrayViaTypeInfo
protected IRExpression makeEmptyArrayViaTypeInfo(IType atomicType, List<Expression> sizeExpressions) -
initMultiArray
-
pushRuntimeTypeOfTypeVar
-
getEnclosingDFS
-
getTypeVarsForDFS
-
getConstructorParamTypes
Parameters are order like so: ctor( [OuterThis,] [This,] [CapturedSymbols,] [TypeParams,] params ) -
pushTypeParametersForConstructor
protected int pushTypeParametersForConstructor(IExpression expr, IType type, List<IRExpression> args, boolean bSuperCall, boolean genericJavaInterop) -
pushEnumSuperConstructorArguments
-
initLocalVarWithDefault
-
initLocalVar
-
makeIRSymbol
-
pushCapturedSymbols
protected void pushCapturedSymbols(IType type, List<IRExpression> args, boolean ignoreExternalSymbols) -
collectArgsIntoObjArray
-
getActualPropertyInfo
-
castResultingTypeIfNecessary
protected IRExpression castResultingTypeIfNecessary(IRType expectedType, IRType actualReturnType, IRExpression root) -
getRuntimeEnclosingType
- Parameters:
type-- Returns:
- the actual runtime enclosing type of this type (handles the case of enhancements, when the "enclosing type" at runtime will be the enhanced object, rather than the acutal enclosing type)
-
maybeUnwrapMetaType
-
classLiteral
Deprecated. -
classLiteral
-
classLiteral
-
getCustomRuntime
-
handleCustomExpressionRuntime
protected IRExpression handleCustomExpressionRuntime(ICustomExpressionRuntime customRuntime, IType expectedType) -
pushExternalSymbolsMap
-
requiresExternalSymbolCapture
-
buildMethodCall
protected IRMethodCallExpression buildMethodCall(IRType ownersType, String name, boolean isInterface, IRType returnType, List<IRType> paramTypes, IRExpression root, List<IRExpression> args) -
buildMethodCall
protected IRMethodCallExpression buildMethodCall(Class ownersType, String name, Class returnType, Class[] paramTypes, IRExpression root, List<IRExpression> args) -
buildCast
-
numericLiteral
-
charLiteral
-
booleanLiteral
-
nullLiteral
-
stringLiteral
-
buildArrayLoad
-
buildArrayLoad
-
buildFieldGet
protected IRExpression buildFieldGet(IRType owner, String fieldName, IRType fieldType, IRExpression root) -
buildFieldSet
protected IRStatement buildFieldSet(IRType owner, String fieldName, IRType fieldType, IRExpression root, IRExpression value) -
buildAssignment
-
identifier
-
buildArrayStore
protected IRStatement buildArrayStore(IRExpression lhs, IRExpression index, IRExpression value, IRType componentType) -
buildInitializedArray
-
buildNewExpression
protected IRExpression buildNewExpression(IRType type, List<IRType> parameterTypes, List<IRExpression> args) -
buildNewExpression
protected IRExpression buildNewExpression(Class type, Class[] parameterTypes, List<IRExpression> args) -
getTypeVarParamName
-
getCapturedSymbolParameterName
-
exprList
-
getIRTypes
-
getIRTypes
-
buildNullCheckTernary
protected IRExpression buildNullCheckTernary(IRExpression root, IRExpression ifNull, IRExpression ifNotNull) -
buildThrow
-
buildIf
-
buildIfElse
protected IRIfStatement buildIfElse(IRExpression test, IRStatement ifStatement, IRStatement elseStatement) -
buildComposite
-
buildComposite
-
buildMethodCall
-
buildNewExpression
-
buildReturn
-
buildEquals
-
buildNotEquals
-
buildGreaterThan
-
buildTernary
protected IRExpression buildTernary(IRExpression test, IRExpression trueValue, IRExpression falseValue, IRType resultType) -
buildAddition
-
buildSubtraction
-
buildArithmetic
protected IRExpression buildArithmetic(IRExpression lhs, IRExpression rhs, IRArithmeticExpression.Operation operation) -
buildNegation
-
buildArrayLength
-
inStaticContext
protected boolean inStaticContext() -
makeAnnotationInfos
public static List<GosuAnnotationInfo> makeAnnotationInfos(List<IGosuAnnotation> gosuAnnotations, IFeatureInfo fiAnnotated) -
isCheckedArithmeticEnabled
protected boolean isCheckedArithmeticEnabled() -
isNonStaticInnerClass
-
getField_new
-
assignStructuralTypeOwner
-
fastStringCoercion
-
isHandledByCustomCoercion
-
findDimensionType
-
findComparableParamType
-