public class J2clPass extends java.lang.Object implements CompilerPass
Inlines Arrays.$create(), Arrays.$init(), Arrays.$instanceIsOfType(), Arrays.$castTo() and Casts.to() so that all references to Object.$isInstance() functions will be fully qualified and easy to strip.
Inlines all Interface.$markImplementor(FooClass) metaclass calls so that FooClass and others like it are not unnecessarily retained and so that static analysis of interface instanceof calls becomes possible.
Modifier and Type | Class and Description |
---|---|
private class |
J2clPass.ClassStaticFunctionsInliner
Collects references to certain function definitions in a certain class and then inlines fully
qualified static method calls to those functions anywhere in the program.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ALL_CLASS_FILE_NAMES |
private AbstractCompiler |
compiler |
private com.google.common.base.Supplier<java.lang.String> |
safeNameIdSupplier |
Constructor and Description |
---|
J2clPass(AbstractCompiler compiler) |
Modifier and Type | Method and Description |
---|---|
private void |
inlineFunctionsInFile(Node root,
java.lang.String classFileName,
java.util.Set<java.lang.String> fnNamesToInline,
FunctionInjector.InliningMode inliningMode) |
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
private static final java.lang.String ALL_CLASS_FILE_NAMES
private final AbstractCompiler compiler
private final com.google.common.base.Supplier<java.lang.String> safeNameIdSupplier
public J2clPass(AbstractCompiler compiler)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprivate void inlineFunctionsInFile(Node root, java.lang.String classFileName, java.util.Set<java.lang.String> fnNamesToInline, FunctionInjector.InliningMode inliningMode)