Remove duplicate method
Closes
@@ -17,8 +17,8 @@ package com.google.javascript.jscomp;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT;
-import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT_YET;
+import static com.google.javascript.jscomp.Es6ToEs3Util.cannotConvert;
+import static com.google.javascript.jscomp.Es6ToEs3Util.cannotConvertYet;
import com.google.auto.value.AutoValue;
import com.google.common.base.Preconditions;
@@ -110,12 +110,12 @@ public final class Es6RewriteClass implements NodeTraversal.Callback, HotSwapCom
case GETTER_DEF:
case SETTER_DEF:
if (FeatureSet.ES3.contains(compiler.getOptions().getOutputFeatureSet())) {
- cannotConvert(n, "ES5 getters/setters (consider using --language_out=ES5)");
+ cannotConvert(compiler, n, "ES5 getters/setters (consider using --language_out=ES5)");
return false;
}
break;
case NEW_TARGET:
- cannotConvertYet(n, "new.target");
+ cannotConvertYet(compiler, n, "new.target");
break;
default:
break;
@@ -434,11 +434,12 @@ public final class Es6RewriteClass implements NodeTraversal.Callback, HotSwapCom
*/
private void visitNonMethodMember(Node member, ClassDeclarationMetadata metadata) {
if (member.isComputedProp() && member.isStaticMember()) {
- cannotConvertYet(member, "Static computed property");
+ cannotConvertYet(compiler, member, "Static computed property");
return;
}
if (member.isComputedProp() && !member.getFirstChild().isQualifiedName()) {
- cannotConvert(member.getFirstChild(), "Computed property with non-qualified-name key");
+ cannotConvert(
+ compiler, member.getFirstChild(), "Computed property with non-qualified-name key");
return;
}
@@ -589,19 +590,6 @@ public final class Es6RewriteClass implements NodeTraversal.Callback, HotSwapCom
}
- private void cannotConvert(Node n, String message) {
- compiler.report(JSError.make(n, CANNOT_CONVERT, message));
- }
-
- /**
- * Warns the user that the given ES6 feature cannot be converted to ES3
- * because the transpilation is not yet implemented. A call to this method
- * is essentially a "TODO(tbreisacher): Implement {@code feature}" comment.
- */
- private void cannotConvertYet(Node n, String feature) {
- compiler.report(JSError.make(n, CANNOT_CONVERT_YET, feature));
- }
-
private Node createPropertyDescriptor() {
return IR.objectlit(
astFactory.createStringKey("configurable", astFactory.createBoolean(true)),
