Exemple #1
0
        private TypeBase ResolveTypeRef(TypeRef typeRef)
        {
            TypeBase resolvedType = PrimaryType.Unknown;
            var      name         = typeRef.TypeName;

            if (!m_types.Contains(name.Content))
            {
                AddError(c_SE_TypeNameMissing, name.Span, name.Content);
            }
            else
            {
                typeRef.Type = m_types[name.Content];
                resolvedType = typeRef.Type;
            }

            return(resolvedType);
        }
Exemple #2
0
        private TypeBase ResolveTypeRef(TypeRef typeRef)
        {
            TypeBase resolvedType = PrimaryType.Unknown;
            var      name         = typeRef.TypeName;

            if (!m_types.Contains(name.Value))
            {
                m_errorManager.AddError(MemberDeclResolver.c_SE_TypeNameMissing, name.Span, name.Value);
            }
            else
            {
                typeRef.Type = m_types[name.Value];
                resolvedType = typeRef.Type;
            }

            return(resolvedType);
        }
Exemple #3
0
        public override AstNode VisitClassDecl(ClassDecl ast)
        {
            var name = ast.Name.Content;

            if (m_types.Contains(name))
            {
                AddError(c_SE_TypeNameDuplicates, ast.Name.Span, name);
                return(ast);
            }

            var classType = new CodeClassType()
            {
                Name = name
            };

            m_types.Add(classType);
            ast.Type = classType;

            return(ast);
        }