Bug 1436790 - Update Fluent in Gecko to 0.6.2. r=Pike

MozReview-Commit-ID: BC2oTIGLips

--HG--
extra : rebase_source : b7d5122123ff49a2332d3848e235c0c6ae1c0921
This commit is contained in:
Zibi Braniecki 2018-02-08 10:59:29 -08:00
parent a167feb192
commit 5fe1b2b553

View File

@ -95,7 +95,8 @@ class RuntimeParser {
// We don't care about comments or sections at runtime // We don't care about comments or sections at runtime
if (ch === '/' || if (ch === '/' ||
(ch === '#' && [' ', '#'].includes(this._source[this._index + 1]))) { (ch === '#' &&
[' ', '#', '\n'].includes(this._source[this._index + 1]))) {
this.skipComment(); this.skipComment();
return; return;
} }
@ -360,7 +361,9 @@ class RuntimeParser {
this.skipBlankLines(); this.skipBlankLines();
if (this._source[this._index] !== ' ') { if (this._source[this._index] !== ' ') {
// No indentation means we're done with this message. // No indentation means we're done with this message. Callers should check
// if the return value here is null. It may be OK for messages, but not OK
// for terms, attributes and variants.
return firstLineContent; return firstLineContent;
} }
@ -779,6 +782,10 @@ class RuntimeParser {
const val = this.getPattern(); const val = this.getPattern();
if (val === null) {
throw this.error('Expected attribute to have a value');
}
if (typeof val === 'string') { if (typeof val === 'string') {
attrs[key] = val; attrs[key] = val;
} else { } else {
@ -826,11 +833,13 @@ class RuntimeParser {
this.skipInlineWS(); this.skipInlineWS();
const variant = { const val = this.getPattern();
key,
val: this.getPattern() if (val === null) {
}; throw this.error('Expected variant to have a value');
variants[index++] = variant; }
variants[index++] = {key, val};
this.skipWS(); this.skipWS();
} }