Skip to content

Commit

Permalink
Refactor out some redundant string literals.
Browse files Browse the repository at this point in the history
Josh Klun committed Apr 30, 2016
1 parent 1547868 commit 39a4c3c
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@
#import "OutputLanguageWriterScalaCaseClass.h"
#import "ClassBaseObject.h"

static NSString *const kScalaString = @"String";
static NSString *const kScalaBool = @"Boolean";
static NSString *const kScalaInt = @"Int";
static NSString *const kScalaDouble = @"Double";

@interface OutputLanguageWriterScalaCaseClass ()

- (NSString *)scalaTypeForProperty:(ClassPropertiesObject *)property;
@@ -53,18 +58,17 @@ - (NSString *)scalaTypeForProperty:(ClassPropertiesObject *)property {
case PropertyTypeClass:
collectionType = property.collectionTypeString;
break;
// TODO: All this duplication is kind of gross and it would be nice to refactor it.
case PropertyTypeString:
collectionType = @"String";
collectionType = kScalaString;
break;
case PropertyTypeInt:
collectionType = @"Int";
collectionType = kScalaInt;
break;
case PropertyTypeBool:
collectionType = @"Boolean";
collectionType = kScalaBool;
break;
case PropertyTypeDouble:
collectionType = @"Double";
collectionType = kScalaDouble;
break;
default:
NSLog(@"Warning: scalaTypeForType got invalid collection type: %d for property: %@",
@@ -77,17 +81,17 @@ - (NSString *)scalaTypeForProperty:(ClassPropertiesObject *)property {
case PropertyTypeDictionary:
break;
case PropertyTypeString:
scalaType = @"String";
scalaType = kScalaString;
break;
case PropertyTypeInt:
scalaType = @"Int";
scalaType = kScalaInt;
break;
case PropertyTypeBool:
scalaType = @"Boolean";
scalaType = kScalaBool;
break;
// TODO: It seems like Double is being triggered when Int should be.
case PropertyTypeDouble:
scalaType = @"Double";
scalaType = kScalaDouble;
break;
case PropertyTypeClass:
scalaType = property.referenceClass.className;

0 comments on commit 39a4c3c

Please sign in to comment.