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
16 if (BadExportExpressionParser.IsNamed(expression.Expression, out string? name))
17 {
18 if (name == null)
19 {
20 throw new BadCompilerException("Named export expression is null");
21 }
22
23 context.Emit(BadOpCode.LoadVar, expression.Position, name);
24 }
25
26 context.Emit(BadOpCode.Export, expression.Position);
27 }
28}
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