예제 #1
0
        public void RegisterType(string name, BaseType baseType, int propertiesOfVarible)
        {
            if (Context.StackOfContext.Stack.Peek()._table.ContainsKey(name))
            {
                throw new SemanticException($"Type :{name} exists.");
            }
            if (Context.StackOfContext.Stack.Peek().Contains(name))
            {
                throw new SemanticException($"  :{name} is a type.");
            }
            baseType.LenghtOfProperties = propertiesOfVarible;

            _table.Add(name, baseType);
            TableValue.Add(name, baseType.GetDefaultValue());
        }