diff --git a/port/linux/test/VM-test.cpp b/port/linux/test/VM-test.cpp index 87ddd4907..793d2b3cb 100644 --- a/port/linux/test/VM-test.cpp +++ b/port/linux/test/VM-test.cpp @@ -1666,3 +1666,27 @@ TEST(vm, exit_fn) { EXPECT_EQ(pikaMemNow(), 0); } #endif + +TEST(vm, pass_) { + /* init */ + pikaMemInfo.heapUsedMax = 0; + PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain); + extern unsigned char pikaModules_py_a[]; + obj_linkLibrary(pikaMain, pikaModules_py_a); + /* run */ + __platform_printf("BEGIN\r\n"); + obj_run(pikaMain, + "pass\n" + "def testpass():\n" + " pass\n" + "for i in range(10):\n" + " pass\n" + "testpass()\n" + "print('after pass')\n"); + /* collect */ + /* assert */ + EXPECT_STREQ(log_buff[0], "after pass\r\n"); + /* deinit */ + obj_deinit(pikaMain); + EXPECT_EQ(pikaMemNow(), 0); +} diff --git a/port/linux/test/parse-test.cpp b/port/linux/test/parse-test.cpp index d8d61076f..60a8bb052 100644 --- a/port/linux/test/parse-test.cpp +++ b/port/linux/test/parse-test.cpp @@ -4270,4 +4270,45 @@ TEST(parser, for_multi) { EXPECT_EQ(pikaMemNow(), 0); } +TEST(parser, pass_) { + pikaMemInfo.heapUsedMax = 0; + Args* buffs = New_strBuff(); + char* lines = + "pass\n" + "def testpass():\n" + " pass\n" + "for i in range(10):\n" + " pass\n"; + __platform_printf("%s\n", lines); + char* pikaAsm = Parser_linesToAsm(buffs, lines); + __platform_printf("%s", pikaAsm); + EXPECT_STREQ(pikaAsm, + "B0\n" + "B0\n" + "0 DEF testpass()\n" + "0 JMP 1\n" + "B1\n" + "B1\n" + "0 RET \n" + "B0\n" + "2 NUM 10\n" + "1 RUN range\n" + "0 RUN iter\n" + "0 OUT $l0\n" + "B0\n" + "0 RUN $l0.__next__\n" + "0 OUT i\n" + "0 EST i\n" + "0 JEZ 2\n" + "B1\n" + "B0\n" + "0 JMP -1\n" + "B0\n" + "0 DEL $l0\n" + "B0\n"); + + args_deinit(buffs); + EXPECT_EQ(pikaMemNow(), 0); +} + #endif diff --git a/port/linux/version_config.py b/port/linux/version_config.py index 4a57182fe..4f8249db5 100644 --- a/port/linux/version_config.py +++ b/port/linux/version_config.py @@ -1,3 +1,3 @@ MajorVersion = "1" MinorVersion = "10" -MicroVersion = "8" +MicroVersion = "9" diff --git a/src/PikaParser.c b/src/PikaParser.c index 8cc22ab75..8bc2f4d59 100644 --- a/src/PikaParser.c +++ b/src/PikaParser.c @@ -226,6 +226,11 @@ static enum StmtType Lexer_matchStmtType(char* right) { if (strEqu(cs.token1.pyload, "...")) { goto iter_continue; } + + if (strEqu(cs.token1.pyload, "pass")){ + goto iter_continue; + } + if (strIsStartWith(cs.token1.pyload, ".")) { if (cs.iter_index != 1) { is_get_chain = PIKA_TRUE; diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 360696288..2bd6e45b5 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -1,5 +1,5 @@ #define PIKA_VERSION_MAJOR 1 #define PIKA_VERSION_MINOR 10 -#define PIKA_VERSION_MICRO 8 +#define PIKA_VERSION_MICRO 9 -#define PIKA_EDIT_TIME "2022/09/09 13:10:15" +#define PIKA_EDIT_TIME "2022/09/15 18:43:26" diff --git a/tools/pikaCompiler/rust-msc-latest-win10.exe b/tools/pikaCompiler/rust-msc-latest-win10.exe index 73e99b2c8..629615da8 100644 Binary files a/tools/pikaCompiler/rust-msc-latest-win10.exe and b/tools/pikaCompiler/rust-msc-latest-win10.exe differ