have the Instance token be an alias for Subclass.ReturnValue

This commit is contained in:
Erik Krogh Kristensen
2022-04-27 11:17:15 +02:00
parent 46acce0ad4
commit ea01bcf5ec
4 changed files with 8 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ API::Node getExtraSuccessorFromNode(API::Node node, AccessPathToken token) {
result = node.getMember(token.getAnArgument())
or
token.getName() = "Instance" and
result = node.getReturn() // commonly used Token. In Python `Instance` is just an alias for `ReturnValue`
result = node.getASubclass*().getReturn() // In Python `Instance` is just an alias for `Subclass.ReturnValue`
or
token.getName() = "Awaited" and
result = node.getAwaited()

View File

@@ -41,6 +41,7 @@ isSource
| test.py:39:11:39:20 | ControlFlowNode for Await | test-source |
| test.py:41:8:41:27 | ControlFlowNode for Attribute() | test-source |
| test.py:46:7:46:16 | ControlFlowNode for SubClass() | test-source |
| test.py:51:8:51:18 | ControlFlowNode for Sub2Class() | test-source |
syntaxErrors
| Member[foo |
| Member[foo] .Member[bar] |

View File

@@ -43,4 +43,9 @@ inst = CommonTokens.Class()
class SubClass (CommonTokens.Super):
pass
sub = SubClass()
sub = SubClass()
class Sub2Class (CommonTokens.Class):
pass
sub2 = Sub2Class()

View File

@@ -53,8 +53,6 @@ class Sinks extends ModelInput::SinkModelCsv {
}
}
// TODO: Commonly used tokens
// TODO: Should `instance()` be shorthand for `subClass*().getReturn()`?
// TODO: Uniform tokens for fields
// TODO: Non-positional arguments (including Named parameters)
// TODO: Any argument