Beispiel #1
0
            public void Add(MethodSymbol ms)
            {
                FlatArrayBuilder fab = new FlatArrayBuilder();
                fab.Add(FlatValue.Int32(ms.IsStatic ? (int)ClassMemberType.StaticMethod : (int)ClassMemberType.Method));
                fab.Add(FlatValue.String(ms.GetFullyQualifiedName()));

                Function f;
                if (!Chunk.Functions.TryGetValue(ms, out f))
                {
                    throw new NotImplementedException("Method not found " + ms.ToString());
                }

                fab.Add(FlatValue.Int32(f.NumFunction));

                Members.Add(fab.GetFlatValue());
            }
Beispiel #2
0
        public FlatOperand Resolve(MethodSymbol method, FlatOperand fop_type, FlatOperand into_lvalue, List<FlatStatement> instructions)
        {
            string method_name = method.GetFullyQualifiedName();

            if (into_lvalue == null)
            {
                FlatOperand register_fop = AllocateRegister("");
                into_lvalue = register_fop.GetLValue(this, instructions);
            }

            FlatOperand fop_methodname = FlatOperand.Immediate(FlatValue.String(method_name));

            if (method.IsStatic)
            {
                instructions.Add(FlatStatement.RESOLVESTATICMETHOD(into_lvalue,fop_type,fop_methodname));
                return into_lvalue.AsRValue(FlatValue.StaticMethod(method));
            }

            instructions.Add(FlatStatement.RESOLVEMETHOD(into_lvalue, fop_type, fop_methodname));
            return into_lvalue.AsRValue(FlatValue.Method(method));
        }