Skip to content

Commit d0d3882

Browse files
authored
Merge pull request #1919 from esben-semmle/js/fixup-1
Approved by asger-semmle, xiemaisi
2 parents 1313821 + 0e31cad commit d0d3882

File tree

18 files changed

+29
-29
lines changed

18 files changed

+29
-29
lines changed

javascript/ql/src/Declarations/DeadStore.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ predicate isDefaultInit(Expr e) {
1212
// primitive default values: zero, false, empty string, and (integer) -1
1313
e.(NumberLiteral).getValue().toFloat() = 0.0 or
1414
e.(NegExpr).getOperand().(NumberLiteral).getValue() = "1" or
15-
e.(ConstantString).getStringValue() = "" or
15+
e.getStringValue() = "" or
1616
e.(BooleanLiteral).getValue() = "false" or
1717
// initialising to an empty array or object literal, even if unnecessary,
1818
// can convey useful type information to the reader

javascript/ql/src/Expressions/HapaxLegomenon.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int countOccurrences(string name) {
2323
id.(Identifier).getName() = name
2424
or
2525
// count string literals as well to capture meta-programming
26-
id.(ConstantString).getStringValue() = name
26+
id.getStringValue() = name
2727
)
2828
}
2929

javascript/ql/src/Security/CWE-798/HardcodedCredentials.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ where
2222
// use source value in message if it's available
2323
if source.getNode().asExpr() instanceof ConstantString
2424
then
25-
value = "The hard-coded value \"" + source.getNode().asExpr().(ConstantString).getStringValue() +
25+
value = "The hard-coded value \"" + source.getNode().getStringValue() +
2626
"\""
2727
else value = "This hard-coded value"
2828
select source.getNode(), source, sink, value + " is used as $@.", sink.getNode(),

javascript/ql/src/semmle/javascript/AMD.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private class AmdDependencyPath extends PathExprCandidate {
189189
private class ConstantAmdDependencyPathElement extends PathExprInModule, ConstantString {
190190
ConstantAmdDependencyPathElement() { this = any(AmdDependencyPath amd).getAPart() }
191191

192-
override string getValue() { result = this.(ConstantString).getStringValue() }
192+
override string getValue() { result = getStringValue() }
193193
}
194194

195195
/**

javascript/ql/src/semmle/javascript/Closure.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module Closure {
5656
ClosureNamespaceRef::Range {
5757
DefaultNamespaceRef() { this = DataFlow::globalVarRef("goog").getAMethodCall() }
5858

59-
override string getClosureNamespace() { result = getArgument(0).asExpr().getStringValue() }
59+
override string getClosureNamespace() { result = getArgument(0).getStringValue() }
6060
}
6161

6262
/**

javascript/ql/src/semmle/javascript/ES2015Modules.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ImportDeclaration extends Stmt, Import, @importdeclaration {
8282
private class LiteralImportPath extends PathExprInModule, ConstantString {
8383
LiteralImportPath() { exists(ImportDeclaration req | this = req.getChildExpr(-1)) }
8484

85-
override string getValue() { result = this.(ConstantString).getStringValue() }
85+
override string getValue() { result = getStringValue() }
8686
}
8787

8888
/**
@@ -596,7 +596,7 @@ abstract class ReExportDeclaration extends ExportDeclaration {
596596
private class LiteralReExportPath extends PathExprInModule, ConstantString {
597597
LiteralReExportPath() { exists(ReExportDeclaration bred | this = bred.getImportedPath()) }
598598

599-
override string getValue() { result = this.(ConstantString).getStringValue() }
599+
override string getValue() { result = getStringValue() }
600600
}
601601

602602
/**

javascript/ql/src/semmle/javascript/Expr.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ private class LiteralDynamicImportPath extends PathExprInModule, ConstantString
26002600
exists(DynamicImportExpr di | this.getParentExpr*() = di.getSource())
26012601
}
26022602

2603-
override string getValue() { result = this.(ConstantString).getStringValue() }
2603+
override string getValue() { result = getStringValue() }
26042604
}
26052605

26062606
/**

javascript/ql/src/semmle/javascript/NodeJS.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ private class RequirePath extends PathExprCandidate {
269269
private class ConstantRequirePathElement extends PathExprInModule, ConstantString {
270270
ConstantRequirePathElement() { this = any(RequirePath rp).getAPart() }
271271

272-
override string getValue() { result = this.getStringValue() }
272+
override string getValue() { result = getStringValue() }
273273
}
274274

275275
/** A `__dirname` path expression. */

javascript/ql/src/semmle/javascript/StandardLibrary.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CallToObjectDefineProperty extends DataFlow::MethodCallNode {
1717
DataFlow::Node getBaseObject() { result = getArgument(0) }
1818

1919
/** Gets the name of the property being defined, if it can be determined. */
20-
string getPropertyName() { result = getArgument(1).asExpr().(ConstantString).getStringValue() }
20+
string getPropertyName() { result = getArgument(1).getStringValue() }
2121

2222
/** Gets the data flow node denoting the descriptor of the property being defined. */
2323
DataFlow::Node getPropertyDescriptor() { result = getArgument(2) }

javascript/ql/src/semmle/javascript/TypeScript.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private class LiteralExternalModulePath extends PathExprInModule, ConstantString
222222
exists(ExternalModuleReference emr | this.getParentExpr*() = emr.getExpression())
223223
}
224224

225-
override string getValue() { result = this.(ConstantString).getStringValue() }
225+
override string getValue() { result = getStringValue() }
226226
}
227227

228228
/** A TypeScript "export-assign" declaration. */

0 commit comments

Comments
 (0)