GenerationStrategy removed
This commit is contained in:
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.GenerationStrategy;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
@@ -38,7 +37,7 @@ import static org.jetbrains.jet.codegen.binding.CodegenBinding.registerClassName
|
||||
public class KotlinCodegenFacade {
|
||||
public static void compileCorrectFiles(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull GenerationStrategy strategy, @NotNull CompilationErrorHandler errorHandler
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
) {
|
||||
for (JetFile file : state.getFiles()) {
|
||||
if (file.isScript()) {
|
||||
@@ -60,9 +59,19 @@ public class KotlinCodegenFacade {
|
||||
}
|
||||
|
||||
for (Map.Entry<FqName, Collection<JetFile>> entry : namespaceGrouping.entrySet()) {
|
||||
strategy.generateNamespace(state, entry.getKey(), entry.getValue(), errorHandler);
|
||||
generateNamespace(state, entry.getKey(), entry.getValue(), errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateNamespace(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FqName fqName,
|
||||
@NotNull Collection<JetFile> jetFiles,
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
) {
|
||||
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
|
||||
codegen.generate(errorHandler);
|
||||
}
|
||||
|
||||
private KotlinCodegenFacade() {}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.jetbrains.jet.codegen.context.CodegenContext;
|
||||
import org.jetbrains.jet.codegen.context.ScriptContext;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.StandardGenerationStrategy;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
@@ -251,7 +250,7 @@ public class ScriptCodegen extends MemberCodegen {
|
||||
registerClassNameForScript(state.getBindingTrace(), script, className);
|
||||
|
||||
state.beforeCompile();
|
||||
StandardGenerationStrategy.INSTANCE.generateNamespace(
|
||||
KotlinCodegenFacade.generateNamespace(
|
||||
state,
|
||||
JetPsiUtil.getFQName((JetFile) script.getContainingFile()),
|
||||
Collections.singleton((JetFile) script.getContainingFile()),
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.codegen.state;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface GenerationStrategy {
|
||||
void generateNamespace(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FqName fqName,
|
||||
@NotNull Collection<JetFile> jetFiles,
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.codegen.state;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.NamespaceCodegen;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class StandardGenerationStrategy implements GenerationStrategy {
|
||||
public static final GenerationStrategy INSTANCE = new StandardGenerationStrategy();
|
||||
|
||||
private StandardGenerationStrategy() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateNamespace(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FqName fqName,
|
||||
@NotNull Collection<JetFile> jetFiles,
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
) {
|
||||
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
|
||||
codegen.generate(errorHandler);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user