updating the compiler to recognize class-level variables accessors prefixed with self/super in assignment expressions
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-12-02 03:35:59 +09:00
parent 70828ac110
commit 924d4ad5e2
9 changed files with 102 additions and 20 deletions

View File

@ -9,6 +9,7 @@ check_SCRIPTS = \
va-01.hcl
check_ERRORS = \
class-01.err \
do-01.err \
do-02.err \
feed-01.err \

View File

@ -480,6 +480,7 @@ check_SCRIPTS = \
va-01.hcl
check_ERRORS = \
class-01.err \
do-01.err \
do-02.err \
feed-01.err \

23
t/class-01.err Normal file
View File

@ -0,0 +1,23 @@
defclass B | x y | {
};
defclass X ::: B | a b | {
defun ::* new(t) {
| a |
set self.a t;
set a 100;
set self.b (* t 2);
set self.c (fun(b) { ##ERROR: syntax error - unknown class-level variable name
printf "xxxx [%d]\n" b;
});
return self;
};
defun print() {
self.c (+ self.a self.b);
printf "a=%d b=%d\n" self.a self.b;
}
};