Skip to content

Commit

Permalink
Fix returning ptr types from functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Dec 5, 2023
1 parent 8f72574 commit 8647cba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lua/wire/client/hlzasm/hc_syntax.lua
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,24 @@ function HCOMP:DefineVariable(isFunctionParam,isForwardDecl,isRegisterDecl,isStr
self:PreviousToken() -- LPAREN
self:PreviousToken() -- Func Name
self:PreviousToken() -- Type Name
local ptrlevel = 0
if self:MatchToken(TOKEN.TIMES) then
-- skip back until we're done with the ptr
self:PreviousToken()
while self:MatchToken(TOKEN.TIMES) do
ptrlevel = ptrlevel + 1;
self:PreviousToken()
self:PreviousToken()
end
end
if not self:MatchToken(TOKEN.IDENT) then
self:MatchToken(TOKEN.TYPE) -- If it's not an IDENT (struct/user defined) it should be a generic type
end
local returnType = self.TokenData
self.CurrentToken = self.CurrentToken + ptrlevel -- return to present.
self:MatchToken(TOKEN.IDENT)
local funcName = self.TokenData
self.CurFunction = {Name = funcName, ReturnType = returnType}
self.CurFunction = {Name = funcName, ReturnType = returnType, ReturnPtrLevel = ptrlevel}
self:NextToken()
label.Type = "Pointer"
label.Defined = true
Expand Down

0 comments on commit 8647cba

Please sign in to comment.