mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Fix types of true/false
This commit is contained in:
@@ -11,8 +11,8 @@ private import codeql_ruby.ast.Scope
|
||||
private string builtin() {
|
||||
result =
|
||||
[
|
||||
"Object", "Kernel", "BasicObject", "Class", "Module", "NilClass", "Boolean", "Numeric",
|
||||
"Integer", "Float", "Rational", "Complex", "Array", "Hash"
|
||||
"Object", "Kernel", "BasicObject", "Class", "Module", "NilClass", "FalseClass", "TrueClass",
|
||||
"Numeric", "Integer", "Float", "Rational", "Complex", "Array", "Hash"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -45,7 +45,10 @@ private module Cached {
|
||||
Module getSuperClass(Module cls) {
|
||||
cls = TResolved("Object") and result = TResolved("BasicObject")
|
||||
or
|
||||
cls = TResolved(["Module", "Class", "Numeric", "Array", "Hash", "Boolean", "NilClass"]) and
|
||||
cls =
|
||||
TResolved([
|
||||
"Module", "Class", "Numeric", "Array", "Hash", "FalseClass", "TrueClass", "NilClass"
|
||||
]) and
|
||||
result = TResolved("Object")
|
||||
or
|
||||
cls = TResolved(["Integer", "Float", "Rational", "Complex"]) and
|
||||
|
||||
@@ -97,7 +97,9 @@ private DataFlow::LocalSourceNode trackInstance(Module tp, TypeTracker t) {
|
||||
(
|
||||
result.asExpr().getExpr() instanceof NilLiteral and tp = TResolved("NilClass")
|
||||
or
|
||||
result.asExpr().getExpr() instanceof BooleanLiteral and tp = TResolved("Boolean")
|
||||
result.asExpr().getExpr().(BooleanLiteral).isFalse() and tp = TResolved("FalseClass")
|
||||
or
|
||||
result.asExpr().getExpr().(BooleanLiteral).isTrue() and tp = TResolved("TrueClass")
|
||||
or
|
||||
result.asExpr().getExpr() instanceof IntegerLiteral and tp = TResolved("Integer")
|
||||
or
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
|
||||
#-----| BasicObject
|
||||
|
||||
#-----| Boolean
|
||||
#-----| super -> Object
|
||||
|
||||
#-----| Class
|
||||
#-----| super -> Object
|
||||
|
||||
#-----| Complex
|
||||
#-----| super -> Numeric
|
||||
|
||||
#-----| FalseClass
|
||||
#-----| super -> Object
|
||||
|
||||
#-----| Float
|
||||
#-----| super -> Numeric
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
#-----| Rational
|
||||
#-----| super -> Numeric
|
||||
|
||||
#-----| TrueClass
|
||||
#-----| super -> Object
|
||||
|
||||
calls.rb:
|
||||
# 15| M
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ lookupMethod
|
||||
| calls.rb:51:1:55:3 | D | foo | calls.rb:1:1:3:3 | foo |
|
||||
| calls.rb:51:1:55:3 | D | instance_m | calls.rb:16:5:16:23 | instance_m |
|
||||
| file://:0:0:0:0 | Array | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Boolean | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Class | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Complex | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | FalseClass | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Float | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Hash | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Integer | foo | calls.rb:1:1:3:3 | foo |
|
||||
@@ -33,6 +33,7 @@ lookupMethod
|
||||
| file://:0:0:0:0 | Numeric | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Object | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | Rational | foo | calls.rb:1:1:3:3 | foo |
|
||||
| file://:0:0:0:0 | TrueClass | foo | calls.rb:1:1:3:3 | foo |
|
||||
| hello.rb:1:1:8:3 | EnglishWords | hello | hello.rb:2:5:4:7 | hello |
|
||||
| hello.rb:1:1:8:3 | EnglishWords | world | hello.rb:5:5:7:7 | world |
|
||||
| hello.rb:11:1:16:3 | Greeting | foo | calls.rb:1:1:3:3 | foo |
|
||||
|
||||
@@ -4,9 +4,9 @@ getModule
|
||||
| calls.rb:51:1:55:3 | D |
|
||||
| file://:0:0:0:0 | Array |
|
||||
| file://:0:0:0:0 | BasicObject |
|
||||
| file://:0:0:0:0 | Boolean |
|
||||
| file://:0:0:0:0 | Class |
|
||||
| file://:0:0:0:0 | Complex |
|
||||
| file://:0:0:0:0 | FalseClass |
|
||||
| file://:0:0:0:0 | Float |
|
||||
| file://:0:0:0:0 | Hash |
|
||||
| file://:0:0:0:0 | Integer |
|
||||
@@ -16,6 +16,7 @@ getModule
|
||||
| file://:0:0:0:0 | Numeric |
|
||||
| file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Rational |
|
||||
| file://:0:0:0:0 | TrueClass |
|
||||
| hello.rb:1:1:8:3 | EnglishWords |
|
||||
| hello.rb:11:1:16:3 | Greeting |
|
||||
| hello.rb:18:1:22:3 | HelloWorld |
|
||||
@@ -96,9 +97,9 @@ getSuperClass
|
||||
| calls.rb:29:1:44:3 | C | file://:0:0:0:0 | Object |
|
||||
| calls.rb:51:1:55:3 | D | calls.rb:29:1:44:3 | C |
|
||||
| file://:0:0:0:0 | Array | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Boolean | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Class | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Complex | file://:0:0:0:0 | Numeric |
|
||||
| file://:0:0:0:0 | FalseClass | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Float | file://:0:0:0:0 | Numeric |
|
||||
| file://:0:0:0:0 | Hash | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Integer | file://:0:0:0:0 | Numeric |
|
||||
@@ -107,6 +108,7 @@ getSuperClass
|
||||
| file://:0:0:0:0 | Numeric | file://:0:0:0:0 | Object |
|
||||
| file://:0:0:0:0 | Object | file://:0:0:0:0 | BasicObject |
|
||||
| file://:0:0:0:0 | Rational | file://:0:0:0:0 | Numeric |
|
||||
| file://:0:0:0:0 | TrueClass | file://:0:0:0:0 | Object |
|
||||
| hello.rb:11:1:16:3 | Greeting | file://:0:0:0:0 | Object |
|
||||
| hello.rb:18:1:22:3 | HelloWorld | hello.rb:11:1:16:3 | Greeting |
|
||||
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | file://:0:0:0:0 | Object |
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
|
||||
#-----| BasicObject
|
||||
|
||||
#-----| Boolean
|
||||
#-----| -> Object
|
||||
|
||||
#-----| Class
|
||||
#-----| -> Object
|
||||
|
||||
#-----| Complex
|
||||
#-----| -> Numeric
|
||||
|
||||
#-----| FalseClass
|
||||
#-----| -> Object
|
||||
|
||||
#-----| Float
|
||||
#-----| -> Numeric
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#-----| Rational
|
||||
#-----| -> Numeric
|
||||
|
||||
#-----| TrueClass
|
||||
#-----| -> Object
|
||||
|
||||
calls.rb:
|
||||
# 15| M
|
||||
|
||||
|
||||
Reference in New Issue
Block a user