How to use the lua-types.isIndexExpression function in lua-types

To help you get started, we’ve selected a few lua-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ark120202 / babel-lua / packages / lua-generator / src / node / parentheses.js View on Github external
function Binary(node, parent) {
  if (t.isCallExpression(parent) || (t.isIndexExpression(parent) && parent.identifier === node)) {
    return false;
  }
  if (t.isUnaryExpression(parent)) return true;

  if (t.isBinary(parent)) {
    const parentOp = parent.operator;
    // Unary was tested above
    const parentPos = PRECEDENCE[parentOp];

    let nodeOp = node.operator;
    // Prepend 'U' to differ unary operators
    if (t.isUnaryExpression(node)) nodeOp = `U${nodeOp}`;
    const nodePos = PRECEDENCE[nodeOp];

    if (
      (parentPos === nodePos &&
github ark120202 / babel-lua / packages / lua-generator / src / node / parentheses.js View on Github external
function Literal(node, parent) {
  return (t.isIndexExpression(parent) || t.isMemberExpression(parent)) && parent.base === node;
}