コード例 #1
0
        public override void ValidateSemantic()
        {
            BaseType type;

            if (NameOfVariable.StructValue != null)
            {
                type = StackContext.Context.Stack.Peek().GetVariable(NameOfVariable.StructValue, Position);
            }
            else
            {
                type = DataType.ValidateTypeSemantic();
            }

            var variable = new TypesTable.Variable();

            if (NameOfVariable.Accessors != null && NameOfVariable.Accessors.Count > 0)
            {
                variable.Accessors.AddRange(NameOfVariable.Accessors);
            }

            if (ListOfPointer != null && ListOfPointer.Count > 0)
            {
                variable.Pointers.AddRange(ListOfPointer);
            }

            StackContext.Context.Stack.Peek().RegisterType(NameOfVariable.Value, type, Position, variable);

            if (NameOfVariable.Assignation != null)
            {
                NameOfVariable.Assignation.LeftValue             = DataType;
                NameOfVariable.Assignation.LeftValue.StructValue = NameOfVariable.Value;

                NameOfVariable.Assignation.ValidateSemantic();
            }
        }
コード例 #2
0
        public override void ValidateSemantic()
        {
            StackContext.Context.Stack.Push(new TypesTable());

            var type = DataType.ValidateTypeSemantic();

            var variable = new TypesTable.Variable
            {
                Accessors = Item.Accessors,
                Pointers  = Item.PointerNodes
            };

            StackContext.Context.Stack.Peek().RegisterType(Item.Value, type, Position, variable);
            StackContext.Context.PastContexts.Add(CodeGuid, StackContext.Context.Stack.Pop());
        }
コード例 #3
0
        public override void ValidateSemantic()
        {
            var type = TypeOfConst.ValidateTypeSemantic();

            if (Assignation != null)
            {
                Assignation.LeftValue = TypeOfConst;

                Assignation.ValidateSemantic();
            }

            var variable = new TypesTable.Variable
            {
                Accessors = ConstName.Accessors,
                Pointers  = PointersList
            };

            StackContext.Context.Stack.Peek().Table.Remove(ConstName.Value);

            StackContext.Context.Stack.Peek().RegisterType(ConstName.Value, new ConstType
            {
                Assignation = Assignation, Type = type
            }, Position, variable);
        }