mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 06:08:41 +01:00
Remove Fn.new().
It's unneeded now that we have fn () { ... }.
This commit is contained in:
@ -2659,7 +2659,8 @@ static GrammarRule* getRule(TokenType type)
|
|||||||
return &rules[type];
|
return &rules[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Doc.
|
// Completes parsing an expression after the prefix part has been parsed.
|
||||||
|
// Parses any trailing infix expressions.
|
||||||
static void parseInfix(Compiler* compiler, bool allowAssignment,
|
static void parseInfix(Compiler* compiler, bool allowAssignment,
|
||||||
Precedence precedence)
|
Precedence precedence)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -235,14 +235,6 @@ DEF_PRIMITIVE(fiber_yield1)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_PRIMITIVE(fn_new)
|
|
||||||
{
|
|
||||||
if (!validateFn(vm, args[1], "Argument")) return false;
|
|
||||||
|
|
||||||
// The block argument is already a function, so just return it.
|
|
||||||
RETURN_VAL(args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEF_PRIMITIVE(fn_arity)
|
DEF_PRIMITIVE(fn_arity)
|
||||||
{
|
{
|
||||||
RETURN_NUM(AS_FN(args[0])->arity);
|
RETURN_NUM(AS_FN(args[0])->arity);
|
||||||
@ -1161,7 +1153,6 @@ void wrenInitializeCore(WrenVM* vm)
|
|||||||
PRIMITIVE(vm->fiberClass, "try()", fiber_try);
|
PRIMITIVE(vm->fiberClass, "try()", fiber_try);
|
||||||
|
|
||||||
vm->fnClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Fn"));
|
vm->fnClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Fn"));
|
||||||
PRIMITIVE(vm->fnClass->obj.classObj, "new(_)", fn_new);
|
|
||||||
|
|
||||||
PRIMITIVE(vm->fnClass, "arity", fn_arity);
|
PRIMITIVE(vm->fnClass, "arity", fn_arity);
|
||||||
fnCall(vm, "call()");
|
fnCall(vm, "call()");
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
Fn.new(3) // expect runtime error: Argument must be a function.
|
|
||||||
Reference in New Issue
Block a user