Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (!members.length) {
return;
}
members.forEach(function(m) {
// x[y]
if (m.computed) {
args.push(m.property);
} else {
// x.y
args.push(t.stringLiteral(m.property.name));
}
});
let callArgs = [t.arrayExpression(args)];
if (parent.callee === node) {
callArgs.push(t.numericLiteral(1));
}
let newNode = t.callExpression(t.identifier(memberFn), callArgs);
newNode.callee.__rmlSkipped = 1;
// will process a.v of x.y[a.v]
path.replaceWith(newNode);
// path.skip();
}
}
};
t.switchCase(this.finalLoc, [
// Intentionally fall through to the "end" case...
]),
// So that the runtime can jump to the final location without having
// to know its offset, we provide the "end" case as a synonym.
t.switchCase(t.stringLiteral("end"), [
// This will check/clear both context.thrown and context.rval.
t.returnStatement(
t.callExpression(this.contextProperty("stop"), [])
)
])
);
return t.whileStatement(
t.numericLiteral(1),
t.switchStatement(
t.assignmentExpression(
"=",
this.contextProperty("prev"),
this.contextProperty("next")
),
cases
)
);
};
t.switchCase(this.finalLoc, [
// Intentionally fall through to the "end" case...
]),
// So that the runtime can jump to the final location without having
// to know its offset, we provide the "end" case as a synonym.
t.switchCase(t.stringLiteral("end"), [
// This will check/clear both context.thrown and context.rval.
t.returnStatement(
t.callExpression(this.contextProperty("stop"), [])
)
])
);
return t.whileStatement(
t.numericLiteral(1),
t.switchStatement(
t.assignmentExpression(
"=",
this.contextProperty("prev"),
this.contextProperty("next")
),
cases
)
);
};
function fromVal (val) {
if (isArray(val)) {
return fromArray(val); // eslint-disable-line no-use-before-define
} else if (isObject(val)) {
return fromObject(val); // eslint-disable-line no-use-before-define
} else if (isFunction(val)) {
return fromFunction(val); // eslint-disable-line no-use-before-define
} else if (isNumber(val)) {
return t.numericLiteral(val);
} else if (isString(val)) {
return t.stringLiteral(val);
}
throw new Error("Cannot transform value into AST.", val);
}
exit(path) {
const expr = t.unaryExpression(
'!',
t.unaryExpression(
'!',
t.binaryExpression(
'%',
path.get('expression').node,
t.numericLiteral(2)
)
)
);
expr.extra = { parenthesizedArgument: true };
path.replaceWithJS(expr);
},
},
selectedInput.selectionStart + (direction === 'LEFT' ? -1 : 1),
0,
selectedInput.value.length
))
) {
event.preventDefault();
return this.changeSelected((ast, selected) => ({
direction,
selected: navigate(direction, ast, selected)
}));
}
const enteredNumber = parseInt(event.key, 10);
if (isNullLiteral(selectedNode) && !isNaN(enteredNumber)) {
event.preventDefault();
return this.replace(numericLiteral(enteredNumber));
}
function findActionFor(keyMappings: KeyMapping[], event: any) {
for (const { mappings, name, keys, modifiers, test, type } of keyMappings) {
if (
(modifiers &&
(Array.isArray(modifiers)
? modifiers
: modifiers(selectedNode, selected)
).some(modifier => !event[modifier + 'Key'])) ||
(keys && keys.every(key => key !== event.key)) ||
(test && !test(selectedNode, selected))
) {
continue;
}
function loc() {
return t.numericLiteral(-1);
}
ExpressionStatement: function (path) {
if (isCPS(path.node)) return;
if (t.isFunctionExpression(path.node.expression)) return;
path.node.cps = true;
const k = path.scope.generateUidIdentifier('k');
const kCall = t.callExpression(k, [t.unaryExpression('void', t.numericLiteral(0))]);
kCall.cps = true;
const kReturn = t.returnStatement(kCall);
kReturn.cps = true;
const kBody = t.blockStatement([path.node, kReturn]);
kBody.cps = true;
const expFunction = t.functionExpression(null, [k], kBody);
expFunction.cps = true;
const newExp = t.expressionStatement(expFunction);
newExp.cps = true;
path.replaceWith(newExp);
},
MemberExpression(path, asset) {
if (path.scope.hasBinding('module') || path.scope.getData('shouldWrap')) {
return;
}
if (matchesPattern(path.node, 'module.exports')) {
path.replaceWith(getExportsIdentifier(asset));
asset.cacheData.isCommonJS = true;
}
if (matchesPattern(path.node, 'module.id')) {
path.replaceWith(t.numericLiteral(asset.id));
}
if (matchesPattern(path.node, 'module.hot')) {
path.replaceWith(t.identifier('null'));
}
if (matchesPattern(path.node, 'module.bundle')) {
path.replaceWith(t.identifier('require'));
}
},