Skip to content

Commit

Permalink
Fix "Missing serialize REPR function for REPR NativeRef (StrLexRef)"
Browse files Browse the repository at this point in the history
ASN::META parses a definition with a grammar and creates classes and methods
from the parsed description. This leads to a StrLexRef getting used as a method
name which ends up in the serialization context. Decont the names of added
methods to ensure we have a plain old string.

Fixes GH #3045
  • Loading branch information
niner committed Jul 12, 2019
1 parent d4ceb97 commit 600ece3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Perl6/Metamodel/MethodContainer.nqp
Expand Up @@ -17,6 +17,7 @@ role Perl6::Metamodel::MethodContainer {
method add_method($obj, $name, $code_obj) {
# Ensure we haven't already got it.
$code_obj := nqp::decont($code_obj);
$name := nqp::decont_s($name);
if nqp::existskey(%!methods, $name) || nqp::existskey(%!submethods, $name) {
nqp::die("Package '"
~ self.name($obj)
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/Metamodel/PrivateMethodContainer.nqp
Expand Up @@ -5,6 +5,7 @@ role Perl6::Metamodel::PrivateMethodContainer {

# Adds a private method.
method add_private_method($obj, $name, $code) {
$name := nqp::decont_s($name);
if nqp::existskey(%!private_methods, $name) {
nqp::die("Private method '$name' already declared in package " ~
self.name($obj));
Expand Down

0 comments on commit 600ece3

Please sign in to comment.