Lines Matching defs:auto
41 const auto searchFlags = PropertySearchFlags::SEARCH_ALL | PropertySearchFlags::SEARCH_IN_BASE |
43 auto *resolved = classType->GetProperty(name, searchFlags);
127 const auto *const classProp = ident->Parent()->AsClassProperty();
131 const auto *const variableDecl = ident->Parent()->AsVariableDeclarator();
138 const auto [class_var, class_type] = FindVariableInClassOrEnclosing(ident->Name(), Context().ContainingClass());
139 auto *parentClass = FindAncestorGivenByType(ident, ir::AstNodeType::CLASS_DEFINITION);
154 const auto &pos = ident->Start();
165 auto *scopeIter = Scope();
168 auto captureVariable = [this, var, ident, &scopeIter, &inStaticMethod, &pos]() {
177 auto *parent = ident->Parent();
215 const auto &pos = ident->Start();
231 const auto *scopeIter = Scope();
244 auto *const resolved = ident->Variable();
249 auto options = ident->Parent()->IsTSTypeAliasDeclaration() ? varbinder::ResolveBindingOptions::TYPE_ALIASES
252 auto *resolved = FindVariableInFunctionScope(ident->Name(), options);
298 auto const numericPromotion = [this, unboxedL, unboxedR, bothConst]() -> std::tuple<checker::Type *, bool> {
385 auto checkLeftRight = CheckLeftRightType(checker, unboxedL, unboxedR);
426 auto [isResolve, isValue] =
441 auto [resolveLeft, leftValue] = IsResolvedAndValue(expr->Left(), leftType);
442 auto [resolveRight, rightValue] = IsResolvedAndValue(expr->Right(), rightType);
567 for (auto e : init->AsArrayExpression()->Elements()) {
575 auto const isNumeric = [](checker::Type *ct) { return ct->HasTypeFlag(TypeFlag::ETS_CONVERTIBLE_TO_NUMERIC); };
576 auto const elementType = std::all_of(elementTypes.begin(), elementTypes.end(), isNumeric)
591 auto *nodeVar = localTypeAnnotation->AsETSTypeReference()->Part()->Name()->AsIdentifier()->Variable();
596 auto *node = nodeVar->Declaration()->Node();
606 auto *const arrowFuncExpr = init;
619 auto type = bindingVar->TsTypeOrError();
627 auto constituentTypes = type->AsETSUnionType()->ConstituentTypes();
645 for (auto constituentType : annotationType->AsETSUnionType()->ConstituentTypes()) {
795 for (auto it : annotationType->AsETSUnionType()->ConstituentTypes()) {
849 auto *nonConstSourceType = GetNonConstantType(sourceType);
850 auto *nonConstTargetType = GetNonConstantType(targetType);
916 auto *const arrayType = actualType->AsETSArrayType();
948 auto *const objectType = actualType->AsETSObjectType();
981 auto types = ResolveSmartCastTypes();
985 auto const &variable = std::get<VARIABLE_POSITION>(*types);
990 if (auto [_, inserted] =
998 for (auto &smartCast : testSmartCasts_) {
1005 for (auto &smartCast : testSmartCasts_) {
1026 auto const *const variableScope = testCondition_.variable->GetScope();
1027 auto const topLevelVariable =
1042 auto *smartType = GetSmartCast(testCondition_.variable);
1047 auto *const checker = parent_->AsETSChecker();
1057 auto *const testedType = testCondition_.testedType->AsETSObjectType();
1061 auto *const testedType = testCondition_.testedType->AsETSArrayType();
1083 auto parent = typeAnnotation->Parent();
1100 auto *variableType = variable->TsType();
1112 auto *const &variable = std::get<VARIABLE_POSITION>(types);
1113 auto *const &consequentTypeNew = std::get<CONSEQUENT_TYPE_POSITION>(types);
1114 auto *const &alternateTypeNew = std::get<ALTERNATE_TYPE_POSITION>(types);
1116 if (auto const it = testSmartCasts_.find(variable); it != testSmartCasts_.end()) {
1117 auto *const consequentTypeOld = it->second.first;
1126 if (auto *const alternateTypeOld = it->second.second; alternateTypeOld != nullptr) {
1181 auto paramName = expandedAliasType->AsETSTypeParameter()->GetDeclNode()->Name()->Name();
1186 auto objectType = expandedAliasType->AsETSObjectType();
1189 for (const auto typeArgument : objectType->TypeArguments()) {
1193 auto tupleType = expandedAliasType->AsETSTupleType();
1195 for (auto type : tupleType->GetTupleTypesList()) {
1199 auto arrayType = expandedAliasType->AsETSArrayType();
1201 auto elementType = arrayType->ElementType();
1204 auto unionType = expandedAliasType->AsETSUnionType();
1206 for (auto type : unionType->ConstituentTypes()) {
1217 auto *const typeAliasNode =
1236 for (auto *const origTypeParam : typeParams->Params()) {
1242 auto *aliasSub = NewSubstitution();
1249 auto expandedAliasType = aliasType->Substitute(Relation(), aliasSub);
1253 auto *typeAliasTypeName = typeAliasNode->TypeParams()->Params().at(idx)->Name();
1254 auto *typeAliasType = typeAliasTypeName->Variable()->TsType();
1258 auto paramType = typeParams->Params().at(idx)->TsType();
1260 auto boxedType = PrimitiveTypeAsETSBuiltinType(typeParams->Params().at(idx)->GetType(this));
1300 for (auto item : importDecl->Specifiers()) {
1316 for (auto [_, var] : bindings) {
1318 auto [found, aliasedName] = FindSpecifierForModuleObject(importDecl, var->AsLocalVariable()->Name());
1333 if (auto relatedMapItem =
1336 if (auto result = std::find_if(relatedMapItem->second.begin(), relatedMapItem->second.end(),
1337 [originalName](const auto &item) { return item.second == originalName; });
1354 auto programList = etsBinder->GetProgramList(importPath);
1389 auto *etsBinder = static_cast<varbinder::ETSBinder *>(VarBinder());
1391 for (auto [bindingName, var] : etsBinder->TopScope()->Bindings()) {
1414 auto *importData = VarBinder()->AsETSBinder()->DynamicImportDataForVar(name->AsIdentifier()->Variable());
1420 auto *refVar = name->AsIdentifier()->Variable()->AsLocalVariable();
1521 for (auto *it : list) {
1532 for (auto *it : funcType->CallSignatures()) {
1544 for (auto *it : funcType->CallSignatures()) {
1550 auto sigStr1 = ss.str();
1553 auto sigStr2 = ss.str();
1566 for (auto *s : source->CallSignatures()) {
1581 for (auto *curr : current) {
1582 auto name = curr->Name();
1583 auto *found = FindFunctionInVectorGivenByName(name, merged);
1595 auto *iter = node->Parent();
1611 auto *iter = signature->Function()->Parent();
1636 auto label = isContinue ? node->AsContinueStatement()->Ident() : node->AsBreakStatement()->Ident();
1638 auto var = label->Variable();
1649 const auto *iter = node->Parent();
1686 auto *discriminantType = GetNonConstantType(MaybeUnboxExpression(discriminant));
1712 auto *promoted = MaybePromotedBuiltinType(expr->TsTypeOrError());
1721 auto *primitive = MaybePrimitiveBuiltinType(expr->TsType());
1736 const auto identifierTypeKind = ETSChecker::TypeKind(caseType);
1766 auto *var = expression->AsMemberExpression()->PropVar();
1772 auto *var = expression->AsIdentifier()->Variable();
1782 for (auto &it : cases) {
1783 auto *caseTest = it->Test();
1787 auto *caseType = caseTest->TsType();
1830 auto *caseTest = cases.at(caseNum)->Test();
1831 auto *compareCaseTest = cases.at(compareCase)->Test();
1881 const auto compareCaseValue = GetStringFromIdentifierValue(compareCaseType);
1931 for (const auto param : ancestorFunction->AsScriptFunction()->Signature()->Function()->Params()) {
1967 if (auto interfaces =
1989 const auto predicateFunc = [&enclosingCatchClause](ir::CatchClause *clause) {
1997 const auto catches = p->AsTryStatement()->CatchClauses();
2017 auto *iter = startFrom->Parent();
2043 for (auto item : func->Params()) {
2044 auto const *type = item->AsETSParameterExpression()->Ident()->TypeAnnotation();
2047 auto *typeDecl = type->AsETSTypeReference()->Part()->Name()->AsIdentifier()->Variable()->Declaration();
2067 auto *relevantType = CreateNewETSObjectType(child->Name(), child->GetDeclNode(), child->ObjectFlags());
2092 for (auto *it : typeArgTypes) {
2110 for (auto [k, v] : *substitution) {
2122 for (auto &fstr : fields) {
2132 for (auto *p : type->Params()) {
2133 auto *const param = p->AsETSParameterExpression();
2174 auto const &typeParams = type->TypeArguments();
2206 for (auto *const param : lambda->Params()) {
2207 const auto *const lambdaParam = param->AsETSParameterExpression()->Ident();
2233 for (auto *type : typeAnn->AsETSUnionType()->Types()) {
2246 const auto *const calleeParam = calleeType->Params()[i]->AsETSParameterExpression()->Ident();
2247 auto *const lambdaParam = lambda->Params()[i]->AsETSParameterExpression()->Ident();
2249 auto *const typeAnnotation = calleeParam->TypeAnnotation()->Clone(Allocator(), lambdaParam);
2259 auto *const returnTypeAnnotation = calleeType->ReturnType()->Clone(Allocator(), lambda);
2273 for (auto *const element : arrayExpr->Elements()) {
2295 auto callSignatures = instantiateMethod->TsType()->AsETSFunctionType()->CallSignatures();
2297 auto methodOwner = std::string(callSignatures[0]->Owner()->Name());
2306 auto parser = parser::ETSParser(&program, options, parser::ParserStatus::NO_OPTS);
2307 auto *argExpr = parser.CreateExpression(implicitInstantiateArgument);
2321 auto *fieldDecl = Allocator()->New<varbinder::LetDecl>(classProp->Key()->AsIdentifier()->Name());
2324 auto fieldVar = scope->InstanceFieldScope()->AddDecl(Allocator(), fieldDecl, ScriptExtension::ETS);
2338 auto *classDef = field->Parent()->AsClassDefinition();
2349 auto *memberExpression =
2364 auto *paramIdent = field->Key()->AsIdentifier()->Clone(Allocator(), nullptr);
2366 auto *const typeAnnotation = field->TypeAnnotation()->Clone(Allocator(), paramIdent);
2372 auto *paramExpression = AllocNode<ir::ETSParameterExpression>(paramIdent, nullptr);
2374 auto *const paramVar = std::get<2>(paramScope->AddParamDecl(Allocator(), paramExpression));
2379 auto *assignmentExpression = AllocNode<ir::AssignmentExpression>(
2395 auto *paramScope = checker->Allocator()->New<varbinder::FunctionParamScope>(checker->Allocator(), classScope);
2396 auto *functionScope = checker->Allocator()->New<varbinder::FunctionScope>(checker->Allocator(), paramScope);
2405 auto *body = checker->AllocNode<ir::BlockStatement>(checker->Allocator(), std::move(stmts));
2406 auto funcFlags = isSetter ? ir::ScriptFunctionFlags::SETTER : ir::ScriptFunctionFlags::GETTER;
2407 auto *const returnTypeAnn = isSetter || field->TypeAnnotation() == nullptr
2411 auto *func = checker->AllocNode<ir::ScriptFunction>(
2423 auto *methodIdent = property->Key()->AsIdentifier()->Clone(checker->Allocator(), nullptr);
2425 auto *funcExpr = checker->AllocNode<ir::FunctionExpression>(func);
2429 auto *method = checker->AllocNode<ir::MethodDefinition>(ir::MethodDefinitionKind::METHOD, methodIdent, funcExpr,
2432 auto *decl = checker->Allocator()->New<varbinder::FunctionDecl>(checker->Allocator(),
2434 auto *var = checker->Allocator()->New<varbinder::LocalVariable>(decl, varbinder::VariableFlags::VAR);
2449 auto classCtx = varbinder::LexicalScope<varbinder::ClassScope>::Enter(checker->VarBinder(), classScope);
2463 auto *const classDef = classType->GetDeclNode()->AsClassDefinition();
2464 auto *const scope = checker->Scope()->AsClassScope();
2465 auto *const classProp = checker->ClassPropToImplementationProp(
2472 auto *const classProp = classType
2485 auto *const classDef = classType->GetDeclNode()->AsClassDefinition();
2486 for (auto &method : {getter, setter}) {
2491 const auto mflag = method == getter ? ir::ModifierFlags::GETTER : ir::ModifierFlags::SETTER;
2492 const auto tflag = method == getter ? TypeFlag::GETTER : TypeFlag::SETTER;
2510 auto *const classDef = classType->GetDeclNode()->AsClassDefinition();
2511 auto *interfaceProp = originalProp->Clone(Allocator(), originalProp->Parent());
2514 auto *const scope = Scope()->AsClassScope();
2518 auto *const classProp = GetImplementationClassProp(this, interfaceProp, originalProp, classType);
2524 const auto &name = getter->Key()->AsIdentifier()->Name();
2531 auto *const methodScope = scope->InstanceMethodScope();
2532 auto *const decl = Allocator()->New<varbinder::FunctionDecl>(Allocator(), name, getter);
2533 auto *var = methodScope->AddDecl(Allocator(), decl, ScriptExtension::ETS);
2536 auto *const prevDecl = methodScope->FindDecl(name);
2537 for (const auto &method : {getter, setter}) {
2562 auto const propInvoke = type->AsETSObjectType()->GetProperty(FUNCTIONAL_INTERFACE_INVOKE_METHOD_NAME,
2581 auto className = ident->Name();
2586 auto *instantiateMethod =
2588 auto *invokeMethod =
2602 auto *classId = AllocNode<ir::Identifier>(className, Allocator());
2604 auto *methodId = AllocNode<ir::Identifier>(propertyName, Allocator());
2611 auto *transformedCallee =
2619 auto *callExpr = ident->Parent()->AsCallExpression();
2625 auto *argExpr = GenerateImplicitInstantiateArg(instantiateMethod, std::string(className));
2632 auto &arguments = callExpr->Arguments();
2642 auto *syntheticObjType = Allocator()->New<checker::ETSObjectType>(Allocator(), syntheticName, syntheticName, id,
2645 auto *classDecl = Allocator()->New<varbinder::ClassDecl>(syntheticName);
2657 for (auto item : VarBinder()->AsETSBinder()->ReExportImports()) {
2661 auto *reExportType = GetImportSpecifierObjectType(item->GetETSImportDeclarations(), ident);
2663 for (auto node : importDecl->Specifiers()) {
2665 auto specifier = node->AsImportSpecifier();
2674 auto importPath = importDecl->ResolvedSource()->Str();
2679 auto assemblerName = syntheticNames[0];
2689 auto *moduleObjectType =
2693 auto *rootDecl = Allocator()->New<varbinder::ClassDecl>(syntheticNames[0]);
2701 for (const auto &syntheticName : syntheticNames) {