本文整理汇总了C#中IMethodData.GetSignatureForError方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodData.GetSignatureForError方法的具体用法?C# IMethodData.GetSignatureForError怎么用?C# IMethodData.GetSignatureForError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodData
的用法示例。
在下文中一共展示了IMethodData.GetSignatureForError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIterator
public static void CreateIterator(IMethodData method, TypeContainer parent, Modifiers modifiers, CompilerContext ctx)
{
bool is_enumerable;
TypeSpec iterator_type;
TypeSpec ret = method.ReturnType;
if (ret == null)
return;
if (!CheckType (ret, out iterator_type, out is_enumerable)) {
ctx.Report.Error (1624, method.Location,
"The body of `{0}' cannot be an iterator block " +
"because `{1}' is not an iterator interface type",
method.GetSignatureForError (),
TypeManager.CSharpName (ret));
return;
}
ParametersCompiled parameters = method.ParameterInfo;
for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters [i];
Parameter.Modifier mod = p.ModFlags;
if ((mod & Parameter.Modifier.ISBYREF) != 0) {
ctx.Report.Error (1623, p.Location,
"Iterators cannot have ref or out parameters");
return;
}
if (p is ArglistParameter) {
ctx.Report.Error (1636, method.Location,
"__arglist is not allowed in parameter list of iterators");
return;
}
if (parameters.Types [i].IsPointer) {
ctx.Report.Error (1637, p.Location,
"Iterators cannot have unsafe parameters or " +
"yield types");
return;
}
}
if ((modifiers & Modifiers.UNSAFE) != 0) {
ctx.Report.Error (1629, method.Location, "Unsafe code may not appear in iterators");
return;
}
// TODO: Ugly leftover
new Iterator (ctx, method, parent, iterator_type, is_enumerable);
}
示例2: Resolve
public bool Resolve (FlowBranching parent, BlockContext rc, ParametersCompiled ip, IMethodData md)
{
if (resolved)
return true;
resolved = true;
try {
if (!ResolveMeta (rc, ip))
return false;
using (rc.With (ResolveContext.Options.DoFlowAnalysis, true)) {
FlowBranchingToplevel top_level = rc.StartFlowBranching (this, parent);
if (!Resolve (rc))
return false;
unreachable = top_level.End ();
}
} catch (Exception) {
#if PRODUCTION
if (rc.CurrentBlock != null) {
ec.Report.Error (584, rc.CurrentBlock.StartLocation, "Internal compiler error: Phase Resolve");
} else {
ec.Report.Error (587, "Internal compiler error: Phase Resolve");
}
#endif
throw;
}
if (rc.ReturnType != TypeManager.void_type && !unreachable) {
if (rc.CurrentAnonymousMethod == null) {
rc.Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
return false;
} else if (!rc.CurrentAnonymousMethod.IsIterator) {
rc.Report.Error (1643, rc.CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
rc.CurrentAnonymousMethod.GetSignatureForError ());
return false;
}
}
return true;
}
示例3: Resolve
public bool Resolve (FlowBranching parent, BlockContext rc, IMethodData md)
{
if (resolved)
return true;
resolved = true;
if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion))
flags |= Flags.IsExpressionTree;
try {
ResolveMeta (rc);
using (rc.With (ResolveContext.Options.DoFlowAnalysis, true)) {
FlowBranchingToplevel top_level = rc.StartFlowBranching (this, parent);
if (!Resolve (rc))
return false;
unreachable = top_level.End ();
}
} catch (Exception e) {
if (e is CompletionResult || rc.Report.IsDisabled)
throw;
if (rc.CurrentBlock != null) {
rc.Report.Error (584, rc.CurrentBlock.StartLocation, "Internal compiler error: {0}", e.Message);
} else {
rc.Report.Error (587, "Internal compiler error: {0}", e.Message);
}
if (Report.DebugFlags > 0)
throw;
}
if (rc.ReturnType != TypeManager.void_type && !unreachable) {
if (rc.CurrentAnonymousMethod == null) {
// FIXME: Missing FlowAnalysis for generated iterator MoveNext method
if (md is IteratorMethod) {
unreachable = true;
} else {
rc.Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
return false;
}
} else {
rc.Report.Error (1643, rc.CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
rc.CurrentAnonymousMethod.GetSignatureForError ());
return false;
}
}
return true;
}
示例4: ResolveTopBlock
public bool ResolveTopBlock (EmitContext anonymous_method_host, ToplevelBlock block,
Parameters ip, IMethodData md, out bool unreachable)
{
if (resolved) {
unreachable = this.unreachable;
return true;
}
current_phase = Phase.Resolving;
unreachable = false;
if (!loc.IsNull)
CurrentFile = loc.File;
#if PRODUCTION
try {
#endif
if (!block.ResolveMeta (this, ip))
return false;
using (this.With (EmitContext.Flags.DoFlowAnalysis, true)) {
FlowBranchingToplevel top_level;
if (anonymous_method_host != null)
top_level = new FlowBranchingToplevel (anonymous_method_host.CurrentBranching, block);
else
top_level = block.TopLevelBranching;
current_flow_branching = top_level;
bool ok = block.Resolve (this);
current_flow_branching = null;
if (!ok)
return false;
bool flow_unreachable = top_level.End ();
if (flow_unreachable)
this.unreachable = unreachable = true;
}
#if PRODUCTION
} catch (Exception e) {
Console.WriteLine ("Exception caught by the compiler while compiling:");
Console.WriteLine (" Block that caused the problem begin at: " + loc);
if (CurrentBlock != null){
Console.WriteLine (" Block being compiled: [{0},{1}]",
CurrentBlock.StartLocation, CurrentBlock.EndLocation);
}
Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
throw;
}
#endif
if (return_type != TypeManager.void_type && !unreachable) {
if (CurrentAnonymousMethod == null) {
Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
return false;
} else if (!CurrentAnonymousMethod.IsIterator) {
Report.Error (1643, CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
CurrentAnonymousMethod.GetSignatureForError ());
return false;
}
}
resolved = true;
return true;
}