Пример #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)
        {
            int relPos = context.GetParameterReferencePosition(_argIndex);

            return($"{relPos}");
        }