delete WRAPPED flag that no one cares about; test for staticmethod as wrapping call

This commit is contained in:
Dmitry Jemerov
2011-12-08 17:48:19 +01:00
parent a271e810b8
commit 4684f470ed
5 changed files with 12 additions and 9 deletions

View File

@@ -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,
}
/**

View File

@@ -642,7 +642,6 @@ public class PyUtil {
flags.add(CLASSMETHOD);
}
else if (PyNames.STATICMETHOD.equals(wrapper_name)) flags.add(STATICMETHOD);
flags.add(WRAPPED);
}
}
}

View File

@@ -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();

View File

@@ -0,0 +1,5 @@
class A:
def foo(self): pass
foo = staticmethod(foo)
A.f<caret>oo()

View File

@@ -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));
}
}