Skip to content

Commit

Permalink
wip better support for dynamic name expressions in get/var
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Dec 8, 2023
1 parent b27dd70 commit 4a95e95
Show file tree
Hide file tree
Showing 5 changed files with 338 additions and 125 deletions.
16 changes: 16 additions & 0 deletions src/ol/expr/expression.js
Expand Up @@ -197,6 +197,20 @@ export class LiteralExpression {
}
}

/**
* @param {Expression} expr Expression
* @return {boolean} Whether the expression relies on properties
*/
function checkReliesOnProperties(expr) {
if (expr instanceof LiteralExpression) {
return false;
}
if (expr.reliesOnProperties) {
return true;
}
return expr.args.some(checkReliesOnProperties);
}

export class CallExpression {
/**
* @param {number} type The return type.
Expand All @@ -207,6 +221,8 @@ export class CallExpression {
this.type = type;
this.operator = operator;
this.args = args;
this.reliesOnProperties =
operator === 'get' || args.some(checkReliesOnProperties);
}
}

Expand Down

0 comments on commit 4a95e95

Please sign in to comment.