Skip to content

Commit

Permalink
FIX bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed May 28, 2024
1 parent c674035 commit 9a17bbe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private void ResolveIndex(UnResolved unResolved)
if (ty is LuaNamedType namedType)
{
Compilation.Db.AddMember(documentId, namedType.Name, declaration);
Context.ClearMemberCache(namedType.Name);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions EmmyLua/CodeAnalysis/Compilation/Infer/SearchContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void ClearCache()
DeclarationCaches.Clear();
}

public void ClearMemberCache(string name)
{
NamedTypeMemberCaches.Remove(name);
BaseMemberCaches.Remove(name);
}

private LuaType InferCore(LuaSyntaxElement element)
{
if (_currentDepth > MaxDepth)
Expand Down
6 changes: 5 additions & 1 deletion EmmyLua/CodeAnalysis/Compile/Grammar/Lua/Expression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ public static CompleteMarker ClosureExpr(LuaParser p)

if (ParamList(p).IsComplete)
{
BlockParser.Block(p);
if (p.Current is not LuaTokenKind.TkEnd)
{
BlockParser.Block(p);
}

p.Expect(LuaTokenKind.TkEnd);
}

Expand Down

0 comments on commit 9a17bbe

Please sign in to comment.