Skip to content

Conversation

@zbraniecki
Copy link
Collaborator

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1405645

@stasm - one trick is that I don't know how to test such cases in our runtime library. Seems like I need to test for errors and AST, but the tests don't seem to handle that right now.

So, maybe it's worth it to just land it since it passes all tests and we manually tested that it works, and once we improve the infra, add tests for that?

@zbraniecki zbraniecki requested a review from stasm October 5, 2017 15:29
Copy link
Contributor

@stasm stasm left a comment

Choose a reason for hiding this comment

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

Thanks, r+. Can you respond to my questions below before merging?

this._index = lineStart;

if (ch === '#') {
if (attrs !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to remove this check and the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. Since we don't support both, let's just consume one or the other and move on. This simplifies the code and we only pay with a different error message that gives less of a clue, which I think is ok, since our runtime errors are not meaningful at all anyway (since we optimize for perf).

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree we shouldn't care about the error itself, but the important thing here is to make the runtime parser yield the same Junks as the full syntax parser. Otherwise, as a developer you might write something which will work in testing, but will break in Pontoon / compare-locales etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zbraniecki made me realize that the if-else in lines 162-166 is enough to junkify an erroneous message here.

this.skipInlineWS();
val = this.getPattern();
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this else block an optimization for the most common use-case of a one-line key = value? If so, can you add a comment explaining it, please?

@zbraniecki zbraniecki merged commit 1a8d7f4 into projectfluent:master Oct 5, 2017
@zbraniecki zbraniecki deleted the force-indent branch December 12, 2017 04:42
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.

2 participants