org.eclipse.xtext.xtend2.compiler
Class Xtend2Compiler

java.lang.Object
  extended by org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler
      extended by org.eclipse.xtext.xbase.compiler.TypeConvertingCompiler
          extended by org.eclipse.xtext.xbase.compiler.LiteralsCompiler
              extended by org.eclipse.xtext.xbase.compiler.FeatureCallCompiler
                  extended by org.eclipse.xtext.xbase.compiler.XbaseCompiler
                      extended by org.eclipse.xtext.xtend2.compiler.Xtend2Compiler

public class Xtend2Compiler
extends XbaseCompiler

Author:
Sven Efftinge - Initial contribution and API, Jan Koehnlein, Sebastian Zarnekow

Nested Class Summary
 class Xtend2Compiler.RichStringPrepareCompiler
           
 
Constructor Summary
Xtend2Compiler()
           
 
Method Summary
 void _toJavaExpression(RichString richString, IAppendable b)
           
 void _toJavaStatement(RichString richString, IAppendable b, boolean isReferenced)
           
protected  void _toJavaStatement(XClosure closure, IAppendable b, boolean isReferenced)
           
protected  void appendTypeParameterDeclaration(org.eclipse.emf.common.util.EList<JvmTypeParameter> typeParameters, IAppendable appendable)
           
protected  java.lang.Object cacheVarKey(CreateExtensionInfo createExtensionInfo)
           
protected  void compile(org.eclipse.emf.ecore.EObject obj, IAppendable appendable)
           
protected  void compile(XtendClass obj, IAppendable appendable)
           
protected  void compile(XtendField field, IAppendable appendable)
           
 void compile(XtendFile obj, java.io.Writer writer)
          Compile the given file to java code and write the result into the writer.
protected  void compile(XtendFunction obj, IAppendable appendable)
           
protected  void compileCreateExtensionBody(XtendFunction obj, IAppendable appendable)
           
protected  void declareCreateExtensionCache(XtendFunction obj, IAppendable appendable)
           
protected  void declareExceptions(JvmOperation obj, IAppendable appendable)
           
protected  void declareJvmParameters(org.eclipse.emf.common.util.EList<JvmFormalParameter> parameters, IAppendable appendable)
           
protected  void declareParameters(org.eclipse.emf.common.util.EList<XtendParameter> parameters, IAppendable appendable)
           
protected  void declareThis(XtendClass clazz, IAppendable appendable)
           
protected  void generateActualDispatchCall(JvmOperation dispatchOperation, JvmOperation actualOperationToCall, IAppendable a)
           
protected  void generateAnnotations(XtendAnnotationTarget annotationTarget, IAppendable appendable)
           
protected  void generateDispatchMethod(JvmOperation dispatchOperation, java.util.Collection<JvmOperation> collection, IAppendable a)
           
protected  void generateDispatchMethods(XtendClass obj, IAppendable appendable)
           
protected  java.util.List<JvmTypeReference> getCheckedExceptions(JvmOperation operation)
           
protected  IAppendable getClosureContextAppendable(IAppendable appendable)
           
protected  java.lang.String getFavoriteVariableName(org.eclipse.emf.ecore.EObject ex)
           
protected  java.lang.Object getJavaVisibility(JvmVisibility visibility)
           
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.XbaseCompiler
_toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, appendCatchAndFinally
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.FeatureCallCompiler
_toJavaExpression, _toJavaStatement, appendArguments, appendFeatureCall, appendNullValue, appendReceiver, featureCalltoJavaExpression, generateShortCircuitInvocation, getDefaultLiteral, getUpperBound, isMemberCall, isSpreadingMemberFeatureCall, isStatic, isVariableDeclarationRequired, prepareExpression, prepareSpreadingMemberFeatureCall, xAssignmentToJavaExpression
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.LiteralsCompiler
_toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaExpression, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, _toJavaStatement, generateComment
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.TypeConvertingCompiler
convertArrayToList, convertFunctionType, convertListToArray, convertMultiType, convertPrimitiveToWrapper, doConversion, getContextProvider, internalToConvertedExpression, internalToJavaExpression, isList
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.AbstractXbaseCompiler
_toJavaExpression, _toJavaExpression, _toJavaStatement, _toJavaStatement, compile, declareLocalVariable, declareLocalVariable, declareLocalVariable, declareNameInVariableScope, getDefaultValueLiteral, getNameProvider, getPrimitives, getTypeConformanceComputer, getTypeProvider, getTypeReferences, getVarName, internalToJavaStatement, isLocalTypeParameter, isPrimitiveVoid, makeJavaIdentifier, resolveMultiType, serialize, serialize, serialize, setNameProvider, setTypeReferences, toJavaExpression, toJavaStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Xtend2Compiler

public Xtend2Compiler()
Method Detail

compile

public void compile(XtendFile obj,
                    java.io.Writer writer)
Compile the given file to java code and write the result into the writer. It is assumed that a single file will be compiled to a single artifact.

Parameters:
obj - the file to be compiled. May not be null.
writer - the output acceptor. May not be null.
Throws:
java.lang.RuntimeException - something went wrong (I/O errors or the like)

compile

protected void compile(org.eclipse.emf.ecore.EObject obj,
                       IAppendable appendable)

compile

protected void compile(XtendClass obj,
                       IAppendable appendable)

compile

protected void compile(XtendField field,
                       IAppendable appendable)

generateAnnotations

protected void generateAnnotations(XtendAnnotationTarget annotationTarget,
                                   IAppendable appendable)

generateDispatchMethods

protected void generateDispatchMethods(XtendClass obj,
                                       IAppendable appendable)

generateDispatchMethod

protected void generateDispatchMethod(JvmOperation dispatchOperation,
                                      java.util.Collection<JvmOperation> collection,
                                      IAppendable a)

generateActualDispatchCall

protected void generateActualDispatchCall(JvmOperation dispatchOperation,
                                          JvmOperation actualOperationToCall,
                                          IAppendable a)

compile

protected void compile(XtendFunction obj,
                       IAppendable appendable)

getJavaVisibility

protected java.lang.Object getJavaVisibility(JvmVisibility visibility)

declareExceptions

protected void declareExceptions(JvmOperation obj,
                                 IAppendable appendable)

compileCreateExtensionBody

protected void compileCreateExtensionBody(XtendFunction obj,
                                          IAppendable appendable)

declareCreateExtensionCache

protected void declareCreateExtensionCache(XtendFunction obj,
                                           IAppendable appendable)

cacheVarKey

protected java.lang.Object cacheVarKey(CreateExtensionInfo createExtensionInfo)

appendTypeParameterDeclaration

protected void appendTypeParameterDeclaration(org.eclipse.emf.common.util.EList<JvmTypeParameter> typeParameters,
                                              IAppendable appendable)

getCheckedExceptions

protected java.util.List<JvmTypeReference> getCheckedExceptions(JvmOperation operation)

declareParameters

protected void declareParameters(org.eclipse.emf.common.util.EList<XtendParameter> parameters,
                                 IAppendable appendable)

declareJvmParameters

protected void declareJvmParameters(org.eclipse.emf.common.util.EList<JvmFormalParameter> parameters,
                                    IAppendable appendable)

declareThis

protected void declareThis(XtendClass clazz,
                           IAppendable appendable)

_toJavaStatement

protected void _toJavaStatement(XClosure closure,
                                IAppendable b,
                                boolean isReferenced)
Overrides:
_toJavaStatement in class XbaseCompiler

getClosureContextAppendable

protected IAppendable getClosureContextAppendable(IAppendable appendable)

getFavoriteVariableName

protected java.lang.String getFavoriteVariableName(org.eclipse.emf.ecore.EObject ex)
Overrides:
getFavoriteVariableName in class AbstractXbaseCompiler

_toJavaStatement

public void _toJavaStatement(RichString richString,
                             IAppendable b,
                             boolean isReferenced)

_toJavaExpression

public void _toJavaExpression(RichString richString,
                              IAppendable b)