public class DisambiguateProperties extends java.lang.Object implements CompilerPass
Renamimg only occurs if there are two or more distinct properties with the same name.
This pass allows other passes, such as inlining and code removal to take advantage of type information implicitly.
Foo.a; Bar.a;
will become
Foo.Foo$a; Bar.Bar$a;NOTE(dimvar): For every property, this pass groups together the types that can't be disambiguated. If a type inherits from another type, their common properties can never be disambiguated, yet we have to compute this info once per property rather than just once in the pass. This is where the bulk of the time is spent. We have added many caches that help a lot, but it is probably worth it to revisit this pass and rewrite it in a way that does not compute the same thing over and over.
Constructor and Description |
---|
DisambiguateProperties(AbstractCompiler compiler,
java.util.Map<java.lang.String,CheckLevel> propertiesToErrorFor) |
Modifier and Type | Method and Description |
---|---|
protected com.google.javascript.jscomp.disambiguate.DisambiguateProperties.Property |
getProperty(java.lang.String name)
Returns the property for the given name, creating it if necessary.
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
public DisambiguateProperties(AbstractCompiler compiler, java.util.Map<java.lang.String,CheckLevel> propertiesToErrorFor)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprotected com.google.javascript.jscomp.disambiguate.DisambiguateProperties.Property getProperty(java.lang.String name)
Copyright © 2009-2020 Google. All Rights Reserved.