mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-17 16:11:28 +00:00
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.
This commit is contained in:
@@ -1624,22 +1624,30 @@ MessageSendExpression: function(node, st, c) {
|
||||
},
|
||||
SelectorLiteralExpression: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
buffer = compiler.jsBuffer,
|
||||
generate = compiler.generate;
|
||||
if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
compiler.jsBuffer.concat(" sel_getUid(\"");
|
||||
compiler.jsBuffer.concat(node.selector);
|
||||
compiler.jsBuffer.concat("\")");
|
||||
if (!generate) {
|
||||
buffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
buffer.concat(" "); // Add an extra space if it looks something like this: "return(@selector(a:))". No space between return and expression.
|
||||
}
|
||||
buffer.concat("sel_getUid(\"");
|
||||
buffer.concat(node.selector);
|
||||
buffer.concat("\")");
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
},
|
||||
Reference: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
buffer = compiler.jsBuffer,
|
||||
generate = compiler.generate;
|
||||
if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
compiler.jsBuffer.concat(" function(__input) { if (arguments.length) return ");
|
||||
compiler.jsBuffer.concat(node.element.name);
|
||||
compiler.jsBuffer.concat(" = __input; return ");
|
||||
compiler.jsBuffer.concat(node.element.name);
|
||||
compiler.jsBuffer.concat("; }");
|
||||
if (!generate) {
|
||||
buffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
buffer.concat(" "); // Add an extra space if it looks something like this: "return(<expression>)". No space between return and expression.
|
||||
}
|
||||
buffer.concat("function(__input) { if (arguments.length) return ");
|
||||
buffer.concat(node.element.name);
|
||||
buffer.concat(" = __input; return ");
|
||||
buffer.concat(node.element.name);
|
||||
buffer.concat("; }");
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
},
|
||||
Dereference: function(node, st, c) {
|
||||
|
||||
Reference in New Issue
Block a user