BadScript 2
Loading...
Searching...
No Matches
BadCompilerApi.cs
Go to the documentation of this file.
6
8
13{
17 public BadCompilerApi() : base("Compiler") { }
18
20 protected override void LoadApi(BadTable target)
21 {
22 target.SetFunction<BadExpressionFunction, bool>(
23 "Compile",
26 );
27 }
28
35 public static BadCompiledFunction CompileFunction(BadExpressionFunction func, bool useOverride)
36 {
37 BadInstruction[] instrs = BadCompiler.Compile(func.Body).ToArray();
38
39
40 return new BadCompiledFunction(
41 instrs,
42 useOverride,
43 func.ParentScope,
44 func.Position,
45 func.Name,
46 func.IsConstant,
47 func.IsStatic,
48 func.MetaData,
49 func.ReturnType,
50 func.IsSingleLine,
51 func.Parameters
52 );
53 }
54}
Implements an Interop API for the BS2 Language.
Implements a Table Structure for the BadScript Language.
Definition BadTable.cs:14
The Expression Function Implementation used if a function gets defined in the Source Code.
readonly BadSourcePosition Position
The Source Position of the Function.
readonly BadScope ParentScope
The Scope the function is defined in.
IEnumerable< BadExpression > Body
Enumeration of all expressions in the function body.
BadFunctionParameter[] Parameters
The Function Parameters.
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
bool IsConstant
Indicates if the function has no side effects and the result can be cached.
bool IsStatic
Indicates if the Function is static.
BadClassPrototype ReturnType
The Return Type of the Function.
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.
static BadCompiledFunction CompileFunction(BadExpressionFunction func, bool useOverride)
Compiles a Function.
Implements the Compile for the BadVirtualMachine.
void Compile(BadExpressionCompileContext context, BadExpression expression)
Compiles the given BadExpression into a set of BadInstructions.
Contains the Extension Classes for Functions.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains Runtime Function Objects.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Compiler for the BadVirtualMachine.
Implements a single instruction for the BadVirtualMachine.