-
-
Save zoffixznet/99f6c630bdfb95903575dc12882d78c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2017.08 zoffix@VirtualBox~/CPANPRC/other-rakudo (master)$ gd | |
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index b58b684..43c4579 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -61,7 +61,6 @@ role STD { | |
token starter { <!> } | |
token stopper { <!> } | |
- my %quote_lang_cache := nqp::hash(); | |
method quote_lang($l, $start, $stop, @base_tweaks?, @extra_tweaks?) { | |
sub lang_key() { | |
my $stopstr := nqp::istype($stop,VMArray) ?? nqp::join(' ',$stop) !! $stop; | |
@@ -107,9 +106,10 @@ role STD { | |
# Get language from cache or derive it. | |
my $key := lang_key(); | |
- my $quote_lang := nqp::existskey(%quote_lang_cache, $key) && $key ne 'NOCACHE' | |
- ?? %quote_lang_cache{$key} | |
- !! (%quote_lang_cache{$key} := con_lang()); | |
+ my $quote_lang := nqp::isnull(my $cached := self.quote_lang_cache: $key) | |
+ && $key ne 'NOCACHE' | |
+ ?? $cached | |
+ !! self.quote_lang_cache: $key, con_lang(); | |
$quote_lang.set_package(self.package); | |
$quote_lang; | |
} | |
@@ -513,6 +513,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | |
$cursor; | |
} | |
+ my %quote_lang_cache := nqp::hash(); | |
+ method quote_lang_cache($k, $v = nqp::null()) { | |
+ %quote_lang_cache{$k} := $v unless nqp::isnull($v); | |
+ %quote_lang_cache{$k}; | |
+ } | |
+ | |
## Lexer stuff | |
token apostrophe { | |
2017.08 zoffix@VirtualBox~/CPANPRC/other-rakudo (master)$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment