org.eclipse.xtext.xbase.interpreter.impl
Class XbaseInterpreter
java.lang.Object
org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter
- All Implemented Interfaces:
- IExpressionInterpreter
public class XbaseInterpreter
- extends java.lang.Object
- implements IExpressionInterpreter
- Author:
- Sebastian Zarnekow - Initial contribution and API, Sven Efftinge
Method Summary |
protected java.lang.Object |
_assignValueByOperation(JvmOperation jvmOperation,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_assignValueToDeclaredVariable(XVariableDeclaration variable,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_assignValueToField(JvmField jvmField,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateAbstractFeatureCall(XAbstractFeatureCall featureCall,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateAssignment(XAssignment assignment,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateBlockExpression(XBlockExpression literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateBooleanLiteral(XBooleanLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateCastedExpression(XCastedExpression castedExpression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateClosure(XClosure closure,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateConstructorCall(XConstructorCall constructorCall,
IEvaluationContext context,
CancelIndicator indicator)
|
protected IEvaluationResult |
_evaluateDoWhileExpression(XDoWhileExpression doWhileLoop,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateForLoopExpression(XForLoopExpression forLoop,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateIfExpression(XIfExpression ifExpression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateInstanceOf(XInstanceOfExpression instanceOf,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateMemberFeatureCall(XMemberFeatureCall featureCall,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateNullLiteral(XNullLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateNumberLiteral(XNumberLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateReturnExpression(XReturnExpression returnExpr,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateStringLiteral(XStringLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateSwitchExpression(XSwitchExpression switchExpression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateThrowExpression(XThrowExpression throwExpression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateTryCatchFinallyExpression(XTryCatchFinallyExpression tryCatchFinally,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateTypeLiteral(XTypeLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateVariableDeclaration(XVariableDeclaration variableDecl,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_evaluateWhileExpression(XWhileExpression whileLoop,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_featureCallField(JvmField jvmField,
XAbstractFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_featureCallJvmIdentifyableElement(JvmIdentifiableElement identifiable,
XFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
_featureCallOperation(JvmOperation operation,
XAbstractFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
assignValue(JvmIdentifiableElement feature,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
coerceArgumentType(java.lang.Object value,
JvmTypeReference expectedType)
|
protected PolymorphicDispatcher<java.lang.Object> |
createAssignmentDispatcher()
|
protected IEvaluationContext |
createContext()
|
protected PolymorphicDispatcher<java.lang.Object> |
createEvaluateDispatcher()
|
protected PolymorphicDispatcher<java.lang.Object> |
createFeatureCallDispatcher()
|
protected boolean |
eq(java.lang.Object a,
java.lang.Object b)
|
IEvaluationResult |
evaluate(XExpression expression)
|
IEvaluationResult |
evaluate(XExpression expression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.util.List<java.lang.Object> |
evaluateArgumentExpressions(JvmExecutable executable,
java.util.List<XExpression> expressions,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
featureCallField(JvmField jvmField,
java.lang.Object receiver)
|
protected java.lang.Class<?> |
getClass(java.lang.Class<?> class1)
|
protected ClassFinder |
getClassFinder()
|
protected java.lang.Object |
getDefaultObjectValue(JvmTypeReference type)
|
protected JavaReflectAccess |
getJavaReflectAccess()
|
protected java.lang.Object |
getReceiver(XAssignment assignment,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
internalEvaluate(XExpression expression,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
internalFeatureCallDispatch(XAbstractFeatureCall featureCall,
java.lang.Object receiverObj,
IEvaluationContext context,
CancelIndicator indicator)
|
protected java.lang.Object |
invokeOperation(JvmOperation operation,
java.lang.Object receiver,
java.util.List<java.lang.Object> argumentValues)
|
protected java.lang.Object |
invokeOperation(JvmOperation operation,
java.lang.Object receiver,
java.util.List<java.lang.Object> argumentValues,
IEvaluationContext context,
CancelIndicator indicator)
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
|
void |
setFeatureNameProvider(IdentifiableSimpleNameProvider featureNameProvider)
|
protected java.lang.Object |
throwClassCastException(XExpression expression,
java.lang.Object result,
java.lang.Class<?> expectedType)
|
protected java.lang.Object |
throwNullPointerException(XExpression expression,
java.lang.String message)
|
protected java.lang.Object |
wrapOrUnwrapArray(java.lang.Object result,
JvmTypeReference expectedType)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XbaseInterpreter
public XbaseInterpreter()
XbaseInterpreter
public XbaseInterpreter(com.google.inject.Provider<IEvaluationContext> contextProvider,
JavaReflectAccess javaReflectAccess,
java.lang.ClassLoader loader)
setFeatureNameProvider
public void setFeatureNameProvider(IdentifiableSimpleNameProvider featureNameProvider)
setClassLoader
@Inject
public void setClassLoader(java.lang.ClassLoader classLoader)
getClass
protected java.lang.Class<?> getClass(java.lang.Class<?> class1)
createEvaluateDispatcher
protected PolymorphicDispatcher<java.lang.Object> createEvaluateDispatcher()
createAssignmentDispatcher
protected PolymorphicDispatcher<java.lang.Object> createAssignmentDispatcher()
createFeatureCallDispatcher
protected PolymorphicDispatcher<java.lang.Object> createFeatureCallDispatcher()
evaluate
public IEvaluationResult evaluate(XExpression expression)
- Specified by:
evaluate
in interface IExpressionInterpreter
createContext
protected IEvaluationContext createContext()
evaluate
public IEvaluationResult evaluate(XExpression expression,
IEvaluationContext context,
CancelIndicator indicator)
- Specified by:
evaluate
in interface IExpressionInterpreter
internalEvaluate
protected java.lang.Object internalEvaluate(XExpression expression,
IEvaluationContext context,
CancelIndicator indicator)
throws EvaluationException
- Throws:
EvaluationException
_evaluateNullLiteral
protected java.lang.Object _evaluateNullLiteral(XNullLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
literal
- unused in this context but required for dispatchingcontext
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_evaluateReturnExpression
protected java.lang.Object _evaluateReturnExpression(XReturnExpression returnExpr,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateStringLiteral
protected java.lang.Object _evaluateStringLiteral(XStringLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
context
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_evaluateNumberLiteral
protected java.lang.Object _evaluateNumberLiteral(XNumberLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
context
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_evaluateBooleanLiteral
protected java.lang.Object _evaluateBooleanLiteral(XBooleanLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
context
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_evaluateTypeLiteral
protected java.lang.Object _evaluateTypeLiteral(XTypeLiteral literal,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
context
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_evaluateClosure
protected java.lang.Object _evaluateClosure(XClosure closure,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateBlockExpression
protected java.lang.Object _evaluateBlockExpression(XBlockExpression literal,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateIfExpression
protected java.lang.Object _evaluateIfExpression(XIfExpression ifExpression,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateSwitchExpression
protected java.lang.Object _evaluateSwitchExpression(XSwitchExpression switchExpression,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateCastedExpression
protected java.lang.Object _evaluateCastedExpression(XCastedExpression castedExpression,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateThrowExpression
protected java.lang.Object _evaluateThrowExpression(XThrowExpression throwExpression,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateTryCatchFinallyExpression
protected java.lang.Object _evaluateTryCatchFinallyExpression(XTryCatchFinallyExpression tryCatchFinally,
IEvaluationContext context,
CancelIndicator indicator)
eq
protected boolean eq(java.lang.Object a,
java.lang.Object b)
throwNullPointerException
protected java.lang.Object throwNullPointerException(XExpression expression,
java.lang.String message)
- Parameters:
expression
- may be used by inheritors
throwClassCastException
protected java.lang.Object throwClassCastException(XExpression expression,
java.lang.Object result,
java.lang.Class<?> expectedType)
- Parameters:
expression
- may be used by inheritors
wrapOrUnwrapArray
protected java.lang.Object wrapOrUnwrapArray(java.lang.Object result,
JvmTypeReference expectedType)
_evaluateForLoopExpression
protected java.lang.Object _evaluateForLoopExpression(XForLoopExpression forLoop,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateWhileExpression
protected java.lang.Object _evaluateWhileExpression(XWhileExpression whileLoop,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateDoWhileExpression
protected IEvaluationResult _evaluateDoWhileExpression(XDoWhileExpression doWhileLoop,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateConstructorCall
protected java.lang.Object _evaluateConstructorCall(XConstructorCall constructorCall,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateMemberFeatureCall
protected java.lang.Object _evaluateMemberFeatureCall(XMemberFeatureCall featureCall,
IEvaluationContext context,
CancelIndicator indicator)
getDefaultObjectValue
protected java.lang.Object getDefaultObjectValue(JvmTypeReference type)
_evaluateInstanceOf
protected java.lang.Object _evaluateInstanceOf(XInstanceOfExpression instanceOf,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateVariableDeclaration
protected java.lang.Object _evaluateVariableDeclaration(XVariableDeclaration variableDecl,
IEvaluationContext context,
CancelIndicator indicator)
_evaluateAbstractFeatureCall
protected java.lang.Object _evaluateAbstractFeatureCall(XAbstractFeatureCall featureCall,
IEvaluationContext context,
CancelIndicator indicator)
internalFeatureCallDispatch
protected java.lang.Object internalFeatureCallDispatch(XAbstractFeatureCall featureCall,
java.lang.Object receiverObj,
IEvaluationContext context,
CancelIndicator indicator)
_featureCallJvmIdentifyableElement
protected java.lang.Object _featureCallJvmIdentifyableElement(JvmIdentifiableElement identifiable,
XFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
featureCall
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_featureCallField
protected java.lang.Object _featureCallField(JvmField jvmField,
XAbstractFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
featureCall
- unused in this context but required for dispatchingcontext
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
featureCallField
protected java.lang.Object featureCallField(JvmField jvmField,
java.lang.Object receiver)
_featureCallOperation
protected java.lang.Object _featureCallOperation(JvmOperation operation,
XAbstractFeatureCall featureCall,
java.lang.Object receiver,
IEvaluationContext context,
CancelIndicator indicator)
invokeOperation
protected java.lang.Object invokeOperation(JvmOperation operation,
java.lang.Object receiver,
java.util.List<java.lang.Object> argumentValues,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
operation
- the operation that should be invoked.receiver
- the receiver for the invocation. It may be null
which could signal a NullPointerException
or
be valid if the given operation
is a static operation.argumentValues
- the argument values. The number of arguments has to match the number of declared parameters.context
- the current evalutation context.indicator
- the cancel indicator.- Since:
- 2.3.1
invokeOperation
protected java.lang.Object invokeOperation(JvmOperation operation,
java.lang.Object receiver,
java.util.List<java.lang.Object> argumentValues)
evaluateArgumentExpressions
protected java.util.List<java.lang.Object> evaluateArgumentExpressions(JvmExecutable executable,
java.util.List<XExpression> expressions,
IEvaluationContext context,
CancelIndicator indicator)
coerceArgumentType
protected java.lang.Object coerceArgumentType(java.lang.Object value,
JvmTypeReference expectedType)
_evaluateAssignment
protected java.lang.Object _evaluateAssignment(XAssignment assignment,
IEvaluationContext context,
CancelIndicator indicator)
assignValue
protected java.lang.Object assignValue(JvmIdentifiableElement feature,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
_assignValueToDeclaredVariable
protected java.lang.Object _assignValueToDeclaredVariable(XVariableDeclaration variable,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
- Parameters:
assignment
- unused in this context but required for dispatchingindicator
- unused in this context but required for dispatching
_assignValueToField
protected java.lang.Object _assignValueToField(JvmField jvmField,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
getReceiver
protected java.lang.Object getReceiver(XAssignment assignment,
IEvaluationContext context,
CancelIndicator indicator)
_assignValueByOperation
protected java.lang.Object _assignValueByOperation(JvmOperation jvmOperation,
XAssignment assignment,
java.lang.Object value,
IEvaluationContext context,
CancelIndicator indicator)
getClassFinder
protected ClassFinder getClassFinder()
getJavaReflectAccess
protected JavaReflectAccess getJavaReflectAccess()