Skip to content

Commit

Permalink
接口继承引入的同签名方法实现 fix Tencent#513
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Jan 4, 2019
1 parent 3f62013 commit 791ef86
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions Assets/XLua/Src/Editor/Template/LuaInterfaceBridge.tpl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace XLua.CSObjectWrap
local out_idx = has_return and 2 or 1
if has_return then out_num = out_num + 1 end
%>
public <%=return_type_name%> <%=method.Name%>(<%ForEachCsList(parameters, function(parameter, pi)
<%=return_type_name%> <%=CsFullTypeName(method.DeclaringType)%>.<%=method.Name%>(<%ForEachCsList(parameters, function(parameter, pi)
if pi ~= 0 then
%>, <%
end
Expand Down Expand Up @@ -104,17 +104,8 @@ namespace XLua.CSObjectWrap

<%
ForEachCsList(propertys, function(property)
local is_sub_interface_prop = property.DeclaringType ~= type
local parent_has_same_name = false
if is_sub_interface_prop then
ForEachCsList(propertys, function(p)
if p.DeclaringType ~= type and p.Name == property.Name then
parent_has_same_name = true
end
end)
end
%>
<%if not parent_has_same_name then%>public <%end%><%=CsFullTypeName(property.PropertyType)%> <%if parent_has_same_name then%><%=CsFullTypeName(property.DeclaringType)%>.<%end%><%=property.Name%>
<%=CsFullTypeName(property.PropertyType)%> <%=CsFullTypeName(property.DeclaringType)%>.<%=property.Name%>
{
<%if property.CanRead then%>
get
Expand Down Expand Up @@ -167,7 +158,7 @@ namespace XLua.CSObjectWrap
<%end)%>

<%ForEachCsList(events, function(event) %>
public event <%=CsFullTypeName(event.EventHandlerType)%> <%=event.Name%>
event <%=CsFullTypeName(event.EventHandlerType)%> <%=CsFullTypeName(event.DeclaringType)%>.<%=event.Name%>
{<%local parameters = event:GetAddMethod():GetParameters()%>
add
{
Expand Down Expand Up @@ -261,7 +252,7 @@ namespace XLua.CSObjectWrap
local ptype = (indexer:GetGetMethod() or indexer:GetSetMethod()):GetParameters()[0].ParameterType
local pname = (indexer:GetGetMethod() or indexer:GetSetMethod()):GetParameters()[0].Name
%>
public <%=CsFullTypeName(indexer.PropertyType)%> this[<%=CsFullTypeName(ptype)%> <%=pname%>]
<%=CsFullTypeName(indexer.PropertyType)%> <%=CsFullTypeName(indexer.DeclaringType)%>.this[<%=CsFullTypeName(ptype)%> <%=pname%>]
{<%if indexer:GetGetMethod() then
local method = indexer:GetGetMethod()
local parameters = method:GetParameters()
Expand Down

0 comments on commit 791ef86

Please sign in to comment.