Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add handling of Op.deprecated flag

  • Loading branch information...
commit 5e407c3bdfa6be9d69973b185fd73a0c1291ce68 1 parent a6158f7
Vasily Chekalkin bacek authored
3  compilers/opsc/src/Ops/File.pm
View
@@ -258,7 +258,8 @@ method compile_ops($str, :$experimental? = 0) {
my $past := $compiler.compile($str, :target('past'));
for @($past<ops>) {
- $_<experimental> := $experimental;
+ $_.experimental($experimental);
+ $_.deprecated($_.flags<deprecated> ?? 1 !! 0);
self<ops>.push($_);
#say($_.full_name ~ " is number " ~ self<op_order>);
self<op_order>++;
18 compilers/opsc/src/Ops/Op.pm
View
@@ -116,6 +116,14 @@ are appended to the name.
The same as C<full_name()>, but with 'C<Parrot_>' prefixed.
+=item C<experimental()>
+
+Set or get "experimental" flag for Op.
+
+=item C<deprecated()>
+
+Set or get "deprecated" flag for Op.
+
=end
method code($code?) { self.attr('code', $code, defined($code)) }
@@ -126,6 +134,10 @@ method name($name?) { self.attr('name', $name, defined($name)) }
method args($args?) { self.attr('args', $args, defined($args)) }
+method experimental($args?) { self.attr('experimental', $args, defined($args)) }
+
+method deprecated($args?) { self.attr('deprecated', $args, defined($args)) }
+
method need_write_barrier() {
my $need := 0;
# We need write barriers only for (in)out PMC|STR
@@ -173,7 +185,11 @@ flags (passed as ":flag") specified for the op.
=end
-method flags(%flags?) { self.attr('flags', %flags, defined(%flags)) }
+method flags(%flags?) {
+ %flags := self.attr('flags', %flags, defined(%flags));
+ self.deprecated(%flags<deprecated> ?? 1 !! 0);
+ %flags;
+}
=begin
7 t/compilers/opsc/04-op.t
View
@@ -5,14 +5,14 @@
pir::load_bytecode("opsc.pbc");
-plan(7);
+plan(9);
my $op := Ops::Op.new(
code => 42,
name => 'set',
type => 'inline',
args => <foo bar baz>,
- flags => hash(),
+ flags => hash( deprecated => 1, flow => 1 ),
arg_types => <i i ic>,
);
@@ -25,11 +25,14 @@ ok( +$op.arg_types == 3, "... with proper arg_types");
say('# ' ~ $op.arg_types);
ok( $op.full_name eq 'set_i_i_ic', "full_name is correct");
+ok( $op.deprecated, "Op is :deprecated");
$op := Ops::Op.new(
name => 'set',
type => 'inline',
);
ok( $op.full_name eq 'set', "Argless op's full_name is correct");
+ok( !$op.deprecated, "Op is not :deprecated");
+
# vim: expandtab shiftwidth=4 ft=perl6:
Please sign in to comment.
Something went wrong with that request. Please try again.