Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
chore(build): Regenerate compiler assets
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <Jerome.Simeon@docusign.com>
  • Loading branch information
Jerome Simeon authored and Jerome Simeon committed Mar 9, 2022
1 parent fce8220 commit 6984c2a
Show file tree
Hide file tree
Showing 10 changed files with 39,481 additions and 53,907 deletions.
14,172 changes: 7,086 additions & 7,086 deletions package-lock.json

Large diffs are not rendered by default.

26,990 changes: 11,091 additions & 15,899 deletions packages/ergo-cli/extracted/ergoccore.js

Large diffs are not rendered by default.

25,535 changes: 10,359 additions & 15,176 deletions packages/ergo-cli/extracted/ergotopcore.js

Large diffs are not rendered by default.

26,581 changes: 10,890 additions & 15,691 deletions packages/ergo-compiler/extracted/compilercore.js

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions packages/ergo-compiler/test/logicmanager.js
Expand Up @@ -86,20 +86,20 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should register a logic file to the script manager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should succeed creating a dispatch call for a JS logic file with a contract class (ES6)', () => {
Expand Down Expand Up @@ -195,9 +195,9 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogic(false).then((logicCode) => {
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});
});

Expand All @@ -211,16 +211,16 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test3.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should load a logic file (without extension) to the script manager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should set the contract name', () => {
Expand All @@ -236,38 +236,38 @@ describe('LogicManager', () => {
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.getTarget().should.equal('es6');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.setTarget('es6', true);
logicManager.getTarget().should.equal('es6');
const contractName = 'org.accordproject.helloemit.HelloWorld';
logicManager.setContractName(contractName);
logicManager.getContractName().should.equal(ErgoCompiler.contractCallName(contractName));
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should fail to create init and dispatch for ES6 without a contract name', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.getTarget().should.equal('es6');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should set the compilation target to ES6 but not recompile the logic', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.setTarget('es6', false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

it('should fail to create init code for Java', () => {
const logicManager = new LogicManager('java');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.getTarget().should.equal('java');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(10592);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(10596);
});

it('should load a model without a name to the model manager', () => {
Expand Down Expand Up @@ -299,7 +299,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135644);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135676);
});

it('should load a directory with formula', async function () {
Expand All @@ -314,7 +314,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66748);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66768);
});
});

Expand All @@ -332,7 +332,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135644);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135676);
});

it('should load a Zip with formula', async function () {
Expand All @@ -348,7 +348,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66748);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66768);
});
});

Expand All @@ -370,7 +370,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135644);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135676);
});

it('should load a Zip with formula', async function () {
Expand All @@ -390,7 +390,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66748);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66768);
});
});

Expand Down Expand Up @@ -455,15 +455,15 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.updateLogic(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.updateLogic(ergoSample,'testNEW.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
logicManager.updateLogic(ergoSample3,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47852);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47864);
});

});
Expand Down
12 changes: 6 additions & 6 deletions packages/ergo-compiler/test/scriptmanager.js
Expand Up @@ -62,8 +62,8 @@ describe('ScriptManager', () => {
scriptManager.getLogic().map(x => x.name).should.deep.equal(['test.ergo']);
scriptManager.allFunctionDeclarations().length.should.equal(2);
scriptManager.allFunctionDeclarations().map(x => x.getName()).should.deep.equal(['paymentClause','__dispatch']);
scriptManager.getCompiledScript().getContents().length.should.equal(47852);
scriptManager.getCompiledJavaScript().length.should.equal(47852);
scriptManager.getCompiledScript().getContents().length.should.equal(47864);
scriptManager.getCompiledJavaScript().length.should.equal(47864);
scriptManager.allFunctionDeclarations().length.should.equal(152);
scriptManager.allFunctionDeclarations().filter(x => x.name === '__init').length.should.equal(1);
expect(scriptManager.hasInit()).to.not.throw;
Expand All @@ -76,8 +76,8 @@ describe('ScriptManager', () => {
const script2 = scriptManager.createScript('test.ergo','.ergo',ergoSample);
scriptManager.addScript(script1);
scriptManager.addScript(script2);
scriptManager.compileLogic().getContents().length.should.equal(47852);
scriptManager.getCompiledScript().getContents().length.should.equal(47852);
scriptManager.compileLogic().getContents().length.should.equal(47864);
scriptManager.getCompiledScript().getContents().length.should.equal(47864);
scriptManager.getAllScripts().length.should.equal(3);
});

Expand Down Expand Up @@ -182,8 +182,8 @@ describe('ScriptManager', () => {
const script2 = scriptManager.createScript('test.ergo','.ergo',ergoSample);
scriptManager.addScript(script1);
scriptManager.addScript(script2);
scriptManager.compileLogic().getContents().length.should.equal(47852);
scriptManager.getCompiledJavaScript().length.should.equal(47852);
scriptManager.compileLogic().getContents().length.should.equal(47864);
scriptManager.getCompiledJavaScript().length.should.equal(47864);
scriptManager.clearScripts();
return (() => scriptManager.getCompiledJavaScript()).should.throw('Did not find any compiled JavaScript logic');
});
Expand Down
8 changes: 4 additions & 4 deletions runtimes/javascript/ergo-runtime-core.js
Expand Up @@ -219,17 +219,17 @@ function either(v) {
}
throw new Error('TypeError: either called on non-sum');
}
function toLeft(v) {
function getLeft(v) {
if (typeof v === 'object' && isLeft(v)) {
return unboxLeft(v);
}
throw new Error('TypeError: toLeft called on non-sum');
throw new Error('TypeError: getLeft called on non-sum');
}
function toRight(v) {
function getRight(v) {
if (typeof v === 'object' && isRight(v)) {
return unboxRight(v);
}
throw new Error('TypeError: toRight called on non-sum');
throw new Error('TypeError: getRight called on non-sum');
}

/* Brand */
Expand Down
8 changes: 4 additions & 4 deletions runtimes/javascript/ergo-runtime-error.js
Expand Up @@ -15,14 +15,14 @@
/* Unwrapping errors on output */
function unwrapError(result) {
if (result.hasOwnProperty('$left')) {
return toLeft(result);
return getLeft(result);
} else {
var failure = toRight(result);
var failure = getRight(result);
var message = "Unknown Ergo Logic Error (Please file a GitHub issue)";
if (either(cast(["org.accordproject.ergo.stdlib.Error"],failure))) {
message = unbrand(toLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
message = unbrand(getLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
} else {
message = JSON.stringify(toRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
message = JSON.stringify(getRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
}
throw new Error("[Ergo] " + message);
}
Expand Down
16 changes: 8 additions & 8 deletions runtimes/javascript/ergo-runtime.js
Expand Up @@ -219,17 +219,17 @@ function either(v) {
}
throw new Error('TypeError: either called on non-sum');
}
function toLeft(v) {
function getLeft(v) {
if (typeof v === 'object' && isLeft(v)) {
return unboxLeft(v);
}
throw new Error('TypeError: toLeft called on non-sum');
throw new Error('TypeError: getLeft called on non-sum');
}
function toRight(v) {
function getRight(v) {
if (typeof v === 'object' && isRight(v)) {
return unboxRight(v);
}
throw new Error('TypeError: toRight called on non-sum');
throw new Error('TypeError: getRight called on non-sum');
}

/* Brand */
Expand Down Expand Up @@ -1074,14 +1074,14 @@ function logString(v) {
/* Unwrapping errors on output */
function unwrapError(result) {
if (result.hasOwnProperty('$left')) {
return toLeft(result);
return getLeft(result);
} else {
var failure = toRight(result);
var failure = getRight(result);
var message = "Unknown Ergo Logic Error (Please file a GitHub issue)";
if (either(cast(["org.accordproject.ergo.stdlib.Error"],failure))) {
message = unbrand(toLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
message = unbrand(getLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
} else {
message = JSON.stringify(toRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
message = JSON.stringify(getRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
}
throw new Error("[Ergo] " + message);
}
Expand Down
16 changes: 8 additions & 8 deletions runtimes/javascript/ergo_runtime.ml
Expand Up @@ -220,17 +220,17 @@ function either(v) {
}
throw new Error('TypeError: either called on non-sum');
}
function toLeft(v) {
function getLeft(v) {
if (typeof v === 'object' && isLeft(v)) {
return unboxLeft(v);
}
throw new Error('TypeError: toLeft called on non-sum');
throw new Error('TypeError: getLeft called on non-sum');
}
function toRight(v) {
function getRight(v) {
if (typeof v === 'object' && isRight(v)) {
return unboxRight(v);
}
throw new Error('TypeError: toRight called on non-sum');
throw new Error('TypeError: getRight called on non-sum');
}

/* Brand */
Expand Down Expand Up @@ -1075,14 +1075,14 @@ function logString(v) {
/* Unwrapping errors on output */
function unwrapError(result) {
if (result.hasOwnProperty('$left')) {
return toLeft(result);
return getLeft(result);
} else {
var failure = toRight(result);
var failure = getRight(result);
var message = "Unknown Ergo Logic Error (Please file a GitHub issue)";
if (either(cast(["org.accordproject.ergo.stdlib.Error"],failure))) {
message = unbrand(toLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
message = unbrand(getLeft(cast(["org.accordproject.ergo.stdlib.Error"],failure))).message;
} else {
message = JSON.stringify(toRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
message = JSON.stringify(getRight(cast(["org.accordproject.ergo.stdlib.Error"],failure)));
}
throw new Error("[Ergo] " + message);
}
Expand Down

0 comments on commit 6984c2a

Please sign in to comment.