mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
some fix
This commit is contained in:
parent
93be8d7a7b
commit
65f6026e64
@ -26,18 +26,6 @@ struct Loop {
|
||||
Loop(bool forLoop, int start) : forLoop(forLoop), start(start) {}
|
||||
};
|
||||
|
||||
#define ExprCommaSplitArgs(end) \
|
||||
int ARGC = 0; \
|
||||
do { \
|
||||
matchNewLines(); \
|
||||
if (peek() == TK(end)) break; \
|
||||
EXPR(); \
|
||||
ARGC++; \
|
||||
matchNewLines(); \
|
||||
} while (match(TK(","))); \
|
||||
matchNewLines(); \
|
||||
consume(TK(end));
|
||||
|
||||
class Compiler {
|
||||
public:
|
||||
std::unique_ptr<Parser> parser;
|
||||
@ -501,7 +489,16 @@ __LISTCOMP:
|
||||
}
|
||||
|
||||
void exprCall() {
|
||||
ExprCommaSplitArgs(")");
|
||||
int ARGC = 0;
|
||||
do {
|
||||
matchNewLines();
|
||||
if (peek() == TK(")")) break;
|
||||
EXPR();
|
||||
ARGC++;
|
||||
matchNewLines();
|
||||
} while (match(TK(",")));
|
||||
matchNewLines();
|
||||
consume(TK(")"));
|
||||
emitCode(OP_CALL, ARGC);
|
||||
}
|
||||
|
||||
|
@ -449,6 +449,9 @@ extern "C" {
|
||||
__EXPORT
|
||||
void registerModule(VM* vm, const char* name, const char* source){
|
||||
_Code code = compile(vm, source, name + _Str(".py"));
|
||||
vm->registerCompiledModule(name, code);
|
||||
if(code != nullptr){
|
||||
PyVar _m = vm->newModule(name);
|
||||
vm->exec(code, {}, _m);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user