Permalink
Browse files

Fixed module.exports bug by reverting the bundled Narcissus to an old…

…er version.
  • Loading branch information...
1 parent d21d400 commit ddb4fead9a99017fa1b5384d57e6d6fbdb48f1cd @pguillory committed Feb 26, 2011
Showing with 219 additions and 2,161 deletions.
  1. +5 −2 bin/bundle-deps.sh
  2. +0 −17 deps/narcissus/harmony-tests/README.txt
  3. +0 −1 deps/narcissus/harmony-tests/fail-execute/eval-export.js
  4. +0 −1 deps/narcissus/harmony-tests/fail-execute/eval-resolve1.js
  5. +0 −1 deps/narcissus/harmony-tests/fail-execute/eval-resolve2.js
  6. +0 −8 deps/narcissus/harmony-tests/fail-execute/module-uninit-read.js
  7. +0 −3 deps/narcissus/harmony-tests/fail-resolve/export-cycle1.js
  8. +0 −7 deps/narcissus/harmony-tests/fail-resolve/export-cycle2.js
  9. +0 −7 deps/narcissus/harmony-tests/fail-resolve/export-cycle3.js
  10. +0 −15 deps/narcissus/harmony-tests/fail-resolve/export-cycle4.js
  11. +0 −1 deps/narcissus/harmony-tests/fail-resolve/export-unbound-var.js
  12. +0 −2 deps/narcissus/harmony-tests/fail-resolve/import-eval1.js
  13. +0 −2 deps/narcissus/harmony-tests/fail-resolve/import-eval2.js
  14. +0 −5 deps/narcissus/harmony-tests/fail-resolve/module-rebind-assignment1.js
  15. +0 −1 deps/narcissus/harmony-tests/fail-resolve/unbound-read.js
  16. +0 −1 deps/narcissus/harmony-tests/fail-resolve/unbound-write.js
  17. +0 −88 deps/narcissus/harmony-tests/run.sh
  18. +0 −5 deps/narcissus/harmony-tests/succeed/eval-import1.js
  19. +0 −5 deps/narcissus/harmony-tests/succeed/eval-import2.js
  20. +0 −9 deps/narcissus/harmony-tests/succeed/eval-module1.js
  21. +0 −4 deps/narcissus/harmony-tests/succeed/eval-module2.js
  22. +0 −5 deps/narcissus/harmony-tests/succeed/eval-resolve1.js
  23. +0 −3 deps/narcissus/harmony-tests/succeed/eval-resolve2.js
  24. +0 −12 deps/narcissus/harmony-tests/succeed/export-bound-var.js
  25. +0 −5 deps/narcissus/harmony-tests/succeed/export-var.js
  26. +0 −3 deps/narcissus/harmony-tests/succeed/global-this.js
  27. +0 −8 deps/narcissus/harmony-tests/succeed/incomplete-module1.js
  28. +0 −9 deps/narcissus/harmony-tests/succeed/incomplete-module2.js
  29. +0 −1 deps/narcissus/harmony-tests/succeed/module-completion.js
  30. +0 −8 deps/narcissus/harmony-tests/succeed/module-rebind1.js
  31. +0 −10 deps/narcissus/harmony-tests/succeed/module-rebind2.js
  32. +0 −9 deps/narcissus/harmony-tests/succeed/module-rebind3.js
  33. +0 −8 deps/narcissus/harmony-tests/succeed/module-this.js
  34. +0 −18 deps/narcissus/harmony-tests/succeed/re-export1.js
  35. +0 −19 deps/narcissus/harmony-tests/succeed/re-export2.js
  36. +0 −7 deps/narcissus/harmony-tests/succeed/uninitialized-module1.js
  37. +0 −9 deps/narcissus/harmony-tests/succeed/uninitialized-module2.js
  38. +0 −14 deps/narcissus/harmony-tests/succeed/uninitialized-module3.js
  39. +6 −284 deps/narcissus/lib/jsdefs.js
  40. +68 −336 deps/narcissus/lib/jsexec.js
  41. +44 −402 deps/narcissus/lib/jsparse.js
  42. +0 −717 deps/narcissus/lib/jsresolve.js
  43. +5 −15 deps/narcissus/njs
  44. +6 −2 test/test.js
  45. +1 −1 test/tests/1. Functions/1. Returning a value/index.js.parsed.json
  46. +1 −1 test/tests/1. Functions/1. Returning a value/index.js_.parsed.json
  47. +1 −1 test/tests/1. Functions/2. Implicitly return undefined/index.js.parsed.json
  48. +1 −1 test/tests/1. Functions/2. Implicitly return undefined/index.js_.parsed.json
  49. +1 −1 test/tests/1. Functions/3. Throws propagate/index.js.parsed.json
  50. +1 −1 test/tests/1. Functions/3. Throws propagate/index.js_.parsed.json
  51. +1 −1 test/tests/1. Functions/4. Call a regular function/index.js.parsed.json
  52. +1 −1 test/tests/1. Functions/4. Call a regular function/index.js_.parsed.json
  53. +1 −1 test/tests/1. Functions/4b. Call a transformed function/index.js.parsed.json
  54. +1 −1 test/tests/1. Functions/4b. Call a transformed function/index.js_.parsed.json
  55. +1 −1 test/tests/1. Functions/5. Pass through async result/index.js.parsed.json
  56. +1 −1 test/tests/1. Functions/5. Pass through async result/index.js_.parsed.json
  57. +1 −1 test/tests/1. Functions/6. Hoist vars/index.js.parsed.json
  58. +1 −1 test/tests/1. Functions/6. Hoist vars/index.js_.parsed.json
  59. +1 −1 ...tests/1. Functions/7. Return expression containing transformed function call/index.js.parsed.json
  60. +1 −1 ...ests/1. Functions/7. Return expression containing transformed function call/index.js_.parsed.json
  61. +1 −1 test/tests/1. Functions/9. Function defined in var/index.js.parsed.json
  62. +1 −1 test/tests/1. Functions/9. Function defined in var/index.js_.parsed.json
  63. +6 −0 test/tests/10. Modules/1. Module keyword/index.js
  64. +1 −0 test/tests/10. Modules/1. Module keyword/index.js.parsed.json
  65. +5 −0 test/tests/10. Modules/1. Module keyword/index.js_
  66. +1 −0 test/tests/10. Modules/1. Module keyword/index.js_.parsed.json
  67. +1 −1 test/tests/2. Streamlined function call/1. In semicolon expression/index.js.parsed.json
  68. +1 −1 test/tests/2. Streamlined function call/1. In semicolon expression/index.js_.parsed.json
  69. +1 −1 test/tests/2. Streamlined function call/2. In var initializer/index.js.parsed.json
  70. +1 −1 test/tests/2. Streamlined function call/2. In var initializer/index.js_.parsed.json
  71. +1 −1 test/tests/2. Streamlined function call/3. In return value/index.js.parsed.json
  72. +1 −1 test/tests/2. Streamlined function call/3. In return value/index.js_.parsed.json
  73. +1 −1 test/tests/2. Streamlined function call/4. In if expression/index.js.parsed.json
  74. +1 −1 test/tests/2. Streamlined function call/4. In if expression/index.js_.parsed.json
  75. +1 −1 test/tests/2. Streamlined function call/5. In throw exception/index.js.parsed.json
  76. +1 −1 test/tests/2. Streamlined function call/5. In throw exception/index.js_.parsed.json
  77. +1 −1 test/tests/2. Streamlined function call/6. In dot/index.js.parsed.json
  78. +1 −1 test/tests/2. Streamlined function call/6. In dot/index.js_.parsed.json
  79. +1 −1 test/tests/3. While/1. Works/index.js.parsed.json
  80. +1 −1 test/tests/3. While/1. Works/index.js_.parsed.json
  81. +1 −1 test/tests/3. While/2. Body/index.js.parsed.json
  82. +1 −1 test/tests/3. While/2. Body/index.js_.parsed.json
  83. +1 −1 test/tests/3. While/3. Break/index.js.parsed.json
  84. +1 −1 test/tests/3. While/3. Break/index.js_.parsed.json
  85. +1 −1 test/tests/3. While/4. Break in else/index.js.parsed.json
  86. +1 −1 test/tests/3. While/4. Break in else/index.js_.parsed.json
  87. +1 −1 test/tests/3. While/5. Continue/index.js.parsed.json
  88. +1 −1 test/tests/3. While/5. Continue/index.js_.parsed.json
  89. +1 −1 test/tests/4. For/1. Works/index.js.parsed.json
  90. +1 −1 test/tests/4. For/1. Works/index.js_.parsed.json
  91. +1 −1 test/tests/4. For/2. Iterates properly/index.js.parsed.json
  92. +1 −1 test/tests/4. For/2. Iterates properly/index.js_.parsed.json
  93. +1 −1 test/tests/4. For/3. Continue/index.js.parsed.json
  94. +1 −1 test/tests/4. For/3. Continue/index.js_.parsed.json
  95. +1 −1 test/tests/5. Switch/1. SFC in discriminant/index.js.parsed.json
  96. +1 −1 test/tests/5. Switch/1. SFC in discriminant/index.js_.parsed.json
  97. +1 −1 test/tests/5. Switch/2. SFC in case/index.js.parsed.json
  98. +1 −1 test/tests/5. Switch/2. SFC in case/index.js_.parsed.json
  99. +1 −1 test/tests/6. Try-catch/8. In a try block/index.js.parsed.json
  100. +1 −1 test/tests/6. Try-catch/8. In a try block/index.js_.parsed.json
  101. +1 −1 test/tests/6. Try-catch/8b. In a catch block/index.js.parsed.json
  102. +1 −1 test/tests/6. Try-catch/8b. In a catch block/index.js_.parsed.json
  103. +1 −1 test/tests/6. Try-catch/8c. In a finally block/index.js.parsed.json
  104. +1 −1 test/tests/6. Try-catch/8c. In a finally block/index.js_.parsed.json
  105. +1 −1 test/tests/7. For-in/1. Basic use/index.js.parsed.json
  106. +1 −1 test/tests/7. For-in/1. Basic use/index.js_.parsed.json
  107. +1 −1 test/tests/7. For-in/2. SFC in object clause/index.js.parsed.json
  108. +1 −1 test/tests/7. For-in/2. SFC in object clause/index.js_.parsed.json
  109. +1 −1 test/tests/8. If/1. thenPart is single return/index.js.parsed.json
  110. +1 −1 test/tests/8. If/1. thenPart is single return/index.js_.parsed.json
  111. +1 −1 test/tests/8. If/1b. elsePart is single return/index.js.parsed.json
  112. +1 −1 test/tests/8. If/1b. elsePart is single return/index.js_.parsed.json
  113. +1 −1 test/tests/9. Throws in expressions/1. Return value/index.js.parsed.json
  114. +1 −1 test/tests/9. Throws in expressions/1. Return value/index.js_.parsed.json
  115. +1 −1 test/tests/9. Throws in expressions/2. Semicolon expression/index.js.parsed.json
  116. +1 −1 test/tests/9. Throws in expressions/2. Semicolon expression/index.js_.parsed.json
  117. +1 −1 test/tests/9. Throws in expressions/3. Var initializer/index.js.parsed.json
  118. +1 −1 test/tests/9. Throws in expressions/3. Var initializer/index.js_.parsed.json
  119. +1 −1 test/tests/9. Throws in expressions/4. If condition/index.js.parsed.json
  120. +1 −1 test/tests/9. Throws in expressions/4. If condition/index.js_.parsed.json
View
@@ -5,8 +5,11 @@ cd ..
rm -rf deps-temp
mkdir deps-temp
pushd deps-temp
-git clone https://github.com/mozilla/narcissus.git narcissus
-find . -name .git | xargs rm -rf
+ git clone https://github.com/mozilla/narcissus.git narcissus
+ pushd narcissus
+ git checkout 7fdd86b99a9e9321c41f
+ popd
+ find . -name .git | xargs rm -rf
popd
rm -rf deps
mv deps-temp deps
@@ -1,17 +0,0 @@
-This directory contains tests for experimental Harmony features.
-
-NOTE: Please don't fork this test suite without talking to me first!
-
-I purposefully created almost no test harness whatsoever -- just a stupid shell
-script that uses directory structure to figure out expected results. This is
-because:
-
-a) I don't want to write Yet Another Test Harness; and
-
-b) I'd like these tests to get eaten up by some other test suite eventually.
-
-So *please* talk to me first before forking; it's probably much better to
-adapt these tests directly.
-
-Dave Herman
-dherman@mozilla.com
@@ -1 +0,0 @@
-eval("var x = 42; export x;");
@@ -1 +0,0 @@
-eval("xyzzx")
@@ -1 +0,0 @@
-(function(x) { return eval("xyzzx") })("foo");
@@ -1,8 +0,0 @@
-module A {
- import B.foo;
- var x = foo;
-}
-
-module B {
- export var foo = 12;
-}
@@ -1,3 +0,0 @@
-module M {
- export M.foo;
-}
@@ -1,7 +0,0 @@
-module M {
- export N.foo;
-}
-
-module N {
- export M.foo;
-}
@@ -1,7 +0,0 @@
-module M {
- export { foo: N.bar };
-}
-
-module N {
- export { bar: M.foo };
-}
@@ -1,15 +0,0 @@
-module M {
- export { foo: N.bar };
-}
-
-module N {
- export { bar: O.baz };
-}
-
-module O {
- export { baz: P.buz };
-}
-
-module P {
- export { buz: M.foo };
-}
@@ -1 +0,0 @@
-module M { export x }
@@ -1,2 +0,0 @@
-eval("module M { export var foo = 42 }");
-import M.foo;
@@ -1,2 +0,0 @@
-eval("module M { export var foo = 42 }");
-var x = M.foo;
@@ -1,5 +0,0 @@
-module P { export module A { export var a = 12 } }
-
-module B = P.A
-
-B.a = 13;
@@ -1 +0,0 @@
-var foo = someUnboundVariable;
@@ -1 +0,0 @@
-someUnboundVariable = 12;
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-HERE=`dirname $0`
-ROOT=$HERE/..
-
-cd $ROOT
-
-FAILURES=
-
-################################################################################
-
-echo Running harmony-tests/succeed...
-
-SUCCEED_PASS=0
-SUCCEED_FAIL=0
-
-for f in harmony-tests/succeed/*.js ; do
- ./njs -H -f $f >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- SUCCEED_PASS=$(($SUCCEED_PASS + 1))
- else
- SUCCEED_FAIL=$(($SUCCEED_FAIL + 1))
- FAILURES="$FAILURES $f"
- fi
-done
-
-echo "==> $SUCCEED_PASS passed, $SUCCEED_FAIL failed."
-
-################################################################################
-
-echo
-echo Running harmony-tests/fail-resolve...
-
-FAIL_RESOLVE_PASS=0
-FAIL_RESOLVE_FAIL=0
-
-for f in harmony-tests/fail-resolve/*.js ; do
- ./njs -H -E "Narcissus.resolver.resolve(Narcissus.parser.parse(snarf('$f')),Narcissus.interpreter.globalStaticEnv)" >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- FAIL_RESOLVE_FAIL=$((FAIL_RESOLVE_FAIL + 1))
- FAILURES="$FAILURES $f"
- else
- FAIL_RESOLVE_PASS=$((FAIL_RESOLVE_PASS + 1))
- fi
-done
-
-echo "==> $FAIL_RESOLVE_PASS passed, $FAIL_RESOLVE_FAIL failed."
-
-################################################################################
-
-echo
-echo Running harmony-tests/fail-execute...
-
-FAIL_EXECUTE_PASS=0
-FAIL_EXECUTE_FAIL=0
-
-for f in harmony-tests/fail-execute ; do
- ./njs -H -f $f >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- FAIL_EXECUTE_FAIL=$(($FAIL_EXECUTE_FAIL + 1))
- FAILURES="$FAILURES $f"
- else
- FAIL_EXECUTE_PASS=$(($FAIL_EXECUTE_PASS + 1))
- fi
-done
-
-echo "==> $FAIL_EXECUTE_PASS passed, $FAIL_EXECUTE_FAIL failed."
-
-################################################################################
-
-echo
-echo TOTAL:
-
-TOTAL_PASS=$(($SUCCEED_PASS + $FAIL_EXECUTE_PASS + $FAIL_RESOLVE_PASS))
-TOTAL_FAIL=$(($SUCCEED_FAIL + $FAIL_EXECUTE_FAIL + $FAIL_RESOLVE_FAIL))
-
-echo "==> $TOTAL_PASS passed, $TOTAL_FAIL failed."
-
-if [ $TOTAL_FAIL -gt 0 ]; then
- echo
- echo Failures:
- for f in $FAILURES ; do
- echo " $f"
- done
- exit 1
-else
- exit 0
-fi
@@ -1,5 +0,0 @@
-module M {
- export var foo = 42;
-}
-
-assertEq(eval("import M.foo; foo"), 42);
@@ -1,5 +0,0 @@
-module M {
- export var foo = "foo";
-}
-
-assertEq(eval("module M { export var bar = 'bar' } import M.bar; bar"), "bar");
@@ -1,9 +0,0 @@
-module M {
- export var foo = "foo";
-}
-
-var foo = M.foo;
-var bar = eval("module M { export var bar = 'bar'; } M.bar");
-
-assertEq(foo, "foo");
-assertEq(bar, "bar");
@@ -1,4 +0,0 @@
-var M1 = eval("module M { } M");
-var M2 = eval("module M { } M");
-
-assertEq(M1 === M2, false);
@@ -1,5 +0,0 @@
-var foo = 42;
-
-var myfoo = eval("foo");
-
-assertEq(foo, myfoo);
@@ -1,3 +0,0 @@
-var foo = (function(x) { return eval("x") })("foo");
-
-assertEq(foo, "foo");
@@ -1,12 +0,0 @@
-module M {
- import N.x;
- export x;
-}
-
-module N {
- var x = 42;
- export x;
-}
-
-assertEq(M.x, 42);
-assertEq(N.x, 42);
@@ -1,5 +0,0 @@
-module M {
- export var foo = 42;
-}
-
-assertEq(M.foo, 42);
@@ -1,3 +0,0 @@
-var global = this;
-
-assertEq("global" in global, true);
@@ -1,8 +0,0 @@
-var saved;
-
-module M {
- saved = M;
- export var foo = 42;
-}
-
-assertEq("foo" in saved, true);
@@ -1,9 +0,0 @@
-var saved;
-
-module M {
- export var foo = 42;
- var tmp = M;
- saved = tmp.foo;
-}
-
-assertEq(saved, 42);
@@ -1 +0,0 @@
-assertEq(eval("module M { export var foo = 42 }").foo, 42);
@@ -1,8 +0,0 @@
-module P {
- module A { export var a = 12 }
- export A
-}
-
-module B = P.A
-
-assertEq(B.a, 12);
@@ -1,10 +0,0 @@
-module P {
- module A { export var a = 12 }
- export A
-}
-
-module B = P.A, C = P.A, D = P.A;
-
-assertEq(B.a, 12);
-assertEq(C.a, 12);
-assertEq(D.a, 12);
@@ -1,9 +0,0 @@
-module M {
- export var foo = 42;
- export module N {
- module M;
- export var foo = M.foo
- }
-}
-
-assertEq(M.foo, M.N.foo);
@@ -1,8 +0,0 @@
-var saved;
-
-module M {
- saved = this;
- export var foo = 42;
-}
-
-assertEq("foo" in saved, true);
@@ -1,18 +0,0 @@
-module M {
- export module N {
- export var foo = 42;
- export var bar = "hello world";
- }
-}
-
-module Q {
- export {
- foo: M.N.bar,
- bar: M.N.foo
- }
-}
-
-assertEq(Q.foo, "hello world");
-assertEq(Q.bar, 42);
-assertEq(Q.foo, M.N.bar);
-assertEq(Q.bar, M.N.foo);
@@ -1,19 +0,0 @@
-module M {
- export module N {
- export var foo = 42;
- export var bar = "hello world";
- }
-}
-
-module Q {
- module MN = M.N;
- export {
- foo: MN.bar,
- bar: MN.foo
- }
-}
-
-assertEq(Q.foo, "hello world");
-assertEq(Q.bar, 42);
-assertEq(Q.foo, M.N.bar);
-assertEq(Q.bar, M.N.foo);
@@ -1,7 +0,0 @@
-var saved = M;
-
-module M {
- export var foo = 42;
-}
-
-assertEq(saved.foo, 42);
@@ -1,9 +0,0 @@
-var saved = M.N;
-
-module M {
- export module N {
- export var foo = 42;
- }
-}
-
-assertEq(saved.foo, 42);
@@ -1,14 +0,0 @@
-var saved;
-
-module M {
- module N {
- saved = M.O.P;
- }
- export module O {
- export module P {
- export var foo = 42;
- }
- }
-}
-
-assertEq(saved.foo, 42);
Oops, something went wrong.

0 comments on commit ddb4fea

Please sign in to comment.