BadScript 2
Loading...
Searching...
No Matches
BadThrowExpression.cs
Go to the documentation of this file.
6
8
13{
19 public BadThrowExpression(BadExpression right, BadSourcePosition position) : base(
20 false,
21 position
22 )
23 {
24 Right = right;
25 }
26
30 public BadExpression Right { get; set; }
31
33 public override void Optimize()
34 {
36 }
37
39 public override IEnumerable<BadExpression> GetDescendants()
40 {
42 }
43
45 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
46 {
47 BadObject value = BadObject.Null;
48
49 foreach (BadObject obj in Right.Execute(context))
50 {
51 value = obj;
52
53 yield return obj;
54 }
55
56 value = value.Dereference();
57
58 BadRuntimeError? error = new BadRuntimeError(null, value, context.Scope.GetStackTrace());
59
60 throw new BadRuntimeErrorException(error);
61 }
62}
Describes a specific position inside a source file.
static BadExpression Optimize(BadExpression expr)
Optimizes the given expression.
Base Implementation for all Expressions used inside the Script.
IEnumerable< BadExpression > GetDescendantsAndSelf()
Returns all Descendants of the Expression and the Expression itself.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
Implements the Throw Expression that is used to raise errors inside the Script.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
BadThrowExpression(BadExpression right, BadSourcePosition position)
Constructor of the Throw Expression.
BadExpression Right
The Error Object that is thrown.
override void Optimize()
Uses the Constant Folding Optimizer to optimize the expression.
The Execution Context. Every execution of a script needs a context the script is running in....
Gets thrown if the runtime encounters an error.
Implements the Error Object Type.
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
Contains Shared Data Structures and Functionality.
Contains the BadScript2 Constant Folding Optimizations.
Contains the Controlflow 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.