Method.st
changeset 463 447ead9f870c
parent 444 071b4f32272c
child 486 1e19564b2b5e
--- a/Method.st	Tue Oct 31 14:18:25 1995 +0100
+++ b/Method.st	Tue Oct 31 15:36:06 1995 +0100
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Method.st,v 1.51 1995-10-24 15:59:25 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Method.st,v 1.52 1995-10-31 14:36:06 cg Exp $
 '!
 
 !Method class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Method.st,v 1.51 1995-10-24 15:59:25 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Method.st,v 1.52 1995-10-31 14:36:06 cg Exp $
 "
 !
 
@@ -844,46 +844,64 @@
     "return a collection with the methods argument names.
      Uses Parser to parse methods source and extract the names."
 
-    ^ self parse:#parseMethodSpecification: return:#methodArgs or:nil
+    ^ self parse:#'parseMethodSpecificationSilent:' return:#methodArgs or:nil
 
     "
      (Method compiledMethodAt:#printOn:) methodArgNames
     "
+
+    "Modified: 31.10.1995 / 14:36:46 / cg"
 !
 
 methodVarNames
     "return a collection with the methods local-variable names.
      Uses Parser to parse methods source and extract the names."
 
-    ^ self parse:#parseMethodArgAndVarSpecification: return:#methodVars or:nil
+    ^ self parse:#'parseMethodArgAndVarSpecificationSilent:' return:#methodVars or:nil
 
     "
      (Method compiledMethodAt:#printOn:) methodVarNames
     "
+
+    "Modified: 31.10.1995 / 14:36:49 / cg"
 !
 
 hasPrimitiveCode
     "return true, if the method contains primitive code; false if not.
      Uses Parser to parse methods source and get the information."
 
-    ^ self parse:#parseMethod: return:#hasPrimitiveCode or:false
+    |src|
+
+    src := self source.
+    src notNil ifTrue:[
+	(src includesString:'%{' ) ifFalse:[
+	    "/ cannot contain primitive code.
+	    ^ false
+	]
+    ].
+    ^ self parse:#'parseMethodSilent:' return:#hasPrimitiveCode or:false
 
     "
      (Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode 
      (Object compiledMethodAt:#at:) hasPrimitiveCode   
      (Object compiledMethodAt:#basicAt:) hasPrimitiveCode 
     "
+
+    "Modified: 31.10.1995 / 14:43:37 / cg"
 !
 
 methodArgAndVarNames
     "return a collection with the methods argument and variable names.
-     Uses Parser to parse methods source and extract the names."
+     Uses Parser to parse methods source and extract the names.
+     Returns nil if the source is not available, or some other
+     syntax/parse error occurred. For methods with no args and no vars,
+     an empty collection is returned."
 
     |parser sourceString argNames varNames|
 
     sourceString := self source.
     sourceString notNil ifTrue:[
-	parser := Parser parseMethodArgAndVarSpecification:sourceString.
+	parser := Parser parseMethodArgAndVarSpecificationSilent:sourceString.
 	(parser isNil or:[parser == #Error]) ifTrue:[^ nil].
 	argNames := parser methodArgs.
 	varNames := parser methodVars.