static class CodePrinter.CompactCodePrinter extends CodePrinter.MappedCodePrinter
| Modifier and Type | Field and Description |
|---|---|
private boolean |
lineBreak |
private int |
lineStartPosition |
private boolean |
preferLineBreakAtEndOfFile |
private int |
preferredBreakPosition |
private int |
prevCutPosition |
private int |
prevLineStartPosition |
code, lineIndex, lineLength, lineLengthThresholdsawFunction, statementNeedsEnded, statementStarted| Modifier | Constructor and Description |
|---|---|
private |
CompactCodePrinter(boolean lineBreak,
boolean preferLineBreakAtEndOfFile,
int lineLengthThreshold,
boolean createSrcMap,
SourceMap.DetailLevel sourceMapDetailLevel) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
append(java.lang.String str)
Appends a string to the code, keeping track of the current line length.
|
(package private) void |
endFile()
Called when we're at the end of a file.
|
(package private) void |
maybeCutLine()
This may start a new line if the current line is longer than the line
length threshold.
|
(package private) void |
maybeLineBreak() |
(package private) void |
notePreferredLineBreak() |
(package private) void |
startNewLine()
Adds a newline to the code, resetting the line length.
|
endSourceMapping, generateSourceMap, getCode, getCurrentCharIndex, getCurrentLineIndex, getLastChar, reportLineCut, startSourceMappingadd, addConstant, addIdentifier, addNumber, addOp, appendBlockEnd, appendBlockStart, appendOp, beginBlock, beginCaseBody, breakAfterBlockFor, continueProcessing, endBlock, endBlock, endCaseBody, endClass, endFunction, endLine, endStatement, endStatement, isNegativeZero, isWordChar, listSeparator, maybeEndStatement, maybeInsertSpace, shouldPreserveExtraBlocksprivate final boolean lineBreak
private final boolean preferLineBreakAtEndOfFile
private int lineStartPosition
private int preferredBreakPosition
private int prevCutPosition
private int prevLineStartPosition
private CompactCodePrinter(boolean lineBreak,
boolean preferLineBreakAtEndOfFile,
int lineLengthThreshold,
boolean createSrcMap,
SourceMap.DetailLevel sourceMapDetailLevel)
lineBreak - break the lines a bit more aggressivelylineLengthThreshold - The length of a line after which we force
a newline when possible.createSrcMap - Whether to gather source position
mapping information when printing.sourceMapDetailLevel - A filter to control which nodes get mapped into
the source map.void append(java.lang.String str)
append in class CodeConsumervoid startNewLine()
startNewLine in class CodeConsumervoid maybeLineBreak()
maybeLineBreak in class CodeConsumervoid maybeCutLine()
maybeCutLine in class CodeConsumervoid notePreferredLineBreak()
notePreferredLineBreak in class CodeConsumervoid endFile()
CodeConsumerendFile in class CodeConsumer