File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
src/Application/HydraScript.Application.StaticAnalysis Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ public class AmbiguousInvocation(
99 IReadOnlyCollection < FunctionSymbolId > candidates ) :
1010 SemanticException (
1111 segment ,
12- $ "Candidates are:\n { string . Join ( '\n ' , candidates ) } ") ;
12+ $ "Ambiguous Invocation - Candidates are:\n { string . Join ( '\n ' , candidates ) } ") ;
Original file line number Diff line number Diff line change @@ -90,8 +90,16 @@ public VisitUnit Visit(FunctionDeclaration visitable)
9090 x . TypeValue . Accept ( _typeBuilder ) ) ) . ToList ( ) ;
9191 var functionSymbolId = new FunctionSymbolId ( visitable . Name , parameters . Select ( x => x . Type ) ) ;
9292 visitable . ComputedFunctionAddress = functionSymbolId . ToString ( ) ;
93+ var functionSymbol = new FunctionSymbol (
94+ visitable . Name ,
95+ parameters ,
96+ visitable . ReturnTypeValue . Accept ( _typeBuilder ) ,
97+ visitable . IsEmpty ) ;
9398 if ( parentTable . ContainsSymbol ( functionSymbolId ) )
94- throw new OverloadAlreadyExists ( visitable . Name , functionSymbolId ) ;
99+ {
100+ if ( ! ( parentTable . FindSymbol ( functionSymbolId ) ! > functionSymbol ) )
101+ throw new OverloadAlreadyExists ( visitable . Name , functionSymbolId ) ;
102+ }
95103
96104 for ( var i = 0 ; i < parameters . Count ; i ++ )
97105 {
@@ -100,11 +108,6 @@ public VisitUnit Visit(FunctionDeclaration visitable)
100108 _symbolTables [ visitable . Scope ] . AddSymbol ( arg ) ;
101109 }
102110
103- var functionSymbol = new FunctionSymbol (
104- visitable . Name ,
105- parameters ,
106- visitable . ReturnTypeValue . Accept ( _typeBuilder ) ,
107- visitable . IsEmpty ) ;
108111 if ( parameters is [ { Type : ObjectType objectType } , ..] &&
109112 visitable . Arguments is [ { TypeValue : TypeIdentValue } , ..] )
110113 {
You can’t perform that action at this time.
0 commit comments