19
19
#ifndef __OrderInfo_h__
20
20
#define __OrderInfo_h__
22
#include "Puma/Array.h"
23
#include "Puma/Printable.h"
24
#include "Puma/ACTree.h"
25
#include "Puma/Unit.h"
22
#include "PointCutEvaluator.h"
23
#include "PointCutContext.h"
24
#include "JoinPointLoc.h"
30
list<PointCutExpr*> _pces;
31
PointCutExpr* _jp_pce;
33
void add_pce (PointCutExpr *pce) { _pces.push_back (pce); }
34
void set_jp_pce (PointCutExpr *jp_pce) { _jp_pce = jp_pce; }
42
OrderInfo (AspectInfo *ai, CT_AdviceDecl *ad) :
43
_aspect (ai), _tree (ad) {}
44
CT_AdviceDecl *tree () const { return _tree; }
45
AspectInfo *aspect () { return _aspect; }
46
const Unit &unit () const {
47
return *(Unit*)_tree->token ()->belonging_to ();
38
OrderInfo (JPL_Aspect &a, JPL_Order &o) : _aspect (a), _order (o), _jp_pce (0) {}
40
for (list<PointCutExpr*>::iterator i = _pces.begin ();
41
i != _pces.end (); ++i)
42
PointCutEvaluator::destroy (*i);
44
PointCutEvaluator::destroy (_jp_pce);
49
int line () const { return _tree->token ()->location ().line (); }
51
return _tree->end_token()->location().line() - line () + 1;
46
const list<PointCutExpr*> &pces () const { return _pces; }
47
PointCutExpr *jp_pce () const { return _jp_pce; }
48
JPL_Aspect &aspect () const { return _aspect; }
49
JPL_Order &order () const { return _order; }
50
void analyze_exprs (ErrorStream &err, JoinPointModel &jpm) {
51
PointCutContext context (jpm);
52
PointCutEvaluator eval (err, context);
53
context.concrete_aspect (_aspect);
54
set_jp_pce (eval.create (_order.expr (), JoinPointLoc::Any));
55
const list<CTree*> &exprs = _order.pces ();
56
for (list<CTree*>::const_iterator i = exprs.begin (); i != exprs.end (); ++i)
57
add_pce (eval.create (*i, JoinPointLoc::Aspect));