math-codegen
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -36,3 +36,9 @@ 'use strict' | ||
this.defs.$$mathCodegen = { | ||
throwUndefined: function (symbol) { | ||
getProperty: function (symbol, scope, ns) { | ||
if (scope.hasOwnProperty(symbol)) { | ||
return scope[symbol] | ||
} | ||
if (ns.hasOwnProperty(symbol)) { | ||
return ns[symbol] | ||
} | ||
throw SyntaxError('symbol "' + symbol + '" is undefined') | ||
@@ -55,3 +61,3 @@ }, | ||
if (!this.statements.length) { | ||
throw Error('there are no statements saved in this generator') | ||
throw Error('there are no statements saved in this generator, make sure you parse an expression before compiling it') | ||
} | ||
@@ -58,0 +64,0 @@ |
@@ -5,3 +5,3 @@ 'use strict' | ||
var id = node.name | ||
return '(scope["' + id + '"] || ns["' + id + '"] || $$mathCodegen.throwUndefined("' + id + '"))' | ||
return '$$mathCodegen.getProperty("' + id + '", scope, ns)' | ||
} |
{ | ||
"name": "math-codegen", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Generates code from mathematical expressions", | ||
@@ -5,0 +5,0 @@ "bugs": "https://github.com/maurizzzio/math-codegen/issues", |
@@ -6,3 +6,3 @@ # math-codegen | ||
[![Coverage Status][coveralls-image]][coveralls-url] | ||
[![Stability](https://img.shields.io/badge/stability-stable-green.svg)]() | ||
[![Stability](https://img.shields.io/badge/stability-unstable-yellow.svg)]() | ||
@@ -46,4 +46,2 @@ [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
NOTE: still a work on progress | ||
### Lifecycle | ||
@@ -50,0 +48,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19894
268
1
357