Search in sources :

Example 1 with STECache

use of org.eclipse.n4js.transpiler.TranspilerState.STECache in project n4js by eclipse.

the class PreparationStep method createIM.

private STECache createIM(Script script, Tracer tracer, InformationRegistry info) {
    final AST2IMCopier copier = new AST2IMCopier(script, tracer, info);
    final EObject result = copier.copy(script);
    final STECache steCache = new STECache((Script_IM) result);
    copier.steCache = steCache;
    copier.copyReferences();
    copier.createRemainingSymbolTableEntries();
    return steCache;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) STECache(org.eclipse.n4js.transpiler.TranspilerState.STECache)

Example 2 with STECache

use of org.eclipse.n4js.transpiler.TranspilerState.STECache in project n4js by eclipse.

the class PreparationStep method prepare.

/**
 * Creates and initializes the transpiler state. In particular, this will create the intermediate model as a copy of
 * the original AST with some modifications (esp. rewiring of cross-references to ensure intermediate model is
 * self-contained).
 *
 * @param options
 *            the {@link GeneratorOption generator options} to use during generation.
 */
public TranspilerState prepare(Script script, GeneratorOption[] options) {
    final N4JSResource resource = (N4JSResource) script.eResource();
    final ContainerTypesHelper.MemberCollector memberCollector = containerTypesHelper.fromContext(resource);
    final Tracer tracer = new Tracer();
    final InformationRegistry info = new InformationRegistry();
    final STECache steCache = createIM(script, tracer, info);
    return new TranspilerState(resource, options, memberCollector, steCache.im, steCache, tracer, info);
}
Also used : ContainerTypesHelper(org.eclipse.n4js.utils.ContainerTypesHelper) STECache(org.eclipse.n4js.transpiler.TranspilerState.STECache) N4JSResource(org.eclipse.n4js.resource.N4JSResource)

Aggregations

STECache (org.eclipse.n4js.transpiler.TranspilerState.STECache)2 EObject (org.eclipse.emf.ecore.EObject)1 N4JSResource (org.eclipse.n4js.resource.N4JSResource)1 ContainerTypesHelper (org.eclipse.n4js.utils.ContainerTypesHelper)1