/
Packfile.winxed
51 lines (44 loc) · 1.29 KB
/
Packfile.winxed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2011-2012, Parrot Foundation.
class PACT.Packfile
{
var subs;
var name;
var root_ns;
var constants;
function Packfile(string name)
{
self.name = name;
self.root_ns = new PACT.Packfile.Namespace("");
self.constants = [];
}
function get_root_ns()
{
return self.root_ns;
}
function get_namespace(var name)
{
return self.root_ns.get_child_ns(name);
}
// BCG: ns optional, perhaps?
function new_sub(string name, var ns)
{
if (ns == null)
ns = self.root_ns;
var s = new PACT.Packfile.Subroutine(self, name, ns);
}
// BCG: I'm not sure I'd worry about a constant table at this level.
// I think the PackfileConstantTable has convenient methods to
// deal with addition and de-dup when we output.
// It's simpler if we don't have to worry about it until then.
function add_constant(var constant)
{
// TODO: We need to de-duplicate. Do we do that on input or do that
// on output?
push(self.constants, constant);
}
// BCG: Again with wanting an inverse and doing it as a stage.
function get_packfile()
{
// TODO: This is the biggie. Create the entire Packfile PMC structure
}
}