Skip to content

Made undefinedp() work on unassigned class members.#911

Merged
thefallentree merged 1 commit intofluffos:masterfrom
jalbright015:master
Aug 28, 2022
Merged

Made undefinedp() work on unassigned class members.#911
thefallentree merged 1 commit intofluffos:masterfrom
jalbright015:master

Conversation

@jalbright015
Copy link
Copy Markdown
Contributor

@jalbright015 jalbright015 commented Aug 28, 2022

Made classes initialize members with const0u so that they can be tested with undefinedp(). Added assertions to testsuite for undefined class members and moved test file from testsuite/single/tests/operators/class.c to testsuite/single/tests/compiler/class.c.

Fixes issue: #903

class SuperClass {
  int foo;
}

class SuperClass super;

void test()
{  
  string ret = "";
  super = new(class SuperClass);
  
  ret += sprintf("super.foo: %O\n", super.foo);
  ret += sprintf("identify(super.foo): %O\n", identify(super.foo));
  ret += sprintf("undefinedp(super.foo): %O\n", undefinedp(super.foo));
  ret += sprintf("typeof(super.foo): %O\n", typeof(super.foo));

  debug(":jezu", ret, wizards());
}
> eval return "/open/jezu/class.c"->test()
super.foo: 0
identify(super.foo): "UNDEFINED"
undefinedp(super.foo): 1
typeof(super.foo): "int"

@thefallentree thefallentree merged commit ccee556 into fluffos:master Aug 28, 2022
Amirani-al pushed a commit to Amirani-al/fluffos that referenced this pull request May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants