Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MethodDefinition.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6 
7 namespace SiliconStudio.Shaders.Ast
8 {
9  /// <summary>
10  /// A method definition with a body of statements.
11  /// </summary>
13  {
14  [VisitorIgnore]
15  private MethodDeclaration declaration;
16 
17  #region Constructors and Destructors
18 
19  /// <summary>
20  /// Initializes a new instance of the <see cref="MethodDefinition"/> class.
21  /// </summary>
23  {
24  Body = new StatementList();
25  declaration = this;
26  }
27 
28  /// <summary>
29  /// Initializes a new instance of the <see cref="MethodDefinition"/> class.
30  /// </summary>
31  /// <param name="returntype">The returntype.</param>
32  /// <param name="name">The name.</param>
33  public MethodDefinition(TypeBase returntype, string name) : this()
34  {
35  ReturnType = returntype;
36  Name = new Identifier(name);
37  declaration = this;
38  }
39 
40  #endregion
41 
42  #region Public Properties
43 
44  /// <summary>
45  /// Gets or sets the declaration.
46  /// </summary>
47  /// <value>
48  /// The declaration.
49  /// </value>
50  public MethodDeclaration Declaration { get { return declaration; } set { declaration = value; } }
51 
52  /// <summary>
53  /// Gets or sets the list of statements.
54  /// </summary>
55  /// <value>
56  /// The list of statements.
57  /// </value>
58  public StatementList Body { get; set; }
59 
60 
61  #endregion
62 
63  #region Public Methods
64 
65  /// <inheritdoc />
66  public override IEnumerable<Node> Childrens()
67  {
68  base.Childrens();
69  ChildrenList.Add(Body);
70  return ChildrenList;
71  }
72 
73  #endregion
74  }
75 }
A tag interface to identify a container for scope declarations.
A method definition with a body of statements.
Base type for all types.
Definition: TypeBase.cs:11
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
MethodDefinition()
Initializes a new instance of the MethodDefinition class.
MethodDefinition(TypeBase returntype, string name)
Initializes a new instance of the MethodDefinition class.