Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Last active Mar 1, 2019
Embed
What would you like to do?
diff --git a/src/core/Encoding/Builtin.pm6 b/src/core/Encoding/Builtin.pm6
index ac1597c1a..0d8f7b0d2 100644
--- a/src/core/Encoding/Builtin.pm6
+++ b/src/core/Encoding/Builtin.pm6
@@ -1,6 +1,7 @@
class Encoding::Builtin does Encoding {
has Str $.name;
has $!alternative-names;
+ has %!encoders;
method new() {
X::Cannot::New.new(class => self.WHAT).throw
@@ -24,9 +25,20 @@ class Encoding::Builtin does Encoding {
my int $is-win = Rakudo::Internals.IS-WIN;
method encoder(:$replacement, :$translate-nl, :$strict --> Encoding::Encoder) {
- my $encoder = $replacement.DEFINITE && $replacement !=== False
- ?? Encoding::Encoder::Builtin.new($!name, self!buf-type(), :$strict, :replacement(self!rep-char($replacement)))
- !! Encoding::Encoder::Builtin.new($!name, self!buf-type(), :$strict);
+ my $encoder;
+ if $replacement.DEFINITE && $replacement !=== False {
+ $encoder = Encoding::Encoder::Builtin.new($!name, self!buf-type(), :$strict, :replacement(self!rep-char($replacement)));
+ }
+ else {
+ my $buf-type = self!buf-type().^name;
+ if %!encoders{$!name}{$buf-type}{$strict}:exists {
+ $encoder = %!encoders{$!name}{$buf-type}{$strict};
+ }
+ else {
+ $encoder = Encoding::Encoder::Builtin.new($!name, self!buf-type(), :$strict);
+ %!encoders{$!name}{$buf-type}{$strict} = $encoder;
+ }
+ }
$translate-nl && $is-win
?? Encoding::Encoder::TranslateNewlineWrapper.new($encoder)
The following step can take a long time, please be patient.
/home/dan/Source/perl6/install/bin/moar --libpath="blib" --libpath="/home/dan/Source/perl6/install/share/nqp/lib" --libpath="/home/dan/Source/perl6/install/share/nqp/lib" perl6.moarvm --nqp-lib=blib --setting=NULL --ll-exception --optimize=3 --target=mbc --stagestats --output=CORE.setting.moarvm gen/moar/CORE.setting
Stage start : 0.000
Stage parse : 90.298
Stage syntaxcheck: 0.000
Stage ast : 0.000
Stage optimize : 10.648
Stage mast : 19.742
Stage mbc : 0.576
/home/dan/Source/perl6/install/bin/nqp-m tools/build/gen-cat.nqp moar -f tools/build/moar_core_d_sources > gen/moar/CORE.d.setting
The following step can take a long time, please be patient.
/home/dan/Source/perl6/install/bin/moar --libpath="blib" --libpath="/home/dan/Source/perl6/install/share/nqp/lib" --libpath="/home/dan/Source/perl6/install/share/nqp/lib" perl6.moarvm --nqp-lib=blib --setting=NULL.d --ll-exception --optimize=3 --target=mbc --stagestats --output=CORE.d.setting.moarvm gen/moar/CORE.d.setting
Stage start : 0.000
Stage parse : Earlier failures:
(HANDLED) Dynamic variable $*ERR not found
Final error:
Cannot resolve caller say(Failure:U: Str:D); none of these signatures match:
(Mu: *%_)
at SETTING::src/core/Exception.pm6:62 (CORE.setting.moarvm:throw)
from SETTING::src/core/Exception.pm6:2784 (CORE.setting.moarvm:)
from gen/moar/BOOTSTRAP.nqp:2929 (blib/Perl6/BOOTSTRAP.moarvm:)
from SETTING::src/core/Mu.pm6:572 (CORE.setting.moarvm:say)
from SETTING::src/core/Exception.pm6:433 (CORE.setting.moarvm:print_control)
from SETTING::src/core/Exception.pm6:492 (CORE.setting.moarvm:<anon>)
from gen/moar/stage2/NQPHLL.nqp:1831 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:)
from <unknown>:1 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:)
from SETTING::src/core/control.pm6:188 (CORE.setting.moarvm:warn)
from SETTING::src/core/control.pm6:186 (CORE.setting.moarvm:warn)
from SETTING::src/core/Mu.pm6:550 (CORE.setting.moarvm:Str)
from SETTING::src/core/Mu.pm6:546 (CORE.setting.moarvm:Str)
from SETTING::src/core/Hash.pm6:149 (CORE.setting.moarvm:BIND-KEY)
from SETTING::src/core/Hash.pm6:147 (CORE.setting.moarvm:BIND-KEY)
from gen/moar/BOOTSTRAP.nqp:1361 (blib/Perl6/BOOTSTRAP.moarvm:assigned)
from gen/moar/BOOTSTRAP.nqp:1617 (blib/Perl6/BOOTSTRAP.moarvm:)
from SETTING::src/core/Any.pm6:406 (CORE.setting.moarvm:ASSIGN-KEY)
from SETTING::src/core/Any.pm6:404 (CORE.setting.moarvm:ASSIGN-KEY)
from SETTING::src/core/hash_slice.pm6:10 (CORE.setting.moarvm:postcircumfix:<{ }>)
from SETTING::src/core/hash_slice.pm6:3 (CORE.setting.moarvm:postcircumfix:<{ }>)
from SETTING::src/core/Encoding/Builtin.pm6:39 (CORE.setting.moarvm:encoder)
from SETTING::src/core/io_operators.pm6:190 (CORE.setting.moarvm:activate-handle)
from SETTING::src/core/io_operators.pm6:197 (CORE.setting.moarvm:)
from SETTING::src/core/io_operators.pm6:1 (CORE.setting.moarvm:<unit>)
from gen/moar/CORE.setting:1 (CORE.setting.moarvm:<unit-outer>)
from <unknown>:1 (CORE.setting.moarvm:<load>)
from gen/moar/ModuleLoader.nqp:249 (blib/Perl6/ModuleLoader.moarvm:)
from gen/moar/ModuleLoader.nqp:245 (blib/Perl6/ModuleLoader.moarvm:load_setting)
from src/Perl6/World.nqp:843 (blib/Perl6/World.moarvm:load_setting)
from src/Perl6/World.nqp:603 (blib/Perl6/World.moarvm:loading_and_symbol_setup)
from gen/moar/Perl6-Grammar.nqp:825 (blib/Perl6/Grammar.moarvm:comp_unit)
from gen/moar/Perl6-Grammar.nqp:555 (blib/Perl6/Grammar.moarvm:TOP)
from gen/moar/stage2/QRegex.nqp:2307 (/home/dan/Source/perl6/install/share/nqp/lib/QRegex.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:2030 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:1950 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:execute_stage)
from gen/moar/stage2/NQPHLL.nqp:1983 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:run)
from gen/moar/stage2/NQPHLL.nqp:1975 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:1970 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:compile)
from gen/moar/stage2/NQPHLL.nqp:1666 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1888 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1848 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:38 (blib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1773 (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:48 (perl6.moarvm:MAIN)
from gen/moar/main.nqp:1 (perl6.moarvm:<mainline>)
from <unknown>:1 (perl6.moarvm:<main>)
from <unknown>:1 (perl6.moarvm:<entry>)
make: *** [Makefile:518: CORE.d.setting.moarvm] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment