swp-uebersetzerbau-ss13 / common

Shared files between teams.
1 stars 0 forks source link

Incomplete ASTNode interface #19

Closed Tkrauss closed 11 years ago

Tkrauss commented 11 years ago

Shouldn't there exists a setChildren(list)-method or -- probably the smarter solution -- a addChildren(Node) and a removeChildren(Node) method? Is it a problem to add this?

fub-frank commented 11 years ago

The different types of nodes do not have a addChildren method. Instead they have named methods like

or methods like (in cases of a fixed number of nodes)

AddChildren could be difficult for some node types. E.g. BlockNode has Statements and Declarations. When you call addChild it is unknown whether to add the node to the List of Statements or the List of Declarations.

The removeChildren method does not exist indeed. Is it needed by a component? Then we need to add it.

Tkrauss commented 11 years ago

Ah okay, thanks for your answer. Just want to make sure that this behavior is wanted. I think it's possible to use that... Anyway .... , if it'll be a problem later, we will discuss when it's time;).