@@ -68,21 +68,25 @@ class ExpressionNode extends AstNode, TExpressionNode {
6868
6969 Job getJob ( ) { result .getAChildNode * ( ) = n }
7070
71+ /**
72+ * Gets the length of each line in the StringValue .
73+ */
7174 int lineLength ( int idx ) {
7275 exists ( string line | line = n .getValue ( ) .splitAt ( "\n" , idx ) and result = line .length ( ) + 1 )
7376 }
7477
75- bindingset [ i]
76- int unboundPartialLineLengthSum ( int i ) {
77- result = sum ( int j , int length | j in [ 0 .. i ] and length = this .lineLength ( j ) | length )
78- }
79-
78+ /**
79+ * Gets the sum of the length of the lines up to the given index.
80+ */
8081 int partialLineLengthSum ( int i ) {
8182 i in [ 0 .. count ( n .getValue ( ) .splitAt ( "\n" ) ) ] and
82- result = this .unboundPartialLineLengthSum ( i )
83+ result = sum ( int j , int length | j in [ 0 .. i ] and length = this .lineLength ( j ) | length )
8384 }
8485
85- predicate expressionOffsets ( int sl , int sc , int el , int ec ) {
86+ /**
87+ * Gets the absolute coordinates of the expression.
88+ */
89+ predicate expressionLocation ( int sl , int sc , int el , int ec ) {
8690 exists ( int lineDiff , string style , Location loc |
8791 loc = n .asYamlNode ( ) .getLocation ( ) and
8892 lineDiff = loc .getEndLine ( ) - loc .getStartLine ( ) and
@@ -164,7 +168,7 @@ class ExpressionNode extends AstNode, TExpressionNode {
164168
165169 predicate hasLocationInfo ( string path , int sl , int sc , int el , int ec ) {
166170 path = n .asYamlNode ( ) .getFile ( ) .getAbsolutePath ( ) and
167- this .expressionOffsets ( sl , sc , el , ec )
171+ this .expressionLocation ( sl , sc , el , ec )
168172 }
169173
170174 override File getFile ( ) { result = n .asYamlNode ( ) .getFile ( ) }
0 commit comments