org.eclipse.xtend.middleend.internal
Class MiddleEndImpl

java.lang.Object
  extended by org.eclipse.xtend.middleend.internal.MiddleEndImpl
All Implemented Interfaces:
MiddleEnd

public final class MiddleEndImpl
extends java.lang.Object
implements MiddleEnd

This class is the generic entry point for parsing and executing code. Different languages can contribute their specific middle ends using extension points.
MiddleEnd instances are stateful in that they preserve caching of the contributed middle ends. They also preserve a single ExecutionContext instance throughout their life span, but they expose it to allows using code to selectively manipulate and / or re-initialize it between invocations.

Author:
Arno Haase (http://www.haase-consulting.com)

Constructor Summary
MiddleEndImpl(BackendTypesystem ts, java.util.List<LanguageSpecificMiddleEnd> languageHandlers)
          The map with "specific params" is used to initialize the contributed middle ends.
 
Method Summary
 void applyAdvice(java.lang.String resourceName)
          tells this middle end instance to apply the advice in a given resource to all subsequent invocations.
 FunctionDefContextInternal createEmptyFdc()
           
 ExecutionContext getExecutionContext()
          This method exposes the execution context to using code with the explicit purpose of allowing others to inspect and manipulate / re-initialize it partially or in toto.
 FunctionDefContext getFunctions(java.lang.String resourceName)
           
 java.util.List<LanguageSpecificMiddleEnd> getLanguageSpecificMiddleEnds()
           
 java.util.Map<java.lang.String,ParsedResource> getParsedResources()
           
 BackendTypesystem getTypesystem()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiddleEndImpl

public MiddleEndImpl(BackendTypesystem ts,
                     java.util.List<LanguageSpecificMiddleEnd> languageHandlers)
The map with "specific params" is used to initialize the contributed middle ends. The key must be the class implementing the LanguageSpecificMiddleEnd interface and contributed via the extension point.

Method Detail

applyAdvice

public void applyAdvice(java.lang.String resourceName)
tells this middle end instance to apply the advice in a given resource to all subsequent invocations.

Specified by:
applyAdvice in interface MiddleEnd

getFunctions

public FunctionDefContext getFunctions(java.lang.String resourceName)
Specified by:
getFunctions in interface MiddleEnd

getExecutionContext

public ExecutionContext getExecutionContext()
This method exposes the execution context to using code with the explicit purpose of allowing others to inspect and manipulate / re-initialize it partially or in toto.
But beware: This data structure is used directly by the runtime, and modifications can significantly influence behavior at runtime!

Specified by:
getExecutionContext in interface MiddleEnd

getTypesystem

public BackendTypesystem getTypesystem()
Specified by:
getTypesystem in interface MiddleEnd

createEmptyFdc

public FunctionDefContextInternal createEmptyFdc()
Specified by:
createEmptyFdc in interface MiddleEnd

getParsedResources

public java.util.Map<java.lang.String,ParsedResource> getParsedResources()
Specified by:
getParsedResources in interface MiddleEnd

getLanguageSpecificMiddleEnds

public java.util.List<LanguageSpecificMiddleEnd> getLanguageSpecificMiddleEnds()
Specified by:
getLanguageSpecificMiddleEnds in interface MiddleEnd