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

refactor: allow resolution of variables in the proto chain #578

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fluent-bundle/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ function resolveVariableReference(
let arg: FluentVariable;
if (scope.params) {
// We're inside a TermReference. It's OK to reference undefined parameters.
if (Object.prototype.hasOwnProperty.call(scope.params, name)) {
if (Reflect.has(scope.params, name)) {
Copy link
Author

Choose a reason for hiding this comment

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

Reflect.has is not available in IE11. This project doesn't provide details about the level of support that it is offering for legacy browsers, judging by the code, I don't see any usage of Reflect. We can replace this with name in scope.params which is equivalent and does work in legacy systems as well.

arg = scope.params[name];
} else {
return new FluentNone(`$${name}`);
}
} else if (
scope.args
&& Object.prototype.hasOwnProperty.call(scope.args, name)
&& Reflect.has(scope.args, name)
) {
// We're in the top-level Pattern or inside a MessageReference. Missing
// variables references produce ReferenceErrors.
Expand Down