1
0
forked from Mirror/wren

Compile imports to actual instructions instead of core library calls.

This commit is contained in:
Bob Nystrom
2017-10-31 15:58:59 -07:00
parent e9ac543853
commit 8d37b20783
5 changed files with 84 additions and 54 deletions

View File

@ -190,6 +190,19 @@ OPCODE(METHOD_INSTANCE, -2)
// closure.
OPCODE(METHOD_STATIC, -2)
// Import a module whose name is the string stored at [arg] in the constant
// table.
//
// Pushes null onto the stack so that the fiber for the imported module can
// replace that with a dummy value when it returns. (Fibers always return a
// value when resuming a caller.)
OPCODE(IMPORT_MODULE, 1)
// Import a variable from a previously-imported module. The module's name is at
// [arg1] in the constant table and the variable name is at [arg2]. Pushes the
// loaded variable onto the stack.
OPCODE(IMPORT_VARIABLE, 1)
// This pseudo-instruction indicates the end of the bytecode. It should
// always be preceded by a `CODE_RETURN`, so is never actually executed.
OPCODE(END, 0)