Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ReturnStatement.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 return statement.
11  /// </summary>
12  public class ReturnStatement : Statement
13  {
14  /// <summary>
15  /// Initializes a new instance of the <see cref="ReturnStatement"/> class.
16  /// </summary>
17  public ReturnStatement()
18  {
19  }
20 
21  /// <summary>
22  /// Initializes a new instance of the <see cref="ReturnStatement"/> class.
23  /// </summary>
24  /// <param name="value">The value.</param>
26  {
27  Value = value;
28  }
29 
30  #region Public Properties
31 
32  /// <summary>
33  /// Gets or sets the value.
34  /// </summary>
35  /// <value>
36  /// The value.
37  /// </value>
38  /// <remarks>
39  /// If this value is null, return without any expression.
40  /// </remarks>
41  public Expression Value { get; set; }
42 
43  #endregion
44 
45  #region Public Methods
46 
47  /// <inheritdoc />
48  public override IEnumerable<Node> Childrens()
49  {
50  ChildrenList.Clear();
51  ChildrenList.Add(Value);
52  return ChildrenList;
53  }
54 
55  /// <inheritdoc />
56  public override string ToString()
57  {
58  return string.Format("return{0};", Value != null ? " " + Value : string.Empty);
59  }
60 
61  #endregion
62  }
63 }
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
Base root class for all statements.
Definition: Statement.cs:11
ReturnStatement()
Initializes a new instance of the ReturnStatement class.
ReturnStatement(Expression value)
Initializes a new instance of the ReturnStatement class.