Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add native context handlers for Mu.defined and Mu.Bool
  • Loading branch information
sorear committed Nov 21, 2010
1 parent fc0abe9 commit 21feb67
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Kernel.cs
Expand Up @@ -433,6 +433,18 @@ class CtxReturnSelf : ContextHandler<Variable> {
}
}

class CtxRawNativeDefined : ContextHandler<bool> {
public override bool Get(Variable obj) {
return obj.Fetch().IsDefined();
}
}

class CtxBoolNativeDefined : ContextHandler<Variable> {
public override Variable Get(Variable obj) {
return obj.Fetch().IsDefined() ? Kernel.TrueV : Kernel.FalseV;
}
}

// NOT IP6; these things should only be exposed through a ClassHOW-like
// façade
public class DynMetaObject {
Expand Down Expand Up @@ -1487,6 +1499,8 @@ class ExitRunloopException : Exception { }
NumMO.FillProtoClass(new string[] { "value" });

MuMO = new DynMetaObject("Mu");
MuMO.loc_Bool = MuMO.loc_defined = new CtxBoolNativeDefined();
MuMO.loc_raw_Bool = MuMO.loc_raw_defined = new CtxRawNativeDefined();
MuMO.FillProtoClass(new string[] { });

StashMO = new DynMetaObject("Stash");
Expand Down

0 comments on commit 21feb67

Please sign in to comment.