2020-08-30 01:32:38 -07:00
|
|
|
#ifndef POLSERVER_LOCALVARIABLESCOPE_H
|
|
|
|
|
#define POLSERVER_LOCALVARIABLESCOPE_H
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/model/SimpleTypes.h"
|
|
|
|
|
#include "bscript/compiler/model/WarnOn.h"
|
2020-08-30 01:32:38 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
class Report;
|
2020-09-12 09:31:52 -07:00
|
|
|
class LocalVariableScopeInfo;
|
2020-08-30 01:32:38 -07:00
|
|
|
class LocalVariableScopes;
|
|
|
|
|
class SourceLocation;
|
|
|
|
|
class Variable;
|
|
|
|
|
|
|
|
|
|
class LocalVariableScope
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit LocalVariableScope( LocalVariableScopes&,
|
2020-09-12 09:31:52 -07:00
|
|
|
LocalVariableScopeInfo& );
|
2020-08-30 01:32:38 -07:00
|
|
|
~LocalVariableScope();
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<Variable> create( const std::string& name, WarnOn, const SourceLocation& );
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
LocalVariableScopes& scopes;
|
|
|
|
|
Report& report;
|
2020-12-01 02:23:03 -08:00
|
|
|
const BlockDepth block_depth;
|
2020-08-30 01:32:38 -07:00
|
|
|
const unsigned prev_locals;
|
|
|
|
|
std::vector<std::shared_ptr<Variable>> shadowing;
|
2020-09-12 09:31:52 -07:00
|
|
|
LocalVariableScopeInfo& local_variable_scope_info;
|
2020-08-30 01:32:38 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
|
|
|
|
|
|
#endif // POLSERVER_LOCALVARIABLESCOPE_H
|