@@ -245,36 +245,45 @@ class MetaItemLitExpr : public MetaItemInner
245245  }
246246};
247247
248- //  more generic meta item "path = lit " form
249- class  MetaItemPathLit  : public  MetaItem 
248+ //  more generic meta item "path = expr " form
249+ class  MetaItemPathExpr  : public  MetaItem 
250250{
251251  SimplePath path;
252-   LiteralExpr lit ;
252+   std::unique_ptr<Expr> expr ;
253253
254254public: 
255-   MetaItemPathLit  (SimplePath path, LiteralExpr lit_expr)
256-     : path (std::move (path)), lit (std::move (lit_expr))
255+   MetaItemPathExpr  (SimplePath path, std::unique_ptr<Expr> expr)
256+     : path (std::move (path)), expr (std::move (expr))
257+   {}
258+ 
259+   MetaItemPathExpr  (const  MetaItemPathExpr &other)
260+     : path (other.path), expr (other.expr->clone_expr  ())
257261  {}
258262
263+   MetaItemPathExpr operator = (const  MetaItemPathExpr &other)
264+   {
265+     path = other.path ;
266+     expr = other.expr ->clone_expr  ();
267+     return  *this ;
268+   }
269+ 
259270  SimplePath get_path  () const  { return  path; }
260271
261272  SimplePath &get_path  () { return  path; }
262273
263-   LiteralExpr get_literal  () const  { return  lit; }
264- 
265-   LiteralExpr &get_literal  () { return  lit; }
274+   Expr &get_expr  () { return  *expr; }
266275
267276  std::string as_string  () const  override 
268277  {
269-     return  path.as_string  () + "  = " lit. as_string  ();
278+     return  path.as_string  () + "  = " expr-> as_string  ();
270279  }
271280
272281  MetaItem::ItemKind get_item_kind  () const  override 
273282  {
274-     return  MetaItem::ItemKind::PathLit ;
283+     return  MetaItem::ItemKind::PathExpr ;
275284  }
276285
277-   //  There are two Locations in MetaItemPathLit  (path and lit_expr),
286+   //  There are two Locations in MetaItemPathExpr  (path and lit_expr),
278287  //   we have no idea use which of them, just simply return UNKNOWN_LOCATION
279288  //   now.
280289  //  Maybe we will figure out when we really need the location in the future.
@@ -286,13 +295,11 @@ class MetaItemPathLit : public MetaItem
286295  /*  TODO: return true if "ident" is defined and value of it is "lit", return
287296   * false otherwise */  
288297
289-   Attribute to_attribute  () const  override ;
290- 
291298protected: 
292299  //  Use covariance to implement clone function as returning this type
293-   MetaItemPathLit  *clone_meta_item_inner_impl  () const  override 
300+   MetaItemPathExpr  *clone_meta_item_inner_impl  () const  override 
294301  {
295-     return  new  MetaItemPathLit  (*this );
302+     return  new  MetaItemPathExpr  (*this );
296303  }
297304};
298305
0 commit comments