How to use the traceur/src/codegeneration/ParseTreeFactory.createIdentifierExpression function in traceur

To help you get started, we’ve selected a few traceur 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 angular / angular / tools / transpiler / src / codegeneration / StrictEqualityTransformer.js View on Github external
transformBinaryExpression(tree) {
    tree.left = this.transformAny(tree.left);
    tree.right = this.transformAny(tree.right);

    if (tree.operator.type === EQUAL_EQUAL_EQUAL) {
      // `a === b` -> `identical(a, b)`
      return createCallExpression(createIdentifierExpression('identical'),
                                  createArgumentList([tree.left, tree.right]));
    }

    if (tree.operator.type === NOT_EQUAL_EQUAL) {
      // `a !== b` -> `!identical(a, b)`
      // TODO(vojta): do this in a cleaner way.
      return createCallExpression(createIdentifierExpression('!identical'),
                                  createArgumentList([tree.left, tree.right]));
    }

    return tree;
  }
}