Type check method for let be such that
@param node
@param nodeLocation
@param bind
@param suchThat
@param body
@param question
@return a pair of the type and definition
@throws AnalysisException
175852
protected Map.Entry<PType, AMultiBindListDefinition> typecheckLetBeSt(
			INode node, ILexLocation nodeLocation, PMultipleBind bind,
			PExp suchThat, INode body, TypeCheckInfo question)
			throws AnalysisException
	{
		final PDefinition def = AstFactory.newAMultiBindListDefinition(nodeLocation, question.assistantFactory.createPMultipleBindAssistant().getMultipleBindList((PMultipleBind) bind));

		def.apply(THIS, question.newConstraint(null));
		
		List<PDefinition> qualified = new Vector<PDefinition>();
		
		for (PDefinition d: question.assistantFactory.createPDefinitionAssistant().getDefinitions(def))
		{
			PDefinition copy = d.clone();
			copy.setNameScope(NameScope.LOCAL);
			qualified.add(copy);
		}
		
		Environment local = new FlatCheckedEnvironment(question.assistantFactory, qualified, question.env, question.scope);

		TypeCheckInfo newInfo = new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers, question.constraint, null);

		if (suchThat != null
				&& !question.assistantFactory.createPTypeAssistant().isType(suchThat.apply(THIS, newInfo.newConstraint(null)), ABooleanBasicType.class))
		{
			boolean isExpression = node instanceof PExp;
			TypeCheckerErrors.report((isExpression ? 3117 : 3225), "Such that clause is not boolean", nodeLocation, node);
		}

		newInfo.qualifiers = null;
		final PType r = body.apply(THIS, newInfo);
		local.unusedCheck();

		return new Map.Entry<PType, AMultiBindListDefinition>()
		{

			@Override
			public AMultiBindListDefinition setValue(
					AMultiBindListDefinition value)
			{
				return null;
			}

			@Override
			public AMultiBindListDefinition getValue()
			{
				return (AMultiBindListDefinition) def;
			}

			@Override
			public PType getKey()
			{
				return r;
			}
		};
	}
862953
function isContextSensitive(node) {
            ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
            switch (node.kind) {
                case 179 /* FunctionExpression */:
                case 180 /* ArrowFunction */:
                    return isContextSensitiveFunctionLikeDeclaration(node);
                case 171 /* ObjectLiteralExpression */:
                    return ts.forEach(node.properties, isContextSensitive);
                case 170 /* ArrayLiteralExpression */:
                    return ts.forEach(node.elements, isContextSensitive);
                case 188 /* ConditionalExpression */:
                    return isContextSensitive(node.whenTrue) ||
                        isContextSensitive(node.whenFalse);
                case 187 /* BinaryExpression */:
                    return node.operatorToken.kind === 52 /* BarBarToken */ &&
                        (isContextSensitive(node.left) || isContextSensitive(node.right));
                case 253 /* PropertyAssignment */:
                    return isContextSensitive(node.initializer);
                case 147 /* MethodDeclaration */:
                case 146 /* MethodSignature */:
                    return isContextSensitiveFunctionLikeDeclaration(node);
                case 178 /* ParenthesizedExpression */:
                    return isContextSensitive(node.expression);
            }
            return false;
        }
658099
Node createThisForFunction(Node functionNode) {
    final Node result = IR.thisNode();
    if (isAddingTypes()) {
      result.setJSType(getTypeOfThisForFunctionNode(functionNode));
    }
    return result;
  }
1258631
@Override
  public void endVisit(MethodDeclaration node) {
    ExecutableElement element = node.getExecutableElement();
    if (!ElementUtil.getName(element).equals("compareTo") || node.getBody() == null) {
      return;
    }
    DeclaredType comparableType = typeUtil.findSupertype(
        ElementUtil.getDeclaringClass(element).asType(), "java.lang.Comparable");
    if (comparableType == null) {
      return;
    }
    List<? extends TypeMirror> typeArguments = comparableType.getTypeArguments();
    List<? extends VariableElement> parameters = element.getParameters();
    if (typeArguments.size() != 1 || parameters.size() != 1
        || !typeArguments.get(0).equals(parameters.get(0).asType())) {
      return;
    }

    VariableElement param = node.getParameter(0).getVariableElement();

    FunctionInvocation castCheck = createCastCheck(typeArguments.get(0), new SimpleName(param));
    if (castCheck != null) {
      node.getBody().addStatement(0, new ExpressionStatement(castCheck));
    }
  }
1235774
private ClassNode checkForTargetType(final Expression expr, final ClassNode type) {
        BinaryExpression enclosingBinaryExpression = typeCheckingContext.getEnclosingBinaryExpression();
        if (enclosingBinaryExpression instanceof DeclarationExpression
                && isEmptyCollection(expr) && isAssignment(enclosingBinaryExpression.getOperation().getType())) {
            VariableExpression target = (VariableExpression) enclosingBinaryExpression.getLeftExpression();
            return adjustForTargetType(target.getType(), type);
        }
        if (currentField != null) {
            return adjustForTargetType(currentField.getType(), type);
        }
        if (currentProperty != null) {
            return adjustForTargetType(currentProperty.getType(), type);
        }
        MethodNode enclosingMethod = typeCheckingContext.getEnclosingMethod();
        if (enclosingMethod != null) {
            return adjustForTargetType(enclosingMethod.getReturnType(), type);
        }
        return type;
    }
978385
void expectActualObject(Node n, JSType type, String msg) {
    if (!type.isObject()) {
      mismatch(n, msg, type, OBJECT_TYPE);
    }
  }
410273
def node_query(self, node):
        

        if isinstance(node, ast.Call):
            assert node.args
            arg = node.args[0]
            if not isinstance(arg, ast.Str):
                return
        else:
            raise TypeError(type(node))

        return arg.s
1229161
private Description checkToString(ExpressionTree tree, VisitorState state) {
    Symbol sym = ASTHelpers.getSymbol(tree);
    if (!(sym instanceof VarSymbol || sym instanceof MethodSymbol)) {
      return NO_MATCH;
    }
    Type type = ASTHelpers.getType(tree);
    if (type instanceof MethodType) {
      type = type.getReturnType();
    }
    Tree parent = state.getPath().getParentPath().getLeaf();
    ToStringKind toStringKind = isToString(parent, tree, state);
    if (toStringKind == ToStringKind.NONE) {
      return NO_MATCH;
    }
    if (!typePredicate().apply(type, state)) {
      return NO_MATCH;
    }
    Optional<Fix> fix;
    switch (toStringKind) {
      case IMPLICIT:
        fix = implicitToStringFix(tree, state);
        break;
      case EXPLICIT:
        fix = toStringFix(parent, tree, state);
        break;
      default:
        throw new AssertionError(toStringKind);
    }
    return maybeFix(tree, state, type, fix);
  }
319099
public Object visit(Lookup node) {
        
        Token dotToken = node.getDot();
        SourceInfo info = dotToken.getSourceInfo();
        
        if (info != null && info.getStartPosition() == mDotPosition) {
			
            // Found the matching position, so this node represents the
            // lookup expression that we are looking for.
            
            Expression expression = node.getExpression();
            
            Type type = expression.getType();                
            if (type != null) {
                // Save the type class
                mType = type.getObjectClass();                    
            }                
            
            return null;
        }
        
        return super.visit(node);
    }
867395
@CheckReturnValue
  protected Statement genParamTypeChecks(TemplateNode node, String alias) {
    ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
    for (TemplateParam param : node.getAllParams()) {
      String paramName = param.name();
      SoyType paramType = param.type();
      CodeChunk.Generator generator = templateTranslationContext.codeGenerator();
      Expression paramChunk = genCodeForParamAccess(paramName, param);
      JsType jsType = getJsTypeForParamTypeCheck(paramType);
      // The opt_param.name value that will be type-tested.
      String paramAlias = genParamAlias(paramName);
      Expression coerced = jsType.getValueCoercion(paramChunk, generator);
      if (coerced != null) {
        // since we have coercion logic, dump into a temporary
        paramChunk = generator.declarationBuilder().setRhs(coerced).build().ref();
      }
      if (param.hasDefault()) {
        if (coerced == null) {
          paramChunk = generator.declarationBuilder().setRhs(paramChunk).build().ref();
        }
        declarations.add(
            genParamDefault(param, paramChunk, alias, jsType, /* declareStatic= */ true));
      }
      // The param value to assign
      Expression value;
      Optional<Expression> soyTypeAssertion =
          jsType.getSoyTypeAssertion(paramChunk, paramName, generator);
      // The type-cast expression.
      if (soyTypeAssertion.isPresent()) {
        value = soyTypeAssertion.get();
      } else {
        value = paramChunk;
      }

      VariableDeclaration.Builder declarationBuilder =
          VariableDeclaration.builder(paramAlias)
              .setRhs(value)
              .setGoogRequires(jsType.getGoogRequires());
      declarationBuilder.setJsDoc(
          JsDoc.builder()
              .addParameterizedAnnotation(
                  "type", getJsTypeForParamForDeclaration(paramType).typeExpr())
              .build());
      VariableDeclaration declaration = declarationBuilder.build();
      declarations.add(declaration);

      templateTranslationContext
          .soyToJsVariableMappings()
          // TODO(lukes): this should really be declartion.ref() but we cannot do that until
          // everything is on the code chunk api.
          .put(paramName, id(paramAlias));
    }
    return Statement.of(declarations.build());
  }
27246
@Override
	public void caseATypeMultipleBind(ATypeMultipleBind node)
			throws AnalysisException
	{
		ADefPatternBind bind = node.getAncestor(ADefPatternBind.class);

		if(bind != null && bind.parent() instanceof AForPatternBindStm)
		{
			super.caseATypeMultipleBind(node);
		}
		else {

			info.addUnsupportedNode(node, "Type binds are not supported");
		}
	}
198418
function nodeAtLocation(location) {
        return exports.root.find(function each(n) {
            return n.isAtLocation(location, false);
        });
    }
11960
private void checkStrictParamType(
      final TemplateNode node, final TemplateParam param, @Nullable SoyValueProvider paramValue) {
    Kind kind = param.type().getKind();
    if (kind == Kind.ANY || kind == Kind.UNKNOWN) {
      // Nothing to check.  ANY and UKNOWN match all types.
      return;
    }
    if (paramValue == null) {
      paramValue = NullData.INSTANCE;
    } else if (paramValue instanceof SoyAbstractCachingValueProvider) {
      SoyAbstractCachingValueProvider typedValue = (SoyAbstractCachingValueProvider) paramValue;
      if (!typedValue.isComputed()) {
        // in order to preserve laziness we tell the value provider to assert the type when
        // computation is triggered
        typedValue.addValueAssertion(
            new ValueAssertion() {
              @Override
              public void check(SoyValue value) {
                checkValueType(param, value, node);
              }
            });
        return;
      }
    } else if (param.hasDefault() && paramValue.resolve() instanceof UndefinedData) {
      // Default parameters are undefined if they're unset.
      return;
    }
    checkValueType(param, paramValue.resolve(), node);
  }
1350154
protected void checkNode(@Nullable Node node, Token type) throws MalformedException {
    if (node == null) {
      throw new MalformedException(
          "Expected node type " + type + "; found: null", node);
    }
    if (node.getToken() != type) {
      throw new MalformedException(
          "Expected node type " + type + "; found: " + node.getToken(), node);
    }
  }
862862
@Override
	public PType caseACaseAlternativeStm(ACaseAlternativeStm node,
			TypeCheckInfo question) throws AnalysisException
	{

		if (node.getDefs().size() == 0)
		{
			node.setDefs(new LinkedList<PDefinition>());
			question.assistantFactory.createPPatternAssistant().typeResolve(node.getPattern(), THIS, question);

			if (node.getPattern() instanceof AExpressionPattern)
			{
				// Only expression patterns need type checking...
				AExpressionPattern ep = (AExpressionPattern) node.getPattern();
				PType ptype = ep.getExp().apply(THIS, question);

				if (!question.assistantFactory.getTypeComparator().compatible(ptype, node.getCtype()))
				{
					TypeCheckerErrors.report(3311, "Pattern cannot match", node.getPattern().getLocation(), node.getPattern());
				}
			}

			question.assistantFactory.createPPatternAssistant().typeResolve(node.getPattern(), THIS, question);

			ACasesStm stm = (ACasesStm) node.parent();
			node.getDefs().addAll(question.assistantFactory.createPPatternAssistant().getDefinitions(node.getPattern(), stm.getExp().getType(), NameScope.LOCAL));
		}

		question.assistantFactory.createPDefinitionListAssistant().typeCheck(node.getDefs(), THIS, question);

		if (!question.assistantFactory.createPPatternAssistant().matches(node.getPattern(), node.getCtype()))
		{
			TypeCheckerErrors.report(3311, "Pattern cannot match", node.getPattern().getLocation(), node.getPattern());
		}

		Environment local = new FlatCheckedEnvironment(question.assistantFactory, node.getDefs(), question.env, question.scope);
		PType r = node.getResult().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, null, question.returnType));
		local.unusedCheck();

		return r;
	}
948337
public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
		if (node.getKind() != Kind.ANNOTATION) return false;
		return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
	}
884804
function _makeFindCondition(match) {
        switch (typeof match) {
        case "function":
            return match;
        case "string":
            return function findCondition(name, node) {
                return node.name === name;
            }.bind(undefined, match.toUpperCase());
        case "number":
            return function findCondition(type, node) {
                return node.type === type;
            }.bind(undefined, match);
        default:
            console.error("Invalid find condition: " + match);
        }
    }