From 0fdfc82bde5b8975ee93d5da9c604ad9b99942e0 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Mon, 26 Oct 2009 17:06:32 -0700 Subject: [PATCH] fixed error message generation bug in SLICC ast files --- src/mem/slicc/ast/ChipComponentAccessAST.py | 4 ++-- src/mem/slicc/ast/MemberExprAST.py | 6 +++--- src/mem/slicc/ast/MethodCallExprAST.py | 12 ++++++------ src/mem/slicc/ast/ReturnStatementAST.py | 2 +- src/mem/slicc/ast/TypeFieldEnumAST.py | 6 +++--- src/mem/slicc/ast/TypeFieldMemberAST.py | 2 +- src/mem/slicc/ast/TypeFieldMethodAST.py | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mem/slicc/ast/ChipComponentAccessAST.py b/src/mem/slicc/ast/ChipComponentAccessAST.py index 841220c94..bbb1b61e9 100644 --- a/src/mem/slicc/ast/ChipComponentAccessAST.py +++ b/src/mem/slicc/ast/ChipComponentAccessAST.py @@ -85,8 +85,8 @@ class ChipMethodAccessAST(ChipComponentAccessAST): # Verify that this is a method of the object if not var.type.methodExist(methodId): - error("%s: Type '%s' does not have a method '%s'" % \ - ("Invalid method call", var.type, methodId)) + self.error("%s: Type '%s' does not have a method '%s'" % \ + ("Invalid method call", var.type, methodId)) expected_size = len(var.type.methodParamType(methodId)) if len(self.expr_vec) != expected_size: diff --git a/src/mem/slicc/ast/MemberExprAST.py b/src/mem/slicc/ast/MemberExprAST.py index 113bb188a..c62e28741 100644 --- a/src/mem/slicc/ast/MemberExprAST.py +++ b/src/mem/slicc/ast/MemberExprAST.py @@ -47,9 +47,9 @@ class MemberExprAST(ExprAST): # Verify that this is a valid field name for this type if self.field not in return_type.data_members: - error("Invalid object field: " + - "Type '%s' does not have data member %s" % \ - (return_type, self.field)) + self.error("Invalid object field: " + + "Type '%s' does not have data member %s" % \ + (return_type, self.field)) # Return the type of the field return return_type.data_members[self.field].type diff --git a/src/mem/slicc/ast/MethodCallExprAST.py b/src/mem/slicc/ast/MethodCallExprAST.py index ecfe43cdb..d423ee4a7 100644 --- a/src/mem/slicc/ast/MethodCallExprAST.py +++ b/src/mem/slicc/ast/MethodCallExprAST.py @@ -55,22 +55,22 @@ class MethodCallExprAST(ExprAST): # Verify that this is a method of the object if methodId not in obj_type.methods: - error("Invalid method call: Type '%s' does not have a method '%s'", - obj_type, methodId) + self.error("Invalid method call: Type '%s' does not have a method '%s'", + obj_type, methodId) if len(self.expr_ast_vec) != \ len(obj_type.methods[methodId].param_types): # Right number of parameters - error("Wrong number of parameters for function name: '%s', " + \ - "expected: , actual: ", proc_name, + self.error("Wrong number of parameters for function name: '%s', " + \ + "expected: , actual: ", proc_name, len(obj_type.methods[methodId].param_types), len(self.expr_ast_vec)) for actual_type, expected_type in \ zip(paramTypes, obj_type.methods[methodId].param_types): if actual_type != expected_type: - error("Type mismatch: expected: %s actual: %s", - expected_type, actual_type) + self.error("Type mismatch: expected: %s actual: %s", + expected_type, actual_type) # Return the return type of the method return obj_type.methods[methodId].return_type diff --git a/src/mem/slicc/ast/ReturnStatementAST.py b/src/mem/slicc/ast/ReturnStatementAST.py index 1d08a7234..f1aff1c32 100644 --- a/src/mem/slicc/ast/ReturnStatementAST.py +++ b/src/mem/slicc/ast/ReturnStatementAST.py @@ -42,7 +42,7 @@ class ReturnStatementAST(StatementAST): # Is return valid here? if return_type is None: - error("Invalid 'return' statement") + self.error("Invalid 'return' statement") # The return type must match if return_type != actual_type: diff --git a/src/mem/slicc/ast/TypeFieldEnumAST.py b/src/mem/slicc/ast/TypeFieldEnumAST.py index d068666ad..138fff793 100644 --- a/src/mem/slicc/ast/TypeFieldEnumAST.py +++ b/src/mem/slicc/ast/TypeFieldEnumAST.py @@ -41,19 +41,19 @@ class TypeFieldEnumAST(TypeFieldAST): def generate(self, type): # Add enumeration if not type.enumAdd(self.field_id, self.pairs_ast.pairs): - error("Duplicate enumeration: %s:%s" % (type, self.field_id)) + self.error("Duplicate enumeration: %s:%s" % (type, self.field_id)) # Fill machine info machine = self.symtab.state_machine if str(type) == "State": if not machine: - error("State declaration not part of a machine.") + self.error("State declaration not part of a machine.") s = State(self.symtab, self.field_id, self.location, self.pairs) machine.addState(s) if str(type) == "Event": if not machine: - error("Event declaration not part of a machine.") + self.error("Event declaration not part of a machine.") e = Event(self.symtab, self.field_id, self.location, self.pairs) machine.addEvent(e) diff --git a/src/mem/slicc/ast/TypeFieldMemberAST.py b/src/mem/slicc/ast/TypeFieldMemberAST.py index 285d5b622..a60153664 100644 --- a/src/mem/slicc/ast/TypeFieldMemberAST.py +++ b/src/mem/slicc/ast/TypeFieldMemberAST.py @@ -54,4 +54,4 @@ class TypeFieldMemberAST(TypeFieldAST): if not type.dataMemberAdd(self.field_id, field_type, self.pairs, init_code): - error("Duplicate data member: %s:%s" % (type_ptr, field_id)) + self.error("Duplicate data member: %s:%s" % (type_ptr, field_id)) diff --git a/src/mem/slicc/ast/TypeFieldMethodAST.py b/src/mem/slicc/ast/TypeFieldMethodAST.py index 337b15597..2c8cf3f7b 100644 --- a/src/mem/slicc/ast/TypeFieldMethodAST.py +++ b/src/mem/slicc/ast/TypeFieldMethodAST.py @@ -47,4 +47,4 @@ class TypeFieldMethodAST(TypeFieldAST): # Add method if not type.methodAdd(self.ident, return_type, types): - error("Duplicate method: %s:%s()" % (type, self.ident)) + self.error("Duplicate method: %s:%s()" % (type, self.ident))