23 private static readonly Dictionary<string, BadString>
s_StringCache =
new Dictionary<string, BadString>();
53 return o is
string || o is decimal || o is
null || o.GetType().IsNumericType();
78 if (typeof(T).IsNumericType() || obj !=
null && obj.GetType().IsNumericType())
80 return new BadNumber(Convert.ToDecimal(obj));
98 if (Equals(obj,
default(T)))
120 return caller !=
null && caller.Provider.HasObject(GetType(), propName);
136 return caller.Provider.GetObjectReference(GetType(), propName,
this, caller);
156 return b.HasValue ? b.Value :
Null;
176 return b.HasValue ? b.Value :
Null;
233 return Equals((
object?)other);
253 return ReferenceEquals(
this, obj);
259 throw new NotSupportedException();
Implements the Scope for the Script Engine.
Gets thrown by the runtime.
static BadRuntimeException Create(BadScope? scope, string message)
Creates a new BadScriptException.
Implementation for the null-value.
override BadClassPrototype GetPrototype()
override int GetHashCode()
override string ToSafeString(List< BadObject > done)
object Value
The Value of the Native Object.
bool Equals(IBadNative? other)
Returns the Prototype for the Null Object.
override bool Equals(object? obj)
Type Type
The Type of the Native Object.
The Base Class for all BadScript Objects.
static readonly BadObject True
The True Value for the BadScript Language.
static readonly BadObject False
The False Value for the BadScript Language.
static bool CanWrap(object? o)
Returns true if the given object cam be wrapped.
string ToSafeString(List< BadObject > done)
Returns a String Representation of this Object. This function is recursion proof and supports circula...
override string ToString()
Returns a String Representation of this Object.
virtual BadObjectReference GetProperty(string propName, BadScope? caller=null)
Returns a Reference to the Property with the given Name.
static readonly Dictionary< string, BadString > s_StringCache
The String Cache for the BadScript Language.
static readonly BadClassPrototype s_Prototype
The Any Prototype for the BadScript Language.
BadClassPrototype GetPrototype()
Returns the Prototype of this Object.
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...
static readonly BadObject Null
The Null Value for the BadScript Language.
static BadObject Wrap< T >(T obj, bool allowNative=true)
Wraps the given object into a BadObject Instance.
Implements the base functionality for a BadScript Reference.
Implements a Native Boolean.
Implements a Native Type.
Implements a Native Number.
Implements a Native String.
The Any Prototype, Base type for all types.
static readonly BadAnyPrototype Instance
The Instance of the BadAnyPrototype.
Implements a Class Prototype for the BadScript Language.
Defines Settings for Native Optimizations.
static T Instance
Returns the Instance of the Settings Provider.
Defines properties for Native Types.
Contains the Error Objects for the BadScript2 Language.
Contains the Extension Classes for Functions.
Contains the Interop Reflection Classes for the BadScript2 Language.
Contains the Native Runtime Objects.
Contains Runtime Type Objects.
Contains the Runtime Objects.
Contains Runtime Settings Objects.
This is a helper type that can be used when using the .SetFunction extensions to allow for nullable p...
readonly? T Value
The Value of the Parameter.