Merge pull request #14859 from s-hadinger/berry_instance_func

Berry instance variables are never methods
This commit is contained in:
s-hadinger 2022-02-15 17:47:29 +01:00 committed by GitHub
commit 05ac7ba4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -904,7 +904,11 @@ newframe: /* a new call frame */
if (var_isinstance(a) && var_isstr(b)) {
binstance *obj = var_toobj(a);
bstring *attr = var_tostr(b);
if (!be_instance_setmember(vm, obj, attr, c)) {
bvalue result = *c;
if (var_isfunction(&result)) {
var_markstatic(&result);
}
if (!be_instance_setmember(vm, obj, attr, &result)) {
reg = vm->reg;
vm_error(vm, "attribute_error",
"class '%s' cannot assign to attribute '%s'",