Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit e6164dc

Browse files
author
Mikhail Arkhipov
committed
Use index
1 parent d713701 commit e6164dc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Analysis/Engine/Impl/ModuleAnalysis.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ private bool IsFunctionArgument(IScope scope, IAnalysisVariable v) {
275275
return true;
276276
}
277277
if (scope is FunctionScope funcScope) {
278-
var def = funcScope.Function.FunctionDefinition;
279-
// TODO: Use indexes rather than lines to check location
280-
return v.Location.StartLine == def.GetStart(def.GlobalParent).Line;
278+
var funcDef = funcScope.Function.FunctionDefinition;
279+
var varSpan = v.Location.Span.ToLinearSpan(_unit.Tree);
280+
return funcDef.NameExpression.EndIndex <= varSpan.Start && varSpan.End <= funcDef.HeaderIndex;
281281
}
282282
return false;
283283
}

0 commit comments

Comments
 (0)