BadScript 2
Loading...
Searching...
No Matches
BadVoidPrototype.cs
Go to the documentation of this file.
4
6
12{
16 public static BadVoidPrototype Instance { get; } = new BadVoidPrototype();
17 public static BadObject Object { get; } = new BadVoidObject();
18 private class BadVoidObject : BadObject
19 {
21 {
22 return Instance;
23 }
24
25 public override string ToSafeString(List<BadObject> done)
26 {
27 return "<void>";
28 }
29
30 public override string ToString()
31 {
32 return "<void>";
33 }
34
35 public override bool HasProperty(string propName, BadScope? caller = null)
36 {
37 return false;
38 }
39
40 public override BadObjectReference GetProperty(string propName, BadScope? caller = null)
41 {
42 throw BadRuntimeException.Create(caller, $"Property '{propName}' does not exist on void");
43 }
44 }
48 private BadVoidPrototype() : base("void", BadMetaData.Empty)
49 {
50 }
51
53 protected override BadClassPrototype? BaseClass { get; } = null;
55 public override bool IsAbstract { get; } = true;
57 public override IReadOnlyCollection<BadInterfacePrototype> Interfaces { get; } = Array.Empty<BadInterfacePrototype>();
59 public override IEnumerable<BadObject> CreateInstance(BadExecutionContext caller, bool setThis = true)
60 {
61 throw BadRuntimeException.Create(caller.Scope, "Cannot create an instance of void");
62 }
63
65 public override bool IsAssignableFrom(BadObject obj)
66 {
67 return obj == Object;
68 }
69
71 public override bool IsSuperClassOf(BadClassPrototype proto)
72 {
73 return proto == Instance;
74 }
75}
Implements a Meta Data container for an 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.
Implements the Scope for the Script Engine.
Definition BadScope.cs:238
static BadRuntimeException Create(BadScope? scope, string message)
Creates a new BadScriptException.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
Implements the base functionality for a BadScript Reference.
Implements a Class Prototype for the BadScript Language.
override 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...
override BadObjectReference GetProperty(string propName, BadScope? caller=null)
Returns a Reference to the Property with the given Name.
The Void Prototype, can be assigned to nothing, can not be inherited from, can not be instantiated....
override IReadOnlyCollection< BadInterfacePrototype > Interfaces
override IEnumerable< BadObject > CreateInstance(BadExecutionContext caller, bool setThis=true)
override bool IsSuperClassOf(BadClassPrototype proto)
Returns true if the Class is a Subclass of the given Class.true if the Class is a Subclass of the giv...
override bool IsAssignableFrom(BadObject obj)
Returns true if the provided object is an instance of this class or a subclass of this class....
static BadVoidPrototype Instance
The Instance of the BadVoidPrototype.
BadVoidPrototype()
Creates a new BadVoidPrototype.
Contains the Parser for the BadScript2 Language.
Contains the Error Objects for the BadScript2 Language.
Contains Runtime Interface Objects.