Skip to content

Commit

Permalink
[js] Merge role into class
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Jul 12, 2017
1 parent 976b3cd commit fe78578
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/vm/js/Chunk.nqp
Expand Up @@ -10,15 +10,7 @@ my $T_NONVAL := -2; # something that is not a nqp value
my $T_ARGS := -3; # comma separated arguments to a js call
my $T_ARGS_ARRAY := -4; # an array of arguments to a js call

role Joinable {
method join() {
my @strs := nqp::list_s();
self.collect(@strs);
nqp::join('', @strs);
}
}

class Chunk does Joinable {
class Chunk {
has int $!type; # the js type of $!expr
has str $!expr; # a javascript expression without side effects
has $!node; # a QAST::Node that contains info for source maps
Expand Down Expand Up @@ -58,6 +50,12 @@ class Chunk does Joinable {
}
}
}

method join() {
my @strs := nqp::list_s();
self.collect(@strs);
nqp::join('', @strs);
}

method with_source_map_info($hll-compiler) {
my @parts;
Expand Down

0 comments on commit fe78578

Please sign in to comment.