TypeDeclAST.py (6714:028047200ff7) TypeDeclAST.py (7839:9e556fb25900)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 36 unchanged lines hidden (view full) ---

45 if parent:
46 ident = "%s_%s" % (parent, self.type_ast.ident)
47 else:
48 ident = self.type_ast.ident
49 return set(("%s.hh" % ident, "%s.cc" % ident))
50
51 def generate(self):
52 ident = str(self.type_ast)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 36 unchanged lines hidden (view full) ---

45 if parent:
46 ident = "%s_%s" % (parent, self.type_ast.ident)
47 else:
48 ident = self.type_ast.ident
49 return set(("%s.hh" % ident, "%s.cc" % ident))
50
51 def generate(self):
52 ident = str(self.type_ast)
53 machine = self.symtab.state_machine
53
54 # Make the new type
55 new_type = Type(self.symtab, ident, self.location, self.pairs,
56 self.state_machine)
54
55 # Make the new type
56 new_type = Type(self.symtab, ident, self.location, self.pairs,
57 self.state_machine)
58
59 if machine:
60 machine.addType(new_type)
61
57 self.symtab.newSymbol(new_type)
58
59 # Add all of the fields of the type to it
60 for field in self.field_asts:
61 field.generate(new_type)
62 self.symtab.newSymbol(new_type)
63
64 # Add all of the fields of the type to it
65 for field in self.field_asts:
66 field.generate(new_type)