@@ -40,9 +40,7 @@ class PackageJSON extends JSONObject {
40
40
ContributorInfo getAuthor ( ) { result = getPropValue ( "author" ) }
41
41
42
42
/** Gets information for a contributor to this package. */
43
- ContributorInfo getAContributor ( ) {
44
- result = getPropValue ( "contributors" ) .( JSONArray ) .getElementValue ( _)
45
- }
43
+ ContributorInfo getAContributor ( ) { result = getPropValue ( "contributors" ) .getElementValue ( _) }
46
44
47
45
/** Gets the array of files for this package. */
48
46
JSONArray getFiles ( ) { result = getPropValue ( "files" ) }
@@ -57,13 +55,13 @@ class PackageJSON extends JSONObject {
57
55
string getBin ( string cmd ) {
58
56
cmd = getPackageName ( ) and result = getPropStringValue ( "bin" )
59
57
or
60
- result = getPropValue ( "bin" ) .( JSONObject ) . getPropStringValue ( cmd )
58
+ result = getPropValue ( "bin" ) .getPropValue ( cmd ) . getStringValue ( )
61
59
}
62
60
63
61
/** Gets a manual page for this package. */
64
62
string getAManFile ( ) {
65
63
result = getPropStringValue ( "man" ) or
66
- result = getPropValue ( "man" ) .( JSONArray ) . getElementStringValue ( _ )
64
+ result = getPropValue ( "man" ) .getElementValue ( _ ) . getStringValue ( )
67
65
}
68
66
69
67
/** Gets information about the directories of this package. */
@@ -191,12 +189,12 @@ class BugTrackerInfo extends JSONValue {
191
189
192
190
/** Gets the bug tracker URL. */
193
191
string getUrl ( ) {
194
- result = this .( JSONObject ) . getPropStringValue ( "url" ) or
195
- result = this .( JSONString ) . getValue ( )
192
+ result = this .getPropValue ( "url" ) . getStringValue ( ) or
193
+ result = this .getStringValue ( )
196
194
}
197
195
198
196
/** Gets the bug reporting email address. */
199
- string getEmail ( ) { result = this .( JSONObject ) . getPropStringValue ( "email" ) }
197
+ string getEmail ( ) { result = this .getPropValue ( "email" ) . getStringValue ( ) }
200
198
}
201
199
202
200
/**
@@ -206,7 +204,7 @@ class ContributorInfo extends JSONValue {
206
204
ContributorInfo ( ) {
207
205
exists ( PackageJSON pkg |
208
206
this = pkg .getPropValue ( "author" ) or
209
- this = pkg .getPropValue ( "contributors" ) .( JSONArray ) . getElementValue ( _)
207
+ this = pkg .getPropValue ( "contributors" ) .getElementValue ( _)
210
208
) and
211
209
( this instanceof JSONObject or this instanceof JSONString )
212
210
}
@@ -217,24 +215,24 @@ class ContributorInfo extends JSONValue {
217
215
* homepage URL.
218
216
*/
219
217
private string parseInfo ( int group ) {
220
- result = this .( JSONString ) . getValue ( ) .regexpCapture ( "(.*?)(?: <(.*?)>)?(?: \\((.*)?\\))" , group )
218
+ result = this .getStringValue ( ) .regexpCapture ( "(.*?)(?: <(.*?)>)?(?: \\((.*)?\\))" , group )
221
219
}
222
220
223
221
/** Gets the contributor's name. */
224
222
string getName ( ) {
225
- result = this .( JSONObject ) . getPropStringValue ( "name" ) or
223
+ result = this .getPropValue ( "name" ) . getStringValue ( ) or
226
224
result = parseInfo ( 1 )
227
225
}
228
226
229
227
/** Gets the contributor's email address. */
230
228
string getEmail ( ) {
231
- result = this .( JSONObject ) . getPropStringValue ( "email" ) or
229
+ result = this .getPropValue ( "email" ) . getStringValue ( ) or
232
230
result = parseInfo ( 2 )
233
231
}
234
232
235
233
/** Gets the contributor's homepage URL. */
236
234
string getUrl ( ) {
237
- result = this .( JSONObject ) . getPropStringValue ( "url" ) or
235
+ result = this .getPropValue ( "url" ) . getStringValue ( ) or
238
236
result = parseInfo ( 3 )
239
237
}
240
238
}
0 commit comments