Created
December 22, 2017 18:28
-
-
Save Frazi1/4768b379e2c4885fbbb4fa49fe13b05b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ReturnTypeToStringConverter | |
{ | |
public static string Convert(ReturnType returnType) | |
{ | |
switch (returnType) | |
{ | |
case BoolReturnType boolReturnType: | |
return JasminReferenceConstants.JavaBool; | |
case CharReturnType charReturnType: | |
return JasminReferenceConstants.JavaChar; | |
case ArrayReturnType arrayReturnType: | |
return $"{JasminReferenceConstants.ArrayMark}{Convert(arrayReturnType.InnerType)}"; | |
case IntReturnType intReturnType: | |
return JasminReferenceConstants.JavaInteger; | |
case StringReturnType stringReturnType: | |
return JasminReferenceConstants.JavaStringClass; | |
case VoidReturnType voidReturnType: | |
return JasminReferenceConstants.JavaVoid; | |
default: | |
throw new InvalidOperationException($"Bad type {returnType} (Convert)"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment