mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:38:53 +07:00
delete WRAPPED flag that no one cares about; test for staticmethod as wrapping call
This commit is contained in:
@@ -72,13 +72,6 @@ extends
|
||||
* Function is decorated with {@code @staticmethod}, its first param is as in a regular function.
|
||||
*/
|
||||
STATICMETHOD,
|
||||
|
||||
/**
|
||||
* Function is not decorated, but wrapped in an actual call to {@code staticmethod} or {@code classmethod},
|
||||
* e.g. {@code foo = classmethod(foo)}. The callee is the inner version of {@code foo}, not the outer callable produced
|
||||
* by the wrapping call.
|
||||
*/
|
||||
WRAPPED,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -642,7 +642,6 @@ public class PyUtil {
|
||||
flags.add(CLASSMETHOD);
|
||||
}
|
||||
else if (PyNames.STATICMETHOD.equals(wrapper_name)) flags.add(STATICMETHOD);
|
||||
flags.add(WRAPPED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,6 @@ public class PyCallExpressionHelper {
|
||||
? PyUtil.detectDecorationsAndWrappersOf((PyFunction) resolved)
|
||||
: EnumSet.noneOf(PyFunction.Flag.class);
|
||||
if (wrappedFlag != null) {
|
||||
flags.add(PyFunction.Flag.WRAPPED);
|
||||
flags.add(wrappedFlag);
|
||||
}
|
||||
List<PyExpression> qualifiers = resolveResult != null ? resolveResult.getQualifiers() : Collections.<PyExpression>emptyList();
|
||||
|
||||
5
python/testData/resolve/callee/WrappedStaticMethod.py
Normal file
5
python/testData/resolve/callee/WrappedStaticMethod.py
Normal file
@@ -0,0 +1,5 @@
|
||||
class A:
|
||||
def foo(self): pass
|
||||
foo = staticmethod(foo)
|
||||
|
||||
A.f<caret>oo()
|
||||
@@ -45,4 +45,11 @@ public class PyResolveCalleeTest extends PyTestCase {
|
||||
assertNotNull(resolved.getCallable());
|
||||
assertTrue(resolved.getFlags().equals(EnumSet.noneOf(PyFunction.Flag.class)));
|
||||
}
|
||||
|
||||
public void testWrappedStaticMethod() {
|
||||
PyCallExpression.PyMarkedCallee resolved = resolveCallee();
|
||||
assertNotNull(resolved.getCallable());
|
||||
assertEquals(0, resolved.getImplicitOffset());
|
||||
assertEquals(resolved.getFlags(), EnumSet.of(PyFunction.Flag.STATICMETHOD));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user