Пример #1
0
        public override object ConvertParameter(CompilerMethodContext context, ILOperation operation)
        {
            List <string> refList    = new List <string>();
            bool          isInstance = !context.Method.IsStatic;

            for (int i = 0; i < context.Method.GetParameters().Length; i++)
            {
                if (context.Method.GetParameters()[i].ParameterType.IsReferenceCounted())
                {
                    refList.Add(context.GetParameterReferencePosition(i + (isInstance ? 1 : 0)).ToString());
                }
            }

            var body      = context.Method.GetMethodBody();
            var variables = body.LocalVariables;

            for (int i = 0; i < variables.Count; i++)
            {
                if (variables[i].LocalType.IsReferenceCounted())
                {
                    refList.Add(context.GetLocalVariableReferencePosition(i).ToString());
                }
            }

            return($"{context.GetLocalStackSize()}, [{string.Join(',', refList)}]");
        }
Пример #2
0
        public override object ConvertParameter(CompilerMethodContext context, ILOperation operation)
        {
            var body      = context.Method.GetMethodBody();
            var variables = body.LocalVariables;
            var index     = context.GetLocalVariableReferencePosition((int)operation.RawParameter);
            var isRef     = variables[(int)operation.RawParameter].LocalType.IsReferenceCounted() ? "1" : "0";

            return($"{index}, {isRef}");
        }
Пример #3
0
        public override object ConvertParameter(CompilerMethodContext context, ILOperation operation)
        {
            var refPos = context.GetLocalVariableReferencePosition(_varIndex);

            return($"{refPos}, {_value}");
        }
Пример #4
0
        public override object ConvertParameter(CompilerMethodContext context, ILOperation operation)
        {
            int relPos = context.GetLocalVariableReferencePosition((int)operation.RawParameter);

            return($"{relPos}");
        }