Lines Matching refs:allocator

218     Variable *AddDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension)
223 return AddBinding(allocator, FindLocal(decl->Name(), options), decl, extension);
226 Variable *AddTsDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension)
229 return AddBinding(allocator, FindLocal(decl->Name(), ResolveBindingOptions::ALL), decl, extension);
233 T *NewDecl(ArenaAllocator *allocator, Args &&...args);
236 VariableType *AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags);
239 static VariableType *CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags flags,
243 Variable *PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&...args);
255 ArenaMap<util::StringView, Variable *> OrderedBindings(ArenaAllocator *allocator) const
257 ArenaMap<util::StringView, Variable *> result(allocator->Adapter());
262 virtual Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
283 explicit Scope(ArenaAllocator *allocator, Scope *parent)
284 : parent_(parent), decls_(allocator->Adapter()), bindings_(allocator->Adapter())
288 explicit Scope(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags)
289 : parent_(parent), decls_(allocator->Adapter()), bindings_(allocator->Adapter()), flags_(flags)
305 Variable *AddLocal(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
308 Variable *AddLocalVar(ArenaAllocator *allocator, Decl *newDecl);
400 explicit VariableScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent) {}
403 Variable *AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
406 Variable *AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
410 Variable *AddTSBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFlags flags);
413 Variable *AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
438 std::tuple<ParameterDecl *, ir::AstNode *, Variable *> AddParamDecl(ArenaAllocator *allocator, ir::AstNode *param);
441 explicit ParamScope(ArenaAllocator *allocator, Scope *parent)
442 : Scope(allocator, parent), params_(allocator->Adapter())
446 Variable *AddParam(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFlags flags);
456 explicit FunctionParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, parent) {}
473 void BindName(ArenaAllocator *allocator, util::StringView name);
480 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
495 explicit ScopeWithParamScope(ArenaAllocator *allocator, Scope *parent) : E(allocator, parent), paramScope_(nullptr)
528 explicit LocalScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent) {}
529 explicit LocalScope(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags) : Scope(allocator, parent, flags) {}
536 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
542 explicit LocalScopeWithTypeAlias(ArenaAllocator *allocator, Scope *parent)
543 : LocalScope(allocator, parent),
544 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS))
547 explicit LocalScopeWithTypeAlias(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags)
548 : LocalScope(allocator, parent, flags),
549 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS))
555 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
574 explicit FunctionScope(ArenaAllocator *allocator, Scope *parent)
575 : ScopeWithParamScope(allocator, parent),
576 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS))
612 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
623 explicit ClassScope(ArenaAllocator *allocator, Scope *parent)
624 : LocalScopeWithTypeAlias(allocator, parent),
625 staticDeclScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::STATIC_DECL_SCOPE)),
626 staticFieldScope_(allocator->New<LocalScope>(allocator, staticDeclScope_, ScopeFlags::STATIC_FIELD_SCOPE)),
627 staticMethodScope_(allocator->New<LocalScope>(allocator, staticFieldScope_, ScopeFlags::STATIC_METHOD_SCOPE)),
628 instanceDeclScope_(allocator->New<LocalScope>(allocator, staticMethodScope_, ScopeFlags::DECL_SCOPE)),
629 instanceFieldScope_(allocator->New<LocalScope>(allocator, instanceDeclScope_, ScopeFlags::FIELD_SCOPE)),
630 instanceMethodScope_(allocator->New<LocalScope>(allocator, instanceFieldScope_, ScopeFlags::METHOD_SCOPE))
706 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
756 explicit CatchParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, parent) {}
763 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
771 explicit CatchScope(ArenaAllocator *allocator, Scope *parent) : ScopeWithParamScope(allocator, parent) {}
778 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
786 explicit LoopDeclarationScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator, parent) {}
793 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
796 return AddLocal(allocator, currentVariable, newDecl, extension);
808 void ConvertToVariableScope(ArenaAllocator *allocator);
819 explicit LoopScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator, parent)
843 void ConvertToVariableScope(ArenaAllocator *allocator);
845 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
848 return AddLocal(allocator, currentVariable, newDecl, extension);
860 explicit GlobalScope(ArenaAllocator *allocator)
861 : FunctionScope(allocator, nullptr), foreignBindings_(allocator->Adapter())
863 auto *paramScope = allocator->New<FunctionParamScope>(allocator, this);
873 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
900 explicit ModuleScope(ArenaAllocator *allocator)
901 : GlobalScope(allocator),
902 allocator_(allocator),
935 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
941 Variable *AddImport(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
950 Variable *VariableScope::AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl)
953 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, VariableFlags::HOIST_VAR)).first->second;
972 Variable *VariableScope::AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
978 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, flags)).first->second;
998 Variable *VariableScope::AddTSBinding(ArenaAllocator *allocator, [[maybe_unused]] Variable *currentVariable,
1002 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, flags)).first->second;
1006 Variable *VariableScope::AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl)
1012 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, VariableFlags::NONE)).first->second;
1016 T *Scope::NewDecl(ArenaAllocator *allocator, Args &&...args)
1018 T *decl = allocator->New<T>(std::forward<Args>(args)...);
1025 VariableType *Scope::AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags)
1031 auto *decl = allocator->New<DeclType>(name);
1032 auto *variable = allocator->New<VariableType>(decl, flags);
1042 VariableType *Scope::CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags flags, ir::AstNode *node)
1044 auto *decl = allocator->New<DeclType>(name);
1045 auto *variable = allocator->New<VariableType>(decl, flags);
1051 Variable *Scope::PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&...args)
1055 return bindings_.insert({name, allocator->New<T>(std::forward<Args>(args)...)}).first->second;