Capítulo 417 de 859

Chapter 417: FunctionOverloadingNode

Core Idea

This class allows to define multiple overloaded versions of the same function. Depending on the parameters of the function call, the node picks the best-fit overloaded version.

Key Concepts

  • functionNodes : Array.<function()>: Array of Fn function definitions.
  • global : boolean: This node is marked as global.
  • parametersNodes : Array.<Node>: A list of parameter nodes.

Reference Tables

Constructor

Signature
new FunctionOverloadingNode( functionNodes : Array.<function()>, …parametersNodes : Node )

Properties

PropertyDescription
.functionNodes : Array.<function()>Array of Fn function definitions.
.global : booleanThis node is marked as global.
.parametersNodes : Array.<Node>A list of parameter nodes.

Methods

MethodDescription
.generateNodeType( builder : NodeBuilder ) : stringThis method is overwritten since the node type is inferred from the function's return type.
.getCandidateFn( builder : NodeBuilder ) : FunctionNodeReturns the candidate function for the current parameters.
.setup( builder : NodeBuilder ) : NodeSets up the node for the current parameters.

Key Takeaways

  1. FunctionOverloadingNode extends: EventDispatcher → Node
  2. Most relevant properties: functionNodes, global, parametersNodes.
  3. Key methods: generateNodeType, getCandidateFn, setup.

Connects To