BadScript 2
Loading...
Searching...
No Matches
BadDeleteExpression.cs
Go to the documentation of this file.
5
10
15{
19 public readonly BadExpression Expression;
20
26 public BadDeleteExpression(BadExpression expression, BadSourcePosition position) : base(false, position)
27 {
28 Expression = expression;
29 }
30
32 public override IEnumerable<BadExpression> GetDescendants()
33 {
35 }
36
38 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
39 {
41
42 foreach (BadObject o in Expression.Execute(context))
43 {
44 obj = o;
45
46 yield return o;
47 }
48
49 if (obj is not BadObjectReference r)
50 {
51 throw BadRuntimeException.Create(context.Scope, $"Cannot delete {Expression}", Position);
52 }
53
54 r.Delete();
55
56 yield return BadObject.Null;
57 }
58}
Describes a specific position inside a source file.
Implements an expression that Deletes an object pointed to by BadObjectReference.
BadDeleteExpression(BadExpression expression, BadSourcePosition position)
Creates a new Delete Expression.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
readonly BadExpression Expression
The Key to delete.
override IEnumerable< BadExpression > GetDescendants()
Base Implementation for all Expressions used inside the Script.
IEnumerable< BadExpression > GetDescendantsAndSelf()
Returns all Descendants of the Expression and the Expression itself.
BadSourcePosition Position
The source Position of the Expression.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
The Execution Context. Every execution of a script needs a context the script is running in....
static BadRuntimeException Create(BadScope? scope, string message)
Creates a new BadScriptException.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
static readonly BadObject Null
The Null Value for the BadScript Language.
Definition BadObject.cs:28
Implements the base functionality for a BadScript Reference.
Contains Shared Data Structures and Functionality.
Contains the Expressions for the BadScript2 Language.
Contains the Error Objects for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.