diff --git a/ets2panda/compiler/lowering/ets/interfaceObjectLiteralLowering.cpp b/ets2panda/compiler/lowering/ets/interfaceObjectLiteralLowering.cpp index c88ab3572b51a831e15f60d1bffe3e22bae19a02..9ee825e05e1214f825df3e87a9e3a23d6dd7ad14 100644 --- a/ets2panda/compiler/lowering/ets/interfaceObjectLiteralLowering.cpp +++ b/ets2panda/compiler/lowering/ets/interfaceObjectLiteralLowering.cpp @@ -227,6 +227,12 @@ static void GenerateAnonClassTypeFromInterface(public_lib::Context *ctx, ir::TSI }; auto originalName = std::string {ifaceNode->InternalName()}; + util::StringView modulePrefix = + ctx->parserProgram->VarBinder()->AsETSBinder()->GetRecordTable()->Program()->ModulePrefix(); + int modulePrefixLen = modulePrefix.Length(); + if (modulePrefixLen > 0 && util::StringView(originalName).StartsWith(modulePrefix.Utf8())) { + originalName = originalName.substr(modulePrefixLen); + } std::replace(originalName.begin(), originalName.end(), '.', '$'); auto anonClassName = util::UString(originalName.append(OBJECT_LITERAL_SUFFIX), checker->ProgramAllocator()); auto *classDecl = checker->BuildClass(anonClassName.View(), classBodyBuilder);