Show uses for __call__() and __{get,set}item__()
Uses of __getitem__() and __setitem__() weren't shown at all. Uses of __call__() were incorrectly shown as uses of __init__(). This removes ExpressionAst::belongsToCall, because it's always equal to ExpressionAst::parent or null. This adds a new parameter `isAlias` to functionForCalled(), which allows it to distinguish between calling a class object (constructor __init__) and calling an instance of that class with __call__(). This parameter can (and probably should) be used in other callers to improve parsing or just simplify code. For now, the default value of `true` causes functionForCalled() to behave as before. The ranges for these uses - as with the existing __init__() ones - are not always correct, particularly following subscripts. TODO: make the ranges of AST nodes more reliable, and then look more carefully for opening braces. No test regressions. No new tests, because the test framework doesn't seem to support use ranges currently. Tested on some real projects, didn't crash. Differential Revision: https://phabricator.kde.org/D3512
parent
d757d25e
Please register or sign in to comment