} // proc SetChunk public void AddDebugInfo(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint) { if (debugInfos == null) { debugInfos = new List <LuaDebugInfo>(); } var info = new LuaDebugInfo(ChunkName, method.Name, sequencePoint.Document, ilOffset, sequencePoint.StartLine, sequencePoint.StartColumn); var pos = debugInfos.BinarySearch(info); if (pos < 0) { debugInfos.Insert(~pos, info); } else { debugInfos[pos] = info; } } // proc AddDebugInfo
} // func GetMethodRange protected internal override ILuaDebugInfo GetDebugInfo(MethodBase method, int ilOffset) { LuaDebugInfo info = null; // find method range int iStart; int iEnd; if (!GetMethodRange(method.Name, out iStart, out iEnd)) { return(null); } // find debug info if (debugInfos != null) { for (int i = iStart; i <= iEnd; i++) { if (debugInfos[i].ILOffset <= ilOffset) { info = debugInfos[i]; } else if (debugInfos[i].ILOffset > ilOffset) { break; } } } // clear debug if (info != null && info.IsClear) { info = null; } return(info); } // func GetDebugInfo