Skip to content

Fix missing function names in console.log and Bun.inspect - #6612

Merged
Jarred-Sumner merged 6 commits into
mainfrom
jarred/fix-function-names
Oct 20, 2023
Merged

Jarred-Sumner merged 6 commits into
mainfrom
jarred/fix-function-names

Conversation

@Jarred-Sumner

@Jarred-Sumner Jarred-Sumner commented Oct 20, 2023 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Uses JSC::getCalculatedDisplayName for getting function names instead of

❯ bun /tmp/a.js
[Function]

❯ bun-debug /tmp/a.js
[Function: f]

❯ cat /tmp/a.js
       │ File: /tmp/a.js
   1   │ var f = (x) => x;
   2   │ f.length;
   3   │ console.log(f);

Note that we do need to address a transpiler issue where inlining causes names of functions to be lost. This impacts const and let. We should assign these to their declared names instead. This is not possible to do for arrow functions, but is possible to do for regular functions.

How did you verify your code works?

Tests

@Jarred-Sumner Jarred-Sumner changed the title Fix missing function names in Bun.inspect Fix missing function names in console.log and Bun.inspect Oct 20, 2023
@github-actions

github-actions Bot commented Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

❌ @Jarred-Sumner 6 files with test failures on bun-darwin-aarch64:

  • test/bundler/bundler_edgecase.test.ts
  • test/integration/next/default-pages-dir/test/dev-server.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/bun/util/filesink.test.ts
  • test/js/node/watch/fs.watch.test.ts
  • test/js/web/worker.test.ts

View test output

#acb9b58bec5281ef9ab154869b02e1c407510bac

@github-actions

github-actions Bot commented Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

❌ @Jarred-Sumner 4 files with test failures on linux-x64:

  • test/bundler/esbuild/splitting.test.ts
  • test/js/third_party/prompts/prompts.test.ts
  • test/js/web/fetch/fetch-gzip.test.ts
  • test/js/web/worker.test.ts

View test output

#acb9b58bec5281ef9ab154869b02e1c407510bac

@github-actions

github-actions Bot commented Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

❌ @Jarred-Sumner 1 files with test failures on linux-x64-baseline:

  • test/js/bun/util/filesink.test.ts

View test output

#acb9b58bec5281ef9ab154869b02e1c407510bac

@github-actions

github-actions Bot commented Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

❌ @Jarred-Sumner 6 files with test failures on bun-darwin-x64:

  • test/integration/next/default-pages-dir/test/dev-server.test.ts
  • test/js/bun/spawn/spawn.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/abort/abort.test.ts
  • test/js/web/timers/setTimeout.test.js

View test output

#acb9b58bec5281ef9ab154869b02e1c407510bac

@github-actions

github-actions Bot commented Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

❌ @Jarred-Sumner 8 files with test failures on bun-darwin-x64-baseline:

  • test/integration/next/default-pages-dir/test/dev-server.test.ts
  • test/integration/next/default-pages-dir/test/next-build.test.ts
  • test/js/bun/spawn/spawn.test.ts
  • test/js/bun/util/filesink.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/node/watch/fs.watchFile.test.ts
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/timers/setTimeout.test.js

View test output

#acb9b58bec5281ef9ab154869b02e1c407510bac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants