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

[TIMOB-23902] Use boxed expression to return enum value #139

Merged
merged 1 commit into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion metabase/ios/lib/generate/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ function getObjCReturnResult (value, name, returns, asPointer) {
return returns + ' (' + name + ' == nil) ? (id)[NSNull null] : (id)[HyperloopPointer pointer:(const void *)' + asPointer + name + ' encoding:@encode(' + value.value + ')];';
}
case 'enum': {
return returns + ' [HyperloopPointer pointer:(const void *)' + asPointer + name + ' encoding:@encode(' + value.value + ')];';
return returns + ' @(' + name + ');';
}
case 'struct': {
if (value.framework && value.filename) {
Expand Down
15 changes: 15 additions & 0 deletions metabase/ios/test/util_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var should = require('should');
var util = require('../lib/generate/util');

describe('util', function () {
describe('getObjCReturnResult()', function() {
it('should use boxed expression to return enums', function() {
var variableName = 'arg1';
var value = {
type: 'enum'
};
var returnResult = util.getObjCReturnResult(value, variableName);
should(returnResult).be.equal('return @(' + variableName + ');');
});
});
});