Ejemplo n.º 1
0
        private void EmitLocalsDebugInfo(AbcCode code)
        {
            if (!IsEmitDebugInfo)
            {
                return;
            }

            const int regShift  = -1;
            var       firstLine = DebugFirstLine;

            //if (HasActivationVar)
            //{
            //    code.DebugLocalInfo(0, ThisTraitName + "$0", 0);
            //}

            if (HasPseudoThis)
            {
                code.DebugLocalInfo(0, "pfx$pseudo_this", firstLine);
            }

            int n = _method.Parameters.Count;

            for (int i = 0; i < n; ++i)
            {
                IParameter p    = _method.Parameters[i];
                int        slot = GetArgIndex(p);
                code.DebugLocalInfo(slot + regShift, p.Name, firstLine);
            }

            if (HasActivationVar)
            {
                code.DebugLocalInfo(_activationVar + regShift, ThisTraitName + "$0", firstLine);
            }

            if (HasLocalVariables)
            {
                n = VarCount;
                for (int i = 0; i < n; ++i)
                {
                    var v = GetVar(i);
                    if (v.IsAddressed)
                    {
                        continue;
                    }
                    int slot = GetVarIndex(i);
                    code.DebugLocalInfo(slot + regShift, v.Name, firstLine);
                }
            }
        }