Allow Cxx references to be used in native module's method signature

Reviewed By: javache

Differential Revision: D5772182

fbshipit-source-id: 21e2f7b8d14ffdcfc0ba969c9a35315863a19b71
This commit is contained in:
Alex Dvornikov 2017-09-07 09:11:27 -07:00 committed by Facebook Github Bot
parent 1f2ca244d7
commit bd723745c1
2 changed files with 7 additions and 4 deletions

View File

@ -90,11 +90,12 @@ extern SEL RCTParseMethodSignature(const char *methodSignature, NSArray **argTyp
- (void)testNamespacedCxxStruct
{
NSArray *arguments;
const char *methodSignature = "foo:(foo::type &)foo";
const char *methodSignature = "foo:(foo::type &)foo bar:(bar::type &)bar";
SEL selector = RCTParseMethodSignature(methodSignature, &arguments);
XCTAssertEqualObjects(NSStringFromSelector(selector), @"foo:");
XCTAssertEqual(arguments.count, (NSUInteger)1);
XCTAssertEqualObjects(NSStringFromSelector(selector), @"foo:bar:");
XCTAssertEqual(arguments.count, (NSUInteger)2);
XCTAssertEqualObjects(((RCTMethodArgument *)arguments[0]).type, @"foo::type");
XCTAssertEqualObjects(((RCTMethodArgument *)arguments[1]).type, @"bar::type");
}
- (void)testAttributes

View File

@ -136,7 +136,9 @@ NSString *RCTParseType(const char **input)
RCTReadChar(input, '>');
}
RCTSkipWhitespace(input);
RCTReadChar(input, '*');
if (!RCTReadChar(input, '*')) {
RCTReadChar(input, '&');
}
return type;
}