tc39 / proposal-function-implementation-hiding

JavaScript language proposal: function implementation hiding
https://ci.tc39.es/preview/tc39/ecma262/pull/1739
MIT License
98 stars 7 forks source link

Semantics of top-level directive #47

Open Huxpro opened 3 years ago

Huxpro commented 3 years ago

What does top-level directives do?

'hide source';
function foo() { /* no hide source */ } // inherit?
function bar() { 'show source' } // override?

Would it be ignored? Would there be an error?

Huxpro commented 3 years ago

From the current drafting spec it seems like

  1. top-level (script/module scope) directive is allowed
  2. stronger semantics always override weaker (i.e. inner scope can't override outer scope)

Am I understanding this correct?