BadScript 2
Loading...
Searching...
No Matches
BadDefaultExportExpressionCompiler.cs
Go to the documentation of this file.
3
5
9public class BadDefaultExportExpressionCompiler : BadExpressionCompiler<BadDefaultExportExpression>
10{
12 public override void Compile(BadExpressionCompileContext context, BadDefaultExportExpression expression)
13 {
14 context.Compile(expression.Expression);
15 if (BadExportExpressionParser.IsNamed(expression.Expression, out string? name))
16 {
17 if(name == null)
18 {
19 throw new BadCompilerException("Named export expression is null");
20 }
21 context.Emit(BadOpCode.LoadVar, expression.Position, name);
22 }
23 context.Emit(BadOpCode.Export, expression.Position);
24 }
25}
BadSourcePosition Position
The source Position of the Expression.
static bool IsNamed(BadExpression expr, out string? name)
Returns true if the specified expression is a named expression.
Gets thrown when a Compiler is not able to compile a specific BadExpression.
override void Compile(BadExpressionCompileContext context, BadDefaultExportExpression expression)
BadOpCode
Defines the Operations that the BadVirtualMachine can execute.
Definition BadOpCode.cs:7