public override void EnterFormalParameter(JavaParser.FormalParameterContext context) { // type of parameter TypeTypeListener typeTypeListener = new TypeTypeListener(); context.typeType().EnterRule(typeTypeListener); TypeName typeName = null; if (typeTypeListener.PrimitiveTypeName != null) { typeName = typeTypeListener.PrimitiveTypeName; } else if (!string.IsNullOrEmpty(typeTypeListener.ID)) { typeName = TypeName.For(typeTypeListener.ID); } else { typeName = PrimitiveTypeName.Void; } // name of parameter VariableDeclaratorIdListener variableDeclaratorIdListener = new VariableDeclaratorIdListener(); context.variableDeclaratorId().EnterRule(variableDeclaratorIdListener); Argument = new Argument(variableDeclaratorIdListener.ID, typeName); }
public UstNode VisitFormalParameter(JavaParser.FormalParameterContext context) { var type = (TypeToken)Visit(context.typeType()); var id = (IdToken)Visit(context.variableDeclaratorId()); var result = new ParameterDeclaration(type, id, context.GetTextSpan(), FileNode); return(result); }