Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/mjsunit/harmony/module-resolution.js

Issue 9615009: Basic interface inference for modules. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Eps. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/harmony/module-parsing.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 // Flags: --harmony-modules --harmony-scoping
29
30 // Test basic module interface inference.
31
32 "use strict";
33
34 print("begin.")
35
36 export let x = print("0")
37
38 export module B = A.B
39
40 export module A {
41 export let x = print("1")
42 export let f = function() { return B.x }
43 export module B {
44 module BB = B
45 export BB, x
46 let x = print("2")
47 let y = print("3")
48 let Ax = A.x
49 let ABx = A.B.x
50 let Ay = A.y
51 let BBx = BB.x
52 let Af = A.f
53 function f(x,y) { return x }
54 }
55 export let y = print("4")
56 let Ax = A.x
57 let Bx = B.x
58 let ABx = A.B.x
59 module C {
60 export let z = print("5")
61 export module D = B
62 // TODO(rossberg): turn these into proper negative test cases once we have
63 // suitable error messages.
64 // import C.z // multiple declarations
65 import x from B
66 }
67 module D {
68 // TODO(rossberg): Handle import *.
69 // import A.* // invalid forward import
70 }
71 module M {}
72 // TODO(rossberg): Handle import *.
73 // import M.* // invalid forward import
74 let Cz = C.z
75 let CDx = C.D.x
76 }
77
78 export module Imports {
79 module A1 {
80 export module A2 {}
81 }
82 module B {
83 // TODO(rossberg): Handle import *.
84 // import A1.*
85 // import A2.* // unbound variable A2
86 }
87 }
88
89 export module E {
90 export let xx = x
91 export y, B
92 let Bx = B.x
93 // TODO(rossberg): Handle import *.
94 // import A.*
95 }
96
97 export module M1 {
98 export module A2 = M2
99 }
100 export module M2 {
101 export module A1 = M1
102 }
103
104 // TODO(rossberg): turn these into proper negative test cases once we have
105 // suitable error messages.
106 // module W1 = W2.W
107 // module W2 = { export module W = W3 }
108 // module W3 = W1 // cyclic module definition
109
110 // module W1 = W2.W3
111 // module W2 = {
112 // export module W3 = W4
113 // export module W4 = W1
114 // } // cyclic module definition
115
116 // TODO(rossberg): Handle import *.
117 //module M3B = M3.B
118 //export module M3 {
119 // export module B { export let x = "" }
120 // module C1 = { import M3.* }
121 // module C2 = { import M3.B.* }
122 // module C3 = { import M3B.* }
123 // module C4 = { export x import B.* }
124 //// TODO(rossberg): turn these into proper negative test cases once we have
125 //// suitable error messages.
126 //// export module C5 = { import C5.* } // invalid forward import
127 //// export module C6 = { import M3.C6.* } // invalid forward import
128 //}
129
130 export module External at "external.js"
131 export module External1 = External
132 export module ExternalA = External.A
133 export module InnerExternal {
134 export module E at "external.js"
135 }
136 export module External2 = InnerExternal.E
137 //export let xxx = InnerExternal.E.A.x
138
139 print("end.")
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/module-parsing.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698