本文整理汇总了C#中IScope.IsDefinedLocally方法的典型用法代码示例。如果您正苦于以下问题:C# IScope.IsDefinedLocally方法的具体用法?C# IScope.IsDefinedLocally怎么用?C# IScope.IsDefinedLocally使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScope
的用法示例。
在下文中一共展示了IScope.IsDefinedLocally方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestForDefineErrors
public bool TestForDefineErrors(Symbol sym, IScope currentScope)
{
string location = string.Empty;
if (sym.Def != null)
location = "line " + sym.Def.Line + ":" + sym.Def.CharPositionInLine + " ";
if (currentScope.IsDefinedLocally(sym.Name))
{
_listener.Error(location + "Symbol '"
+ sym.Name + "' already defined"
);
return true;
}
if (currentScope.ScopeName == "local")
{
//if we're in a local scope, travel up until we hit a function def scope
//or an event def scope and make sure we're not shadowing any parameters
//if we are, issue a warning
if (FindSymbolInMethodScope(sym, currentScope) != null)
{
_listener.Info(location + "Symbol '"
+ sym.Name + "' shadows parameter of the same name"
);
}
}
return false;
}