Skip to content

Commit 3c4bd5b

Browse files
committed
forward toString() etc. predicates from YamlNode to Locatable
1 parent b5e9048 commit 3c4bd5b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

javascript/ql/lib/semmle/javascript/PrintAst.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private predicate isNotNeeded(Locatable el) {
5151
private string getQlClass(Locatable el) {
5252
result = "[" + el.getPrimaryQlClasses() + "] "
5353
// Alternative implementation -- do not delete. It is useful for QL class discovery.
54-
// not el.getAPrimaryQlClass() = "???" and result = "[" + getPrimaryQlClasses() + "] " or el.getAPrimaryQlClass() = "???" and result = "??[" + concat(el.getAQlClass(), ",") + "] "
54+
// not el.getAPrimaryQlClass() = "???" and result = "[" + el.getPrimaryQlClasses() + "] " or el.getAPrimaryQlClass() = "???" and result = "??[" + concat(el.getAQlClass(), ",") + "] "
5555
}
5656

5757
/**

javascript/ql/lib/semmle/javascript/YAML.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ private module YamlSig implements LibYaml::InputSig {
4848

4949
import LibYaml::Make<YamlSig>
5050

51+
// private class to forward the `toString` etc. predicates from `YamlNode` to `Locatable`.
52+
private class MyYmlNode extends Locatable instanceof YamlNode {
53+
override string getAPrimaryQlClass() { result = YamlNode.super.getAPrimaryQlClass() }
54+
55+
override Location getLocation() { result = YamlNode.super.getLocation() }
56+
57+
override string toString() { result = YamlNode.super.toString() }
58+
}
59+
5160
/** DEPRECATED: Alias for YamlNode */
5261
deprecated class YAMLNode = YamlNode;
5362

0 commit comments

Comments
 (0)