-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypes.h
75 lines (65 loc) · 2.04 KB
/
Types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// Types.h
//
// Created by Gregory Casamento on 10/20/14.
//
#import <Foundation/Foundation.h>
@class ASTNode;
@class ExpressionList;
enum {
STRING = 1,
BOOLEAN, NUMBER, ARRAY, DICTIONARY,
TUPLE,
FUNCTION,
CLASS,
STRUCT,
VOID,
UNKOWN
};
typedef NSUInteger SwiftType;
// GenericType...
@interface GenericType : NSObject
@property (nonatomic,assign) SwiftType type;
@property (nonatomic,assign) BOOL optional;
- (id)initWithType: (SwiftType)type;
- (GenericType *) operate: (NSString *)op
: (GenericType *)other;
- (NSString *) customBinaryOperator: (ASTNode *)myNode
: (NSString *)op
: (ASTNode *)otherNode;
- (GenericType *) fromTypeIdentifier: (NSString *)name;
@end
// IndirectionType...
@interface IndirectionType : GenericType
@property (nonatomic, retain) GenericType *pointer;
- (id) initWithPointer: (GenericType *)pointer;
- (void) update: (GenericType *)pointer;
@end
// TupleType...
@interface TupleType: GenericType
@property (nonatomic, retain) NSMutableArray *names;
@property (nonatomic, retain) NSMutableArray *types;
- (id) initWithList: (ExpressionList *)list;
- (void) addType: (NSString *)name
: (GenericType *)type;
- (GenericType *) getTypeForIndex:(int)index;
@end
// ArrayType...
@interface ArrayType: GenericType
@property (nonatomic, retain) GenericType *innerType;
- (id) initWithInnerType: (GenericType *)innerType;
@end
// DictionaryType...
@interface DictionaryType: GenericType
@property (nonatomic, retain) GenericType *innerType;
- (id) initWithInnerType: (GenericType *)innerType;
@end
// FunctionType...
@interface FunctionType: GenericType
@property (nonatomic, retain) GenericType *returnType;
@property (nonatomic, retain) NSMutableArray *argumentTypes;
- (id) initWithArgumentTypes: (NSMutableArray *)argumentTypes
returnType: (GenericType *)returnType;
- (id) initWithArgumentTypes:(GenericType *)argumentType
returnType:(GenericType *)returnType;
@end