Skip to content

Commit

Permalink
create TclString type with 'class' instead of PIR
Browse files Browse the repository at this point in the history
also, minor whitespace fixup.
  • Loading branch information
coke committed Apr 5, 2010
1 parent 46dc23b commit 6731036
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/TclString.pm
@@ -1,20 +1,20 @@
INIT {
pir::subclass__ps(pir::get_class__ps('String'), 'TclString');

my $tcl := pir::get_class__ps('TclString');
my $core := pir::get_class__ps('String');
pir::getinterp__p().hll_map($core, $tcl);

$tcl.add_vtable_override('get_bool', TclString::getBoolean);
$tcl.add_vtable_override('get_integer', TclString::getInteger);
}

module TclString {
method __dump($dumper, $label) {
pir::print('"');
$dumper.dumpStringEscaped( self, '"' );
pir::print('"');
}
class TclString is String {

INIT {
my $tcl_type := P6metaclass().get_parrotclass('TclString');
my $core_type := P6metaclass().get_parrotclass('String', :hll<parrot>);

pir::getinterp__p().hll_map($core_type, $tcl_type);

$tcl_type.add_vtable_override('get_bool', TclString::getBoolean);
$tcl_type.add_vtable_override('get_integer', TclString::getInteger);
}

method __dump($dumper, $label) {
pir::print('"');
$dumper.dumpStringEscaped( self, '"' );
pir::print('"');
}

method getInteger() { ## :is vtable
my $parse := Partcl::Grammar.parse(
Expand Down

0 comments on commit 6731036

Please sign in to comment.