Skip to content

Commit

Permalink
Allow Cxx references to be used in native module's method signature
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D5772182

fbshipit-source-id: 21e2f7b8d14ffdcfc0ba969c9a35315863a19b71
  • Loading branch information
fromcelticpark authored and facebook-github-bot committed Sep 7, 2017
1 parent 1f2ca24 commit bd72374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions RNTester/RNTesterUnitTests/RCTMethodArgumentTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ - (void)testUntypedUnnamedArgs
- (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
Expand Down
4 changes: 3 additions & 1 deletion React/Base/RCTParserUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ static BOOL RCTIsCollectionType(NSString *type)
RCTReadChar(input, '>');
}
RCTSkipWhitespace(input);
RCTReadChar(input, '*');
if (!RCTReadChar(input, '*')) {
RCTReadChar(input, '&');
}
return type;
}

Expand Down

0 comments on commit bd72374

Please sign in to comment.