public bool Visit(TypeDecl node) { //TODO: remove this code (in cases to separate private functions CheckIdentifierDuplicateInScope(node.Ident.Token); switch (node.IdentType) { case SimpleTypeNode simpleTypeNode: { var symType = _symStack.CheckTypeDeclared(simpleTypeNode.Token.Value); _symStack.AddAlias(node.Ident.ToString(), symType); break; } case ArrayTypeNode arrayTypeNode: { arrayTypeNode.Accept(this); _symStack.AddType(node.Ident.ToString(), arrayTypeNode.SymType); break; } case RecordTypeNode recordTypeNode: { recordTypeNode.Accept(this); _symStack.AddType(node.Ident.ToString(), recordTypeNode.SymType); break; } case PointerTypeNode pointerTypeNode: { //TODO: this is something strange! Why alias here when AddPtr or smth must be var ptrType = _symStack.CheckTypeDeclared(pointerTypeNode.SimpleType.Token.Value); _symStack.AddAlias(node.Ident.ToString(), ptrType); break; } } return(true); }