Examples of IMethodSignature


Examples of com.strobel.assembler.metadata.IMethodSignature

        if (callSite != null &&
            callSite.getBootstrapArguments().size() >= 3 &&
            callSite.getBootstrapArguments().get(2) instanceof IMethodSignature) {

            final IMethodSignature signature = (IMethodSignature) callSite.getBootstrapArguments().get(2);

            if (signature.getParameters().size() == 1 &&
                signature.getParameters().get(0).getParameterType().getSimpleType() == JvmType.Integer &&
                signature.getReturnType().isArray() &&
                !signature.getReturnType().getElementType().isGenericType()) {

                final LambdaExpression pattern = new LambdaExpression(Expression.MYSTERY_OFFSET);
                final ParameterDeclaration size = new ParameterDeclaration();

                size.setName(Pattern.ANY_STRING);
                size.setAnyModifiers(true);
                size.setType(new OptionalNode(new SimpleType("int")).toType());

                pattern.getParameters().add(new NamedNode("size", size).toParameterDeclaration());

                final ArrayCreationExpression arrayCreation = new ArrayCreationExpression(Expression.MYSTERY_OFFSET);

                arrayCreation.getDimensions().add(new IdentifierExpressionBackReference("size").toExpression());
                arrayCreation.setType(new NamedNode("type", new AnyNode()).toType());

                pattern.setBody(arrayCreation);

                final Match match = pattern.match(node);

                if (match.success()) {
                    final AstType type = first(match.<AstType>get("type"));

                    if (signature.getReturnType().getElementType().isEquivalentTo(type.toTypeReference())) {
                        final MethodGroupExpression replacement = new MethodGroupExpression(
                            Expression.MYSTERY_OFFSET,
                            new TypeReferenceExpression(Expression.MYSTERY_OFFSET, type.clone().makeArrayType()),
                            "new"
                        );
View Full Code Here

Examples of com.strobel.assembler.metadata.IMethodSignature

            if (astBuilder == null) {
                return null;
            }

            final IMethodSignature method = TypeUtilities.getLambdaSignature((LambdaExpression) function);

            if (method == null) {
                return null;
            }

            left = astBuilder.convertType(method.getReturnType(), NO_IMPORT_OPTIONS);
        }

        final Expression right = node.getExpression();

        addCastForAssignment(left, right);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.