Pārlūkot izejas kodu

Fix compiler bug when trying to access full argument list

Matt Coles 9 gadi atpakaļ
vecāks
revīzija
5ddee93319
2 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 1 1
      compiler.js
  2. 2 0
      examples/fizzbuzz.mc

+ 1 - 1
compiler.js

@@ -406,7 +406,7 @@ var generator = function (node) {
406 406
       return '{ value: \'' + node.value + '\' }'
407 407
       break
408 408
     case 'ArgvLiteral':
409
-      if (node.value === 0) {
409
+      if (node.value === '0') {
410 410
         return '{ value: process.argv.slice(2).join(\' \') }'
411 411
       } else {
412 412
         return '_.__get_arg(' + (+node.value+1) + ')'

+ 2 - 0
examples/fizzbuzz.mc

@@ -11,5 +11,7 @@
11 11
   )
12 12
 1)
13 13
 
14
+(log {0})
15
+
14 16
 (if (eq {1} "")
15 17
   (fizzbuzz 25) | (fizzbuzz {1}))