Skip to content

Commit

Permalink
Merge pull request #11 from arhik/main
Browse files Browse the repository at this point in the history
capture simple function call in function statements
  • Loading branch information
arhik authored Mar 26, 2024
2 parents 3e538bf + b5dee97 commit 7684a6d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,20 @@ function wgslFunctionStatement(io, stmnt; indent=true, indentLevel=0)
if cond == true
wgslFunctionStatements(io, ifblock;indent=true, indentLevel=indentLevel)
end
# TODO this is incomplete
# TODO this is incomplete
elseif @capture(stmnt, f_(a__))
if a == []
if f == :synchronize
write(io, "workgroupBarrier();\n")
end
end
elseif @capture(stmnt, @forloop forLoop_)
@capture(forLoop, for idx_::idxType_ in range_ block__ end)
@capture(range, start_:step_:stop_)
#idxInit = @var Base.eval(:($idx::UInt32 = Meta.parse(wgslType(UInt32(r.start - 1)))))
#@infiltrate
idxExpr = :($idx::$idxType)
write(io, " "^(4*(indentLevel-1))*"for( var $(wgslType(idxExpr)) = $(start); $idx < $(stop); $(idx)++) { \n")
write(io, "for(var $(wgslType(idxExpr)) = $(start); $idx < $(stop); $(idx)++) { \n")
wgslFunctionStatements(io, block; indent=false, indentLevel=indentLevel)
write(io, " "^(4*indentLevel)*"}\n")
elseif @capture(stmnt, @escif if cond_ blocks__ end)
Expand Down

0 comments on commit 7684a6d

Please sign in to comment.