Skip to content

Commit

Permalink
Added curly brackets as terminators. Data access options that might c…
Browse files Browse the repository at this point in the history
…ontain curly braces have their own loop which uses ')' as the terminator, so curly braces are safe terminator.
  • Loading branch information
amiller-gh committed Mar 12, 2015
1 parent d26205e commit 643858e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reboundjs",
"version": "0.0.56",
"version": "0.0.57",
"description": "Automatic data binding for Backbone using HTMLBars.",
"main": "dist/cjs/rebound-precompiler/rebound-precompiler.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions packages/property-compiler/lib/property-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ function compile(prop, name){
tmpPath,
attrs = [],
workingpath = [],
terminators = [';',',','==','>','<','>=','<=','>==','<==','!=','!==', '===', '&&', '||', '+', '-', '/', '*'];
terminators = [';',',','==','>','<','>=','<=','>==','<==','!=','!==', '===', '&&', '||', '+', '-', '/', '*', '{', '}'];
do{

token = nextToken();
console.log(token.value, token.type.type);

if(token.value === 'this'){
listening++;
Expand Down
14 changes: 13 additions & 1 deletion packages/property-compiler/test/property_compiler_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ require(['property-compiler/property-compiler'], function(compiler){
deepEqual( res, ['one', 'two'], 'Property Compiler works with complex if statement (multiple terminators between `this`)' );


func = function(){
if(this.get('page') === 'login' && this.get('user.uid')){
this.set('page', 'checkout');
return 1;
}
return 0;
};

res = compiler.compile(func, 'path');
deepEqual( res, ['page', 'user.uid'], 'Property Compiler works with complex if statement (multiple terminators between `this`)' );


// TODO: Features to eventually support
//
//
Expand All @@ -167,7 +179,7 @@ require(['property-compiler/property-compiler'], function(compiler){
// compiler.register({cid: 'testId'}, 'key', func, 'path');
// res = compiler.compile(func, 'path');
// deepEqual( res, ['foo.bar'], 'Property Compiler saves state when object is saved to a variable' );
//
//
//
//
// func = function(){
Expand Down

0 comments on commit 643858e

Please sign in to comment.