JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Cannot have statements followed by a class in a script #154

Closed JSAbrahams closed 2 years ago

JSAbrahams commented 5 years ago

Description of Bug

The parser throws an error if we have a few statements followed by a class.

How to Reproduce

Write a script with a few statements followed by a class

Expected behaviour

We would expect the script to execute as usual Namely, it should be possible to have a few statements followed by a class, i.e., write a script with some statements with for instance a helper class at the bottom.

JSAbrahams commented 5 years ago

So this bug has been fixed in #151

However, a limitation of the current pipeline/parsing framework is that the order of classes and statements is not kept. So in the output, all the classes are written first and then all the statements, meaning that the ordering of classes and statements is lost (though hiding statements between classes is bad practice anyway).

Not sure if this is a bad thing, but it is behaviour which should be kept in mind.