@@ -68,21 +68,25 @@ class ExpressionNode extends AstNode, TExpressionNode {
68
68
69
69
Job getJob ( ) { result .getAChildNode * ( ) = n }
70
70
71
+ /**
72
+ * Gets the length of each line in the StringValue .
73
+ */
71
74
int lineLength ( int idx ) {
72
75
exists ( string line | line = n .getValue ( ) .splitAt ( "\n" , idx ) and result = line .length ( ) + 1 )
73
76
}
74
77
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
+ */
80
81
int partialLineLengthSum ( int i ) {
81
82
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 )
83
84
}
84
85
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 ) {
86
90
exists ( int lineDiff , string style , Location loc |
87
91
loc = n .asYamlNode ( ) .getLocation ( ) and
88
92
lineDiff = loc .getEndLine ( ) - loc .getStartLine ( ) and
@@ -164,7 +168,7 @@ class ExpressionNode extends AstNode, TExpressionNode {
164
168
165
169
predicate hasLocationInfo ( string path , int sl , int sc , int el , int ec ) {
166
170
path = n .asYamlNode ( ) .getFile ( ) .getAbsolutePath ( ) and
167
- this .expressionOffsets ( sl , sc , el , ec )
171
+ this .expressionLocation ( sl , sc , el , ec )
168
172
}
169
173
170
174
override File getFile ( ) { result = n .asYamlNode ( ) .getFile ( ) }
0 commit comments