Пример #1
0
 @Nullable
 protected JsExpression getAliasForDescriptor(
     @NotNull DeclarationDescriptor descriptor, boolean fromChild) {
   JsExpression alias =
       aliasesForDescriptors == null ? null : aliasesForDescriptors.get(descriptor.getOriginal());
   return alias != null || parent == null ? alias : parent.getAliasForDescriptor(descriptor, true);
 }
Пример #2
0
 @NotNull
 public TranslationContext innerContextWithThisAliased(
     @NotNull DeclarationDescriptor correspondingDescriptor, @NotNull JsName alias) {
   return new TranslationContext(
       staticContext,
       dynamicContext,
       aliasingContext.withThisAliased(correspondingDescriptor, alias));
 }
Пример #3
0
 @NotNull
 public JsName getNameForDescriptor(@NotNull DeclarationDescriptor descriptor) {
   JsName alias = aliasingContext.getAliasForDescriptor(descriptor);
   if (alias != null) {
     return alias;
   }
   return staticContext.getNameForDescriptor(descriptor);
 }
Пример #4
0
 @NotNull
 public static TranslationContext rootContext(@NotNull StaticContext staticContext) {
   JsProgram program = staticContext.getProgram();
   JsBlock globalBlock = program.getGlobalBlock();
   DynamicContext rootDynamicContext =
       DynamicContext.rootContext(staticContext.getRootScope(), globalBlock);
   AliasingContext rootAliasingContext = AliasingContext.getCleanContext();
   return new TranslationContext(staticContext, rootDynamicContext, rootAliasingContext);
 }
Пример #5
0
 @NotNull
 public TranslationContext innerContextWithDescriptorsAliased(
     @NotNull Map<DeclarationDescriptor, JsName> aliases) {
   return new TranslationContext(
       staticContext, dynamicContext, aliasingContext.withDescriptorsAliased(aliases));
 }
Пример #6
0
 @NotNull
 public TranslationContext innerContextWithAliasesForExpressions(
     @NotNull Map<JetExpression, JsName> aliases) {
   return new TranslationContext(
       staticContext, dynamicContext, aliasingContext.withAliasesForExpressions(aliases));
 }
Пример #7
0
 @Nullable
 public JsExpression getAliasForExpression(@NotNull JetExpression element) {
   JsExpression alias = aliasesForExpressions == null ? null : aliasesForExpressions.get(element);
   return alias != null || parent == null ? alias : parent.getAliasForExpression(element);
 }