当前位置: 首页>>代码示例>>C#>>正文


C# Visitor.Visit方法代码示例

本文整理汇总了C#中Visitor.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# Visitor.Visit方法的具体用法?C# Visitor.Visit怎么用?C# Visitor.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Visitor的用法示例。


在下文中一共展示了Visitor.Visit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Convert

 public static QueryComplete Convert(
     Expression<Func<BsonDocument, bool>> expression
     )
 {
     var visitor = new Visitor();
     visitor.Visit(expression);
     return (QueryComplete) visitor.ResultStack.Pop();
 }
开发者ID:rmueller,项目名称:LinqToMongo,代码行数:8,代码来源:ExpressionToQueryConverter.cs

示例2: Highlight

        private JObject Highlight(SyntaxNode root, SemanticModel model)
        {
            var visitor = new Visitor(model);
            visitor.Visit(root);
            var regions = visitor.Regions.OrderBy(r => r.Line).ThenBy(r => r.Start)
                .GroupBy(r => new
            {
                Line = r.Line,
                Start = r.Start,
                End = r.End
            }).Select(g =>
            {
                var k = g.Key;
                var c = string.Join(" ", g.Where(r => !string.IsNullOrEmpty(r.Style)).Select(r => r.Style).Distinct());
                var props = new JObject(g.Where(r => r.Props != null).SelectMany(r => r.Props.Properties()));
                if (props.Count == 0)
                    props = null;

                return new Visitor.Region
                {
                    Start = k.Start,
                    Line = k.Line,
                    End = k.End,
                    Style = c,
                    Props = props
                };
            });

            JObject lines = new JObject();
            foreach (var region in regions)
            {
                JArray lregions;
                var lineProp = lines.Property(region.Line.ToString());
                if (lineProp == null)
                {
                    lineProp = new JProperty(region.Line.ToString());
                    lregions = new JArray();
                    lineProp.Value = new JObject(new JProperty("ranges", lregions));
                    lines.Add(lineProp);
                }
                else
                {
                    lregions = (JArray)((JObject)lineProp.Value).Property("ranges").Value;
                }

                var annotation = JObject.FromObject(new AnnotationRange(region.Start, region.End, new OrionStyle(styleClass: region.Style, attributes: region.Props)));
                if (region.Style.Contains("error"))
                    AddError((JObject)lineProp.Value, annotation);
                lregions.Add(annotation);
            }

            return lines;
        }
开发者ID:Runt-Editor,项目名称:Runt,代码行数:53,代码来源:Highlighter.cs

示例3: ThrowIfUnsupported

        /// <summary>
        /// Checks whether the given node is supported on the given server.
        /// </summary>
        internal static void ThrowIfUnsupported(SqlNode node, SqlNodeAnnotations annotations, SqlProvider.ProviderMode provider) {
            // Check to see whether there's at least one SqlServerCompatibilityAnnotation.
            if (annotations.HasAnnotationType(typeof(SqlServerCompatibilityAnnotation))) {
                Visitor visitor = new Visitor(provider);
                visitor.annotations = annotations;
                visitor.Visit(node);

                // If any messages were recorded, then throw an exception.
                if (visitor.reasons.Count > 0) {
                    throw Error.ExpressionNotSupportedForSqlServerVersion(visitor.reasons);
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:SqlServer2KCompatibilityCheck.cs

示例4: Test

        private static void Test(Expression exp, Action<Dictionary<Expression, string>> additionalCheck = null)
        {
            var vis = new Visitor();
            vis.Visit(exp);

            var sortedPaths = vis.paths.OrderBy(s => s);
            sortedPaths.SequenceEqual(vis.paths).Assert();

            vis.paths.Skip(1).All(p => Visitor.IsXChildOfY(p, vis.paths[0]) && !Visitor.IsXChildOfY(vis.paths[0], p))
                .Assert();

            if (additionalCheck != null)
            {
                additionalCheck(vis.pathsDict);
            }
        }
开发者ID:madelson,项目名称:LinqToHadoop,代码行数:16,代码来源:BranchTrackingVisitorTests.cs

示例5: Accept

 public override void Accept(Visitor visitor)
 {
     visitor.Visit(this);
 }
开发者ID:gsscoder,项目名称:exprengine,代码行数:4,代码来源:MemberAcessExpression.cs

示例6: Process

 public Expression Process(Expression expression) {
     var visitor = new Visitor();
     return visitor.Visit(expression);
 }
开发者ID:rho24,项目名称:PocoDb,代码行数:4,代码来源:ExpressionProcessor.cs

示例7: GenerateNamespaceTypes

        protected string GenerateNamespaceTypes(string nameSpace, IList<Type> allTypes)
        {
            var trace = new StringBuilder();
            var visitor = new Visitor();

            trace.AppendFormatObject(NamespaceStartFormat, new NameSpaceEventArgs()
            {
                Comment = nameSpace,
                NameSpaceName = nameSpace
            });

            visitor.TypeVisiting += (sender, args) => {
                if (args.BaseTypeInfo != null)
                {
                    trace.AppendFormatObject(DerivedTypeStartFormat, args);
                }
                else
                {
                    trace.AppendFormatObject(TerminalTypeStartFormat, args);
                }
            };
            visitor.TypeVisited += (sender, args) => { trace.AppendFormatObject(TypeEndFormat, args); };

            Func<MemberEventArgs, bool> include = args =>
                (this.ExportsNonPublicMembers || args.IsPublic) && args.IsOwnProperty && !args.IgnoredByGenerators.Contains(this.id);

            visitor.MemberVisiting += (sender, args) => {
                if (include(args))
                {
                    trace.AppendFormatObject(MemberStartFormat, args);
                }
            };

            visitor.MemberVisited += (sender, args) =>
            {
                if (include(args))
                {
                    trace.AppendFormatObject(MemberEndFormat, args);
                }
            };

            visitor.MethodVisiting += (sender, args) =>
            {
                if ((this.ExportsNonPublicMembers || args.MethodInfo.IsPublic) && args.IsOwnMethod)
                {
                    trace.AppendFormatObject(MethodStartFormat, args);
                }
            };

            visitor.MethodVisited += (sender, args) =>
            {
                if ((this.ExportsNonPublicMembers || args.MethodInfo.IsPublic) && args.IsOwnMethod)
                {
                    trace.AppendFormatObject(MethodEndFormat, args);
                }
            };

            visitor.Visit(allTypes, this.language);

            trace.AppendFormatObject(NamespaceEndFormat, new NameSpaceEventArgs() { Comment = nameSpace, NameSpaceName = nameSpace });

            return trace.ToString().Trim();
        }
开发者ID:spelltwister,项目名称:TypeWalker,代码行数:63,代码来源:LanguageGenerator.cs

示例8: CanBigJoin

 internal static bool CanBigJoin(SqlSelect select) {
     Visitor v = new Visitor();
     v.Visit(select);
     return v.canBigJoin;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:SqlMultiplexer.cs

示例9: HasHierarchy

 internal static bool HasHierarchy(SqlExpression expr) {
     Visitor v = new Visitor();
     v.Visit(expr);
     return v.foundHierarchy;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:SqlMultiplexer.cs

示例10: Accept

 public override string Accept(Visitor visitor)
 {
     return visitor.Visit(this);
 }
开发者ID:agabani,项目名称:DesignPatterns,代码行数:4,代码来源:Element.cs

示例11: ReferencesAny

 /// <summary>
 /// Returns true iff the given node references any aliases the list of 'aliases'.
 /// </summary>
 internal static bool ReferencesAny(SqlNode node, IEnumerable<SqlAlias> aliases) {
     Visitor visitor = new Visitor();
     visitor.aliases = aliases;
     visitor.Visit(node);
     return visitor.referencesAnyMatchingAliases;
 }
开发者ID:modulexcite,项目名称:LinqToSQL2,代码行数:9,代码来源:SqlAliasesReferenced.cs

示例12: IsDependent

 internal static bool IsDependent(SqlNode node, HashSet<SqlAlias> aliasesToCheck, HashSet<SqlExpression> ignoreExpressions) {
     Visitor v = new Visitor(aliasesToCheck, ignoreExpressions);
     v.Visit(node);
     return v.hasDependency;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:SqlOuterApplyReducer.cs

示例13: Gather

 internal static HashSet<SqlColumn> Gather(SqlNode node, HashSet<SqlColumn> columns) {
     Visitor v = new Visitor(columns);
     v.Visit(node);
     return columns;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:SqlOuterApplyReducer.cs

示例14: Reduce

		internal static SqlNode Reduce(SqlNode node, SqlFactory factory, SqlNodeAnnotations annotations) {
			Visitor r = new Visitor(factory, annotations);
			return r.Visit(node);			
		}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:SqlOuterApplyReducer.cs

示例15: IsSimple

 internal static bool IsSimple(SqlExpression expr) {
     Visitor v = new Visitor();
     v.Visit(expr);
     return v.IsSimple;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:SimpleExpression.cs


注:本文中的Visitor.Visit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。