use of org.eclipse.n4js.generator.AbstractSubGenerator in project n4js by eclipse.
the class XpectN4JSES5GeneratorHelper method compile.
/**
* Compiles provided Script. Can replace backslashes with single quote (for windows command line issues)
*
* @param depRoot
* script to transpile
* @param options
* the {@link GeneratorOption}s to use during compilation.
* @param replaceQuotes
* should replace quotes (only for windows)
* @return string representation of compilation result
*/
public String compile(Script depRoot, GeneratorOption[] options, boolean replaceQuotes) {
final Resource resource = depRoot.eResource();
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
final AbstractSubGenerator generator = getGeneratorForResource(resource);
String compileResultStr = generator.getCompileResultAsText(depRoot, options);
if (replaceQuotes) {
// Windows Node.js has problems with " as it interprets it as ending of script to execute
compileResultStr = compileResultStr.replace("\"", "'");
}
return compileResultStr;
}
Aggregations