Example #1
0
 public override void Visit(SetQueryNode node)
 {
     _symbolTable.SetCurrentNode(node);
     // Hvis man sætter en attribute i en klasse, og kun det?
     if (node.InVariable != null)
     {
         AllType ClassType = _symbolTable.RetrieveSymbol(node.InVariable.Name) ?? AllType.UNKNOWNTYPE;
         if (!_symbolTable.IsClass(ClassType))
         {
             _symbolTable.InvalidTypeClass();
         }
         else
         {
             foreach (var Attribute in node.Attributes)
             {
                 AllType AttributeType = _symbolTable.GetAttributeType(Attribute.Item1.Name, ClassType) ?? AllType.UNKNOWNTYPE;
                 Attribute.Item3.Accept(this);
                 CheckAllowedCast(AttributeType, Attribute.Item3.Type_enum);
             }
         }
     }
     else
     {
         foreach (var Attribute in node.Attributes)
         {
             AllType AttributeType = _symbolTable.RetrieveSymbol(Attribute.Item1.Name) ?? AllType.UNKNOWNTYPE;
             Attribute.Item3.Accept(this);
             CheckAllowedCast(AttributeType, Attribute.Item3.Type_enum);
         }
     }
     VisitChildren(node);
 }