diff --git a/README b/README
index 244d6f82..04fb649f 100644
--- a/README
+++ b/README
@@ -26,7 +26,7 @@
gem install coffee-script
Compile a script:
- coffee-script /path/to/script.cs
+ coffee-script /path/to/script.coffee
For documentation, usage, and examples, see:
http://jashkenas.github.com/coffee-script/
diff --git a/Rakefile b/Rakefile
index 82536e6a..1891f84f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,7 +19,7 @@ namespace :build do
desc "Compile the Narwhal interface for --interactive and --run"
task :narwhal do
- sh "bin/coffee-script lib/coffee_script/narwhal/*.cs -o lib/coffee_script/narwhal/js"
+ sh "bin/coffee-script lib/coffee_script/narwhal/*.coffee -o lib/coffee_script/narwhal/js"
end
end
@@ -27,7 +27,7 @@ end
desc "Build the documentation page"
task :doc do
source = 'documentation/index.html.erb'
- child = fork { exec "bin/coffee-script documentation/cs/*.cs -o documentation/js -w" }
+ child = fork { exec "bin/coffee-script documentation/coffee/*.coffee -o documentation/js -w" }
at_exit { Process.kill("INT", child) }
Signal.trap("INT") { exit }
loop do
diff --git a/documentation/cs/aliases.cs b/documentation/coffee/aliases.coffee
similarity index 100%
rename from documentation/cs/aliases.cs
rename to documentation/coffee/aliases.coffee
diff --git a/documentation/cs/array_comprehensions.cs b/documentation/coffee/array_comprehensions.coffee
similarity index 100%
rename from documentation/cs/array_comprehensions.cs
rename to documentation/coffee/array_comprehensions.coffee
diff --git a/documentation/cs/assignment.cs b/documentation/coffee/assignment.coffee
similarity index 100%
rename from documentation/cs/assignment.cs
rename to documentation/coffee/assignment.coffee
diff --git a/documentation/cs/conditionals.cs b/documentation/coffee/conditionals.coffee
similarity index 100%
rename from documentation/cs/conditionals.cs
rename to documentation/coffee/conditionals.coffee
diff --git a/documentation/cs/embedded.cs b/documentation/coffee/embedded.coffee
similarity index 100%
rename from documentation/cs/embedded.cs
rename to documentation/coffee/embedded.coffee
diff --git a/documentation/cs/expressions.cs b/documentation/coffee/expressions.coffee
similarity index 100%
rename from documentation/cs/expressions.cs
rename to documentation/coffee/expressions.coffee
diff --git a/documentation/cs/functions.cs b/documentation/coffee/functions.coffee
similarity index 100%
rename from documentation/cs/functions.cs
rename to documentation/coffee/functions.coffee
diff --git a/documentation/cs/objects_and_arrays.cs b/documentation/coffee/objects_and_arrays.coffee
similarity index 100%
rename from documentation/cs/objects_and_arrays.cs
rename to documentation/coffee/objects_and_arrays.coffee
diff --git a/documentation/cs/overview.cs b/documentation/coffee/overview.coffee
similarity index 100%
rename from documentation/cs/overview.cs
rename to documentation/coffee/overview.coffee
diff --git a/documentation/cs/scope.cs b/documentation/coffee/scope.coffee
similarity index 100%
rename from documentation/cs/scope.cs
rename to documentation/coffee/scope.coffee
diff --git a/documentation/cs/slices.cs b/documentation/coffee/slices.coffee
similarity index 100%
rename from documentation/cs/slices.cs
rename to documentation/coffee/slices.coffee
diff --git a/documentation/cs/strings.cs b/documentation/coffee/strings.coffee
similarity index 100%
rename from documentation/cs/strings.cs
rename to documentation/coffee/strings.coffee
diff --git a/documentation/cs/super.cs b/documentation/coffee/super.coffee
similarity index 100%
rename from documentation/cs/super.cs
rename to documentation/coffee/super.coffee
diff --git a/documentation/cs/switch.cs b/documentation/coffee/switch.coffee
similarity index 100%
rename from documentation/cs/switch.cs
rename to documentation/coffee/switch.coffee
diff --git a/documentation/cs/try.cs b/documentation/coffee/try.coffee
similarity index 100%
rename from documentation/cs/try.cs
rename to documentation/coffee/try.coffee
diff --git a/documentation/cs/while.cs b/documentation/coffee/while.coffee
similarity index 100%
rename from documentation/cs/while.cs
rename to documentation/coffee/while.coffee
diff --git a/documentation/cs/intro.cs b/documentation/cs/intro.cs
deleted file mode 100644
index b0f13bb9..00000000
--- a/documentation/cs/intro.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-# CoffeeScript on the left, JS on the right.
-
-square: x => x * x.
diff --git a/documentation/cs/punctuation.cs b/documentation/cs/punctuation.cs
deleted file mode 100644
index 3ecf2073..00000000
--- a/documentation/cs/punctuation.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-# Comments start with hash marks.
-
-# Periods mark the end of a block.
-left_hand: if raining then umbrella else parasol.
-
-# To signal the beginning of the next expression,
-# use "then", or a newline.
-left_hand: if raining
- umbrella
-else
- parasol.
diff --git a/documentation/index.html.erb b/documentation/index.html.erb
index 0442d1c5..29c233b7 100644
--- a/documentation/index.html.erb
+++ b/documentation/index.html.erb
@@ -3,7 +3,7 @@
def code_for(file, executable=false)
@stripper ||= /(\A\(function\(\)\{\n|\}\)\(\);\Z|^ )/
return '' unless File.exists?("documentation/js/#{file}.js")
- cs = File.read("documentation/cs/#{file}.cs")
+ cs = File.read("documentation/coffee/#{file}.coffee")
js = File.read("documentation/js/#{file}.js").gsub(@stripper, '')
cshtml = Uv.parse(cs, 'xhtml', 'coffeescript', false, 'idle', false)
jshtml = Uv.parse(js, 'xhtml', 'javascript', false, 'idle', false)
@@ -92,11 +92,11 @@ gem install coffee-script
Installing the gem provides the coffee-script command, which can
- be used to compile CoffeeScript .cs files into JavaScript, as
- well as debug them. In conjunction with
+ be used to compile CoffeeScript .coffee files into JavaScript, as
+ well as debug them. In conjunction with
Narwhal, the coffee-script
- command also provides direct evaluation and an interactive REPL.
- When compiling to JavaScript, coffee-script writes the output
+ command also provides direct evaluation and an interactive REPL.
+ When compiling to JavaScript, coffee-script writes the output
as .js files in the same directory by default, but output
can be customized with the following options:
@@ -105,7 +105,7 @@ gem install coffee-script
-i, --interactive |
- Launch an interactive CoffeeScript session.
+ Launch an interactive CoffeeScript session.
Requires Narwhal.
|
@@ -187,9 +187,9 @@ gem install coffee-script
-coffee-script path/to/script.cs
-coffee-script --watch --lint experimental.cs
-coffee-script --print app/scripts/*.cs > concatenation.js
+coffee-script path/to/script.coffee
+coffee-script --watch --lint experimental.coffee
+coffee-script --print app/scripts/*.coffee > concatenation.js
Language Reference
@@ -442,18 +442,18 @@ coffee-script --print app/scripts/*.cs > concatenation.js
Change Log
-
+
- The coffee-script command now includes --interactive,
+ The coffee-script command now includes --interactive,
which launches an interactive CoffeeScript session, and --run,
which directly compiles and executes a script. Both options depend on a
working installation of Narwhal.
- The aint keyword has been replaced by isnt, which goes
+ The aint keyword has been replaced by isnt, which goes
together a little smoother with is.
Quoted strings are now allowed as identifiers within object literals: eg.
{"5+5": 10}.
- All assignment operators now use a colon: +:, -:,
+ All assignment operators now use a colon: +:, -:,
*:, etc.
diff --git a/examples/code.cs b/examples/code.coffee
similarity index 100%
rename from examples/code.cs
rename to examples/code.coffee
diff --git a/examples/documents.cs b/examples/documents.coffee
similarity index 100%
rename from examples/documents.cs
rename to examples/documents.coffee
diff --git a/examples/poignant.cs b/examples/poignant.coffee
similarity index 100%
rename from examples/poignant.cs
rename to examples/poignant.coffee
diff --git a/examples/syntax_errors.cs b/examples/syntax_errors.coffee
similarity index 100%
rename from examples/syntax_errors.cs
rename to examples/syntax_errors.coffee
diff --git a/examples/underscore.cs b/examples/underscore.coffee
similarity index 100%
rename from examples/underscore.cs
rename to examples/underscore.coffee
diff --git a/index.html b/index.html
index 40230798..b4a27c58 100644
--- a/index.html
+++ b/index.html
@@ -162,11 +162,11 @@ gem install coffee-script
Installing the gem provides the coffee-script command, which can
- be used to compile CoffeeScript .cs files into JavaScript, as
- well as debug them. In conjunction with
+ be used to compile CoffeeScript .coffee files into JavaScript, as
+ well as debug them. In conjunction with
Narwhal, the coffee-script
- command also provides direct evaluation and an interactive REPL.
- When compiling to JavaScript, coffee-script writes the output
+ command also provides direct evaluation and an interactive REPL.
+ When compiling to JavaScript, coffee-script writes the output
as .js files in the same directory by default, but output
can be customized with the following options:
@@ -175,7 +175,7 @@ gem install coffee-script
-i, --interactive |
- Launch an interactive CoffeeScript session.
+ Launch an interactive CoffeeScript session.
Requires Narwhal.
|
@@ -257,9 +257,9 @@ gem install coffee-script
-coffee-script path/to/script.cs
-coffee-script --watch --lint experimental.cs
-coffee-script --print app/scripts/*.cs > concatenation.js
+coffee-script path/to/script.coffee
+coffee-script --watch --lint experimental.coffee
+coffee-script --print app/scripts/*.coffee > concatenation.js
Language Reference
@@ -829,18 +829,18 @@ world...";
Change Log
-
+
- The coffee-script command now includes --interactive,
+ The coffee-script command now includes --interactive,
which launches an interactive CoffeeScript session, and --run,
which directly compiles and executes a script. Both options depend on a
working installation of Narwhal.
- The aint keyword has been replaced by isnt, which goes
+ The aint keyword has been replaced by isnt, which goes
together a little smoother with is.
Quoted strings are now allowed as identifiers within object literals: eg.
{"5+5": 10}.
- All assignment operators now use a colon: +:, -:,
+ All assignment operators now use a colon: +:, -:,
*:, etc.
diff --git a/lib/coffee_script/CoffeeScript.tmbundle/Preferences/CoffeeScript.tmPreferences b/lib/coffee_script/CoffeeScript.tmbundle/Preferences/CoffeeScript.tmPreferences
index 5847e50b..bc80ac94 100644
--- a/lib/coffee_script/CoffeeScript.tmbundle/Preferences/CoffeeScript.tmPreferences
+++ b/lib/coffee_script/CoffeeScript.tmbundle/Preferences/CoffeeScript.tmPreferences
@@ -5,7 +5,7 @@
name
comments
scope
- source.cs
+ source.coffee
settings
shellVariables
diff --git a/lib/coffee_script/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage b/lib/coffee_script/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage
index 6a35fb27..927e017d 100644
--- a/lib/coffee_script/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage
+++ b/lib/coffee_script/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage
@@ -6,8 +6,7 @@
CoffeeScript Syntax: version 1
fileTypes
- cs
- coffeescript
+ coffee
name
CoffeeScript
@@ -19,22 +18,22 @@
1
name
- entity.name.function.cs
+ entity.name.function.coffee
2
name
- keyword.operator.cs
+ keyword.operator.coffee
3
name
- variable.parameter.function.cs
+ variable.parameter.function.coffee
4
name
- storage.type.function.cs
+ storage.type.function.coffee
comment
@@ -42,7 +41,7 @@
match
([a-zA-Z_?.$]*)\s*(=|:)\s*([\w,\s]*?)\s*(=>)
name
- meta.function.cs
+ meta.function.coffee
captures
@@ -50,12 +49,12 @@
1
name
- variable.parameter.function.cs
+ variable.parameter.function.coffee
2
name
- storage.type.function.cs
+ storage.type.function.coffee
comment
@@ -63,7 +62,7 @@
match
([a-zA-Z_?., $]*)\s*(=>)
name
- meta.inline.function.cs
+ meta.inline.function.coffee
captures
@@ -71,12 +70,12 @@
1
name
- keyword.operator.new.cs
+ keyword.operator.new.coffee
2
name
- entity.name.type.instance.cs
+ entity.name.type.instance.coffee
match
@@ -88,7 +87,7 @@
match
\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?))\b
name
- constant.numeric.cs
+ constant.numeric.coffee
begin
@@ -98,7 +97,7 @@
0
name
- punctuation.definition.string.begin.cs
+ punctuation.definition.string.begin.coffee
end
@@ -108,18 +107,18 @@
0
name
- punctuation.definition.string.end.cs
+ punctuation.definition.string.end.coffee
name
- string.quoted.single.cs
+ string.quoted.single.coffee
patterns
match
\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)
name
- constant.character.escape.cs
+ constant.character.escape.coffee
@@ -131,7 +130,7 @@
0
name
- punctuation.definition.string.begin.cs
+ punctuation.definition.string.begin.coffee
end
@@ -141,18 +140,18 @@
0
name
- punctuation.definition.string.end.cs
+ punctuation.definition.string.end.coffee
name
- string.quoted.double.cs
+ string.quoted.double.coffee
patterns
match
\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)
name
- constant.character.escape.cs
+ constant.character.escape.coffee
@@ -164,7 +163,7 @@
0
name
- punctuation.definition.string.begin.cs
+ punctuation.definition.string.begin.coffee
end
@@ -174,18 +173,18 @@
0
name
- punctuation.definition.string.end.cs
+ punctuation.definition.string.end.coffee
name
- string.quoted.script.cs
+ string.quoted.script.coffee
patterns
match
\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)
name
- constant.character.escape.cs
+ constant.character.escape.coffee
@@ -195,61 +194,61 @@
1
name
- punctuation.definition.comment.cs
+ punctuation.definition.comment.coffee
match
(#).*$\n?
name
- comment.line.cs
+ comment.line.coffee
match
\b(break|when|catch|continue|else|finally|for|if|return|switch|then|throw|try|unless|while)\b
name
- keyword.control.cs
+ keyword.control.coffee
match
\b(true|on|yes)\b
name
- constant.language.boolean.true.cs
+ constant.language.boolean.true.coffee
match
\b(false|off|no)\b
name
- constant.language.boolean.false.cs
+ constant.language.boolean.false.coffee
match
\bnull\b
name
- constant.language.null.cs
+ constant.language.null.coffee
match
\b(super|this|extends)\b
name
- variable.language.cs
+ variable.language.coffee
match
\b(debugger)\b
name
- keyword.other.cs
+ keyword.other.coffee
match
!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\?|\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|and|or|is|isnt|not)\b
name
- keyword.operator.cs
+ keyword.operator.coffee
match
\b(Infinity|NaN|undefined)\b
name
- constant.language.cs
+ constant.language.coffee
begin
@@ -259,7 +258,7 @@
1
name
- punctuation.definition.string.begin.cs
+ punctuation.definition.string.begin.coffee
end
@@ -269,18 +268,18 @@
1
name
- punctuation.definition.string.end.cs
+ punctuation.definition.string.end.coffee
name
- string.regexp.cs
+ string.regexp.coffee
patterns
match
\\.
name
- constant.character.escape.cs
+ constant.character.escape.coffee
@@ -288,41 +287,41 @@
match
\;
name
- punctuation.terminator.statement.cs
+ punctuation.terminator.statement.coffee
match
,[ |\t]*
name
- meta.delimiter.object.comma.cs
+ meta.delimiter.object.comma.coffee
match
\.
name
- meta.delimiter.method.period.cs
+ meta.delimiter.method.period.coffee
match
\{|\}
name
- meta.brace.curly.cs
+ meta.brace.curly.coffee
match
\(|\)
name
- meta.brace.round.cs
+ meta.brace.round.coffee
match
\[|\]
name
- meta.brace.square.cs
+ meta.brace.square.coffee
scopeName
- source.cs
+ source.coffee
uuid
5B520980-A7D5-4E10-8582-1A4C889A8DE5
diff --git a/lib/coffee_script/command_line.rb b/lib/coffee_script/command_line.rb
index 33439f85..be80a7d6 100644
--- a/lib/coffee_script/command_line.rb
+++ b/lib/coffee_script/command_line.rb
@@ -13,7 +13,7 @@ module CoffeeScript
coffee-script compiles CoffeeScript source files into JavaScript.
Usage:
- coffee-script path/to/script.cs
+ coffee-script path/to/script.coffee
EOS
# Seconds to pause between checks for changed source files.
diff --git a/lib/coffee_script/narwhal/coffee-script.cs b/lib/coffee_script/narwhal/coffee-script.coffee
similarity index 98%
rename from lib/coffee_script/narwhal/coffee-script.cs
rename to lib/coffee_script/narwhal/coffee-script.coffee
index fe474a7f..7c99e87e 100644
--- a/lib/coffee_script/narwhal/coffee-script.cs
+++ b/lib/coffee_script/narwhal/coffee-script.coffee
@@ -1,4 +1,4 @@
-# This (javascript) file is generated from lib/coffee_script/narwhal/coffee-script.cs
+# This (javascript) file is generated from lib/coffee_script/narwhal/coffee-script.coffee
# Executes the `coffee-script` Ruby program to convert from CoffeeScript
# to Javascript. Eventually this will hopefully happen entirely within JS.
diff --git a/lib/coffee_script/narwhal/js/coffee-script.js b/lib/coffee_script/narwhal/js/coffee-script.js
index 34f16f6a..7703a25f 100644
--- a/lib/coffee_script/narwhal/js/coffee-script.js
+++ b/lib/coffee_script/narwhal/js/coffee-script.js
@@ -1,6 +1,6 @@
(function(){
- // This (javascript) file is generated from lib/coffee_script/narwhal/coffee-script.cs Executes the `coffee-script` Ruby program to convert from CoffeeScript
+ // This (javascript) file is generated from lib/coffee_script/narwhal/coffee-script.coffee Executes the `coffee-script` Ruby program to convert from CoffeeScript
// to Javascript. Eventually this will hopefully happen entirely within JS. Require external dependencies.
var OS = require('os');
var File = require('file');
diff --git a/lib/coffee_script/narwhal/js/loader.js b/lib/coffee_script/narwhal/js/loader.js
index 6db0e791..676b4bd8 100644
--- a/lib/coffee_script/narwhal/js/loader.js
+++ b/lib/coffee_script/narwhal/js/loader.js
@@ -1,6 +1,6 @@
(function(){
- // This (javascript) file is generated from lib/coffee_script/narwhal/loader.cs
+ // This (javascript) file is generated from lib/coffee_script/narwhal/loader.coffee
var coffeescript = null;
var factories = {
};
@@ -16,5 +16,5 @@
return factories[topId] = factories[topId] || this.reload(topId, path);
}
};
- require.loader.loaders.unshift([".cs", loader]);
+ require.loader.loaders.unshift([".coffee", loader]);
})();
\ No newline at end of file
diff --git a/lib/coffee_script/narwhal/launcher.cs b/lib/coffee_script/narwhal/launcher.coffee
similarity index 100%
rename from lib/coffee_script/narwhal/launcher.cs
rename to lib/coffee_script/narwhal/launcher.coffee
diff --git a/lib/coffee_script/narwhal/loader.cs b/lib/coffee_script/narwhal/loader.coffee
similarity index 85%
rename from lib/coffee_script/narwhal/loader.cs
rename to lib/coffee_script/narwhal/loader.coffee
index 2405267e..509a533e 100644
--- a/lib/coffee_script/narwhal/loader.cs
+++ b/lib/coffee_script/narwhal/loader.coffee
@@ -1,4 +1,4 @@
-# This (javascript) file is generated from lib/coffee_script/narwhal/loader.cs
+# This (javascript) file is generated from lib/coffee_script/narwhal/loader.coffee
coffeescript: null
factories: {}
@@ -16,4 +16,4 @@ loader: {
}
-require.loader.loaders.unshift([".cs", loader])
+require.loader.loaders.unshift([".coffee", loader])
diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb
index 968037f2..a210f31f 100644
--- a/lib/coffee_script/nodes.rb
+++ b/lib/coffee_script/nodes.rb
@@ -506,32 +506,28 @@ module CoffeeScript
def compile(o={})
o = super(o)
- scope = o[:scope]
- name_found = scope.find(@name)
- index_found = @index && scope.find(@index)
- svar = scope.free_variable
- ivar = scope.free_variable
- lvar = scope.free_variable
- name_part = name_found ? @name : "var #{@name}"
- index_name = @index ? (index_found ? @index : "var #{@index}") : nil
- source_part = "var #{svar} = #{@source.compile(o)};"
- for_part = "var #{ivar}=0, #{lvar}=#{svar}.length; #{ivar}<#{lvar}; #{ivar}++"
- var_part = "\n#{o[:indent] + TAB}#{name_part} = #{svar}[#{ivar}];\n"
- index_part = @index ? "#{o[:indent] + TAB}#{index_name} = #{ivar};\n" : ''
+ scope = o[:scope]
+ name_found = scope.find(@name)
+ index_found = @index && scope.find(@index)
+ svar = scope.free_variable
+ ivar = scope.free_variable
+ lvar = scope.free_variable
+ rvar = scope.free_variable
+ name_part = name_found ? @name : "var #{@name}"
+ index_name = @index ? (index_found ? @index : "var #{@index}") : nil
+ source_part = "var #{svar} = #{@source.compile(o)};"
+ for_part = "var #{ivar}=0, #{lvar}=#{svar}.length; #{ivar}<#{lvar}; #{ivar}++"
+ var_part = "\n#{o[:indent] + TAB}#{name_part} = #{svar}[#{ivar}];\n"
+ index_part = @index ? "#{o[:indent] + TAB}#{index_name} = #{ivar};\n" : ''
+ body = @body
+ suffix = ';'
+ set_result = "var #{rvar} = [];\n#{o[:indent]}"
+ save_result = "#{rvar}[#{ivar}] = "
+ return_result = rvar
- set_result = ''
- save_result = ''
- return_result = ''
- body = @body
- suffix = ';'
if o[:return] || o[:assign]
- rvar = scope.free_variable
- set_result = "var #{rvar} = [];\n#{o[:indent]}"
- save_result += "#{rvar}[#{ivar}] = "
- return_result = rvar
- return_result = "#{o[:assign]} = #{return_result};" if o[:assign]
- return_result = "return #{return_result};" if o[:return]
- return_result = "\n#{o[:indent]}#{return_result}"
+ return_result = "#{o[:assign]} = #{return_result}" if o[:assign]
+ return_result = "return #{return_result}" if o[:return]
if @filter
body = CallNode.new(ValueNode.new(LiteralNode.new(rvar), [AccessorNode.new('push')]), [@body])
body = IfNode.new(@filter, body, nil, :statement => true)
@@ -542,6 +538,7 @@ module CoffeeScript
body = IfNode.new(@filter, @body)
end
+ return_result = "\n#{o[:indent]}#{return_result};"
indent = o[:indent] + TAB
body = body.compile(o.merge(:indent => indent))
write("#{source_part}\n#{o[:indent]}#{set_result}for (#{for_part}) {#{var_part}#{index_part}#{indent}#{save_result}#{body}#{suffix}\n#{o[:indent]}}#{return_result}")
diff --git a/test/fixtures/each.cs b/test/fixtures/each.coffee
similarity index 100%
rename from test/fixtures/each.cs
rename to test/fixtures/each.coffee
diff --git a/test/fixtures/each.js b/test/fixtures/each.js
index 58778639..8536f46a 100644
--- a/test/fixtures/each.js
+++ b/test/fixtures/each.js
@@ -9,17 +9,21 @@
obj.forEach(iterator, context);
} else if (_.isArray(obj) || _.isArguments(obj)) {
var __a = obj;
+ var __d = [];
for (var __b=0, __c=__a.length; __b<__c; __b++) {
var item = __a[__b];
var i = __b;
- iterator.call(context, item, i, obj);
+ __d[__b] = iterator.call(context, item, i, obj);
}
+ __d;
} else {
- var __d = _.keys(obj);
- for (var __e=0, __f=__d.length; __e<__f; __e++) {
- var key = __d[__e];
- iterator.call(context, obj[key], key, obj);
+ var __e = _.keys(obj);
+ var __h = [];
+ for (var __f=0, __g=__e.length; __f<__g; __f++) {
+ var key = __e[__f];
+ __h[__f] = iterator.call(context, obj[key], key, obj);
}
+ __h;
}
} catch (e) {
if (e !== breaker) {
diff --git a/test/fixtures/each_no_wrap.js b/test/fixtures/each_no_wrap.js
index 0d2f6479..5cc80f37 100644
--- a/test/fixtures/each_no_wrap.js
+++ b/test/fixtures/each_no_wrap.js
@@ -8,17 +8,21 @@ _.each = function(obj, iterator, context) {
obj.forEach(iterator, context);
} else if (_.isArray(obj) || _.isArguments(obj)) {
var __a = obj;
+ var __d = [];
for (var __b=0, __c=__a.length; __b<__c; __b++) {
var item = __a[__b];
var i = __b;
- iterator.call(context, item, i, obj);
+ __d[__b] = iterator.call(context, item, i, obj);
}
+ __d;
} else {
- var __d = _.keys(obj);
- for (var __e=0, __f=__d.length; __e<__f; __e++) {
- var key = __d[__e];
- iterator.call(context, obj[key], key, obj);
+ var __e = _.keys(obj);
+ var __h = [];
+ for (var __f=0, __g=__e.length; __f<__g; __f++) {
+ var key = __e[__f];
+ __h[__f] = iterator.call(context, obj[key], key, obj);
}
+ __h;
}
} catch (e) {
if (e !== breaker) {
diff --git a/test/fixtures/execution/array_comprehension.cs b/test/fixtures/execution/array_comprehension.coffee
similarity index 100%
rename from test/fixtures/execution/array_comprehension.cs
rename to test/fixtures/execution/array_comprehension.coffee
diff --git a/test/fixtures/execution/assign_to_try_catch.cs b/test/fixtures/execution/assign_to_try_catch.coffee
similarity index 100%
rename from test/fixtures/execution/assign_to_try_catch.cs
rename to test/fixtures/execution/assign_to_try_catch.coffee
diff --git a/test/fixtures/execution/calling_super.cs b/test/fixtures/execution/calling_super.coffee
similarity index 100%
rename from test/fixtures/execution/calling_super.cs
rename to test/fixtures/execution/calling_super.coffee
diff --git a/test/fixtures/execution/chained_calls.cs b/test/fixtures/execution/chained_calls.coffee
similarity index 100%
rename from test/fixtures/execution/chained_calls.cs
rename to test/fixtures/execution/chained_calls.coffee
diff --git a/test/fixtures/execution/fancy_if_statement.cs b/test/fixtures/execution/fancy_if_statement.coffee
similarity index 100%
rename from test/fixtures/execution/fancy_if_statement.cs
rename to test/fixtures/execution/fancy_if_statement.coffee
diff --git a/test/fixtures/execution/keyword_operators.cs b/test/fixtures/execution/keyword_operators.cs
deleted file mode 100644
index 573de104..00000000
--- a/test/fixtures/execution/keyword_operators.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-a: 5
-atype: typeof a
-
-b: "hello"
-btype: typeof b
-
-Klass: => .
-k: new Klass()
-
-print(atype is 'number' and btype is 'string' and k instanceof Klass)
\ No newline at end of file
diff --git a/test/fixtures/execution/test_everything.cs b/test/fixtures/execution/test_everything.coffee
similarity index 100%
rename from test/fixtures/execution/test_everything.cs
rename to test/fixtures/execution/test_everything.coffee
diff --git a/test/fixtures/execution/test_switch.cs b/test/fixtures/execution/test_switch.coffee
similarity index 100%
rename from test/fixtures/execution/test_switch.cs
rename to test/fixtures/execution/test_switch.coffee
diff --git a/test/fixtures/inner_comments.cs b/test/fixtures/inner_comments.coffee
similarity index 100%
rename from test/fixtures/inner_comments.cs
rename to test/fixtures/inner_comments.coffee
diff --git a/test/unit/test_execution.rb b/test/unit/test_execution.rb
index 26e7975b..8e9d79e8 100644
--- a/test/unit/test_execution.rb
+++ b/test/unit/test_execution.rb
@@ -6,17 +6,17 @@ class ExecutionTest < Test::Unit::TestCase
ALLS_WELL = /\A\n?(true\n)+\Z/
def test_execution_of_coffeescript
- sources = ['test/fixtures/execution/*.cs'].join(' ')
+ sources = ['test/fixtures/execution/*.coffee'].join(' ')
assert `bin/coffee-script -r #{sources}`.match(ALLS_WELL)
end
def test_lintless_coffeescript
- lint_results = `bin/coffee-script -l test/fixtures/execution/*.cs`
+ lint_results = `bin/coffee-script -l test/fixtures/execution/*.coffee`
assert lint_results.match(NO_WARNINGS)
end
def test_lintless_examples
- lint_results = `bin/coffee-script -l examples/*.cs`
+ lint_results = `bin/coffee-script -l examples/*.coffee`
assert lint_results.match(NO_WARNINGS)
end
diff --git a/test/unit/test_lexer.rb b/test/unit/test_lexer.rb
index b626e4f3..09edfd87 100644
--- a/test/unit/test_lexer.rb
+++ b/test/unit/test_lexer.rb
@@ -43,7 +43,7 @@ class LexerTest < Test::Unit::TestCase
end
def test_lexing
- tokens = @lex.tokenize(File.read('test/fixtures/each.cs'))
+ tokens = @lex.tokenize(File.read('test/fixtures/each.coffee'))
assert tokens.inspect == File.read('test/fixtures/each.tokens')
end
diff --git a/test/unit/test_parser.rb b/test/unit/test_parser.rb
index 05943b73..d356dfa1 100644
--- a/test/unit/test_parser.rb
+++ b/test/unit/test_parser.rb
@@ -58,12 +58,12 @@ class ParserTest < Test::Unit::TestCase
end
def test_parsing_inner_comments
- nodes = @par.parse(File.read('test/fixtures/inner_comments.cs'))
+ nodes = @par.parse(File.read('test/fixtures/inner_comments.coffee'))
assert nodes.compile == File.read('test/fixtures/inner_comments.js')
end
def test_parsing
- nodes = @par.parse(File.read('test/fixtures/each.cs'))
+ nodes = @par.parse(File.read('test/fixtures/each.coffee'))
assign = nodes.expressions[1]
assert assign.is_a? AssignNode
assert assign.variable.literal == '_'
@@ -73,7 +73,7 @@ class ParserTest < Test::Unit::TestCase
end
def test_no_wrap
- nodes = @par.parse(File.read('test/fixtures/each.cs'))
+ nodes = @par.parse(File.read('test/fixtures/each.coffee'))
assert nodes.compile(:no_wrap => true) == File.read('test/fixtures/each_no_wrap.js')
end