diff --git a/ets2panda/test/ast/compiler/ets/external_local_interface.ets b/ets2panda/test/ast/compiler/ets/external_local_interface.ets new file mode 100644 index 0000000000000000000000000000000000000000..b17d69c20e36db6ce2d8142e5d7484e82ab5deb1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/external_local_interface.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 {foo} from "./external_local_interface_decl" + + diff --git a/ets2panda/test/ast/compiler/ets/external_local_interface_decl.ets b/ets2panda/test/ast/compiler/ets/external_local_interface_decl.ets new file mode 100644 index 0000000000000000000000000000000000000000..891e84f1a8062aaaed089fba65075575d49c121f --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/external_local_interface_decl.ets @@ -0,0 +1,22 @@ +/* + * 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 function foo() { + interface A{ + s:string + } + + let a:A = {s:""} +} \ No newline at end of file diff --git a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt index 42b02135c12a9459e762757a60ce251ff0b90f75..cff206ab65f9653310b727318207646dac283ae0 100644 --- a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt +++ b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt @@ -159,6 +159,7 @@ runtime/ets/import_declare_type_alias.ets ast/compiler/ets/import_type_without_export.ets ast/compiler/ets/type_binding_01.ets ast/compiler/ets/type_binding_02.ets +ast/compiler/ets/external_local_interface.ets # FailKind.ES2PANDA_FAIL runtime/ets/StringFasta.ets diff --git a/ets2panda/varbinder/varbinder.cpp b/ets2panda/varbinder/varbinder.cpp index 0504029b7be6471f8ede3cfadc766d7e0d78e2e5..d08635be49f405e5e6175910cb3c0e3676bcd55f 100644 --- a/ets2panda/varbinder/varbinder.cpp +++ b/ets2panda/varbinder/varbinder.cpp @@ -470,6 +470,19 @@ void VarBinder::VisitScriptFunction(ir::ScriptFunction *func) } if (!BuildInternalName(func)) { + if (func->Body() == nullptr) { + return; + } + auto stmt = func->Body()->AsBlockStatement()->Statements(); + auto scopeCtx = LexicalScope::Enter(this, funcScope); + std::function doNode = [&](ir::AstNode *node) { + if (node->IsTSInterfaceDeclaration() || node->IsClassDeclaration() || node->IsTSEnumDeclaration() || + node->IsAnnotationDeclaration() || node->IsTSTypeAliasDeclaration()) { + ResolveReference(node); + } + node->Iterate([&](ir::AstNode *child) { doNode(child); }); + }; + doNode(func->Body()); return; }