2019-05-31 10:21:04 -04:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestObjCMethodDecl(t *testing.T) {
|
2019-06-04 00:14:04 -04:00
|
|
|
nodes := map[string]testNode{
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a58a7570 <line:17:1, col:27> col:1 - isEqual: 'BOOL':'signed char'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a58a7570,
|
|
|
|
Pos: NewPositionFromString("line:17:1, col:27"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "isEqual",
|
|
|
|
Type: "BOOL",
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: false,
|
|
|
|
Parameters: []string{"isEqual"},
|
|
|
|
Implicit: false,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a58a7570,
|
|
|
|
NewPositionFromString("line:17:1, col:27"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a58a7978 </usr/include/objc/NSObject.h:22:1, col:21> col:1 - self 'instancetype':'id'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a58a7978,
|
|
|
|
Pos: NewPositionFromString("/usr/include/objc/NSObject.h:22:1, col:21"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "self",
|
|
|
|
Type: "instancetype",
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: false,
|
|
|
|
Parameters: []string{},
|
|
|
|
Implicit: false,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a58a7978,
|
|
|
|
NewPositionFromString("/usr/include/objc/NSObject.h:22:1, col:21"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a58a82b0 <line:34:1, col:42> col:1 - respondsToSelector: 'BOOL':'signed char'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a58a82b0,
|
|
|
|
Pos: NewPositionFromString("line:34:1, col:42"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "respondsToSelector",
|
|
|
|
Type: "BOOL",
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: false,
|
|
|
|
Parameters: []string{"respondsToSelector"},
|
|
|
|
Implicit: false,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a58a82b0,
|
|
|
|
NewPositionFromString("line:34:1, col:42"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a58a82b0 <line:34:1, col:42> col:1 + instancesRespondToSelector: 'BOOL':'signed char'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a58a82b0,
|
|
|
|
Pos: NewPositionFromString("line:34:1, col:42"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "instancesRespondToSelector",
|
|
|
|
Type: "BOOL",
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: true,
|
|
|
|
Parameters: []string{"instancesRespondToSelector"},
|
|
|
|
Implicit: false,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a58a82b0,
|
|
|
|
NewPositionFromString("line:34:1, col:42"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a58a7cd8 <line:26:1, col:83> col:1 - performSelector:withObject:withObject: 'id':'id'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a58a7cd8,
|
|
|
|
Pos: NewPositionFromString("line:26:1, col:83"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "performSelector",
|
|
|
|
Type: "id",
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: false,
|
|
|
|
Parameters: []string{"performSelector", "withObject", "withObject"},
|
|
|
|
Implicit: false,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a58a7cd8,
|
|
|
|
NewPositionFromString("line:26:1, col:83"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f92a4459318 <line:41:71> col:71 implicit - writableTypeIdentifiersForItemProvider 'NSArray<NSString *> * _Nonnull':'NSArray<NSString *> *'`: testNode{&ObjCMethodDecl{
|
|
|
|
Addr: 0x7f92a4459318,
|
|
|
|
Pos: NewPositionFromString("line:41:71"),
|
|
|
|
Position2: "",
|
|
|
|
Name: "writableTypeIdentifiersForItemProvider",
|
|
|
|
Type: `NSArray<NSString *> * _Nonnull`,
|
|
|
|
Type2: "",
|
|
|
|
ClassMethod: false,
|
|
|
|
Parameters: []string{},
|
|
|
|
Implicit: true,
|
2021-11-16 16:01:03 -05:00
|
|
|
Attr: []string{""},
|
2019-06-11 12:38:22 -04:00
|
|
|
ChildNodes: []Node{},
|
2019-05-31 10:21:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f92a4459318,
|
|
|
|
NewPositionFromString("line:41:71"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-05-31 10:21:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
runNodeTests(t, nodes)
|
|
|
|
}
|