BadScript 2
Loading...
Searching...
No Matches
BadInequalityExpression.cs
Go to the documentation of this file.
4
6
11{
19 left,
20 right,
21 position
22 ) { }
23
30 public static BadObject NotEqual(BadObject left, BadObject right)
31 {
32 return left.Equals(right) ? BadObject.False : BadObject.True;
33 }
34
43 public static IEnumerable<BadObject> NotEqualWithOverride(
44 BadExecutionContext? caller,
45 BadObject left,
46 BadObject right,
47 BadSourcePosition position)
48 {
50 {
52 left,
53 right,
54 caller!,
56 position
57 ))
58 {
59 yield return o;
60 }
61 }
63 {
65 right,
66 left,
67 caller!,
69 position
70 ))
71 {
72 yield return o;
73 }
74 }
75 else
76
77 {
78 yield return NotEqual(left, right);
79 }
80 }
81
83 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
84 {
86
87 foreach (BadObject o in Left.Execute(context))
88 {
89 left = o;
90
91 yield return o;
92 }
93
94 left = left.Dereference();
95 BadObject right = BadObject.Null;
96
97 foreach (BadObject o in Right.Execute(context))
98 {
99 right = o;
100
101 yield return o;
102 }
103
104 right = right.Dereference();
105
106 foreach (BadObject? o in NotEqualWithOverride(context, left, right, Position))
107 {
108 yield return o;
109 }
110 }
111
113 protected override string GetSymbol()
114 {
115 return "!=";
116 }
117}
Describes a specific position inside a source file.
Contains Static Data for the BadScript Language.
Base Implementation for all Expressions used inside the Script.
static IEnumerable< BadObject > ExecuteOperatorOverride(BadObject left, BadObject right, BadExecutionContext context, string name, BadSourcePosition position)
Helper function that executes an operator override function if implemented.
BadSourcePosition Position
The source Position of the Expression.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
Base Implementation of all Binary Expressions.
BadExpression Right
Right side of the Expression.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
static BadObject NotEqual(BadObject left, BadObject right)
Returns True if the two Objects are not equal.
static IEnumerable< BadObject > NotEqualWithOverride(BadExecutionContext? caller, BadObject left, BadObject right, BadSourcePosition position)
Executes the expression.
BadInequalityExpression(BadExpression left, BadExpression right, BadSourcePosition position)
Constructor for the Inequality Expression.
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
static readonly BadObject True
The True Value for the BadScript Language.
Definition BadObject.cs:33
virtual bool HasProperty(string propName, BadScope? caller=null)
Returns true if the object contains a given property or there exists an extension for the current Ins...
Definition BadObject.cs:118
static readonly BadObject Null
The Null Value for the BadScript Language.
Definition BadObject.cs:28
Contains Shared Data Structures and Functionality.
Contains the Comparison Expressions for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.