1
0
Fork 0

Turns out some code likes to call isa() with non-objects. Might as

well have it return false (which is valid) instead of throwing an
exception (also valid, but more surprising).
This commit is contained in:
andy 2008-02-07 21:23:42 +00:00
parent bedac8ec83
commit 4ae206fc00

View file

@ -3,7 +3,7 @@
# (class) object. Example: isa(someObject, props.Node) # (class) object. Example: isa(someObject, props.Node)
# #
var isa = func(obj, class) { var isa = func(obj, class) {
if(contains(obj, "parents")) if(typeof(obj) == "hash" and obj["parents"] != nil)
foreach(c; obj.parents) foreach(c; obj.parents)
if(c == class or isa(c, class)) if(c == class or isa(c, class))
return 1; return 1;
@ -31,7 +31,7 @@ var fgcommand = func(cmd, node=nil) {
var cmdarg = func { props.wrapNode(_cmdarg()) } var cmdarg = func { props.wrapNode(_cmdarg()) }
## ##
# Utility. Does what it you think it does. # Utility. Does what you think it does.
# #
var abs = func(v) { return v < 0 ? -v : v } var abs = func(v) { return v < 0 ? -v : v }