diff --git a/src/vm/wren_compiler.c b/src/vm/wren_compiler.c index f1c33139..04d983c1 100644 --- a/src/vm/wren_compiler.c +++ b/src/vm/wren_compiler.c @@ -3237,6 +3237,7 @@ static void classDefinition(Compiler* compiler, bool isForeign) // Compiles an "import" statement. static void import(Compiler* compiler) { + ignoreNewlines(compiler); consume(compiler, TOKEN_STRING, "Expect a string after 'import'."); int moduleConstant = addConstant(compiler, compiler->parser->previous.value); @@ -3252,6 +3253,7 @@ static void import(Compiler* compiler) // Compile the comma-separated list of variables to import. do { + ignoreNewlines(compiler); int slot = declareNamedVariable(compiler); // Define a string constant for the variable name. diff --git a/test/language/module/newlines/module.wren b/test/language/module/newlines/module.wren new file mode 100644 index 00000000..37386c66 --- /dev/null +++ b/test/language/module/newlines/module.wren @@ -0,0 +1,5 @@ +// nontest +System.print("ran module") + +var A = "a" +var B = "b" \ No newline at end of file diff --git a/test/language/module/newlines/newlines.wren b/test/language/module/newlines/newlines.wren new file mode 100644 index 00000000..559ce949 --- /dev/null +++ b/test/language/module/newlines/newlines.wren @@ -0,0 +1,15 @@ +import + + +"module" + +import "module" for + +A, + +B + +// expect: ran module + +System.print(A) // expect: a +System.print(B) // expect: b