mirror of
https://github.com/github/codeql.git
synced 2026-02-20 08:53:49 +01:00
AST: add Self class
This commit is contained in:
@@ -12,6 +12,18 @@ class Expr extends Stmt {
|
||||
Expr() { this = range }
|
||||
}
|
||||
|
||||
/**
|
||||
* A reference to the current object. For example:
|
||||
* - `self == other`
|
||||
* - `self.method_name`
|
||||
* - `def self.method_name ... end`
|
||||
*/
|
||||
class Self extends Expr, @token_self {
|
||||
override Self::Range range;
|
||||
|
||||
final override string getAPrimaryQlClass() { result = "Self" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A literal.
|
||||
*
|
||||
|
||||
@@ -47,8 +47,6 @@ module AstNode {
|
||||
or
|
||||
this instanceof Generated::BareString
|
||||
or
|
||||
this instanceof Generated::Self
|
||||
or
|
||||
this instanceof Generated::Float
|
||||
or
|
||||
this instanceof Generated::Superclass
|
||||
|
||||
@@ -6,6 +6,14 @@ module Expr {
|
||||
abstract class Range extends Stmt::Range { }
|
||||
}
|
||||
|
||||
module Self {
|
||||
class Range extends Expr::Range, @token_self {
|
||||
final override Generated::Self generated;
|
||||
|
||||
final override string toString() { result = "self" }
|
||||
}
|
||||
}
|
||||
|
||||
module Literal {
|
||||
abstract class Range extends Expr::Range {
|
||||
abstract string getValueText();
|
||||
|
||||
Reference in New Issue
Block a user