void InlineableFunctionLocator::visit(FunctionCall &call)
{
FunctionDeclaration *def = call.declaration;
- if(def && def->definition!=def)
+ if(def)
def = def->definition;
if(def)
visit_and_inline(*i);
FunctionDeclaration *def = call.declaration;
- if(def && def->definition!=def)
+ if(def)
def = def->definition;
if(def && inlineable.count(def))
if(var.declaration && !assignment_target)
{
VariableInfo &var_info = variables.back()[var.declaration];
- var_info.assignments.clear();
+ clear_assignments(var_info, false);
var_info.referenced = true;
}
}
BlockVariableMap &block_variables = variables.back();
for(BlockVariableMap::iterator i=block_variables.begin(); i!=block_variables.end(); ++i)
if(!i->second.local && i->second.referenced)
- i->second.assignments.clear();
+ clear_assignments(i->second, false);
merge_down_variables();
}
FunctionCall::FunctionCall():
- declaration(0),
- constructor(false)
+ constructor(false),
+ declaration(0)
{ }
FunctionCall::FunctionCall(const FunctionCall &other):
name(other.name),
- declaration(0),
constructor(other.constructor),
- arguments(other.arguments)
+ arguments(other.arguments),
+ declaration(0)
{ }
void FunctionCall::visit(NodeVisitor &visitor)
VariableDeclaration::VariableDeclaration():
constant(false),
- type_declaration(0),
array(false),
+ type_declaration(0),
linked_declaration(0)
{ }
VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
+ layout(other.layout),
constant(other.constant),
sampling(other.sampling),
interpolation(other.interpolation),
interface(other.interface),
precision(other.precision),
type(other.type),
- type_declaration(0),
name(other.name),
array(other.array),
array_size(other.array_size),
init_expression(other.init_expression),
- linked_declaration(0),
- layout(other.layout)
+ type_declaration(0),
+ linked_declaration(0)
{ }
VariableDeclaration::~VariableDeclaration()
return_type(other.return_type),
name(other.name),
parameters(other.parameters),
- definition(other.definition==&other ? this : 0),
- body(other.body)
+ body(other.body),
+ definition(other.definition==&other ? this : 0)
{ }
void FunctionDeclaration::visit(NodeVisitor &visitor)
{
NodeList<Statement> body;
bool use_braces;
+
std::map<std::string, VariableDeclaration *> variables;
Block *parent;
struct VariableReference: Expression
{
std::string name;
+
VariableDeclaration *declaration;
VariableReference();
struct InterfaceBlockReference: Expression
{
std::string name;
+
InterfaceBlock *declaration;
InterfaceBlockReference();
{
NodePtr<Expression> left;
std::string member;
+
VariableDeclaration *declaration;
MemberAccess();
struct Assignment: BinaryExpression
{
bool self_referencing;
+
VariableDeclaration *target_declaration;
Assignment();
struct FunctionCall: Expression
{
std::string name;
- FunctionDeclaration *declaration;
bool constructor;
NodeArray<Expression> arguments;
+ FunctionDeclaration *declaration;
+
FunctionCall();
FunctionCall(const FunctionCall &);
struct VariableDeclaration: Statement
{
+ NodePtr<Layout> layout;
bool constant;
std::string sampling;
std::string interpolation;
std::string interface;
std::string precision;
std::string type;
- StructDeclaration *type_declaration;
std::string name;
bool array;
NodePtr<Expression> array_size;
NodePtr<Expression> init_expression;
+
+ StructDeclaration *type_declaration;
VariableDeclaration *linked_declaration;
- NodePtr<Layout> layout;
VariableDeclaration();
VariableDeclaration(const VariableDeclaration &);
Block members;
std::string instance_name;
bool array;
+
InterfaceBlock *linked_block;
InterfaceBlock();
std::string return_type;
std::string name;
NodeArray<VariableDeclaration> parameters;
- FunctionDeclaration *definition;
Block body;
+ FunctionDeclaration *definition;
+
FunctionDeclaration();
FunctionDeclaration(const FunctionDeclaration &);