Permalink
Browse files

[common] Add .defined methods to the various built-in types.

  • Loading branch information...
1 parent c8d35ab commit ac08da5dea8a914a300ece2ccc1551d991a9bb2d @jnthn committed Oct 29, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 common/NQP/NQPSetting.pm
View
29 common/NQP/NQPSetting.pm
@@ -21,6 +21,9 @@ knowhow NQPStr is repr('P6str') {
method Stringy() {
self
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPInt is repr('P6int') {
@@ -45,6 +48,9 @@ knowhow NQPInt is repr('P6int') {
method Stringy() {
nqp::coerce_int_to_str(self, NQPStr)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPNum is repr('P6num') {
@@ -69,6 +75,9 @@ knowhow NQPNum is repr('P6num') {
method Stringy() {
nqp::coerce_num_to_str(self, NQPStr)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPList is repr('P6list') {
@@ -84,6 +93,9 @@ knowhow NQPList is repr('P6list') {
method at_pos($idx) {
nqp::lllist_get_at_pos(self, $idx.Int)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPArray is repr('P6list') {
@@ -102,6 +114,9 @@ knowhow NQPArray is repr('P6list') {
method bind_pos($idx, $value) {
nqp::lllist_bind_at_pos(self, $idx.Int, $value)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPHash is repr('P6mapping') {
@@ -120,12 +135,18 @@ knowhow NQPHash is repr('P6mapping') {
method bind_key($key, $value) {
nqp::llmapping_bind_at_key(self, $key.Str, $value)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
knowhow NQPCode is repr('RakudoCodeRef') {
method leave($with) {
nqp::leave_block(self, $with)
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
}
## XXX Need coercive Any fallbacks too.
@@ -232,6 +253,10 @@ knowhow NQPException {
self;
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
+
method resumable() {
$!resumable
}
@@ -351,6 +376,10 @@ knowhow NQPClassHOW {
%!methods
}
+ method defined() {
+ nqp::repr_defined(self)
+ }
+
##
## Dispatchy
##

0 comments on commit ac08da5

Please sign in to comment.