Class CssCustomFunctionNode
java.lang.Object
com.google.common.css.compiler.ast.CssNode
com.google.common.css.compiler.ast.CssValueNode
com.google.common.css.compiler.ast.CssFunctionNode
com.google.common.css.compiler.ast.CssCustomFunctionNode
- All Implemented Interfaces:
ChunkAware,Proxiable<CssCustomFunctionNode>,Locatable
- Direct Known Subclasses:
CssCustomFunctionNode.CssCustomFunctionNodeProxy
public class CssCustomFunctionNode
extends CssFunctionNode
implements Proxiable<CssCustomFunctionNode>
A node representing a custom GSS function call.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCopy-on-Write proxy forCssCustomFunctionNodeused to avoid copying of function call subtrees inReplaceConstantReferencespass.Nested classes/interfaces inherited from class com.google.common.css.compiler.ast.CssFunctionNode
CssFunctionNode.Function -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCssCustomFunctionNode(CssCustomFunctionNode function) Copy constructor.CssCustomFunctionNode(String gssFunctionName, SourceCodeLocation sourceCodeLocation) Constructor of the node. -
Method Summary
Modifier and TypeMethodDescriptionCreates the proxy object.deepCopy()static List<CssValueNode>fixupFunctionArguments(Iterable<CssValueNode> functionParameters) TurnsfunctionParameterscontaining comma and space literals into a correctly-grouped list ofCssValueNodes.voidsetArguments(CssFunctionArgumentsNode arguments) voidsetResult(List<CssValueNode> functionResult) Saves the value of function computation for later use.toString()Use for debugging only.Methods inherited from class com.google.common.css.compiler.ast.CssFunctionNode
getArguments, getChunk, getFunction, getValue, setChunkMethods inherited from class com.google.common.css.compiler.ast.CssValueNode
getIsDefault, setIsDefault, setValueMethods inherited from class com.google.common.css.compiler.ast.CssNode
ancestors, appendComment, deepCopyNodes, equals, getComments, getParent, getShouldBeFlipped, getSourceCodeLocation, getVisitController, hasComment, hashCode, inFunArgs, setComments, setShouldBeFlipped, setSourceCodeLocation
-
Field Details
-
resultNodes
-
-
Constructor Details
-
CssCustomFunctionNode
Constructor of the node.- Parameters:
gssFunctionName- name of the function "called" by this nodesourceCodeLocation- location of this node
-
CssCustomFunctionNode
Copy constructor.- Parameters:
function- the copied custom function node
-
-
Method Details
-
deepCopy
- Overrides:
deepCopyin classCssFunctionNode
-
getFunctionName
- Overrides:
getFunctionNamein classCssFunctionNode
-
toString
Description copied from class:CssValueNodeUse for debugging only.- Overrides:
toStringin classCssFunctionNode- See Also:
-
setArguments
- Overrides:
setArgumentsin classCssFunctionNode
-
createProxy
Description copied from interface:ProxiableCreates the proxy object. If the original object is immutable and does not have any children, it can return itself.- Specified by:
createProxyin interfaceProxiable<CssCustomFunctionNode>- Returns:
- the copy-on-write proxy for this node
-
getResult
- Returns:
- cached result of function value computation
-
setResult
Saves the value of function computation for later use.- Parameters:
functionResult- the list of nodes returned by the call to theGssFunction
-
fixupFunctionArguments
TurnsfunctionParameterscontaining comma and space literals into a correctly-grouped list ofCssValueNodes. For example, in this code:
the* @def A 1 2 3 4; @def B 6 7 8 9; @def USE_A true; @def MARGIN selectFrom(USE_A, A, B);selectFromgets expanded to:
where each value in braces is one parameter. That's 17 parameters. Passing that parameter list to this function returns a list with 3 values:* @def MARGIN selectFrom([true][,][1][ ][2][ ][3][ ][4][,][6][ ][7][ ][8][ ][9])true,1 2 3 4, and6 7 8 9.Note that this function must be passed value nodes that are already expanded as it will create
CssLiteralNodes out of the values between commas via concatenation of theirtoStringmethods.- Parameters:
functionParameters- an iterable that contains resolved parameter values (no references)- Returns:
- a list values that represent the actual arguments to the function, one value per argument
-