while typing in the evening the compiler greeted me with the following message (no it was actually crash reporter):
Here comes the offending code (I have marked the misbehaving statement).
- Code: Select all
Declare Class "NSPredicate"
Declare Function "NSPredicate" - (NSString *)predicateFormat
Declare Function "NSPredicate" - (BOOL)evaluateWithObject:(id)object
Declare Function "NSPredicate" + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat
Declare Function "NSPredicate" + (NSPredicate *)predicateWithValue:(BOOL)value
Declare Function "NSMutableArray" - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate
Dim tick As String(Character(39))
Dim myPred As NSPredicate = Nil
Dim predStr As String
Function filterArray(theArray As Array, Filter As String) As Array
predStr = Concat("SELF LIKE ", tick, Filter, tick)
myPred = NSPredicate.predicateWithFormat( predStr)
Return(theArray.filteredArrayUsingPredicate(myPred))
End Function
Event AwakeFromNib()
Dim myArray As NSMutableArray
Dim resultArray As NSMutableArray
myArray = Array("fest.o","zz.mm","heike.o","udo.mm")
Alert(filterArray(myArray,"*.o"))
Alert(filterArray(myArray),"*.mm") ' this crashes the compiler
End Event
By just omitting an argument to a function the compiler gets in an unstable state. I didn't strip the example down, but hope you can spot the glitch.
I had to sleep over this in order to understand the root cause. It occurred before but I couldn't pin the problem.
Regards
Udo