Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function declaration returns the function, it should return undefined #454

Closed
HalidOdat opened this issue Jun 3, 2020 · 0 comments · Fixed by #473
Closed

Function declaration returns the function, it should return undefined #454

HalidOdat opened this issue Jun 3, 2020 · 0 comments · Fixed by #473
Labels
bug Something isn't working E-Easy Easy execution Issues or PRs related to code execution good first issue Good for newcomers
Milestone

Comments

@HalidOdat
Copy link
Member

Describe the bug
A clear and concise description of what the bug is.

Function declaration returns the function, it should return undefined

To Reproduce

function x() {}

Actual behavior
Returns the function, as if it was a function expression.

Output

{
name: x,
prototype: {
__proto__: {
hasOwnProperty: {
          length: 0,
      extensible: true
            },
    toString: {
          length: 0,
      extensible: true
            },
 constructor: {
  setPrototypeOf: {
              length: 2,
          extensible: true
                },
       prototype: [Cycle],
            name: Object,
          length: 1,
  defineProperty: {
              length: 3,
          extensible: true
                },
  getPrototypeOf: {
              length: 1,
          extensible: true
                },
       __proto__: undefined,
      extensible: true
            },
  extensible: true
        },
extensible: true
    },
length: 0,
__proto__: {
constructor: {
        name: Function,
   prototype: [Cycle],
      length: 1,
   __proto__: undefined,
  extensible: true
        },
__proto__: {
hasOwnProperty: {
          length: 0,
      extensible: true
            },
    toString: {
          length: 0,
      extensible: true
            },
 constructor: {
  setPrototypeOf: {
              length: 2,
          extensible: true
                },
       prototype: [Cycle],
            name: Object,
          length: 1,
  defineProperty: {
              length: 3,
          extensible: true
                },
  getPrototypeOf: {
              length: 1,
          extensible: true
                },
       __proto__: undefined,
      extensible: true
            },
  extensible: true
        },
extensible: true
    },
extensible: true
}

Expected behavior
Explain what you expected to happen, and what is happening instead.

undefined

Build environment (please complete the following information):

  • OS: Manjaro Linux
  • Target triple: x86_64-unknown-linux-gnu
  • Rustc version: rustc 1.43.1 (8d69840ab 2020-05-04)

Additional context
Add any other context about the problem here.

Changing the line https://github.com/boa-dev/boa/blob/master/boa/src/exec/declaration/mod.rs#L38 to return undefined should fix the problem.

@HalidOdat HalidOdat added bug Something isn't working good first issue Good for newcomers E-Easy Easy execution Issues or PRs related to code execution labels Jun 3, 2020
@Razican Razican added this to the v0.9.0 milestone Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working E-Easy Easy execution Issues or PRs related to code execution good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants