File tree Expand file tree Collapse file tree 6 files changed +10
-11
lines changed
HydraScript.Application.CodeGeneration/Visitors
HydraScript.Application.StaticAnalysis/Visitors
Domain/HydraScript.Domain.FrontEnd/Parser/Impl/Ast/Nodes
Declarations/AfterTypesAreLoaded Expand file tree Collapse file tree 6 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,6 @@ public AddressedInstructions Visit(CallExpression visitable)
262262 return [ ] ;
263263
264264 var methodCall = ! visitable . Empty ( ) ;
265- string functionId ;
266265 AddressedInstructions result = [ ] ;
267266
268267 if ( methodCall )
@@ -271,12 +270,6 @@ public AddressedInstructions Visit(CallExpression visitable)
271270 var lastMemberInstruction = ( DotRead ) memberInstructions [ memberInstructions . End ] ;
272271 memberInstructions . Remove ( lastMemberInstruction ) ;
273272 result . AddRange ( memberInstructions ) ;
274-
275- functionId = lastMemberInstruction . Property ;
276- }
277- else
278- {
279- functionId = visitable . Id ;
280273 }
281274
282275 if ( methodCall )
@@ -298,7 +291,7 @@ public AddressedInstructions Visit(CallExpression visitable)
298291 }
299292
300293 result . Add ( new CallFunction (
301- new FunctionInfo ( functionId ) ,
294+ new FunctionInfo ( visitable . ComputedFunctionAddress ) ,
302295 visitable . HasReturnValue ) ) ;
303296
304297 return result ;
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ public AddressedInstructions Visit(FunctionDeclaration visitable)
118118 if ( ! visitable . Statements . Any ( ) )
119119 return [ ] ;
120120
121- var functionInfo = new FunctionInfo ( visitable . Name ) ;
121+ var functionInfo = new FunctionInfo ( visitable . ComputedFunctionAddress ) ;
122122
123123 var result = new AddressedInstructions
124124 {
Original file line number Diff line number Diff line change @@ -71,8 +71,9 @@ public VisitUnit Visit(FunctionDeclaration visitable)
7171 new VariableSymbol (
7272 name : x . Key ,
7373 x . TypeValue . Accept ( _typeBuilder ) ) ) . ToList ( ) ;
74- if ( _symbolTables [ visitable . Parent . Scope ] . ContainsSymbol (
75- new FunctionSymbolId ( visitable . Name , parameters . Select ( x => x . Type ) ) ) )
74+ var functionSymbolId = new FunctionSymbolId ( visitable . Name , parameters . Select ( x => x . Type ) ) ;
75+ visitable . ComputedFunctionAddress = functionSymbolId . ToString ( ) ;
76+ if ( _symbolTables [ visitable . Parent . Scope ] . ContainsSymbol ( functionSymbolId ) )
7677 throw new DeclarationAlreadyExists ( visitable . Name ) ;
7778
7879 for ( var i = 0 ; i < parameters . Count ; i ++ )
Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ public Type Visit(CallExpression visitable)
420420 ?? throw new UnknownIdentifierReference ( visitable . Id ) ;
421421 }
422422
423+ visitable . ComputedFunctionAddress = functionSymbol . Id . ToString ( ) ;
423424 visitable . IsEmptyCall = functionSymbol . IsEmpty ;
424425 var functionReturnType = functionSymbol . Type ;
425426
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ public partial class FunctionDeclaration : AfterTypesAreLoadedDeclaration
1717 public BlockStatement Statements { get ; }
1818 public bool IsEmpty => Statements . Count == 0 ;
1919
20+ public string ComputedFunctionAddress { get ; set ; } = default ! ;
21+
2022 public FunctionDeclaration (
2123 IdentifierReference name ,
2224 TypeValue returnTypeValue ,
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ public partial class CallExpression : LeftHandSideExpression
1616 public bool IsEmptyCall { get ; set ; }
1717 public bool HasReturnValue { get ; set ; }
1818
19+ public string ComputedFunctionAddress { get ; set ; } = default ! ;
20+
1921 public CallExpression ( MemberExpression member , IEnumerable < Expression > expressions )
2022 {
2123 Member = member ;
You can’t perform that action at this time.
0 commit comments