comparison dmd/scope.c @ 1640:9bf06e02070b

Merge DMD 1.057.
author Christian Kamm <kamm incasoftware de>
date Mon, 08 Mar 2010 21:39:20 +0100
parents def7a1d494fd
children
comparison
equal deleted inserted replaced
1639:41145d30acb8 1640:9bf06e02070b
1 1
2 // Copyright (c) 1999-2005 by Digital Mars 2 // Copyright (c) 1999-2010 by Digital Mars
3 // All Rights Reserved 3 // All Rights Reserved
4 // written by Walter Bright 4 // written by Walter Bright
5 // http://www.digitalmars.com 5 // http://www.digitalmars.com
6 // License for redistribution is by either the Artistic License 6 // License for redistribution is by either the Artistic License
7 // in artistic.txt, or the GNU General Public License in gnu.txt. 7 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 9
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <assert.h> 11 #include <assert.h>
12 12
13 #include "root.h" 13 #include "root.h"
14 #include "speller.h"
14 15
15 #include "mars.h" 16 #include "mars.h"
16 #include "init.h" 17 #include "init.h"
17 #include "identifier.h" 18 #include "identifier.h"
18 #include "attrib.h" 19 #include "attrib.h"
359 //assert(!sc->enclosing || sc != sc->enclosing->enclosing); 360 //assert(!sc->enclosing || sc != sc->enclosing->enclosing);
360 //if (++i == 10) 361 //if (++i == 10)
361 //assert(0); 362 //assert(0);
362 } 363 }
363 } 364 }
365
366
367 /************************************************
368 * Given the failed search attempt, try to find
369 * one with a close spelling.
370 */
371
372 void *scope_search_fp(void *arg, const char *seed)
373 {
374 //printf("scope_search_fp('%s')\n", seed);
375 Scope *sc = (Scope *)arg;
376 Identifier id(seed, 0);
377 Module::clearCache();
378 Dsymbol *s = sc->search(0, &id, NULL);
379 return s;
380 }
381
382 Dsymbol *Scope::search_correct(Identifier *ident)
383 {
384 if (global.gag)
385 return NULL; // don't do it for speculative compiles; too time consuming
386
387 return (Dsymbol *)speller(ident->toChars(), &scope_search_fp, this, idchars);
388 }