소스 검색

show better line for double functions

Kajetan Johannes Hammerle 4 년 전
부모
커밋
6191d26fa8
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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);