ruby: Added message type check to OutPortDeclAST.py
Though OutPort's message type is not used to generate code, this fix checks that the programmer's intent is correct. Eventually, we may want to remove the message type from the OutPort declaration statement.
This commit is contained in:
parent
cf08b232ff
commit
43e4f59e4f
1 changed files with 5 additions and 0 deletions
|
@ -30,6 +30,7 @@ from m5.util import code_formatter
|
|||
from slicc.ast.DeclAST import DeclAST
|
||||
from slicc.ast.TypeAST import TypeAST
|
||||
from slicc.symbols import Var
|
||||
from slicc.symbols import Type
|
||||
|
||||
class OutPortDeclAST(DeclAST):
|
||||
def __init__(self, slicc, ident, msg_type, var_expr, pairs):
|
||||
|
@ -52,6 +53,10 @@ class OutPortDeclAST(DeclAST):
|
|||
"attribute. Type '%s' does not have this attribute.",
|
||||
(queue_type))
|
||||
|
||||
if not self.symtab.find(self.msg_type.ident, Type):
|
||||
self.error("The message type '%s' does not exist.",
|
||||
self.msg_type.ident)
|
||||
|
||||
var = Var(self.symtab, self.ident, self.location, self.queue_type.type,
|
||||
str(code), self.pairs)
|
||||
self.symtab.newSymbol(var)
|
||||
|
|
Loading…
Reference in a new issue