Package com.asakusafw.utils.java.internal.parser.javadoc.ir

Examples of com.asakusafw.utils.java.internal.parser.javadoc.ir.IrDocMethodParameter


            IrDocMethod method = (IrDocMethod) fragments.get(0);
            assertNull(method.getDeclaringType());
            assertEquals("method", method.getName().getIdentifier());
            assertEquals(1, method.getParameters().size());
            {
                IrDocMethodParameter param = method.getParameters().get(0);
                assertEquals(BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
            }
        }
    }
View Full Code Here


            assertNotNull(elem);
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("abs", elem.getName().asString());
            assertEquals(1, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertNull(param.getName());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Math#abs(int number)");
            IrDocMethod elem = JavadocBlockParserUtil.fetchMethod(scanner, null);
            assertNotNull(elem);
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("abs", elem.getName().asString());
            assertEquals(1, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("number", param.getName().getIdentifier());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Arrays#asList(Object...)");
            IrDocMethod elem = JavadocBlockParserUtil.fetchMethod(scanner, null);
            assertNotNull(elem);
            assertEquals("Arrays", elem.getDeclaringType().getName().asString());
            assertEquals("asList", elem.getName().asString());
            assertEquals(1, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.NAMED_TYPE, param.getType().getKind());
                assertEquals("Object", ((IrDocNamedType) param.getType()).getName().asString());
                assertTrue(param.isVariableArity());
                assertNull(param.getName());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Arrays#asList(Object...elems)");
            IrDocMethod elem = JavadocBlockParserUtil.fetchMethod(scanner, null);
            assertNotNull(elem);
            assertEquals("Arrays", elem.getDeclaringType().getName().asString());
            assertEquals("asList", elem.getName().asString());
            assertEquals(1, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.NAMED_TYPE, param.getType().getKind());
                assertEquals("Object", ((IrDocNamedType) param.getType()).getName().asString());
                assertTrue(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("elems", param.getName().getIdentifier());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Math#max(int, int)");
            IrDocMethod elem = JavadocBlockParserUtil.fetchMethod(scanner, null);
            assertNotNull(elem);
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("max", elem.getName().asString());
            assertEquals(2, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNull(param.getName());
            }
            {
                IrDocMethodParameter param = elem.getParameters().get(1);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNull(param.getName());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("Math#max(int a, int b)");
            IrDocMethod elem = JavadocBlockParserUtil.fetchMethod(scanner, null);
            assertNotNull(elem);
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("max", elem.getName().asString());
            assertEquals(2, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("a", param.getName().getIdentifier());
            }
            {
                IrDocMethodParameter param = elem.getParameters().get(1);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("b", param.getName().getIdentifier());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
        {
            DefaultJavadocScanner scanner = string("/Math#max(int a, int b)");
View Full Code Here

            IrDocMethod elem = (IrDocMethod) target;
            assertEquals("Math", elem.getDeclaringType().getName().asString());
            assertEquals("max", elem.getName().asString());
            assertEquals(2, elem.getParameters().size());
            {
                IrDocMethodParameter param = elem.getParameters().get(0);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("a", param.getName().getIdentifier());
            }
            {
                IrDocMethodParameter param = elem.getParameters().get(1);
                assertEquals(IrDocElementKind.BASIC_TYPE, param.getType().getKind());
                assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind());
                assertFalse(param.isVariableArity());
                assertNotNull(param.getName());
                assertEquals("b", param.getName().getIdentifier());
            }
            assertEquals(EOF, scanner.lookahead(0).getKind());
        }
    }
View Full Code Here

            return null;
        }

        JavadocToken delim;
        List<IrDocMethodParameter> parameters;
        IrDocMethodParameter first = fetchMethodParameter(stream);
        if (first == null) {
            delim = consumeIfMatch(stream, RIGHT_PAREN);
            if (delim == null) {
                stream.rewind();
                return null;
            }
            parameters = Collections.emptyList();
        } else {
            parameters = new ArrayList<IrDocMethodParameter>();
            parameters.add(first);
            while (true) {
                delim = stream.nextToken();
                if (delim.getKind() == RIGHT_PAREN) {
                    break;
                } else if (delim.getKind() == COMMA) {
                    IrDocMethodParameter p = fetchMethodParameter(stream);
                    if (p == null) {
                        stream.rewind();
                        return null;
                    }
                    parameters.add(p);
View Full Code Here

        IrDocSimpleName name = fetchSimpleName(stream);
        if (name != null) {
            delim = name.getLocation();
        }

        IrDocMethodParameter elem = new IrDocMethodParameter();
        elem.setType(type);
        elem.setVariableArity(varargs);
        elem.setName(name);
        setLocation(elem, type.getLocation(), delim);
        return elem;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.internal.parser.javadoc.ir.IrDocMethodParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.