Capítulo 482 de 859

Chapter 482: StackNode

Core Idea

Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. They are usually needed in cases like If, Else.

Key Concepts

  • isStackNode : boolean (readonly): This flag can be used for type testing.
  • nodes : Array.<Node>: List of nodes.
  • outputNode : Node: The output node.
  • parent : StackNode: The parent stack node.

Reference Tables

Constructor

Signature
new StackNode( parent : StackNode )

Properties

PropertyDescription
.isStackNode : boolean (readonly)This flag can be used for type testing.
.nodes : Array.<Node>List of nodes.
.outputNode : NodeThe output node.
.parent : StackNodeThe parent stack node.

Methods

MethodDescription
.Case( …params : any ) : StackNodeRepresents a case statement in TSL. The TSL version accepts an arbitrary numbers of values. The last parameter must be the callback method that should be executed in the true case.
.Default( method : function ) : StackNodeRepresents the default code block of a Switch/Case statement.
.Else( method : function ) : StackNodeRepresent an else statement in TSL.
.ElseIf( boolNode : Node, method : function ) : StackNodeRepresent an elseif statement in TSL.
.If( boolNode : Node, method : function ) : StackNodeRepresent an if statement in TSL.
.Switch( expression : any, method : function ) : StackNodeRepresents a switch statement in TSL.
.addToStack( node : Node, index : number ) : StackNodeAdds a node to this stack.
.addToStackBefore( node : Node ) : StackNodeAdds a node to the stack before the current node.

Key Takeaways

  1. StackNode extends: EventDispatcher → Node
  2. Most relevant properties: isStackNode, nodes, outputNode, parent.
  3. Key methods: Case, Default, Else, ElseIf.

Connects To