PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 36ms app.codeStats 0ms

/src/org/ooc/frontend/model/NamespaceDecl.java

http://github.com/nddrylliog/ooc
Java | 57 lines | 42 code | 15 blank | 0 comment | 3 complexity | 5c16d1179358b93f9b314e1dde7f166c MD5 | raw file
 1package org.ooc.frontend.model;
 2
 3import java.io.IOException;
 4
 5import org.ooc.frontend.Visitor;
 6import org.ooc.frontend.model.tokens.Token;
 7
 8public class NamespaceDecl extends Declaration {
 9	private NodeList<Import> imports;
10
11	public NamespaceDecl(String name, Token startToken, Module module) {
12		super(name, startToken, module);
13		imports = new NodeList<Import>(startToken);
14	}
15
16	public void addImport(Import import_) {
17		imports.add(import_);
18	}
19
20	public NodeList<Import> getImports() {
21		return imports;
22	}
23
24	public void acceptChildren(Visitor visitor) throws IOException {
25		
26	}
27
28	public void accept(Visitor visitor) throws IOException {
29	
30	}
31
32	public TypeDecl resolveType(String name) {
33		for(Import imp: imports) {
34			TypeDecl type = imp.getModule().getType(name);
35			if(type != null) return type;
36		}
37		return null;
38	}
39
40	public Type getType() {
41		return null;
42	}
43
44	public boolean hasChildren() {
45		return !imports.isEmpty();
46	}
47
48	@Override
49	public TypeDecl getTypeDecl() {
50		return null;
51	}
52
53	@Override
54	public boolean replace(Node oldie, Node kiddo) {
55		return false;
56	}
57}