Package org.teavm.model

Examples of org.teavm.model.MethodDescriptor


    private void generateGetLength(GeneratorContext context, SourceWriter writer) throws IOException {
        String array = context.getParameterName(1);
        writer.append("if (" + array + " === null || " + array + ".constructor.$meta.item === undefined) {")
                .softNewLine().indent();
        String clsName = "java.lang.IllegalArgumentException";
        MethodReference cons = new MethodReference(clsName, new MethodDescriptor("<init>", ValueType.VOID));
        writer.append("$rt_throw(").appendClass(clsName).append(".").appendMethod(cons).append("());").softNewLine();
        writer.outdent().append("}").softNewLine();
        writer.append("return " + array + ".data.length;").softNewLine();
    }
View Full Code Here


        return append(naming.getNameFor(method));
    }

    public SourceWriter appendMethod(String className, String name, ValueType... params)
            throws NamingException, IOException {
        return append(naming.getNameFor(new MethodReference(className, new MethodDescriptor(name, params))));
    }
View Full Code Here

        return append(naming.getFullNameFor(method));
    }

    public SourceWriter appendMethodBody(String className, String name, ValueType... params)
            throws NamingException, IOException {
        return append(naming.getFullNameFor(new MethodReference(className, new MethodDescriptor(name, params))));
    }
View Full Code Here

        if (cls == null || cls.getParent() == null || !cls.getParent().equals("java.lang.Enum")) {
            return;
        }
        allEnums.propagate(agent.getType(className));
        if (enumConstantsStack != null) {
            MethodReader method = cls.getMethod(new MethodDescriptor("values",
                    ValueType.arrayOf(ValueType.object(cls.getName()))));
            if (method != null) {
                agent.linkMethod(method.getReference(), enumConstantsStack).use();
            }
        }
View Full Code Here

    }

    @Override
    public void afterClass(ClassReader cls) throws IOException {
        if (cls.getName().equals("java.lang.Object")) {
            MethodReader toString = cls.getMethod(new MethodDescriptor("toString", String.class));
            if (toString != null) {
                String clsName = context.getNaming().getNameFor(cls.getName());
                String toStringName = context.getNaming().getNameFor(toString.getReference());
                context.getWriter().append(clsName).append(".prototype.toString").ws().append('=').ws()
                        .append("function()").ws().append('{').indent().softNewLine();
View Full Code Here

                if (i > 0) {
                    writer.append(", ");
                }
                String implName = implementations.get(i);
                writer.append("[").appendClass(implName).append(", ").appendMethodBody(
                        new MethodReference(implName, new MethodDescriptor("<init>", ValueType.VOID)))
                        .append("]");
            }
            writer.append("];").softNewLine();
        }
        writer.outdent().append("}").softNewLine();
View Full Code Here

            });
        }
    }

    private void initConstructor(DependencyAgent agent, String type) {
        MethodReference ctor = new MethodReference(type, new MethodDescriptor("<init>", ValueType.VOID));
        agent.linkMethod(ctor, stack).use();
    }
View Full Code Here

    private InvocationExpr parseInvocationExpr(InvocationType invocationType, DataInput input) throws IOException {
        InvocationExpr expr = new InvocationExpr();
        expr.setType(invocationType);
        String className = symbolTable.at(input.readInt());
        MethodDescriptor method = MethodDescriptor.parse(symbolTable.at(input.readInt()));
        expr.setMethod(new MethodReference(className, method));
        int argCount = input.readShort();
        for (int i = 0; i < argCount; ++i) {
            expr.getArguments().add(readExpr(input));
        }
View Full Code Here

        if (method == null) {
            return locationAsString(callFrame.getOriginalLocation());
        }
        StringBuilder sb = new StringBuilder();
        sb.append(classAsString(method.getClassName())).append('.').append(method.getName()).append('(');
        MethodDescriptor desc = method.getDescriptor();
        for (int i = 0; i < desc.parameterCount(); ++i) {
            if (i > 0) {
                sb.append(',');
            }
            sb.append(typeAsString(desc.parameterType(i)));
        }
        sb.append(')');
        if (callFrame.getLocation() != null && callFrame.getLocation().getLine() >= 0) {
            sb.append(" line " + callFrame.getLocation().getLine());
        } else {
View Full Code Here

TOP

Related Classes of org.teavm.model.MethodDescriptor

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.