Benign rust 238,457 installs Download

oxc_parser_napi 0.149.0

“A collection of JavaScript tools written in Rust.”

npm semver registry package nameRust builds heap Layout from computed size
SHA-25648a3af77c208130bc8e30a97e951c9596bc652a2d0bc0f564d131c40b7e2cd6d
MaleculeH(Mg)

Evidence

imports crate::AstType lines 1–33
1use std::{
2 alloc::Layout,
3 mem::{self, ManuallyDrop},
4 ptr::{self, NonNull},
5 str,
6};
7
8use napi::{
9 Task,
10 bindgen_prelude::{AsyncTask, Uint8Array},
11};
12use napi_derive::napi;
13
14use oxc::{
15 allocator::{Allocator, ArenaVec, FromIn},
16 ast_visit::utf8_to_utf16::Utf8ToUtf16,
17 semantic::SemanticBuilder,
18};
19#[cfg(feature = "tokens")]
20use oxc_estree_tokens::{ESTreeTokenOptions, update_tokens};
21use oxc_napi::get_source_type;
22
23use crate::{
24 AstType, ParserOptions, get_ast_type, parse_impl,
25 raw_transfer_constants::{ACTIVE_SIZE, BLOCK_ALIGN, BLOCK_SIZE, CURSOR_MIN_ALIGN},
26 raw_transfer_types::{EcmaScriptModule, Error, RawTransferData, RawTransferMetadata},
27};
28
29// For raw transfer, use a buffer 2 GiB in size, with 4 GiB alignment.
30// This ensures that all 64-bit pointers have the same value in upper 32 bits,
31// so JS only needs to read the lower 32 bits to get an offset into the buffer.
32//
33// Buffe …
English function-word token "and" lines 40–43
40:67… ft operator,
41// which is cheaper than `>>>`, and does not risk offsets being interpreted as negative.
42
43/// Layout describing the JS-owned buffer …
Rust builds heap Layout from computed size lines 43–49
43:62… , aligned on `BLOCK_ALIGN`).
44const BLOCK_LAYOUT: Layout = match Layout::from_size_align(BLOCK_SIZE, BLOCK_ALIGN) {
45 Ok(layout) => layout,
46 Err(_) => unreachable!(),
47};
48
49/// Get offset within a `Uint8Array` whic …
Result field or assignment key lines 176–181
176:10… solve(&mut self, _: napi::Env, _result: ()) -> napi::Result<()> {
177 Ok(())
178 }
179}
180
181/// Parse AST …
assert_eq! macro lines 200–206
200:8… Check buffer has expected size and alignment
201 assert_eq!(buffer.len(), BLOCK_SIZE);
202 let buffer_ptr = NonNull::from_mut(buffer).cast::<u8>();
203 assert!(buffer_ptr.addr().get().is_multiple_of(BLOCK_ALIGN));
204
205 const _: () = {
206 assert!(BLOCK_SIZE.is_multiple_of(A …

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.