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

@@ -93,6 +93,12 @@ void freeNodeCustom(Node* node, bool freeSelf) {
case NODE_INCREMENT_POSTFIX:
freeLiteral(node->increment.identifier);
break;
case NODE_IMPORT:
case NODE_EXPORT:
freeLiteral(node->import.identifier);
freeLiteral(node->import.alias);
break;
}
if (freeSelf) {
@@ -246,3 +252,13 @@ void emitNodePostfixIncrement(Node** nodeHandle, Literal identifier, int increme
*nodeHandle = tmp;
}
void emitNodeImport(Node** nodeHandle, NodeType mode, Literal identifier, Literal alias) {
Node* tmp = ALLOCATE(Node, 1);
tmp->type = mode;
tmp->import.identifier = copyLiteral(identifier);
tmp->import.alias = copyLiteral(alias);
*nodeHandle = tmp;
}