Skip to content

Commit c9fcdb8

Browse files
asgerferik-krogh
andauthored
Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
1 parent a7698b8 commit c9fcdb8

File tree

1 file changed

+10
-8
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks/data/internal

1 file changed

+10
-8
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/Shared.qll

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ class AccessPath extends string {
278278
}
279279

280280
/** Gets the `n`th token on the access path. */
281-
AccessPathToken getToken(int n) { result = getRawToken(n) }
281+
AccessPathToken getToken(int n) { result = this.getRawToken(n) }
282282

283283
/** Gets the number of tokens on the path. */
284-
int getNumToken() { result = count(int n | exists(getRawToken(n))) }
284+
int getNumToken() { result = count(int n | exists(this.getRawToken(n))) }
285285
}
286286

287287
/**
@@ -437,25 +437,27 @@ private API::Node getNodeFromInputOutputPath(API::InvokeNode baseNode, AccessPat
437437
class AccessPathToken extends string {
438438
AccessPathToken() { this = any(AccessPath path).getRawToken(_) }
439439

440-
private string getPart(int part) { result = this.regexpCapture("([^\\[]+)(?:\\[([^\\]]*)\\])?", part) }
440+
private string getPart(int part) {
441+
result = this.regexpCapture("([^\\[]+)(?:\\[([^\\]]*)\\])?", part)
442+
}
441443

442444
/** Gets the name of the token, such as `Member` from `Member[x]` */
443-
string getName() { result = getPart(1) }
445+
string getName() { result = this.getPart(1) }
444446

445447
/**
446448
* Gets the argument list, such as `1,2` from `Member[1,2]`,
447449
* or has no result if there are no arguments.
448450
*/
449-
string getArgumentList() { result = getPart(2) }
451+
string getArgumentList() { result = this.getPart(2) }
450452

451453
/** Gets the `n`th argument to this token, such as `x` or `y` from `Member[x,y]`. */
452-
string getArgument(int n) { result = getArgumentList().splitAt(",", n) }
454+
string getArgument(int n) { result = this.getArgumentList().splitAt(",", n) }
453455

454456
/** Gets an argument to this token, such as `x` or `y` from `Member[x,y]`. */
455-
string getAnArgument() { result = getArgument(_) }
457+
string getAnArgument() { result = this.getArgument(_) }
456458

457459
/** Gets the number of arguments to this token, such as 2 for `Member[x,y]` or zero for `ReturnValue`. */
458-
int getNumArgument() { result = count(int n | exists(getArgument(n))) }
460+
int getNumArgument() { result = count(int n | exists(this.getArgument(n))) }
459461
}
460462

461463
/**

0 commit comments

Comments
 (0)