Returns the JavaScript statement to declare the scope declaration (eg. the list of
variables declared in the JavaScript function).
13200
CharSequence scopeDeclaration()
	{
		if (scopeVariables.length == 0)
		{
			return "";
		}
		StringBuilder scopeDeclaration = new StringBuilder();
		scopeDeclaration.append(scopeVariables[0]);
		for (int i = 1; i < scopeVariables.length; i++)
		{
			scopeDeclaration.append(", ");
			scopeDeclaration.append(scopeVariables[i]);
		}
		return scopeDeclaration;
	}
375960
function(node)
    {
      // declarations is an array of the comma-separated variable declarations like "var foo, zerp;"
      node.declarations.forEach(declaration =>
      {
        // id contains info about the variable being declare.
        var variable_name = declaration.id.name;
        // Skip if the variable is already whitelisted.
        if (variable_whitelist.indexOf(variable_name) > -1)
          return;

        // init contains info about the value being initialized to. It is null when the variable is
        // being declared without being initialized.
        // If initialization type is "CallExpression", that means that the variable is being
        // initialized to a function.
        // init.callee contains info about the function that the value is being initialized to,
        // undefined if it's not being initialized to a function, or at all.
        // So, this filters down into variables being initialized to the "require" function.
        if (declaration.init && declaration.init.type === `CallExpression` &&
        declaration.init.callee.name === `require`)
        {
          var module_name;
          // init.arguments is an array of the arguments being passed to the callee, undefinied if
          // the variable isn't being initialized to a function, or at all. Unlike the declarations,
          // we won't iterate over this because we only care about the first argument.
          if (declaration.init.arguments[0].type === `TemplateLiteral`)
            // The quasis array is a bit weird. Parsed template literals have them, and the number
            // of elements is equal to the number of placeholders, plus one for the non-placeholder
            // section. However, the values of the placeholder sections are always empty, so I'm
            // not sure what purpose they serve.
            // This takes the cooked non-placeholder portion as-is.
            module_name = declaration.init.arguments[0].quasis[0].value.cooked;
          else if (declaration.init.arguments[0].type === `Literal`)
            // Literals are easy. The value is right there.
            module_name = declaration.init.arguments[0].value;
          else
            // Something other than `, ', or "? ¯\_(ツ)_/¯
            return;
          // Detect if the module is being included via a path. This means that it is a part of the
          // project, and not from an external dependency. This means that it's alright to correct
          // the case in it.
          if (module_name.includes(`/`))
            variable_whitelist.push(variable_name);
        }
      });
    }
685113
function(context) {
      var varName,
          localVars = [];
      for (varName in context) {
        localVars.push('var ' + varName + ' = context.' + varName + ';');
      }
      return localVars.join('\n');
    }
183192
def function_declaration(self):
        
        self._process(Nature.DEF)

        identifier = Identifier(self.token.value)
        self._process(Nature.ID)

        parameters = self.parameters()
        return FunctionDeclaration(
            identifier=identifier, parameters=parameters, body=self.function_body()
        )
1200215
public static List<Expression> getVariableExpressions(DeclarationExpression declarationExpression) {
        Expression leftExpression = declarationExpression.getLeftExpression();

        // !important: performance enhancement
        if (leftExpression instanceof ArrayExpression) {
            List<Expression> expressions = ((ArrayExpression) leftExpression).getExpressions();
            return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;
        } else if (leftExpression instanceof ListExpression) {
            List<Expression> expressions = ((ListExpression) leftExpression).getExpressions();
            return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;
        } else if (leftExpression instanceof TupleExpression) {
            List<Expression> expressions = ((TupleExpression) leftExpression).getExpressions();
            return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;
        } else if (leftExpression instanceof VariableExpression) {
            return Arrays.asList(leftExpression);
        }
        // todo: write warning
        return Collections.emptyList();
    }
1318698
def VAR_DECL(self, cursor):
        """"""
        # get the name
        name = self.get_unique_name(cursor)
        log.debug('VAR_DECL: name: %s', name)
        # Check for a previous declaration in the register
        if self.is_registered(name):
            return self.get_registered(name)
        # get the typedesc object
        _type = self._VAR_DECL_type(cursor)
        # transform the ctypes values into ctypeslib
        init_value = self._VAR_DECL_value(cursor, _type)
        # finished
        log.debug('VAR_DECL: _type:%s', _type.name)
        log.debug('VAR_DECL: _init:%s', init_value)
        log.debug('VAR_DECL: location:%s', getattr(cursor, 'location'))
        obj = self.register(name, typedesc.Variable(name, _type, init_value))
        self.set_location(obj, cursor)
        self.set_comment(obj, cursor)
        return True
918524
function Scope(parent) {
  var map = Object.create(null);
  var api = {};
  api.markAsUsed = function(k) {
    if (typeof k !== "string") {
      throw new Error("Scope keys must be strings: " + k);
    }
    if (api.hasOwnVar(k)) {
      map[k].used = true;
      return api;
    }
    if (parent) {
      return parent.markAsUsed(k);
    }
    throw new Error("tried to use a variable before declaration: " + k);
  };
  api.ownUnusedVars = function() {
    return Object
      .keys(map)
      .filter(function(k) { return !map[k].used; })
      .map(function(k) { return map[k]; });
  };
  api.get = function(k) {
    if (api.hasOwnVar(k)) {
      return map[k];
    }
    if (parent) {
      return parent.get(k);
    }
    throw new Error("no such variable " + k);
  };
  api.declare = function(k, v) {
    // v.line :: number
    // v.column :: number
    // v.used :: boolean

    // Underscore is not a valid variable, so don't put it in the scope.
    if (k === "_") {
      return api;
    }
    v.name = k;
    // TODO: Unbreak the linter so I can use this check. Redeclaring a variable is not ok, but it's currently happening due to hoisting.
    // if (api.hasOwnVar(k)) {
    //     throw new Error("cannot redeclare variable " + k);
    // }
    if (api.hasOwnVar(k)) {
      v.used = api.get(k).used;
    }
    map[k] = v;
    return api;
  };
  api.hasVar = function(k) {
    if (api.hasOwnVar(k)) {
      return true;
    }
    if (parent) {
      return parent.hasVar(k);
    }
    return false;
  };
  api.hasOwnVar = function(k) {
    return {}.hasOwnProperty.call(map, k);
  };
  api.ownVars = function() {
    return Object.keys(map);
  };
  api.bareToString = function() {
    var innards = Object
      .keys(map)
      .map(function(k) {
        return k + ":" + (map[k].used ? "T" : "F");
      })
      .join(" ");
    var s = "{" + innards + "}";
    if (parent) {
      return parent.bareToString() + " > " + s;
    }
    return s;
  };
  api.toString = function() {
    return "#Scope[" + api.bareToString() + "]";
  };
  api.parent = parent;
  return Object.freeze(api);
}
1329754
function (parts, scope) {
      var o = scope !== undefined ? scope : Global;
      for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
        o = o[parts[i]];
      return o;
    }
988971
def get_source_var_declaration(self, var):
        
        return next((x.source_mapping for x in self.variables if x.name == var))
766066
function() {
      var scope = context.getScope();
      while (scope) {
        var node = scope.block;
        var isClass = node.type === 'ClassExpression';
        var isFunction = /Function/.test(node.type); // Functions
        var isMethod = node.parent && node.parent.type === 'MethodDefinition'; // Classes methods
        var isArgument = node.parent && node.parent.type === 'CallExpression'; // Arguments (callback, etc.)
        // Stop moving up if we reach a class or an argument (like a callback)
        if (isClass || isArgument) {
          return null;
        }
        // Return the node if it is a function that is not a class method
        if (isFunction && !isMethod) {
          return node;
        }
        scope = scope.upper;
      }
      return null;
    }
925264
function getDeclarationDeps($ast, declaration, scope) {
  if(scope !== SCOPE_EXPLICIT) {
    return {};
  }

  const depParentNodes = $ast(declaration).parents(node => {
    if(node.node.type === 'mixin') {
      return true;
    } else if(node.node.type === 'atrule') {
      const atruleIdentNode = $ast(node).children('atkeyword').children('ident');
      return atruleIdentNode.length() > 0 && atruleIdentNode.first().value() === 'function'
    } else {
      return false;
    }
  });

  if(depParentNodes.length() === 0) {
    return {};
  }

  const depParentNode = depParentNodes.last();
  const depKeywordNode = depParentNode.children('atkeyword').children('ident');

  if(depKeywordNode.length() === 0) {
    return {};
  }

  const atKeyword = depKeywordNode.first().value();

  if(!DEP_HOST[atKeyword]) {
    return {};
  }

  const depHostNode = DEP_HOST[atKeyword](depParentNode);
  const atKeywordIdentifierNode = depHostNode.children('ident');

  if(atKeywordIdentifierNode.length() === 0) {
    return {};
  }

  const atIdentifier = atKeywordIdentifierNode.first().value();
  const argumentsNode = depHostNode.children('arguments');

  // Count arguments to mixin/function @atrule
  const requiredArgsCount = argumentsNode.children('variable').length();
  const optionalArgsCount = argumentsNode.children('declaration').length();
  const totalArgsCount = requiredArgsCount + optionalArgsCount;

  if(!DEP_KEYWORDS[atKeyword]) {
    return {};
  }

  return {
    [DEP_KEYWORDS[atKeyword]]: {
      name: atIdentifier,
      argsCount: {
        total: totalArgsCount,
        required: requiredArgsCount,
        optional: optionalArgsCount,
      },
    },
  };
}
320748
public VariableRef[] getOutOfScopeVariableRefs() {
        Scope parent;
        if ((parent = getParent()) == null) {
            return new VariableRef[0];
        }

        Collection<VariableRef> allRefs = new ArrayList<VariableRef>();
        fillVariableRefs(allRefs, this);

        Collection<VariableRef> refs =
            new ArrayList<VariableRef>(allRefs.size());

        Iterator<VariableRef> it = allRefs.iterator();
        while (it.hasNext()) {
            VariableRef ref = it.next();
            Variable var = ref.getVariable();
            if (var != null &&
                parent.getDeclaredVariable(var.getName()) == var) {
                refs.add(ref);
            }
        }

        VariableRef[] refsArray = new VariableRef[refs.size()];
        return refs.toArray(refsArray);
    }
209597
def _get_code_w_scope(data, position, obj_end, opts, element_name):
    """"""
    code_end = position + _UNPACK_INT(data[position:position + 4])[0]
    code, position = _get_string(
        data, position + 4, code_end, opts, element_name)
    scope, position = _get_object(data, position, code_end, opts, element_name)
    if position != code_end:
        raise InvalidBSON('scope outside of javascript code boundaries')
    return Code(code, scope), position
1020116
function() {
    var OPERATORS =
        [[Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, 'BREAK'],
         [Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, 'CONTINUE']];
    this.setHelpUrl(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL);
    this.setColour(Blockly.Blocks.loops.HUE);
    this.appendDummyInput()
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'FLOW');
    this.setPreviousStatement(true);
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      var op = thisBlock.getFieldValue('FLOW');
      var TOOLTIPS = {
        'BREAK': Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,
        'CONTINUE': Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE
      };
      return TOOLTIPS[op];
    });
  }
906178
function parseConstLetDeclaration(kind) {
        var declarations;

        expectKeyword(kind);

        declarations = parseVariableDeclarationList(kind);

        consumeSemicolon();

        return {
            type: Syntax.VariableDeclaration,
            declarations: declarations,
            kind: kind
        };
    }
613586
function extractVars(path) {
    const declarators = [];

    if (path.isVariableDeclaration({ kind: "var" })) {
      for (const decl of path.node.declarations) {
        const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id));

        declarators.push(
          ...bindingIds.map(name => t.variableDeclarator(t.identifier(name)))
        );
      }
    } else {
      path.traverse({
        VariableDeclaration(varPath) {
          if (!varPath.isVariableDeclaration({ kind: "var" })) return;

          if (!isSameFunctionScope(varPath, path)) return;

          for (const decl of varPath.node.declarations) {
            const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id));
            declarators.push(
              ...bindingIds.map(name =>
                t.variableDeclarator(t.identifier(name))
              )
            );
          }
        }
      });
    }

    if (declarators.length <= 0) return [];

    return [t.variableDeclaration("var", declarators)];
  }
90472
private WyalFile.VariableDeclaration[] generatePostconditionTypePattern(WyilFile.Decl.FunctionOrMethod declaration,
			LocalEnvironment environment) {
		Tuple<Decl.Variable> params = declaration.getParameters();
		Tuple<Decl.Variable> returns = declaration.getReturns();
		WyalFile.VariableDeclaration[] vars = new WyalFile.VariableDeclaration[params.size() + returns.size()];
		// second, set initial environment
		for (int i = 0; i != params.size(); ++i) {
			WyilFile.Decl.Variable var = params.get(i);
			vars[i] = environment.read(var);
		}
		for (int i = 0; i != returns.size(); ++i) {
			WyilFile.Decl.Variable var = returns.get(i);
			vars[i + params.size()] = environment.read(var);
		}
		//
		return vars;
	}