| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Flags: --harmony-modules --harmony-scoping | 28 // Flags: --harmony-modules --harmony-scoping |
| 29 | 29 |
| 30 // Test basic module interface inference. | 30 // Test basic module interface inference. |
| 31 | 31 |
| 32 "use strict"; | 32 "use strict"; |
| 33 | 33 |
| 34 print("begin.") | 34 print("begin.") |
| 35 | 35 |
| 36 |
| 36 export let x = print("0") | 37 export let x = print("0") |
| 37 | 38 |
| 38 export module B = A.B | 39 export module B = A.B |
| 39 | 40 |
| 40 export module A { | 41 export module A { |
| 41 export let x = print("1") | 42 export let x = print("1") |
| 42 export let f = function() { return B.x } | 43 export let f = function() { return B.x } |
| 43 export module B { | 44 export module B { |
| 44 module BB = B | 45 module BB = B |
| 45 export BB, x | 46 export BB, x |
| 46 let x = print("2") | 47 let x = print("2") |
| 47 let y = print("3") | 48 var y = print("3") |
| 48 let Ax = A.x | 49 let Ax = A.x |
| 50 try { A.y } catch (e) {} // throws |
| 51 let Az = A.z // undefined |
| 52 let Az2 = z // undefined |
| 53 A.g() // hoisted |
| 54 g() // hoisted |
| 49 let ABx = A.B.x | 55 let ABx = A.B.x |
| 50 let Ay = A.y | 56 let ABy = A.B.y |
| 57 let Bx = B.x |
| 58 let By = B.y |
| 51 let BBx = BB.x | 59 let BBx = BB.x |
| 60 let BBy = BB.y |
| 52 let Af = A.f | 61 let Af = A.f |
| 53 function f(x,y) { return x } | 62 function f(x,y) { return x } |
| 54 } | 63 } |
| 55 export let y = print("4") | 64 export let y = print("4") |
| 65 export var z = print("4.1") |
| 66 export function g() {} |
| 56 let Ax = A.x | 67 let Ax = A.x |
| 57 let Bx = B.x | 68 let Bx = B.x |
| 58 let ABx = A.B.x | 69 let ABx = A.B.x |
| 59 module C { | 70 module C { |
| 60 export let z = print("5") | 71 export let z = print("5") |
| 61 export module D = B | 72 export module D = B |
| 62 // TODO(rossberg): turn these into proper negative test cases once we have | 73 // TODO(rossberg): turn these into proper negative test cases once we have |
| 63 // suitable error messages. | 74 // suitable error messages. |
| 64 // import C.z // multiple declarations | 75 // import C.z // multiple declarations |
| 65 import x from B | 76 import x from B |
| (...skipping 19 matching lines...) Expand all Loading... |
| 85 // import A2.* // unbound variable A2 | 96 // import A2.* // unbound variable A2 |
| 86 } | 97 } |
| 87 } | 98 } |
| 88 | 99 |
| 89 export module E { | 100 export module E { |
| 90 export let xx = x | 101 export let xx = x |
| 91 export y, B | 102 export y, B |
| 92 let Bx = B.x | 103 let Bx = B.x |
| 93 // TODO(rossberg): Handle import *. | 104 // TODO(rossberg): Handle import *. |
| 94 // import A.* | 105 // import A.* |
| 106 module B = A.B |
| 107 let y = A.y |
| 95 } | 108 } |
| 96 | 109 |
| 97 export module M1 { | 110 export module M1 { |
| 98 export module A2 = M2 | 111 export module A2 = M2 |
| 99 } | 112 } |
| 100 export module M2 { | 113 export module M2 { |
| 101 export module A1 = M1 | 114 export module A1 = M1 |
| 102 } | 115 } |
| 103 | 116 |
| 104 // TODO(rossberg): turn these into proper negative test cases once we have | 117 // TODO(rossberg): turn these into proper negative test cases once we have |
| (...skipping 25 matching lines...) Expand all Loading... |
| 130 export module External at "external.js" | 143 export module External at "external.js" |
| 131 export module External1 = External | 144 export module External1 = External |
| 132 //export module ExternalA = External.A | 145 //export module ExternalA = External.A |
| 133 export module InnerExternal { | 146 export module InnerExternal { |
| 134 export module E at "external.js" | 147 export module E at "external.js" |
| 135 } | 148 } |
| 136 export module External2 = InnerExternal.E | 149 export module External2 = InnerExternal.E |
| 137 //export let xxx = InnerExternal.E.A.x | 150 //export let xxx = InnerExternal.E.A.x |
| 138 | 151 |
| 139 print("end.") | 152 print("end.") |
| OLD | NEW |