The life will be easier to have the same in both environments.
Warnings and errors now don’t use read only properties for line and column information. So the test cases in Toolstest.j now work in modern JS engines.
It is also easier to set options for the compiler.
Previously, it was not possible to specify the desired output format of the command objj.
Now we can have either the default format or a xml format if --xml-output-format is added.
Previously, ObjJ was ignoring unknow ivar type. This patch adds some check to ensure the type is either a known class, the current class
itself, a global, a basic JS type or a declared custom type.
In order to declare custom types, this patch introduces the @typedef keyword.
For instance, this will throw a warning:
```objj
@import <Foundation/Foundation.j>
@implementation MyClass: CPObject
{
NUSuppaType mode;
}
@end
```
This will not:
```objj
@import <Foundation/Foundation.j>
@typedef NUSuppaType
@implementation NUMyClass: CPObject
{
NUSuppaType mode;
}
@end
```
Declared types are shared accross all application, one type can only be declared once.
If the receiver is an identifier and not an ivar that needs 'self.' infront there is no need to assign it to a temporary variable. Also if the identifier is 'self' there we assume it is not nil.
This caused 'null is not an object' type error when class declaration with 'accessors' declared ivars was in the same file as the protocol it was conforming to.
Earlier the compiler generated the 'if' without the last ';' when a empty statement is used, with sometimes devastating result. The same if an empty statement was after the 'else'.
I have also added a test case for some different empty statement senarios.
The Objective-J parser and compiler now handles protocol syntax. The Objective-J runtime has new functions to handle protocols. The method 'conformsToProtocol:' has been added to CPObject as an instance and a class method.
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.