Преглед изворни кода

* fixed checking whether first character of a selector is valid (patch by
Dmitry Boyarintsev, mantis #14680)

git-svn-id: branches/objc@13768 -

Jonas Maebe пре 16 година
родитељ
комит
3f0eee741a
3 измењених фајлова са 20 додато и 2 уклоњено
  1. 1 0
      .gitattributes
  2. 1 2
      compiler/objcutil.pas
  3. 18 0
      tests/test/tobjc23.pp

+ 1 - 0
.gitattributes

@@ -8613,6 +8613,7 @@ tests/test/tobjc2.pp svneol=native#text/plain
 tests/test/tobjc20.pp svneol=native#text/plain
 tests/test/tobjc21.pp svneol=native#text/plain
 tests/test/tobjc22.pp svneol=native#text/plain
+tests/test/tobjc23.pp svneol=native#text/plain
 tests/test/tobjc3.pp svneol=native#text/plain
 tests/test/tobjc4.pp svneol=native#text/plain
 tests/test/tobjc4a.pp svneol=native#text/plain

+ 1 - 2
compiler/objcutil.pas

@@ -94,9 +94,8 @@ begin
   else
     begin
       { no special characters other than ':'
-        (already checked character 0, so start checking from 1)
       }
-      for i:=1 to len-1 do
+      for i:=0 to len-1 do
         if (value_str[i] = ':') then
           gotcolon:=true
         else if not(value_str[i] in ['_','A'..'Z','a'..'z','0'..'9',':']) then

+ 18 - 0
tests/test/tobjc23.pp

@@ -0,0 +1,18 @@
+{ %fail }
+{ %target=darwin }
+{ %cpu=powerpc,powerpc64,i386,x86_64,arm }
+
+{$modeswitch objectivec1}
+
+type
+  ta = objcclass
+    { should give an error because the selector name is invalid }
+    procedure test(l:longint); message '?test:';
+  end;
+
+procedure ta.test(l:longint);
+begin
+end;
+
+begin
+end.