-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: disallow most types in //go:wasmimport
This is for compatibility with upstream Go. See golang/go#59149 for more context.
- Loading branch information
1 parent
503e4fa
commit 79a8291
Showing
4 changed files
with
101 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
package main | ||
|
||
import "unsafe" | ||
|
||
//go:wasmimport modulename empty | ||
func empty() | ||
|
||
// ERROR: can only use //go:wasmimport on declarations | ||
// | ||
//go:wasmimport modulename implementation | ||
func implementation() { | ||
} | ||
|
||
type Uint uint32 | ||
|
||
//go:wasmimport modulename validparam | ||
func validparam(a int32, b uint64, c float64, d unsafe.Pointer, e Uint) | ||
|
||
// ERROR: //go:wasmimport modulename invalidparam: unsupported parameter type int | ||
// ERROR: //go:wasmimport modulename invalidparam: unsupported parameter type string | ||
// ERROR: //go:wasmimport modulename invalidparam: unsupported parameter type []byte | ||
// ERROR: //go:wasmimport modulename invalidparam: unsupported parameter type *int32 | ||
// | ||
//go:wasmimport modulename invalidparam | ||
func invalidparam(a int, b string, c []byte, d *int32) | ||
|
||
//go:wasmimport modulename validreturn | ||
func validreturn() int32 | ||
|
||
// ERROR: //go:wasmimport modulename manyreturns: too many return values | ||
// | ||
//go:wasmimport modulename manyreturns | ||
func manyreturns() (int32, int32) | ||
|
||
// ERROR: //go:wasmimport modulename invalidreturn: unsupported result type int | ||
// | ||
//go:wasmimport modulename invalidreturn | ||
func invalidreturn() int | ||
|
||
// ERROR: //go:wasmimport modulename invalidUnsafePointerReturn: unsupported result type unsafe.Pointer | ||
// | ||
//go:wasmimport modulename invalidUnsafePointerReturn | ||
func invalidUnsafePointerReturn() unsafe.Pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters