Skip to content

Commit bc60096

Browse files
committed
Fix wrong include name file
This happened when resolving pending calls. Filename must be that of the variable (where the variable is being referenced, not the current main file which is not always the right one).
1 parent 8b7352b commit bc60096

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

api/symboltable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def check_is_declared(self, id_: str, lineno: int, classname='identifier',
218218

219219
if result is None or not result.declared:
220220
if show_error:
221-
syntax_error(lineno, 'Undeclared %s "%s"' % (classname, id_))
221+
syntax_error(lineno, 'Undeclared %s "%s"' % (classname, id_),
222+
fname=(result.filename if result is not None else None))
222223
return False
223224
return True
224225

tests/functional/include_error.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REM should shouw the original (included) filename, not this one
2+
3+
#include "llb.bas"

tests/functional/test_errmsg.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,6 @@ dim_at_label6.bas:3: error: Circular dependency between 'c' and 'b'
158158
dim_at_label7.bas:3: error: Circular dependency between 'b' and 'a'
159159
dim_at_label7.bas:3: error: Circular dependency between 'a' and 'c'
160160
dim_at_label7.bas:4: error: Circular dependency between 'c' and 'b'
161+
>>> process_file('include_error.bas')
162+
llb.bas:3: error: Undeclared function "f$"
161163

0 commit comments

Comments
 (0)