Remove Fn.new().

It's unneeded now that we have fn () { ... }.
This commit is contained in:
Bob Nystrom
2015-11-28 10:13:14 -08:00
parent 22b9ed8f6f
commit f54f8df4d6
3 changed files with 2 additions and 11 deletions

View File

@ -2659,7 +2659,8 @@ static GrammarRule* getRule(TokenType 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,
Precedence precedence)
{

View File

@ -235,14 +235,6 @@ DEF_PRIMITIVE(fiber_yield1)
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)
{
RETURN_NUM(AS_FN(args[0])->arity);
@ -1161,7 +1153,6 @@ void wrenInitializeCore(WrenVM* vm)
PRIMITIVE(vm->fiberClass, "try()", fiber_try);
vm->fnClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Fn"));
PRIMITIVE(vm->fnClass->obj.classObj, "new(_)", fn_new);
PRIMITIVE(vm->fnClass, "arity", fn_arity);
fnCall(vm, "call()");

View File

@ -1 +0,0 @@
Fn.new(3) // expect runtime error: Argument must be a function.