Import and export are working

This commit is contained in:
2022-09-05 06:39:05 +01:00
parent dceb83e618
commit 7fb9ebbce0
10 changed files with 266 additions and 12 deletions

View File

@@ -716,6 +716,26 @@ static void writeCompilerWithJumps(Compiler* compiler, Node* node, void* breakAd
compiler->bytecode[compiler->count++] = (unsigned char)OP_VAR_ASSIGN; //1 byte
}
break;
case NODE_IMPORT: {
//push the identifier, and the alias
writeLiteralToCompiler(compiler, node->import.identifier);
writeLiteralToCompiler(compiler, node->import.alias);
//push the import opcode
compiler->bytecode[compiler->count++] = (unsigned char)OP_IMPORT; //1 byte
}
break;
case NODE_EXPORT: {
//push the identifier, and the alias
writeLiteralToCompiler(compiler, node->import.identifier);
writeLiteralToCompiler(compiler, node->import.alias);
//push the import opcode
compiler->bytecode[compiler->count++] = (unsigned char)OP_EXPORT; //1 byte
}
break;
}
}