unknown type is now a nice error

This commit is contained in:
rusefi 2019-05-29 23:54:25 -04:00
parent 493bd4c677
commit d33f117688
1 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,9 @@ public class TypesHelper {
public static final String UINT8_T = "uint8_t";
public static final String UINT_16_T = "uint16_t";
public static final String INT_16_T = "int16_t";
private static final String FLOAT_T = "float";
private static final String INT_32_T = "int";
private static final String UINT_32_T = "uint32_t";
public static int getElementSize(ReaderState state, String type) {
Objects.requireNonNull(state);
@ -23,7 +26,11 @@ public class TypesHelper {
if (type.equals(INT_16_T) || type.equals(UINT_16_T)) {
return 2;
}
return 4;
if (type.equals(FLOAT_T) || type.equals(INT_32_T) || type.equals(UINT_32_T) ||
type.equals("angle_t")) {
return 4;
}
throw new IllegalArgumentException("Unknown type " + type);
}
public static String convertToTs(String type) {