9a5c59cf0f5b628355b8458437215bd262549e4e
1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 import model
::module_compound
18 var graph
= new ProjectGraph("foo")
19 var file
= new FileCompound(graph
)
20 var file_2
= new FileCompound(graph
)
21 var bar_class
= new ClassCompound(graph
)
22 var baz_class
= new ClassCompound(graph
)
23 var a_ns
= new Namespace(graph
)
24 var b_ns
= new Namespace(graph
)
25 var c_ns
= new Namespace(graph
)
26 var d_ns
= new Namespace(graph
)
27 var buffer
= new RopeBuffer
29 file
.full_name
= "Bar.java"
30 file
.model_id
= "_Bar_8java"
31 file
.declare_class
("classa_b_bar", "a::b::Bar")
32 file
.declare_class
("classbaz", "Baz")
33 file
.declare_namespace
("", "a::b")
36 file_2
.full_name
= "Bar.java"
37 file_2
.model_id
= "_Bar_8java_2"
38 file_2
.declare_namespace
("namespacec", "c")
39 file_2
.declare_namespace
("", "d")
42 bar_class
.model_id
= "classa_b_bar"
43 bar_class
.full_name
= "a::b::Bar"
44 bar_class
.put_in_graph
46 baz_class
.model_id
= "classbaz"
47 baz_class
.full_name
= "Baz"
48 baz_class
.put_in_graph
51 a_ns
.declare_namespace
("", "a::b")
54 b_ns
.full_name
= "a::b"
55 b_ns
.declare_class
("classa_b_bar", "")
58 c_ns
.model_id
= "namespacec"
62 d_ns
.model_id
= "namespaced"
66 print
"---===WITHOUT GLOBALS===---"
71 print
"---===WITH GLOBALS===---"
72 #buffer.clear # Buggy.
73 buffer
= new RopeBuffer
74 graph
.add_global_modules