Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
|
Jakob Kummerow
2012/02/28 14:04:09
nit: 2012 :-)
| |
| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 29 | 29 |
| 30 // Test basic module syntax, with and without ASI. | 30 // Test basic module syntax, with and without ASI. |
| 31 | 31 |
| 32 module A {} | 32 module A {} |
| 33 | 33 |
| 34 module A1 = A | 34 module A1 = A |
| 35 module A2 = A; | 35 module A2 = A; |
| 36 module A3 = A2 | 36 module A3 = A2 |
| 37 | 37 |
| 38 module B { | 38 module B { |
| 39 var x | 39 export x |
| 40 var x, y; | 40 export y, z, c, f |
| 41 var x = 0, y | 41 |
| 42 let x, y | 42 var vx |
| 43 let z = 1 | 43 var vx, vy; |
| 44 var vx = 0, vy | |
| 45 let lx, ly | |
| 46 let lz = 1 | |
| 44 const c = 9 | 47 const c = 9 |
| 45 function f() {} | 48 function f() {} |
| 49 | |
| 46 module C { | 50 module C { |
| 47 let x | 51 let x |
| 48 module D {} | 52 module D {} |
| 49 let y | 53 let y |
| 50 } | 54 } |
| 55 | |
| 51 let zz = "" | 56 let zz = "" |
| 57 | |
| 58 export var x0 | |
| 59 export var x1, x2 = 6, x3 | |
| 60 export let y0 | |
| 61 export let y1 = 0, y2 | |
| 62 export const z0 = 0 | |
| 63 export const z1 = 2, z2 = 3 | |
| 64 export function f0() {} | |
| 65 export module M1 {} | |
| 66 export module M2 = C.D | |
| 67 export module M3 at "http://where" | |
| 68 | |
| 69 import i0 from I | |
| 70 import i1, i2, i3 from I | |
| 71 import i4, i5 from "http://where" | |
| 52 } | 72 } |
| 53 | 73 |
| 54 module C1 = B.C; | 74 module C1 = B.C; |
| 55 module D1 = B.C.D | 75 module D1 = B.C.D |
| 56 module D2 = C1.D | 76 module D2 = C1.D |
| 57 module D3 = D2 | 77 module D3 = D2 |
| 58 | 78 |
| 59 module E1 at "http://where" | 79 module E1 at "http://where" |
| 60 module E2 at "http://where"; | 80 module E2 at "http://where"; |
| 61 module E3 = E1.F | 81 module E3 = E1.F |
| 62 | 82 |
| 63 | 83 |
| 64 // Check that ASI does not interfere. | 84 // Check that ASI does not interfere. |
| 65 | 85 |
| 66 module X | 86 module X |
| 67 { | 87 { |
| 68 let x | 88 let x |
| 69 } | 89 } |
| 70 | 90 |
| 71 module Y | 91 module Y |
| 72 = | 92 = |
| 73 X | 93 X |
| 74 | 94 |
| 75 module Z | 95 module Z |
| 76 at | 96 at |
| 77 "file://local" | 97 "file://local" |
| 78 | 98 |
| 99 import | |
| 100 x | |
| 101 , | |
| 102 y | |
| 103 from | |
| 104 "file://local" | |
| 105 | |
| 106 module Wrap { | |
| 107 export | |
| 108 x | |
| 109 , | |
| 110 y | |
| 111 | |
| 112 export | |
| 113 var | |
| 114 v1 = 1 | |
| 115 | |
| 116 export | |
| 117 let | |
| 118 v2 = 2 | |
| 119 | |
| 120 export | |
| 121 const | |
| 122 v3 = 3 | |
| 123 | |
| 124 export | |
| 125 function | |
| 126 f | |
| 127 ( | |
| 128 ) | |
| 129 { | |
| 130 } | |
| 131 | |
| 132 export | |
| 133 module V | |
| 134 { | |
| 135 } | |
| 136 } | |
| 137 | |
| 79 | 138 |
| 80 // Check that 'module' still works as an identifier. | 139 // Check that 'module' still works as an identifier. |
| 81 | 140 |
| 82 var module | 141 var module |
| 83 module = {} | 142 module = {} |
| 84 module["a"] = 6 | 143 module["a"] = 6 |
| 85 function module() {} | 144 function module() {} |
| 86 function f(module) { return module } | 145 function f(module) { return module } |
| 87 try {} catch (module) {} | 146 try {} catch (module) {} |
| 88 | 147 |
| 89 module | 148 module |
| 90 v = 20 | 149 v = 20 |
| OLD | NEW |