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.
This commit is contained in:
+5
-5
@@ -103,7 +103,7 @@ class Sequence {
|
||||
}
|
||||
|
||||
class MapSequence is Sequence {
|
||||
this new(sequence, fn) {
|
||||
construct new(sequence, fn) {
|
||||
_sequence = sequence
|
||||
_fn = fn
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class MapSequence is Sequence {
|
||||
}
|
||||
|
||||
class WhereSequence is Sequence {
|
||||
this new(sequence, fn) {
|
||||
construct new(sequence, fn) {
|
||||
_sequence = sequence
|
||||
_fn = fn
|
||||
}
|
||||
@@ -133,7 +133,7 @@ class String is Sequence {
|
||||
}
|
||||
|
||||
class StringByteSequence is Sequence {
|
||||
this new(string) {
|
||||
construct new(string) {
|
||||
_string = string
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class Map {
|
||||
}
|
||||
|
||||
class MapKeySequence is Sequence {
|
||||
this new(map) {
|
||||
construct new(map) {
|
||||
_map = map
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class MapKeySequence is Sequence {
|
||||
}
|
||||
|
||||
class MapValueSequence is Sequence {
|
||||
this new(map) {
|
||||
construct new(map) {
|
||||
_map = map
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user