Commit Graph
53 Commits
Author SHA1 Message Date
Alexander Ljungberg c1f538ece5 Formatting: whitespace.
Refs #1974.
2013-11-28 18:39:01 +00:00
Martin Carlberg 8419001810 Merge branch 'master' of https://github.com/cappuccino/cappuccino into protocol 2013-11-22 14:23:52 +01:00
Martin Carlberg f0e2daf6c7 Fixed: Add get and set instance methods to class definition when ivar has accessors.
This caused 'Method is not implemented' warnings when a class implemented protocol declared set and get methods as 'accessors' on an ivar.
2013-09-12 21:54:57 +02:00
Martin Carlberg 9f0d8c54e4 Fixed: Uses current protocolDefs when compiling accessors
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.
2013-09-12 21:47:15 +02:00
Martin Carlberg 23fb618596 Fixed: Compiler now generates correct empty statement after 'if (a);'
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.
2013-09-09 16:38:38 +02:00
Martin Carlberg ba0604320e Fixed: Should be 'objj_allocateProtocol' and 'objj_registerProtocol' not 'objc_allocateProtocol' and 'objc_registerProtocol' 2013-08-31 15:33:32 +02:00
Martin Carlberg c979a69e6b Fixed: Compiler can now handle only @action/IBAction declared return type when checking for 'Conflicting return type' method declaration.
Also made the warning message point to correct return type token when type is not declared.
2013-08-28 11:23:55 +02:00
Martin Carlberg 9eebb0a64b Fixed: Pass correct node to error message when finding duplicated protocol 2013-08-22 16:53:22 +02:00
Martin Carlberg cfc682c165 Fixed: Protocol methods is now registered in the correct place 2013-08-22 12:36:29 +02:00
Martin Carlberg c326168e83 Fixed: Protocol definition in compiler was not created correct from protocol definition in the runtime 2013-08-22 12:35:16 +02:00
Martin Carlberg b8b96a17d7 Fixed: Check if global function exists in correct way 2013-08-22 12:34:14 +02:00
Martin Carlberg 672ed6ed0c Fixed: Handle protocol declaration with no method declarations 2013-08-12 22:41:36 +02:00
Martin Carlberg f74312dc42 Fixed: Allow type on return or parameter type to be a class if superclass or protocol declared it as 'id' 2013-08-12 16:55:35 +02:00
Martin Carlberg 2e216d7e9a Fixed: Make default return type to 'void' for '@action' or 'IBAction' marked method. 2013-08-12 16:53:19 +02:00
Martin Carlberg 29d7833fcb Fixed: Renamed local variable that used reserved variable name ('arguments') 2013-08-12 16:52:07 +02:00
Martin Carlberg d38125db13 New: Added Objective-J protocol support
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.
2013-08-09 19:02:45 +02:00
Martin Carlberg 595736b8c6 Fixed: When selector is only a ':' in a send message statement the new compiler crashed.
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];
2013-05-30 14:39:58 +02:00
Martin Carlberg ee4112b7f1 Fixed: Removed double spaces before '@ref' and '@selector' generated output from compiler.
'@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.
2013-05-22 10:34:46 +02:00
Martin Carlberg 1d896c6ac9 Fixed: Code generator didn't generate ';' for empty loops
The line 'while (count--);' was generated to 'while (count--)'. The same with 'for(;;);' and 'for (a in []);'
2013-05-22 10:27:01 +02:00
Aparajita Fishman 6bac934d0c Fixed: changed indentation of generated code to Cappuccino standard of 4 spaces. 2013-05-18 18:42:26 -04:00
Martin Carlberg 8145df9613 Fixed: Removed all uses of preprocess macros in the compiler 2013-05-13 16:23:12 +02:00
Martin Carlberg e9ca7c7395 Fixed: IE8 Browser support.
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.
2013-05-06 16:17:09 +02:00
Martin Carlberg b6fd6a15f0 Fixed: Removed extra spaces in code generation between 'else' and 'if' in 'else if' statements 2013-04-23 17:07:26 +02:00
Martin Carlberg e35bfaf96c Fixed: Better looking code generation with correct indentation for 'if' - 'else if' statements 2013-04-23 15:48:25 +02:00
Martin Carlberg 8707247008 New: Always generate code when compiling 2013-03-27 14:45:25 +01:00
Martin Carlberg 89457845f9 Fixed: Made some smaller code generation changes to get better formatted compiled code 2013-03-21 14:32:21 +01:00
Martin Carlberg 1842d7127a New: The generated code will now have correct indentation. 2013-03-21 11:33:13 +01:00
Martin Carlberg fa18095538 Fixed: Does not add extra parentheses for expression operators with the same precedence 2013-03-20 20:47:27 +01:00
Martin Carlberg 92ac8569b3 New: Full support for generate code instead of copy
The new compiler can now generate code. The old way of copy and alter the source
code is still supported.
2013-03-17 21:00:24 +01:00
Martin Carlberg 22cdbd7ec7 Merge branch 'master' of https://github.com/cappuccino/cappuccino into preprocess
Conflicts:
	Objective-J/ObjJAcornCompiler.js
	Objective-J/acorn.js
2013-03-12 11:20:56 +01:00
Martin Carlberg 362f3b890e Added first try for compiler to generate code 2013-03-12 09:22:26 +01:00
Alexander Ljungberg 483bd16a2d Formatting: simplify code slightly. 2013-03-10 17:40:58 +00:00
Alexander Ljungberg b53616ead3 New: @deref(<any idempotent expression>).
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.
2013-03-10 17:32:28 +00:00
Alexander Ljungberg f201ab0721 New: update operators on references, such as @deref(x)++.
This fix implements support for both prefix and postfix update operators on a dereference.
2013-03-10 14:02:37 +00:00
Alexander Ljungberg 34faf362d1 New: @ref and @deref in Objective-J 2.0. 2013-03-10 12:17:43 +00:00
Alexander Ljungberg 472848da91 New: array literals in Objective-J 2.0.
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.
2013-02-25 14:57:05 +00:00
Alexander Ljungberg 5200f945fe New: dictionary literals in Objective-J 2.0. 2013-02-25 14:24:29 +00:00
Martin Carlberg 64a38a2aef Refactored how maybe warnings is handled and prepared for new "local variable hides global variable" warning. The warning is disabled because there are to many warning in the Cappuccino frameworks right now. 2013-02-19 20:22:42 +01:00
Martin Carlberg cccfe7268b Fixed better comment 2013-02-19 17:48:16 +01:00
Martin Carlberg c03697c0a6 Fixed support for IE8 2013-02-19 17:47:34 +01:00
Martin Carlberg 32bf87c0c3 Fixed typo 2013-02-19 17:46:24 +01:00
Martin Carlberg 201c7637f6 Fixed new compiler to output better formatted error messages 2013-01-22 15:38:02 +01:00
Martin Carlberg 2952812a4b Fixed uninitialized warning message in new compiler when using rhino 2013-01-22 10:32:37 +01:00
Martin Carlberg 586c9d3139 Fixed "Can't find superclass 'MyClass' <Context File: Accessors>" problem when
compiling accessors to class with superclass in same file.
2013-01-18 21:23:11 +01:00
Martin Carlberg 6fbab322cf Fixed warning messages in compiler 2013-01-18 14:25:05 +01:00
Martin Carlberg e78f211e8a Added @class and @global declaration and will now make a warning if class or global is not declared. 2013-01-14 18:36:39 +01:00
Martin Carlberg 3dc6a30c4c Code clean up 2013-01-11 20:36:19 +01:00
Martin Carlberg 7c71cd1f80 The new compiler takes care of hoisted variables 2013-01-10 19:30:34 +01:00
Martin Carlberg 0dd98b56bc "self." is only added to instance variables when compiling an instance method 2013-01-09 10:21:16 +01:00
Martin Carlberg d49e78c43e Removal of old compiler 2013-01-07 20:29:56 +01:00