LivelyKernel / lively4-core

A Self-supporting, Web-based Development Environment
https://lively-kernel.org/lively4/lively4-core/start.html
MIT License
73 stars 25 forks source link

aexpr should keep Object.defineProperty config an object #396

Open JensLincke opened 4 years ago

JensLincke commented 4 years ago
Object.defineProperty(_recorder_.tempfile_js, 'expect', {
  get() {
    return expect;
  },

gets rewritten to:

Object.defineProperty(_recorder_._src_client_reactive_test_active_expression_proxies_active_expression_proxies_spec_js, 'expect', _wrap({

But it should be an Object, and a Proxy raised an error.

niconomaa commented 4 years ago

out current approach leads to the object in the above mentioned example not being transformed, as specified. in cases where the configuration object for defineProperty is not is not defined in the argument itself but rather represente with an identifier, our current approach still transform the object, as in the following example:

let config = {
  get() {
    return expect;
  }

Object.defineProperty(_recorder_.tempfile_js, 'expect', config)
onsetsu commented 4 years ago

@niconomaa Have you synced this functionality already? @JensLincke can you check, whether this resolves our issue?

niconomaa commented 4 years ago

@onsetsu yes

an alternative approach that we would like to discuss is, instead of checking an AST node's parent, checking "downwards" the AST from the CallExpression in question