X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramsyntax.cpp;h=098130f87c2e4920597eadb2838295b782dbf740;hb=f632bf388a58b036e265f3789c797beff5ab063a;hp=6e4d070e2b3e480cd29b09ccabbb7e7ae4194415;hpb=a29cc14162e911b36d18d1d1896216697c7dc0c1;p=libs%2Fgl.git diff --git a/source/programsyntax.cpp b/source/programsyntax.cpp index 6e4d070e..098130f8 100644 --- a/source/programsyntax.cpp +++ b/source/programsyntax.cpp @@ -54,17 +54,25 @@ void UnaryExpression::visit(NodeVisitor &visitor) } -BinaryExpression::BinaryExpression(): - assignment(false) +void BinaryExpression::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + +Assignment::Assignment(): + self_referencing(false), + target_declaration(0) { } -void BinaryExpression::visit(NodeVisitor &visitor) +void Assignment::visit(NodeVisitor &visitor) { visitor.visit(*this); } FunctionCall::FunctionCall(): + declaration(0), constructor(false) { } @@ -80,6 +88,12 @@ void ExpressionStatement::visit(NodeVisitor &visitor) } +void Import::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + void Layout::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -110,7 +124,8 @@ void VariableDeclaration::visit(NodeVisitor &visitor) } -InterfaceBlock::InterfaceBlock() +InterfaceBlock::InterfaceBlock(): + array(false) { members.use_braces = true; } @@ -122,7 +137,15 @@ void InterfaceBlock::visit(NodeVisitor &visitor) FunctionDeclaration::FunctionDeclaration(): - definition(false) + definition(0) +{ } + +FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other): + return_type(other.return_type), + name(other.name), + parameters(other.parameters), + definition(other.definition==&other ? this : other.definition), + body(other.body) { } void FunctionDeclaration::visit(NodeVisitor &visitor) @@ -137,6 +160,12 @@ void Conditional::visit(NodeVisitor &visitor) } +void Iteration::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + void Passthrough::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -149,9 +178,9 @@ void Return::visit(NodeVisitor &visitor) } -void Iteration::visit(NodeVisitor &visitor) +void NodeVisitor::visit(Assignment &assign) { - visitor.visit(*this); + visit(static_cast(assign)); }