Type checks a AElseIf node

@param elseIfNode
@param elseIfLocation
@param test
@param thenNode
@param question
@return
@throws AnalysisException
481148
PType typeCheckAElseIf(INode elseIfNode, ILexLocation elseIfLocation,
			INode test, INode thenNode, TypeCheckInfo question)
			throws AnalysisException
	{
		if (!question.assistantFactory.createPTypeAssistant().isType(test.apply(THIS, question.newConstraint(null)), ABooleanBasicType.class))
		{
			boolean isExpression = elseIfNode.parent() instanceof PExp;
			TypeCheckerErrors.report((isExpression ? 3086 : 3218), "Expression is not boolean", elseIfLocation, elseIfNode);
		}

		List<QualifiedDefinition> qualified = test.apply(question.assistantFactory.getQualificationVisitor(), question);

		for (QualifiedDefinition qdef : qualified)
		{
			qdef.qualifyType();
		}

		PType type = thenNode.apply(THIS, question);

		for (QualifiedDefinition qdef : qualified)
		{
			qdef.resetType();
		}

		return type;
	}
358158
@Override
	public PExp caseAExistsExp(AExistsExp node, Substitution question)
			throws AnalysisException
	{
		PExp sub = node.getPredicate().clone().apply(main, question);
		node.setPredicate(sub.clone());
		return node;

	}
1194369
@Override
    public StoreDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
        MethodGen methodGen = getMethodGen(analysisCache, descriptor);
        if (methodGen == null) {
            return null;
        }
        StoreAnalysis analysis = new StoreAnalysis(getDepthFirstSearch(analysisCache, descriptor), getConstantPoolGen(
                analysisCache, descriptor.getClassDescriptor()));
        StoreDataflow dataflow = new StoreDataflow(getCFG(analysisCache, descriptor), analysis);
        dataflow.execute();
        return dataflow;
    }
670734
function(node, touchingIsIntersecting) {
                assertRangeValid(this);
                assertNode(node, "NOT_FOUND_ERR");
                if (getDocument(node) !== getRangeDocument(this)) {
                    return false;
                }

                var parent = node.parentNode, offset = getNodeIndex(node);
                assertNode(parent, "NOT_FOUND_ERR");

                var startComparison = comparePoints(parent, offset, this.endContainer, this.endOffset),
                    endComparison = comparePoints(parent, offset + 1, this.startContainer, this.startOffset);

                return touchingIsIntersecting ? startComparison <= 0 && endComparison >= 0 : startComparison < 0 && endComparison > 0;
            }
964844
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
        Type type = node.getType();
        if (node instanceof MethodDeclaration && ("newBufferAndOffset".equals(name) || "nextArrayOffset".equals(name))) {
            node.setType(PrimitiveType.intType());
        } else if (PrimitiveType.longType().equals(type)) {
            switch(name) {
            case "offset":
            case "offsetInNew":
            case "offsetInOld":
            case "lookAheadElementOffset":
                node.setType(PrimitiveType.intType());
            }
        } else if (isRefType(type, "LinkedQueueNode")) {
            node.setType(simpleParametricType("LinkedQueueAtomicNode", "E"));
        } else if (isRefArray(type, "E")) {
            node.setType(atomicRefArrayType((ArrayType) type));
        }
    }
1279468
private int inOrderAnalyse(StructuralNode node) {
        int subtreeNodes = 0;

        if (isStop) {
            return 0;
        }

        if (node == null) {
            return 0;
        }

        // analyse entity if not root and not leaf.
        // Leaf is not analysed because only folder entity is used to determine if path exist.
        try {
            if (!node.isRoot()) {
                if (!node.isLeaf() || node.isLeaf() && node.getParent().isRoot()) {
                    analyse(node);
                    
                } else {
                    //ZAP: it's a Leaf then no children are available
                    return 1;
                }
            }
            
        } catch (Exception e) {
        }

        Iterator<StructuralNode> iter = node.getChildIterator();
        while (iter.hasNext()) {
            subtreeNodes += inOrderAnalyse(iter.next());
        }
        
        return subtreeNodes + 1;
    }
233712
static <K extends Comparable<K>> void checkNode(Node<K> node) {
        node.checkNode(null, null);
    }
764408
@Override
  protected void visitIfNode(IfNode node) {
    // Create another instance of this visitor for generating Python expressions from children.
    GenPyExprsVisitor genPyExprsVisitor =
        genPyExprsVisitorFactory.create(localVarExprs, errorReporter);
    TranslateToPyExprVisitor translator =
        new TranslateToPyExprVisitor(localVarExprs, pluginValueFactory, errorReporter);

    StringBuilder pyExprTextSb = new StringBuilder();

    boolean hasElse = false;
    // We need to be careful about parenthesizing the sub-expressions in a python ternary operator,
    // as nested ternary operators will right-associate. Due to the structure of the parse tree,
    // we accumulate open parens in the loop below, and pendingParens tracks how many closing parens
    // we need to add at the end.
    int pendingParens = 0;
    for (SoyNode child : node.getChildren()) {

      if (child instanceof IfCondNode) {
        IfCondNode icn = (IfCondNode) child;

        // Python ternary conditional expressions modify the order of the conditional from
        // <conditional> ? <true> : <false> to
        // <true> if <conditional> else <false>
        PyExpr condBlock = PyExprUtils.concatPyExprs(genPyExprsVisitor.exec(icn)).toPyString();
        condBlock =
            PyExprUtils.maybeProtect(
                condBlock, PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL));
        pyExprTextSb.append("(").append(condBlock.getText());

        // Append the conditional and if/else syntax.
        PyExpr condPyExpr = translator.exec(icn.getExpr());
        pyExprTextSb.append(") if (").append(condPyExpr.getText()).append(") else (");
        pendingParens++;

      } else if (child instanceof IfElseNode) {
        hasElse = true;
        IfElseNode ien = (IfElseNode) child;

        PyExpr elseBlock = PyExprUtils.concatPyExprs(genPyExprsVisitor.exec(ien)).toPyString();
        pyExprTextSb.append(elseBlock.getText()).append(")");
        pendingParens--;
      } else {
        throw new AssertionError("Unexpected if child node type. Child: " + child);
      }
    }

    if (!hasElse) {
      pyExprTextSb.append("''");
    }
    for (int i = 0; i < pendingParens; i++) {
      pyExprTextSb.append(")");
    }

    // By their nature, inline'd conditionals can only contain output strings, so they can be
    // treated as a string type with a conditional precedence.
    pyExprs.add(
        new PyStringExpr(
            pyExprTextSb.toString(), PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL)));
  }
1018705
@Override protected void visitIfNode(IfNode node) {

    // Create another instance of this visitor class for generating JS expressions from children.
    GenJsExprsVisitor genJsExprsVisitor =
        genJsExprsVisitorFactory.create(translationContext, templateAliases, errorReporter);
    CodeChunk.Generator generator = translationContext.codeGenerator();

    List<Expression> ifs = new ArrayList<>();
    List<Expression> thens = new ArrayList<>();
    Expression trailingElse = null;

    for (SoyNode child : node.getChildren()) {

      if (child instanceof IfCondNode) {
        IfCondNode ifCond = (IfCondNode) child;

        ifs.add(translateExpr(ifCond.getExpr()));
        thens.add(CodeChunkUtils.concatChunks(genJsExprsVisitor.exec(ifCond)));
      } else if (child instanceof IfElseNode) {
        trailingElse = CodeChunkUtils.concatChunks(genJsExprsVisitor.exec(child));
      } else {
        throw new AssertionError();
      }
    }

    Preconditions.checkState(ifs.size() == thens.size());

    ConditionalExpressionBuilder builder = Expression.ifExpression(ifs.get(0), thens.get(0));

    for (int i = 1; i < ifs.size(); i++) {
      builder.addElseIf(ifs.get(i), thens.get(i));
    }

    Expression ifChunk =
        trailingElse != null
            ? builder.setElse(trailingElse).build(generator)
            : builder.setElse(LITERAL_EMPTY_STRING).build(generator);

    chunks.add(ifChunk);
  }
438540
function isLocalCall (node) {
  return nodeType(node, exactMatch(nodeTypes.FUNCTIONCALL)) &&
        minNrOfChildren(node, 1) &&
        nodeType(node.children[0], exactMatch(nodeTypes.IDENTIFIER)) &&
        expressionType(node.children[0], basicRegex.FUNCTIONTYPE) &&
        !expressionType(node.children[0], basicRegex.EXTERNALFUNCTIONTYPE) &&
        nrOfChildren(node.children[0], 0)
}
676612
private void visit(
      HtmlMatcherConditionNode condNode,
      Map<Equivalence.Wrapper<ExprNode>, Boolean> exprValueMap,
      HtmlStack stack) {
    Equivalence.Wrapper<ExprNode> condition = ExprEquivalence.get().wrap(condNode.getExpression());
    // In some cases we may encounter a condition we have already made a decision for. Consider
    // this case:
    // <pre>@code {
    //    {if $foo}<div>{/if}
    //    {if $foo}</div>{/if}
    // }</pre>
    // In this case, it is unnecessary once we have decided that $foo is TRUE to traverse the
    // branch where $foo is FALSE. We save the original state of the value and use it below
    // to decide if we should take a branch.
    Boolean originalState = exprValueMap.getOrDefault(condition, null);

    Optional<HtmlMatcherGraphNode> nextNode = condNode.getNodeForEdgeKind(EdgeKind.TRUE_EDGE);
    Optional<HtmlMatcherGraphNode> nextAltNode = condNode.getNodeForEdgeKind(EdgeKind.FALSE_EDGE);
    if (!condNode.isInternallyBalanced(stack.inForeignContent, idGenerator)
        && nextNode.isPresent()
        && !Boolean.FALSE.equals(originalState)) {
      Map<Equivalence.Wrapper<ExprNode>, Boolean> lMap = new HashMap<>(exprValueMap);
      lMap.put(condition, true);
      visit(nextNode.get(), lMap, stack);
    }

    if (nextAltNode.isPresent() && !Boolean.TRUE.equals(originalState)) {
      Map<Equivalence.Wrapper<ExprNode>, Boolean> rMap = new HashMap<>(exprValueMap);
      rMap.put(condition, false);
      visit(nextAltNode.get(), rMap, stack);
    }
  }
394653
function(node) {
						//only check nodes that are typed, we don't care about any others
						if(node.type && node.range) {
							if(!next && node.type === Estraverse.Syntax.Program && offset < node.range[0]) {
								//https://bugs.eclipse.org/bugs/show_bug.cgi?id=447454
								return Estraverse.VisitorOption.Break;
							}
							// Class and method declarations count offsets including the curly braces {} Bug 494484
							// When offset is touching both identifier and body, we want finder to return the identifier
							var bracesIncluded = false;							
							if (node.range[0] === offset && found && found.range[1] === offset && node.type === 'ClassBody' || node.type === 'FunctionExpression' && found && found.type === 'Identifier'){
								bracesIncluded = true;
							}

							if((!bracesIncluded && node.range[0] <= offset) || (bracesIncluded && node.range[0] < offset) ){
								found = node;
								if(parents) {
									parents.push(node);
								}
							} else {
								if(next) {
									found = node;
									if(parents) {
										parents.push(node);
									}
								}
								if(found.type !== Estraverse.Syntax.Program) {
									//we don't want to find the next node as the program root
									//if program has no children it will be returned on the next pass
									//https://bugs.eclipse.org/bugs/show_bug.cgi?id=442411
									return Estraverse.VisitorOption.Break;
								}
							}
						}
					}
135547
@Override public PType caseAAbsoluteUnaryExp(AAbsoluteUnaryExp node,
			TypeCheckInfo question) throws AnalysisException
	{
		question.qualifiers = null;
		TypeCheckInfo absConstraint = question.newConstraint(null);

		if (question.constraint != null
				&& question.assistantFactory.createPTypeAssistant().isNumeric(question.constraint))
		{
			if (question.constraint instanceof AIntNumericBasicType
					|| question.constraint instanceof ANatOneNumericBasicType)
			{
				absConstraint = question.newConstraint(AstFactory.newAIntNumericBasicType(node.getLocation()));
			} else
			{
				absConstraint = question;
			}
		}

		PType t = node.getExp().apply(THIS, absConstraint);

		if (!question.assistantFactory.createPTypeAssistant().isNumeric(t))
		{
			TypeCheckerErrors.report(3053, "Argument of 'abs' is not numeric", node.getLocation(), node);
		} else if (t instanceof AIntNumericBasicType)
		{
			t = AstFactory.newANatNumericBasicType(t.getLocation());
		}

		node.setType(t);
		return t;
	}
1071188
@Override
    public CompactLocationNumbering analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor)
            throws CheckedAnalysisException {
        Method method = analysisCache.getMethodAnalysis(Method.class, descriptor);

        if (method.getCode() == null) {
            return null;
        }

        CFG cfg = getCFG(analysisCache, descriptor);
        return new CompactLocationNumbering(cfg);
    }
1020403
function isForkingByTrueOrFalse(node) {
		var parent = node.parent;

		switch (parent.type) {
			case "ConditionalExpression":
			case "IfStatement":
			case "WhileStatement":
			case "DoWhileStatement":
			case "ForStatement":
				return parent.test === node;

			case "LogicalExpression":
				return true;

			default:
				return false;
		}
	}
1132791
@Override
    public MethodBytecodeSet analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
        Method method = analysisCache.getMethodAnalysis(Method.class, descriptor);
        Code code = method.getCode();
        if (code == null) {
            return null;
        }

        byte[] instructionList = code.getCode();

        // Create callback
        UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length);

        // Scan the method.
        BytecodeScanner scanner = new BytecodeScanner();
        scanner.scan(instructionList, callback);

        UnpackedCode unpackedCode = callback.getUnpackedCode();
        MethodBytecodeSet result = null;
        if (unpackedCode != null) {
            result = unpackedCode.getBytecodeSet();
        }

        return result;
    }
643050
public Value eval(ACaseAlternative node, Value val, Context ctxt)
			throws AnalysisException
	{
		Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "case alternative", ctxt);

		try
		{
			evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getPattern(), val, ctxt));
			return node.getResult().apply(VdmRuntime.getExpressionEvaluator(), evalContext);
		} catch (PatternMatchException e)
		{
			// Silently fail (CasesExpression will try the others)
		}

		return null;
	}