JS frontend: introduce some JavaScript specific constants.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.k2js
|
||||
|
||||
object JavaScript {
|
||||
val FULL_NAME = "JavaScript"
|
||||
val NAME = "JS"
|
||||
val LOWER_NAME = "js"
|
||||
|
||||
val EXTENSION = "js"
|
||||
val DOT_EXTENSION = "." + EXTENSION
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.intellij.util.io.URLUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
import org.jetbrains.k2js.JavaScript;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -45,8 +46,8 @@ public class LibrarySourcesConfig extends Config {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.k2js.config.LibrarySourcesConfig");
|
||||
public static final String STDLIB_JS_MODULE_NAME = "stdlib";
|
||||
public static final String BUILTINS_JS_MODULE_NAME = "builtins";
|
||||
public static final String BUILTINS_JS_FILE_NAME = BUILTINS_JS_MODULE_NAME + ".js";
|
||||
public static final String STDLIB_JS_FILE_NAME = STDLIB_JS_MODULE_NAME + ".js";
|
||||
public static final String BUILTINS_JS_FILE_NAME = BUILTINS_JS_MODULE_NAME + JavaScript.DOT_EXTENSION;
|
||||
public static final String STDLIB_JS_FILE_NAME = STDLIB_JS_MODULE_NAME + JavaScript.DOT_EXTENSION;
|
||||
|
||||
@NotNull
|
||||
private final List<String> files;
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.JavaScript;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
@@ -38,7 +39,7 @@ public final class NativeInteropTest extends SingleFileTranslationTest {
|
||||
protected List<String> additionalJsFiles(@NotNull EcmaVersion ecmaVersion) {
|
||||
List<String> result = Lists.newArrayList(super.additionalJsFiles(ecmaVersion));
|
||||
|
||||
String jsFilePath = pathToTestDir() + NATIVE + "/" + getTestName(true) + ".js";
|
||||
String jsFilePath = pathToTestDir() + NATIVE + "/" + getTestName(true) + JavaScript.DOT_EXTENSION;
|
||||
File jsFile = new File(jsFilePath);
|
||||
if (jsFile.exists() && jsFile.isFile()) {
|
||||
result.add(jsFilePath);
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.k2js.test.utils;
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.JsFunction;
|
||||
import com.google.dart.compiler.backend.js.ast.JsNode;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.JavaScript;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
|
||||
import java.io.File;
|
||||
@@ -43,7 +42,7 @@ public final class JsTestUtils {
|
||||
|
||||
@NotNull
|
||||
public static String convertFileNameToDotJsFile(@NotNull String filename, @NotNull EcmaVersion ecmaVersion) {
|
||||
String postFix = "_" + ecmaVersion.toString() + ".js";
|
||||
String postFix = "_" + ecmaVersion.toString() + JavaScript.DOT_EXTENSION;
|
||||
int index = filename.lastIndexOf('.');
|
||||
if (index < 0) {
|
||||
return filename + postFix;
|
||||
|
||||
Reference in New Issue
Block a user