本文整理汇总了C#中Iodine.Runtime.IodineObject.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IodineObject.SetAttribute方法的具体用法?C# IodineObject.SetAttribute怎么用?C# IodineObject.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Iodine.Runtime.IodineObject
的用法示例。
在下文中一共展示了IodineObject.SetAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Inherit
public virtual void Inherit(VirtualMachine vm, IodineObject self, IodineObject[] arguments)
{
IodineObject obj = this.Invoke (vm, arguments);
foreach (string attr in attributes.Keys) {
if (!self.HasAttribute (attr))
self.SetAttribute (attr, attributes [attr]);
obj.SetAttribute (attr, attributes [attr]);
}
self.SetAttribute ("__super__", obj);
self.Base = obj;
}
示例2: BindAttributes
public IodineObject BindAttributes(IodineObject obj)
{
foreach (KeyValuePair<string, IodineObject> kv in attributes) {
if (!obj.HasAttribute (kv.Key))
obj.SetAttribute (kv.Key, kv.Value);
}
return obj;
}
示例3: Inherit
public override void Inherit(VirtualMachine vm, IodineObject self, IodineObject[] arguments)
{
IodineObject obj = Invoke (vm, arguments);
foreach (KeyValuePair<string, IodineObject> kv in attributes) {
if (!self.HasAttribute (kv.Key))
self.SetAttribute (kv.Key, kv.Value);
if (!obj.HasAttribute (kv.Key))
obj.SetAttribute (kv.Key, kv.Value);
}
self.SetAttribute ("__super__", obj);
self.Base = obj;
}
示例4: Inherit
public override void Inherit (VirtualMachine vm, IodineObject self, IodineObject[] arguments)
{
IodineObject obj = Invoke (vm, arguments);
foreach (KeyValuePair<string, IodineObject> kv in Attributes) {
if (!self.HasAttribute (kv.Key))
self.SetAttribute (kv.Key, kv.Value);
if (!obj.HasAttribute (kv.Key)) {
obj.SetAttribute (kv.Key, kv.Value);
}
}
Dictionary<string, IodineObject> childAttributes = obj.Attributes;
foreach (KeyValuePair<string, IodineObject> kv in childAttributes) {
if (kv.Value is IodineInstanceMethodWrapper) {
IodineInstanceMethodWrapper wrapper = (IodineInstanceMethodWrapper)kv.Value;
wrapper.Rewrap (self);
}
}
self.SetAttribute ("__super__", obj);
self.Base = obj;
}
示例5: RaiseException
public void RaiseException(IodineObject ex)
{
if (exceptionHandlers.Count == 0) {
throw new UnhandledIodineExceptionException (Top, ex);
} else {
IodineExceptionHandler handler = exceptionHandlers.Pop ();
ex.SetAttribute ("stackTrace", new IodineString (Trace ()));
Unwind (frameCount - handler.Frame);
lastException = ex;
Top.InstructionPointer = handler.InstructionPointer;
}
}
示例6: RaiseException
public void RaiseException (IodineObject ex)
{
if (traceCallback != null) {
traceCallback (TraceType.Exception, this, Top, currentLocation);
}
IodineExceptionHandler handler = PopCurrentExceptionHandler ();
if (handler == null) { // No exception handler
/*
* The program has gone haywire and we ARE going to crash, however
* we must attempt to properly dispose any objects created inside
* Iodine's with statement
*/
StackFrame top = Top;
while (top != null) {
while (top.DisposableObjects.Count > 0) {
IodineObject obj = top.DisposableObjects.Pop ();
try {
obj.Exit (this); // Call __exit__
} catch (UnhandledIodineExceptionException) {
// Ignore this, we will throw one when we're done anyway
}
}
top = top.Parent;
}
throw new UnhandledIodineExceptionException (Top, ex);
}
ex.SetAttribute ("stackTrace", new IodineString (GetStackTrace ()));
UnwindStack (frameCount - handler.Frame);
lastException = ex;
Top.InstructionPointer = handler.InstructionPointer;
}