Skip to content

Commit 01d41ce

Browse files
committed
[js] Make nqp::flip NFG aware
1 parent aa093e8 commit 01d41ce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/vm/js/Operations.nqp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ class QAST::OperationsJS {
452452
add_simple_op('tc', $T_STR, [$T_STR]);
453453
add_simple_op('tclc', $T_STR, [$T_STR]);
454454

455-
add_simple_op('flip', $T_STR, [$T_STR], sub ($string) {"$string.split('').reverse().join('')"});
455+
add_simple_op('flip', $T_STR, [$T_STR]);
456456

457457
#TODO: make the offset be something better then a UTF16 offset
458458
add_simple_op('ord', $T_INT, [$T_STR, $T_INT], sub ($string, $pos='0') {"$string.codePointAt($pos)"});

src/vm/js/nqp-runtime/core.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,3 +1629,7 @@ op.getrusage = function() {
16291629
usage.nivcsw
16301630
]);
16311631
};
1632+
1633+
op.flip = function(str) {
1634+
return graphemeBreaker.break(str).reverse().join('');
1635+
};

0 commit comments

Comments
 (0)