Rename Method -> MethodDeclaration

This commit is contained in:
Arthur Baars
2021-04-09 18:34:09 +02:00
parent 3590a2c2ac
commit d361ef37af
14 changed files with 60 additions and 53 deletions

View File

@@ -123,7 +123,7 @@ private class Ensure extends StmtSequence, TEnsure {
class BodyStmt extends StmtSequence, TBodyStmt {
// Not defined by dispatch, as it should not be exposed
private Generated::AstNode getChild(int i) {
result = any(Generated::Method g | this = TMethod(g)).getChild(i)
result = any(Generated::Method g | this = TMethodDeclaration(g)).getChild(i)
or
result = any(Generated::SingletonMethod g | this = TSingletonMethod(g)).getChild(i)
or

View File

@@ -32,12 +32,12 @@ class MethodBase extends Callable, BodyStmt, Scope, TMethodBase {
}
/** A normal method. */
class Method extends MethodBase, TMethod {
class MethodDeclaration extends MethodBase, TMethodDeclaration {
private Generated::Method g;
Method() { this = TMethod(g) }
MethodDeclaration() { this = TMethodDeclaration(g) }
final override string getAPrimaryQlClass() { result = "Method" }
final override string getAPrimaryQlClass() { result = "MethodDeclaration" }
final override string getName() {
result = g.getName().(Generated::Token).getValue() or

View File

@@ -138,7 +138,7 @@ private module Cached {
g instanceof @binary_and or g instanceof @binary_ampersandampersand
} or
TLogicalOrExpr(Generated::Binary g) { g instanceof @binary_or or g instanceof @binary_pipepipe } or
TMethod(Generated::Method g) or
TMethodDeclaration(Generated::Method g) or
TModuleDeclaration(Generated::Module g) or
TModuloExpr(Generated::Binary g) { g instanceof @binary_percent } or
TMulExpr(Generated::Binary g) { g instanceof @binary_star } or
@@ -301,7 +301,7 @@ private module Cached {
n = TLocalVariableAccess(result, _) or
n = TLogicalAndExpr(result) or
n = TLogicalOrExpr(result) or
n = TMethod(result) or
n = TMethodDeclaration(result) or
n = TModuleDeclaration(result) or
n = TModuloExpr(result) or
n = TMulExpr(result) or
@@ -402,7 +402,8 @@ class TStmtSequence =
TBeginBlock or TEndBlock or TThen or TElse or TDo or TEnsure or TStringInterpolationComponent or
TBlock or TBodyStmt or TParenthesizedExpr;
class TBodyStmt = TBeginExpr or TModuleBase or TMethod or TLambda or TDoBlock or TSingletonMethod;
class TBodyStmt =
TBeginExpr or TModuleBase or TMethodDeclaration or TLambda or TDoBlock or TSingletonMethod;
class TLiteral =
TNumericLiteral or TNilLiteral or TBooleanLiteral or TStringlikeLiteral or TCharacterLiteral or
@@ -428,7 +429,7 @@ class TArrayLiteral = TRegularArrayLiteral or TStringArrayLiteral or TSymbolArra
class TCallable = TMethodBase or TLambda or TBlock;
class TMethodBase = TMethod or TSingletonMethod;
class TMethodBase = TMethodDeclaration or TSingletonMethod;
class TBlock = TDoBlock or TBraceBlock;

View File

@@ -925,7 +925,7 @@ module Trees {
private class MethodNameTree extends LeafTree, MethodName, ASTInternal::TTokenMethodName { }
private class MethodTree extends BodyStmtPostOrderTree, Method {
private class MethodDeclarationTree extends BodyStmtPostOrderTree, MethodDeclaration {
/** Gets the `i`th child in the body of this block. */
final override AstNode getBodyChild(int i, boolean rescuable) {
result = this.getParameter(i) and rescuable = false

View File

@@ -269,7 +269,11 @@ private module ReturnNodes {
scope = node.getScope()
|
stmt instanceof ReturnStmt and
(scope instanceof Method or scope instanceof SingletonMethod or scope instanceof Lambda)
(
scope instanceof MethodDeclaration or
scope instanceof SingletonMethod or
scope instanceof Lambda
)
or
stmt instanceof NextStmt and
(scope instanceof Block or scope instanceof Lambda)