@@ -70,13 +70,16 @@ import System;
7070
7171public
7272function addImportsToScope
73+ // adrpo: hm, i don't know if this is correct as imports are not inherited
7374 input list< SCode . Element > imports;
7475 input InstNode currentScope;
7576 input output ClassTree . Tree scope;
7677protected
7778 Absyn . Import i;
7879 InstNode node, top_scope;
7980 SourceInfo info;
81+ Class cls;
82+ ClassTree . Tree els;
8083algorithm
8184 if listEmpty(imports) then
8285 return ;
@@ -93,17 +96,33 @@ algorithm
9396 case Absyn . NAMED_IMPORT ()
9497 algorithm
9598 node := Lookup . lookupClassName(Absyn . FULLYQUALIFIED (i. path), top_scope, info);
99+ // TODO! FIXME! check if there is a local definition with the same name and if prefix of path is a package
100+ // how about importing constants not just classes?!
96101 scope := NFInst . addClassToScope(i. name, ClassTree . Entry . CLASS (node), info, scope);
97102 then
98103 ();
99104
100105 case Absyn . QUAL_IMPORT ()
101106 algorithm
102107 node := Lookup . lookupClassName(Absyn . FULLYQUALIFIED (i. path), top_scope, info);
108+ // TODO! FIXME! check if there is a local definition with the same name and if prefix of path is a package
109+ // how about importing constants not just classes?!
103110 scope := NFInst . addClassToScope(Absyn . pathLastIdent(i. path), ClassTree . Entry . CLASS (node), info, scope);
104111 then
105112 ();
106113
114+ case Absyn . UNQUAL_IMPORT ()
115+ algorithm
116+ node := Lookup . lookupClassName(Absyn . FULLYQUALIFIED (i. path), top_scope, info);
117+ node := NFInst . expand(node);
118+ // TODO! FIXME! check that the path is a package!
119+ // how about importing constants not just classes?!
120+ // add all the definitions from node to current scope
121+ // using addInheritedElements here as is basically similar
122+ scope := NFInst . addInheritedElements({node}, scope);
123+ then
124+ ();
125+
107126 else
108127 algorithm
109128 print("NFInst.addImportsToScope: IMPLEMENT ME \n " );
0 commit comments