You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We need to check if the preferred namespace name (`preferredName`) we'd like to use in the refactored code will present a name conflict.
151
+
// A name conflict means that, in a scope where we would like to use the preferred namespace name, there already exists a symbol with that name in that scope.
152
+
// We are going to use the namespace name in the scopes the named imports being refactored are referenced,
153
+
// so we look for conflicts by looking at every reference to those named imports.
if(symbol){// There already is a symbol with the same name as the preferred namespace name.
157
+
if(toConvertSymbols.has(symbol)){// `preferredName` resolves to a symbol for one of the named import references we are going to transform into namespace import references...
158
+
returnisExportSpecifier(id.parent);// ...but if this reference is an export specifier, it will not be transformed, so it is a conflict; otherwise, it will be renamed and is not a conflict.
159
+
}
160
+
returntrue;// `preferredName` resolves to any other symbol, which will be present in the refactored code and so poses a name conflict.
161
+
}
162
+
returnfalse;// There is no symbol with the same name as the preferred namespace name, so no conflict.
0 commit comments