jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.89k stars 669 forks source link

import symbol conflicts with global variable name #5015

Closed dananderson closed 1 year ago

dananderson commented 2 years ago
JerryScript revision

2.4.0

Build platform

all

Build steps

n/a

Build log

n/a

Test case

Assume there is a global variable named 'process' in the current realm. Assume the process package exports default and a symbol named process as well.

When using a default import:

import process from 'process'

When using a named import:

import { process } from 'process'

Both statements fail.

Execution platform

all

Execution steps

n/a

Output

Error message: Imported binding shadows local variable

Backtrace

n/a

Expected behavior

No parse or runtime Error.

zherczeg commented 1 year ago

It looks like this is a "feature" in JerryScript. Probably something was misunderstood. Attempting to change this in #5023

zherczeg commented 1 year ago

Patch landed. Thank you for the report.