// OWNS
        public override string Visit(OwnsActionNode node, object obj)
        {
            foreach (DeclarationNode ownedObjectDcl in node.OwnedObjectDcls)
            {
                string typeString = Visit(ownedObjectDcl.Type);

                // Add a property to the appropriate class for every owned object
                _codeWriter.AddProperty(node.OwnerType, typeString, ownedObjectDcl.Id.ToString());
            }
            return(null);
        }
Beispiel #2
0
        // OWNS
        public override TypeNode Visit(OwnsActionNode node, object obj)
        {
            // If the owner type is not Player, log error
            if (node.OwnerType != StandardTypes.Player)
            {
                ErrorLogger.LogError(new ExpectedTypeError(StandardTypes.Player, node.OwnerType.SourcePosition));
                return(new ErrorTypeNode(node.SourcePosition));
            }

            // Visit all owned object declarations
            node.OwnedObjectDcls.ForEach(x => Visit(x));
            return(null);
        }
Beispiel #3
0
 public abstract T Visit(OwnsActionNode node, object obj);