Skip to content

Commit

Permalink
[fix]修复了typescript中容器类型无法正确生成调用resolve语句的问题。 (#128)
Browse files Browse the repository at this point in the history
Co-authored-by: lintianbao <lintianbao@thedream.cc>
  • Loading branch information
kteong1012 and lintianbao authored Apr 8, 2024
1 parent dd8f40f commit 88c09bc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Luban.Typescript/Templates/typescript-json/schema.sbn
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func generate_resolve_field_ref
if (is_field_bean_need_resolve_ref field)
ret 'this.'+fieldName + '?.resolve(tables);'
else if (is_field_array_like_need_resolve_ref field)
ret 'for (let _e of ' + fieldName + ') { _e?.resolve(tables); }'
ret 'for (let _e of ' + 'this.' + + fieldName + ') { _e?.resolve(tables); }'
else if (is_field_map_need_resolve_ref field)
ret 'foreach (var [_, _e] of ' + fieldName ') { _e?.resolve(tables); }'
ret 'foreach (var [_, _e] of ' + 'this.' + fieldName ') { _e?.resolve(tables); }'
else
ret ''
end
Expand Down Expand Up @@ -101,10 +101,8 @@ export {{if bean.is_abstract_type}}abstract {{end}}class {{bean.name}}{{if bean.
super.resolve(tables)
{{~end~}}
{{~ for field in bean.export_fields ~}}
{{~if can_generate_ref field~}}
{{generate_resolve_field_ref field}}
{{~end~}}
{{~end~}}
}
}

Expand Down Expand Up @@ -228,4 +226,4 @@ export class {{__name}} {
this._{{table.name}}.resolve(this)
{{~end~}}
}
}
}

0 comments on commit 88c09bc

Please sign in to comment.