Files
wren/test/language/constructor/no_default.wren
T
Bob Nystrom 7d9e45e906 feat: replace 'this' keyword with 'construct' for constructor definitions across core lib, compiler, docs, and tests
Add TOKEN_CONSTRUCT as a new reserved word in the Wren compiler lexer and parser, and update the grammar rule table so that 'construct' triggers a constructor signature instead of 'this'. Modify all built-in class definitions in core.wren, wren_core.c, benchmark files, and test fixtures to use 'construct new(...)' and 'construct named(...)' syntax. Update documentation in classes.markdown and syntax.markdown to reflect the new keyword, and remove the deprecated test files for 'new' and infix class expressions.
2015-07-21 14:24:53 +00:00

7 lines
201 B
Plaintext

class Foo {
construct real() {}
}
// Classes do not get an argument-less "new()" if they define a constructor.
var foo = Foo.new() // expect runtime error: Foo metaclass does not implement 'new()'.