mirror of
https://github.com/github/codeql.git
synced 2026-02-07 10:41:06 +01:00
Merge pull request #41 from github/tausbn/support-instanceof
Support `instanceof`
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -589,7 +589,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tree-sitter-ql"
|
||||
version = "0.19.0"
|
||||
source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=e08901378e2fd5c33f1e88bbb59716fd36f094f7#e08901378e2fd5c33f1e88bbb59716fd36f094f7"
|
||||
source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=a9348d405de3b2dde0e6d7e59d476ae91516b7af#a9348d405de3b2dde0e6d7e59d476ae91516b7af"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter",
|
||||
|
||||
@@ -10,7 +10,7 @@ edition = "2018"
|
||||
flate2 = "1.0"
|
||||
node-types = { path = "../node-types" }
|
||||
tree-sitter = "0.19"
|
||||
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "e08901378e2fd5c33f1e88bbb59716fd36f094f7" }
|
||||
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "a9348d405de3b2dde0e6d7e59d476ae91516b7af" }
|
||||
clap = "2.33"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
|
||||
|
||||
@@ -10,4 +10,4 @@ edition = "2018"
|
||||
node-types = { path = "../node-types" }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
|
||||
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "e08901378e2fd5c33f1e88bbb59716fd36f094f7" }
|
||||
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "a9348d405de3b2dde0e6d7e59d476ae91516b7af" }
|
||||
|
||||
@@ -665,7 +665,7 @@ class Class extends TClass, TypeDeclaration, ModuleDeclaration {
|
||||
/**
|
||||
* Gets a super-type referenced in the `extends` part of the class declaration.
|
||||
*/
|
||||
TypeExpr getASuperType() { toGenerated(result) = cls.getChild(_) }
|
||||
TypeExpr getASuperType() { toGenerated(result) in [cls.getExtends(_), cls.getInstanceof(_)] }
|
||||
|
||||
/** Gets the type that this class is defined to be an alias of. */
|
||||
TypeExpr getAliasType() {
|
||||
|
||||
@@ -389,6 +389,12 @@ module Generated {
|
||||
/** Gets the location of this element. */
|
||||
override Location getLocation() { dataclass_def(this, _, result) }
|
||||
|
||||
/** Gets the node corresponding to the field `extends`. */
|
||||
AstNode getExtends(int i) { dataclass_extends(this, i, result) }
|
||||
|
||||
/** Gets the node corresponding to the field `instanceof`. */
|
||||
AstNode getInstanceof(int i) { dataclass_instanceof(this, i, result) }
|
||||
|
||||
/** Gets the node corresponding to the field `name`. */
|
||||
ClassName getName() { dataclass_def(this, result, _) }
|
||||
|
||||
@@ -397,7 +403,10 @@ module Generated {
|
||||
|
||||
/** Gets a field or child node of this node. */
|
||||
override AstNode getAFieldOrChild() {
|
||||
dataclass_def(this, result, _) or dataclass_child(this, _, result)
|
||||
dataclass_extends(this, _, result) or
|
||||
dataclass_instanceof(this, _, result) or
|
||||
dataclass_def(this, result, _) or
|
||||
dataclass_child(this, _, result)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,25 @@ conjunction_def(
|
||||
int loc: @location ref
|
||||
);
|
||||
|
||||
@dataclass_child_type = @class_member | @type_alias_body | @type_expr | @type_union_body
|
||||
@dataclass_extends_type = @reserved_word | @type_expr
|
||||
|
||||
#keyset[dataclass, index]
|
||||
dataclass_extends(
|
||||
int dataclass: @dataclass ref,
|
||||
int index: int ref,
|
||||
unique int extends: @dataclass_extends_type ref
|
||||
);
|
||||
|
||||
@dataclass_instanceof_type = @reserved_word | @type_expr
|
||||
|
||||
#keyset[dataclass, index]
|
||||
dataclass_instanceof(
|
||||
int dataclass: @dataclass ref,
|
||||
int index: int ref,
|
||||
unique int instanceof: @dataclass_instanceof_type ref
|
||||
);
|
||||
|
||||
@dataclass_child_type = @class_member | @type_alias_body | @type_union_body
|
||||
|
||||
#keyset[dataclass, index]
|
||||
dataclass_child(
|
||||
|
||||
Reference in New Issue
Block a user