Permalink
Browse files

Add back `noWrap` as a deprecated option with a warning

  • Loading branch information...
1 parent 8eaef5c commit 5a3fca10503d9ae7ad748b90f6d35711586acded @sstephenson committed Oct 9, 2010
Showing with 17 additions and 2 deletions.
  1. +6 −1 lib/nodes.js
  2. +11 −1 src/nodes.coffee
View
@@ -205,7 +205,12 @@
};
Expressions.prototype.compileRoot = function(o) {
var code, wrap;
- wrap = (o.wrap != null) ? o.wrap : true;
+ wrap = (function() {
+ if (o.noWrap != null) {
+ ((typeof console !== "undefined" && console !== null) ? (typeof console.warn !== "function" ? undefined : console.warn("Warning: The `noWrap` option to `CoffeeScript.compile` is deprecated and\nwill be removed in the future. Please use the `wrap` option instead.")) : undefined);
+ return !o.noWrap;
+ } else return (o.wrap != null) ? o.wrap : true;
+ })();
o.indent = (this.tab = wrap ? TAB : '');
o.scope = new Scope(null, this, null);
code = this.compileWithDeclarations(o);
View
@@ -197,7 +197,17 @@ exports.Expressions = class Expressions extends Base
# It would be better not to generate them in the first place, but for now,
# clean up obvious double-parentheses.
compileRoot: (o) ->
- wrap = if o.wrap? then o.wrap else true
+ wrap = if o.noWrap?
+ console?.warn? """
+ Warning: The `noWrap` option to `CoffeeScript.compile` is deprecated and
+ will be removed in the future. Please use the `wrap` option instead.
+ """
+ !o.noWrap
+ else if o.wrap?
+ o.wrap
+ else
+ true
+
o.indent = @tab = if wrap then TAB else ''
o.scope = new Scope(null, this, null)
code = @compileWithDeclarations(o)

0 comments on commit 5a3fca1

Please sign in to comment.