Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faile parse when return object #253

Open
qokelate opened this issue Sep 19, 2020 · 2 comments
Open

Faile parse when return object #253

qokelate opened this issue Sep 19, 2020 · 2 comments

Comments

@qokelate
Copy link

#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject

//decode error
- (NSString *)basicMethodOne:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;

//decode error
- (int *)demo1:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;

- (NSInteger)basicMethodOne;


@end
@qokelate
Copy link
Author

qokelate commented Sep 19, 2020

my simple patch:

index.js:

const methodDeclarationRegex = /([+-]\s*\([^;]+)(?:\s*;)/g;
const matchReturnType = /(?:[+-]\s*\(\s*)(.+?)(?:\s*\)\s*\w+\s*[;:])/;
const argumentsRegex = /\s?\(((?:\w|\s|\*|\<|\>)*)\)((?:\w)*)\s?/g;
test.h

#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject

//decode error
- (   some_spec1 some_spec2 some_spec3 NSString *    )basicMethodOne:(NSInteger)argOne AndArgTwo:(some_spec1 some_spec2 some_spec3 NSString *)argTwo;

//decode error
- (int *)demo1:(NSInteger)argOne AndArgTwo:(NSString *)argTwo;

- (NSInteger    )basicMethodOne;


@end

@DanielMSchmidt
Copy link
Owner

Thank you for filing this @qokelate would you be so kind to open a PR with this fix and a test case for it? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants