本文整理汇总了C#中Operation.AddMetaInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.AddMetaInfo方法的具体用法?C# Operation.AddMetaInfo怎么用?C# Operation.AddMetaInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation.AddMetaInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process_Operation
private void Process_Operation(dynamic node)
{
Operation operation = new Operation();
// Map source location and node to object
operation.AddMetaInfo(new SourceLocationInfo(node, context));
context.AddObject(node, operation);
// Interface
try
{
NameContext.Current.CheckName(node.Name, typeof(Operation));
operation.Interface = (Interface)NameContext.Current.Scope;
}
catch (NameCollisionException exception)
{
Error_NameExists(operation, exception);
}
// Name (obligatory)
operation.Name = node.Name;
// ReturnType (obligatory)
try
{
operation.ReturnType = this.Process_ReturnTypeReference(node.ReturnType);
}
catch (NameNotFoundException exception)
{
Error_NameNotFound(operation, exception);
}
catch (NameCollisionException exception)
{
Error_NameCollision(operation, exception);
}
// Enter scope
using (new NameContextScope(operation))
{
// Parameters (optional)
if (node.Parameters != null)
{
foreach (dynamic param in node.Parameters)
{
this.Process_OperationParameter(param);
}
}
// Exceptions (optional)
if (node.Exceptions != null)
{
foreach (dynamic exc in node.Exceptions)
{
SourceLocationInfo location = new SourceLocationInfo(exc, context);
try
{
ExceptionType exceptionType = this.Process_NamespacedTypeReference(exc, typeof(ExceptionType));
if (operation.Exceptions.Contains(exceptionType))
{
Error_NameRedundant(location, typeof(ExceptionType), exceptionType.FullName);
}
else
{
operation.Exceptions.Add(exceptionType);
}
}
catch (NameNotFoundException exception)
{
Error_NameNotFound(location, exception);
}
catch (NameCollisionException exception)
{
Error_NameCollision(location, exception);
}
}
}
}
}