mattunlv / ProcessJ-main-branch-old

ProcessJ Compiler Project
2 stars 4 forks source link

Code generation for external types #19

Closed mattunlv closed 7 years ago

mattunlv commented 7 years ago

darkwing:ProcessJ matt$ more externtest.pj

import std.io; import std.number;

public proc void main(string args[])[yield=true] { Integer i; i = makeInteger(7); int j = getValueInteger(i); println(j);

} darkwing:ProcessJ matt$ more Include/JVM/std/number.pj

pragma LIBRARY;

pragma NATIVE;

pragma FILE "number";

pragma LANGUAGE "JVM";

package std;

extern java.lang.Integer Integer

public proc Integer makeInteger(int value) ;

public proc int getValueInteger(Integer i) ;

darkwing:ProcessJ matt$ more Lib/JVM/std/number.java package std;

public class number { public static java.lang.Integer makeInteger(int value) { return new java.lang.Integer(value); }

public static int getValueInteger(java.lang.Integer i) {
    return i.intValue();
}

}

darkwing:ProcessJ matt$ more externtest.pj

import std.io; import std.number;

public proc void main(string args[])[yield=true] { Integer i; i = makeInteger(7); int j = getValueInteger(i); println(j);
}

generates:

public static class procMain extends PJProcess { String[] _pd$args; null _ld1$i; int _ld2$j;

        public procMain(String[] _pd$args) {
            this._pd$args = _pd$args;
        }
...

the null is wrong - I should be the extern type name (here; java.lang.Integer)

cabelshrestha commented 7 years ago

Fixed and the code has been pushed into master.

mattunlv commented 7 years ago

Hey Cabel,

when you say ‘fixed’ are you referring to that strange bug that I cannot for the life of me explain ????

fingerscrossed* cause we are DEAD in the water right now …

Matt


On Feb 22, 2017, at 05:47, Cabel Shrestha notifications@github.com wrote:

Closed #19 https://github.com/mattunlv/ProcessJ/issues/19.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattunlv/ProcessJ/issues/19#event-972561233, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFQHV0wDPBnKSKPho3yamCOWqj20PtHks5rfDx9gaJpZM4LJdc8.