Merge remote branch 'origin/master'

This commit is contained in:
Jonathan Puckey 2011-03-04 12:21:06 +01:00
commit c00f85c9e5

View file

@ -14,7 +14,7 @@ var PaperScript = new function() {
'!=': 'equals' '!=': 'equals'
}; };
function $operator(left, operator, right) { function $eval(left, operator, right) {
var handler = operators[operator]; var handler = operators[operator];
if (left && left[handler]) { if (left && left[handler]) {
var res = left[handler](right); var res = left[handler](right);
@ -35,12 +35,12 @@ var PaperScript = new function() {
// Handle Sign Operators // Handle Sign Operators
var signs = { var signOperators = {
'-': 'negate' '-': 'negate'
}; };
function $sign(operator, value) { function $sign(operator, value) {
var handler = signs[operator]; var handler = signOperators[operator];
if (value && value[handler]) { if (value && value[handler]) {
return value[handler](); return value[handler]();
} }
@ -64,7 +64,7 @@ var PaperScript = new function() {
// is potentially an object. // is potentially an object.
if (operators[operator] && isDynamic(left)) { if (operators[operator] && isDynamic(left)) {
// Replace with call to $operator(left, operator, right): // Replace with call to $operator(left, operator, right):
return ['call', ['name', '$operator'], return ['call', ['name', '$eval'],
[left, ['string', operator], right]]; [left, ['string', operator], right]];
} }
} }
@ -101,7 +101,7 @@ var PaperScript = new function() {
}, },
'unary-prefix': function(operator, exp) { 'unary-prefix': function(operator, exp) {
if (signs[operator] && isDynamic(exp)) { if (signOperators[operator] && isDynamic(exp)) {
return ['call', ['name', '$sign'], return ['call', ['name', '$sign'],
[['string', operator], walk(exp)]]; [['string', operator], walk(exp)]];
} }