public abstract class JsAbstractTextTransformer extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
js |
protected StatementRanges |
originalStatementRanges |
protected JsSourceMap |
sourceInfoMap |
protected StatementRanges |
statementRanges |
Constructor and Description |
---|
JsAbstractTextTransformer(JsAbstractTextTransformer xformer) |
JsAbstractTextTransformer(String js,
StatementRanges statementRanges,
JsSourceMap sourceInfoMap) |
Modifier and Type | Method and Description |
---|---|
protected void |
addStatement(int index,
String code,
StringBuilder newJs,
ArrayList<Integer> starts,
ArrayList<Integer> ends) |
protected void |
beginStatement(int index,
StringBuilder newJs,
ArrayList<Integer> starts) |
protected void |
beginStatements(StringBuilder newJs,
ArrayList<Integer> starts,
ArrayList<Integer> ends)
Called if any operations need to be performed before all statements have
been processed.
|
protected void |
endStatement(int index,
StringBuilder newJs,
ArrayList<Integer> ends) |
protected void |
endStatements(StringBuilder newJs,
ArrayList<Integer> starts,
ArrayList<Integer> ends)
Called if any operations need to be performed after all statements have
been processed.
|
abstract void |
exec() |
String |
getJs() |
protected String |
getJsForRange(int stmtIndex) |
JsSourceMap |
getSourceInfoMap() |
StatementRanges |
getStatementRanges() |
protected void |
recomputeJsAndStatementRanges(int[] stmtIndices)
Dump functions and fragments back into a new JS string, and calculate a new
StatementRanges object.
|
protected abstract void |
updateSourceInfoMap()
Update the expression ranges in the SourceInfo map after the
transformer has manipulated the statements.
|
protected String js
protected StatementRanges originalStatementRanges
protected StatementRanges statementRanges
protected JsSourceMap sourceInfoMap
public JsAbstractTextTransformer(JsAbstractTextTransformer xformer)
public JsAbstractTextTransformer(String js, StatementRanges statementRanges, JsSourceMap sourceInfoMap)
public abstract void exec()
public String getJs()
public JsSourceMap getSourceInfoMap()
public StatementRanges getStatementRanges()
protected void addStatement(int index, String code, StringBuilder newJs, ArrayList<Integer> starts, ArrayList<Integer> ends)
protected void beginStatement(int index, StringBuilder newJs, ArrayList<Integer> starts)
protected void beginStatements(StringBuilder newJs, ArrayList<Integer> starts, ArrayList<Integer> ends)
newJs
- starts
- ends
- protected void endStatement(int index, StringBuilder newJs, ArrayList<Integer> ends)
protected void endStatements(StringBuilder newJs, ArrayList<Integer> starts, ArrayList<Integer> ends)
newJs
- starts
- ends
- protected String getJsForRange(int stmtIndex)
protected void recomputeJsAndStatementRanges(int[] stmtIndices)
protected abstract void updateSourceInfoMap()
Copyright © 2018. All rights reserved.