Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Better parameters mismatch function (solved)
#1
I was compiling my program when the compiler claimed (correctly) that there was an error in my code:
Code:
util.bas:105: error: Function 'FormatStr' takes 3 parameters, not 1
This message was correct, but instead of signaling the file name and the line where the error was present, it was showing the line number and the file name of where the function was defined!
It also messes with the line number, which corresponds to where the error happened, not where the function was defined. In my case, the error happened at line number 105 of player.bas, calling function FormatStr() defined in line number 39 of util.bas.
I think it would be better to expose both pieces of information, maybe this way:
Code:
player.bas: 105: error: Function 'FormatStr' takes 3 parameters, not 1
util.bas:39: error: Function 'FormatStr' defined here.
Well, something like that.
-- Baltasar
Reply
#2
Can you post a minimal example to reproduce this error?
Otherwise, contact me privately and send me the source code so I can reproduce the error and fix it.  Rolleyes
---
Boriel
Reply
#3
Sure, say you have two files:

params_error.bas
Code:
sub foo(a as ubyte, b as ubyte)
    print a, ", ", b
end sub

params_error2.bas
Code:
#include "params_error.bas"
foo(42)

You compile, and the output is:
Code:
params_error.bas:3: error: Function 'foo' takes 2 parameters, not 1

While I think it should be, or at least ir would be more infomative being:

Code:
params_error2.bas:2: error: Function 'foo' takes 2 parameters, not 1
params_error.bas:3: error: Function 'foo' defined here.
-- Baltasar
Reply
#4
Please try this new version and let me know if it works correctly now :-)
http://www.boriel.com/files/zxb/zxbasic-...ta6.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...-beta6.zip
http://www.boriel.com/files/zxb/zxbasic-...-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...x64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...cos.tar.gz
---
Boriel
Reply
#5
Working correctly, thanks!!
-- Baltasar
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)