diff --git a/src/compiler.c b/src/compiler.c index 697b657..f1ed4ac 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -2556,10 +2556,12 @@ static size_t importModule(struct GlobalState * state, KrkToken * startOfName, i } static void importStatement(struct GlobalState * state) { + KrkToken left = state->parser.previous; do { KrkToken firstName = state->parser.current; KrkToken startOfName = {0}; size_t ind = importModule(state, &startOfName, 0); + writeExpressionLocation(&left,&state->parser.current,&firstName,state); if (match(TOKEN_AS)) { consume(TOKEN_IDENTIFIER, "Expected identifier after 'as'."); ind = identifierConstant(state, &state->parser.previous); diff --git a/test/testExpressionUnderlining.krk.expect b/test/testExpressionUnderlining.krk.expect index 8b63ff3..8b94cef 100644 --- a/test/testExpressionUnderlining.krk.expect +++ b/test/testExpressionUnderlining.krk.expect @@ -16,6 +16,8 @@ print(foo['bar']['baz']['qux']['etc']) ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ print(foo['bar']['baz']['qux']['etc']) ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +import os +~~~~~~~^^ os.system(42) ~~^~~~~~~ os.system(42)