Esempio n. 1
0
        public override void VisitClassDeclaration(IClassDeclaration classDeclarationParam, IHighlightingConsumer context)
        {
            base.VisitClassDeclaration(classDeclarationParam, context);

            if (!classDeclarationParam.IsSynthetic() ||
                !T4CSharpCodeGenerator.ClassName.Equals(classDeclarationParam.DeclaredName, StringComparison.Ordinal))
            {
                return;
            }

            IDeclaredTypeUsage superTypeUsage = classDeclarationParam.SuperTypeUsageNodes.FirstOrDefault();

            if (superTypeUsage == null ||
                T4CSharpCodeGenerator.DefaultBaseClassName.Equals(superTypeUsage.GetText(), StringComparison.Ordinal))
            {
                return;
            }

            ITypeElement typeElement = CSharpTypeFactory.CreateDeclaredType(superTypeUsage).GetTypeElement();

            if (typeElement == null)
            {
                return;
            }

            if (!typeElement.Methods.Any(IsTransformTextMethod))
            {
                context.AddHighlighting(new MissingTransformTextMethodHighlighting(superTypeUsage));
            }
        }
Esempio n. 2
0
		public override void VisitClassDeclaration(IClassDeclaration classDeclarationParam, IHighlightingConsumer context) {
			base.VisitClassDeclaration(classDeclarationParam, context);

			if (!classDeclarationParam.IsSynthetic()
			|| !T4CSharpCodeGenerator.ClassName.Equals(classDeclarationParam.DeclaredName, StringComparison.Ordinal))
				return;

			IDeclaredTypeUsage superTypeUsage = classDeclarationParam.SuperTypeUsageNodes.FirstOrDefault();
			if (superTypeUsage == null
			|| T4CSharpCodeGenerator.DefaultBaseClassName.Equals(superTypeUsage.GetText(), StringComparison.Ordinal))
				return;

			ITypeElement typeElement = CSharpTypeFactory.CreateDeclaredType(superTypeUsage).GetTypeElement();
			if (typeElement == null)
				return;

			if (!typeElement.Methods.Any(IsTransformTextMethod))
				context.AddHighlighting(new MissingTransformTextMethodHighlighting(superTypeUsage));
		}
Esempio n. 3
0
        public override void VisitClassDeclaration(IClassDeclaration classDeclarationParam, IHighlightingConsumer context)
        {
            base.VisitClassDeclaration(classDeclarationParam, context);

            if (!classDeclarationParam.IsSynthetic())
            {
                return;
            }
            if (!T4CSharpIntermediateConverterBase.GeneratedClassNameString.Equals(
                    classDeclarationParam.DeclaredName, StringComparison.Ordinal))
            {
                return;
            }

            ITypeUsage baseClassNode = classDeclarationParam.SuperTypeUsageNodes.FirstOrDefault();

            if (baseClassNode?.IsVisibleInDocument() != true)
            {
                return;
            }

            if (T4CSharpIntermediateConverterBase.GeneratedBaseClassNameString.Equals(
                    baseClassNode.GetText(),
                    StringComparison.Ordinal))
            {
                return;
            }

            ITypeElement baseClass = classDeclarationParam.SuperTypes.FirstOrDefault()?.GetTypeElement();

            if (baseClass == null)
            {
                return;
            }

            if (HasTransformTextMethod(baseClass))
            {
                return;
            }
            context.AddHighlighting(new MissingTransformTextMethodError(baseClassNode, baseClass));
        }