@@ -40,9 +40,7 @@ class PackageJSON extends JSONObject {
4040 ContributorInfo getAuthor ( ) { result = getPropValue ( "author" ) }
4141
4242 /** 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 ( _) }
4644
4745 /** Gets the array of files for this package. */
4846 JSONArray getFiles ( ) { result = getPropValue ( "files" ) }
@@ -57,13 +55,13 @@ class PackageJSON extends JSONObject {
5755 string getBin ( string cmd ) {
5856 cmd = getPackageName ( ) and result = getPropStringValue ( "bin" )
5957 or
60- result = getPropValue ( "bin" ) .( JSONObject ) . getPropStringValue ( cmd )
58+ result = getPropValue ( "bin" ) .getPropValue ( cmd ) . getStringValue ( )
6159 }
6260
6361 /** Gets a manual page for this package. */
6462 string getAManFile ( ) {
6563 result = getPropStringValue ( "man" ) or
66- result = getPropValue ( "man" ) .( JSONArray ) . getElementStringValue ( _ )
64+ result = getPropValue ( "man" ) .getElementValue ( _ ) . getStringValue ( )
6765 }
6866
6967 /** Gets information about the directories of this package. */
@@ -191,12 +189,12 @@ class BugTrackerInfo extends JSONValue {
191189
192190 /** Gets the bug tracker URL. */
193191 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 ( )
196194 }
197195
198196 /** Gets the bug reporting email address. */
199- string getEmail ( ) { result = this .( JSONObject ) . getPropStringValue ( "email" ) }
197+ string getEmail ( ) { result = this .getPropValue ( "email" ) . getStringValue ( ) }
200198}
201199
202200/**
@@ -206,7 +204,7 @@ class ContributorInfo extends JSONValue {
206204 ContributorInfo ( ) {
207205 exists ( PackageJSON pkg |
208206 this = pkg .getPropValue ( "author" ) or
209- this = pkg .getPropValue ( "contributors" ) .( JSONArray ) . getElementValue ( _)
207+ this = pkg .getPropValue ( "contributors" ) .getElementValue ( _)
210208 ) and
211209 ( this instanceof JSONObject or this instanceof JSONString )
212210 }
@@ -217,24 +215,24 @@ class ContributorInfo extends JSONValue {
217215 * homepage URL.
218216 */
219217 private string parseInfo ( int group ) {
220- result = this .( JSONString ) . getValue ( ) .regexpCapture ( "(.*?)(?: <(.*?)>)?(?: \\((.*)?\\))" , group )
218+ result = this .getStringValue ( ) .regexpCapture ( "(.*?)(?: <(.*?)>)?(?: \\((.*)?\\))" , group )
221219 }
222220
223221 /** Gets the contributor's name. */
224222 string getName ( ) {
225- result = this .( JSONObject ) . getPropStringValue ( "name" ) or
223+ result = this .getPropValue ( "name" ) . getStringValue ( ) or
226224 result = parseInfo ( 1 )
227225 }
228226
229227 /** Gets the contributor's email address. */
230228 string getEmail ( ) {
231- result = this .( JSONObject ) . getPropStringValue ( "email" ) or
229+ result = this .getPropValue ( "email" ) . getStringValue ( ) or
232230 result = parseInfo ( 2 )
233231 }
234232
235233 /** Gets the contributor's homepage URL. */
236234 string getUrl ( ) {
237- result = this .( JSONObject ) . getPropStringValue ( "url" ) or
235+ result = this .getPropValue ( "url" ) . getStringValue ( ) or
238236 result = parseInfo ( 3 )
239237 }
240238}
0 commit comments