Add Engine::compile_to_self_contained.

This commit is contained in:
Stephen Chung
2021-01-09 00:24:55 +08:00
parent b96c832141
commit 0f1f6c4ad3
5 changed files with 206 additions and 7 deletions

View File

@@ -11,6 +11,11 @@ Breaking changes
* `ParseErrorType::WrongFnDefinition` is renamed `FnWrongDefinition`.
* Redefining an existing function within the same script now throws a new `ParseErrorType::FnDuplicatedDefinition`. This is to prevent accidental overwriting an earlier function definition.
New features
------------
* `Engine::compile_to_self_contained` compiles a script into an `AST` and _eagerly_ resolves all `import` statements with string literal paths. The resolved modules are directly embedded into the `AST`. When the `AST` is later evaluated, `import` statements directly yield the pre-resolved modules without going through the resolution process once again.
Enhancements
------------