mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 21:21:10 +00:00
Improve: allow type declarations before variable definitions
This commit is contained in:
parent
ee04d96487
commit
b8e575ea99
3 changed files with 224 additions and 99 deletions
|
@ -403,7 +403,11 @@ impl Context {
|
|||
input: &Input,
|
||||
namespace: &Str,
|
||||
) -> SingleTyCheckResult<VarInfo> {
|
||||
if let Some(vi) = self.decls.get(&ident.inspect()[..]) {
|
||||
if let Some(vi) = self
|
||||
.decls
|
||||
.get(&ident.inspect()[..])
|
||||
.or_else(|| self.future_defined_locals.get(&ident.inspect()[..]))
|
||||
{
|
||||
match self.validate_visibility(ident, vi, input, namespace) {
|
||||
Ok(()) => {
|
||||
return Ok(vi.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue