Introduce ANEXT, AENTER and AEXIT in PyNames
authorSemyon Proshev <Semyon.Proshev@jetbrains.com>
Tue, 26 Jul 2016 16:20:51 +0000 (19:20 +0300)
committerSemyon Proshev <Semyon.Proshev@jetbrains.com>
Mon, 1 Aug 2016 18:28:24 +0000 (21:28 +0300)
python/psi-api/src/com/jetbrains/python/PyNames.java
python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java

index 11c723e9de7e1f9ea195dc7b795de6be1fc3035c..99896e451317caafa34dca9fef64ea83e6d86808 100644 (file)
@@ -166,6 +166,9 @@ public class PyNames {
   public static final String DIV = "__div__";
   public static final String TRUEDIV = "__truediv__";
   public static final String AITER = "__aiter__";
+  public static final String ANEXT = "__anext__";
+  public static final String AENTER = "__aenter__";
+  public static final String AEXIT = "__aexit__";
   public static final String SIZEOF = "__sizeof__";
 
   public static final String NAME = "__name__";
@@ -409,10 +412,10 @@ public class PyNames {
     .put("__matmul__", _self_other_descr)
     .put("__rmatmul__", _self_other_descr)
     .put("__await__", _only_self_descr)
-    .put("__aenter__", _only_self_descr)
-    .put("__aexit__", _exit_descr)
+    .put(AENTER, _only_self_descr)
+    .put(AEXIT, _exit_descr)
     .put(AITER, _only_self_descr)
-    .put("__anext__", _only_self_descr)
+    .put(ANEXT, _only_self_descr)
     .build();
 
   public static ImmutableMap<String, BuiltinDescription> getBuiltinMethods(LanguageLevel level) {
index f41f4104cfa338a90efac81e95b954269d136ac6..dcf90bfea17a55a67d7f230ffcfce7dee3fa74e8 100644 (file)
@@ -683,7 +683,7 @@ public class PyFunctionImpl extends PyBaseElementImpl<PyFunctionStub> implements
 
     return languageLevel.isAtLeast(LanguageLevel.PYTHON35) && (
       functionName == null ||
-      ArrayUtil.contains(functionName, PyNames.AITER, "__anext__", "__aenter__", "__aexit__") ||
+      ArrayUtil.contains(functionName, PyNames.AITER, PyNames.ANEXT, PyNames.AENTER, PyNames.AEXIT) ||
       !PyNames.getBuiltinMethods(languageLevel).containsKey(functionName)
     );
   }