| 130909 | |
| 130910 | |
| 130911 | function expressionFunction(name, fn, visitor) { |
| 130912 | if (arguments.length === 1) { |
| 130913 | return functionContext[name]; |
| 130914 | } // register with the functionContext |
| 130915 | |
| 130916 | |
| 130917 | functionContext[name] = fn; // if there is an astVisitor register that, too |
| 130918 | |
| 130919 | if (visitor) astVisitors[name] = visitor; // if the code generator has already been initialized, |
| 130920 | // we need to also register the function with it |
| 130921 | |
| 130922 | if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; |
| 130923 | return this; |
| 130924 | } // register expression functions with ast visitors |
| 130925 | |
| 130926 | |
| 130927 | expressionFunction('bandwidth', _scale.bandwidth, _visitors.scaleVisitor); |