MarkUntranspilableFeaturesAsRemoved( AbstractCompiler compiler, FeatureSet inputFeatures, FeatureSet outputFeatures) { checkNotNull(compiler); checkNotNull(inputFeatures); checkNotNull(outputFeatures); this.compiler = compiler; this.untranspilableFeaturesToRemove = inputFeatures // All features in the input language features... .without(ALL_TRANSPILABLE_FEATURES) // that we can't transpile... .without(outputFeatures); // and do not exist in the output language features }
static void maybeMarkFeaturesAsTranspiledAway( AbstractCompiler compiler, FeatureSet transpiledFeatures) { // We don't bother to do this if the compiler has halting errors, which avoids unnecessary // warnings from AstValidator warning that the features are still there. if (!compiler.hasHaltingErrors()) { compiler.setFeatureSet(compiler.getFeatureSet().without(transpiledFeatures)); } }
static void maybeMarkFeaturesAsTranspiledAway( AbstractCompiler compiler, Feature transpiledFeature, Feature... moreTranspiledFeatures) { if (!compiler.hasHaltingErrors()) { compiler.setFeatureSet( compiler.getFeatureSet().without(transpiledFeature, moreTranspiledFeatures)); } }
@Override public void process(Node externs, Node root) { checkArgument(externs.isRoot(), externs); checkArgument(root.isRoot(), root); for (Node file : Iterables.concat(externs.children(), root.children())) { checkState(file.isScript(), file); hotSwapScript(file, null); } compiler.setFeatureSet(compiler.getFeatureSet().without(MODULES)); // This pass may add getters properties on module objects. GatherGettersAndSetterProperties.update(compiler, externs, root); }
private ClosureBundler getBundler() { if (bundler != null) { return bundler; } ImmutableList<String> moduleRoots; if (!flags.moduleRoot.isEmpty()) { moduleRoots = ImmutableList.copyOf(flags.moduleRoot); } else { moduleRoots = ImmutableList.of(ModuleLoader.DEFAULT_FILENAME_PREFIX); } CompilerOptions options = createOptions(); return bundler = new ClosureBundler( Transpiler.NULL, new BaseTranspiler( new CompilerSupplier( LanguageMode.ECMASCRIPT_NEXT.toFeatureSet().without(Feature.MODULES), options.getModuleResolutionMode(), moduleRoots, options.getBrowserResolverPrefixReplacements()), /* runtimeLibraryName= */ "")); }
@Override public void process(Node externs, Node root) { for (Node script : root.children()) { if (Es6RewriteModules.isEs6ModuleRoot(script)) { NodeTraversal.traverse(compiler, script, new Rewriter(compiler, script)); script.putBooleanProp(Node.TRANSPILED, true); } } compiler.setFeatureSet(compiler.getFeatureSet().without(Feature.MODULES)); }
FeatureSet unsupportedFeatures = featuresInAst.without(featuresSupportedByPass); logger.warning("AST contains unsupported features: " + unsupportedFeatures); return;
protected void setOptions(CompilerOptions options) { options.setLanguageIn(LanguageMode.ECMASCRIPT_NEXT); options.setOutputFeatureSet(outputFeatureSet.without(Feature.MODULES)); options.setEmitUseStrict(false); options.setQuoteKeywordProperties(true);
FeatureSet mustBeCompiledAway = used.without(compiler.getOptions().getOutputFeatureSet());