[Yunq] Move method numbers to a scheme set by the parser.
This commit is contained in:
parent
3b91819a4b
commit
9e12531651
3 changed files with 5 additions and 2 deletions
|
|
@ -215,8 +215,11 @@ class Parser():
|
|||
|
||||
methods: list[Method] = []
|
||||
method_names = set()
|
||||
next_method_number = 0
|
||||
while self.peektype() != LexemeType.RIGHT_BRACE:
|
||||
m = self.method()
|
||||
m.number = next_method_number
|
||||
next_method_number += 1
|
||||
if m.name in method_names:
|
||||
sys.exit("Method %s declared twice on %s" % (m.name, name))
|
||||
method_names.add(m.name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue