mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Ruby: address review feedback
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Whereas `ConstantValue::getString()` previously returned both string and regular-expression values, it now returns only string values. The same applies to `ConstantValue::isString(value)`.
|
||||
* Regular-expression values can now be accessed with the new predicates `ConstantValue::getRegExp()`, `ConstantValue::isRegExp(value)`, and `ConstantValue::isRegExpWithFlags(value, flags).
|
||||
* Regular-expression values can now be accessed with the new predicates `ConstantValue::getRegExp()`, `ConstantValue::isRegExp(value)`, and `ConstantValue::isRegExpWithFlags(value, flags)`.
|
||||
|
||||
@@ -74,7 +74,7 @@ class ConstantValue extends TConstantValue {
|
||||
/** Gets the regexp value, if this is a regexp. */
|
||||
string getRegExp() { this.isRegExpWithFlags(result, _) }
|
||||
|
||||
/** Holds if this is the regexp value `/s/`. */
|
||||
/** Holds if this is the regexp value `/s/`, ignoring any flags. */
|
||||
predicate isRegExp(string s) { this.isRegExpWithFlags(s, _) }
|
||||
|
||||
/** Holds if this is the regexp value `/s/flags` . */
|
||||
@@ -125,13 +125,13 @@ module ConstantValue {
|
||||
class ConstantStringlikeValue extends ConstantValue, TStringlike { }
|
||||
|
||||
/** A constant string value. */
|
||||
class ConstantStringValue extends ConstantValue, TString { }
|
||||
class ConstantStringValue extends ConstantStringlikeValue, TString { }
|
||||
|
||||
/** A constant symbol value. */
|
||||
class ConstantSymbolValue extends ConstantValue, TSymbol { }
|
||||
class ConstantSymbolValue extends ConstantStringlikeValue, TSymbol { }
|
||||
|
||||
/** A constant regexp value. */
|
||||
class ConstantRegExpValue extends ConstantValue, TRegExp { }
|
||||
class ConstantRegExpValue extends ConstantStringlikeValue, TRegExp { }
|
||||
|
||||
/** A constant Boolean value. */
|
||||
class ConstantBooleanValue extends ConstantValue, TBoolean { }
|
||||
|
||||
@@ -18,9 +18,7 @@ query predicate regexpEscapeSequenceComponents(RegExpEscapeSequenceComponent c,
|
||||
}
|
||||
|
||||
query predicate stringlikeLiterals(StringlikeLiteral l, string value, string kind) {
|
||||
value = l.getConstantValue().getString() and kind = "string"
|
||||
or
|
||||
value = l.getConstantValue().getSymbol() and kind = "symbol"
|
||||
or
|
||||
value = l.getConstantValue().getRegExp() and kind = "regexp"
|
||||
exists(ConstantValue v |
|
||||
v = l.getConstantValue() and value = v.getStringlikeValue() and kind = v.getValueType()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user