/// <summary> /// Add a function declaration node to this compilation unit node. /// </summary> /// <param name="declaration">The function declaration node to add.</param> /// <exception cref="ArgumentNullException">Thrown if the 'declaration' parameter is <c>null</c>.</exception> public void Add(LSLFunctionDeclarationNode declaration) { if (declaration == null) { throw new ArgumentNullException("declaration"); } declaration.Parent = this; if (_globalVariableDeclarations.Count > 0) { _globalVariableDeclarations.Last().IsLastStatementInScope = false; } _addCounter++; _functionDeclarations.Add(declaration); }
/// <summary> /// Construct an <see cref="LSLFunctionCallNode" /> with an arguments list and definition reference. <para/> /// <paramref name="definition" /> receives this node as a new reference in <see cref="LSLFunctionDeclarationNode.References" />. /// </summary> /// <param name="argumentList">The argument list node.</param> /// <param name="definition">The function definition node.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="definition" /> or <paramref name="argumentList" /> is /// <c>null</c>. /// </exception> public LSLFunctionCallNode(LSLFunctionDeclarationNode definition, LSLExpressionListNode argumentList) { if (definition == null) { throw new ArgumentNullException("definition"); } if (argumentList == null) { throw new ArgumentNullException("argumentList"); } Name = definition.Name; ArgumentExpressionList = argumentList; ArgumentExpressionList.Parent = this; Definition = definition; Definition.AddReference(this); Signature = definition.CreateSignature(); }
/// <summary> /// Internal method that sets the DefinitionNode property, this method is named this way to bring clarity to the source /// code where it is used. /// </summary> /// <param name="definition"></param> internal void GiveDefinition(LSLFunctionDeclarationNode definition) { DefinitionNode = definition; }
/// <summary> /// Construct an <see cref="LSLFunctionCallNode" /> with an arguments list and definition reference. /// <paramref name="definition" /> receives this node as a new reference in <see cref="LSLFunctionDeclarationNode.References" />. /// </summary> /// <param name="argumentList">The list of expression arguments.</param> /// <param name="definition">The function definition node.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="definition" /> or <paramref name="argumentList" /> is /// <c>null</c>. /// </exception> public LSLFunctionCallNode(LSLFunctionDeclarationNode definition, params ILSLExprNode[] argumentList) : this(definition, new LSLExpressionListNode(argumentList)) { }