Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xsmith
WebAssembly Sandbox
Commits
07fae1e5
Commit
07fae1e5
authored
Jun 08, 2020
by
Guy Watson
Browse files
Add 'number' super-type for when a non-specific but singular type is wanted
parent
674d8af0
Changes
1
Hide whitespace changes
Inline
Side-by-side
wasmlike/wasmlike.rkt
View file @
07fae1e5
...
...
@@ -226,18 +226,21 @@
(
+
1
depth
))))]
[
Func
(
λ
(
n
c
)
(
+
1
(
att-value
'nesting-level
(
ast-parent
n
))))])
;; Subtype group - use when all types are valid, but only ONE is wanted
;; Use with (fresh-subtype-of 'value)
(
define
number
(
base-type
'number
))
;; All the base types of WebAssembly
(
define
i32
(
base-type
'i32
))
(
define
i64
(
base-type
'i64
))
(
define
f32
(
base-type
'f32
))
(
define
f64
(
base-type
'f64
))
;; Larger groups
(
define
i32
(
base-type
'i32
number
))
(
define
i64
(
base-type
'i64
number
))
(
define
f32
(
base-type
'f32
number
))
(
define
f64
(
base-type
'f64
number
))
;; Larger groups
- use when ALL the contained types are valid
(
define
(
fresh-number
)
(
fresh-type-variable
i32
i64
f32
f64
))
(
define
(
fresh-int
)
(
fresh-type-variable
i32
i64
))
(
define
(
fresh-float
)
(
fresh-type-variable
f32
f64
))
(
define
(
no-child-types
)
(
λ
(
n
t
)
(
hash
)))
...
...
@@ -298,7 +301,7 @@
[
Comparison
[
i32
(
λ
(
n
t
)
;; The type of the children is unconstrained, they just have to be the same
(
define
child-type
(
number
))
(
define
child-type
(
fresh-subtype-of
'
number
))
(
hash
'l
child-type
'r
child-type
))]]
[
Testop
[
i32
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment