junichi11 commented on a change in pull request #2640:
URL: https://github.com/apache/netbeans/pull/2640#discussion_r551651408
##########
File path: php/php.editor/tools/ASTPHP5Parser.cup
##########
@@ -192,6 +192,28 @@ parser code {:
return new ClassName(varleft, propertyListright, dispatch);
}
+ Statement createAttributedStatement(Statement statement, List<Attribute>
attributes) {
+ Statement attributedStatement = statement;
+ if (statement instanceof FunctionDeclaration) {
+ attributedStatement =
FunctionDeclaration.create((FunctionDeclaration) statement, attributes);
+ } else if (statement instanceof ClassDeclaration) {
+ attributedStatement = ClassDeclaration.create((ClassDeclaration)
statement, attributes);
+ } else if (statement instanceof InterfaceDeclaration) {
+ attributedStatement =
InterfaceDeclaration.create((InterfaceDeclaration) statement, attributes);
+ } else if (statement instanceof TraitDeclaration) {
+ attributedStatement = TraitDeclaration.create((TraitDeclaration)
statement, attributes);
+ } else if (statement instanceof FieldsDeclaration) {
+ attributedStatement = FieldsDeclaration.create((FieldsDeclaration)
statement, attributes);
+ } else if (statement instanceof ConstantDeclaration) {
+ attributedStatement =
ConstantDeclaration.create((ConstantDeclaration) statement, attributes);
+ } else if (statement instanceof MethodDeclaration) {
+ attributedStatement = MethodDeclaration.create((MethodDeclaration)
statement, attributes);
+ } else {
+ assert false;
+ }
+ return attributedStatement;
+ }
Review comment:
I've added the static create methods to each node to add attributes
(recreate the node with attributes).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists