mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
afd2aea59e
commit
a0545048bd
@ -45,7 +45,7 @@ retmany_x : 1
|
||||
retmany_x : 2
|
||||
retmany_x : 3
|
||||
successfully errored with this message:
|
||||
TypeError: expected 2 positional arguments, but got 0 (x)
|
||||
TypeError: expected 2 positional arguments, got 0 (x)
|
||||
['hello']
|
||||
|
||||
testing pushing functions
|
||||
@ -74,4 +74,4 @@ pi: 3.14
|
||||
pi: 3.14
|
||||
2
|
||||
successfully errored with this message:
|
||||
TypeError: expected 'int', but got 'float'
|
||||
TypeError: expected 'int', got 'float'
|
||||
|
@ -376,7 +376,7 @@ struct NativeProxyFuncCBase {
|
||||
|
||||
static void check_args_size(VM* vm, ArgsView args, int n){
|
||||
if (args.size() != n){
|
||||
vm->TypeError("expected " + std::to_string(n) + " arguments, but got " + std::to_string(args.size()));
|
||||
vm->TypeError("expected " + std::to_string(n) + " arguments, got " + std::to_string(args.size()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -135,7 +135,7 @@ class Compiler {
|
||||
void consume(TokenIndex expected) {
|
||||
if (!match(expected)){
|
||||
SyntaxError(
|
||||
fmt("expected '", TK_STR(expected), "', but got '", TK_STR(curr().type), "'")
|
||||
fmt("expected '", TK_STR(expected), "', got '", TK_STR(curr().type), "'")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -577,7 +577,7 @@ __SUBSCR_END:
|
||||
|
||||
void parse_expression(int precedence, bool push_stack=true) {
|
||||
PrattCallback prefix = rules[curr().type].prefix;
|
||||
if (prefix == nullptr) SyntaxError(Str("expected an expression, but got ") + TK_STR(curr().type));
|
||||
if (prefix == nullptr) SyntaxError(Str("expected an expression, got ") + TK_STR(curr().type));
|
||||
advance();
|
||||
(this->*prefix)();
|
||||
while (rules[curr().type].precedence >= precedence) {
|
||||
|
@ -277,7 +277,7 @@ inline void init_builtins(VM* _vm) {
|
||||
case 1: r.stop = CAST(i64, args[0]); break;
|
||||
case 2: r.start = CAST(i64, args[0]); r.stop = CAST(i64, args[1]); break;
|
||||
case 3: r.start = CAST(i64, args[0]); r.stop = CAST(i64, args[1]); r.step = CAST(i64, args[2]); break;
|
||||
default: vm->TypeError("expected 1-3 arguments, but got " + std::to_string(args.size()));
|
||||
default: vm->TypeError("expected 1-3 arguments, got " + std::to_string(args.size()));
|
||||
}
|
||||
return VAR(r);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user