mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Rename $operator() to more meaningful $eval().
This commit is contained in:
parent
11672d104f
commit
6d00c723d9
1 changed files with 5 additions and 5 deletions
|
@ -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)]];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue