protected TypeDeclarationStatementNodeBase(string name, FormalParameterNode[] parameters, AttributeNode[] attributes) : base(name) { if (parameters == null) ThrowHelper.ThrowArgumentNullException(() => parameters); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); Parameters = parameters.ToList(); Attributes = attributes.ToList(); AddChildren(Parameters); AddChildren(Attributes); }
public FunctionDeclarationStatementNode(string name, BlockStatementNode functionBody, TypeNameNode returnType, FormalParameterNode[] parameters, IEnumerable<AttributeNode> attributes) : base(name) { if (functionBody == null) ThrowHelper.ThrowArgumentNullException(() => functionBody); if (returnType == null) ThrowHelper.ThrowArgumentNullException(() => returnType); if (parameters == null) ThrowHelper.ThrowArgumentNullException(() => parameters); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); FunctionBody = functionBody; ReturnType = returnType; Parameters = parameters; Attributes = attributes.ToList(); AddChildren(FunctionBody, ReturnType); AddChildren(Parameters); AddChildren(Attributes); }
public ObjectDeclarationStatementNode Object(string name, FormalParameterNode[] parameters, AttributeNode[] attributes) { if (string.IsNullOrWhiteSpace(name)) ThrowHelper.ThrowException("The 'name' is blank!"); if (parameters == null) ThrowHelper.ThrowArgumentNullException(() => parameters); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); return new ObjectDeclarationStatementNode(name, parameters, attributes); }
public ObjectDeclarationStatementNode Object(string name, FormalParameterNode[] parameters) { return Object(name, parameters, new AttributeNode[0]); }
public FunctionDeclarationStatementNode Function(string name, TypeNameNode returnType, FormalParameterNode[] parameters, BlockStatementNode body, AttributeNode[] attributes) { if (string.IsNullOrWhiteSpace(name)) ThrowHelper.ThrowException("The 'name' is blank!"); if (body == null) ThrowHelper.ThrowArgumentNullException(() => body); if (parameters == null) ThrowHelper.ThrowArgumentNullException(() => parameters); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); var type = returnType ?? new TypeNameNode("void"); return new FunctionDeclarationStatementNode(name, body, type, parameters, attributes); }
public FunctionDeclarationStatementNode Function(string name, TypeNameNode returnType, FormalParameterNode[] parameters, ExpressionNode body, AttributeNode[] attributes) { var statementFactory = CompilerService.StatementFactory; return Function(name, returnType, parameters, statementFactory.Block(new StatementNodeBase[] { statementFactory.Expression(body) }), attributes); }
public AttributeDeclarationStatementNode(string name, FormalParameterNode[] parameters, AttributeNode[] attributes) : base(name, parameters, attributes) { }