Skip to content

Commit b7e7d68

Browse files
committed
update generated files
1 parent d4fb317 commit b7e7d68

File tree

9 files changed

+55
-45
lines changed

9 files changed

+55
-45
lines changed

crates/parser-generator/src/parser_generator/lexer/generated.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,6 @@ pub fn get_keyword_map() -> HashMap<&'static str, &'static str> {
21192119
("json_arrayagg", "JSON_ARRAYAGG"),
21202120
("json_object", "JSON_OBJECT"),
21212121
("json_objectagg", "JSON_OBJECTAGG"),
2122-
("json_scalar", "JSON_SCALAR"),
2123-
("json_serialize", "JSON_SERIALIZE"),
21242122
("key", "KEY"),
21252123
("keys", "KEYS"),
21262124
("label", "LABEL"),

crates/postgresql-cst-parser/src/lexer/generated.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,6 @@ pub fn get_keyword_map() -> HashMap<&'static str, &'static str> {
21192119
("json_arrayagg", "JSON_ARRAYAGG"),
21202120
("json_object", "JSON_OBJECT"),
21212121
("json_objectagg", "JSON_OBJECTAGG"),
2122-
("json_scalar", "JSON_SCALAR"),
2123-
("json_serialize", "JSON_SERIALIZE"),
21242122
("key", "KEY"),
21252123
("keys", "KEYS"),
21262124
("label", "LABEL"),

demo/src/postgresql-cst-parser/postgresql_cst_parser_wasm.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
2222
* Instantiates the given `module`, which can either be bytes or
2323
* a precompiled `WebAssembly.Module`.
2424
*
25-
* @param {SyncInitInput} module
25+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
2626
*
2727
* @returns {InitOutput}
2828
*/
29-
export function initSync(module: SyncInitInput): InitOutput;
29+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
3030

3131
/**
3232
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
3333
* for everything else, calls `WebAssembly.instantiate` directly.
3434
*
35-
* @param {InitInput | Promise<InitInput>} module_or_path
35+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
3636
*
3737
* @returns {Promise<InitOutput>}
3838
*/
39-
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
39+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;

demo/src/postgresql-cst-parser/postgresql_cst_parser_wasm.js

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ let wasm;
22

33
let WASM_VECTOR_LEN = 0;
44

5-
let cachedUint8Memory0 = null;
5+
let cachedUint8ArrayMemory0 = null;
66

7-
function getUint8Memory0() {
8-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
9-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
7+
function getUint8ArrayMemory0() {
8+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1010
}
11-
return cachedUint8Memory0;
11+
return cachedUint8ArrayMemory0;
1212
}
1313

1414
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -31,15 +31,15 @@ function passStringToWasm0(arg, malloc, realloc) {
3131
if (realloc === undefined) {
3232
const buf = cachedTextEncoder.encode(arg);
3333
const ptr = malloc(buf.length, 1) >>> 0;
34-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
34+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
3535
WASM_VECTOR_LEN = buf.length;
3636
return ptr;
3737
}
3838

3939
let len = arg.length;
4040
let ptr = malloc(len, 1) >>> 0;
4141

42-
const mem = getUint8Memory0();
42+
const mem = getUint8ArrayMemory0();
4343

4444
let offset = 0;
4545

@@ -54,23 +54,24 @@ function passStringToWasm0(arg, malloc, realloc) {
5454
arg = arg.slice(offset);
5555
}
5656
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
57+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
5858
const ret = encodeString(arg, view);
5959

6060
offset += ret.written;
61+
ptr = realloc(ptr, len, offset, 1) >>> 0;
6162
}
6263

6364
WASM_VECTOR_LEN = offset;
6465
return ptr;
6566
}
6667

67-
let cachedInt32Memory0 = null;
68+
let cachedDataViewMemory0 = null;
6869

69-
function getInt32Memory0() {
70-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
71-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
70+
function getDataViewMemory0() {
71+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
7273
}
73-
return cachedInt32Memory0;
74+
return cachedDataViewMemory0;
7475
}
7576

7677
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
@@ -79,7 +80,7 @@ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
7980

8081
function getStringFromWasm0(ptr, len) {
8182
ptr = ptr >>> 0;
82-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
83+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
8384
}
8485
/**
8586
* @param {string} sql
@@ -93,8 +94,8 @@ export function parse_sql(sql) {
9394
const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
9495
const len0 = WASM_VECTOR_LEN;
9596
wasm.parse_sql(retptr, ptr0, len0);
96-
var r0 = getInt32Memory0()[retptr / 4 + 0];
97-
var r1 = getInt32Memory0()[retptr / 4 + 1];
97+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
98+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9899
deferred2_0 = r0;
99100
deferred2_1 = r1;
100101
return getStringFromWasm0(r0, r1);
@@ -142,15 +143,16 @@ function __wbg_get_imports() {
142143
return imports;
143144
}
144145

145-
function __wbg_init_memory(imports, maybe_memory) {
146+
function __wbg_init_memory(imports, memory) {
146147

147148
}
148149

149150
function __wbg_finalize_init(instance, module) {
150151
wasm = instance.exports;
151152
__wbg_init.__wbindgen_wasm_module = module;
152-
cachedInt32Memory0 = null;
153-
cachedUint8Memory0 = null;
153+
cachedDataViewMemory0 = null;
154+
cachedUint8ArrayMemory0 = null;
155+
154156

155157

156158
return wasm;
@@ -159,6 +161,12 @@ function __wbg_finalize_init(instance, module) {
159161
function initSync(module) {
160162
if (wasm !== undefined) return wasm;
161163

164+
165+
if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype)
166+
({module} = module)
167+
else
168+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
169+
162170
const imports = __wbg_get_imports();
163171

164172
__wbg_init_memory(imports);
@@ -172,24 +180,30 @@ function initSync(module) {
172180
return __wbg_finalize_init(instance, module);
173181
}
174182

175-
async function __wbg_init(input) {
183+
async function __wbg_init(module_or_path) {
176184
if (wasm !== undefined) return wasm;
177185

178-
if (typeof input === 'undefined') {
179-
input = new URL('postgresql_cst_parser_wasm_bg.wasm', import.meta.url);
186+
187+
if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype)
188+
({module_or_path} = module_or_path)
189+
else
190+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
191+
192+
if (typeof module_or_path === 'undefined') {
193+
module_or_path = new URL('postgresql_cst_parser_wasm_bg.wasm', import.meta.url);
180194
}
181195
const imports = __wbg_get_imports();
182196

183-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
184-
input = fetch(input);
197+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
198+
module_or_path = fetch(module_or_path);
185199
}
186200

187201
__wbg_init_memory(imports);
188202

189-
const { instance, module } = await __wbg_load(await input, imports);
203+
const { instance, module } = await __wbg_load(await module_or_path, imports);
190204

191205
return __wbg_finalize_init(instance, module);
192206
}
193207

194-
export { initSync }
208+
export { initSync };
195209
export default __wbg_init;
Binary file not shown.

0 commit comments

Comments
 (0)