JS: eliminate redundant ConstantString casts

This commit is contained in:
Esben Sparre Andreasen
2019-09-11 10:51:25 +02:00
parent 16c95d8c5e
commit aab17850d1
13 changed files with 18 additions and 18 deletions

View File

@@ -5,10 +5,10 @@ class ResolveCall extends CallExpr {
Variable getVariable() { result = this.getArgument(0).(VarUse).getVariable() }
string getExpectation() { result = this.getArgument(1).(ConstantString).getStringValue() }
string getExpectation() { result = this.getArgument(1).getStringValue() }
string getDeclaredValue() {
result = getVariable().getAnAssignedExpr().(ConstantString).getStringValue()
result = getVariable().getAnAssignedExpr().getStringValue()
or
exists(NamespaceDeclaration decl | decl.getId() = getVariable().getADeclaration() |
result = getNamespaceName(decl)
@@ -17,7 +17,7 @@ class ResolveCall extends CallExpr {
}
string getNamespaceName(NamespaceDeclaration decl) {
result = decl.getStmt(0).(ExprStmt).getExpr().(ConstantString).getStringValue()
result = decl.getStmt(0).(ExprStmt).getExpr().getStringValue()
or
not decl.getStmt(0).(ExprStmt).getExpr() instanceof ConstantString and
result = "Namespace " + decl.getId() + " on line " +

View File

@@ -50,7 +50,7 @@ class OspreyMethodDefinition extends MethodCallExpr {
string getVerb() { result = getMethodName() }
/** Get the resource path to which this method belongs. */
string getResourcePath() { result = getArgument(0).(ConstantString).getStringValue() }
string getResourcePath() { result = getArgument(0).getStringValue() }
}
/** A callback function bound to a REST method. */