2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/model/Variable.h"
|
2020-08-25 00:57:03 -07:00
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
2020-12-01 02:23:03 -08:00
|
|
|
Variable::Variable( VariableScope scope, std::string name, BlockDepth block_depth,
|
2024-07-29 22:30:52 +02:00
|
|
|
VariableIndex index, WarnOn warn_on, std::shared_ptr<Variable> capturing,
|
|
|
|
|
const SourceLocation& source_location )
|
|
|
|
|
: scope( scope ),
|
|
|
|
|
name( std::move( name ) ),
|
|
|
|
|
block_depth( block_depth ),
|
|
|
|
|
index( index ),
|
|
|
|
|
warn_on( warn_on ),
|
|
|
|
|
source_location( source_location ),
|
|
|
|
|
capturing( std::move( capturing ) ),
|
|
|
|
|
used( false )
|
2020-08-25 00:57:03 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Variable::mark_used()
|
|
|
|
|
{
|
|
|
|
|
used = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Variable::was_used() const
|
|
|
|
|
{
|
|
|
|
|
return used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|