diff options
author | Li Jin <dragon-fly@qq.com> | 2023-08-30 09:14:22 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-08-30 09:14:22 +0800 |
commit | 103fd0646eb83898b37398731f90e2dc277ac2d8 (patch) | |
tree | 8df80ca45af367df676f322bde03883fbb93df62 /src | |
parent | ed718b7b6754379b9471830b1cc5241a2fd0f941 (diff) | |
download | yuescript-103fd0646eb83898b37398731f90e2dc277ac2d8.tar.gz yuescript-103fd0646eb83898b37398731f90e2dc277ac2d8.tar.bz2 yuescript-103fd0646eb83898b37398731f90e2dc277ac2d8.zip |
fix inline variable renaming.v0.19.2
Diffstat (limited to 'src')
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
-rw-r--r-- | src/yuescript/yue_parser.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 40f12af..42b92a4 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -74,7 +74,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
74 | "close"s // Lua 5.4 | 74 | "close"s // Lua 5.4 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const std::string_view version = "0.19.1"sv; | 77 | const std::string_view version = "0.19.2"sv; |
78 | const std::string_view extension = "yue"sv; | 78 | const std::string_view extension = "yue"sv; |
79 | 79 | ||
80 | class CompileError : public std::logic_error { | 80 | class CompileError : public std::logic_error { |
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index ea45e85..ff7660a 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -974,12 +974,13 @@ ParseInfo YueParser::parse(std::string_view codes, rule& r) { | |||
974 | moduleName = moduleStr + std::to_string(index); | 974 | moduleName = moduleStr + std::to_string(index); |
975 | index++; | 975 | index++; |
976 | } while (state.usedNames.find(moduleName) != state.usedNames.end()); | 976 | } while (state.usedNames.find(moduleName) != state.usedNames.end()); |
977 | state.usedNames.insert(moduleName); | ||
977 | res.moduleName = moduleName; | 978 | res.moduleName = moduleName; |
978 | res.usedNames = std::move(state.usedNames); | ||
979 | res.exportDefault = state.exportDefault; | 979 | res.exportDefault = state.exportDefault; |
980 | res.exportMacro = state.exportMacro; | 980 | res.exportMacro = state.exportMacro; |
981 | res.exportMetatable = !state.exportMetatable && state.exportMetamethod; | 981 | res.exportMetatable = !state.exportMetatable && state.exportMetamethod; |
982 | } | 982 | } |
983 | res.usedNames = std::move(state.usedNames); | ||
983 | } catch (const ParserError& err) { | 984 | } catch (const ParserError& err) { |
984 | res.error = {err.what(), err.line, err.col}; | 985 | res.error = {err.what(), err.line, err.col}; |
985 | return res; | 986 | return res; |