Skip to content

this keyword in functions in objects are converted to undefined #256

Open
@MaddyUnderStars

Description

@MaddyUnderStars

Running the following through hsm

export default function(context, args) {
    const a = {
        b: function() {
            return this;
        },
    }

    return a.b();
}
}

produces the below

function(context, args) {
  let a = {
    b: function () {
      return undefined
    }
  }
  return a.b()
}

notice the conversion of this to undefined. this in b should refer to a

This issue seems very closely related to #236

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions