Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

Fix werid error #345

Closed littlewhitecloud closed 1 year ago

littlewhitecloud commented 1 year ago

fix #244

littlewhitecloud commented 1 year ago
-compiler error in file "tests/other_errors/function_wrong_n_args.jou", line 4: function getchar() takes 0 arguments, but it was called with 1 argument
-Exit code: 1
+bash: line 1:  3861 Segmentation fault      (core dumped) ./jou -O3 tests/other_errors/function_wrong_n_args.jou

Oh, no, segmentation fault

Akuli commented 1 year ago
-compiler error in file "tests/syntax_error/missing_self.jou", line 2: error when defining method bar() bacause it has no self
+compiler error in file "tests/syntax_error/missing_self.jou", line 7: error when defining method bar() bacause it has no self

This means that the error is reported on the wrong line. The compiler actually reports an error on line 7, but according to the test it should be reported on line 2.

littlewhitecloud commented 1 year ago

my idea: create a new flag named selfused, and if it doesn't true after the "while" loop and accept_self is true, I will give an parse_error

littlewhitecloud commented 1 year ago

Now the problem is: how can I get this function name for showing the error

Akuli commented 1 year ago

You can use result.name.

Akuli commented 1 year ago

Now add the same error message in the self-hosted compiler :)

littlewhitecloud commented 1 year ago

finally...