Merge pull request #214 from ThakeeNathees/ctor-crash

class without constructor crash fix
This commit is contained in:
Thakee Nathees 2022-04-27 20:29:15 +05:30 committed by GitHub
commit 89056637b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -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;
} }

View File

@ -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
############################################################################### ###############################################################################