BadScript 2
Loading...
Searching...
No Matches
BadInstanceOfExpression.cs
Go to the documentation of this file.
7
9
14{
22 left,
23 right,
24 position
25 ) { }
26
28 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
29 {
31
32 foreach (BadObject o in Left.Execute(context))
33 {
34 left = o;
35
36 yield return o;
37 }
38
39 left = left.Dereference();
40 BadObject right = BadObject.Null;
41
42 foreach (BadObject o in Right.Execute(context))
43 {
44 right = o;
45
46 yield return o;
47 }
48
49 right = right.Dereference();
50
51
52 if (right is not BadClassPrototype type)
53 {
54 throw BadRuntimeException.Create(context.Scope, $"Right side of {BadStaticKeys.INSTANCE_OF} must be a class", Position);
55 }
56
57
58 yield return type.IsSuperClassOf(left.GetPrototype());
59 }
60
62 protected override string GetSymbol()
63 {
65 }
66}
Describes a specific position inside a source file.
Contains Static Data for the BadScript Language.
Base Implementation for all Expressions used inside the Script.
BadSourcePosition Position
The source Position of the Expression.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
BadInstanceOfExpression(BadExpression left, BadExpression right, BadSourcePosition position)
Constructor for the 'instanceof' operator.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
Base Implementation of all Binary Expressions.
BadExpression Right
Right side of the Expression.
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 a Class Prototype for the BadScript Language.
Contains Shared Data Structures and Functionality.
Contains the Binary Expressions for the BadScript2 Language.
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.