Class AmbiguateProperties
- java.lang.Object
-
- com.google.javascript.jscomp.disambiguate.AmbiguateProperties
-
- All Implemented Interfaces:
CompilerPass
public class AmbiguateProperties extends java.lang.Object implements CompilerPass
Renames unrelated properties to the same name, using type information. This allows better compression as more properties can be given short names.Properties are considered unrelated if they are never referenced from the same type or from a subtype of each others' types, thus this pass is only effective if type checking is enabled.
Example:
Foo.fooprop = 0; Foo.fooprop2 = 0; Bar.barprop = 0;
becomes:Foo.a = 0; Foo.b = 0; Bar.a = 0;
-
-
Constructor Summary
Constructors Constructor Description AmbiguateProperties(AbstractCompiler compiler, char[] reservedFirstCharacters, char[] reservedNonFirstCharacters, java.util.Set<java.lang.String> externProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
process(Node externs, Node root)
Process the JS with root node root.
-
-
-
Constructor Detail
-
AmbiguateProperties
public AmbiguateProperties(AbstractCompiler compiler, char[] reservedFirstCharacters, char[] reservedNonFirstCharacters, java.util.Set<java.lang.String> externProperties)
-
-
Method Detail
-
process
public void process(Node externs, Node root)
Description copied from interface:CompilerPass
Process the JS with root node root. Can modify the contents of each Node tree- Specified by:
process
in interfaceCompilerPass
- Parameters:
externs
- Top of external JS treeroot
- Top of JS tree
-
-