Skip to content
Permalink
Browse files

+ Sexp#line now raises if setting w/ non-integer (eg nil).

[git-p4: depot-paths = "//src/sexp_processor/dev/": change = 11967]
  • Loading branch information...
zenspider committed Apr 16, 2019
1 parent 882ed3a commit ce284487f057203360c41b14d2b25f8c5453fbb9
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/sexp.rb
@@ -202,13 +202,16 @@ def find_nodes name
each_sexp.find_all { |sexp| sexp.sexp_type == name }
end

UNASSIGNED = Object.new

##
# If passed a line number, sets the line and returns self. Otherwise
# returns the line number. This allows you to do message cascades
# and still get the sexp back.

def line n = nil
if n then
def line n = UNASSIGNED
if n != UNASSIGNED then
raise ArgumentError, "setting %p.line %p" % [self, n] unless Integer === n
@line = n
self
else

0 comments on commit ce28448

Please sign in to comment.
You can’t perform that action at this time.