@Override
    public void visitJetFile(@NotNull JetFile file) {
      MutablePackageFragmentDescriptor packageFragment = getOrCreatePackageFragmentForFile(file);
      c.getPackageFragments().put(file, packageFragment);
      c.addFile(file);

      PackageViewDescriptor packageView =
          packageFragment.getContainingDeclaration().getPackage(packageFragment.getFqName());
      ChainedScope rootPlusPackageScope =
          new ChainedScope(
              packageView, "Root scope for " + file, packageView.getMemberScope(), outerScope);
      WriteThroughScope packageScope =
          new WriteThroughScope(
              rootPlusPackageScope,
              packageFragment.getMemberScope(),
              new TraceBasedRedeclarationHandler(trace),
              "package in file " + file.getName());
      packageScope.changeLockLevel(WritableScope.LockLevel.BOTH);
      c.getFileScopes().put(file, packageScope);

      if (file.isScript()) {
        scriptHeaderResolver.processScriptHierarchy(c, file.getScript(), packageScope);
      }

      prepareForDeferredCall(packageScope, packageFragment, file);
    }
 @Override
 public void visitJetFile(JetFile file) {
   if (file.isScript()) {
     //noinspection ConstantConditions
     final ClassDescriptor classDescriptor =
         bindingContext.get(CLASS_FOR_FUNCTION, bindingContext.get(SCRIPT, file.getScript()));
     classStack.push(classDescriptor);
     //noinspection ConstantConditions
     nameStack.push(classNameForScriptPsi(bindingContext, file.getScript()).getInternalName());
   } else {
     nameStack.push(JetPsiUtil.getFQName(file).getFqName().replace('.', '/'));
   }
   file.acceptChildren(this);
   nameStack.pop();
   if (file.isScript()) {
     classStack.pop();
   }
 }