X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramsyntax.cpp;h=098130f87c2e4920597eadb2838295b782dbf740;hb=e55f79ccb21e8c1be3d86f127e3ec1583e58ce92;hp=4341f06b72c4542393c052d62c39acccb80fe53e;hpb=7cd066816f7faab6f8f0eba1fca4dee67ee5dc3b;p=libs%2Fgl.git diff --git a/source/programsyntax.cpp b/source/programsyntax.cpp index 4341f06b..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) @@ -155,6 +178,12 @@ void Return::visit(NodeVisitor &visitor) } +void NodeVisitor::visit(Assignment &assign) +{ + visit(static_cast(assign)); +} + + void TraversingVisitor::visit(Block &block) { for(list >::iterator i=block.body.begin(); i!=block.body.end(); ++i)