forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFSCNMethod.m
58 lines (48 loc) · 1.52 KB
/
FSCNMethod.m
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
// FSCNMethod.m
/* FSCNMethod.m Copyright (c) 2008-2009 Philippe Mougin. */
/* This software is open source. See the license. */
#import "FSCNMethod.h"
#import "FSCompiler.h"
@implementation FSCNMethod
-(void)dealloc
{
[method release];
[super dealloc];
}
- (NSString *)description
{
if (isClassMethod) return [NSString stringWithFormat:@"Method \"+ %@\"", [FSCompiler stringFromSelector:method->selector]];
else return [NSString stringWithFormat:@"Method \"- %@\"", [FSCompiler stringFromSelector:method->selector]];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[super encodeWithCoder:coder];
[coder encodeObject:method forKey:@"method"];
[coder encodeBool: isClassMethod forKey:@"isClassMethod"];
}
- (id)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
nodeType = METHOD;
method = [[coder decodeObjectForKey:@"method"] retain];
isClassMethod = [coder decodeBoolForKey:@"isClassMethod"];
return self;
}
- (id)initWithMethod:(FSMethod *)theMethod isClassMethod:(BOOL)classMethod
{
self = [super init];
if (self != nil)
{
nodeType = METHOD;
method = [theMethod retain];
isClassMethod = classMethod;
}
return self;
}
- (void)translateCharRange:(long)translation
{
[super translateCharRange:translation];
// We do not translate the code nodes in method->code as they are handled differently: they are already
// translated in order for the location information to be relative to the begining of the method body
}
@end