Class AmbiguateProperties
java.lang.Object
com.google.javascript.jscomp.disambiguate.AmbiguateProperties
- All Implemented Interfaces:
CompilerPass
Renames unrelated properties to the same name, using
Color
s provided by the typechecker.
This allows better compression as more properties can be given short names.
Properties are considered unrelated if they are never referenced from the same color or from a subtype of each others' colors, 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
ConstructorsConstructorDescriptionAmbiguateProperties
(AbstractCompiler compiler, char[] reservedFirstCharacters, char[] reservedNonFirstCharacters, Set<String> externProperties) -
Method Summary
-
Constructor Details
-
AmbiguateProperties
public AmbiguateProperties(AbstractCompiler compiler, char[] reservedFirstCharacters, char[] reservedNonFirstCharacters, Set<String> externProperties)
-
-
Method Details
-
process
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
-