diff options
author | Li Jin <dragon-fly@qq.com> | 2021-04-23 16:04:17 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-04-23 16:04:17 +0800 |
commit | 705dfda89c7795f84419e176e3f861780fbd0fcb (patch) | |
tree | f0acef79502ea6bca2dd36a4fbe4b5cb41a500bd /src | |
parent | 68499e8060e6fadbf478528b390a8e9168896d4c (diff) | |
download | yuescript-705dfda89c7795f84419e176e3f861780fbd0fcb.tar.gz yuescript-705dfda89c7795f84419e176e3f861780fbd0fcb.tar.bz2 yuescript-705dfda89c7795f84419e176e3f861780fbd0fcb.zip |
add a missing global variable check.
Diffstat (limited to 'src')
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 1cc5284..5f59340 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -59,7 +59,7 @@ inline std::string s(std::string_view sv) { | |||
59 | return std::string(sv); | 59 | return std::string(sv); |
60 | } | 60 | } |
61 | 61 | ||
62 | const std::string_view version = "0.7.8"sv; | 62 | const std::string_view version = "0.7.9"sv; |
63 | const std::string_view extension = "yue"sv; | 63 | const std::string_view extension = "yue"sv; |
64 | 64 | ||
65 | class YueCompilerImpl { | 65 | class YueCompilerImpl { |
@@ -4411,6 +4411,11 @@ private: | |||
4411 | 4411 | ||
4412 | void transform_variable_pair(variable_pair_t* pair, str_list& out) { | 4412 | void transform_variable_pair(variable_pair_t* pair, str_list& out) { |
4413 | auto name = _parser.toString(pair->name); | 4413 | auto name = _parser.toString(pair->name); |
4414 | if (_config.lintGlobalVariable && !isSolidDefined(name)) { | ||
4415 | if (_globals.find(name) == _globals.end()) { | ||
4416 | _globals[name] = {pair->name->m_begin.m_line, pair->name->m_begin.m_col}; | ||
4417 | } | ||
4418 | } | ||
4414 | out.push_back(name + s(" = "sv) + name); | 4419 | out.push_back(name + s(" = "sv) + name); |
4415 | } | 4420 | } |
4416 | 4421 | ||