MCPcopy Create free account
hub / github.com/brimdata/super / constructor

Method constructor

book/super-example/wasm_exec.js:104–477  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102
103 globalThis.Go = class {
104 constructor() {
105 this.argv = ["js"];
106 this.env = {};
107 this.exit = (code) => {
108 if (code !== 0) {
109 console.warn("exit code:", code);
110 }
111 };
112 this._exitPromise = new Promise((resolve) => {
113 this._resolveExitPromise = resolve;
114 });
115 this._pendingEvent = null;
116 this._scheduledTimeouts = new Map();
117 this._nextCallbackTimeoutID = 1;
118
119 const setInt64 = (addr, v) => {
120 this.mem.setUint32(addr + 0, v, true);
121 this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
122 }
123
124 const setInt32 = (addr, v) => {
125 this.mem.setUint32(addr + 0, v, true);
126 }
127
128 const getInt64 = (addr) => {
129 const low = this.mem.getUint32(addr + 0, true);
130 const high = this.mem.getInt32(addr + 4, true);
131 return low + high * 4294967296;
132 }
133
134 const loadValue = (addr) => {
135 const f = this.mem.getFloat64(addr, true);
136 if (f === 0) {
137 return undefined;
138 }
139 if (!isNaN(f)) {
140 return f;
141 }
142
143 const id = this.mem.getUint32(addr, true);
144 return this._values[id];
145 }
146
147 const storeValue = (addr, v) => {
148 const nanHead = 0x7FF80000;
149
150 if (typeof v === "number" && v !== 0) {
151 if (isNaN(v)) {
152 this.mem.setUint32(addr + 4, nanHead, true);
153 this.mem.setUint32(addr, 0, true);
154 return;
155 }
156 this.mem.setFloat64(addr, v, true);
157 return;
158 }
159
160 if (v === undefined) {
161 this.mem.setFloat64(addr, 0, true);

Callers

nothing calls this directly

Calls 8

parseIntFunction · 0.85
setInt32Method · 0.80
_resumeMethod · 0.80
deleteMethod · 0.80
pushMethod · 0.80
StringFunction · 0.50
applyMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected