26 private readonly Dictionary<int, BadObject>
m_Cache =
new Dictionary<int, BadObject>();
117 return args.Length > i ? args[i].Dereference() :
Null;
137 else if (args.Length <= i)
170 for (
int i = 0; i < parameters.Length; i++)
178 new BadArray(args.Skip(i).ToList()),
183 else if (args.Length <= i)
223 private static int?
GetHash(IEnumerable<BadObject> args)
235 hash = hash == 0 ? native.Value.GetHashCode() :
BadHashCode.Combine(hash, native.Value);
255 BadLogger.
Warn($
"Found Cached value with Hash {hash}",
"Runtime");
276 $
"Invalid return type for function '{GetHeader()}'. Expected '{ReturnType.Name}' got '{ret.GetPrototype().Name}'"
325 return $
"{BadStaticKeys.FUNCTION_KEY} {returnType.Name} {name}({string.Join(",
", parameters.Cast<object>())})";
Describes a specific position inside a source file.
Public facing interface for a logger.
static void Warn(string message)
Writes a Warning to the Message Handler.
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.
void DefineVariable(string name, BadObject value, BadScope? caller=null, BadPropertyInfo? info=null, BadObject[]? attributes=null)
Defines a new Variable in the current scope.
Gets thrown by the runtime.
static BadRuntimeException Create(BadScope? scope, string message)
Creates a new BadScriptException.
Implements a Dynamic List/Array for the BadScript Language.
The Base Class for all BadScript Objects.
override string ToString()
Returns a String Representation of this Object.
static readonly BadObject Null
The Null Value for the BadScript Language.
Stores Meta Information about a Property.
Implements a function that can be called from the script.
readonly Dictionary< int, BadObject > m_Cache
The Result Cache.
BadFunctionParameter[] Parameters
The Function Parameters.
virtual BadFunction BindParentScope(BadScope scope)
Returns an instance that is bound to the given scope.
bool IsSingleLine
Indicates if the function is a single line function(without block) Is used to determine the behaviour...
BadWordToken? Name
(optional) Name of the Function
IEnumerable< BadObject > InvokeBlock(BadObject[] args, BadExecutionContext caller)
Invokes the function with the specified arguments.
BadFunction(BadWordToken? name, bool isConstant, bool isStatic, BadClassPrototype returnType, bool isSingleLine, params BadFunctionParameter[] parameters)
Creates a new Function.
static readonly BadClassPrototype Prototype
The Prototype for the Function Object.
override string ToSafeString(List< BadObject > done)
static ? int GetHash(IEnumerable< BadObject > args)
Returns the Hash of the function arguments.
static void ApplyParameters(string funcStr, BadFunctionParameter[] parameters, BadExecutionContext context, BadObject[] args, BadSourcePosition? position=null)
Applies the function arguments to the context of the function.
IEnumerable< BadObject > Invoke(BadObject[] args, BadExecutionContext caller)
Invokes the function with the specified arguments.
static BadObject GetParameter(BadObject[] args, int i)
Returns the Function Parameter at the given index.
void ApplyParameters(BadExecutionContext context, BadObject[] args, BadSourcePosition? position=null)
Applies the function arguments to the context of the function.
string GetHeader()
Returns the Header of the function.
static string GetHeader(string name, BadClassPrototype returnType, IEnumerable< BadFunctionParameter > parameters)
Returns the Header of the function.
override BadClassPrototype GetPrototype()
void CheckParameters(BadObject[] args, BadExecutionContext caller, BadSourcePosition? position=null)
Checks Parameters for the given function call.
bool IsConstant
Indicates if the function has no side effects and the result can be cached.
bool IsStatic
Indicates if the Function is static.
virtual BadMetaData MetaData
The Metadata of the Function.
BadClassPrototype ReturnType
The Return Type of the Function.
Provides function parameter info.
bool IsOptional
Indicates if this parameter is optional.
BadClassPrototype? Type
The Class Prototype of the Parameter.
bool IsRestArgs
Indicates if this parameter is the rest parameter of the function.
string Name
The Name of the Parameter.
bool IsNullChecked
Indicates if this parameter is null checked by the runtime.
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.
virtual bool IsAssignableFrom(BadObject obj)
Returns true if the provided object is an instance of this class or a subclass of this class.
Helper Class that Builds a Native Class from a Prototype.
static BadClassPrototype GetNative(string name)
Returns a Native Class Prototype for the given Native Type.
Defines Settings for Native Optimizations.
static T Instance
Returns the Instance of the Settings Provider.
Implements Combination of HashCode Functions Taken from decompiled source of System....
Defines properties for Native Types.
Contains Logging system for the BadScript Runtime.
Contains Shared Data Structures and Functionality.
Contains the Parser for the BadScript2 Language.
Contains the Reader Tokens for the BadScript2 Language.
Contains the Error Objects for the BadScript2 Language.
Contains Runtime Function Objects.
Contains the Native Runtime Objects.
Contains Runtime Type Objects.
Contains Runtime Settings Objects.
Contains Utility Functions and Classes.