Java dependencies untangled from AnalyzingUtils
This commit is contained in:
Generated
+8
-8
@@ -2,14 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
<buildFile url="file://$PROJECT_DIR$/idea/buildLexer.xml">
|
||||
<additionalClassPath />
|
||||
<antReference projectDefault="true" />
|
||||
<customJdkName value="" />
|
||||
<maximumHeapSize value="128" />
|
||||
<maximumStackSize value="2" />
|
||||
<properties />
|
||||
</buildFile>
|
||||
<buildFile url="file://$PROJECT_DIR$/grammar/buildGrammarLexer.xml">
|
||||
<additionalClassPath />
|
||||
<antReference projectDefault="true" />
|
||||
@@ -26,6 +18,14 @@
|
||||
<maximumStackSize value="2" />
|
||||
<properties />
|
||||
</buildFile>
|
||||
<buildFile url="file://$PROJECT_DIR$/frontend/buildLexer.xml">
|
||||
<additionalClassPath />
|
||||
<antReference projectDefault="true" />
|
||||
<customJdkName value="" />
|
||||
<maximumHeapSize value="128" />
|
||||
<maximumStackSize value="2" />
|
||||
<properties />
|
||||
</buildFile>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDefaultImports;
|
||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.commons.Method;
|
||||
@@ -86,7 +87,7 @@ public class GenerationState {
|
||||
public void compile(JetFile psiFile) {
|
||||
final JetNamespace namespace = psiFile.getRootNamespace();
|
||||
NamespaceCodegen codegen = forNamespace(namespace);
|
||||
final BindingContext bindingContext = AnalyzingUtils.analyzeNamespace(namespace, JetControlFlowDataTraceFactory.EMPTY);
|
||||
final BindingContext bindingContext = AnalyzingUtils.getInstance(JavaDefaultImports.JAVA_DEFAULT_IMPORTS).analyzeNamespace(namespace, JetControlFlowDataTraceFactory.EMPTY);
|
||||
bindingContexts.push(bindingContext);
|
||||
typeMapper = new JetTypeMapper(standardLibrary, bindingContext);
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<project name="ConfluenceLexer" default="confluenceLexer">
|
||||
<property name="home" value="${basedir}"/>
|
||||
<property file="${home}/../idea/idea.properties"/>
|
||||
<property file="${home}/../frontend/idea.properties"/>
|
||||
|
||||
<property name="flex.base" value="${idea.home}/tools/lexer/jflex-1.4"/>
|
||||
<property name="out.dir" value="${basedir}/tmpout"/>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.jetbrains.jet.lang.resolve.java;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.ImportingStrategy;
|
||||
import org.jetbrains.jet.lang.resolve.WritableScope;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JavaDefaultImports {
|
||||
public static final ImportingStrategy JAVA_DEFAULT_IMPORTS = new ImportingStrategy() {
|
||||
@Override
|
||||
public void addImports(Project project, JetSemanticServices semanticServices, BindingTrace trace, WritableScope rootScope) {
|
||||
// scope.importScope(javaSemanticServices.getDescriptorResolver().resolveNamespace("").getMemberScope());
|
||||
// scope.importScope(javaSemanticServices.getDescriptorResolver().resolveNamespace("java.lang").getMemberScope());
|
||||
JavaSemanticServices javaSemanticServices = new JavaSemanticServices(project, semanticServices, trace);
|
||||
rootScope.importScope(new JavaPackageScope("", null, javaSemanticServices));
|
||||
rootScope.importScope(new JavaPackageScope("java.lang", null, javaSemanticServices));
|
||||
}
|
||||
};
|
||||
}
|
||||
+52
-47
@@ -30,37 +30,31 @@ public class AnalyzingUtils {
|
||||
private final static Key<CachedValue<BindingContext>> BINDING_CONTEXT = Key.create("BINDING_CONTEXT");
|
||||
private static final Object lock = new Object();
|
||||
|
||||
public static BindingContext analyzeFileWithCache(@NotNull final JetFile file) {
|
||||
// TODO : Synchronization?
|
||||
CachedValue<BindingContext> bindingContextCachedValue = file.getUserData(BINDING_CONTEXT);
|
||||
if (bindingContextCachedValue == null) {
|
||||
bindingContextCachedValue = CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<BindingContext>() {
|
||||
@Override
|
||||
public Result<BindingContext> compute() {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
JetNamespace rootNamespace = file.getRootNamespace();
|
||||
BindingContext bindingContext = analyzeNamespace(rootNamespace, JetControlFlowDataTraceFactory.EMPTY);
|
||||
return new Result<BindingContext>(bindingContext, PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||
bindingTraceContext.getErrorHandler().genericError(file.getNode(), e.getClass().getSimpleName() + ": " + e.getMessage());
|
||||
return new Result<BindingContext>(bindingTraceContext.getBindingContext(), PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
file.putUserData(BINDING_CONTEXT, bindingContextCachedValue);
|
||||
}
|
||||
return bindingContextCachedValue.getValue();
|
||||
public static AnalyzingUtils getInstance(@NotNull ImportingStrategy importingStrategy) {
|
||||
return new AnalyzingUtils(importingStrategy);
|
||||
}
|
||||
|
||||
public static BindingContext analyzeNamespace(@NotNull JetNamespace namespace, @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
||||
public static void checkForSyntacticErrors(@NotNull PsiElement root) {
|
||||
root.acceptChildren(new PsiElementVisitor() {
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorElement(PsiErrorElement element) {
|
||||
throw new IllegalArgumentException(element.getErrorDescription() + "; looking at " + element.getNode().getElementType() + " '" + element.getText() + ErrorHandler.atLocation(element));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final ImportingStrategy importingStrategy;
|
||||
|
||||
private AnalyzingUtils(ImportingStrategy importingStrategy) {
|
||||
this.importingStrategy = importingStrategy;
|
||||
}
|
||||
|
||||
public BindingContext analyzeNamespace(@NotNull JetNamespace namespace, @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
||||
Project project = namespace.getProject();
|
||||
|
||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||
@@ -69,12 +63,7 @@ public class AnalyzingUtils {
|
||||
JetScope libraryScope = semanticServices.getStandardLibrary().getLibraryScope();
|
||||
ModuleDescriptor owner = new ModuleDescriptor("<module>");
|
||||
final WritableScope scope = new WritableScopeImpl(libraryScope, owner, bindingTraceContext.getErrorHandler()).setDebugName("Root scope in analyzeNamespace");
|
||||
// scope.importScope(javaSemanticServices.getDescriptorResolver().resolveNamespace("").getMemberScope());
|
||||
// scope.importScope(javaSemanticServices.getDescriptorResolver().resolveNamespace("java.lang").getMemberScope());
|
||||
JavaSemanticServices javaSemanticServices = new JavaSemanticServices(project, semanticServices, bindingTraceContext);
|
||||
scope.importScope(new JavaPackageScope("", null, javaSemanticServices));
|
||||
scope.importScope(new JavaPackageScope("java.lang", null, javaSemanticServices));
|
||||
|
||||
importingStrategy.addImports(project, semanticServices, bindingTraceContext, scope);
|
||||
TopDownAnalyzer.process(semanticServices, bindingTraceContext, scope, new NamespaceLike.Adapter(owner) {
|
||||
|
||||
@Override
|
||||
@@ -110,17 +99,33 @@ public class AnalyzingUtils {
|
||||
return bindingTraceContext.getBindingContext();
|
||||
}
|
||||
|
||||
public static void checkForSyntacticErrors(@NotNull PsiElement root) {
|
||||
root.acceptChildren(new PsiElementVisitor() {
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorElement(PsiErrorElement element) {
|
||||
throw new IllegalArgumentException(element.getErrorDescription() + "; looking at " + element.getNode().getElementType() + " '" + element.getText() + ErrorHandler.atLocation(element));
|
||||
}
|
||||
});
|
||||
public BindingContext analyzeFileWithCache(@NotNull final JetFile file) {
|
||||
// TODO : Synchronization?
|
||||
CachedValue<BindingContext> bindingContextCachedValue = file.getUserData(BINDING_CONTEXT);
|
||||
if (bindingContextCachedValue == null) {
|
||||
bindingContextCachedValue = CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<BindingContext>() {
|
||||
@Override
|
||||
public Result<BindingContext> compute() {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
JetNamespace rootNamespace = file.getRootNamespace();
|
||||
BindingContext bindingContext = analyzeNamespace(rootNamespace, JetControlFlowDataTraceFactory.EMPTY);
|
||||
return new Result<BindingContext>(bindingContext, PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||
bindingTraceContext.getErrorHandler().genericError(file.getNode(), e.getClass().getSimpleName() + ": " + e.getMessage());
|
||||
return new Result<BindingContext>(bindingTraceContext.getBindingContext(), PsiModificationTracker.MODIFICATION_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
file.putUserData(BINDING_CONTEXT, bindingContextCachedValue);
|
||||
}
|
||||
return bindingContextCachedValue.getValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface ImportingStrategy {
|
||||
ImportingStrategy NONE = new ImportingStrategy() {
|
||||
@Override
|
||||
public void addImports(Project project, JetSemanticServices semanticServices, BindingTrace trace, WritableScope rootScope) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
void addImports(Project project, JetSemanticServices semanticServices, BindingTrace trace, WritableScope rootScope);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 9/9/11 2:48 PM */
|
||||
/* The following code was generated by JFlex 1.4.3 on 9/9/11 9:32 PM */
|
||||
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package org.jetbrains.jet.lexer;
|
||||
@@ -14,8 +14,8 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
|
||||
* on 9/9/11 2:48 PM from the specification file
|
||||
* <tt>/Users/abreslav/work/jet/idea/src/org/jetbrains/jet/lexer/Jet.flex</tt>
|
||||
* on 9/9/11 9:32 PM from the specification file
|
||||
* <tt>/Users/abreslav/work/jet/frontend/src/org/jetbrains/jet/lexer/Jet.flex</tt>
|
||||
*/
|
||||
class _JetLexer implements FlexLexer {
|
||||
/** initial size of the lookahead buffer */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<project name="GrammarLexer" default="lexer">
|
||||
<property name="home" value="${basedir}"/>
|
||||
<property file="${home}/../idea/idea.properties"/>
|
||||
<property file="${home}/../frontend/idea.properties"/>
|
||||
|
||||
<property name="flex.base" value="${idea.home}/tools/lexer/jflex-1.4"/>
|
||||
<property name="out.dir" value="${basedir}/tmpout"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 6/28/11 5:58 PM */
|
||||
/* The following code was generated by JFlex 1.4.3 on 9/9/11 9:32 PM */
|
||||
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package org.jetbrains.jet.grammar;
|
||||
@@ -13,7 +13,7 @@ package org.jetbrains.jet.grammar;
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
|
||||
* on 6/28/11 5:58 PM from the specification file
|
||||
* on 9/9/11 9:32 PM from the specification file
|
||||
* <tt>/Users/abreslav/work/jet/grammar/src/org/jetbrains/jet/grammar/Grammar.flex</tt>
|
||||
*/
|
||||
class _GrammarLexer {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<orderEntry type="module" module-name="backend" />
|
||||
<orderEntry type="module" module-name="frontend" />
|
||||
<orderEntry type="module" module-name="frontend.java" />
|
||||
<orderEntry type="module" module-name="stdlib" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jetbrains.jet.plugin;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetNamespace;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDefaultImports;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class AnalyzerFacade {
|
||||
public static BindingContext analyzeNamespace(@NotNull JetNamespace namespace, @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
||||
return AnalyzingUtils.getInstance(JavaDefaultImports.JAVA_DEFAULT_IMPORTS).analyzeNamespace(namespace, flowDataTraceFactory);
|
||||
}
|
||||
|
||||
public static BindingContext analyzeFileWithCache(@NotNull JetFile file) {
|
||||
return AnalyzingUtils.getInstance(JavaDefaultImports.JAVA_DEFAULT_IMPORTS).analyzeFileWithCache(file);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
@@ -26,7 +25,7 @@ public class JetQuickDocumentationProvider extends AbstractDocumentationProvider
|
||||
ref = PsiTreeUtil.getParentOfType(originalElement, JetReferenceExpression.class);
|
||||
}
|
||||
if (ref != null) {
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache((JetFile) element.getContainingFile());
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache((JetFile) element.getContainingFile());
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, ref);
|
||||
if (declarationDescriptor != null) {
|
||||
return render(declarationDescriptor);
|
||||
|
||||
@@ -11,9 +11,9 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ public class ShowExpressionTypeAction extends AnAction {
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
assert editor != null && psiFile != null;
|
||||
JetExpression expression;
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache((JetFile) psiFile);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache((JetFile) psiFile);
|
||||
if (editor.getSelectionModel().hasSelection()) {
|
||||
int startOffset = editor.getSelectionModel().getSelectionStart();
|
||||
int endOffset = editor.getSelectionModel().getSelectionEnd();
|
||||
|
||||
@@ -13,10 +13,10 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
import org.jetbrains.jet.plugin.JetHighlighter;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -51,7 +51,7 @@ public class DebugInfoAnnotator implements Annotator {
|
||||
if (element instanceof JetFile) {
|
||||
JetFile file = (JetFile) element;
|
||||
try {
|
||||
final BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
final BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
|
||||
final Set<JetReferenceExpression> unresolvedReferences = Sets.newHashSet();
|
||||
for (JetDiagnostic diagnostic : bindingContext.getDiagnostics()) {
|
||||
|
||||
@@ -16,12 +16,15 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.PsiIconUtil;
|
||||
import com.intellij.util.PsiNavigateUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -42,7 +45,7 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
JetFile file = PsiTreeUtil.getParentOfType(element, JetFile.class);
|
||||
|
||||
if (file == null) return null;
|
||||
final BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
final BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
|
||||
if (element instanceof JetClass) {
|
||||
JetClass jetClass = (JetClass) element;
|
||||
|
||||
@@ -11,14 +11,14 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.plugin.JetHighlighter;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
import org.jetbrains.jet.plugin.JetHighlighter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -43,7 +43,7 @@ public class JetPsiChecker implements Annotator {
|
||||
if (element instanceof JetFile) {
|
||||
JetFile file = (JetFile) element;
|
||||
try {
|
||||
final BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
final BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
|
||||
ErrorHandler errorHandler = new ErrorHandler() {
|
||||
private final Set<DeclarationDescriptor> redeclarations = new HashSet<DeclarationDescriptor>();
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -125,7 +125,7 @@ public class JetPositionManager implements PositionManager {
|
||||
if (mapper != null) {
|
||||
return mapper;
|
||||
}
|
||||
final BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
final BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
final JetStandardLibrary standardLibrary = JetStandardLibrary.getJetStandardLibrary(myDebugProcess.getProject());
|
||||
final JetTypeMapper typeMapper = new JetTypeMapper(standardLibrary, bindingContext);
|
||||
file.acceptChildren(new JetVisitorVoid() {
|
||||
|
||||
@@ -9,9 +9,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class JetPsiReference implements PsiPolyVariantReference {
|
||||
|
||||
protected PsiElement doResolve() {
|
||||
JetFile file = (JetFile) getElement().getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
PsiElement psiElement = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, myExpression);
|
||||
if (psiElement != null) {
|
||||
return psiElement;
|
||||
@@ -87,7 +87,7 @@ public abstract class JetPsiReference implements PsiPolyVariantReference {
|
||||
|
||||
protected ResolveResult[] doMultiResolve() {
|
||||
JetFile file = (JetFile) getElement().getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
Collection<? extends DeclarationDescriptor> declarationDescriptors = bindingContext.get(AMBIGUOUS_REFERENCE_TARGET, myExpression);
|
||||
assert declarationDescriptors != null;
|
||||
ResolveResult[] results = new ResolveResult[declarationDescriptors.size()];
|
||||
|
||||
@@ -12,10 +12,10 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.JetScope;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
|
||||
import java.util.List;
|
||||
@@ -49,7 +49,7 @@ class JetSimpleNameReference extends JetPsiReference {
|
||||
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) parent;
|
||||
JetExpression receiverExpression = qualifiedExpression.getReceiverExpression();
|
||||
JetFile file = (JetFile) myExpression.getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, receiverExpression);
|
||||
if (expressionType != null) {
|
||||
return collectLookupElements(bindingContext, expressionType.getMemberScope());
|
||||
@@ -57,7 +57,7 @@ class JetSimpleNameReference extends JetPsiReference {
|
||||
}
|
||||
else {
|
||||
JetFile file = (JetFile) myExpression.getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache(file);
|
||||
JetScope resolutionScope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, myExpression);
|
||||
if (resolutionScope != null) {
|
||||
return collectLookupElements(bindingContext, resolutionScope);
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedDeclaration;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -68,7 +68,7 @@ public class JetControlFlowTest extends JetTestCaseBase {
|
||||
|
||||
};
|
||||
|
||||
AnalyzingUtils.analyzeNamespace(file.getRootNamespace(), new JetControlFlowDataTraceFactory() {
|
||||
AnalyzerFacade.analyzeNamespace(file.getRootNamespace(), new JetControlFlowDataTraceFactory() {
|
||||
@NotNull
|
||||
@Override
|
||||
public JetPseudocodeTrace createTrace(JetElement element) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class JetCodeConformanceTest extends TestCase {
|
||||
TestSuite suite = new TestSuite();
|
||||
TestSuite ats = new TestSuite("Side-effect-free at()'s in assertions");
|
||||
suite.addTest(ats);
|
||||
File parsingSourceDir = new File("./idea/src/org/jetbrains/jet/lang/parsing");
|
||||
File parsingSourceDir = new File("./frontend/src/org/jetbrains/jet/lang/parsing");
|
||||
for (File sourceFile : parsingSourceDir.listFiles()) {
|
||||
if (sourceFile.getName().endsWith(".java")) {
|
||||
ats.addTest(new JetCodeConformanceTest(sourceFile.getName(), sourceFile));
|
||||
|
||||
@@ -10,13 +10,13 @@ import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||
import org.jetbrains.jet.plugin.AnalyzerFacade;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -95,7 +95,7 @@ public class ExpectedResolveData {
|
||||
JetSemanticServices semanticServices = JetSemanticServices.createSemanticServices(file.getProject());
|
||||
JetStandardLibrary lib = semanticServices.getStandardLibrary();
|
||||
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeNamespace(file.getRootNamespace(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeNamespace(file.getRootNamespace(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
ErrorHandler.applyHandler(new ErrorHandler() {
|
||||
@Override
|
||||
public void unresolvedReference(@NotNull JetReferenceExpression referenceExpression) {
|
||||
|
||||
Reference in New Issue
Block a user