mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-06 04:37:47 +08:00
class without constructor crash fix
This commit is contained in:
parent
590e76b19f
commit
821874f823
@ -934,8 +934,9 @@ L_do_call:
|
|||||||
CHECK_ERROR();
|
CHECK_ERROR();
|
||||||
|
|
||||||
closure = (const Closure*)(cls)->ctor;
|
closure = (const Closure*)(cls)->ctor;
|
||||||
while (closure == NULL && cls != NULL) {
|
while (closure == NULL) {
|
||||||
cls = cls->super_class;
|
cls = cls->super_class;
|
||||||
|
if (cls == NULL) break;
|
||||||
closure = cls->ctor;
|
closure = cls->ctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,19 @@ print("v2 = ${v2.to_string()}")
|
|||||||
v3 = v1.add(v2); assert(v3.x == 4 and v3.y == 6)
|
v3 = v1.add(v2); assert(v3.x == 4 and v3.y == 6)
|
||||||
print("v3 = ${v3.to_string()}")
|
print("v3 = ${v3.to_string()}")
|
||||||
|
|
||||||
|
|
||||||
|
## Default constructor crash (issue #213)
|
||||||
|
class A
|
||||||
|
end
|
||||||
|
a = A()
|
||||||
|
print(a)
|
||||||
|
|
||||||
|
class B is A
|
||||||
|
end
|
||||||
|
|
||||||
|
b = B()
|
||||||
|
assert((b is B) and (b is A))
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## INHERITANCE
|
## INHERITANCE
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user