diff options
author | James <gotnospirit@gmail.com> | 2022-09-30 10:30:42 +0800 |
---|---|---|
committer | James <gotnospirit@gmail.com> | 2022-09-30 10:30:42 +0800 |
commit | c8132ee27980dcd86238ebf1f585976708a712a1 (patch) | |
tree | 37f85d1dff73cf88f974f83bcb7a4c08a08ed30b | |
parent | 56563ef09e779b9f4b105fea0e5a1a8e59c7cfe8 (diff) |
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 cb76147a56..151d05e241 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")) { |