Skip to content

Commit ac7a409

Browse files
authored
Merge pull request #3140 from emlyn/funcnames
Refuse to define functions starting with a capital letter.
2 parents 6a7f2ee + 70eb68b commit ac7a409

File tree

1 file changed

+2
-0
lines changed
  • app/server/ruby/lib/sonicpi/lang

1 file changed

+2
-0
lines changed

app/server/ruby/lib/sonicpi/lang/core.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,8 @@ def define(name, &block)
27512751
raise ArgumentError, "A function called #{name} is already part of Sonic Pi's core API. Please choose another name."
27522752
end
27532753

2754+
raise ArgumentError, "Function names can't start with a capital letter." if name.to_s =~ /^[A-Z]/
2755+
27542756
if already_defined
27552757
__info "Redefining fn #{name.inspect}"
27562758
else

0 commit comments

Comments
 (0)