Skip to content

Commit

Permalink
report problematic code when buildin is called in wrong way (gh#yast/…
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jul 23, 2013
1 parent ab810eb commit 2507599
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ruby/yast/builtins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ def self.tostring val, width=nil
val.signature.match /(.*)\((.*)\)/
"<YCPRef:#{$1}#{val.remote_method.name} (#{$2})>"
else
y2warning "tostring builtin called on wrong type #{val.class}"
y2warning 1, "tostring builtin called on wrong type #{val.class}"
return val.inspect
end
end
Expand Down
14 changes: 7 additions & 7 deletions src/ruby/yast/ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ def self.get (object, indexes, default=nil)
if (0..res.size-1).include? i
res = res[i]
else
Yast.y2milestone "Index #{i} is out of array size"
Yast.y2milestone 1, "Index #{i} is out of array size"
return block_given? ? yield : default
end
else
Yast.y2warning "Passed #{i.inspect} as index key for array."
Yast.y2warning 1, "Passed #{i.inspect} as index key for array."
return block_given? ? yield : default
end
when ::Hash
Expand All @@ -81,7 +81,7 @@ def self.get (object, indexes, default=nil)
Yast.y2milestone 1, "Builtin index called on nil."
return block_given? ? yield : default
else
Yast.y2warning "Builtin index called on wrong type #{res.class} from #{caller.inspect}"
Yast.y2warning 1, "Builtin index called on wrong type #{res.class}"
return block_given? ? yield : default
end
end
Expand All @@ -102,11 +102,11 @@ def self.set (object, indexes, value)
if (0..res.size-1).include? i
res = res[i]
else
Yast.y2warning "Index #{i} is out of array size"
Yast.y2warning 1, "Index #{i} is out of array size"
return
end
else
Yast.y2warning "Passed #{i.inspect} as index key for array."
Yast.y2warning 1, "Passed #{i.inspect} as index key for array."
return
end
when ::Hash
Expand All @@ -116,15 +116,15 @@ def self.set (object, indexes, value)
return
end
else
Yast.y2warning "Builtin assign called on wrong type #{res.class}"
Yast.y2warning 1, "Builtin assign called on wrong type #{res.class}"
return
end
end
case res
when ::Array, Yast::Term, ::Hash
res[last] = Yast.deep_copy(value)
else
Yast.y2warning "Builtin assign called on wrong type #{res.class}"
Yast.y2warning 1, "Builtin assign called on wrong type #{res.class}"
end
end

Expand Down

0 comments on commit 2507599

Please sign in to comment.