diff options
author | Ayke van Laethem <[email protected]> | 2023-03-24 00:23:03 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-09-23 09:41:44 +0100 |
commit | 37460ad60af2601a0412426c229663443c8d8eaa (patch) | |
tree | 0800550e161710c78f91fd8ffc5ef63aec60f59d /compiler/symbol.go | |
parent | dcca47f1f6088ea2565468e4a93a96e4308af480 (diff) | |
download | tinygo-37460ad60af2601a0412426c229663443c8d8eaa.tar.gz tinygo-37460ad60af2601a0412426c229663443c8d8eaa.zip |
compiler: support pragmas on generic functions
Diffstat (limited to 'compiler/symbol.go')
-rw-r--r-- | compiler/symbol.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/symbol.go b/compiler/symbol.go index 29f009520..32eb55107 100644 --- a/compiler/symbol.go +++ b/compiler/symbol.go @@ -250,10 +250,14 @@ func (c *compilerContext) getFunctionInfo(f *ssa.Function) functionInfo { // parsePragmas is used by getFunctionInfo to parse function pragmas such as // //export or //go:noinline. func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) { - if f.Syntax() == nil { + syntax := f.Syntax() + if f.Origin() != nil { + syntax = f.Origin().Syntax() + } + if syntax == nil { return } - if decl, ok := f.Syntax().(*ast.FuncDecl); ok && decl.Doc != nil { + if decl, ok := syntax.(*ast.FuncDecl); ok && decl.Doc != nil { for _, comment := range decl.Doc.List { text := comment.Text if strings.HasPrefix(text, "//export ") { |