diff --git a/src/protocol/ast_printer.rs b/src/protocol/ast_printer.rs index 5529cd3dde91d3b9834ab3cc4ecce3d8641eef9d..ef616a9504825f992232a4087d7898e01352722f 100644 --- a/src/protocol/ast_printer.rs +++ b/src/protocol/ast_printer.rs @@ -354,11 +354,8 @@ impl ASTWriter { self.kv(indent3).with_s_key("PolyVar").with_identifier_val(&poly_var_id); } - self.kv(indent2).with_s_key("ReturnParserTypes"); - for return_type in &def.return_types { - self.kv(indent3).with_s_key("ReturnParserType") - .with_custom_val(|s| write_parser_type(s, heap, return_type)); - } + self.kv(indent2).with_s_key("ReturnParserType") + .with_custom_val(|s| write_parser_type(s, heap, &def.return_type)); self.kv(indent2).with_s_key("Parameters"); for variable_id in &def.parameters { @@ -401,9 +398,7 @@ impl ASTWriter { self.kv(indent).with_id(PREFIX_BLOCK_STMT_ID, stmt.this.0.index) .with_s_key("Block"); self.kv(indent2).with_s_key("EndBlockID").with_disp_val(&stmt.end_block.0.index); - self.kv(indent2).with_s_key("FirstUniqueScopeID").with_disp_val(&stmt.first_unique_id_in_scope); - self.kv(indent2).with_s_key("NextUniqueScopeID").with_disp_val(&stmt.next_unique_id_in_scope); - self.kv(indent2).with_s_key("RelativePos").with_disp_val(&stmt.scope_node.relative_pos_in_parent); + self.kv(indent2).with_s_key("ScopeID").with_disp_val(&stmt.scope.index); self.kv(indent2).with_s_key("Statements"); for stmt_id in &stmt.statements { @@ -457,11 +452,11 @@ impl ASTWriter { self.write_expr(heap, stmt.test, indent3); self.kv(indent2).with_s_key("TrueBody"); - self.write_stmt(heap, stmt.true_body.upcast(), indent3); + self.write_stmt(heap, stmt.true_case.body, indent3); - if let Some(false_body) = stmt.false_body { + if let Some(false_body) = stmt.false_case { self.kv(indent2).with_s_key("FalseBody"); - self.write_stmt(heap, false_body.upcast(), indent3); + self.write_stmt(heap, false_body.body, indent3); } }, Statement::EndIf(stmt) => { @@ -480,7 +475,7 @@ impl ASTWriter { self.kv(indent2).with_s_key("Condition"); self.write_expr(heap, stmt.test, indent3); self.kv(indent2).with_s_key("Body"); - self.write_stmt(heap, stmt.body.upcast(), indent3); + self.write_stmt(heap, stmt.body, indent3); }, Statement::EndWhile(stmt) => { self.kv(indent).with_id(PREFIX_ENDWHILE_STMT_ID, stmt.this.0.index) @@ -509,7 +504,7 @@ impl ASTWriter { .with_s_key("Synchronous"); self.kv(indent2).with_s_key("EndSync").with_disp_val(&stmt.end_sync.0.index); self.kv(indent2).with_s_key("Body"); - self.write_stmt(heap, stmt.body.upcast(), indent3); + self.write_stmt(heap, stmt.body, indent3); }, Statement::EndSynchronous(stmt) => { self.kv(indent).with_id(PREFIX_ENDSYNC_STMT_ID, stmt.this.0.index) @@ -522,11 +517,11 @@ impl ASTWriter { .with_s_key("Fork"); self.kv(indent2).with_s_key("EndFork").with_disp_val(&stmt.end_fork.0.index); self.kv(indent2).with_s_key("LeftBody"); - self.write_stmt(heap, stmt.left_body.upcast(), indent3); + self.write_stmt(heap, stmt.left_body, indent3); if let Some(right_body_id) = stmt.right_body { self.kv(indent2).with_s_key("RightBody"); - self.write_stmt(heap, right_body_id.upcast(), indent3); + self.write_stmt(heap, right_body_id, indent3); } }, Statement::EndFork(stmt) => { @@ -547,7 +542,7 @@ impl ASTWriter { self.write_stmt(heap, case.guard, indent4); self.kv(indent3).with_s_key("Block"); - self.write_stmt(heap, case.block.upcast(), indent4); + self.write_stmt(heap, case.body, indent4); } }, Statement::EndSelect(stmt) => { @@ -825,7 +820,7 @@ impl ASTWriter { self.kv(indent2).with_s_key("Kind").with_debug_val(&var.kind); self.kv(indent2).with_s_key("ParserType") .with_custom_val(|w| write_parser_type(w, heap, &var.parser_type)); - self.kv(indent2).with_s_key("RelativePos").with_disp_val(&var.relative_pos_in_block); + self.kv(indent2).with_s_key("RelativePos").with_disp_val(&var.relative_pos_in_parent); self.kv(indent2).with_s_key("UniqueScopeID").with_disp_val(&var.unique_id_in_scope); }