From e48c69a792b8f1ad553799672d8d4e6eb8733d4c Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 8 Aug 2016 13:39:00 -0400 Subject: [PATCH] model: MVirtualType fast resolution for the special type `SELF` Signed-off-by: Jean Privat --- src/model/model.nit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/model/model.nit b/src/model/model.nit index 8e39f9b..0357df2 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -1454,6 +1454,9 @@ class MVirtualType do if not cleanup_virtual then return self assert can_resolve_for(mtype, anchor, mmodule) + + if mproperty.is_selftype then return mtype + # self is a virtual type declared (or inherited) in mtype # The point of the function it to get the bound of the virtual type that make sense for mtype # But because mtype is maybe a virtual/formal type, we need to get a real receiver first @@ -2263,6 +2266,9 @@ class MVirtualTypeProp # The formal type associated to the virtual type property var mvirtualtype = new MVirtualType(self) + + # Is `self` the special virtual type `SELF`? + var is_selftype: Bool is lazy do return name == "SELF" end # A definition of a property (local property) -- 1.7.9.5