public abstract class AbstractXbaseCompiler
extends java.lang.Object
Constructor and Description |
---|
AbstractXbaseCompiler() |
Modifier and Type | Method and Description |
---|---|
void |
_toJavaExpression(XExpression func,
ITreeAppendable b) |
void |
_toJavaStatement(XExpression func,
ITreeAppendable b,
boolean isReferenced) |
protected void |
appendDefaultLiteral(ITreeAppendable b,
LightweightTypeReference type) |
protected boolean |
canCompileToJavaExpression(XExpression expression,
ITreeAppendable appendable) |
ITreeAppendable |
compile(XBlockExpression expr,
ITreeAppendable b,
LightweightTypeReference expectedReturnType)
this one trims the outer block
|
ITreeAppendable |
compile(XExpression obj,
ITreeAppendable parentAppendable,
JvmTypeReference expectedReturnType,
java.util.Set<JvmTypeReference> declaredExceptions) |
ITreeAppendable |
compile(XExpression obj,
ITreeAppendable appendable,
LightweightTypeReference expectedReturnType) |
ITreeAppendable |
compile(XExpression obj,
ITreeAppendable parentAppendable,
LightweightTypeReference expectedReturnType,
java.util.Set<JvmTypeReference> declaredExceptions) |
ITreeAppendable |
compileAsJavaExpression(XExpression obj,
ITreeAppendable parentAppendable,
JvmTypeReference expectedType) |
ITreeAppendable |
compileAsJavaExpression(XExpression obj,
ITreeAppendable parentAppendable,
LightweightTypeReference expectedType) |
protected void |
compileWithJvmConstructorCall(XBlockExpression obj,
ITreeAppendable apendable) |
protected void |
declareFreshLocalVariable(XExpression expr,
ITreeAppendable b,
Later expression) |
protected void |
declareSyntheticVariable(XExpression expr,
ITreeAppendable b) |
protected void |
doInternalToJavaStatement(XExpression obj,
ITreeAppendable builder,
boolean isReferenced) |
protected JvmType |
findKnownTopLevelType(java.lang.Class<?> rawType,
org.eclipse.emf.common.notify.Notifier context) |
protected JvmType |
findKnownType(java.lang.Class<?> rawType,
org.eclipse.emf.common.notify.Notifier context) |
protected void |
generateCheckedExceptionHandling(ITreeAppendable appendable) |
protected java.lang.String |
getDefaultValueLiteral(XExpression expr) |
protected JvmTypeReference |
getExpectedType(XExpression expr) |
protected java.lang.String |
getFavoriteVariableName(org.eclipse.emf.ecore.EObject ex) |
protected LightweightTypeReference |
getLightweightExpectedType(XExpression expr) |
protected LightweightTypeReference |
getLightweightReturnType(XExpression expr) |
protected LightweightTypeReference |
getLightweightType(JvmIdentifiableElement identifiable) |
protected LightweightTypeReference |
getLightweightType(XExpression expr) |
protected IdentifiableSimpleNameProvider |
getNameProvider() |
protected java.lang.String |
getReferenceName(XExpression expr,
ITreeAppendable b) |
protected IResolvedTypes |
getResolvedTypes(org.eclipse.emf.ecore.EObject obj) |
protected JvmTypeReference |
getType(JvmIdentifiableElement identifiable) |
protected JvmTypeReference |
getType(XExpression expr) |
protected CommonTypeComputationServices |
getTypeComputationServices() |
protected LightweightTypeReference |
getTypeForVariableDeclaration(XExpression expr) |
TypeReferenceSerializer |
getTypeReferenceSerializer() |
protected java.lang.String |
getVarName(java.lang.Object ex,
ITreeAppendable appendable) |
protected boolean |
hasJvmConstructorCall(XExpression obj) |
protected boolean |
hasUnhandledException(java.util.List<LightweightTypeReference> thrownExceptions,
java.util.Collection<JvmTypeReference> declaredExceptions) |
protected boolean |
internalCanCompileToJavaExpression(XExpression expression,
ITreeAppendable appendable) |
protected abstract void |
internalToConvertedExpression(XExpression obj,
ITreeAppendable appendable,
LightweightTypeReference toBeConvertedTo) |
protected void |
internalToJavaExpression(XExpression obj,
ITreeAppendable appendable) |
protected void |
internalToJavaStatement(XExpression obj,
ITreeAppendable builder,
boolean isReferenced) |
protected boolean |
isEarlyExit(XExpression expr) |
protected boolean |
isJavaConformant(LightweightTypeReference left,
LightweightTypeReference right) |
protected boolean |
isPrimitiveVoid(JvmTypeReference typeRef) |
protected boolean |
isPrimitiveVoid(XExpression xExpression) |
protected boolean |
isReferenceToForeignTypeParameter(JvmTypeReference reference,
org.eclipse.emf.ecore.EObject context) |
protected boolean |
isUnhandledException(LightweightTypeReference thrownException,
java.util.Collection<JvmTypeReference> declaredExceptions) |
protected boolean |
isVariableDeclarationRequired(XExpression expr,
ITreeAppendable b)
whether an expression needs to be declared in a statement
If an expression has side effects this method must return true for it.
|
protected java.lang.String |
makeJavaIdentifier(java.lang.String name) |
protected boolean |
needsSneakyThrow(XExpression obj,
java.util.Collection<JvmTypeReference> declaredExceptions) |
protected ITypeReferenceOwner |
newTypeReferenceOwner(org.eclipse.emf.ecore.EObject context) |
protected JvmTypeReference |
resolveMultiType(JvmTypeReference typeRef,
org.eclipse.emf.ecore.EObject context) |
protected void |
serialize(JvmTypeReference type,
org.eclipse.emf.ecore.EObject context,
ITreeAppendable appendable) |
protected void |
serialize(JvmTypeReference type,
org.eclipse.emf.ecore.EObject context,
ITreeAppendable appendable,
boolean withoutConstraints,
boolean paramsToWildcard) |
protected void |
serialize(JvmTypeReference type,
org.eclipse.emf.ecore.EObject context,
ITreeAppendable appendable,
boolean withoutConstraints,
boolean paramsToWildcard,
boolean paramsToObject,
boolean allowPrimitives) |
void |
setNameProvider(IdentifiableSimpleNameProvider nameProvider) |
void |
toJavaExpression(XExpression obj,
ITreeAppendable appendable) |
void |
toJavaStatement(XExpression obj,
ITreeAppendable appendable,
boolean isReferenced) |
protected LightweightTypeReference |
toLightweight(JvmTypeReference reference,
org.eclipse.emf.ecore.EObject context) |
public TypeReferenceSerializer getTypeReferenceSerializer()
protected JvmType findKnownTopLevelType(java.lang.Class<?> rawType, org.eclipse.emf.common.notify.Notifier context)
protected JvmType findKnownType(java.lang.Class<?> rawType, org.eclipse.emf.common.notify.Notifier context)
protected CommonTypeComputationServices getTypeComputationServices()
protected ITypeReferenceOwner newTypeReferenceOwner(org.eclipse.emf.ecore.EObject context)
protected LightweightTypeReference toLightweight(JvmTypeReference reference, org.eclipse.emf.ecore.EObject context)
public ITreeAppendable compile(XExpression obj, ITreeAppendable appendable, LightweightTypeReference expectedReturnType)
public ITreeAppendable compileAsJavaExpression(XExpression obj, ITreeAppendable parentAppendable, JvmTypeReference expectedType)
public ITreeAppendable compileAsJavaExpression(XExpression obj, ITreeAppendable parentAppendable, LightweightTypeReference expectedType)
protected void appendDefaultLiteral(ITreeAppendable b, LightweightTypeReference type)
protected void generateCheckedExceptionHandling(ITreeAppendable appendable)
protected boolean canCompileToJavaExpression(XExpression expression, ITreeAppendable appendable)
protected boolean internalCanCompileToJavaExpression(XExpression expression, ITreeAppendable appendable)
expression
- to be used by subtypesappendable
- to be used by subtypespublic ITreeAppendable compile(XExpression obj, ITreeAppendable parentAppendable, JvmTypeReference expectedReturnType, java.util.Set<JvmTypeReference> declaredExceptions)
public ITreeAppendable compile(XExpression obj, ITreeAppendable parentAppendable, LightweightTypeReference expectedReturnType, java.util.Set<JvmTypeReference> declaredExceptions)
protected void compileWithJvmConstructorCall(XBlockExpression obj, ITreeAppendable apendable)
protected boolean hasJvmConstructorCall(XExpression obj)
protected boolean needsSneakyThrow(XExpression obj, java.util.Collection<JvmTypeReference> declaredExceptions)
protected boolean hasUnhandledException(java.util.List<LightweightTypeReference> thrownExceptions, java.util.Collection<JvmTypeReference> declaredExceptions)
protected boolean isUnhandledException(LightweightTypeReference thrownException, java.util.Collection<JvmTypeReference> declaredExceptions)
public ITreeAppendable compile(XBlockExpression expr, ITreeAppendable b, LightweightTypeReference expectedReturnType)
protected boolean isEarlyExit(XExpression expr)
protected boolean isPrimitiveVoid(JvmTypeReference typeRef)
protected JvmTypeReference getType(XExpression expr)
protected JvmTypeReference getType(JvmIdentifiableElement identifiable)
protected LightweightTypeReference getLightweightType(XExpression expr)
protected LightweightTypeReference getLightweightType(JvmIdentifiableElement identifiable)
protected LightweightTypeReference getLightweightReturnType(XExpression expr)
protected IResolvedTypes getResolvedTypes(org.eclipse.emf.ecore.EObject obj)
protected JvmTypeReference getExpectedType(XExpression expr)
protected LightweightTypeReference getLightweightExpectedType(XExpression expr)
protected abstract void internalToConvertedExpression(XExpression obj, ITreeAppendable appendable, LightweightTypeReference toBeConvertedTo)
protected boolean isPrimitiveVoid(XExpression xExpression)
protected final void internalToJavaStatement(XExpression obj, ITreeAppendable builder, boolean isReferenced)
protected void doInternalToJavaStatement(XExpression obj, ITreeAppendable builder, boolean isReferenced)
public void toJavaExpression(XExpression obj, ITreeAppendable appendable)
public void toJavaStatement(XExpression obj, ITreeAppendable appendable, boolean isReferenced)
protected void internalToJavaExpression(XExpression obj, ITreeAppendable appendable)
public void _toJavaStatement(XExpression func, ITreeAppendable b, boolean isReferenced)
b
- the appendable, unused, but necessary for dispatching purposeisReferenced
- unused, but necessary for dispatching purposepublic void _toJavaExpression(XExpression func, ITreeAppendable b)
b
- the appendable, unused, but necessary for dispatching purposeprotected void serialize(JvmTypeReference type, org.eclipse.emf.ecore.EObject context, ITreeAppendable appendable)
protected void serialize(JvmTypeReference type, org.eclipse.emf.ecore.EObject context, ITreeAppendable appendable, boolean withoutConstraints, boolean paramsToWildcard)
protected void serialize(JvmTypeReference type, org.eclipse.emf.ecore.EObject context, ITreeAppendable appendable, boolean withoutConstraints, boolean paramsToWildcard, boolean paramsToObject, boolean allowPrimitives)
protected boolean isReferenceToForeignTypeParameter(JvmTypeReference reference, org.eclipse.emf.ecore.EObject context)
protected JvmTypeReference resolveMultiType(JvmTypeReference typeRef, org.eclipse.emf.ecore.EObject context)
protected java.lang.String getVarName(java.lang.Object ex, ITreeAppendable appendable)
public void setNameProvider(IdentifiableSimpleNameProvider nameProvider)
protected IdentifiableSimpleNameProvider getNameProvider()
protected java.lang.String getFavoriteVariableName(org.eclipse.emf.ecore.EObject ex)
protected java.lang.String makeJavaIdentifier(java.lang.String name)
protected boolean isJavaConformant(LightweightTypeReference left, LightweightTypeReference right)
protected void declareSyntheticVariable(XExpression expr, ITreeAppendable b)
protected java.lang.String getDefaultValueLiteral(XExpression expr)
protected void declareFreshLocalVariable(XExpression expr, ITreeAppendable b, Later expression)
protected LightweightTypeReference getTypeForVariableDeclaration(XExpression expr)
protected boolean isVariableDeclarationRequired(XExpression expr, ITreeAppendable b)
expr
- the checked expressionb
- the appendable which represents the current compiler stateprotected java.lang.String getReferenceName(XExpression expr, ITreeAppendable b)
null
if the
expression hasn't been assigned to a local variable before.