From e55d15dfc9c8efa5b21683cf610cd3ddf7459a98 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 30 Mar 2021 10:18:13 +0200 Subject: [PATCH] :art: Improve dym --- src/parse/did_you_mean.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/parse/did_you_mean.c b/src/parse/did_you_mean.c index e2d4e784..63819fad 100644 --- a/src/parse/did_you_mean.c +++ b/src/parse/did_you_mean.c @@ -32,12 +32,10 @@ static m_bool wagner_fisher(const char *s, const char* t) { return (i && j && d[m-1][n-1] < MAX_DISTANCE); } -ANN static void ressembles(const Vector v, const Nspc nspc, const char* name, bool *const done) { +ANN static void ressembles(const Nspc nspc, const char* name, bool *const done) { struct scope_iter iter = { nspc->info->value, 0, 0 }; Value value; while(scope_iter(&iter, &value) > 0) { - if(vector_find(v, (vtype)value->name) > 0 &&!strcmp(name, value->name)) - continue; if(wagner_fisher(name, value->name)) { if(!*done) { *done = true; @@ -55,22 +53,15 @@ ANN static void ressembles(const Vector v, const Nspc nspc, const char* name, bo #undef did_you_mean_nspc ANN void did_you_mean_nspc(Nspc nspc, const char* name) { CHECK_LEN(name) - struct Vector_ v; - vector_init(&v); bool done; - do ressembles(&v, nspc, name, &done); + do ressembles(nspc, name, &done); while((nspc = nspc->parent)); - vector_release(&v); } #undef did_you_mean_type ANN void did_you_mean_type(Type type, const char* name) { CHECK_LEN(name) - Type t = type; - struct Vector_ v; - vector_init(&v); bool done; - do ressembles(&v, t->nspc, name, &done); - while((t = t->info->parent) && t->nspc); - vector_release(&v); + do ressembles(type->nspc, name, &done); + while((type = type->info->parent) && type->nspc); } -- 2.43.0