Package com.google.javascript.jscomp
Class VariableMap
java.lang.Object
com.google.javascript.jscomp.VariableMap
Stores the mapping from original variable name to new variable names.
- See Also:
-
RenameVars
-
Method Summary
Modifier and TypeMethodDescriptionstatic VariableMap
fromBytes
(byte[] bytes) Deserializes the variable map from a byte array returned bytoBytes()
.static VariableMap
Initializes the variable map from an existing map.Returns an unmodifiable mapping from new names to original names.Returns an unmodifiable mapping from original names to new names.static VariableMap
Reads the variable map from a file written viasave(String)
.lookupNewName
(String sourceName) Given an original variable name, look up new name, may return null if it's not found.lookupSourceName
(String newName) Given a new variable name, lookup the source name, may return null if it's not found.void
Saves the variable map to a file.byte[]
toBytes()
Serializes the variable map to a byte array.
-
Method Details
-
lookupNewName
Given an original variable name, look up new name, may return null if it's not found. -
lookupSourceName
Given a new variable name, lookup the source name, may return null if it's not found. -
getOriginalNameToNewNameMap
Returns an unmodifiable mapping from original names to new names. -
getNewNameToOriginalNameMap
Returns an unmodifiable mapping from new names to original names. -
save
Saves the variable map to a file.- Throws:
IOException
-
load
Reads the variable map from a file written viasave(String)
.- Throws:
IOException
-
toBytes
public byte[] toBytes()Serializes the variable map to a byte array. -
fromBytes
Deserializes the variable map from a byte array returned bytoBytes()
.- Throws:
ParseException
-
fromMap
Initializes the variable map from an existing map.- Parameters:
map
- The map to use from original names to generated names. It is copied and changes to the specified map will not affect the returned object.
-