Ejemplo n.º 1
0
        public static TypeNode Create(LeafParser.Def_typeContext ctx)
        {
            var s = ctx.@struct();

            if (s != null)
            {
                return(new StructTypeNode(s));
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        private void DefineType(LeafParser.Def_typeContext def, LeafParser.Attribute_addContext[]?attribs)
        {
            Type type;
            var  name = def.Id().GetText();

            if (def.generic_def_list() != null)
            {
                throw new NotImplementedException("Generics are not supported.");
            }

            if (def.@struct() != null)
            {
                type = new StructType(name, this, def.@struct(), attribs);
            }
            else
            {
                throw new NotImplementedException();
            }

            if (!Namespace.Types.TryAdd(name, type))
            {
                throw new DuplicateSymbolException(name, this, def.Start.Line);
            }
        }