This commit is contained in:
Tobias Koppers 2013-12-31 12:42:38 +01:00
parent fe2681cb31
commit 1df510b919
3 changed files with 16 additions and 2 deletions

View File

@ -551,9 +551,11 @@ Parser.prototype.walkExpression = function walkExpression(expression) {
case "CallExpression":
if(expression.callee.type === "FunctionExpression" && expression.arguments) {
// (function(...) { }(...))
var args = expression.arguments.map(function(arg) {
var args = expression.arguments.map(function(arg, idx) {
var result = this.evaluateExpression(arg);
if(!result.isIdentifier()) result = undefined;
if(result && !result.isIdentifier()) result = undefined;
if(result && (!expression.callee.params[idx] || expression.callee.params[idx].name !== result.identifier))
result = undefined;
if(!result) {
this.walkExpression(arg);
return;

View File

@ -179,6 +179,15 @@ it("should parse a bound function expression 4", function(done) {
}.bind(null, 123));
});
it("should create a context if require passed to IIFE (renaming todo)", function(done) {
require.ensure([], function(require) {
(function(req) {
req.keys.should.be.type("function");
done();
}(require));
});
});
it("should not fail issue #138 second", function() {
(function(define, global) { 'use strict';
define(function (require) {

View File

@ -0,0 +1,3 @@
module.exports = [
[/Critical dependencies/]
];