BadScript 2
Loading...
Searching...
No Matches
BadConstantExpression.cs
Go to the documentation of this file.
4
6
10public class BadConstantExpression : BadExpression, IBadNativeExpression
11{
17 public BadConstantExpression(BadSourcePosition position, BadObject value) : base(true, position)
18 {
19 Value = value;
20 }
21
25 public BadObject Value { get; }
26
27#region IBadNativeExpression Members
28
32 object IBadNativeExpression.Value => Value;
33
34#endregion
35
37 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
38 {
39 yield return Value;
40 }
41
46 public override string ToString()
47 {
48 return Value.ToString();
49 }
50
52 public override IEnumerable<BadExpression> GetDescendants()
53 {
54 yield break;
55 }
56}
57
63{
69 protected BadConstantExpression(T value, BadSourcePosition position) : base(true, position)
70 {
71 Value = value;
72 }
73
74
78 public T Value { get; }
79
80#region IBadNativeExpression Members
81
85 object IBadNativeExpression.Value => Value!;
86
87#endregion
88
90 public override IEnumerable<BadExpression> GetDescendants()
91 {
92 yield break;
93 }
94
95
100 public override string ToString()
101 {
102 return Value!.ToString()!;
103 }
104
106 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
107 {
108 yield return BadObject.Wrap(Value);
109 }
110}
Describes a specific position inside a source file.
Base Implementation for all Expressions used inside the Script.
object IBadNativeExpression. Value
Private Implementation of IBadNativeExpression.Value.
BadConstantExpression(T value, BadSourcePosition position)
Constructor of the Constant Expression.
BadConstantExpression(BadSourcePosition position, BadObject value)
Constructor of the Constant Expression.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
override string ToString()
String Representation of the Expression.
BadObject Value
The Constant Value of the Expression.
The Execution Context. Every execution of a script needs a context the script is running in....
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
override string ToString()
Returns a String Representation of this Object.
Definition BadObject.cs:224
Gets implemented by all Constant/Native Expressions to provide fast access to the value without unwra...
Contains Shared Data Structures and Functionality.
Contains the Constant Expressions for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.