forked from lkesteloot/turbopascal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRawData.js
29 lines (24 loc) · 857 Bytes
/
RawData.js
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
// An object that stores a linear array of raw data (constants) and a parallel
// array of their simple type codes.
define(function () {
var RawData = function () {
this.length = 0;
this.data = [];
this.simpleTypeCodes = [];
};
// Adds a piece of data and its simple type (inst.I, etc.) to the list.
RawData.prototype.add = function (datum, simpleTypeCode) {
this.length++;
this.data.push(datum);
this.simpleTypeCodes.push(simpleTypeCode);
};
// Adds a SIMPLE_TYPE node.
RawData.prototype.addNode = function (node) {
this.add(node.getConstantValue(), node.expressionType.getSimpleTypeCode());
};
// Print the array for human debugging.
RawData.prototype.print = function () {
return "(" + this.data.join(", ") + ")";
};
return RawData;
});