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

add support for embedded type references #43

Merged
merged 2 commits into from
Jun 28, 2016
Merged

add support for embedded type references #43

merged 2 commits into from
Jun 28, 2016

Conversation

sshutovskyi
Copy link

No description provided.

@@ -131,7 +132,8 @@ function compileFieldWrite(ctx, field, name) {

var postfix = (field.options.packed ? '' : 'Field') + '(' + field.tag + ', obj.' + name + ')';

var type = ctx[field.type];
var path = field.type.split('.');
var type = path.reduce(function(ctx, name) { return ctx && ctx[name]; }, ctx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's cut this out into a separate function to DRY up identical code.

@mourner
Copy link
Member

mourner commented Jun 27, 2016

Great fix, thanks! Let's drop the bench proto changes — I think this would be better expressed as a separate small proto fixture in test/fixtures and a corresponding test in compile.test.js.

@mourner mourner merged commit 505da7c into mapbox:master Jun 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants