Minor code improvements and TODO fixes.
This commit is contained in:
@@ -49,7 +49,6 @@ public final class TestConfig extends Config {
|
|||||||
List<JetFile> libFiles = new ArrayList<JetFile>();
|
List<JetFile> libFiles = new ArrayList<JetFile>();
|
||||||
for (String libFileName : LIB_FILE_NAMES) {
|
for (String libFileName : LIB_FILE_NAMES) {
|
||||||
JetFile file = null;
|
JetFile file = null;
|
||||||
//TODO: close stream?
|
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||||
InputStream stream = new FileInputStream(LIBRARIES_LOCATION + libFileName);
|
InputStream stream = new FileInputStream(LIBRARIES_LOCATION + libFileName);
|
||||||
@@ -70,6 +69,7 @@ public final class TestConfig extends Config {
|
|||||||
return libFiles;
|
return libFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<JetFile> generateLibFiles() {
|
public List<JetFile> generateLibFiles() {
|
||||||
if (jsLibFiles == null) {
|
if (jsLibFiles == null) {
|
||||||
|
|||||||
@@ -94,13 +94,13 @@ public class FunctionTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: disabled. Probable cause : vars in closures.
|
//TODO: disabled. Probable cause : vars in closures.
|
||||||
//
|
|
||||||
// public void testKT921() throws Exception {
|
//public void testKT921() throws Exception {
|
||||||
//
|
//
|
||||||
// checkOutput("KT-921.kt", "1,\n" +
|
// checkOutput("KT-921.kt", "1,\n" +
|
||||||
// "1, 2,\n" +
|
// "1, 2,\n" +
|
||||||
// "2, ");
|
// "2, ");
|
||||||
// }
|
//}
|
||||||
|
|
||||||
public void testFunctionInsideFunction() throws Exception {
|
public void testFunctionInsideFunction() throws Exception {
|
||||||
fooBoxTest();
|
fooBoxTest();
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
|||||||
import org.jetbrains.k2js.config.Config;
|
import org.jetbrains.k2js.config.Config;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -67,7 +66,7 @@ public final class AnalyzerFacadeForJS {
|
|||||||
|
|
||||||
final ModuleDescriptor owner = new ModuleDescriptor("<module>");
|
final ModuleDescriptor owner = new ModuleDescriptor("<module>");
|
||||||
|
|
||||||
Predicate<PsiFile> completely = Predicates.<PsiFile>and(notLibFiles(config.getLibFiles()), filesToAnalyzeCompletely);
|
Predicate<PsiFile> completely = Predicates.and(notLibFiles(config.getLibFiles()), filesToAnalyzeCompletely);
|
||||||
|
|
||||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(completely, false, false);
|
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(completely, false, false);
|
||||||
|
|
||||||
@@ -115,25 +114,6 @@ public final class AnalyzerFacadeForJS {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: exclude?
|
|
||||||
@NotNull
|
|
||||||
public static BindingContext analyzeNamespace(@NotNull JetFile file) {
|
|
||||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
|
||||||
Project project = file.getProject();
|
|
||||||
|
|
||||||
final ModuleDescriptor owner = new ModuleDescriptor("<module>");
|
|
||||||
|
|
||||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
|
|
||||||
Predicates.<PsiFile>alwaysTrue(), false, false);
|
|
||||||
|
|
||||||
InjectorForTopDownAnalyzerForJs injector = new InjectorForTopDownAnalyzerForJs(
|
|
||||||
project, topDownAnalysisParameters, new ObservableBindingTrace(bindingTraceContext), owner,
|
|
||||||
JetControlFlowDataTraceFactory.EMPTY, JsConfiguration.jsLibConfiguration(project));
|
|
||||||
|
|
||||||
injector.getTopDownAnalyzer().analyzeFiles(Collections.singletonList(file));
|
|
||||||
return bindingTraceContext.getBindingContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final class JsConfiguration implements ModuleConfiguration {
|
private static final class JsConfiguration implements ModuleConfiguration {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
//TODO: clean up the code
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|||||||
Reference in New Issue
Block a user