diff --git a/java/src/com/google/template/soy/internal/proto/ProtoUtils.java b/java/src/com/google/template/soy/internal/proto/ProtoUtils.java index 150beb1552..f9ff68cf99 100644 --- a/java/src/com/google/template/soy/internal/proto/ProtoUtils.java +++ b/java/src/com/google/template/soy/internal/proto/ProtoUtils.java @@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument; +import com.google.apps.jspb.Jspb; import com.google.common.base.CaseFormat; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; @@ -239,4 +240,14 @@ public static boolean isMessageLike(FieldDescriptor field) { } return field.getJavaType() == FieldDescriptor.JavaType.MESSAGE; } + + public static boolean isNumberInt64(FieldDescriptor field) { + if (field.getJavaType() != FieldDescriptor.JavaType.LONG) { + return false; + } + if (field.getOptions().hasExtension(Jspb.jstype)) { + return field.getOptions().getExtension(Jspb.jstype) != Jspb.JsType.STRING; + } + return field.getOptions().getJstype() != JSType.JS_STRING; + } }