Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 40 additions & 23 deletions apps/oxlint/src-js/generated/deserialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3243,30 +3243,37 @@ function deserializeNullLiteral(pos) {
}

function deserializeNumericLiteral(pos) {
let start, end;
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
__proto__: NodeProto,
type: "Literal",
value: deserializeF64(pos + 32),
raw: deserializeOptionStr(pos + 16),
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
raw:
uint32[(pos + 16) >> 2] === 0 && uint32[(pos + 20) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
range: [start, end],
parent,
};
}

function deserializeStringLiteral(pos) {
let start,
end,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
__proto__: NodeProto,
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
range: [start, end],
parent,
}),
Expand All @@ -3279,17 +3286,20 @@ function deserializeStringLiteral(pos) {
}

function deserializeBigIntLiteral(pos) {
let start,
end,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
__proto__: NodeProto,
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
bigint: null,
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
start,
end,
range: [start, end],
parent,
}),
Expand All @@ -3301,17 +3311,20 @@ function deserializeBigIntLiteral(pos) {
}

function deserializeRegExpLiteral(pos) {
let start,
end,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
__proto__: NodeProto,
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 48),
raw:
uint32[(pos + 48) >> 2] === 0 && uint32[(pos + 52) >> 2] === 0
? null
: sourceText.slice(start, end),
regex: null,
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
start,
end,
range: [start, end],
parent,
}),
Expand Down Expand Up @@ -3820,14 +3833,18 @@ function deserializeJSXSpreadChild(pos) {
}

function deserializeJSXText(pos) {
let start, end;
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
__proto__: NodeProto,
type: "JSXText",
value: deserializeStr(pos + 16),
raw: deserializeOptionStr(pos + 32),
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
range: [start, end],
parent,
};
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_ast/src/ast/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,5 +517,6 @@ pub struct JSXText<'a> {
///
/// `None` when this ast node is not constructed from the parser.
#[content_eq(skip)]
#[estree(from_span)]
pub raw: Option<Str<'a>>,
}
6 changes: 4 additions & 2 deletions crates/oxc_ast/src/ast/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct NumericLiteral<'a> {
///
/// `None` when this ast node is not constructed from the parser.
#[content_eq(skip)]
#[estree(json_safe)]
#[estree(json_safe, from_span)]
pub raw: Option<Str<'a>>,
/// The base representation used by the literal in source code
#[content_eq(skip)]
Expand Down Expand Up @@ -95,6 +95,7 @@ pub struct StringLiteral<'a> {
///
/// `None` when this ast node is not constructed from the parser.
#[content_eq(skip)]
#[estree(from_span)]
pub raw: Option<Str<'a>>,

/// The string value contains lone surrogates.
Expand Down Expand Up @@ -122,7 +123,7 @@ pub struct BigIntLiteral<'a> {
pub value: Str<'a>,
/// The bigint as it appears in source code
#[content_eq(skip)]
#[estree(json_safe)]
#[estree(json_safe, from_span)]
pub raw: Option<Str<'a>>,
/// The base representation used by the literal in source code
#[content_eq(skip)]
Expand Down Expand Up @@ -153,6 +154,7 @@ pub struct RegExpLiteral<'a> {
///
/// `None` when this ast node is not constructed from the parser.
#[content_eq(skip)]
#[estree(from_span)]
pub raw: Option<Str<'a>>,
}

Expand Down
61 changes: 43 additions & 18 deletions napi/parser/src-js/generated/deserialize/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2314,22 +2314,32 @@ function deserializeNullLiteral(pos) {
}

function deserializeNumericLiteral(pos) {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
type: "Literal",
value: deserializeF64(pos + 32),
raw: deserializeOptionStr(pos + 16),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 16) >> 2] === 0 && uint32[(pos + 20) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
};
}

function deserializeStringLiteral(pos) {
let node = {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
node = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
},
value = deserializeStr(pos + 16);
deserializeBool(pos + 12) &&
Expand All @@ -2339,13 +2349,18 @@ function deserializeStringLiteral(pos) {
}

function deserializeBigIntLiteral(pos) {
let node = {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
node = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
bigint: null,
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
start,
end,
},
bigint = deserializeStr(pos + 16);
node.value = BigInt(bigint);
Expand All @@ -2354,13 +2369,18 @@ function deserializeBigIntLiteral(pos) {
}

function deserializeRegExpLiteral(pos) {
let node = {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
node = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 48),
raw:
uint32[(pos + 48) >> 2] === 0 && uint32[(pos + 52) >> 2] === 0
? null
: sourceText.slice(start, end),
regex: null,
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
start,
end,
},
regex = deserializeRegExp(pos + 16),
value = null;
Expand Down Expand Up @@ -2767,12 +2787,17 @@ function deserializeJSXSpreadChild(pos) {
}

function deserializeJSXText(pos) {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
type: "JSXText",
value: deserializeStr(pos + 16),
raw: deserializeOptionStr(pos + 32),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
};
}

Expand Down
61 changes: 43 additions & 18 deletions napi/parser/src-js/generated/deserialize/js_parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2597,24 +2597,34 @@ function deserializeNullLiteral(pos) {
}

function deserializeNumericLiteral(pos) {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
type: "Literal",
value: deserializeF64(pos + 32),
raw: deserializeOptionStr(pos + 16),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 16) >> 2] === 0 && uint32[(pos + 20) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
parent,
};
}

function deserializeStringLiteral(pos) {
let previousParent = parent,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
parent,
}),
value = deserializeStr(pos + 16);
Expand All @@ -2626,14 +2636,19 @@ function deserializeStringLiteral(pos) {
}

function deserializeBigIntLiteral(pos) {
let previousParent = parent,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 32),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
bigint: null,
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
start,
end,
parent,
}),
bigint = deserializeStr(pos + 16);
Expand All @@ -2644,14 +2659,19 @@ function deserializeBigIntLiteral(pos) {
}

function deserializeRegExpLiteral(pos) {
let previousParent = parent,
let start = deserializeU32(pos),
end = deserializeU32(pos + 4),
previousParent = parent,
node = (parent = {
type: "Literal",
value: null,
raw: deserializeOptionStr(pos + 48),
raw:
uint32[(pos + 48) >> 2] === 0 && uint32[(pos + 52) >> 2] === 0
? null
: sourceText.slice(start, end),
regex: null,
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
start,
end,
parent,
}),
regex = deserializeRegExp(pos + 16),
Expand Down Expand Up @@ -3100,12 +3120,17 @@ function deserializeJSXSpreadChild(pos) {
}

function deserializeJSXText(pos) {
let start = deserializeU32(pos),
end = deserializeU32(pos + 4);
return {
type: "JSXText",
value: deserializeStr(pos + 16),
raw: deserializeOptionStr(pos + 32),
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
raw:
uint32[(pos + 32) >> 2] === 0 && uint32[(pos + 36) >> 2] === 0
? null
: sourceText.slice(start, end),
start,
end,
parent,
};
}
Expand Down
Loading
Loading