public abstract class Composite extends CodeChunk.WithValue
CodeChunk.Generator, CodeChunk.RequiresCollector, CodeChunk.WithValueEMPTY_OBJECT_LITERAL, LITERAL_EMPTY_STRING, LITERAL_FALSE, LITERAL_NULL, LITERAL_TRUE| Constructor and Description |
|---|
Composite() |
| Modifier and Type | Method and Description |
|---|---|
void |
collectRequires(CodeChunk.RequiresCollector collector)
Adds all the 'goog.require' identifiers needed by this CodeChunk to the given collection.
|
boolean |
isCheap()
Returns
true if the expression represented by this code chunk is so trivial that it
isn't worth storing it in a temporary if it needs to be referenced multiple times. |
JsExpr |
singleExprOrName()
If this chunk can be represented as a single expression, returns that expression.
|
and, assign, bracketAccess, call, call, divideBy, dotAccess, doubleEquals, doubleEqualsNull, doubleNotEquals, initialStatements, instanceof_, minus, op, or, plus, plusEquals, times, tripleEquals, withInitialStatement, withInitialStatementsarrayLiteral, assertExpr, assertExprAndCollectRequires, assign, dontTrustPrecedenceOf, dottedIdNoRequire, forLoop, forLoop, fromExpr, function, getCode, getStatementsForInsertingIntoForeignCodeAtIndent, id, ifExpression, ifStatement, mapLiteral, new_, not, number, number, operation, return_, statements, statements, stringLiteral, switch_, throw_, treatRawStringAsStatementLegacyOnlypublic final boolean isCheap()
CodeChunk.WithValuetrue if the expression represented by this code chunk is so trivial that it
isn't worth storing it in a temporary if it needs to be referenced multiple times.
The default is false, only certain special code chunks return true.
isCheap in class CodeChunk.WithValuepublic void collectRequires(CodeChunk.RequiresCollector collector)
CodeChunkcollectRequires in class CodeChunkpublic JsExpr singleExprOrName()
CodeChunk.WithValueinitial statements.
This method should rarely be used, but is needed when interoperating with parts of the
codegen system that do not yet understand CodeChunks (e.g. SoyJsSrcFunction).
singleExprOrName in class CodeChunk.WithValue