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
30 object IBadNativeExpression.Value => Value;
31
33 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
34 {
35 yield return Value;
36 }
37
42 public override string ToString()
43 {
44 return Value.ToString();
45 }
46
48 public override IEnumerable<BadExpression> GetDescendants()
49 {
50 yield break;
51 }
52}
53
59{
65 protected BadConstantExpression(T value, BadSourcePosition position) : base(true, position)
66 {
67 Value = value;
68 }
69
70
74 public T Value { get; }
75
79 object IBadNativeExpression.Value => Value!;
80
82 public override IEnumerable<BadExpression> GetDescendants()
83 {
84 yield break;
85 }
86
87
92 public override string ToString()
93 {
94 return Value!.ToString()!;
95 }
96
98 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
99 {
100 yield return BadObject.Wrap(Value);
101 }
102}
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:210
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.