BadScript 2
Loading...
Searching...
No Matches
BadDefaultExportExpression.cs
Go to the documentation of this file.
5
7
12{
18 public BadDefaultExportExpression(BadExpression expression, BadSourcePosition position) : base(false, position)
19 {
20 Expression = expression;
21 }
22
26 public BadExpression Expression { get; private set; }
27
29 public override IEnumerable<BadExpression> GetDescendants()
30 {
32 }
33
35 public override void Optimize()
36 {
38 }
39
41 protected override IEnumerable<BadObject> InnerExecute(BadExecutionContext context)
42 {
43 BadObject? result = BadObject.Null;
44 foreach (BadObject o in Expression.Execute(context))
45 {
46 result = o;
47
48 yield return o;
49 }
50
51 result = result.Dereference();
52
53 context.Scope.SetExports(context, result);
54
55 yield return result;
56 }
57
58 public override string ToString()
59 {
60 return "export default " + Expression;
61 }
62}
Describes a specific position inside a source file.
static BadExpression Optimize(BadExpression expr)
Optimizes the given expression.
Base Implementation for all Expressions used inside the Script.
IEnumerable< BadExpression > GetDescendantsAndSelf()
Returns all Descendants of the Expression and the Expression itself.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
override void Optimize()
Uses the Constant Folding Optimizer to optimize the expression.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
BadDefaultExportExpression(BadExpression expression, BadSourcePosition position)
Creates a new Default Export Expression.
The Execution Context. Every execution of a script needs a context the script is running in....
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
static readonly BadObject Null
The Null Value for the BadScript Language.
Definition BadObject.cs:28
Contains Shared Data Structures and Functionality.
Contains the BadScript2 Constant Folding Optimizations.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.