void (PyDictLiteralExpression dictExpression, PyElementGenerator elementGenerator) { PyExpression[] argumentList = dictExpression.getElements(); StringBuilder stringBuilder = new StringBuilder("dict("); int size = argumentList.length; for (int i = 0; i != size; ++i) { PyExpression argument = argumentList[i]; if (argument instanceof PyKeyValueExpression) { PyExpression key = ((PyKeyValueExpression)argument).getKey(); PyExpression value = ((PyKeyValueExpression)argument).getValue(); if (key instanceof PyStringLiteralExpression && value != null) { stringBuilder.append(((PyStringLiteralExpression)key).getStringValue()); stringBuilder.append("="); stringBuilder.append(value.getText()); if (i != size-1) stringBuilder.append(", "); } } } stringBuilder.append(")"); PyCallExpression callExpression = (PyCallExpression)elementGenerator.createFromText(LanguageLevel.forElement(dictExpression), PyExpressionStatement.class, stringBuilder.toString()).getExpression(); dictExpression.replace(callExpression); }