added more test-cases for class redefintion
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
28c05ff903
commit
0e2dfea7fb
@ -3559,10 +3559,12 @@ static int execute (hcl_t* hcl)
|
||||
/* store or pop */
|
||||
if (HCL_IS_CLASS(hcl, ass->cdr) && ((hcl_oop_class_t)ass->cdr)->name == ass->car)
|
||||
{
|
||||
/* the existing value must be a class. disallow re-definition */
|
||||
hcl_seterrbfmt (hcl, HCL_EPERM, "prohibited redefintion of %.*js", HCL_OBJ_GET_SIZE(ass->car), HCL_OBJ_GET_CHAR_SLOT(ass->car));
|
||||
if (do_throw_with_internal_errmsg(hcl, fetched_instruction_pointer) >= 0) break;
|
||||
goto oops_with_errmsg_supplement;
|
||||
}
|
||||
|
||||
ass->cdr = HCL_STACK_GETTOP(hcl);
|
||||
|
||||
if ((bcode >> 2) & 1)
|
||||
|
@ -147,3 +147,41 @@ class X [ a b c ] {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
class F {
|
||||
}
|
||||
|
||||
class F { ##ERROR: exception not handled - "prohibited redefintion of F
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
class F {
|
||||
}
|
||||
|
||||
F := 30 ##ERROR: exception not handled - "prohibited redefintion of F
|
||||
|
||||
---
|
||||
|
||||
|
||||
class F {
|
||||
}
|
||||
|
||||
F := (class { ##ERROR: exception not handled - "prohibited redefintion of F"
|
||||
})
|
||||
|
||||
---
|
||||
|
||||
F := (class {
|
||||
})
|
||||
|
||||
F := (class F { ##ERROR: exception not handle - "prohibited redefintion of F"
|
||||
})
|
||||
|
||||
## TDOO: do we need to allow the above?
|
||||
|
||||
##F := 30
|
||||
##class F { ##ERROR: exception not handled - "prohibited redefintion of F"
|
||||
##}
|
||||
|
Loading…
Reference in New Issue
Block a user