Commit Graph
73 Commits
Author SHA1 Message Date
Martin CarlbergandGitHub 86d595b086 Fixed: Make the isa property on classes not enumerable. (#3100)
As we have a tool-free bridges between many classes and JavaScript types by setting the isa property on the type, for example CPArray and Array. Using the for...in enumeration the isa property will be included in the loop if the property is enumerable (this is the default behavior). This commit set the property as not enumerable.

Also added test case for check that the isa property on classes are not enumerable using a for...in loop.
2025-05-14 10:09:01 +02:00
Martin CarlbergandGitHub 7dc77ed609 Fixed: Make sure we handle undefined when testing for nil values (#2862) 2020-01-31 13:43:58 +01:00
cacaodev 1b72646772 Style: remove tabs 2016-01-17 20:54:20 +01:00
cacaodev 8c67eee4c8 (CPArray)arrayByApplyingBlock: documentation 2016-01-16 18:28:04 +01:00
cacaodev 08aa591c65 NEW CPArray -arrayByApplyingBlock:(Function/*element, index*/)aBlock
Test for CPArray -arrayByApplyingBlock:
2016-01-14 21:57:57 +01:00
Martin Carlberg 8599ad4a3c Fixed: The init method ’initWithObjects:count:’ for CPArray did not work on native CPJavaScriptArray when ’count’ is not the same as the length on the provided array.
A test case for this is also added in the test class CPArrayTest
2015-09-25 17:07:15 +02:00
Alexandre Wilhelm 3be3a1f2e6 Merge pull request #2329 from daboe01/fix-issue-10
Added documentation for CPArray's hash method
2015-05-01 14:05:19 -07:00
Alexandre Wilhelm 34f724a4a4 Fixed: capp_lint fixes 2015-04-22 11:22:44 -07:00
daboe01 845a35a9b8 rewording 2015-03-08 20:49:01 +01:00
daboe01 399b3fd198 documentation for the hash method 2015-03-08 19:03:35 +01:00
Martin Carlberg 0efb7e67c9 Fixed: Use new fast msgSend function for some foundation classes 2014-04-10 11:03:49 +02:00
Martin Carlberg bb58a206a8 Fixed: Removed all warnings of conflicting return and parameter types caused by the new compiler 2013-08-12 16:46:14 +02:00
Alexander Ljungberg 315e3fccf3 Formatting.
Refs #1959.
2013-07-15 10:36:48 +01:00
Martin Carlberg f52f11899a New: Sort using descriptors handles nil and CPNull in correct way
This is the same way as Cocoa works.
Also added test case.
2013-07-09 13:38:13 +02:00
Alexander Ljungberg e59389b0dd Fixed: crash in - CPArray/CPDictionary description containing self referential JS object.
Without this fix, certain JS contents could cause `- CPDictionary description` and `- CPArray description` to crash.

This change limits how deeply the description code will recurse before returning a default "…" description.
2013-06-13 20:14:22 +01:00
Aparajita Fishman 391ff7279d Fixed: capp_lint errors. 2013-05-16 15:02:45 -04:00
Alexander Ljungberg c550cd7afb New: optimise CPArray enumerateObjectsWithOptions:usingBlock:. 2013-03-10 13:09:24 +00:00
Alexander Ljungberg f4096b94a7 New: use @ref and @deref instead of Ref.h throughout Cappuccino. 2013-03-10 13:08:34 +00:00
Aparajita Fishman 471641c228 Fixed: subviews in cib did not receive view(Will/Did)MoveToSuperview:
In Cocoa, viewWillMoveToSuperview: and viewDidMoveToSuperview: are called when views are instantiated from code or from a nib.

Previously in Cappuccino, when a view was instantiated from a cib, the _subviews of the view were directly set from the decoded subview array. This short-circuited all of the normal notifications a view receives when added to a superview, including viewWillMoveToSuperview: and viewDidMoveToSuperview:. As a result, some views that override these methods, such as CPSearchField, were not set up correctly when instantiated from a cib.

With this commit, subviews instantiated from a cib are manually added to their superview, thus ensuring they go through the same cycle as views instantiated from code, and ensuring that viewWillMoveToSuperview: and viewDidMoveToSuperview: are called.

Closes #1699
2013-02-25 20:09:18 -05:00
Alexander Ljungberg 6d1c4a9570 Fixed: - CPMutableArray removeObjectIdenticalTo did not remove all instances, was documented incorrectly.
Contrary to what the previous documentation said, removeObjectIdenticalTo: should remove all instances of the argument from the receiver, not just the first one.
2013-02-24 23:51:48 +00:00
Alexander Ljungberg be4a168601 Make 30268f9865c compatible with Internet Explorer 8-. 2013-02-24 23:50:09 +00:00
Alexander Ljungberg c4370240f8 Fixed: subclasses of CPMutableArray had broken removeObject:.
The `removeObject:` default provided in CPMutableArray would not work in subclasses because it relied on the class having a .length property.
2013-02-24 23:43:20 +00:00
Alexander Ljungberg 0268f9865c Faster CPMutableArray removeObjectIdenticalTo:.
About 6-8X speedup by skipping all the `indexOfObjectIdenticalTo:` calls and going straight to JS `indexOf`.
2013-02-24 15:19:00 +00:00
cacaodev 04026c054b _CPJavaScriptArray -objectsAtIndexes: implementation.
Added speed test in CPArrayPerformanceTest (6x faster).
2013-02-04 17:26:18 +01:00
Alexander Ljungberg 75d73d3a5e Format object descriptions like object literals.
This change makes CPDictionary descriptions exactly like Objective-C literals. Later when Objective-J adds support for such literals too, it'll be possible to just copy and paste a CPDictionary description into code.

Also updated CPArray to look similar for consistency.
2013-01-26 12:01:20 +00:00
Aparajita Fishman 95790d55d5 Object description formatting
- Made CPDescriptionOfObject smarter about detecting CG objects
- CPObject, CPArray, CPDictionary do a better (as in perfect) job of indenting nested objects
- CPDictionary is displayed using Cocoa-style key = value; notation
2013-01-25 19:19:01 +08:00
Martin Carlberg 458fa9d02e Fixed a lot of small bugs found by new warning message from compiler 2013-01-18 14:24:37 +01:00
Martin Carlberg b52217e8a0 Tried to make the import mess a little better. Fixed a lot of bugs. Changed some class names in the test cases. Looks like all the tests are being run in the same space. Has to look into this….. 2012-12-17 00:40:26 +01:00
Martin Carlberg 0280a10832 More changes now when we don't have with(self) 2012-12-16 19:20:59 +01:00
Martin Carlberg c297e926f9 Compiler now works with jake and can compiler the whole Cappuccino framework. A lot of test cases still fail 2012-12-16 17:38:47 +01:00
Alexander Ljungberg 46848562d0 Improve describe format of CPDictionary and CPArray to be more like literals.
E.g. a dictionary is expressed as @{key1: value1}, an array like @[value2, value2], a string like @"<value>".

Also don't put all child objects into quotation marks - that makes them all look like strings.
2012-08-24 17:25:37 +01:00
Martin Carlberg e265d09034 Fixed sortUsingDescriptors: so it can handle sort descriptors
with a key path instead of just a key.
Also added a test case for this.
2012-07-06 20:52:33 +02:00
Aparajita Fishman b6adf26549 Make Alexander happy. ;-) 2012-07-05 12:26:55 -07:00
Aparajita Fishman d0bfde1887 Annotate indexOfObject methods, use "index" instead of "idx" 2012-07-05 11:34:01 -07:00
Alexander Ljungberg 8afb67521d Annotate indexesOfObjectsPassingTest: function signature. 2012-07-04 23:26:07 +01:00
Aparajita Fishman 593f3c2109 Fixed the method names 2012-07-04 17:03:53 -04:00
Aparajita Fishman 0f5a6b4e5e Added CPArray -indexesOfObjectPassingTest methods 2012-07-04 15:41:45 -04:00
Aparajita Fishman 5410884e03 Fixed the documentation for CPArray -indexOfObject methods 2012-06-29 09:02:35 -07:00
Alexander Ljungberg f538cbc51d Re #1560. Remove obsolete function. 2012-06-10 01:18:56 +01:00
Martin Carlberg 0696b22971 Fixed formatting 2012-06-08 20:18:22 +02:00
Martin Carlberg d7ff93f7f2 SortUsingDescriptors: Using the selector in the descriptor instead of always using compare: 2012-06-08 19:48:39 +02:00
Martin Carlberg dc30092b60 A very fast sortUsingDescriptors:
I needed to sort a lot of objects and was not impressed by the speed.
Sharing my improvements...
2012-06-07 23:25:58 +02:00
Alexander Ljungberg 5e7125e310 Refs #1538. Clean up, accidental global. 2012-05-14 21:12:31 +01:00
Alexander Ljungberg bc370a2a5a Merge pull request #1538 from mrcarlberg/cappuccino
---

Dont you hate when your logs of arrays and dictionaries display [Object object] when you have JavaScript objects in them. Now with this patch all JavaScript objects will be display with all attributes in a nice good looking way. Log CGRect, CGPoint and other JavaScript objects withour any hassle anymore. For example: console.log([myRect]);
2012-05-14 21:12:17 +01:00
Blair Duncan 6ede1ccb04 Unnecessary globals 2012-04-10 17:25:46 -04:00
Alexander Ljungberg 3a0068186a Implement stopping support for CPArray enumerateObjectsUsingBlock:. 2012-03-23 00:34:09 +00:00
Alexander Ljungberg 2951a83e73 CPArray enumerateObjectsWithOptions:usingBlock:. 2012-03-22 17:05:59 +00:00
Aparajita Fishman 1c2a304ee5 Assignment of function is a statement and should be semicolon terminated. Some miscellaneous linting as well. 2012-01-05 17:51:37 -10:00
Alexander Ljungberg 7f31be7cb1 Fixed: array replaceObjectsInRange:withObjectsFromArray: always failed with a "'null' is not an object' error.
This was caused by the new range checks in f8404c7a97.
2011-09-07 16:18:08 +01:00
Aparajita Fishman 8e203ec78e Fixed range checking for insertObject:atIndex: 2011-08-08 15:14:30 -07:00