Skip to content

Commit

Permalink
More WIP on compound assignments.
Browse files Browse the repository at this point in the history
  • Loading branch information
burrows committed Dec 20, 2010
1 parent 36a8721 commit 7585873
Show file tree
Hide file tree
Showing 8 changed files with 1,529 additions and 91 deletions.
60 changes: 60 additions & 0 deletions specs/fixtures/variables.bully
@@ -0,0 +1,60 @@
module VariablesSpecs
class ParAsgn
attr_accessor :x

def initialize
@x = 0
end

def inc
@x += 1
end

def to_ary
[1,2,3,4]
end
end

class OpAsgn
attr_accessor :a, :b, :side_effect

def do_side_effect
self.side_effect = true
return @a
end

def do_more_side_effects
@a += 5
self
end

def do_bool_side_effects
@b += 1
self
end
end

class Hashalike
def [](k) k end
def []=(k, v) [k, v] end
end

def self.reverse_foo(a, b)
# FIXME:
# return b, a
return [b, a]
end

class ArrayLike
def initialize(array)
@array = array
end

def to_a
@array
end
end

class ArraySubclass < Array
end
end

0 comments on commit 7585873

Please sign in to comment.