| 262 | } |
| 263 | |
| 264 | static void test_compiler(const String &p_code, const String &p_script_path, const Vector<String> &p_lines) { |
| 265 | GDScriptParser parser; |
| 266 | Error err = parser.parse(p_code, p_script_path, false); |
| 267 | |
| 268 | if (err != OK) { |
| 269 | print_line("Error in parser:"); |
| 270 | const List<GDScriptParser::ParserError> &errors = parser.get_errors(); |
| 271 | for (const GDScriptParser::ParserError &error : errors) { |
| 272 | print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message)); |
| 273 | } |
| 274 | return; |
| 275 | } |
| 276 | |
| 277 | GDScriptAnalyzer analyzer(&parser); |
| 278 | err = analyzer.analyze(); |
| 279 | |
| 280 | if (err != OK) { |
| 281 | print_line("Error in analyzer:"); |
| 282 | const List<GDScriptParser::ParserError> &errors = parser.get_errors(); |
| 283 | for (const GDScriptParser::ParserError &error : errors) { |
| 284 | print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message)); |
| 285 | } |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | GDScriptCompiler compiler; |
| 290 | Ref<GDScript> script; |
| 291 | script.instantiate(); |
| 292 | script->set_path(p_script_path); |
| 293 | |
| 294 | err = compiler.compile(&parser, script.ptr(), false); |
| 295 | |
| 296 | if (err) { |
| 297 | print_line("Error in compiler:"); |
| 298 | print_line(vformat("%02d:%02d: %s", compiler.get_error_line(), compiler.get_error_column(), compiler.get_error())); |
| 299 | return; |
| 300 | } |
| 301 | |
| 302 | recursively_disassemble_functions(script, p_lines); |
| 303 | } |
| 304 | |
| 305 | void test(TestType p_type) { |
| 306 | List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); |
no test coverage detected