Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]修复了typescript中容器类型无法正确生成调用resolve语句的问题。 #128

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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~}}
}
}
}