Exemple #1
0
        public override void EnterVariableDeclarator(JavaParser.VariableDeclaratorContext context)
        {
            VariableDeclaratorIdListener variableDeclaratorIdListener = new VariableDeclaratorIdListener();

            context.variableDeclaratorId().EnterRule(variableDeclaratorIdListener);
            ID = variableDeclaratorIdListener.ID;
        }
Exemple #2
0
        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);
        }