Exemplo n.º 1
0
        private CompositeElement ResolveIncludeDirective([NotNull] IT4IncludeDirective directive)
        {
            if (LogicalSourceFile == null)
            {
                return(null);
            }
            var pathWithMacros = directive.ResolvedPath;
            var path           = IncludeResolver?.ResolvePath(pathWithMacros);

            if (path == null)
            {
                return(null);
            }
            var includeFile = T4ParsingContextHelper.ExecuteGuarded(
                path,
                directive.Once,
                () => IncludeResolver?.Resolve(pathWithMacros)
                );

            if (includeFile == null)
            {
                return(null);
            }
            return(BuildIncludedT4Tree(includeFile));
        }
		public override void VisitIncludeDirectiveNode(IT4IncludeDirective includeDirectiveParam)
		{
			string suffix = Result.State.ProduceBeforeEof();
			if (!string.IsNullOrEmpty(suffix)) AppendTransformation(suffix, Result.State.FirstNode);
			Guard.TryEndProcessing(IncludeResolver.Resolve(includeDirectiveParam.ResolvedPath).GetLocation());
			var intermediateResults = Results.Pop();
			Result.Append(intermediateResults);
		}
Exemplo n.º 3
0
        private void ReportRedundantInclude([NotNull] IT4IncludeDirective include)
        {
            var value = include.GetFirstAttribute(T4DirectiveInfoManager.Include.FileAttribute)?.Value;

            if (value == null)
            {
                return;
            }
            AddHighlighting(value, new RedundantIncludeWarning(include));
        }
Exemplo n.º 4
0
        private void ReportUnresolvedPath([NotNull] IT4IncludeDirective include)
        {
            var path = include.GetAttributeValueToken(T4DirectiveInfoManager.Include.FileAttribute.Name);

            if (path == null)
            {
                return;
            }
            AddHighlighting(path, new UnresolvedIncludeError(path));
        }
Exemplo n.º 5
0
        private void ProcessInclude([NotNull] IT4IncludeDirective include)
        {
            var sourceFile = IncludeResolver.Resolve(include.ResolvedPath);

            if (sourceFile == null)
            {
                ReportUnresolvedPath(include);
                return;
            }

            if (!Guard.CanProcess(sourceFile.GetLocation()))
            {
                return;
            }
            if (include.Once && Guard.HasSeenFile(sourceFile.GetLocation()))
            {
                ReportRedundantInclude(include);
            }
        }
        private void ReportUnresolvedPath([NotNull] IT4IncludeDirective include)
        {
            var name = include.Name;

            AddHighlighting(name, new UnresolvedIncludeWarning(name));
        }