Fix scoping error in coffee-script.coffee

Closes #4167.
This commit is contained in:
Simon Lydell
2016-01-07 07:21:05 +01:00
parent b8403bfa97
commit ae72dbb379
2 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.10.0
(function() {
var Lexer, SourceMap, base, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors,
var Lexer, SourceMap, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors,
hasProp = {}.hasOwnProperty,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@@ -206,13 +206,15 @@
if (require.extensions) {
ref = this.FILE_EXTENSIONS;
fn1 = function(ext) {
var base;
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files.");
};
};
for (i = 0, len = ref.length; i < len; i++) {
ext = ref[i];
if ((base = require.extensions)[ext] == null) {
base[ext] = function() {
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files.");
};
}
fn1(ext);
}
}

View File

@@ -175,7 +175,7 @@ exports.register = -> require './register'
# Throw error with deprecation warning when depending upon implicit `require.extensions` registration
if require.extensions
for ext in @FILE_EXTENSIONS
for ext in @FILE_EXTENSIONS then do (ext) ->
require.extensions[ext] ?= ->
throw new Error """
Use CoffeeScript.register() or require the coffee-script/register module to require #{ext} files.