Exemple #1
0
    internal override GFunction ToGFunction()
    {
        string code;
        XType  xt = Stack.Peek(0).GetRestricted();

        if (xt == XType.BOOL || xt == XType.U8 || xt == XType.I8)
        {
            code = "T1_PUSH_U8(T1_TOS_U8());";
        }
        else if (xt == XType.U16 || xt == XType.I16)
        {
            code = "T1_PUSH_U16(T1_TOS_U16());";
        }
        else if (xt == XType.U32 || xt == XType.I32)
        {
            code = "T1_PUSH_U32(T1_TOS_U32());";
        }
        else if (xt == XType.U64 || xt == XType.I64)
        {
            code = "T1_PUSH_U64(T1_TOS_U64());";
        }
        else if (xt == null)
        {
            code = "T1_PUSH_REF(T1_TOS_REF());";
        }
        else
        {
            throw new Exception(string.Format("unknown restricted type: {0}", xt.Name));
        }
        return(GFunctionNative.Add(f, code));
    }
Exemple #2
0
    internal static GFunctionNative Add(Function f, string code)
    {
        GFunctionNative gf;
        SortedDictionary <string, GFunctionNative> d;

        if (!ALL.TryGetValue(f, out d))
        {
            d = new SortedDictionary <string, GFunctionNative>(
                StringComparer.Ordinal);
            ALL[f]  = d;
            gf      = new GFunctionNative(f, code);
            d[code] = gf;
            return(gf);
        }
        if (!d.TryGetValue(code, out gf))
        {
            gf      = new GFunctionNative(f, code);
            d[code] = gf;
        }
        return(gf);
    }
Exemple #3
0
 internal override GFunction ToGFunction()
 {
     // FIXME
     return(GFunctionNative.Add(fn, "NYI"));
 }