/// <summary> /// Visits the declaration node of a user defined function during syntax tree traversal. /// </summary> /// <param name="node">The Syntax Tree Node.</param> /// <returns>An object of type (T) from the visitor implementation of this function.</returns> public virtual T VisitFunctionDeclaration(ILSLFunctionDeclarationNode node) { Visit(node.ParameterList); Visit(node.Code); return(default(T)); }
/// <summary> /// Build a <see cref="LSLFunctionSignature" /> object based off the signature of this function declaration node. /// </summary> /// <param name="functionDeclarationNode">The <see cref="ILSLFunctionDeclarationNode"/>.</param> /// <returns>The created <see cref="LSLFunctionSignature" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="functionDeclarationNode"/> is <see langword="null" />.</exception> public static LSLFunctionSignature CreateSignature(this ILSLFunctionDeclarationNode functionDeclarationNode) { if (functionDeclarationNode == null) { throw new ArgumentNullException("functionDeclarationNode"); } return(new LSLFunctionSignature(functionDeclarationNode.ReturnType, functionDeclarationNode.Name, functionDeclarationNode.ParameterList.Parameters.Select(x => new LSLParameterSignature(x.Type, x.Name, false)))); }
void ILSLSyntaxWarningListener.FunctionNeverUsed(LSLSourceCodeRange location, ILSLFunctionDeclarationNode functionDeclarationNode) { _warningActionQueue.Enqueue(location.StartIndex, () => SyntaxWarningListener.FunctionNeverUsed(location, functionDeclarationNode)); }
/// <summary> /// A user defined function was never referenced. /// </summary> /// <param name="location">The location in the source code of the function that was never referenced.</param> /// <param name="functionDeclarationNode">The function declaration node of the un-referenced function.</param> public virtual void FunctionNeverUsed(LSLSourceCodeRange location, ILSLFunctionDeclarationNode functionDeclarationNode) { OnWarning(location, string.Format("Function \"{0}\" was never used.", functionDeclarationNode.Name)); }