From c8f6b5bd5c55845562571c196a0b2c1a7ca20f71 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 14 Aug 2020 20:43:03 +0200 Subject: =?UTF-8?q?Desugar=20body=20into=20last=20argument=20=F0=9F=8D=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/test.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src/syntax/test.rs') diff --git a/src/syntax/test.rs b/src/syntax/test.rs index 2ea5dde3..97fecebc 100644 --- a/src/syntax/test.rs +++ b/src/syntax/test.rs @@ -3,10 +3,10 @@ use std::fmt::Debug; use crate::func::prelude::*; use super::decoration::Decoration; use super::expr::{Expr, Ident, NamedTuple, Object, Pair, Tuple}; -use super::parsing::{FuncArg, FuncArgs, FuncHeader}; +use super::parsing::{FuncArg, FuncArgs}; use super::span::Spanned; use super::tokens::Token; -use super::tree::{DynamicNode, SyntaxNode, SyntaxTree}; +use super::tree::{DynamicNode, SyntaxNode}; pub fn check(src: &str, exp: T, found: T, cmp_spans: bool) where @@ -58,19 +58,13 @@ macro_rules! span_item { }; } -pub fn debug_func(call: FuncCall, _: &ParseState) -> Pass { - let node = DebugNode { - header: call.header, - body: call.body.map(|s| s.v), - }; - Pass::node(node, Feedback::new()) +pub fn debug_func(mut call: FuncCall, _: &ParseState) -> Pass { + let tree = call.args.pos.get::(); + Pass::node(DebugNode(call, tree), Feedback::new()) } #[derive(Debug, Clone, PartialEq)] -pub struct DebugNode { - pub header: FuncHeader, - pub body: Option, -} +pub struct DebugNode(pub FuncCall, pub Option); #[async_trait(?Send)] impl Layout for DebugNode { @@ -102,12 +96,12 @@ impl SpanlessEq for SyntaxNode { impl SpanlessEq for DebugNode { fn spanless_eq(&self, other: &Self) -> bool { - self.header.spanless_eq(&other.header) - && self.body.spanless_eq(&other.body) + self.0.spanless_eq(&other.0) + && self.1.spanless_eq(&other.1) } } -impl SpanlessEq for FuncHeader { +impl SpanlessEq for FuncCall { fn spanless_eq(&self, other: &Self) -> bool { self.name.spanless_eq(&other.name) && self.args.spanless_eq(&other.args) -- cgit v1.2.3