TODO: this currently produces a very conservative estimate.
We need to narrow down the conditions under which certain constructs
can return null (e.g., if(a, b, c) might return null for non-null a
only if b or c can be null.
760488
public static boolean mayReturnNullOnNonNullInput(Expression expression)
    {
        requireNonNull(expression, "expression is null");

        AtomicBoolean result = new AtomicBoolean(false);
        new Visitor().process(expression, result);
        return result.get();
    }
166601
function(vector) {
    var V = vector.elements || vector;
    var i, product = 0, n = this.elements.length;
    if (n != V.length) { return null; }
    do { product += this.elements[n-1] * V[n-1]; } while (--n);
    return product;
  }
1106981
private void closeStatement
        (CodeBuilder b, LocalVariable statementVar, Label tryAfterStatement)
    {
        Label contLabel = b.createLabel();
        Label endFinallyLabel = b.createLabel().setLocation();

        b.loadLocal(statementVar);
        b.invokeInterface(TypeDesc.forClass(Statement.class), "close", null, null);
        b.branch(contLabel);

        b.exceptionHandler(tryAfterStatement, endFinallyLabel, null);
        b.loadLocal(statementVar);
        b.invokeInterface(TypeDesc.forClass(Statement.class), "close", null, null);
        b.throwObject();

        contLabel.setLocation();
    }
318484
private void processIntegerReturn() {
        if ((sawConstant == null) && (stack.getStackDepth() == 0)) {
            throw new StopOpcodeParsingException();
        }

        Integer returnValue = null;
        if (sawConstant == null) {
            OpcodeStack.Item item = stack.getStackItem(0);
            returnValue = (Integer) item.getConstant();
        } else {
            returnValue = sawConstant;
        }

        if (returnValue == null) {
            throw new StopOpcodeParsingException();
        }
        int v = returnValue.intValue();
        if (v < 0) {
            seenNegative = true;
            if (getPC() > furthestBranchTarget) {
                seenUnconditionalNonZero = true;
            }
        } else if (v > 0) {
            seenPositive = true;
            if (getPC() > furthestBranchTarget) {
                seenUnconditionalNonZero = true;
            }
        } else {
            seenZero = true;
        }

        sawConstant = null;
    }
402742
T at(Integer i) {
        if (i == null) {
            return null;
        }
        if (i >= _array.size()) {
            return null;
        }
        return _array.get(i);
    }
1093382
def is_null_like(x):
    
    return x in [None, ""] or \
        (coll_like(x) and isinstance(x, Sized) and 0 == len(x))
1281317
function(a, b) {
            var c = this.instances[this.id];
            if (!c[a]) {
                if ( a.indexOf('>') > -1 ) {
                    var e = a.replace(/ /g, '').split('>');
                    for ( var i = 0; i < e.length; i++ ) {
                        if ( !c[e[i]] ) {
                            if (b) {
                                c[e[i]] = ( (i + 1) < e.length ) ? [] : b;
                            } else {
                                return null;
                            }
                        }
                        c = c[e[i]];
                    }
                    return c;
                } else if ( b && !c[a] ) {
                    this.set(a, b);
                }
            }
            return c[a];
        }
761691
private boolean constructorMayHaveBeenAddedByCompiler(ConstructorNode constructor) {
    Parameter[] params = constructor.getParameters();
    Statement firstStat = constructor.getFirstStatement();
    return AstUtil.isJointCompiled(spec.getAst()) && constructor.isPublic()
      && params != null && params.length == 0 && firstStat == null;
  }
14820
Expr ternary() {
		Expr cond = or();
		if (peek().sym == Sym.QUESTION) {
			move();
			Expr exprOne = expr();
			match(Sym.COLON);
			return new Ternary(cond, exprOne, expr(), location);
		}
		return cond;
	}
1251059
function getPrecedingConditional(node) {
      do {
          node = node.previousSibling;
      } while(node && node.nodeType !== 1 && node.nodeType !== 8);
      
      if (!node) { return; }
      
      if (node.nodeType === 8) {
          node = previousSibling(node);
      }
      
      return get(node, 'conditional');
  }
993557
public Optional<Nullness> getExprNullness(ExpressionTree exprTree) {
    InferenceVariable iv = TypeArgInferenceVar.create(ImmutableList.of(), exprTree);
    return constraintGraph.nodes().contains(iv) ? getNullness(iv) : Optional.empty();
  }
1125341
function determineIfIncluded(conn, earlier_unit, arrLaterUnits, handleResult){
	if (!earlier_unit)
		throw Error("no earlier_unit");
	if (storage.isGenesisUnit(earlier_unit))
		return handleResult(true);
	storage.readPropsOfUnits(conn, earlier_unit, arrLaterUnits, function(objEarlierUnitProps, arrLaterUnitProps){
		if (objEarlierUnitProps.is_free === 1)
			return handleResult(false);
		
		var max_later_limci = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.latest_included_mc_index; }));
		//console.log("max limci "+max_later_limci+", earlier mci "+objEarlierUnitProps.main_chain_index);
		if (objEarlierUnitProps.main_chain_index !== null && max_later_limci >= objEarlierUnitProps.main_chain_index)
			return handleResult(true);
		
		var max_later_level = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.level; }));
		if (max_later_level < objEarlierUnitProps.level)
			return handleResult(false);
		
		function goUp(arrStartUnits){
			//console.log('determine', earlier_unit, arrLaterUnits, arrStartUnits);
			conn.query(
				"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
				FROM parenthoods JOIN units ON parent_unit=unit \n\
				WHERE child_unit IN(?)",
				[arrStartUnits],
				function(rows){
					var arrNewStartUnits = [];
					for (var i=0; i<rows.length; i++){
						var objUnitProps = rows[i];
						if (objUnitProps.unit === earlier_unit)
							return handleResult(true);
						if (objUnitProps.is_on_main_chain === 0 && objUnitProps.level > objEarlierUnitProps.level)
							arrNewStartUnits.push(objUnitProps.unit);
					}
					(arrNewStartUnits.length > 0) ? goUp(_.uniq(arrNewStartUnits)) : handleResult(false);
				}
			);
		}
		
		goUp(arrLaterUnits);
	
	});
}
892970
function return_ (a, b) {
		var retvals = shine.gc.createArray(),
			val,
			i, l;

		if (b === 0) {
			l = this._register.getLength();
			
			for (i = a; i < l; i++) {
				retvals.push(this._register.getItem(i));
			}

		} else {
			for (i = 0; i < b - 1; i++) {
				retvals.push(val = this._register.getItem(a + i));
				shine.gc.incrRef(val);
			}
		}

		close.call(this, 0);
		
//		this._register.reset();
		this.dead = true;
		
		return retvals;
	}
1127426
private static ConstructorNode getMatchingConstructor(List<ConstructorNode> constructors, List<Expression> argumentList) {
        ConstructorNode lastMatch = null;
        for (int i=0; i<constructors.size(); i++) {
            ConstructorNode cn = constructors.get(i);
            Parameter[] params = cn.getParameters();
            // if number of parameters does not match we have no match
            if (argumentList.size()!=params.length) continue;
            if (lastMatch==null) {
                lastMatch = cn;
            } else {
                // we already had a match so we don't make a direct call at all
                return null;
            }
        }
        return lastMatch;
    }
65241
@SuppressWarnings("unchecked")
	private <T> T nullFor(DataType dataType)
	{
		switch(dataType)
		{
			case Long: return (T)Long.valueOf(-1);
			default: return null;
		}
	}
1334386
private boolean isNullable(ImmutableTerm term, ImmutableSet<Variable> nullableChildVariables) {
        if (term instanceof Constant)
            return term.equals(termFactory.getNullConstant());
        // TODO: improve this
        else if (term.isGround())
            return false;
        // TODO: improve this
        return term.getVariableStream()
                .anyMatch(nullableChildVariables::contains);
    }
409679
private static int minimum(int a, int b, int c) {
      int minValue;
      minValue = a;
      if (b < minValue) {
        minValue = b;
      }
      if (c < minValue) {
        minValue = c;
      }
      return minValue;
  }