1. WebAssembly
  2. Reference
  3. WebAssembly-Variableninstruktionen
  4. local.tee

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

local.tee: Wasm-Textanweisung

Die local.tee-Anweisung setzt den Wert einer lokalen Variablen und lädt den Wert auf den Stack.

Die Anweisung ist nach dem T-Stück benannt, das in der Klempnerei verwendet wird.

Probieren Sie es aus

(module
 (import "console" "log" (func $log (param i32)))
 (func $main
 (local $var i32) ;; create a local variable named $var
 (i32.const 10) ;; load `10` onto the stack
 local.tee $var ;; set the $var to `10` and keep `10` on the stack
 call $log ;; log the top item on the stack (10)
 )
 (start $main)
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });

Syntax

wat
;; load the number 2 onto the stack
i32.const 2
;; store the number 2 in the variable $val and load it on the stack
local.tee $val
Anweisung Binärer Opcode
local.tee 0x22

Help improve MDN

Learn how to contribute Diese Seite wurde automatisch aus dem Englischen übersetzt.

AltStyle によって変換されたページ (->オリジナル) /