class CrossModuleMethodMotion extends java.lang.Object implements CompilerPass
Modifier and Type | Class and Description |
---|---|
(package private) static class |
CrossModuleMethodMotion.IdGenerator |
Modifier and Type | Field and Description |
---|---|
private AnalyzePrototypeProperties |
analyzer |
private AbstractCompiler |
compiler |
private CrossModuleMethodMotion.IdGenerator |
idGenerator |
private JSModuleGraph |
moduleGraph |
private boolean |
noStubFunctions |
(package private) static DiagnosticType |
NULL_COMMON_MODULE_ERROR |
(package private) static java.lang.String |
STUB_DECLARATIONS |
(package private) static java.lang.String |
STUB_METHOD_NAME |
(package private) static java.lang.String |
UNSTUB_METHOD_NAME |
Constructor and Description |
---|
CrossModuleMethodMotion(AbstractCompiler compiler,
CrossModuleMethodMotion.IdGenerator idGenerator,
boolean canModifyExterns,
boolean noStubFunctions)
Creates a new pass for moving prototype properties.
|
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
hasUnmovableRedeclaration(AnalyzePrototypeProperties.NameInfo nameInfo,
AnalyzePrototypeProperties.Property prop) |
private void |
moveMethods(java.util.Collection<AnalyzePrototypeProperties.NameInfo> allNameInfo)
Move methods deeper in the module graph when possible.
|
void |
process(Node externRoot,
Node root)
Process the JS with root node root.
|
static final DiagnosticType NULL_COMMON_MODULE_ERROR
private final AbstractCompiler compiler
private final CrossModuleMethodMotion.IdGenerator idGenerator
private final AnalyzePrototypeProperties analyzer
private final JSModuleGraph moduleGraph
private final boolean noStubFunctions
static final java.lang.String STUB_METHOD_NAME
static final java.lang.String UNSTUB_METHOD_NAME
static final java.lang.String STUB_DECLARATIONS
CrossModuleMethodMotion(AbstractCompiler compiler, CrossModuleMethodMotion.IdGenerator idGenerator, boolean canModifyExterns, boolean noStubFunctions)
compiler
- The compiler.idGenerator
- An id generator for method stubs.canModifyExterns
- If true, then we can move prototype
properties that are declared in the externs file.noStubFunctions
- if true, we can move methods without
stub functions in the parent module.public void process(Node externRoot, Node root)
CompilerPass
process
in interface CompilerPass
externRoot
- Top of external JS treeroot
- Top of JS treeprivate void moveMethods(java.util.Collection<AnalyzePrototypeProperties.NameInfo> allNameInfo)
static boolean hasUnmovableRedeclaration(AnalyzePrototypeProperties.NameInfo nameInfo, AnalyzePrototypeProperties.Property prop)