Previously, Cappuccino only called OBJJ_PROGRESS_CALLBACK when an executable or image sprite file was finished loading. Only a slow connection, this would result in long periods with no visible progress.
Now OBJJ_PROGRESS_CALLBACK is called continuously during download via the XHR progress event. All supported browsers except IE 9 support this event.
The program below crashed on the last line with a 'null is not an object' error message. Also added a test case.
@implementation MyObject {
- (int):(int)a {
return a;
}
@end
var a = [[MyObject alloc] init];
var b = [a:3];
'@ref' is generated to ' function(__input…' with the starting space if, for example, the code is 'return(@ref(a))'. This will create a space between 'return' and 'function(__input…'. When the compiler is generate the code this is not necessary.
The compiler can now run in IE8. Also found the use of the function .indexOf on Arrays in CPView.j.
It is not supported in IE8.
Added a new file (OldBrowserCompatibility.js) in the Objective-J framework that will add functions if they are not supported in the javascript runtime.
CFBundle internally stores its URL in relative form, and returned that relative URL in the bundleURL() function. However, in Cocoa an absolute URL is returned. It is reasonable to assume an absolute URL would be expected by some asking for the bundle's URL. Even within CFBundle, most times bundleURL() is called it is followed with absoluteURL().
This commit returns an absolute URL from bundleURL().
Example:
#define first Martin
#define second Carlberg
var first##second = 13;
Compiles to:
var MartinCarlberg = 13;
Example 2:
#define _function(inline) function inline { return _##inline; }
#define _CGPointMake(x_, y_) { x:x_, y:y_ }
_function(CGPointMake(x, y))
Compiles to:
function CGPointMake (x, y) {
return {x: x, y: y};
}
When a statement ends without a semicolon and a Send message expression is on the next line it was wrongly parsed as a single Send message expression. It should be an ExpressionStatement with a Send message expression inside.
This change makes it possible to @deref any expression, such as a conditional expression, as long as the expression doesn't have side effects.
The reason not to allow dereferencing of expressions with side effects is that we might need to evaluate the expression twice in certain uses of deref, which is not obvious when you look at the deref operator in plain code.
Array literals look like `@[a, b, c]`.
This syntax is supported for completeness and source compatibility, but are not terribly useful since standard JavaScript arrays are toll-free bridged to CPArray.
Array literals could be handy if you're replacing CPArray with your own implementation.