@Nullable public JsPropertyInitializer translate( @NotNull JetClassOrObject declaration, TranslationContext context) { ClassDescriptor descriptor = getClassDescriptor(context().bindingContext(), declaration); JsExpression value; if (descriptor.getModality() == Modality.FINAL) { value = new ClassTranslator(declaration, classDescriptorToQualifiedLabel, context).translate(); } else { String label = createNameForClass(descriptor); JsName name = dummyFunction.getScope().declareName(label); JsNameRef qualifiedLabel = openClassDescriptorToQualifiedLabel.get(descriptor); if (qualifiedLabel == null) { qualifiedLabel = new JsNameRef(name); openClassDescriptorToQualifiedLabel.put(descriptor, qualifiedLabel); } else { qualifiedLabel.resolve(name); } qualifiedLabel.setQualifier(declarationsObjectRef); OpenClassInfo item = new OpenClassInfo((JetClass) declaration, descriptor, name.makeRef()); openList.add(item); openClassDescriptorToItem.put(descriptor, item); value = qualifiedLabel; // not public api classes referenced to internal var _c if (!descriptor.getVisibility().isPublicAPI()) { return null; } } return InitializerUtils.createPropertyInitializer(descriptor, value, context()); }
private JsNameRef mapGetProp(Node getPropNode) throws JsParserException { Node from1 = getPropNode.getFirstChild(); Node from2 = from1.getNext(); JsExpression toQualifier = mapExpression(from1); JsNameRef toNameRef; if (from2 != null) { toNameRef = mapAsPropertyNameRef(from2); } else { // Special properties don't have a second expression. // Object obj = getPropNode.getProp(Node.SPECIAL_PROP_PROP); assert (obj instanceof String); toNameRef = scopeContext.referenceFor((String) obj); } toNameRef.setQualifier(toQualifier); return toNameRef; }