diff --git a/ets2panda/test/ast/compiler/ets/default_export_reexport/export.ets b/ets2panda/test/ast/compiler/ets/default_export_reexport/export.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bd7109180bbea4496591525599a92a3f0cdfda2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/default_export_reexport/export.ets @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class AA {} +export default AA; diff --git a/ets2panda/test/ast/compiler/ets/default_export_reexport/export2.ets b/ets2panda/test/ast/compiler/ets/default_export_reexport/export2.ets new file mode 100644 index 0000000000000000000000000000000000000000..17a8fc658fb58e323d113c3d137ef1a15ac9ff83 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/default_export_reexport/export2.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { default as AA } from "./export" diff --git a/ets2panda/test/ast/compiler/ets/default_export_reexport/mytest.ets b/ets2panda/test/ast/compiler/ets/default_export_reexport/mytest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74348283f6ad42ead8f22aacce875449a745e242 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/default_export_reexport/mytest.ets @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AA } from /* @@ label */"./export2" + +/* @@@ label Error TypeError: Cannot find imported element 'AA' */ \ No newline at end of file diff --git a/ets2panda/varbinder/ETSBinder.cpp b/ets2panda/varbinder/ETSBinder.cpp index ce4d9475a3d4c5fa6e4ce822388bc4fac3dc07ab..0f2508a2ef095c2c3ccec357f9e5873598d67376 100644 --- a/ets2panda/varbinder/ETSBinder.cpp +++ b/ets2panda/varbinder/ETSBinder.cpp @@ -837,6 +837,9 @@ std::pair ETSBinder::FindImportDeclIn } auto specifiers = item->GetETSImportDeclarations()->Specifiers(); + if (specifiers.empty()) { + continue; + } if (specifiers[0]->IsImportSpecifier()) { if (!std::any_of(specifiers.begin(), specifiers.end(), [&imported](auto it) { return it->AsImportSpecifier()->Local()->Name().Is(imported.Mutf8());