• Home
  • Raw
  • Download

Lines Matching +full:allocator +full:-

7  * http://www.apache.org/licenses/LICENSE-2.0
56 explicit TSBindings(ArenaAllocator *allocator) : allocator_(allocator) {} in TSBindings() argument
64 tsBindings_[index] = allocator_->New<VariableMap>(allocator_->Adapter()); in AddTSVariable()
66 return tsBindings_[index]->insert({name, variable}).second; in AddTSVariable()
77 auto res = tsBindings_[index]->find(name); in FindTSVariable()
78 if (res == tsBindings_[index]->end()) { in FindTSVariable()
81 return res->second; in FindTSVariable()
87 if (tsBindings_[i] && tsBindings_[i]->find(name) != tsBindings_[i]->end()) { in InTSBindings()
106 explicit ExportBindings(ArenaAllocator *allocator) in ExportBindings() argument
107 : exportBindings_(allocator->Adapter()), in ExportBindings()
108 exportTSBindings_(allocator) in ExportBindings()
118 return res->second; in FindExportVariable()
309 bool AddDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension) in AddDecl() argument
313 return AddBinding(allocator, FindLocal(decl->Name()), decl, extension); in AddDecl()
316 … bool AddTsDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension) in AddTsDecl() argument
319 …return AddBinding(allocator, FindLocal(decl->Name(), ResolveBindingOptions::ALL), decl, extension); in AddTsDecl()
328 T *NewDecl(ArenaAllocator *allocator, Args &&... args);
331 VariableType *AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags);
334 …static VariableType *CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags fla…
338 void PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&... args);
350 virtual bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
391 return parent_->GetFullScopeName(); in GetFullScopeName()
400 return parent_->GetDuplicateScopeIndex(childScopeName); in GetDuplicateScopeIndex()
421 scopeDuplicateIndex_ = parent->GetDuplicateScopeIndex( in SetSelfScopeName()
428 return topScope_->scopeNames_; in GetScopeNames()
432 explicit Scope(ArenaAllocator *allocator, Scope *parent) in Scope() argument
434 decls_(allocator->Adapter()), in Scope()
435 bindings_(allocator->Adapter()), in Scope()
436 tsBindings_(allocator), in Scope()
437 scopesIndex_(allocator->Adapter()), in Scope()
438 scopeNames_(allocator->Adapter()), in Scope()
439 allocator_(allocator) in Scope()
445 * @return true - if the variable is shadowed
446 * false - otherwise
451 * @return true - if the variable is shadowed
452 * false - otherwise
456 bool AddLocal(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
464 topScope_ = parent_->GetTopScope(); in SetTopScope()
589 explicit VariableScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent), in VariableScope() argument
590 … lexicalVarNameAndTypes_(allocator->Adapter()) {} in VariableScope()
595 bool AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
598 bool AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
602 bool AddClass(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
605 …bool AddTSBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFla…
608 bool AddTSBinding(ArenaAllocator *allocator, Decl *newDecl, VariableFlags flags);
611 bool AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
639 if (param->Name() == name) { in HasParam()
647 …std::tuple<ParameterDecl *, const ir::AstNode *> AddParamDecl(ArenaAllocator *allocator, const ir:…
650 explicit ParamScope(ArenaAllocator *allocator, Scope *parent) in ParamScope() argument
651 : Scope(allocator, parent), params_(allocator->Adapter()) in ParamScope()
655 …bool AddParam(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFlags f…
664 …explicit FunctionParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, pare… in FunctionParamScope() argument
681 void BindName(ArenaAllocator *allocator, util::StringView name);
688 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
712 explicit ScopeWithParamScope(ArenaAllocator *allocator, Scope *parent) : E(allocator, parent) {} in ScopeWithParamScope() argument
718 this->bindings_ = paramScope->Bindings(); in BindParamScope()
723 ASSERT(this->parent_ == paramScope); in AssignParamScope()
724 ASSERT(this->bindings_.empty()); in AssignParamScope()
742 this->bindings_.insert(paramScope_->Bindings().begin(), paramScope_->Bindings().end()); in AddBindsFromParam()
756 …explicit FunctionScope(ArenaAllocator *allocator, Scope *parent) : ScopeWithParamScope(allocator, … in FunctionScope() argument
791 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
809 return ++it->second; in GetDuplicateScopeIndex()
821 if ((parentScope != nullptr) && (parentScope->IsFunctionParamScope())) { in GetParentWithScopeName()
822 parentScope = parentScope->Parent(); in GetParentWithScopeName()
839 explicit LocalScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent) {} in LocalScope() argument
846 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
852 explicit ClassScope(ArenaAllocator *allocator, Scope *parent) in ClassScope() argument
853 : VariableScope(allocator, parent), in ClassScope()
854 computedNames_(allocator->Adapter()), in ClassScope()
855 privateNames_(allocator->Adapter()), in ClassScope()
856 privateGetters_(allocator->Adapter()), in ClassScope()
857 privateSetters_(allocator->Adapter()) in ClassScope()
878 return computedNames_.find(key)->second; in GetSlot()
881 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddBinding() argument
884 return AddLocal(allocator, currentVariable, newDecl, extension); in AddBinding()
905 return ++it->second; in GetDuplicateScopeIndex()
944 …explicit CatchParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, parent)… in CatchParamScope() argument
951 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
959 …explicit CatchScope(ArenaAllocator *allocator, Scope *parent) : ScopeWithParamScope(allocator, par… in CatchScope() argument
966 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
972 … explicit LoopScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator, parent) {} in LoopScope() argument
981 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddBinding() argument
984 return AddLocal(allocator, currentVariable, newDecl, extension); in AddBinding()
993 …explicit StaticBlockScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator, par… in StaticBlockScope() argument
1000 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddBinding() argument
1003 return AddLocal(allocator, currentVariable, newDecl, extension); in AddBinding()
1012 explicit GlobalScope(ArenaAllocator *allocator) : FunctionScope(allocator, nullptr) in GlobalScope() argument
1014 paramScope_ = allocator->New<FunctionParamScope>(allocator, this); in GlobalScope()
1022 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
1044 …explicit ModuleScope(ArenaAllocator *allocator, parser::Program *program) : FunctionScope(allocato… in ModuleScope() argument
1046 paramScope_ = allocator->New<FunctionParamScope>(allocator, this); in ModuleScope()
1062 … void ConvertLocalVariableToModuleVariable(ArenaAllocator *allocator, util::StringView localName);
1064 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
1089 explicit TSModuleScope(ArenaAllocator *allocator, Scope *parent, ExportBindings *exportBindings) in TSModuleScope() argument
1090 …: FunctionScope(allocator, nullptr), exportBindings_(exportBindings), variableNames_(allocator->Ad… in TSModuleScope()
1092 paramScope_ = allocator->New<FunctionParamScope>(allocator, parent); in TSModuleScope()
1094 paramScope_->BindFunctionScope(this); in TSModuleScope()
1106 return exportBindings_->FindExportTSVariable<type>(name); in FindExportTSVariable()
1112 return exportBindings_->AddExportTSVariable<type>(name, var); in AddExportTSVariable()
1117 return exportBindings_->FindExportVariable(name); in FindExportVariable()
1122 return exportBindings_->AddExportVariable(name, var); in AddExportVariable()
1127 return exportBindings_->AddExportVariable(name, FindLocal(name)); in AddExportVariable()
1132 return exportBindings_->InExportBindings(name); in InExportBindings()
1157 …explicit TSEnumScope(ArenaAllocator *allocator, Scope *parent, VariableMap *enumMemberBindings) : … in TSEnumScope() argument
1158allocator, nullptr), enumMemberBindings_(enumMemberBindings), variableNames_(allocator->Adapter()) in TSEnumScope()
1160 paramScope_ = allocator->New<FunctionParamScope>(allocator, parent); in TSEnumScope()
1162 paramScope_->BindFunctionScope(this); in TSEnumScope()
1164 scopeDuplicateIndex_ = parent->GetDuplicateScopeIndex(GetScopeTag()); in TSEnumScope()
1174 auto res = enumMemberBindings_->find(name); in FindEnumMemberVariable()
1175 if (res == enumMemberBindings_->end()) { in FindEnumMemberVariable()
1178 return res->second; in FindEnumMemberVariable()
1191 bool AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
1218 bool VariableScope::AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl) in AddVar() argument
1221 flags |= DeclFlagToVariableFlag(newDecl->Flags()); in AddVar()
1224 bindings_.insert({newDecl->Name(), allocator->New<T>(newDecl, flags)}); in AddVar()
1228 switch (currentVariable->Declaration()->Type()) { in AddVar()
1230 currentVariable->Reset(newDecl, flags); in AddVar()
1246 bool VariableScope::AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddFunction() argument
1250 flags |= DeclFlagToVariableFlag(newDecl->Flags()); in AddFunction()
1253 bindings_.insert({newDecl->Name(), allocator->New<T>(newDecl, flags)}); in AddFunction()
1257 auto decl = currentVariable->Declaration(); in AddFunction()
1258 if (decl->IsClassDecl() && decl->AsClassDecl()->IsDeclare()) { in AddFunction()
1259 newDecl->AsFunctionDecl()->SetDeclClass(decl->AsClassDecl()); in AddFunction()
1260 bindings_[newDecl->Name()] = allocator->New<T>(newDecl, flags); in AddFunction()
1268 switch (currentVariable->Declaration()->Type()) { in AddFunction()
1271 currentVariable->Reset(newDecl, flags); in AddFunction()
1283 bool VariableScope::AddClass(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl) in AddClass() argument
1285 ASSERT(newDecl->IsClassDecl()); in AddClass()
1287 VariableFlags flags = DeclFlagToVariableFlag(newDecl->Flags()); in AddClass()
1290 bindings_.insert({newDecl->Name(), allocator->New<T>(newDecl, flags)}); in AddClass()
1294 auto decl = currentVariable->Declaration(); in AddClass()
1295 if (newDecl->AsClassDecl()->IsDeclare() && decl->IsFunctionDecl()) { in AddClass()
1296 decl->AsFunctionDecl()->SetDeclClass(newDecl->AsClassDecl()); in AddClass()
1304 bool VariableScope::AddTSBinding(ArenaAllocator *allocator, [[maybe_unused]] Variable *currentVaria… in AddTSBinding() argument
1309 bindings_.insert({newDecl->Name(), allocator->New<T>(newDecl, flags)}); in AddTSBinding()
1314 bool VariableScope::AddTSBinding(ArenaAllocator *allocator, Decl *newDecl, VariableFlags flags) in AddTSBinding() argument
1319 newDecl->Name(), allocator->New<T>(newDecl, flags)); in AddTSBinding()
1323 newDecl->Name(), allocator->New<T>(newDecl, flags)); in AddTSBinding()
1327 newDecl->Name(), allocator->New<T>(newDecl, flags)); in AddTSBinding()
1331 newDecl->Name(), allocator->New<T>(newDecl, flags)); in AddTSBinding()
1341 bool VariableScope::AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl) in AddLexical() argument
1343 VariableFlags flags = DeclFlagToVariableFlag(newDecl->Flags()); in AddLexical()
1349 bindings_.insert({newDecl->Name(), allocator->New<T>(newDecl, flags)}); in AddLexical()
1354 T *Scope::NewDecl(ArenaAllocator *allocator, Args &&... args) in NewDecl() argument
1356 T *decl = allocator->New<T>(std::forward<Args>(args)...); in NewDecl()
1363 VariableType *Scope::AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags) in AddDecl() argument
1369 auto *decl = allocator->New<DeclType>(name); in AddDecl()
1370 auto *variable = allocator->New<VariableType>(decl, flags); in AddDecl()
1375 bindings_.insert({decl->Name(), variable}); in AddDecl()
1381 VariableType *Scope::CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags flag… in CreateVar() argument
1384 auto *decl = allocator->New<DeclType>(name); in CreateVar()
1386 auto *variable = allocator->New<VariableType>(decl, flags); in CreateVar()
1388 decl->BindNode(node); in CreateVar()
1393 void Scope::PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&... args) in PropagateBinding() argument
1397 bindings_.insert({name, allocator->New<T>(std::forward<Args>(args)...)}); in PropagateBinding()
1401 if (!res->second->Declaration()->IsParameterDecl()) { in PropagateBinding()
1402 res->second->Reset(std::forward<Args>(args)...); in PropagateBinding()