#ifndef POLSERVER_VARIABLES_H #define POLSERVER_VARIABLES_H #include #include #include #include #include "clib/maputil.h" #include "bscript/compiler/model/SimpleTypes.h" #include "bscript/compiler/model/VariableScope.h" #include "bscript/compiler/model/WarnOn.h" namespace Pol::Bscript::Compiler { class Report; class SourceLocation; class Variable; class Variables { public: Variables( VariableScope, Report& ); std::shared_ptr create( const std::string& name, BlockDepth, WarnOn, const SourceLocation& ); [[nodiscard]] std::shared_ptr find( const std::string& name ) const; void restore_shadowed( std::shared_ptr ); void remove_all_but( unsigned count ); [[nodiscard]] const std::vector& get_names() const; [[nodiscard]] unsigned count() const; private: const VariableScope scope; Report& report; typedef std::map, Clib::ci_cmp_pred> VariableMap; VariableMap variables_by_name; std::vector names_by_index; }; } // namespace Pol::Bscript::Compiler #endif // POLSERVER_SCRIPTVARIABLES_H