Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make subset behave depending on what language revision created it
For the purpose of supporting language version dependent functionality a new metamodel role is being introduced: `Perl6::Metamodel::LanguageRevision`. It is in turn consumes `Perl6::Metamodel::Versioning`. SubsetHOW records the compiler version which created a subset type object and then later checks against the version in order to determine if old or new behaviour is expected.
- Loading branch information
Showing
5 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This role is for metaclasses with languare-revision dependent behavior. | ||
role Perl6::Metamodel::LanguageRevision | ||
does Perl6::Metamodel::Versioning | ||
{ | ||
has $!lang_rev; | ||
|
||
# The only allowed version format is 6.X | ||
method set_language_version($obj, $ver) { | ||
(nqp::iseq_i(nqp::chars($ver), 3) && nqp::eqat($ver, '6.', 0)) | ||
|| nqp::die("Language version must be a string in '6.<rev>' format, got `$ver`."); | ||
self.set_ver($obj, $ver); | ||
$!lang_rev := nqp::substr($ver, 2, 1); | ||
} | ||
|
||
method lang-rev-before($rev) { | ||
nqp::iseq_i(nqp::chars($rev), 1) | ||
|| nqp::die("Language revision must be a single letter, got `$rev`."); | ||
nqp::iseq_i(nqp::cmp_s($!lang_rev, $rev), -1) | ||
} | ||
} |
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
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
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