Explorar o código

show better line for double functions

Kajetan Johannes Hammerle %!s(int64=4) %!d(string=hai) anos
pai
achega
6191d26fa8
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      Compiler.c

+ 2 - 1
Compiler.c

@@ -268,6 +268,7 @@ static void cFunctionInnerBody(int arguments) {
 }
 
 static void cFunctionBody(const char* name, int arguments) {
+    int oldLine = line;
     cConsumeToken(T_OPEN_CURVED_BRACKET);
     cAddOperation(OP_GOTO);
     int gotoIndex = cReserveInt();
@@ -276,7 +277,7 @@ static void cFunctionBody(const char* name, int arguments) {
     returnState = 0;
     cFunctionInnerBody(arguments);
     if(!fmAdd(&functions, name, arguments, address, returnState == 2)) {
-        cError("function registered twice on line %d", line);
+        cError("function registered twice on line %d", oldLine);
     }
 
     cAddOperation(OP_RETURN);