예제 #1
0
 /*package*/ NamespaceTranslator(
     @NotNull NamespaceDescriptor descriptor,
     @NotNull ClassDeclarationTranslator classDeclarationTranslator,
     @NotNull TranslationContext context) {
   super(context.newDeclaration(descriptor));
   this.descriptor = descriptor;
   this.namespaceName = context.getNameForDescriptor(descriptor);
   this.classDeclarationTranslator = classDeclarationTranslator;
 }
예제 #2
0
 @Nullable
 private JsExpression getThisObject() {
   if (qualifier != null && !isExtensionCall) {
     return qualifier;
   }
   return context.thisAliasProvider().get(resolvedCall);
 }
예제 #3
0
  public ClassDeclarationTranslator(@NotNull TranslationContext context) {
    super(context);

    dummyFunction = new JsFunction(context.scope());
    JsName declarationsObject = context().scope().declareName(Namer.nameForClassesVariable());
    classesVar = new JsVars.JsVar(declarationsObject);
    declarationsObjectRef = declarationsObject.makeRef();
  }
예제 #4
0
 @NotNull
 private JsExpression getExtensionFunctionCallReceiver() {
   if (qualifier != null) {
     return qualifier;
   }
   DeclarationDescriptor receiverDescriptor =
       getDeclarationDescriptorForExtensionCallReceiver(resolvedCall);
   return context.getThisObject(receiverDescriptor);
 }
예제 #5
0
 /* package */
 @NotNull
 static DefineInvocation create(
     @NotNull FqName packageFqName,
     @Nullable JsExpression initializer,
     @NotNull JsObjectLiteral members,
     @NotNull TranslationContext context) {
   return new DefineInvocation(
       initializer == null ? JsLiteral.NULL : initializer,
       new JsDocComment(JsAstUtils.LENDS_JS_DOC_TAG, context.getQualifiedReference(packageFqName)),
       members);
 }
 /*package*/ CachedArrayAccessTranslator(
     @NotNull JetArrayAccessExpression expression, @NotNull TranslationContext context) {
   super(expression, context);
   arrayExpression = context.declareTemporary(translateArrayExpression());
   indexExpressions = fromExpressionList(translateIndexExpressions(), context);
 }
예제 #7
0
 @Nullable
 public static Name getNameIfStandardType(
     @NotNull JetExpression expression, @NotNull TranslationContext context) {
   JetType type = context.bindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
   return type != null ? getNameIfStandardType(type) : null;
 }