Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -225,6 +225,8 @@ public class ClosureAnnotator {
|
|||||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||||
String name = recordAnonymousClass(expression.getFunctionLiteral());
|
String name = recordAnonymousClass(expression.getFunctionLiteral());
|
||||||
FunctionDescriptor declarationDescriptor = (FunctionDescriptor) bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, expression);
|
FunctionDescriptor declarationDescriptor = (FunctionDescriptor) bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, expression);
|
||||||
|
// working around a problem with shallow analysis
|
||||||
|
if (declarationDescriptor == null) return;
|
||||||
ClassDescriptor classDescriptor = classDescriptorForFunctionDescriptor(declarationDescriptor, name);
|
ClassDescriptor classDescriptor = classDescriptorForFunctionDescriptor(declarationDescriptor, name);
|
||||||
recordName(classDescriptor, name);
|
recordName(classDescriptor, name);
|
||||||
recordEnclosing(classDescriptor);
|
recordEnclosing(classDescriptor);
|
||||||
|
|||||||
@@ -45,18 +45,17 @@ import org.jetbrains.jet.codegen.ClassBuilder;
|
|||||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||||
import org.jetbrains.jet.codegen.GenerationState;
|
import org.jetbrains.jet.codegen.GenerationState;
|
||||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JetJavaMirrorMarker;
|
import org.jetbrains.jet.lang.resolve.java.JetJavaMirrorMarker;
|
||||||
import org.jetbrains.jet.plugin.JetLanguage;
|
import org.jetbrains.jet.plugin.JetLanguage;
|
||||||
|
import org.jetbrains.jet.plugin.compiler.WholeProjectAnalyzerFacade;
|
||||||
import org.jetbrains.jet.util.QualifiedNamesUtil;
|
import org.jetbrains.jet.util.QualifiedNamesUtil;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMarker {
|
public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMarker {
|
||||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jet.asJava.JetLightClass");
|
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jet.asJava.JetLightClass");
|
||||||
@@ -184,12 +183,14 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
List<JetFile> files = Collections.singletonList(file);
|
|
||||||
//todo:
|
// The context must reflect _all files in the module_. not only the current file
|
||||||
// final BindingContext context = AnalyzerFacadeForJVM.shallowAnalyzeFiles(files);
|
// Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which
|
||||||
final BindingContext context = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file, JetControlFlowDataTraceFactory.EMPTY);
|
// must be loaded from .class files
|
||||||
state.compileCorrectFiles(context, files, CompilationErrorHandler.THROW_EXCEPTION, true);
|
BindingContext context = AnalyzerFacadeForJVM.shallowAnalyzeFiles(WholeProjectAnalyzerFacade.WHOLE_PROJECT_DECLARATION_PROVIDER.fun(file));
|
||||||
|
|
||||||
|
state.compileCorrectFiles(context, Collections.singletonList(file), CompilationErrorHandler.THROW_EXCEPTION, true);
|
||||||
state.getFactory().files();
|
state.getFactory().files();
|
||||||
|
|
||||||
return answer;
|
return answer;
|
||||||
|
|||||||
Reference in New Issue
Block a user