Created
December 21, 2019 16:12
-
-
Save AchalaSB/b6e45d04ada8f387831f54ce5dc79fee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| { | |
| "items": [ | |
| { | |
| "fn": { | |
| "attrs": [ | |
| { | |
| "style": "outer", | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "no_mangle" | |
| } | |
| ] | |
| } | |
| } | |
| ], | |
| "vis": "pub", | |
| "abi": {}, | |
| "ident": "sum", | |
| "inputs": [ | |
| { | |
| "typed": { | |
| "pat": { | |
| "ident": { | |
| "ident": "x" | |
| } | |
| }, | |
| "ty": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "u64" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "typed": { | |
| "pat": { | |
| "ident": { | |
| "ident": "y" | |
| } | |
| }, | |
| "ty": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "u64" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| ], | |
| "output": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "u64" | |
| } | |
| ] | |
| } | |
| }, | |
| "stmts": [ | |
| { | |
| "expr": { | |
| "binary": { | |
| "left": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "x" | |
| } | |
| ] | |
| } | |
| }, | |
| "op": "%", | |
| "right": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "y" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "fn": { | |
| "attrs": [ | |
| { | |
| "style": "outer", | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "no_mangle" | |
| } | |
| ] | |
| } | |
| } | |
| ], | |
| "vis": "pub", | |
| "abi": {}, | |
| "ident": "sum1", | |
| "inputs": [ | |
| { | |
| "typed": { | |
| "pat": { | |
| "ident": { | |
| "ident": "x" | |
| } | |
| }, | |
| "ty": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "f64" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "typed": { | |
| "pat": { | |
| "ident": { | |
| "ident": "y" | |
| } | |
| }, | |
| "ty": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "f64" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| ], | |
| "output": { | |
| "tuple": { | |
| "elems": [ | |
| { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "f64" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "f64" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "f64" | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| "stmts": [ | |
| { | |
| "expr": { | |
| "tuple": { | |
| "elems": [ | |
| { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "x" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "y" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "binary": { | |
| "left": { | |
| "binary": { | |
| "left": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "x" | |
| } | |
| ] | |
| } | |
| }, | |
| "op": "+", | |
| "right": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "y" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "op": "+", | |
| "right": { | |
| "path": { | |
| "segments": [ | |
| { | |
| "ident": "x" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "fn": { | |
| "ident": "main", | |
| "inputs": [], | |
| "output": null, | |
| "stmts": [] | |
| } | |
| } | |
| ] | |
| } |
This file contains hidden or 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
| // generated using https://mholt.github.io/json-to-go/ | |
| type AutoGenerated struct { | |
| Items []struct { | |
| Fn struct { | |
| Attrs []struct { | |
| Style string `json:"style"` | |
| Path struct { | |
| Segments []struct { | |
| Ident string `json:"ident"` | |
| } `json:"segments"` | |
| } `json:"path"` | |
| } `json:"attrs"` | |
| Vis string `json:"vis"` | |
| Abi struct { | |
| } `json:"abi"` | |
| Ident string `json:"ident"` | |
| Inputs []struct { | |
| Typed struct { | |
| Pat struct { | |
| Ident struct { | |
| Ident string `json:"ident"` | |
| } `json:"ident"` | |
| } `json:"pat"` | |
| Ty struct { | |
| Path struct { | |
| Segments []struct { | |
| Ident string `json:"ident"` | |
| } `json:"segments"` | |
| } `json:"path"` | |
| } `json:"ty"` | |
| } `json:"typed"` | |
| } `json:"inputs"` | |
| Output struct { | |
| Path struct { | |
| Segments []struct { | |
| Ident string `json:"ident"` | |
| } `json:"segments"` | |
| } `json:"path"` | |
| } `json:"output"` | |
| Stmts []struct { | |
| Expr struct { | |
| Binary struct { | |
| Left struct { | |
| Path struct { | |
| Segments []struct { | |
| Ident string `json:"ident"` | |
| } `json:"segments"` | |
| } `json:"path"` | |
| } `json:"left"` | |
| Op string `json:"op"` | |
| Right struct { | |
| Path struct { | |
| Segments []struct { | |
| Ident string `json:"ident"` | |
| } `json:"segments"` | |
| } `json:"path"` | |
| } `json:"right"` | |
| } `json:"binary"` | |
| } `json:"expr"` | |
| } `json:"stmts"` | |
| } `json:"fn,omitempty"` | |
| Fn struct { | |
| Ident string `json:"ident"` | |
| Inputs []interface{} `json:"inputs"` | |
| Output interface{} `json:"output"` | |
| Stmts []interface{} `json:"stmts"` | |
| } `json:"fn,omitempty"` | |
| } `json:"items"` | |
| } |
This file contains hidden or 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
| #[no_mangle] | |
| pub extern fn sum(x:u64, y:u64) -> u64 { | |
| x % y | |
| } | |
| #[no_mangle] | |
| pub extern fn sum1(x:f64, y:f64) -> (f64,f64,f64) { | |
| (x, y, x + y + x) | |
| } | |
| fn main(){ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment