Lines Matching refs:allocator
423 bool Scope::AddLocal(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
438 scope->Bindings().insert({newDecl->Name(), allocator->New<GlobalVariable>(newDecl, varFlags)});
440 scope->PropagateBinding<LocalVariable>(allocator, newDecl->Name(), newDecl, varFlags);
447 newDecl->Name(), allocator->New<EnumLiteralVariable>(newDecl, VariableFlags::ENUM_LITERAL));
450 bindings_.insert({newDecl->Name(), allocator->New<LocalVariable>(newDecl, VariableFlags::INTERFACE)});
466 bindings_.insert({newDecl->Name(), allocator->New<LocalVariable>(newDecl, flags)});
472 bool ParamScope::AddParam(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFlags flags)
481 auto *param = allocator->New<LocalVariable>(newDecl, flags);
488 std::tuple<ParameterDecl *, const ir::AstNode *> ParamScope::AddParamDecl(ArenaAllocator *allocator,
491 const auto [name, pattern] = util::Helpers::ParamName(allocator, param, params_.size());
493 auto *decl = NewDecl<ParameterDecl>(allocator, name);
496 if (!AddParam(allocator, FindLocal(name), decl, VariableFlags::VAR)) {
508 auto *varDecl = NewDecl<VarDecl>(allocator, binding->Name());
516 auto *paramVar = allocator->New<LocalVariable>(varDecl, VariableFlags::VAR);
523 void FunctionParamScope::BindName(ArenaAllocator *allocator, util::StringView name)
525 nameVar_ = AddDecl<ConstDecl, LocalVariable>(allocator, name, VariableFlags::INITIALIZED);
529 bool FunctionParamScope::AddBinding([[maybe_unused]] ArenaAllocator *allocator,
582 bool FunctionScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
587 return AddVar<LocalVariable>(allocator, currentVariable, newDecl);
590 return AddFunction<LocalVariable>(allocator, currentVariable, newDecl, extension);
593 return AddClass<LocalVariable>(allocator, currentVariable, newDecl);
596 return AddTSBinding<EnumLiteralVariable>(allocator, newDecl, VariableFlags::ENUM_LITERAL);
599 return AddTSBinding<NamespaceVariable>(allocator, newDecl, VariableFlags::NAMESPACE);
602 return AddTSBinding<ImportEqualsVariable>(allocator, newDecl, VariableFlags::IMPORT_EQUALS);
605 return AddTSBinding<LocalVariable>(allocator, currentVariable, newDecl, VariableFlags::INTERFACE);
608 return AddLexical<LocalVariable>(allocator, currentVariable, newDecl);
665 bool TSEnumScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
669 return enumMemberBindings_->insert({newDecl->Name(), allocator->New<EnumVariable>(newDecl, false)}).second;
700 bool GlobalScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
705 return AddVar<GlobalVariable>(allocator, currentVariable, newDecl);
708 return AddFunction<GlobalVariable>(allocator, currentVariable, newDecl, extension);
711 return AddClass<LocalVariable>(allocator, currentVariable, newDecl);
714 return AddTSBinding<EnumLiteralVariable>(allocator, newDecl, VariableFlags::ENUM_LITERAL);
717 return AddTSBinding<NamespaceVariable>(allocator, newDecl, VariableFlags::NAMESPACE);
720 return AddTSBinding<ImportEqualsVariable>(allocator, newDecl, VariableFlags::IMPORT_EQUALS);
723 return AddTSBinding<LocalVariable>(allocator, currentVariable, newDecl, VariableFlags::INTERFACE);
726 return AddLexical<LocalVariable>(allocator, currentVariable, newDecl);
740 void ModuleScope::ConvertLocalVariableToModuleVariable(ArenaAllocator *allocator, util::StringView localName)
750 res->second = allocator->New<ModuleVariable>(decl, flags | VariableFlags::LOCAL_EXPORT);
762 bool ModuleScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
774 AddVar<ModuleVariable>(allocator, currentVariable, newDecl) :
775 AddVar<LocalVariable>(allocator, currentVariable, newDecl);
785 AddFunction<ModuleVariable>(allocator, currentVariable, newDecl, extension) :
786 AddFunction<LocalVariable>(allocator, currentVariable, newDecl, extension);
790 AddClass<ModuleVariable>(allocator, currentVariable, newDecl) :
791 AddClass<LocalVariable>(allocator, currentVariable, newDecl);
794 return AddTSBinding<EnumLiteralVariable>(allocator, newDecl, VariableFlags::ENUM_LITERAL);
797 return AddTSBinding<NamespaceVariable>(allocator, newDecl, VariableFlags::NAMESPACE);
800 return AddTSBinding<ImportEqualsVariable>(allocator, newDecl, VariableFlags::IMPORT_EQUALS);
803 return AddTSBinding<LocalVariable>(allocator, currentVariable, newDecl, VariableFlags::INTERFACE);
810 AddLexical<ModuleVariable>(allocator, currentVariable, newDecl) :
811 AddLexical<LocalVariable>(allocator, currentVariable, newDecl);
823 bool LocalScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
826 return AddLocal(allocator, currentVariable, newDecl, extension);
843 bool CatchParamScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
846 return AddParam(allocator, currentVariable, newDecl, VariableFlags::INITIALIZED);
849 bool CatchScope::AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
856 return AddLocal(allocator, currentVariable, newDecl, extension);