Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Bernard2018-04-03 14:06:42 +0000
committerSimon Bernard2018-04-03 14:06:42 +0000
commit3946f93aef832732e29a6822c176ef10f3197226 (patch)
tree287e3182a6998f05f63df63707eb471eae8c0b84
parentc42c45925f1bb5b670cf6a5e5fe863a8ce91bd0d (diff)
downloadorg.eclipse.ldt-3946f93aef832732e29a6822c176ef10f3197226.tar.gz
org.eclipse.ldt-3946f93aef832732e29a6822c176ef10f3197226.tar.xz
org.eclipse.ldt-3946f93aef832732e29a6822c176ef10f3197226.zip
Bug 533151: Add support of self typing for function expr:f() endHEAD1.4.2RC2master
-rw-r--r--libraries/modelsbuilder/models/internalmodelbuilder.mlua16
1 files changed, 16 insertions, 0 deletions
diff --git a/libraries/modelsbuilder/models/internalmodelbuilder.mlua b/libraries/modelsbuilder/models/internalmodelbuilder.mlua
index 20f7fef..18a13eb 100644
--- a/libraries/modelsbuilder/models/internalmodelbuilder.mlua
+++ b/libraries/modelsbuilder/models/internalmodelbuilder.mlua
@@ -549,6 +549,22 @@ getitem = function (binder, itemname, comment2apiobj, file)
end
end
end
+ else
+ -- this is the case where we have
+ -- function expr.f(self) or function expr:f()
+ -- we suppose the type of self is the type of "expr"
+ if itemname == "self" and i==1 and binder.parent.tag == "Set" then
+ match binder.parent with
+ |`Set { {`Index { right , string}}, {...}} ->
+ -- if node is an expression supported
+ local supportedexpr = expreto_expression[right]
+ if supportedexpr then
+ -- create expression type ref
+ local selftype = apimodel._exprtyperef(supportedexpr,1)
+ return createitem(itemname,id,selftype)
+ end
+ end
+ end
end
return createitem(itemname,id)
end

Back to the top