Use the friendlier accessors in more places

This commit is contained in:
Tony Garnock-Jones 2019-05-30 14:22:24 +01:00
parent 4660f21251
commit c6e780b50a
4 changed files with 15 additions and 12 deletions

View File

@ -249,7 +249,7 @@ describe('skeleton', () => {
expect(trace.size).to.equal(8);
});
it('should have a correct 3-EVENT subtrace', () => {
expect(trace.filter((e) => { return e.get(0) === "3-EVENT"; }))
expect(trace.filter((e) => { return Event._label(e) === "3-EVENT"; }))
.to.equal(Immutable.List([
Event("3-EVENT", Skeleton.EVENT_ADDED, [123, 234]),
Event("3-EVENT", Skeleton.EVENT_ADDED, [999, 999]),
@ -258,7 +258,7 @@ describe('skeleton', () => {
Event("3-EVENT", Skeleton.EVENT_REMOVED, [123, 234])]));
});
it('should have a correct 2-EVENT subtrace', () => {
expect(trace.filter((e) => { return e.get(0) === "2-EVENT"; }))
expect(trace.filter((e) => { return Event._label(e) === "2-EVENT"; }))
.to.equal(Immutable.List([
Event("2-EVENT", Skeleton.EVENT_ADDED, []),
Event("2-EVENT", Skeleton.EVENT_MESSAGE, []),

View File

@ -57,18 +57,19 @@ export function htmlToString(j) {
function walk(j) {
if (htmlTag.isClassOf(j)) {
pieces.push('<', j.get(0));
j.get(1).forEach(
(p) => pieces.push(' ', escapeHtml(p.get(0)), '="', escapeHtml(p.get(1)), '"'));
pieces.push('<', htmlTag._label(j));
htmlTag._properties(j).forEach(
(p) => pieces.push(' ', escapeHtml(htmlProperty._key(p)),
'="', escapeHtml(htmlProperty._value(p)), '"'));
pieces.push('>');
j.get(2).forEach(walk);
if (!(j.get(0) in emptyHtmlElements)) {
pieces.push('</', j.get(0), '>');
htmlTag._children(j).forEach(walk);
if (!(htmlTag._label(j) in emptyHtmlElements)) {
pieces.push('</', htmlTag._label(j), '>');
}
} else if (htmlFragment.isClassOf(j)) {
j.get(0).forEach(walk);
htmlFragment._children(j).forEach(walk);
} else if (htmlLiteral.isClassOf(j)) {
pieces.push(j.get(0));
pieces.push(htmlLiteral._text(j));
} else if (typeof j === 'object' && j && typeof j[Symbol.iterator] === 'function') {
for (let k of j) { walk(k); }
} else {

View File

@ -70,7 +70,7 @@ spawn named '@syndicate-lang/server/server/POAHandler' {
currentFacet().addEndpoint(() => {
if (Observe.isClassOf(this.assertion)) {
const spec = P.Envelope(this.scope, this.assertion.get(0));
const spec = P.Envelope(this.scope, Observe._specification(this.assertion));
const analysis = Skeleton.analyzeAssertion(spec);
analysis.callback = Dataspace.wrap((evt, vs) => {
currentFacet().actor.scheduleScript(() => {

View File

@ -23,9 +23,11 @@ assertion type Tick(who, n);
assertion type Tock(msg);
assertion type Tack(who);
assertion type Employee(id);
spawn named 'workerMain' {
const myData = require('worker_threads').workerData;
const limit = myData.get(0) === 1 ? 2 : 3;
const limit = Employee._id(myData) === 1 ? 2 : 3;
const me = myData.toString();