Replace all uses of the `new` reserved word with explicit `this new()` constructor definitions and `ClassName.new()` instantiation calls in builtin/core.wren. Update all documentation files (classes.markdown, fiber.markdown, fn.markdown, sequence.markdown, error-handling.markdown, expressions.markdown, fibers.markdown, functions.markdown) to reflect the new constructor syntax, removing `new` keyword examples and replacing them with `ClassName.new()` patterns and `this new()` definitions.
21 lines
355 B
Plaintext
21 lines
355 B
Plaintext
class Base {
|
|
foo { IO.print("Base.foo") }
|
|
foo(a) { IO.print("Base.foo(a)") }
|
|
foo(a, b) { IO.print("Base.foo(a, b)") }
|
|
}
|
|
|
|
class Derived is Base {
|
|
foo(a) {
|
|
IO.print("Derived.bar(a)")
|
|
super
|
|
super(1)
|
|
super(1, 2)
|
|
}
|
|
}
|
|
|
|
Derived.new().foo(1)
|
|
// expect: Derived.bar(a)
|
|
// expect: Base.foo
|
|
// expect: Base.foo(a)
|
|
// expect: Base.foo(a, b)
|