CompiledCode.st
changeset 14255 a5b9d39ad244
parent 14153 6f22f72de84d
child 14423 10c643ab2647
--- a/CompiledCode.st	Thu Jul 26 16:04:41 2012 +0200
+++ b/CompiledCode.st	Thu Jul 26 16:05:24 2012 +0200
@@ -1818,10 +1818,10 @@
      receiver refers to aLiteral (i.e. a deep search)"
 
     self literalsDo: [ :el |
-	el == aLiteral ifTrue:[^true].
-	el class == Array ifTrue:[
-	    (el refersToLiteral: aLiteral) ifTrue: [^true]
-	]
+        el == aLiteral ifTrue:[^true].
+        el class == Array ifTrue:[
+            (el refersToLiteral: aLiteral) ifTrue: [^true]
+        ]
     ].
     ^ false
 
@@ -1830,18 +1830,40 @@
      (CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#class
     "
 
-    "Modified: / 3.3.1998 / 00:02:28 / stefan"
-    "Modified: / 18.8.2000 / 21:17:47 / cg"
+    "Modified: / 03-03-1998 / 00:02:28 / stefan"
+    "Modified: / 26-07-2012 / 15:44:33 / cg"
+!
+
+refersToLiteralMatching:aMatchPattern
+    "return true if the receiver or recursively any array element in the
+     receiver is symbolic and matches aMatchPattern (i.e. a deep search)"
+
+    self literalsDo: [ :el |
+        (el isSymbol and:[ aMatchPattern match: el]) ifTrue:[^true].
+        el class == Array ifTrue:[
+            (el refersToLiteralMatching: aMatchPattern) ifTrue: [^true]
+        ]
+    ].
+    ^ false
+
+    "
+     (CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'is*'
+     (CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'foo*'
+    "
+
+    "Modified: / 03-03-1998 / 00:02:28 / stefan"
+    "Modified: / 18-08-2000 / 21:17:47 / cg"
+    "Created: / 26-07-2012 / 15:37:23 / cg"
 ! !
 
 !CompiledCode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.115 2012-06-01 21:36:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.116 2012-07-26 14:05:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.115 2012-06-01 21:36:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.116 2012-07-26 14:05:24 cg Exp $'
 !
 
 version_SVN