Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data generation stores types as int, language still treats them as a Type object #48

Closed
ankuraga1508 opened this issue May 10, 2016 · 1 comment

Comments

@ankuraga1508
Copy link
Contributor

ankuraga1508 commented May 10, 2016

VoidMethodsTotal: output sum of int;
VoidMethodsMax: output maximum(1) of string weight int;
VoidMethodsMin: output minimum(1) of string weight int;
VoidMethodsMean: output mean of int;

p: Project = input;

void_meth_cur_val := 0;
void_meth_s: stack of int;

q15 := visitor {
    before node: CodeRepository -> {
        snapshot := getsnapshot(node, "SOURCE_JAVA_JLS");
        foreach (i: int; def(snapshot[i]))
            visit(snapshot[i]);
        stop;
    }
    before node: Declaration ->
        if (node.kind == TypeKind.CLASS || node.kind == TypeKind.ANONYMOUS) {
            push(void_meth_s, void_meth_cur_val);
            void_meth_cur_val = 0;
        } else
            stop;
    after node: Declaration -> {
        VoidMethodsTotal << void_meth_cur_val;
        if (void_meth_cur_val > 0) {
            VoidMethodsMax << p.id weight void_meth_cur_val;
            VoidMethodsMin << p.id weight void_meth_cur_val;
            VoidMethodsMean << void_meth_cur_val;
        }
        void_meth_cur_val = pop(void_meth_s);
    }
    before node: Method ->
        if (node.return_type.name == "void")
            void_meth_cur_val++;
};

visit(p, q15);

error: int cannot be dereferenced if (___node.getReturnType().getName().equals("void"))

Return type for getName is int here for Type class.

@psybers psybers added the bug label May 25, 2016
@psybers psybers changed the title Java code gen error : Cannot be dereferenced Data generation stores types as int, language still treats them as a Type object Dec 20, 2016
@psybers
Copy link
Member

psybers commented Apr 15, 2017

This was fixed in #100

@psybers psybers closed this as completed Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants