Example #1
0
        public FlatOperand Resolve(IMethodSymbol 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;
            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));
        }
Example #2
0
            public void Add(IMethodSymbol ms)
            {
                if (IsLibrary)
                    return;
                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 LS2ILMethodException("Method not found " + ms.ToString());
                }

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

                // input declarations
                fab.Add(GenerateInputDeclarations(ms).GetFlatValue());

                Members.Add(fab.GetFlatValue());
            }