coffee-script 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,12 +5,13 @@ module CoffeeScript
5
5
  # whether a variable has been seen before or if it needs to be declared.
6
6
  class Scope
7
7
 
8
- attr_reader :parent, :expressions, :variables, :temp_variable
8
+ attr_reader :parent, :expressions, :function, :variables, :temp_variable
9
9
 
10
10
  # Initialize a scope with its parent, for lookups up the chain,
11
- # as well as the Expressions body where it should declare its variables.
12
- def initialize(parent, expressions)
13
- @parent, @expressions = parent, expressions
11
+ # as well as the Expressions body where it should declare its variables,
12
+ # and the function that it wraps.
13
+ def initialize(parent, expressions, function)
14
+ @parent, @expressions, @function = parent, expressions, function
14
15
  @variables = {}
15
16
  @temp_variable = @parent ? @parent.temp_variable.dup : '__a'
16
17
  end
@@ -44,7 +45,7 @@ module CoffeeScript
44
45
  def free_variable
45
46
  @temp_variable.succ! while check(@temp_variable)
46
47
  @variables[@temp_variable.to_sym] = :var
47
- @temp_variable.dup
48
+ Value.new(@temp_variable.dup)
48
49
  end
49
50
 
50
51
  # Ensure that an assignment is made at the top of scope (or top-level
@@ -2,6 +2,8 @@ module CoffeeScript
2
2
 
3
3
  # Instead of producing raw Ruby objects, the Lexer produces values of this
4
4
  # class, wrapping native objects tagged with line number information.
5
+ # Values masquerade as both strings and nodes -- being used both as nodes in
6
+ # the AST, and as literally-interpolated values in the generated code.
5
7
  class Value
6
8
  attr_reader :value, :line
7
9
 
@@ -45,6 +47,18 @@ module CoffeeScript
45
47
  def match(regex)
46
48
  @value.match(regex)
47
49
  end
50
+
51
+ def children
52
+ []
53
+ end
54
+
55
+ def statement_only?
56
+ false
57
+ end
58
+
59
+ def contains?
60
+ false
61
+ end
48
62
  end
49
63
 
50
64
  end
data/package.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "description": "Unfancy JavaScript",
6
6
  "keywords": ["javascript", "language"],
7
7
  "author": "Jeremy Ashkenas",
8
- "version": "0.2.5"
8
+ "version": "0.2.6"
9
9
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffee-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-13 00:00:00 -05:00
12
+ date: 2010-01-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15