feat(interpreter): make early return in init return this
This commit is contained in:
@@ -29,6 +29,8 @@ class PebbleFunction(PebbleCallable):
|
|||||||
try:
|
try:
|
||||||
interpreter.execute_block(self.declaration.body, env)
|
interpreter.execute_block(self.declaration.body, env)
|
||||||
except ReturnException as ret:
|
except ReturnException as ret:
|
||||||
|
if self.is_init:
|
||||||
|
return self.closure.get_at(0, "this")
|
||||||
return ret.value
|
return ret.value
|
||||||
|
|
||||||
if self.is_init:
|
if self.is_init:
|
||||||
|
|||||||
Reference in New Issue
Block a user