How to use the estraverse.Syntax.Identifier function in estraverse

To help you get started, we’ve selected a few estraverse 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 probmods / webppl / src / transforms / caching.js View on Github external
function shouldCache(callee) {
  // Don't cache 'primitive' functions. It actually could be benficial to cache
  //    these in some cases, but correctly binding 'this' will require some
  //    systemic changes that I don't want to deal with right now.
  if (isPrimitive(callee))
    return false;
  // Don't cache ERPs or other coroutine functions that deal with ERPs.
  // Why do this? If the cache adaptation decides to remove one of these functions,
  //    then that function will have the same address as the ERP it's dealing with,
  //    so the adapter will also try to remove the ERP.
  // Basically, a core assumption of IncrementalMH is that all cache nodes have unique
  //    addresses.
  if (callee.type === Syntax.Identifier && cacheExempt[callee.name])
    return false;
  // Otherwise, go ahead
  return true;
}
github graalvm / graaljs / tools / eslint / node_modules / eslint-scope / lib / referencer.js View on Github external
CallExpression(node) {

        // Check this is direct call to eval
        if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") {

            // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
            // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
            this.currentScope().variableScope.__detectEval();
        }
        this.visitChildren(node);
    }
github power-assert-js / espower / lib / rules / to-be-skipped.js View on Github external
const isCallExpressionWithNonComputedMemberExpression = (currentNode, parentNode, currentKey) => {
  // Do not instrument non-computed property of MemberExpression within CallExpression.
  return currentNode.type === Syntax.Identifier && parentNode.type === Syntax.MemberExpression && !parentNode.computed && currentKey === 'property';
};
github angelozerr / tern.java / core / ternjs / node_modules / tern-eslint / node_modules / eslint / node_modules / escope / lib / referencer.js View on Github external
value: function CallExpression(node) {
                // Check this is direct call to eval
                if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") {
                    // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
                    // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
                    this.currentScope().variableScope.__detectEval();
                }
                this.visitChildren(node);
            }
        },
github graalvm / graaljs / tools / eslint / node_modules / eslint-scope / lib / scope.js View on Github external
__defineImplicit(node, def) {
        if (node && node.type === Syntax.Identifier) {
            this.__defineGeneric(
                    node.name,
                    this.implicit.set,
                    this.implicit.variables,
                    node,
                    def);
        }
    }
}
github xml3d / shade.js / src / generate / osl / registry / shade.js View on Github external
function createScaledClosure(color, closureName, node) {
        return {
            type: Syntax.BinaryExpression,
            operator: "*",
            left: {
                type: Syntax.CallExpression,
                callee: {
                    type: Syntax.Identifier,
                    name: "color"
                },
                arguments: [ color ]
            },
            right: {
                type: Syntax.CallExpression,
                callee: {
                    type: Syntax.Identifier,
                    name: closureName
                },
                arguments: node.arguments
            },
            extra: {
                type: Shade.TYPES.OBJECT,
                kind: Shade.OBJECT_KINDS.COLOR_CLOSURE
            }
github angelozerr / tern.java / core / ternjs / node_modules / tern-eslint / node_modules / eslint / node_modules / escope / src / pattern-visitor.js View on Github external
static isPattern(node) {
        var nodeType = node.type;
        return (
            nodeType === Syntax.Identifier ||
            nodeType === Syntax.ObjectPattern ||
            nodeType === Syntax.ArrayPattern ||
            nodeType === Syntax.SpreadElement ||
            nodeType === Syntax.RestElement ||
            nodeType === Syntax.AssignmentPattern
        );
    }
github xml3d / shade.js / src / generate / embree / registry / system.js View on Github external
var parameterName = Tools.getNameForSystem(SystemDefines.CANVAS_DIMENSIONS);
                state.usedParameters.system[parameterName] = state.systemParameters[SystemDefines.CANVAS_DIMENSIONS];

                return {
                    type: Syntax.NewExpression,
                    callee: {
                        type: Syntax.Identifier,
                        name: "Vec3"
                    },
                    arguments: [
                        {
                            type: Syntax.BinaryExpression,
                            left: {
                                type: Syntax.MemberExpression,
                                object: {
                                    type: Syntax.Identifier,
                                    name: "gl_FragCoord"
                                },
                                property: {
                                    type: Syntax.Identifier,
                                    name: "xyz"
                                }
                            },
                            right: {
                                type: Syntax.Identifier,
                                name: Tools.getNameForSystem(SystemDefines.CANVAS_DIMENSIONS)
                            },
                            operator: "/",
                            extra: {
                                type: Shade.TYPES.OBJECT,
                                kind: Shade.OBJECT_KINDS.FLOAT3
                            }
github xml3d / shade.js / src / type-system / scope.js View on Github external
createTypeInfo: function (node) {
        var result = new Annotation(node);
        if (node.type == Syntax.Identifier) {
            var name = node.name;
            var binding = this.getBindingByName(name);
            if (binding) {
                result.copy(binding);
                return binding;
            }
        }
        return result;
    },
github xml3d / shade.js / src / generate / embree / registry / system.js View on Github external
property: function (node, parent, context, state) {
                var parameterName = Tools.getNameForSystem(SystemDefines.CANVAS_DIMENSIONS);
                state.usedParameters.system[parameterName] = state.systemParameters[SystemDefines.CANVAS_DIMENSIONS];

                return {
                    type: Syntax.NewExpression,
                    callee: {
                        type: Syntax.Identifier,
                        name: "Vec3"
                    },
                    arguments: [
                        {
                            type: Syntax.BinaryExpression,
                            left: {
                                type: Syntax.MemberExpression,
                                object: {
                                    type: Syntax.Identifier,
                                    name: "gl_FragCoord"
                                },
                                property: {
                                    type: Syntax.Identifier,
                                    name: "xyz"
                                }
                            },