Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var oldBufferLength = state.uint8Buffer.length;
state.uint8Buffer = resizeSectionVecSize(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
}
/**
* Resize section byte size.
* If the length of the LEB-encoded size changes, this can change
* the offset for nodes in the section. So we do this before
* shifting following operations' nodes.
*/
if (state.deltaBytes !== 0 && sectionName !== "start") {
var _oldBufferLength = state.uint8Buffer.length;
state.uint8Buffer = resizeSectionByteSize(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - _oldBufferLength;
}
/**
* Shift following operation's nodes
*/
if (state.deltaBytes !== 0) {
ops.forEach(function (op) {
// We don't need to handle add ops, they are positioning independent
switch (op.kind) {
case "update":
shiftLocNodeByDelta(op.oldNode, state.deltaBytes);
break;
var oldBufferLength = state.uint8Buffer.length;
state.uint8Buffer = resizeSectionVecSize(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
}
/**
* Resize section byte size.
* If the length of the LEB-encoded size changes, this can change
* the offset for nodes in the section. So we do this before
* shifting following operations' nodes.
*/
if (state.deltaBytes !== 0 && sectionName !== "start") {
var _oldBufferLength = state.uint8Buffer.length;
state.uint8Buffer = resizeSectionByteSize(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - _oldBufferLength;
}
/**
* Shift following operation's nodes
*/
if (state.deltaBytes !== 0) {
ops.forEach(function (op) {
// We don't need to handle add ops, they are positioning independent
switch (op.kind) {
case "update":
shiftLocNodeByDelta(op.oldNode, state.deltaBytes);
break;
sectionName,
state.deltaElements
);
// Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
}
/**
* Resize section byte size.
* If the length of the LEB-encoded size changes, this can change
* the offset for nodes in the section. So we do this before
* shifting following operations' nodes.
*/
if (state.deltaBytes !== 0 && sectionName !== "start") {
const oldBufferLength = state.uint8Buffer.length;
state.uint8Buffer = resizeSectionByteSize(
ast,
state.uint8Buffer,
sectionName,
state.deltaBytes
);
// Infer bytes added/removed by comparing buffer lengths
state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
}
/**
* Shift following operation's nodes
*/
if (state.deltaBytes !== 0) {
ops.forEach(op => {
// We don't need to handle add ops, they are positioning independent
switch (op.kind) {
*/
if (state.deltaBytes !== 0) {
ops.forEach(op => {
switch (op.kind) {
case "update":
shiftLocNodeByDelta(op.oldNode, state.deltaBytes);
break;
case "delete":
shiftLocNodeByDelta(op.node, state.deltaBytes);
break;
}
});
if (sectionName !== "start") {
state.uint8Buffer = resizeSectionByteSize(
ast,
state.uint8Buffer,
sectionName,
state.deltaBytes
);
}
}
if (state.deltaElements !== 0 && sectionName !== "start") {
state.uint8Buffer = resizeSectionVecSize(
ast,
state.uint8Buffer,
sectionName,
state.deltaElements
);
}