Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A bunch of changes required to make us run under latest Parrot, mostl…
…y because we relied wrongly on :method's old semantics of putting things into the namespace, and the 4-argument substr op has gone.
  • Loading branch information
jnthn committed Apr 29, 2010
1 parent aba83ab commit cdd3430
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Perl6/Grammar.pm
Expand Up @@ -1425,7 +1425,7 @@ sub bracket_ending($matches) {
method EXPR($preclim = '') {
# Override this so we can set $*LEFTSIGIL.
my $*LEFTSIGIL := '';
HLL::Grammar::EXPR(self, $preclim);
pir::find_method__pps(HLL::Grammar, 'EXPR')(self, $preclim);
}

token prefixish {
Expand Down
23 changes: 12 additions & 11 deletions src/builtins/Callable.pir
Expand Up @@ -26,13 +26,13 @@ This implements the parametric role Callable[::T = Mu].

# This defines the body of the role, which is run per type the role is
# parameterized with.
.sub '_callable_role_body'
.sub '' :subid('_callable_role_body')
.param pmc type :optional

$P0 = get_hll_global ['Callable[::T]'], 'of'
capture_lex $P0
$P0 = get_hll_global ['Callable[::T]'], 'returns'
.const 'Sub' $P0 = 'callable_role_returns'
capture_lex $P0
.const 'Sub' $P1 = 'callable_role_of'
capture_lex $P1

# Capture type.
if null type goto no_type
Expand All @@ -44,13 +44,12 @@ This implements the parametric role Callable[::T = Mu].
.lex 'T', type

# Create role.
.const 'Sub' $P0 = 'callable_of'
capture_lex $P0
.tailcall '!create_parametric_role'("Callable[::T]")
.end
.sub '' :load :init
.local pmc block, signature
block = get_hll_global ['Callable[::T]'], '_callable_role_body'
.const 'Sub' $P0 = '_callable_role_body'
block = $P0
signature = allocate_signature 1
setprop block, "$!signature", signature
null $P1
Expand All @@ -64,13 +63,14 @@ Returns the type constraining what may be returned.

=cut

.sub 'returns' :method :outer('_callable_role_body')
.sub 'returns' :method :outer('_callable_role_body') :subid('callable_role_returns')
$P0 = find_lex 'T'
.return ($P0)
.end
.sub '' :load :init
.local pmc block, signature
block = get_hll_global ['Callable[::T]'], 'returns'
.const 'Sub' $P0 = 'callable_role_returns'
block = $P0
signature = allocate_signature 0
setprop block, "$!signature", signature
.end
Expand All @@ -82,13 +82,14 @@ Returns the type constraining what may be returned.

=cut

.sub 'of' :method :outer('_callable_role_body') :subid('callable_of')
.sub 'of' :method :outer('_callable_role_body') :subid('callable_role_of')
$P0 = find_lex 'T'
.return ($P0)
.end
.sub '' :load :init
.local pmc block, signature
block = get_hll_global ['Callable[::T]'], 'of'
.const 'Sub' $P0 = 'callable_role_of'
block = $P0
signature = allocate_signature 0
setprop block, "$!signature", signature
.end
Expand Down
17 changes: 14 additions & 3 deletions src/builtins/Str.pir
Expand Up @@ -155,7 +155,11 @@ Increment and Decrement Methods
dec_2:
dec ipos
repl = substr RANGES, ipos, 1
substr str, r1, 1, repl
$S0 = substr str, 0, r1
$I0 = r1 + 1
$S1 = substr str, $I0
str = concat $S0, repl
str = concat str, $S1
# if the replacement wasn't a carry, we're done
if orig > repl goto done
carry:
Expand Down Expand Up @@ -186,7 +190,11 @@ Increment and Decrement Methods
inc ipos
.local string repl
repl = substr RANGES, ipos, 1
substr str, r1, 1, repl
$S0 = substr str, 0, r1
$I0 = r1 + 1
$S1 = substr str, $I0
str = concat $S0, repl
str = concat str, $S1
# if the replacement wasn't a carry, we're done
if orig < repl goto done
carry:
Expand All @@ -198,7 +206,10 @@ Increment and Decrement Methods
unless repl == '0' goto extend_1
repl = '1'
extend_1:
substr str, r0, 0, repl
$S0 = substr str, 0, r0
$S1 = substr str, r0
str = concat $S0, repl
str = concat str, $S1

done:
.return (str)
Expand Down
2 changes: 1 addition & 1 deletion src/cheats/parrot/P6role.pir
Expand Up @@ -145,7 +145,7 @@ Puns the role to a class and returns that class.

=cut

.sub 'HOW' :method
.sub 'HOW' :method :nsentry
self = descalarref self
$P0 = getprop 'metaclass', self
.return ($P0)
Expand Down
5 changes: 3 additions & 2 deletions src/glue/contextuals.pir
Expand Up @@ -8,8 +8,9 @@

# next, strip twigil and search PROCESS package
.local string pkgname
pkgname = clone name
substr pkgname, 1, 1, ''
$S0 = substr name, 0, 1
$S1 = substr name, 2
pkgname = concat $S0, $S1
$P0 = get_hll_global ['PROCESS'], pkgname
unless null $P0 goto done
$P0 = get_global pkgname
Expand Down
3 changes: 2 additions & 1 deletion src/metamodel/GrammarHOW.pir
Expand Up @@ -40,7 +40,8 @@ delegates to ClassHOW.
$P0 = get_hll_global 'Grammar'
self.'add_parent'(obj, $P0)
have_parents:
$P0 = get_hll_global ['ClassHOW'], 'compose'
$P0 = get_hll_global 'ClassHOW'
$P0 = find_method $P0, 'compose'
.tailcall $P0(self, obj)
.end

Expand Down

0 comments on commit cdd3430

Please sign in to comment.