nitc: update code to use qclassids
authorJean Privat <jean@pryen.org>
Wed, 16 Dec 2015 04:23:10 +0000 (23:23 -0500)
committerJean Privat <jean@pryen.org>
Wed, 16 Dec 2015 04:23:10 +0000 (23:23 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/astbuilder.nit
src/frontend/parallelization_phase.nit
src/frontend/serialization_phase.nit
src/modelbuilder_base.nit
src/modelize/modelize_class.nit
src/modelize/modelize_property.nit
src/pretty.nit

index 1e1a235..2e500ec 100644 (file)
@@ -256,7 +256,10 @@ end
 redef class AType
        private init make
        do
-               _n_id = new TClassid
+               var n_id = new TClassid
+               var n_qid = new AQclassid
+               n_qid.n_id = n_id
+               _n_qid = n_qid
        end
 end
 
index 237eba2..080efe6 100644 (file)
@@ -52,7 +52,7 @@ private class ParallelizationPhase
 
                # Try to get the name of the class
                if nmethdef.parent isa AStdClassdef then
-                       classname += nmethdef.parent.as(AStdClassdef).n_id.text
+                       classname += nmethdef.parent.as(AStdClassdef).n_qid.n_id.text
                end
 
                # Try to get the name of the method
@@ -64,19 +64,21 @@ private class ParallelizationPhase
                var has_rvalue = nmethdef.n_signature.n_type != null
                var vtype = ""
                if has_rvalue then
-                       vtype = "redef type E: " + nmethdef.n_signature.n_type.n_id.text
+                       vtype = "redef type E: " + nmethdef.n_signature.n_type.n_qid.n_id.text
                end
 
                # create a return type
                var n_id = new TClassid
                n_id.text = classname
+               var n_qid = new AQclassid
+               n_qid.n_id = n_id
                var n_type = new AType
-               n_type.n_id = n_id
+               n_type.n_qid = n_qid
                nmethdef.n_signature.n_type = n_type
 
                var params = new Array[String]
                for param in nmethdef.n_signature.n_params do
-                       var typ = param.n_type.n_id.text
+                       var typ = param.n_type.n_qid.n_id.text
                        if param.n_type.n_kwnullable != null then typ = "nullable {typ}"
                        params.add """
 var {{{param.n_id.text}}}: {{{typ}}}
index 358f211..e48e537 100644 (file)
@@ -250,7 +250,7 @@ do
                end
 
                for nclassdef in nclassdefs do
-                       var name = nclassdef.n_id.text
+                       var name = nclassdef.n_qid.n_id.text
                        if nclassdef.n_formaldefs.is_empty and
                           nclassdef.n_classkind isa AConcreteClasskind then
 
@@ -321,7 +321,7 @@ end
 redef class AType
        private fun type_name: String
        do
-               var name = n_id.text
+               var name = n_qid.n_id.text
 
                if n_kwnullable != null then name = "nullable {name}"
 
@@ -338,7 +338,7 @@ redef class AModule
        private fun deserializer_nclassdef: nullable AStdClassdef
        do
                for nclassdef in n_classdefs do
-                       if nclassdef isa AStdClassdef and nclassdef.n_id.text == "Deserializer" then
+                       if nclassdef isa AStdClassdef and nclassdef.n_qid.n_id.text == "Deserializer" then
                                return nclassdef
                        end
                end
index 4edd46d..06f2396 100644 (file)
@@ -235,7 +235,7 @@ class ModelBuilder
        # FIXME: the name "resolve_mtype" is awful
        fun resolve_mtype_unchecked(mmodule: MModule, mclassdef: nullable MClassDef, ntype: AType, with_virtual: Bool): nullable MType
        do
-               var name = ntype.n_id.text
+               var name = ntype.n_qid.n_id.text
                var res: MType
 
                # Check virtual type
index fa1fddb..3897abc 100644 (file)
@@ -47,7 +47,7 @@ redef class ModelBuilder
                var arity = 0
                var names = new Array[String]
                if nclassdef isa AStdClassdef then
-                       name = nclassdef.n_id.text
+                       name = nclassdef.n_qid.n_id.text
                        nkind = nclassdef.n_classkind
                        mkind = nkind.mkind
                        nvisibility = nclassdef.n_visibility
index b00c7f4..b782f25 100644 (file)
@@ -1570,13 +1570,13 @@ redef class ATypePropdef
 
        redef fun build_property(modelbuilder, mclassdef)
        do
-               var name = self.n_id.text
-               var mprop = modelbuilder.try_get_mproperty_by_name(self.n_id, mclassdef, name)
+               var name = self.n_qid.n_id.text
+               var mprop = modelbuilder.try_get_mproperty_by_name(self.n_qid, mclassdef, name)
                if mprop == null then
                        var mvisibility = new_property_visibility(modelbuilder, mclassdef, self.n_visibility)
                        mprop = new MVirtualTypeProp(mclassdef, name, mvisibility)
                        for c in name.chars do if c >= 'a' and c<= 'z' then
-                               modelbuilder.warning(n_id, "bad-type-name", "Warning: lowercase in the virtual type `{name}`.")
+                               modelbuilder.warning(n_qid, "bad-type-name", "Warning: lowercase in the virtual type `{name}`.")
                                break
                        end
                else
index b6989a3..f817b4b 100644 (file)
@@ -697,7 +697,7 @@ redef class AStdClassdef
 
                v.visit n_classkind
                v.adds
-               v.visit n_id
+               v.visit n_qid
 
                if not n_formaldefs.is_empty then
                        v.consume "["
@@ -786,7 +786,7 @@ redef class AType
                        v.adds
                end
 
-               v.visit n_id
+               v.visit n_qid
 
                if not n_types.is_empty then
                        v.consume "["
@@ -945,7 +945,7 @@ redef class ATypePropdef
                super
                v.visit n_kwtype
                v.adds
-               v.visit n_id
+               v.visit n_qid
                v.consume ":"
                v.adds
                v.visit n_type