本文整理汇总了C#中Ioke.Lang.IokeObject.GetMimics方法的典型用法代码示例。如果您正苦于以下问题:C# IokeObject.GetMimics方法的具体用法?C# IokeObject.GetMimics怎么用?C# IokeObject.GetMimics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ioke.Lang.IokeObject
的用法示例。
在下文中一共展示了IokeObject.GetMimics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(IokeObject obj)
{
obj.Kind = "Locals";
obj.GetMimics().Clear();
obj.SetCell("=", obj.runtime.Base.Cells["="]);
var assgn = IokeObject.As(obj.runtime.DefaultBehavior.Cells["Assignment"], null).Cells;
obj.SetCell("++", assgn["++"]);
obj.SetCell("--", assgn["--"]);
obj.SetCell("+=", assgn["+="]);
obj.SetCell("-=", assgn["-="]);
obj.SetCell("/=", assgn["/="]);
obj.SetCell("*=", assgn["*="]);
obj.SetCell("%=", assgn["%="]);
obj.SetCell("**=", assgn["**="]);
obj.SetCell("&=", assgn["&="]);
obj.SetCell("|=", assgn["|="]);
obj.SetCell("^=", assgn["^="]);
obj.SetCell("<<=", assgn["<<="]);
obj.SetCell(">>=", assgn[">>="]);
obj.SetCell("&&=", assgn["&&="]);
obj.SetCell("||=", assgn["||="]);
obj.SetCell("cell", obj.runtime.Base.Cells["cell"]);
obj.SetCell("cell=", obj.runtime.Base.Cells["cell="]);
obj.SetCell("cells", obj.runtime.Base.Cells["cells"]);
obj.SetCell("cellNames", obj.runtime.Base.Cells["cellNames"]);
obj.SetCell("removeCell!", obj.runtime.Base.Cells["removeCell!"]);
obj.SetCell("undefineCell!", obj.runtime.Base.Cells["undefineCell!"]);
obj.SetCell("cellOwner?", obj.runtime.Base.Cells["cellOwner?"]);
obj.SetCell("cellOwner", obj.runtime.Base.Cells["cellOwner"]);
obj.SetCell("identity", obj.runtime.Base.Cells["identity"]);
obj.RegisterMethod(obj.runtime.NewNativeMethod("will pass along the call to the real self object of this context.",
new NativeMethod("pass", DefaultArgumentsDefinition.builder()
.WithRestUnevaluated("arguments")
.Arguments,
(method, context, message, on, outer) => {
object selfDelegate = IokeObject.As(on, context).Self;
if(selfDelegate != null && selfDelegate != on) {
return IokeObject.Perform(selfDelegate, context, message);
}
return context.runtime.nil;
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("will return a text representation of the current stack trace",
new NativeMethod.WithNoArguments("stackTraceAsText",
(method, context, m, on, outer) => {
outer.ArgumentsDefinition.CheckArgumentCount(context, m, on);
Runtime runtime = context.runtime;
StringBuilder sb = new StringBuilder();
IokeObject current = IokeObject.As(on, context);
while("Locals".Equals(current.GetKind(m, context))) {
IokeObject message = IokeObject.As(IokeObject.GetCell(current, m, context, "currentMessage"), context);
IokeObject start = message;
while(Message.GetPrev(start) != null && Message.GetPrev(start).Line == message.Line) {
start = Message.GetPrev(start);
}
string s1 = Message.Code(start);
int ix = s1.IndexOf("\n");
if(ix > -1) {
ix--;
}
sb.Append(string.Format(" {0,-48} {1}\n",
(ix == -1 ? s1 : s1.Substring(0,ix)),
"[" + message.File + ":" + message.Line + ":" + message.Position + GetContextMessageName(IokeObject.As(current.Cells["surroundingContext"], context)) + "]"));
current = IokeObject.As(IokeObject.FindCell(current, m, context, "surroundingContext"), context);
}
return runtime.NewText(sb.ToString());
})));
}