|
34 | 34 | import static com.oracle.graal.python.nodes.BuiltinNames.CLASSMETHOD;
|
35 | 35 | import static com.oracle.graal.python.nodes.BuiltinNames.COMPLEX;
|
36 | 36 | import static com.oracle.graal.python.nodes.BuiltinNames.DICT;
|
| 37 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_ITEMS; |
| 38 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_VALUES; |
| 39 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_KEYS; |
| 40 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_ITEMITERATOR; |
| 41 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_KEYITERATOR; |
| 42 | +import static com.oracle.graal.python.nodes.BuiltinNames.DICT_VALUEITERATOR; |
37 | 43 | import static com.oracle.graal.python.nodes.BuiltinNames.ENUMERATE;
|
38 | 44 | import static com.oracle.graal.python.nodes.BuiltinNames.FLOAT;
|
39 | 45 | import static com.oracle.graal.python.nodes.BuiltinNames.FROZENSET;
|
@@ -2670,63 +2676,63 @@ public PNone module(Object cls) {
|
2670 | 2676 | }
|
2671 | 2677 | }
|
2672 | 2678 |
|
2673 |
| - @Builtin(name = "dict_keys", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictKeysView, isPublic = false) |
| 2679 | + @Builtin(name = DICT_KEYS, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictKeysView, isPublic = false) |
2674 | 2680 | @GenerateNodeFactory
|
2675 | 2681 | public abstract static class DictKeysTypeNode extends PythonBuiltinNode {
|
2676 | 2682 | @SuppressWarnings("unused")
|
2677 | 2683 | @Specialization
|
2678 | 2684 | public Object dictKeys(Object args, Object kwargs) {
|
2679 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_keys'"); |
| 2685 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_KEYS)); |
2680 | 2686 | }
|
2681 | 2687 | }
|
2682 | 2688 |
|
2683 |
| - @Builtin(name = "dict_keysiterator", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictKeysIterator, isPublic = false) |
| 2689 | + @Builtin(name = DICT_KEYITERATOR, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictKeysIterator, isPublic = false) |
2684 | 2690 | @GenerateNodeFactory
|
2685 | 2691 | public abstract static class DictKeysIteratorTypeNode extends PythonBuiltinNode {
|
2686 | 2692 | @SuppressWarnings("unused")
|
2687 | 2693 | @Specialization
|
2688 | 2694 | public Object dictKeys(Object args, Object kwargs) {
|
2689 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_keysiterator'"); |
| 2695 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_KEYITERATOR)); |
2690 | 2696 | }
|
2691 | 2697 | }
|
2692 | 2698 |
|
2693 |
| - @Builtin(name = "dict_values", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictValuesView, isPublic = false) |
| 2699 | + @Builtin(name = DICT_VALUES, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictValuesView, isPublic = false) |
2694 | 2700 | @GenerateNodeFactory
|
2695 | 2701 | public abstract static class DictValuesTypeNode extends PythonBuiltinNode {
|
2696 | 2702 | @SuppressWarnings("unused")
|
2697 | 2703 | @Specialization
|
2698 | 2704 | public Object dictKeys(Object args, Object kwargs) {
|
2699 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_values'"); |
| 2705 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_VALUES)); |
2700 | 2706 | }
|
2701 | 2707 | }
|
2702 | 2708 |
|
2703 |
| - @Builtin(name = "dict_valuesiterator", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictValuesIterator, isPublic = false) |
| 2709 | + @Builtin(name = DICT_VALUEITERATOR, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictValuesIterator, isPublic = false) |
2704 | 2710 | @GenerateNodeFactory
|
2705 | 2711 | public abstract static class DictValuesIteratorTypeNode extends PythonBuiltinNode {
|
2706 | 2712 | @SuppressWarnings("unused")
|
2707 | 2713 | @Specialization
|
2708 | 2714 | public Object dictKeys(Object args, Object kwargs) {
|
2709 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_valuesiterator'"); |
| 2715 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_VALUEITERATOR)); |
2710 | 2716 | }
|
2711 | 2717 | }
|
2712 | 2718 |
|
2713 |
| - @Builtin(name = "dict_items", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictItemsView, isPublic = false) |
| 2719 | + @Builtin(name = DICT_ITEMS, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictItemsView, isPublic = false) |
2714 | 2720 | @GenerateNodeFactory
|
2715 | 2721 | public abstract static class DictItemsTypeNode extends PythonBuiltinNode {
|
2716 | 2722 | @SuppressWarnings("unused")
|
2717 | 2723 | @Specialization
|
2718 | 2724 | public Object dictKeys(Object args, Object kwargs) {
|
2719 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_items'"); |
| 2725 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_ITEMS)); |
2720 | 2726 | }
|
2721 | 2727 | }
|
2722 | 2728 |
|
2723 |
| - @Builtin(name = "dict_itemsiterator", takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictItemsIterator, isPublic = false) |
| 2729 | + @Builtin(name = DICT_ITEMITERATOR, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PDictItemsIterator, isPublic = false) |
2724 | 2730 | @GenerateNodeFactory
|
2725 | 2731 | public abstract static class DictItemsIteratorTypeNode extends PythonBuiltinNode {
|
2726 | 2732 | @SuppressWarnings("unused")
|
2727 | 2733 | @Specialization
|
2728 | 2734 | public Object dictKeys(Object args, Object kwargs) {
|
2729 |
| - throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, "'dict_itemsiterator'"); |
| 2735 | + throw raise(TypeError, ErrorMessages.CANNOT_CREATE_INSTANCES, parentheses(DICT_ITEMITERATOR)); |
2730 | 2736 | }
|
2731 | 2737 | }
|
2732 | 2738 |
|
@@ -3182,4 +3188,9 @@ PMap doit(LazyPythonClass self, @SuppressWarnings("unused") Object[] args, @Supp
|
3182 | 3188 | return factory().createMap(self);
|
3183 | 3189 | }
|
3184 | 3190 | }
|
| 3191 | + |
| 3192 | + @TruffleBoundary |
| 3193 | + private static String parentheses(String str) { |
| 3194 | + return new StringBuilder("'").append(str).append("'").toString(); |
| 3195 | + } |
3185 | 3196 | }
|
0 commit comments