Ruby: Ensure Node::{toString,getLocation} are computed in data flow stage

This commit is contained in:
Tom Hvitved
2022-12-11 20:35:32 +01:00
parent 367aa35d8c
commit 58549087e0
2 changed files with 8 additions and 4 deletions

View File

@@ -340,6 +340,12 @@ private module Cached {
p.(KeywordParameter).getDefaultValue() = e.getExprNode().getExpr()
}
cached
Location getLocation(NodeImpl n) { result = n.getLocationImpl() }
cached
string toString(NodeImpl n) { result = n.toStringImpl() }
/**
* This is the local flow predicate that is used as a building block in global
* data flow.

View File

@@ -19,12 +19,10 @@ class Node extends TNode {
Parameter asParameter() { result = this.(ParameterNode).getParameter() }
/** Gets a textual representation of this node. */
cached
final string toString() { result = this.(NodeImpl).toStringImpl() }
final string toString() { result = toString(this) }
/** Gets the location of this node. */
cached
final Location getLocation() { result = this.(NodeImpl).getLocationImpl() }
final Location getLocation() { result = getLocation(this) }
/**
* Holds if this element is at the specified location.