Use "construct" instead of "this" to define constructors.

This commit is contained in:
Bob Nystrom
2015-07-21 07:24:53 -07:00
parent ed8ec262e4
commit 71ab3ca887
31 changed files with 68 additions and 81 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
// Class definition with a toplevel name.
class SyntaxExample {
// Constructor
this new() {
construct new() {
// Top-level name `IO`
IO.print("I am a constructor!")
@@ -26,7 +26,7 @@ class SyntaxExample {
}
// Constructor with arguments
this constructor(a, b) {
construct constructor(a, b) {
print(a, b)
field = a
}