• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# INamedBlockVariable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中INamedBlockVariable的典型用法代码示例。如果您正苦于以下问题:C# INamedBlockVariable类的具体用法?C# INamedBlockVariable怎么用?C# INamedBlockVariable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



INamedBlockVariable类属于命名空间,在下文中一共展示了INamedBlockVariable类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Error_AlreadyDeclared

		public override void Error_AlreadyDeclared (string name, INamedBlockVariable variable, string reason)
		{
			TopBlock.Report.Error (1931, variable.Location,
				"A range variable `{0}' conflicts with a previous declaration of `{0}'",
				name);
		}
开发者ID:alisci01,项目名称:mono,代码行数:6,代码来源:linq.cs


示例2: MustCaptureVariable

		public bool MustCaptureVariable (INamedBlockVariable local)
		{
			if (CurrentAnonymousMethod == null)
				return false;

			// FIXME: IsIterator is too aggressive, we should capture only if child
			// block contains yield
			if (CurrentAnonymousMethod.IsIterator || CurrentAnonymousMethod is AsyncInitializer)
				return true;

			return local.Block.ParametersBlock != CurrentBlock.ParametersBlock.Original;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:12,代码来源:context.cs


示例3: MustCaptureVariable

		public bool MustCaptureVariable (INamedBlockVariable local)
		{
			if (CurrentAnonymousMethod == null)
				return false;

			//
			// Capture only if this or any of child blocks contain yield
			// or it's a parameter
			//
			if (CurrentAnonymousMethod.IsIterator)
				return local.IsParameter || CurrentBlock.Explicit.HasYield;

			//
			// Capture only if this or any of child blocks contain await
			// or it's a parameter
			//
			if (CurrentAnonymousMethod is AsyncInitializer)
				return CurrentBlock.Explicit.HasAwait;

			return local.Block.ParametersBlock != CurrentBlock.ParametersBlock.Original;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:21,代码来源:context.cs


示例4: GetLocalName

		//
		// Lookup inside a block, the returned value can represent 3 states
		//
		// true+variable: A local name was found and it's valid
		// false+variable: A local name was found in a child block only
		// false+null: No local name was found
		//
		public bool GetLocalName (string name, Block block, ref INamedBlockVariable variable)
		{
			if (names == null)
				return false;

			object value;
			if (!names.TryGetValue (name, out value))
				return false;

			variable = value as INamedBlockVariable;
			Block b = block;
			if (variable != null) {
				do {
					if (variable.Block == b.Original)
						return true;

					b = b.Parent;
				} while (b != null);

				b = variable.Block;
				do {
					if (block == b)
						return false;

					b = b.Parent;
				} while (b != null);
			} else {
				List<INamedBlockVariable> list = (List<INamedBlockVariable>) value;
				for (int i = 0; i < list.Count; ++i) {
					variable = list[i];
					do {
						if (variable.Block == b.Original)
							return true;

						b = b.Parent;
					} while (b != null);

					b = variable.Block;
					do {
						if (block == b)
							return false;

						b = b.Parent;
					} while (b != null);

					b = block;
				}
			}

			variable = null;
			return false;
		}
开发者ID:alisci01,项目名称:mono,代码行数:59,代码来源:statement.cs


示例5: AddLocalName

		public override void AddLocalName (string name, INamedBlockVariable li)
		{
			if (names == null)
				names = new Dictionary<string, object> ();

			object value;
			if (!names.TryGetValue (name, out value)) {
				names.Add (name, li);
				return;
			}

			INamedBlockVariable existing = value as INamedBlockVariable;
			List<INamedBlockVariable> existing_list;
			if (existing != null) {
				existing_list = new List<INamedBlockVariable> ();
				existing_list.Add (existing);
				names[name] = existing_list;
			} else {
				existing_list = (List<INamedBlockVariable>) value;
			}

			//
			// A collision checking between local names
			//
			for (int i = 0; i < existing_list.Count; ++i) {
				existing = existing_list[i];
				Block b = existing.Block;

				// Collision at same level
				if (li.Block == b) {
					li.Block.Error_AlreadyDeclared (name, li);
					break;
				}

				// Collision with parent
				b = li.Block;
				while ((b = b.Parent) != null) {
					if (existing.Block == b) {
						li.Block.Error_AlreadyDeclared (name, li, "parent or current");
						i = existing_list.Count;
						break;
					}
				}

				// Collision with with children
				b = existing.Block;
				while ((b = b.Parent) != null) {
					if (li.Block == b) {
						li.Block.Error_AlreadyDeclared (name, li, "child");
						i = existing_list.Count;
						break;
					}
				}
			}

			existing_list.Add (li);
		}
开发者ID:alisci01,项目名称:mono,代码行数:57,代码来源:statement.cs


示例6: Error_AlreadyDeclared

		public virtual void Error_AlreadyDeclared (string name, INamedBlockVariable variable)
		{
			var pi = variable as ParametersBlock.ParameterInfo;
			if (pi != null) {
				var p = pi.Parameter;
				if (p is AnonymousTypeClass.GeneratedParameter) {
					ParametersBlock.TopBlock.Report.Error (833, p.Location, "`{0}': An anonymous type cannot have multiple properties with the same name",
						p.Name);
				} else {
					ParametersBlock.TopBlock.Report.Error (100, p.Location, "The parameter name `{0}' is a duplicate", p.Name);
				}

				return;
			}

			ParametersBlock.TopBlock.Report.Error (128, variable.Location,
				"A local variable named `{0}' is already defined in this scope", name);
		}
开发者ID:alisci01,项目名称:mono,代码行数:18,代码来源:statement.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# INamedTypeSymbol类代码示例发布时间:2022-05-24
下一篇:
C# INameTable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap