Permalink
Browse files

[llvm] Rework generation of "enum classes".

$foo++ doesn't increase number somehow. Use explicit +1.
  • Loading branch information...
1 parent eb21088 commit cbb77c3f9faccc6bfd2d5b28129c24860334b120 @bacek bacek committed with Reini Urban Mar 30, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 runtime/parrot/library/LLVM.pm
@@ -45,13 +45,13 @@ module LLVM {
#### Bind enums
# For enums we generate new class and bunch of methods.
- sub generate_enum_class($name, $from, @values, &inc?) {
+ sub generate_enum_class($name, $from, @values, &inc? = -> $_ { $_ := $_ + 1 }) {
my $enum := P6metaclass.new_class($name);
my $how := $enum.HOW;
for @values {
my $c := +$from; # Force clone of $count.
$how.add_method( $_, method () { $c }, to => $enum);
- $from := &inc ?? &inc($from) !! $from++;
+ $from := &inc($from);
}
};

0 comments on commit cbb77c3

Please sign in to comment.