Pass on 'this' as root scope, for better inclusion of Acorn inside Paper.js

Use same approach as Esprima.
This commit is contained in:
Jürg Lehni
2013-07-17 16:23:17 -07:00
committed by Marijn Haverbeke
parent a84e21e0ff
commit 097b4162da
2 changed files with 6 additions and 6 deletions

View File

@@ -20,11 +20,11 @@
// [dammit]: acorn_loose.js
// [walk]: util/walk.js
(function(mod) {
(function(root, mod) {
if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
mod(this.acorn || (this.acorn = {})); // Plain browser env
})(function(exports) {
mod(root.acorn || (root.acorn = {})); // Plain browser env
})(this, function(exports) {
"use strict";
exports.version = "0.3.2";

View File

@@ -29,11 +29,11 @@
// invasive changes and simplifications without creating a complicated
// tangle.
(function(mod) {
(function(root, mod) {
if (typeof exports == "object" && typeof module == "object") return mod(exports, require("./acorn")); // CommonJS
if (typeof define == "function" && define.amd) return define(["exports", "./acorn"], mod); // AMD
mod(this.acorn || (this.acorn = {}), this.acorn); // Plain browser env
})(function(exports, acorn) {
mod(root.acorn || (root.acorn = {}), root.acorn); // Plain browser env
})(this, function(exports, acorn) {
"use strict";
var tt = acorn.tokTypes;