@@ -101,6 +101,8 @@ macro rosimport(input)
101101 end
102102end
103103
104+ _get_quote_value (input:: QuoteNode ) = input. value
105+ _get_quote_value (input:: Expr ) = (@assert input. head == :quote ; input. args[1 ])
104106# Return the pkg and types strings for a single expression of form:
105107# pkg.[msg|srv].type or pkg.[msg|srv]:type
106108function _pkgtype_import (input:: Expr )
@@ -109,7 +111,7 @@ function _pkgtype_import(input::Expr)
109111 @assert input. args[1 ]. head == :(.) " Improper @rosimport input"
110112 p = input. args[1 ]. args[1 ]
111113 @assert isa (p, Symbol) " Package name ($(string (p)) ) not a symbol"
112- m_or_s = input. args[1 ]. args[2 ]. args[ 1 ]
114+ m_or_s = _get_quote_value ( input. args[1 ]. args[2 ])
113115 @assert m_or_s in (:msg ,:srv ) " Improper @rosimport input"
114116 ps = string (p)
115117 msb = m_or_s == :msg
@@ -121,6 +123,10 @@ function _pkgtype_import(input::Expr)
121123 tsym = input. args[2 ]. args[1 ]
122124 @assert isa (tsym, Symbol) " Type name ($(string (tsym)) ) not a symbol"
123125 ts = string (tsym)
126+ elseif isa (input. args[2 ], QuoteNode)
127+ tsym = input. args[2 ]. value
128+ @assert isa (tsym, Symbol) " Type name ($(string (tsym)) ) not a symbol"
129+ ts = string (tsym)
124130 end
125131 return ps,msb,ts
126132end
340346function _importexprs (mod:: ROSMsgModule )
341347 imports = Expr[Expr (:import , :RobotOS , :AbstractMsg )]
342348 othermods = filter (d -> d != _name (mod), mod. deps)
343- append! (imports, [Expr (:using ,Symbol (m),:msg ) for m in othermods])
349+ append! (imports, [Expr (:using ,:Main , Symbol (m),:msg ) for m in othermods])
344350 imports
345351end
346352function _importexprs (mod:: ROSSrvModule )
@@ -350,7 +356,7 @@ function _importexprs(mod::ROSSrvModule)
350356 Expr (:import , :RobotOS , :_srv_reqtype ),
351357 Expr (:import , :RobotOS , :_srv_resptype ),
352358 ]
353- append! (imports, [Expr (:using ,Symbol (m),:msg ) for m in mod. deps])
359+ append! (imports, [Expr (:using ,:Main , Symbol (m),:msg ) for m in mod. deps])
354360 imports
355361end
356362
0 commit comments