Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Expressions: an expression can't delete or redefine thisLayer, thisComp or the other unqualified names

tylerjenningswecb8dadde5af
diff --git a/crates/expr/src/prelude.js b/crates/expr/src/prelude.js
index 06757ec79..5671d3ec2 100644
--- a/crates/expr/src/prelude.js
+++ b/crates/expr/src/prelude.js
@@ -1056,11 +1056,11 @@ Markers.prototype = {
// ---------------------------------------------------------------------------------------------
// Unqualified names: thisLayer / thisProperty attributes and the `this*` objects. They're
// accessors on the global object; assigning one (`var width = 10`) shadows it for the current
-// evaluation only.
+// evaluation only. They can't be deleted or redefined, so an expression can't take one away from
+// the evaluations after it.
function __global(name, get) {
Object.defineProperty(globalThis, name, {
- configurable: true,
get: function () { return name in __S.vars ? __S.vars[name] : get(); },
set: function (v) { __S.vars[name] = v; },
});