You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
429 B
19 lines
429 B
var utils = require('../utils') |
|
, nodes = require('../nodes'); |
|
|
|
/** |
|
* Set a variable `name` on current scope. |
|
* |
|
* @param {String} name |
|
* @param {Expression} expr |
|
* @api public |
|
*/ |
|
|
|
module.exports = function define(name, expr){ |
|
utils.assertType(name, 'string', 'name'); |
|
expr = utils.unwrap(expr); |
|
var scope = this.currentScope; |
|
var node = new nodes.Ident(name.val, expr); |
|
scope.add(node); |
|
return nodes.null; |
|
};
|
|
|