Skip to content

Commit

Permalink
Remove Version.new-from-git-describe
Browse files Browse the repository at this point in the history
- This should've been a Rakudo::Internal method instead
- This is no longer needed, as Version.new was made to work
    without using regexes
  • Loading branch information
zoffixznet committed Feb 6, 2018
1 parent 02d2e2c commit ae7d89d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion src/core/Compiler.pm
Expand Up @@ -19,7 +19,7 @@ class Compiler does Systemic {
$!id = nqp::p6box_s(nqp::ifnull(nqp::atkey($compiler,'id'),$id));
# looks like: 2018.01-50-g8afd791c1
$!version = $version
// Version.new-from-git-describe(nqp::atkey($compiler, 'version'));
// Version.new(nqp::atkey($compiler, 'version'));
$!release =
$release // nqp::p6box_s(nqp::atkey($compiler, 'release-number'));
$!build-date =
Expand Down
24 changes: 0 additions & 24 deletions src/core/Version.pm
Expand Up @@ -96,30 +96,6 @@ class Version {
($vplus //= nqp::create(Version)!SET-SELF(nqp::list,1,"")),
self.new))))
}
# for use by the setting where we may not use regexes to parse
method new-from-git-describe(Version: str $v) {
my $strings := nqp::split('.', $v);
my \minor = nqp::pop($strings);
my \extra = nqp::split('-', minor);
nqp::push($strings, nqp::shift(extra)) while nqp::elems(extra);
my int $elems = nqp::elems($strings);
my $parts := nqp::setelems(nqp::list, $elems);

my int $i = -1;
while nqp::islt_i(++$i, $elems) {
my $s = nqp::atpos($strings, $i);
if nqp::iseq_s($s, '0') {
nqp::bindpos($parts, $i, 0);
}
else {
nqp::bindpos($parts, $i, $s);
my $num := nqp::radix(10, $s, 0, 0);
nqp::bindpos($parts, $i, nqp::atpos($num, 0) ?? nqp::atpos($num, 0) !! $s);
}
}
my str $string = nqp::join(".", $strings);
nqp::create(self)!SET-SELF($parts, 0, $string);
}

multi method Str(Version:D:) { $!string }
multi method gist(Version:D:) { nqp::concat("v",$!string) }
Expand Down

0 comments on commit ae7d89d

Please sign in to comment.