diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-30 09:59:04 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-30 09:59:04 +0200 |
commit | fe9f056623166af2007992250107ee2309e0b1c7 (patch) | |
tree | fe0ee371ae70aad76ccf52a76519cf04afb16147 | |
parent | fe40c52be89e2e5de53d39fe8ec894b9c2ca2c1e (diff) | |
parent | c8132ee27980dcd86238ebf1f585976708a712a1 (diff) |
Merge pull request #66640 from gotnospirit/master-project_converter-json-print
Project converter: JSON.print -> JSON.stringify
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index d8ff1e1b6e..30e29f744a 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -1728,6 +1728,7 @@ public: RegEx reg_json_to = RegEx("\\bto_json\\b"); RegEx reg_json_parse = RegEx("([\t ]{0,})([^\n]+)parse_json\\(([^\n]+)"); RegEx reg_json_non_new = RegEx("([\t ]{0,})([^\n]+)JSON\\.parse\\(([^\n]+)"); + RegEx reg_json_print = RegEx("\\bJSON\\b\\.print\\("); RegEx reg_export = RegEx("export\\(([a-zA-Z0-9_]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)"); RegEx reg_export_advanced = RegEx("export\\(([^)^\n]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)([^\n]+)"); RegEx reg_setget_setget = RegEx("var[ ]+([a-zA-Z0-9_]+)([^\n]+)setget[ \t]+([a-zA-Z0-9_]+)[ \t]*,[ \t]*([a-zA-Z0-9_]+)"); @@ -3076,6 +3077,10 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai if (line.contains("parse_json")) { line = reg_container.reg_json_parse.sub(line, "$1var test_json_conv = JSON.new()\n$1test_json_conv.parse($3\n$1$2test_json_conv.get_data()", true); } + // -- JSON.print( -> JSON.stringify( + if (line.contains("JSON.print(")) { + line = reg_container.reg_json_print.sub(line, "JSON.stringify(", true); + } // -- get_node(@ -> get_node( Node if (line.contains("get_node")) { |