TypeDeclAST.py (6657:ef5fae93a3b2) | TypeDeclAST.py (6714:028047200ff7) |
---|---|
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; --- 24 unchanged lines hidden (view full) --- 33 super(TypeDeclAST, self).__init__(slicc, pairs) 34 35 self.type_ast = type_ast 36 self.field_asts = field_asts 37 38 def __repr__(self): 39 return "[TypeDecl: %r]" % (self.type_ast) 40 | 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; --- 24 unchanged lines hidden (view full) --- 33 super(TypeDeclAST, self).__init__(slicc, pairs) 34 35 self.type_ast = type_ast 36 self.field_asts = field_asts 37 38 def __repr__(self): 39 return "[TypeDecl: %r]" % (self.type_ast) 40 |
41 def files(self, hh, cc, parent=None): | 41 def files(self, parent=None): |
42 if "external" in self: | 42 if "external" in self: |
43 return | 43 return set() |
44 45 if parent: 46 ident = "%s_%s" % (parent, self.type_ast.ident) 47 else: 48 ident = self.type_ast.ident | 44 45 if parent: 46 ident = "%s_%s" % (parent, self.type_ast.ident) 47 else: 48 ident = self.type_ast.ident |
49 hh.add("%s.hh" % ident) 50 cc.add("%s.cc" % ident) | 49 return set(("%s.hh" % ident, "%s.cc" % ident)) |
51 52 def generate(self): 53 ident = str(self.type_ast) 54 55 # Make the new type 56 new_type = Type(self.symtab, ident, self.location, self.pairs, 57 self.state_machine) 58 self.symtab.newSymbol(new_type) 59 60 # Add all of the fields of the type to it 61 for field in self.field_asts: 62 field.generate(new_type) | 50 51 def generate(self): 52 ident = str(self.type_ast) 53 54 # Make the new type 55 new_type = Type(self.symtab, ident, self.location, self.pairs, 56 self.state_machine) 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) |