diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-30 11:12:22 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-30 11:12:22 -0800 |
commit | b198650b2ce7eeea4c0d7caa699b6d52b10cdfb0 (patch) | |
tree | 7caa877cda8aa4e7b4ef968209213b56afe0cd78 | |
parent | 3d3aed204db8663de99d90d6eedbd8d71e40f194 (diff) | |
parent | fabc7c37d739a5be83acde3f762777ed4ba4c1f5 (diff) |
Merge pull request #193 from FishingCactus/string_table2
Fix string global name when use as a function parameter
-rw-r--r-- | src/parseTools.js | 7 | ||||
-rwxr-xr-x | tests/runner.py | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index ad6f2830..09168179 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -385,7 +385,12 @@ function finalizeParam(param) { if (param.type == 'i64' && I64_MODE == 1) { return parseI64Constant(param.ident); } - return toNiceIdent(param.ident); + var ret = toNiceIdent(param.ident); + if (ret in Variables.globals && Variables.globals[ret].isString) { + ret = "STRING_TABLE." + ret; + } + + return ret; } } diff --git a/tests/runner.py b/tests/runner.py index cf6b4009..6bd8626d 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -3617,6 +3617,22 @@ def process(filename): ''' self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected), post_build=add_pre_run_and_checks) + def test_direct_string_constant_usage(self): + src = ''' + #include <iostream> + template<int i> + void printText( const char (&text)[ i ] ) + { + std::cout << text; + } + int main() + { + printText( "some string constant" ); + return 0; + } + ''' + self.do_run(src, "some string constant") + def test_fs_base(self): Settings.INCLUDE_FULL_LIBRARY = 1 try: |