public override void PostWalk(FunctionDefinition node) { int start = node.GetStart(_ast).Line; int end = node.Body.GetEnd(_ast).Line + 1; if (_lineNumber < start || _lineNumber >= end) { return; } string funcName = node.Name; if (_name.Length == 0 && funcName != _expectedFuncName) { // The innermost function name must match the one that we've got from the code object. // If it doesn't, the source code that we're parsing is out of sync with the running program, // and cannot be used to compute the fully qualified name. throw new InvalidDataException(); } for (var classDef = node.Parent as ClassDefinition; classDef != null; classDef = classDef.Parent as ClassDefinition) { funcName = classDef.Name + "." + funcName; } if (_name.Length != 0) { _name.Append(" in "); } _name.Append(funcName); }
public override bool Walk(FunctionDefinition node) { var start = node.GetStart(_root); var end = node.GetEnd(_root); if (start.Line <= _line && end.Line >= _line) { FunctionName = node.Name; } return base.Walk(node); }