~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to Puma/src/infos/acinfos/ACSliceInfo.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
namespace Puma {
24
24
 
 
25
/** Desctructor: delete all pattern units */
 
26
ACSliceInfo::~ACSliceInfo () {
 
27
  if (_base_pattern) delete _base_pattern;
 
28
  if (_pattern) delete _pattern;
 
29
  for (int m = 0; m < members (); m++)
 
30
    delete _member_patterns[m];
 
31
}
 
32
 
25
33
ACSliceInfo::Type ACSliceInfo::type () const {
26
34
  if (!_def_node)
27
35
    return SL_UNKNOWN;
35
43
  }
36
44
}
37
45
 
 
46
/** Set the slice definition syntax tree node.
 
47
 *  \param node The slice syntax tree node. */
 
48
void ACSliceInfo::def_node (CT_ClassSliceDecl *csd) {
 
49
  _def_node = csd;
 
50
  
 
51
  // create base clause pattern
 
52
  CT_Intro *intro = (CT_Intro*)csd->base_clause ();
 
53
  if (intro) {
 
54
    // create a unit for the baseclass pattern
 
55
    _base_pattern = new Unit;
 
56
    // set the name for #line directives
 
57
    _base_pattern->name (((Unit*)csd->token ()->belonging_to ())->name ());
 
58
    // copy all tokens
 
59
    for (int e = 1; e < intro->Entries (); e++) { // skip ":"
 
60
      Token *tok = intro->Entry (e)->token ();
 
61
      _base_pattern->append (*tok->duplicate ());
 
62
    }
 
63
  }
 
64
  
 
65
  // create pattern for inline members
 
66
  if (csd->members ()) {
 
67
    // create the unit
 
68
    _pattern = new Unit;
 
69
    // set the name for #line directives
 
70
    _pattern->name (((Unit*)csd->token ()->belonging_to ())->name ());
 
71
    for (int m = 0; m < csd->members ()->Entries (); m++) {
 
72
      CT_Intro *intro = (CT_Intro*)csd->members ()->Entry (m);
 
73
      for (int e = 0; e < intro->Entries (); e++) {
 
74
        Token *tok = intro->Entry (e)->token ();
 
75
        _pattern->append (*tok->duplicate ());
 
76
      }
 
77
    }
 
78
  }
 
79
 
 
80
}
 
81
 
 
82
/** Add a non-inline slice member.
 
83
 *  \param node The new member. */
 
84
void ACSliceInfo::add_member (CT_Intro *i) {
 
85
  _members.append (i);
 
86
  // create a unit for the baseclass pattern
 
87
  Unit *pattern = new Unit;
 
88
  // set the name for #line directives
 
89
  // TODO: think about slices generated by macros here
 
90
  Unit *ah_unit = (Unit*)i->token ()->belonging_to ();
 
91
  pattern->name (ah_unit->name ());
 
92
  // copy all tokens
 
93
  for (int e = 0; e < i->Entries (); e++) {
 
94
    Token *tok = i->Entry (e)->token ();
 
95
    pattern->append (*tok->duplicate ());
 
96
  }
 
97
  _member_patterns.append (pattern);
 
98
  _member_units.append (ah_unit);
 
99
}
 
100
 
38
101
ACSliceInfo *ACSliceInfo::definition () const {
39
102
  CObjectInfo *curr = _object;
40
103
  do {