-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
56 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2023 l-m.dev. All rights reserved. | ||
// Use of this source code is governed by an MIT license | ||
// that can be found in the LICENSE file. | ||
module wasm | ||
|
||
import v.ast | ||
|
||
pub fn (mut g Gen) asm_template(parent ast.AsmStmt, node ast.AsmTemplate) { | ||
if node.is_label || node.is_directive { | ||
g.v_error("`asm wasm` doesn't support labels or directives", node.pos) | ||
} | ||
|
||
match node.name { | ||
'i32.const' { | ||
g.expr() | ||
eprintln(node) | ||
} | ||
else { | ||
g.v_error('unknown opcode', node.pos) | ||
} | ||
} | ||
} | ||
|
||
pub fn (mut g Gen) asm_stmt(node ast.AsmStmt) { | ||
for tmpl in node.templates { | ||
g.asm_template(node, tmpl) | ||
} | ||
} |
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
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