BadScript 2
Loading...
Searching...
No Matches
BadNativeApi.cs
Go to the documentation of this file.
6
8
9[BadInteropApi("Native")]
10internal partial class BadNativeApi
11{
17 [BadMethod(description: "Returns true if the given object is an instance of a class prototype")]
18 [return: BadReturn("True if the given object is an instance of a class prototype")]
19 private bool IsPrototypeInstance([BadParameter(description: "Object to test")] BadObject? arg)
20 {
21 return arg is BadClass;
22 }
23
29 [BadMethod(description: "Returns true if the given object is a class prototype")]
30 [return: BadReturn("True if the given object is a class prototype")]
31 private bool IsPrototype([BadParameter(description: "Object to test")] BadObject? arg)
32 {
33 return arg is BadClassPrototype;
34 }
35
41 [BadMethod(description: "Returns true if the given object is a native object")]
42 [return: BadReturn("True if the given object is a native object")]
43 private bool IsNative([BadParameter(description: "Object to test")] BadObject? arg)
44 {
45 return arg is IBadNative;
46 }
47
53 [BadMethod(description: "Returns true if the given object is a function")]
54 [return: BadReturn("True if the given object is a function")]
55 private bool IsFunction([BadParameter(description: "Object to test")] BadObject? arg)
56 {
57 return arg is BadFunction;
58 }
59
65 [BadMethod(description: "Returns true if the given object is a table")]
66 [return: BadReturn("True if the given object is a table")]
67 private bool IsTable([BadParameter(description: "Object to test")] BadObject? arg)
68 {
69 return arg is BadTable;
70 }
71
77 [BadMethod(description: "Returns true if the given object is a string")]
78 [return: BadReturn("True if the given object is a string")]
79 private bool IsString([BadParameter(description: "Object to test")] BadObject? arg)
80 {
81 return arg is IBadString;
82 }
83
89 [BadMethod(description: "Returns true if the given object is a number")]
90 [return: BadReturn("True if the given object is a number")]
91 private bool IsNumber([BadParameter(description: "Object to test")] BadObject? arg)
92 {
93 return arg is IBadNumber;
94 }
95
101 [BadMethod(description: "Returns true if the given object is a boolean")]
102 [return: BadReturn("True if the given object is a boolean")]
103 private bool IsBoolean([BadParameter(description: "Object to test")] BadObject? arg)
104 {
105 return arg is IBadBoolean;
106 }
107
113 [BadMethod(description: "Returns true if the given object is an array")]
114 [return: BadReturn("True if the given object is an array")]
115 private bool IsArray([BadParameter(description: "Object to test")] BadObject? arg)
116 {
117 return arg is BadArray;
118 }
119
126 [BadMethod(description: "Returns true if the given object is enumerable")]
127 [return: BadReturn("True if the given object is enumerable")]
128 private bool IsEnumerable(BadExecutionContext ctx, [BadParameter(description: "Object to test")] BadObject? arg)
129 {
130 return arg?.HasProperty("GetEnumerator", ctx.Scope) ?? false;
131 }
132
139 [BadMethod(description: "Returns true if the given object is an enumerator")]
140 [return: BadReturn("True if the given object is an enumerator")]
141 private bool IsEnumerator(BadExecutionContext ctx, [BadParameter(description: "Object to test")] BadObject? arg)
142 {
143 return (arg?.HasProperty("GetCurrent", ctx.Scope) ?? false) &&
144 (arg?.HasProperty("MoveNext", ctx.Scope) ?? false);
145 }
146}
bool IsString([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a string.
bool IsPrototype([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a class prototype.
bool IsTable([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a table.
bool IsPrototypeInstance([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is an instance of a class prototype.
bool IsFunction([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a function.
bool IsNumber([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a number.
bool IsEnumerable(BadExecutionContext ctx, [BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is enumerable.
bool IsEnumerator(BadExecutionContext ctx, [BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is an enumerator.
bool IsNative([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a native object.
bool IsArray([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is an array.
bool IsBoolean([BadParameter(description:"Object to test")] BadObject? arg)
Returns true if the given object is a boolean.
The Execution Context. Every execution of a script needs a context the script is running in....
Implements a Dynamic List/Array for the BadScript Language.
Definition BadArray.cs:17
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
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
Implements a Table Structure for the BadScript Language.
Definition BadTable.cs:14
Implements a function that can be called from the script.
Implements a Type Instance in the BadScript Language.
Definition BadClass.cs:11
Implements a Class Prototype for the BadScript Language.
Implements the Interface for Native Boolean.
Definition IBadBoolean.cs:7
Defines properties for Native Types.
Definition IBadNative.cs:7
Implements the Interface for Native Numbers.
Definition IBadNumber.cs:7
Implements the Interface for Native Strings.
Definition IBadString.cs:7
Contains Common Interop APIs for the BadScript2 Runtime.
Contains Runtime Function Objects.
Contains the Native Runtime Objects.
Definition BadBoolean.cs:6
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.