From ec249fc7592d5d6055ee9e1e45fc6cceb759164c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 24 Oct 2019 14:50:44 +0100 Subject: [PATCH] Reorganise analysis --- src/skeleton.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/skeleton.rs b/src/skeleton.rs index cb9852d..52f14f0 100644 --- a/src/skeleton.rs +++ b/src/skeleton.rs @@ -490,23 +490,6 @@ pub struct Analyzer { } impl Analyzer { - pub fn analyze(a: &Assertion) -> AnalysisResults { - let mut z = Analyzer { - const_paths: Vec::new(), - const_vals: Vec::new(), - capture_paths: Vec::new(), - path: Vec::new(), - }; - let skeleton = z.walk(a); - AnalysisResults { - skeleton, - const_paths: z.const_paths, - const_vals: Arc::new(z.const_vals), - capture_paths: z.capture_paths, - assertion: a.clone(), - } - } - fn walk(&mut self, mut a: &Assertion) -> Skeleton { while let Some(fields) = a.value().as_simple_record("Capture", Some(1)) { self.capture_paths.push(self.path.clone()); @@ -537,6 +520,23 @@ impl Analyzer { } } +pub fn analyze(a: &Assertion) -> AnalysisResults { + let mut z = Analyzer { + const_paths: Vec::new(), + const_vals: Vec::new(), + capture_paths: Vec::new(), + path: Vec::new(), + }; + let skeleton = z.walk(a); + AnalysisResults { + skeleton, + const_paths: z.const_paths, + const_vals: Arc::new(z.const_vals), + capture_paths: z.capture_paths, + assertion: a.clone(), + } +} + pub fn instantiate_assertion(a: &Assertion, cs: Captures) -> CachedAssertion { let mut capture_paths = Vec::new(); let mut path = Vec::new();