Mercurial > projects > dil
diff src/dil/semantic/Scope.d @ 838:1ecf05e680ba
Changed build configuration.
From now on, the executable will be placed in bin/.
The postbuild.* scripts for Linux and Windows will place important files in
bin/ and bin/data/.
Added hasType() to class Expression.
Added search() to class Scope.
Added DontKnowYet to struct Types.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 20 Aug 2008 20:39:16 +0200 |
parents | bcb74c9b895c |
children |
line wrap: on
line diff
--- a/src/dil/semantic/Scope.d Thu Aug 14 03:14:43 2008 +0200 +++ b/src/dil/semantic/Scope.d Wed Aug 20 20:39:16 2008 +0200 @@ -30,6 +30,21 @@ return symbol.lookup(name); } + /// Searches for a symbol in this scope and all enclosing scopes. + /// Params: + /// name = the name of the symbol. + Symbol search(Identifier* name) + { + Symbol symbol; + for (auto sc = this; sc; sc = sc.parent) + { + symbol = sc.lookup(name); + if (symbol !is null) + break; + } + return symbol; + } + /// Create a new inner scope and return that. Scope enter(ScopeSymbol symbol) {