Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some tweaks to subsets, making sure they get their own metaclass and …
…proto-object and respond as desired to .defined (with false). Other than that no intentional functional changes - the spectests don't point to any, at least.
  • Loading branch information
jnthn committed Feb 25, 2009
1 parent f43750a commit 7abe283
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/builtins/guts.pir
Expand Up @@ -192,24 +192,25 @@ to find a real, non-subtype and stash that away for fast access later.
real_type = refinee
got_real_type:

# Create subclass, register it with the real type's proto.
# Create subclass.
.local pmc parrot_class, subset
parrot_class = p6meta.'get_parrotclass'(refinee)
subset = subclass parrot_class
p6meta.'register'(subset, 'protoobject' => real_type)

# Override accepts.
.local pmc parrotclass
.const 'Sub' $P0 = "!SUBTYPE_ACCEPTS"
subset.'add_method'('ACCEPTS', $P0)
.const 'Sub' $P1 = "!SUBTYPE_PROTOOVERRIDES"
subset.'add_method'('PROTOOVERRIDES', $P1)

# It's an abstraction.
$P0 = get_hll_global 'Abstraction'
$P0 = $P0.'!select'()
subset.'add_role'($P0)

# Instantiate it - we'll only ever create this one instance.
subset = subset.'new'()
# Register it, creating a proto-object.
subset = p6meta.'register'(subset)

# Mark it a subtype and stash away real type, refinee and refinement.
setprop subset, 'subtype_realtype', real_type
Expand Down Expand Up @@ -240,6 +241,9 @@ to find a real, non-subtype and stash that away for fast access later.
$P0 = get_hll_global ['Bool'], 'False'
.return ($P0)
.end
.sub '!SUBTYPE_PROTOOVERRIDES' :anon :method
.return ('new', 'ACCEPTS')
.end


=item !TOPERL6MULTISUB
Expand Down

0 comments on commit 7abe283

Please sign in to comment.