New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lys

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lys - npm Package Compare versions

Comparing version 0.1.13-20200930180449.commit-702a155 to 0.1.13-20221028202544.commit-d2f25ec

2

dist/bin.js

@@ -5,3 +5,3 @@ #!/usr/bin/env node

const index_bin_1 = require("./index-bin");
index_bin_1.main(process.cwd(), process.argv.slice(2))
(0, index_bin_1.main)(process.cwd(), process.argv.slice(2))
.then(() => process.exit(0))

@@ -8,0 +8,0 @@ .catch($ => {

@@ -9,3 +9,3 @@ "use strict";

const scopePrinter_1 = require("../utils/scopePrinter");
const process = walker_1.walkPreOrder((token, parsingContext) => {
const process = (0, walker_1.walkPreOrder)((token, parsingContext) => {
if (token.astNode && token.astNode.errors && token.astNode.errors.length) {

@@ -33,7 +33,7 @@ token.astNode.errors.forEach(($) => {

if (pc && pc.messageCollector.errors.length) {
pc.system.write(errorPrinter_1.printErrors(pc) + '\n');
pc.system.write((0, errorPrinter_1.printErrors)(pc) + '\n');
if (debug) {
const hasScopeErrors = pc.messageCollector.errors.some($ => $ instanceof NodeError_1.LysScopeError);
if (hasScopeErrors) {
pc.system.write(scopePrinter_1.printScopes(pc) + '\n');
pc.system.write((0, scopePrinter_1.printScopes)(pc) + '\n');
}

@@ -52,3 +52,3 @@ const modulesWithErrors = new Set();

modulesWithErrors.forEach($ => {
pc.system.write($.moduleName + ':\n' + astPrinter_1.printAST($) + '\n');
pc.system.write($.moduleName + ':\n' + (0, astPrinter_1.printAST)($) + '\n');
});

@@ -69,3 +69,3 @@ pc.modulesInContext.forEach($ => {

throw Object.assign(new Error(`${phaseName} failed. ${pc.messageCollector.errors.length} errors found:\n` +
astPrinter_1.indent(pc.messageCollector.errors
(0, astPrinter_1.indent)(pc.messageCollector.errors
.map(($, $$) => {

@@ -76,3 +76,3 @@ let msg = $ instanceof NodeError_1.PositionCapableError ? '' + $.message : $.toString() + '\n';

}
return astPrinter_1.indent(msg, ' ').replace(/^\s+(.*)/m, ($$ + 1).toString() + ') $1');
return (0, astPrinter_1.indent)(msg, ' ').replace(/^\s+(.*)/m, ($$ + 1).toString() + ') $1');
})

@@ -79,0 +79,0 @@ .join('\n'))), { phase: pc });

@@ -11,3 +11,3 @@ "use strict";

if (error instanceof NodeError_1.PositionCapableError) {
if (!this.errors.some($ => $.message === error.message && NodeError_1.isSamePosition($.position, error.position))) {
if (!this.errors.some($ => $.message === error.message && (0, NodeError_1.isSamePosition)($.position, error.position))) {
this.errors.push(error);

@@ -19,3 +19,3 @@ }

if (position) {
if (!this.errors.some($ => $.message === message && NodeError_1.isSamePosition($.position, position))) {
if (!this.errors.some($ => $.message === message && (0, NodeError_1.isSamePosition)($.position, position))) {
const err = new NodeError_1.PositionCapableError(message, position);

@@ -44,3 +44,3 @@ if (error instanceof Error && error.stack) {

warning(message, node) {
if (!this.errors.some($ => $.message === message && NodeError_1.isSamePosition($.position, node.astNode))) {
if (!this.errors.some($ => $.message === message && (0, NodeError_1.isSamePosition)($.position, node.astNode))) {
this.errors.push(new NodeError_1.LysCompilerError(message, node, true));

@@ -53,3 +53,3 @@ }

hasErrorForBranch(position) {
return this.errors.some($ => NodeError_1.isSamePositionOrInside(position, $.position) && !$.warning);
return this.errors.some($ => (0, NodeError_1.isSamePositionOrInside)(position, $.position) && !$.warning);
}

@@ -56,0 +56,0 @@ hasErrors() {

@@ -267,3 +267,4 @@ import { TokenError } from 'ebnf';

typeName: string;
value?: T;
get value(): T;
set value(_: T);
rawValue: string;

@@ -312,3 +313,4 @@ resolvedReference?: Reference;

class StringLiteral extends LiteralNode<string> {
value?: string;
get value(): string;
set value(value: string);
offset?: number;

@@ -315,0 +317,0 @@ length?: number;

@@ -546,2 +546,4 @@ "use strict";

}
get value() { throw new Error('not implemented'); }
set value(_) { throw new Error('not implemented'); }
}

@@ -630,2 +632,8 @@ Nodes.LiteralNode = LiteralNode;

class StringLiteral extends LiteralNode {
get value() {
return this.rawValue;
}
set value(value) {
this.rawValue = value;
}
get childrenOrEmpty() {

@@ -632,0 +640,0 @@ return [];

@@ -123,3 +123,3 @@ "use strict";

const newFileName = this.system.resolvePath(fileName);
const parsing = canonicalPhase_1.getAST(newFileName, moduleName, content, this);
const parsing = (0, canonicalPhase_1.getAST)(newFileName, moduleName, content, this);
this.modulesInContext.set(moduleName, parsing);

@@ -133,3 +133,3 @@ return parsing;

}
phases_1.analyze(moduleName, this, phase, debug);
(0, phases_1.analyze)(moduleName, this, phase, debug);
return this.getExistingParsingPhaseForModule(moduleName);

@@ -162,3 +162,3 @@ }

}
catch (_a) {
catch {
// placeholder

@@ -165,0 +165,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

/// --- PARSING PHASE ---
const process = walker_1.walkPreOrder((token, parsingContext) => {
const process = (0, walker_1.walkPreOrder)((token, parsingContext) => {
if (token.errors && token.errors.length) {

@@ -20,3 +20,3 @@ token.errors.forEach(($) => {

});
const setModuleName = (moduleName) => walker_1.walkPreOrder((token) => {
const setModuleName = (moduleName) => (0, walker_1.walkPreOrder)((token) => {
token.moduleName = moduleName;

@@ -23,0 +23,0 @@ });

@@ -20,3 +20,3 @@ import { Nodes } from '../nodes';

}>;
emitText(): any;
emitText(): Promise<any>;
optimize(): void;

@@ -23,0 +23,0 @@ /** This method only exists for test porpuses */

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeGenerationPhaseResult = void 0;
const t = require("@webassemblyjs/ast");
const t = __importStar(require("@webassemblyjs/ast"));
const wast_printer_1 = require("@webassemblyjs/wast-printer");
global['Binaryen'] = {
globalThis['Binaryen'] = {
TOTAL_MEMORY: 16777216 * 8
};
const binaryen = require("binaryen");
const _wabt = require("wabt");
const binaryen_1 = __importDefault(require("binaryen"));
const wabt_1 = __importDefault(require("wabt"));
const annotations_1 = require("../annotations");

@@ -20,3 +46,3 @@ const helpers_1 = require("../helpers");

const findAllErrors_1 = require("../findAllErrors");
const wabt = _wabt();
const wabt = (0, wabt_1.default)();
const starterName = t.identifier('%%START%%');

@@ -30,3 +56,3 @@ const optimizeLevel = 3;

function getFunctionSeqId(node) {
let fun = nodeHelpers_1.findParentType(node, nodes_1.Nodes.FunctionNode) || nodeHelpers_1.findParentType(node, nodes_1.Nodes.DocumentNode);
let fun = (0, nodeHelpers_1.findParentType)(node, nodes_1.Nodes.FunctionNode) || (0, nodeHelpers_1.findParentType)(node, nodes_1.Nodes.DocumentNode);
let num = fun[secSymbol] || 0;

@@ -153,4 +179,4 @@ num++;

const label = t.identifier(`${exitBlock}_${ix}`);
const newBlock = t.blockInstruction(label, helpers_1.flatten(prev));
const ret = helpers_1.flatten([newBlock, curr.body]);
const newBlock = t.blockInstruction(label, (0, helpers_1.flatten)(prev));
const ret = (0, helpers_1.flatten)([newBlock, curr.body]);
ret.push(t.instruction('br', [exitLabel]));

@@ -162,10 +188,10 @@ return ret;

throw new NodeError_1.LysCompilerError('ofType not defined', match);
return t.blockInstruction(t.identifier(exitBlock), helpers_1.flatten([lhs, ret]), matchType.binaryenType);
return t.blockInstruction(t.identifier(exitBlock), (0, helpers_1.flatten)([lhs, ret]), matchType.binaryenType);
}
function emitList(nodes, document, parsingContext) {
if (nodes instanceof Array) {
return helpers_1.flatten(nodes.map($ => emit($, document, parsingContext)));
return (0, helpers_1.flatten)(nodes.map($ => emit($, document, parsingContext)));
}
else {
return helpers_1.flatten([emit(nodes, document, parsingContext)]);
return (0, helpers_1.flatten)([emit(nodes, document, parsingContext)]);
}

@@ -285,3 +311,3 @@ }

else if (node instanceof nodes_1.Nodes.WasmExpressionNode) {
return helpers_1.flatten(node.atoms.map($ => emitWast($, document, parsingContext)));
return (0, helpers_1.flatten)(node.atoms.map($ => emitWast($, document, parsingContext)));
}

@@ -414,3 +440,3 @@ else if (node instanceof nodes_1.Nodes.ContinueNode) {

}
throw new NodeError_1.LysCompilerError(`This node cannot be emited ${node.nodeName}\n${astPrinter_1.printAST(node)}`, node);
throw new NodeError_1.LysCompilerError(`This node cannot be emited ${node.nodeName}\n${(0, astPrinter_1.printAST)(node)}`, node);
}

@@ -427,3 +453,3 @@ const generatedNode = _emit();

this.sourceMap = null;
findAllErrors_1.failWithErrors(`Compilation`, parsingContext);
(0, findAllErrors_1.failWithErrors)(`Compilation`, parsingContext);
try {

@@ -437,3 +463,3 @@ this.execute();

async validate(optimize = true, debug = false) {
let text = wast_printer_1.print(this.programAST);
let text = (0, wast_printer_1.print)(this.programAST);
const theWabt = await wabt;

@@ -466,6 +492,6 @@ let wabtModule;

try {
binaryen.setOptimizeLevel(optimizeLevel);
binaryen.setShrinkLevel(shrinkLevel);
binaryen.setDebugInfo(debug || !optimize);
const module = binaryen.readBinary(binary.buffer);
binaryen_1.default.setOptimizeLevel(optimizeLevel);
binaryen_1.default.setShrinkLevel(shrinkLevel);
binaryen_1.default.setDebugInfo(debug || !optimize);
const module = binaryen_1.default.readBinary(binary.buffer);
if (!debug) {

@@ -522,5 +548,5 @@ module.runPasses(['duplicate-function-elimination']);

}
emitText() {
async emitText() {
if (this.buffer) {
const module = binaryen.readBinary(this.buffer);
const module = binaryen_1.default.readBinary(this.buffer);
const ret = module.emitText();

@@ -531,3 +557,3 @@ module.dispose();

else if (this.programAST) {
return wast_printer_1.print(this.programAST);
return (0, wast_printer_1.print)(this.programAST);
}

@@ -550,3 +576,3 @@ throw new Error('Impossible to emitText');

memory: new WebAssembly.Memory({ initial: 256 }),
table: new WebAssembly.Table({ initial: 0, element: 'anyfunc' })
table: new WebAssembly.Table({ initial: 0, element: 'funcref' })
}

@@ -559,5 +585,5 @@ };

generatePhase(document, startMemory) {
const globals = nodes_1.findNodesByType(document, nodes_1.Nodes.VarDirectiveNode);
const functions = nodes_1.findNodesByType(document, nodes_1.Nodes.OverloadedFunctionNode);
const bytesLiterals = nodes_1.findNodesByType(document, nodes_1.Nodes.StringLiteral);
const globals = (0, nodes_1.findNodesByType)(document, nodes_1.Nodes.VarDirectiveNode);
const functions = (0, nodes_1.findNodesByType)(document, nodes_1.Nodes.OverloadedFunctionNode);
const bytesLiterals = (0, nodes_1.findNodesByType)(document, nodes_1.Nodes.StringLiteral);
const starters = [];

@@ -636,3 +662,3 @@ const imports = [];

const exportList = [this.document];
const moduleList = helpers_2.getModuleSet(this.document, this.parsingContext);
const moduleList = (0, helpers_2.getModuleSet)(this.document, this.parsingContext);
moduleList.forEach($ => {

@@ -655,3 +681,3 @@ const compilation = this.parsingContext.getPhase($, nodes_1.PhaseFlags.Compilation);

this.parsingContext.signatures.forEach($ => moduleParts.push($));
const table = t.table('anyfunc', t.limit(tableElems.length), t.identifier('lys::internal-functions'));
const table = t.table('funcref', t.limit(tableElems.length), t.identifier('lys::internal-functions'));
const elem = t.elem(

@@ -658,0 +684,0 @@ // table

@@ -13,3 +13,3 @@ "use strict";

const assert = require("assert");
const resolveLocals = walker_1.walkPreOrder((node, _, _parent) => {
const resolveLocals = (0, walker_1.walkPreOrder)((node, _, _parent) => {
if (node instanceof nodes_1.Nodes.PatternMatcherNode) {

@@ -21,3 +21,3 @@ // create a local for lhs of MatchNode

*/
const fn = nodeHelpers_1.findParentType(node, nodes_1.Nodes.FunctionNode);
const fn = (0, nodeHelpers_1.findParentType)(node, nodes_1.Nodes.FunctionNode);
if (fn) {

@@ -45,3 +45,3 @@ const type = types_1.TypeHelpers.getNodeType(node.lhs);

if (nodeLocal && nodeLocal.local instanceof nodes_1.Local) {
const fn = nodeHelpers_1.findParentType(node, nodes_1.Nodes.FunctionNode);
const fn = (0, nodeHelpers_1.findParentType)(node, nodes_1.Nodes.FunctionNode);
if (fn) {

@@ -56,3 +56,3 @@ fn.freeTempLocal(nodeLocal.local);

});
const resolveVariables = walker_1.walkPreOrder((node, parsingContext) => {
const resolveVariables = (0, walker_1.walkPreOrder)((node, parsingContext) => {
if (node instanceof nodes_1.Nodes.ReferenceNode || node instanceof nodes_1.Nodes.MemberNode) {

@@ -83,3 +83,3 @@ if (node.resolvedReference) {

});
const resolveDeclarations = walker_1.walkPreOrder((node, parsingContext, parent) => {
const resolveDeclarations = (0, walker_1.walkPreOrder)((node, parsingContext, parent) => {
if (node instanceof nodes_1.Nodes.VarDeclarationNode) {

@@ -90,3 +90,3 @@ if (parent instanceof nodes_1.Nodes.DirectiveNode) {

else {
const fn = nodeHelpers_1.findParentType(node, nodes_1.Nodes.FunctionNode);
const fn = (0, nodeHelpers_1.findParentType)(node, nodes_1.Nodes.FunctionNode);
if (fn) {

@@ -101,3 +101,3 @@ node.annotate(new annotations_1.annotations.LocalIdentifier(fn.addLocal(types_1.TypeHelpers.getNodeType(node.value), node.variableName)));

});
exports.detectTailCall = walker_1.walkPreOrder((node) => {
exports.detectTailCall = (0, walker_1.walkPreOrder)((node) => {
if (node instanceof nodes_1.Nodes.FunctionNode && node.body) {

@@ -118,3 +118,3 @@ const isTailRec = isRecursiveCallExpression(node, node.body);

if (node.statements.length > 0) {
annotateReturnExpressions(helpers_1.last(node.statements));
annotateReturnExpressions((0, helpers_1.last)(node.statements));
}

@@ -134,3 +134,3 @@ }

// find the last expression of every function body and mark the return expressions
const detectReturnExpressions = walker_1.walkPreOrder((node) => {
const detectReturnExpressions = (0, walker_1.walkPreOrder)((node) => {
if (node instanceof nodes_1.Nodes.FunctionNode && node.body) {

@@ -152,3 +152,3 @@ annotateReturnExpressions(node.body);

if (node instanceof nodes_1.Nodes.BlockNode) {
return node.statements.length > 0 && isRecursiveCallExpression(functionNode, helpers_1.last(node.statements));
return node.statements.length > 0 && isRecursiveCallExpression(functionNode, (0, helpers_1.last)(node.statements));
}

@@ -171,3 +171,3 @@ if (node instanceof nodes_1.Nodes.IfNode) {

const referencedType = types_1.TypeHelpers.getNodeType(fcn.functionNode);
const functionNode = nodeHelpers_1.findParentType(fcn, nodes_1.Nodes.FunctionNode);
const functionNode = (0, nodeHelpers_1.findParentType)(fcn, nodes_1.Nodes.FunctionNode);
if (functionNode && referencedType instanceof types_1.FunctionType) {

@@ -199,5 +199,5 @@ const isTailRec = referencedType.name.internalIdentifier === functionNode.functionName.internalIdentifier;

assert(document.analysis.nextPhase === nodes_1.PhaseFlags.PreCompilation);
helpers_2.fixParents(document, parsingContext, null);
(0, helpers_2.fixParents)(document, parsingContext, null);
detectReturnExpressions(document, parsingContext, null);
exports.detectTailCall(document, parsingContext, null);
(0, exports.detectTailCall)(document, parsingContext, null);
resolveDeclarations(document, parsingContext, null);

@@ -219,3 +219,3 @@ document.analysis.nextPhase++;

resolveVariables(document, parsingContext, null);
helpers_2.fixParents(document, parsingContext, null);
(0, helpers_2.fixParents)(document, parsingContext, null);
document.analysis.nextPhase++;

@@ -222,0 +222,0 @@ }

@@ -18,3 +18,3 @@ "use strict";

exports.getDocument = getDocument;
exports.fixParents = walker_1.walkPreOrder((node, _, parent) => {
exports.fixParents = (0, walker_1.walkPreOrder)((node, _, parent) => {
if (parent) {

@@ -30,3 +30,3 @@ node.parent = parent;

let added = false;
walker_1.walk(document, parsingContext, node => {
(0, walker_1.walk)(document, parsingContext, node => {
if (node.scope && node.scope.importedModules.size) {

@@ -33,0 +33,0 @@ node.scope.importedModules.forEach((_, $) => {

@@ -15,21 +15,21 @@ "use strict";

if (nodes_1.PhaseFlags.Semantic === nextPhase) {
semanticPhase_1.executeSemanticPhase(moduleName, parsingContext);
(0, semanticPhase_1.executeSemanticPhase)(moduleName, parsingContext);
}
else if (nodes_1.PhaseFlags.NameInitialization === nextPhase) {
scopePhase_1.executeNameInitializationPhase(moduleName, parsingContext);
(0, scopePhase_1.executeNameInitializationPhase)(moduleName, parsingContext);
}
else if (nodes_1.PhaseFlags.Scope === nextPhase) {
scopePhase_1.executeScopePhase(moduleName, parsingContext);
(0, scopePhase_1.executeScopePhase)(moduleName, parsingContext);
}
else if (nodes_1.PhaseFlags.TypeInitialization === nextPhase) {
typePhase_1.executeTypeInitialization(moduleName, parsingContext);
(0, typePhase_1.executeTypeInitialization)(moduleName, parsingContext);
}
else if (nodes_1.PhaseFlags.TypeCheck === nextPhase) {
typePhase_1.executeTypeCheck(moduleName, parsingContext, debug);
(0, typePhase_1.executeTypeCheck)(moduleName, parsingContext, debug);
}
else if (nodes_1.PhaseFlags.PreCompilation === nextPhase) {
compilationPhase_1.executePreCompilationPhase(moduleName, parsingContext);
(0, compilationPhase_1.executePreCompilationPhase)(moduleName, parsingContext);
}
else if (nodes_1.PhaseFlags.Compilation === nextPhase) {
compilationPhase_1.executeCompilationPhase(moduleName, parsingContext);
(0, compilationPhase_1.executeCompilationPhase)(moduleName, parsingContext);
}

@@ -36,0 +36,0 @@ if (document.analysis.nextPhase === nextPhase) {

@@ -16,3 +16,3 @@ "use strict";

const valueNodeAnnotation = new annotations_1.annotations.IsValueNode();
const findValueNodes = walker_1.walkPreOrder((node) => {
const findValueNodes = (0, walker_1.walkPreOrder)((node) => {
/**

@@ -88,3 +88,3 @@ * This phase traverses all nodes and adds an annotation to the value nodes, value nodes are those nodes that

});
const createScopes = walker_1.walkPreOrder((node, parsingContext, parent) => {
const createScopes = (0, walker_1.walkPreOrder)((node, parsingContext, parent) => {
if (parent) {

@@ -198,3 +198,3 @@ if (!node.scope) {

}
const resolveVariables = walker_1.walkPreOrder(undefined, (node, parsingContext) => {
const resolveVariables = (0, walker_1.walkPreOrder)(undefined, (node, parsingContext) => {
if (node instanceof nodes_1.Nodes.IsExpressionNode || node instanceof nodes_1.Nodes.IfNode || node instanceof nodes_1.Nodes.MatcherNode) {

@@ -231,3 +231,3 @@ const typeName = 'boolean';

const resolved = node.scope.getQName(node.variable);
const document = helpers_1.getDocument(node);
const document = (0, helpers_1.getDocument)(node);
const isGlobal = !resolved.isLocalReference || resolved.scope === document.scope;

@@ -258,5 +258,5 @@ node.isLocal = !isGlobal;

});
const findImplicitImports = walker_1.walkPreOrder((node, parsingContext) => {
const findImplicitImports = (0, walker_1.walkPreOrder)((node, parsingContext) => {
if (node instanceof nodes_1.Nodes.ImportDirectiveNode) {
const document = helpers_1.getDocument(node);
const document = (0, helpers_1.getDocument)(node);
if (node.module.text === document.moduleName) {

@@ -272,3 +272,3 @@ // TODO: test this

const { moduleName, variable } = node.variable.deconstruct();
const document = helpers_1.getDocument(node);
const document = (0, helpers_1.getDocument)(node);
if (moduleName === document.moduleName) {

@@ -282,3 +282,3 @@ // TODO: test this

});
const injectImplicitCalls = walker_1.walkPreOrder((node, _) => {
const injectImplicitCalls = (0, walker_1.walkPreOrder)((node, _) => {
if (node instanceof nodes_1.Nodes.FunctionCallNode && node.functionNode instanceof nodes_1.Nodes.ReferenceNode) {

@@ -313,3 +313,3 @@ if (node.functionNode.resolvedReference && node.functionNode.resolvedReference.type === 'TYPE') {

function summarizeImports(document, parsingContext) {
helpers_1.collectImports(document.importedModules, document, parsingContext);
(0, helpers_1.collectImports)(document.importedModules, document, parsingContext);
document.importedModules.delete(document.moduleName);

@@ -324,5 +324,5 @@ document.importedModules.forEach(moduleName => {

const unreachableAnnotation = new annotations_1.annotations.IsUnreachable();
const validateLoops = walker_1.walkPreOrder((node, parsingContext) => {
const validateLoops = (0, walker_1.walkPreOrder)((node, parsingContext) => {
if (node instanceof nodes_1.Nodes.ContinueNode || node instanceof nodes_1.Nodes.BreakNode) {
const relevantParent = nodeHelpers_1.findParentDelegate(node, $ => {
const relevantParent = (0, nodeHelpers_1.findParentDelegate)(node, $ => {
return ($ instanceof nodes_1.Nodes.LoopNode || $ instanceof nodes_1.Nodes.FunctionNode || $.hasAnnotation(annotations_1.annotations.IsValueNode));

@@ -361,3 +361,3 @@ });

});
const validateMutability = walker_1.walkPreOrder((node, parsingContext) => {
const validateMutability = (0, walker_1.walkPreOrder)((node, parsingContext) => {
if (node instanceof nodes_1.Nodes.AssignmentNode) {

@@ -378,3 +378,3 @@ if (node.lhs instanceof nodes_1.Nodes.ReferenceNode && node.lhs.resolvedReference) {

createScopes(document, parsingContext, null);
helpers_1.fixParents(document, parsingContext);
(0, helpers_1.fixParents)(document, parsingContext);
findImplicitImports(document, parsingContext, null);

@@ -381,0 +381,0 @@ document.analysis.nextPhase++;

@@ -164,3 +164,3 @@ "use strict";

function processStruct(node, parsingContext, document, isPublic) {
const args = node.parameters.map($ => nodePrinter_1.printNode($)).join(', ');
const args = node.parameters.map($ => (0, nodePrinter_1.printNode)($)).join(', ');
const typeName = node.declaredName.name;

@@ -177,3 +177,3 @@ const typeDirective = new nodes_1.Nodes.TypeDirectiveNode(node.astNode, node.declaredName);

const parameterName = param.parameterName.name;
const parameterType = nodePrinter_1.printNode(param.parameterType);
const parameterType = (0, nodePrinter_1.printNode)(param.parameterType);
if (param.parameterType instanceof nodes_1.Nodes.UnionTypeNode) {

@@ -248,4 +248,4 @@ return `

.join('\n');
const callRefs = node.parameters.map((_, i) => `property$${i}($ref, ${nodePrinter_1.printNode(_.parameterName)})`).join('\n');
const canonical = canonicalPhase_1.getAST(document.fileName + '#' + typeName, document.moduleName + '#' + typeName, `
const callRefs = node.parameters.map((_, i) => `property$${i}($ref, ${(0, nodePrinter_1.printNode)(_.parameterName)})`).join('\n');
const canonical = (0, canonicalPhase_1.getAST)(document.fileName + '#' + typeName, document.moduleName + '#' + typeName, `
impl Reference for ${typeName} {

@@ -285,3 +285,3 @@ #[inline]

fun as(self: ${typeName}): UnsafeCPointer = %wasm {
(call $addressFromRef (get_local $self))
(call $addressFromRef (local.get $self))
}

@@ -292,3 +292,3 @@

(call $${typeName}$discriminant)
(i64.extend_u/i32 (local.get $ptr))
(i64.extend_i32_u (local.get $ptr))
)

@@ -336,3 +336,3 @@ }

else {
const canonical = canonicalPhase_1.getAST(document.fileName + '#' + typeName, document.moduleName + '#' + typeName, `
const canonical = (0, canonicalPhase_1.getAST)(document.fileName + '#' + typeName, document.moduleName + '#' + typeName, `
impl Reference for ${typeName} {

@@ -447,7 +447,7 @@ #[inline]

}
const canonical = canonicalPhase_1.getAST(document.fileName + '#' + variableName.name, document.moduleName + '#' + variableName.name, `
const canonical = (0, canonicalPhase_1.getAST)(document.fileName + '#' + variableName.name, document.moduleName + '#' + variableName.name, `
impl Reference for ${variableName.name} {
#[inline]
fun is(self: ${variableName.name} | ref): boolean = {
${referenceTypes.map($ => 'self is ' + nodePrinter_1.printNode($.variable)).join(' || ') || 'false'}
${referenceTypes.map($ => 'self is ' + (0, nodePrinter_1.printNode)($.variable)).join(' || ') || 'false'}
}

@@ -493,3 +493,3 @@

};
const validateSignatures = walker_1.walkPreOrder((node, parsingContext, _1) => {
const validateSignatures = (0, walker_1.walkPreOrder)((node, parsingContext, _1) => {
if (node instanceof nodes_1.Nodes.FunctionNode) {

@@ -521,3 +521,3 @@ let used = [];

});
const validateInjectedWasm = walker_1.walkPreOrder((node, _, _1) => {
const validateInjectedWasm = (0, walker_1.walkPreOrder)((node, _, _1) => {
if (node instanceof nodes_1.Nodes.WasmAtomNode) {

@@ -534,3 +534,3 @@ if (node.symbol === 'call' || node.symbol === 'global.get' || node.symbol === 'global.set') {

});
const processDeconstruct = walker_1.walkPreOrder((node, _, _parent) => {
const processDeconstruct = (0, walker_1.walkPreOrder)((node, _, _parent) => {
if (node instanceof nodes_1.Nodes.MatchCaseIsNode) {

@@ -537,0 +537,0 @@ if (!node.declaredName) {

@@ -11,3 +11,3 @@ "use strict";

const assert = require("assert");
const initializeTypes = walker_1.walkPreOrder((node, parsingContext) => {
const initializeTypes = (0, walker_1.walkPreOrder)((node, parsingContext) => {
if (node instanceof nodes_1.Nodes.ImplDirective) {

@@ -107,3 +107,3 @@ if (node.targetImpl.resolvedReference) {

assert(document.analysis.nextPhase === nodes_1.PhaseFlags.TypeInitialization);
helpers_1.fixParents(document, parsingContext);
(0, helpers_1.fixParents)(document, parsingContext);
initializeTypes(document, parsingContext);

@@ -110,0 +110,0 @@ document.analysis.nextPhase++;

@@ -162,3 +162,3 @@ "use strict";

return '';
return `${this.name}: {\n${astPrinter_1.indent(ret.join('\n'))}\n}`;
return `${this.name}: {\n${(0, astPrinter_1.indent)(ret.join('\n'))}\n}`;
}

@@ -165,0 +165,0 @@ newChildScope(nameHint) {

@@ -9,3 +9,3 @@ import { Nodes } from './nodes';

f64 = "f64",
anyfunc = "anyfunc",
funcref = "funcref",
func = "func",

@@ -15,3 +15,3 @@ void = "void"

export declare abstract class Type {
nativeType?: NativeTypes;
abstract nativeType?: NativeTypes;
get binaryenType(): Valtype | void;

@@ -116,2 +116,3 @@ equals(otherType: Type): boolean;

readonly simplified: boolean;
nativeType?: NativeTypes | undefined;
get binaryenType(): Valtype;

@@ -147,3 +148,3 @@ constructor(of?: Type[], simplified?: boolean);

*/
simplify(ctx: Scope): Type;
simplify(ctx: Scope): any;
schema(): {

@@ -158,3 +159,3 @@ byteSize: StackType;

readonly of: Type;
get binaryenType(): void | "i32" | "i64" | "f32" | "f64" | "u32" | "label";
get binaryenType(): void | Valtype;
get nativeType(): NativeTypes;

@@ -188,2 +189,3 @@ discriminant: number | null;

readonly of: Type;
nativeType?: NativeTypes | undefined;
static memMap: WeakMap<Type, TypeType>;

@@ -227,9 +229,3 @@ private constructor();

}
export declare const InjectableTypes: {
void: StackType;
ref: RefType;
never: NeverType;
AnyType: TypeType;
Any: AnyType;
};
export declare const InjectableTypes: any;
export declare const UNRESOLVED_TYPE: NeverType;

@@ -236,0 +232,0 @@ export declare namespace TypeHelpers {

@@ -11,3 +11,3 @@ "use strict";

NativeTypes["f64"] = "f64";
NativeTypes["anyfunc"] = "anyfunc";
NativeTypes["funcref"] = "funcref";
NativeTypes["func"] = "func";

@@ -366,3 +366,3 @@ NativeTypes["void"] = "void";

this.of = of;
this.nativeType = NativeTypes.anyfunc;
this.nativeType = NativeTypes.funcref;
}

@@ -807,3 +807,3 @@ toString() {

const memberType = getType(resolvedName);
if (!typeHelpers_1.isValidType(memberType)) {
if (!(0, typeHelpers_1.isValidType)(memberType)) {
return [];

@@ -982,3 +982,3 @@ }

get nativeType() {
return NativeTypes.anyfunc;
return NativeTypes.funcref;
}

@@ -1006,3 +1006,3 @@ toString() {

get nativeType() {
return NativeTypes.anyfunc;
return NativeTypes.funcref;
}

@@ -1045,3 +1045,3 @@ toString() {

node[ofTypeSymbol] = type;
node.isTypeResolved = typeHelpers_1.isValidType(type);
node.isTypeResolved = (0, typeHelpers_1.isValidType)(type);
}

@@ -1048,0 +1048,0 @@ TypeHelpers.setNodeType = setNodeType;

@@ -1,8 +0,7 @@

import { IToken } from 'ebnf';
import { ParsingContext } from './ParsingContext';
export declare function walkPreOrder<T extends {
children: any[];
} = IToken>(cbEnter?: (node: T, phaseResult: ParsingContext, parent: T | null) => boolean | void, cbLeave?: (node: T, phaseResult: ParsingContext, parent: T | null) => void): (node: T, phaseResult: ParsingContext, parent?: T | null) => void;
}>(cbEnter?: (node: T, phaseResult: ParsingContext, parent: T | null) => boolean | void, cbLeave?: (node: T, phaseResult: ParsingContext, parent: T | null) => void): (node: T, phaseResult: ParsingContext, parent?: T | null) => void;
export declare function walk<T extends {
children: any[];
} = IToken>(node: T, phaseResult: ParsingContext, cbEnter?: (node: T, phaseResult: ParsingContext, parent: T | null) => boolean | void, cbLeave?: (node: T, phaseResult: ParsingContext, parent: T | null) => void, parent?: T | null): void;
}>(node: T, phaseResult: ParsingContext, cbEnter?: (node: T, phaseResult: ParsingContext, parent: T | null) => boolean | void, cbLeave?: (node: T, phaseResult: ParsingContext, parent: T | null) => void, parent?: T | null): void;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = void 0;
const arg = require("arg");
const arg_1 = __importDefault(require("arg"));
const ParsingContext_1 = require("./compiler/ParsingContext");

@@ -34,3 +37,3 @@ const path_1 = require("path");

let libPaths = [];
const args = arg({
const args = (0, arg_1.default)({
'--output': String,

@@ -66,3 +69,3 @@ '-o': '--output',

if (file.endsWith('.md')) {
const MD = loadFromMD_1.loadFromMD(parsingContext, parsingContext.system.readFile(file));
const MD = (0, loadFromMD_1.loadFromMD)(parsingContext, parsingContext.system.readFile(file));
mainModule = MD.mainModule;

@@ -101,6 +104,6 @@ for (let path in MD.jsFiles) {

if (!args['--output']) {
args['--output'] = 'build/' + path_1.basename(file, '.lys');
args['--output'] = 'build/' + (0, path_1.basename)(file, '.lys');
}
const outFileFullWithoutExtension = NodeSystem_1.nodeSystem.resolvePath(NodeSystem_1.nodeSystem.getCurrentDirectory(), args['--output']);
const outPath = path_1.dirname(outFileFullWithoutExtension);
const outPath = (0, path_1.dirname)(outFileFullWithoutExtension);
mkdirRecursive(outPath);

@@ -125,6 +128,6 @@ return Object.assign(parsingContext, {

async function emit(parsingContext) {
const codeGen = index_1.compile(parsingContext, parsingContext.mainModule, parsingContext.options.DEBUG);
const codeGen = (0, index_1.compile)(parsingContext, parsingContext.mainModule, parsingContext.options.DEBUG);
await codeGen.validate(parsingContext.options.OPTIMIZE, parsingContext.options.DEBUG || parsingContext.options.WAST);
if (parsingContext.options.WAST) {
NodeSystem_1.nodeSystem.writeFile(parsingContext.outFileFullWithoutExtension + '.wast', codeGen.emitText());
NodeSystem_1.nodeSystem.writeFile(parsingContext.outFileFullWithoutExtension + '.wast', await codeGen.emitText());
}

@@ -137,3 +140,3 @@ if (codeGen.sourceMap) {

}
fs_1.writeFileSync(parsingContext.outFileFullWithoutExtension + '.wasm', codeGen.buffer);
(0, fs_1.writeFileSync)(parsingContext.outFileFullWithoutExtension + '.wasm', codeGen.buffer);
let src = [];

@@ -144,3 +147,3 @@ src.push('Object.defineProperty(exports, "__esModule", { value: true });');

const path = parsingContext.libPaths[i];
src.push(`modules.push(require(${JSON.stringify(path_1.relative(path_1.dirname(parsingContext.outFileFullWithoutExtension), path))}).default);`);
src.push(`modules.push(require(${JSON.stringify((0, path_1.relative)((0, path_1.dirname)(parsingContext.outFileFullWithoutExtension), path))}).default);`);
}

@@ -179,4 +182,4 @@ const values = [];

const targetFile = NodeSystem_1.nodeSystem.resolvePath(parsingContext.outPath + '/desugar/', relativePath);
mkdirRecursive(path_1.dirname(targetFile));
NodeSystem_1.nodeSystem.writeFile(targetFile, nodePrinter_1.printNode(module));
mkdirRecursive((0, path_1.dirname)(targetFile));
NodeSystem_1.nodeSystem.writeFile(targetFile, (0, nodePrinter_1.printNode)(module));
}

@@ -186,3 +189,3 @@ });

if (parsingContext.options.TEST) {
const testInstance = await testEnvironment_1.generateTestInstance(codeGen.buffer, parsingContext.libs);
const testInstance = await (0, testEnvironment_1.generateTestInstance)(codeGen.buffer, parsingContext.libs);
if (typeof testInstance.exports.test !== 'function') {

@@ -199,3 +202,3 @@ if (typeof testInstance.exports.main !== 'function') {

}
const testResults = test_1.getTestResults(testInstance);
const testResults = (0, test_1.getTestResults)(testInstance);
for (let path in parsingContext.customAssertions) {

@@ -242,7 +245,7 @@ const startTime = Date.now();

if (totalPass !== totalTests) {
console.error(colors_1.formatColorAndReset(`\n\n Some tests failed. Passed: ${totalPass} Failed: ${totalTests - totalPass} (${(totalTime / 1000).toFixed(2)}s)\n\n`, colors_1.ForegroundColors.Red));
console.error((0, colors_1.formatColorAndReset)(`\n\n Some tests failed. Passed: ${totalPass} Failed: ${totalTests - totalPass} (${(totalTime / 1000).toFixed(2)}s)\n\n`, colors_1.ForegroundColors.Red));
return false;
}
else {
console.error(colors_1.formatColorAndReset(`\n\n All tests passed. Passed: ${totalPass} Failed: ${totalTests - totalPass} (${(totalTime / 1000).toFixed(2)}s)\n\n`, colors_1.ForegroundColors.Green));
console.error((0, colors_1.formatColorAndReset)(`\n\n All tests passed. Passed: ${totalPass} Failed: ${totalTests - totalPass} (${(totalTime / 1000).toFixed(2)}s)\n\n`, colors_1.ForegroundColors.Green));
return true;

@@ -259,3 +262,3 @@ }

let running = false;
fs_1.watch(cwd, { recursive: true }, (event, fileName) => {
(0, fs_1.watch)(cwd, { recursive: true }, (event, fileName) => {
const fqn = parsingContext.getModuleFQNForFile(fileName);

@@ -278,7 +281,7 @@ const inContext = parsingContext.modulesInContext.has(fqn);

running = false;
console.log(colors_1.formatColorAndReset('[OK] ' + (Date.now() - start).toFixed(1) + 'ms', colors_1.ForegroundColors.Green));
console.log((0, colors_1.formatColorAndReset)('[OK] ' + (Date.now() - start).toFixed(1) + 'ms', colors_1.ForegroundColors.Green));
})
.catch(() => {
running = false;
console.log(colors_1.formatColorAndReset('[ERROR] ' + (Date.now() - start).toFixed(1) + 'ms', colors_1.ForegroundColors.Red));
console.log((0, colors_1.formatColorAndReset)('[ERROR] ' + (Date.now() - start).toFixed(1) + 'ms', colors_1.ForegroundColors.Red));
});

@@ -285,0 +288,0 @@ }

@@ -11,5 +11,5 @@ "use strict";

const compilation = parsingContext.getPhase(moduleName, nodes_1.PhaseFlags.Compilation, debug);
findAllErrors_1.failWithErrors(`Code generation`, parsingContext, debug);
(0, findAllErrors_1.failWithErrors)(`Code generation`, parsingContext, debug);
const codeGen = new codeGenerationPhase_1.CodeGenerationPhaseResult(compilation, parsingContext);
findAllErrors_1.failWithErrors(`Code generation`, parsingContext, debug);
(0, findAllErrors_1.failWithErrors)(`Code generation`, parsingContext, debug);
return codeGen;

@@ -16,0 +16,0 @@ }

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HidratedWebSystem = void 0;
const WebSystem_1 = require("./WebSystem");
const std = require("./std.json");
const std = __importStar(require("./std.json"));
if ('\u0000' in std) {

@@ -7,0 +30,0 @@ throw new Error('Hidrated system not correctly built');

@@ -23,5 +23,5 @@ "use strict";

switch (entryKind) {
case 0 /* File */:
case 0 /* FileSystemEntryKind.File */:
return stat.isFile();
case 1 /* Directory */:
case 1 /* FileSystemEntryKind.Directory */:
return stat.isDirectory();

@@ -52,3 +52,3 @@ default:

directoryExists(path) {
return fileSystemEntryExists(path, 1 /* Directory */);
return fileSystemEntryExists(path, 1 /* FileSystemEntryKind.Directory */);
}

@@ -58,3 +58,3 @@ getDirectories(path) {

.readdirSync(path)
.filter(dir => fileSystemEntryExists(this.resolvePath(path, dir), 1 /* Directory */));
.filter(dir => fileSystemEntryExists(this.resolvePath(path, dir), 1 /* FileSystemEntryKind.Directory */));
}

@@ -116,3 +116,3 @@ write(s) {

fileExists(path) {
return fileSystemEntryExists(path, 0 /* File */);
return fileSystemEntryExists(path, 0 /* FileSystemEntryKind.File */);
}

@@ -119,0 +119,0 @@ getCurrentDirectory() {

@@ -45,6 +45,6 @@ "use strict";

resolvePath(...path) {
return path_1.resolve(...path);
return (0, path_1.resolve)(...path);
}
relative(from, to) {
return path_1.relative(from, to);
return (0, path_1.relative)(from, to);
}

@@ -51,0 +51,0 @@ fileExists(path) {

@@ -42,5 +42,5 @@ "use strict";

errors.forEach((err) => {
printLines.push(colors_1.formatColorAndReset(err.message, colors_1.ForegroundColors.Red));
printLines.push((0, colors_1.formatColorAndReset)(err.message, colors_1.ForegroundColors.Red));
if (err.stack) {
printLines.push(astPrinter_1.indent(colors_1.formatColorAndReset(err.stack, colors_1.ForegroundColors.Grey), ' '));
printLines.push((0, astPrinter_1.indent)((0, colors_1.formatColorAndReset)(err.stack, colors_1.ForegroundColors.Grey), ' '));
}

@@ -56,3 +56,3 @@ });

fileNameToPrint = fileNameToPrint.replace(parsingContext.system.getCurrentDirectory() + '\\', '');
printLines.push(colors_1.formatColorAndReset(fileNameToPrint || '(no file)', colors_1.gutterStyleSequence));
printLines.push((0, colors_1.formatColorAndReset)(fileNameToPrint || '(no file)', colors_1.gutterStyleSequence));
const source = parsing.content;

@@ -92,4 +92,4 @@ let lineMapper = new LineMapper_1.LineMapper(source, Math.random().toString());

});
const blackPadding = colors_1.formatColorAndReset(' ' + colors_1.gutterSeparator, colors_1.gutterStyleSequence);
const ln = (n) => colors_1.formatColorAndReset((' ' + (n + 1).toString()).substr(-5) + '' + colors_1.gutterSeparator, colors_1.gutterStyleSequence);
const blackPadding = (0, colors_1.formatColorAndReset)(' ' + colors_1.gutterSeparator, colors_1.gutterStyleSequence);
const ln = (n) => (0, colors_1.formatColorAndReset)((' ' + (n + 1).toString()).substr(-5) + '' + colors_1.gutterSeparator, colors_1.gutterStyleSequence);
const printedErrors = new Set();

@@ -118,3 +118,3 @@ const printableLines = [];

if (i !== lastLine) {
printLines.push(colors_1.formatColorAndReset(' ...' + colors_1.gutterSeparator, colors_1.gutterStyleSequence));
printLines.push((0, colors_1.formatColorAndReset)(' ...' + colors_1.gutterSeparator, colors_1.gutterStyleSequence));
}

@@ -127,3 +127,3 @@ lastLine = i + 1;

printLines.push(ln(i) +
colors_1.formatColorAndReset(line, colors_1.ForegroundColors.ErrorLine) +
(0, colors_1.formatColorAndReset)(line, colors_1.ForegroundColors.ErrorLine) +
mapSet(errorOnLines[i], x => {

@@ -137,9 +137,9 @@ let message = '';

message =
message + colors_1.formatColorAndReset(new Array(x.end.column + 1 - x.start.column).join('^'), color) + ' ';
message + (0, colors_1.formatColorAndReset)(new Array(x.end.column + 1 - x.start.column).join('^'), color) + ' ';
}
else {
message = '\n' + blackPadding + new Array(x.end.column).join(' ');
message = message + colors_1.formatColorAndReset('^ ', color);
message = message + (0, colors_1.formatColorAndReset)('^ ', color);
}
message = message + colors_1.formatColorAndReset(x.message, color);
message = message + (0, colors_1.formatColorAndReset)(x.message, color);
}

@@ -156,7 +156,7 @@ printedErrors.add(x);

if (lines.length !== lastLine - 1) {
printLines.push(colors_1.formatColorAndReset(' ...' + colors_1.gutterSeparator, colors_1.gutterStyleSequence));
printLines.push((0, colors_1.formatColorAndReset)(' ...' + colors_1.gutterSeparator, colors_1.gutterStyleSequence));
}
printableErrors.forEach(err => {
if (!printedErrors.has(err)) {
printLines.push(colors_1.formatColorAndReset(err.message, colors_1.ForegroundColors.Red));
printLines.push((0, colors_1.formatColorAndReset)(err.message, colors_1.ForegroundColors.Red));
}

@@ -163,0 +163,0 @@ });

@@ -17,3 +17,3 @@ "use strict";

try {
let str = execution_1.readString(getInstance().exports.memory.buffer, offset);
let str = (0, execution_1.readString)(getInstance().exports.memory.buffer, offset);
let ix = 0;

@@ -20,0 +20,0 @@ str = str.replace(/(%(.))/g, function (substr, _, group2) {

@@ -6,2 +6,6 @@ "use strict";

const colors_1 = require("../colors");
function writeLn(message) {
process.stderr.write(message);
process.stderr.write('\n');
}
function getTestResults(instance) {

@@ -26,3 +30,3 @@ return instance.testResults || (instance.testResults = []);

printMemory: (start, length) => {
console.log(`Dump from ${start.toString(16)} of ${length} bytes`);
writeLn(`Dump from ${start.toString(16)} of ${length} bytes`);
while (start % 16 !== 0 && start !== 0) {

@@ -36,6 +40,6 @@ // tslint:disable-next-line:no-parameter-reassignment

}
console.log(execution_1.hexDump(getInstance().exports.memory.buffer, start + length, start));
writeLn((0, execution_1.hexDump)(getInstance().exports.memory.buffer, start + length, start));
},
pushTest: (offset) => {
const title = execution_1.readString(getInstance().exports.memory.buffer, offset);
const title = (0, execution_1.readString)(getInstance().exports.memory.buffer, offset);
const top = getTopTest();

@@ -58,3 +62,3 @@ const suite = {

const indentation = ' '.repeat(level);
console.log('\n' + indentation + title + ':');
writeLn('\n' + indentation + title + ':');
},

@@ -74,3 +78,3 @@ popTest: () => {

registerAssertion: (passed, nameOffset) => {
const title = execution_1.readString(getInstance().exports.memory.buffer, nameOffset);
const title = (0, execution_1.readString)(getInstance().exports.memory.buffer, nameOffset);
const didPass = !!passed;

@@ -89,18 +93,18 @@ const suite = getTopTest();

if (didPass) {
console.log(indentation +
colors_1.formatColorAndReset('✓ ', colors_1.ForegroundColors.Green) +
colors_1.formatColorAndReset(title, colors_1.ForegroundColors.Grey));
writeLn(indentation +
(0, colors_1.formatColorAndReset)('✓ ', colors_1.ForegroundColors.Green) +
(0, colors_1.formatColorAndReset)(title, colors_1.ForegroundColors.Grey));
}
else {
console.log(indentation +
colors_1.formatColorAndReset('X ', colors_1.ForegroundColors.Red) +
colors_1.formatColorAndReset(title, colors_1.ForegroundColors.Grey));
writeLn(indentation +
(0, colors_1.formatColorAndReset)('X ', colors_1.ForegroundColors.Red) +
(0, colors_1.formatColorAndReset)(title, colors_1.ForegroundColors.Grey));
}
},
printNumber: (x) => {
console.log('printNumber: ' + x);
writeLn('printNumber: ' + x);
},
printString: (offset) => {
const str = execution_1.readString(getInstance().exports.memory.buffer, offset);
console.log(str);
const str = (0, execution_1.readString)(getInstance().exports.memory.buffer, offset);
writeLn(str);
}

@@ -107,0 +111,0 @@ }

@@ -8,3 +8,3 @@ "use strict";

function loadFromMD(parsingContext, mdContent) {
const parsedMD = MDParser_1.parseMD(mdContent);
const parsedMD = (0, MDParser_1.parseMD)(mdContent);
parsingContext.reset();

@@ -11,0 +11,0 @@ let mainModule = 'main';

@@ -43,3 +43,3 @@ "use strict";

return '{}';
return '{\n' + astPrinter_1.indent(node.statements.map(printNode).join('\n')) + '\n}';
return '{\n' + (0, astPrinter_1.indent)(node.statements.map(printNode).join('\n')) + '\n}';
}

@@ -63,3 +63,3 @@ else if (node instanceof nodes_1.Nodes.MemberNode) {

? ' = ' + bodyText
: ' =\n' + astPrinter_1.indent(bodyText);
: ' =\n' + (0, astPrinter_1.indent)(bodyText);
const retType = node.functionReturnType ? ': ' + printNode(node.functionReturnType) : '';

@@ -80,3 +80,3 @@ const params = node.parameters.map(printNode).join(', ');

? ' ' + bodyText
: '\n' + astPrinter_1.indent(bodyText);
: '\n' + (0, astPrinter_1.indent)(bodyText);
return `loop${body}`;

@@ -86,6 +86,6 @@ }

if (node.baseImpl) {
return `impl ${printNode(node.baseImpl)} for ${printNode(node.targetImpl)} {\n${astPrinter_1.indent(node.directives.map(printNode).join('\n\n'))}\n}`;
return `impl ${printNode(node.baseImpl)} for ${printNode(node.targetImpl)} {\n${(0, astPrinter_1.indent)(node.directives.map(printNode).join('\n\n'))}\n}`;
}
else {
return `impl ${printNode(node.targetImpl)} {\n${astPrinter_1.indent(node.directives.map(printNode).join('\n\n'))}\n}`;
return `impl ${printNode(node.targetImpl)} {\n${(0, astPrinter_1.indent)(node.directives.map(printNode).join('\n\n'))}\n}`;
}

@@ -112,3 +112,3 @@ }

else if (node instanceof nodes_1.Nodes.InjectedFunctionCallNode) {
return `/* <Injected function call> */\n${astPrinter_1.indent(node.argumentsNode.map(printNode).join('\n'))}\n/* </Injected function call> */`;
return `/* <Injected function call> */\n${(0, astPrinter_1.indent)(node.argumentsNode.map(printNode).join('\n'))}\n/* </Injected function call> */`;
}

@@ -134,3 +134,3 @@ else if (node instanceof nodes_1.Nodes.FunctionCallNode) {

else if (node instanceof nodes_1.Nodes.WasmExpressionNode) {
return `%wasm {\n${astPrinter_1.indent(node.atoms.map(printNode).join('\n'))}\n}`;
return `%wasm {\n${(0, astPrinter_1.indent)(node.atoms.map(printNode).join('\n'))}\n}`;
}

@@ -154,3 +154,3 @@ else if (node instanceof nodes_1.Nodes.StructTypeNode) {

else {
return '\n' + astPrinter_1.indent(printNode(node.truePart)) + '\n';
return '\n' + (0, astPrinter_1.indent)(printNode(node.truePart)) + '\n';
}

@@ -166,3 +166,3 @@ };

else {
return '\n' + astPrinter_1.indent(printNode(node.falsePart)) + '\n';
return '\n' + (0, astPrinter_1.indent)(printNode(node.falsePart)) + '\n';
}

@@ -190,6 +190,6 @@ };

else if (node instanceof nodes_1.Nodes.EffectDeclarationNode) {
return `effect ${printNode(node.name)} {\n${astPrinter_1.indent(node.elements.map(printNode).join('\n'))}\n}`;
return `effect ${printNode(node.name)} {\n${(0, astPrinter_1.indent)(node.elements.map(printNode).join('\n'))}\n}`;
}
else if (node instanceof nodes_1.Nodes.PatternMatcherNode) {
return `match ${printNode(node.lhs)} {\n${astPrinter_1.indent(node.matchingSet.map(printNode).join('\n'))}\n}`;
return `match ${printNode(node.lhs)} {\n${(0, astPrinter_1.indent)(node.matchingSet.map(printNode).join('\n'))}\n}`;
}

@@ -228,7 +228,7 @@ else if (node instanceof nodes_1.Nodes.MatchConditionNode) {

else if (node instanceof nodes_1.Nodes.EnumDirectiveNode) {
const types = astPrinter_1.indent(node.declarations.map($ => printNode($)).join('\n'));
const types = (0, astPrinter_1.indent)(node.declarations.map($ => printNode($)).join('\n'));
return `enum ${printNode(node.variableName)} {\n${types}\n}`;
}
else if (node instanceof nodes_1.Nodes.TraitDirectiveNode) {
const types = astPrinter_1.indent(node.directives.map($ => printNode($)).join('\n'));
const types = (0, astPrinter_1.indent)(node.directives.map($ => printNode($)).join('\n'));
return `trait ${printNode(node.traitName)} {\n${types}\n}`;

@@ -235,0 +235,0 @@ }

{
"name": "lys",
"version": "0.1.13-20200930180449.commit-702a155",
"version": "0.1.13-20221028202544.commit-d2f25ec",
"description": "",

@@ -11,4 +11,3 @@ "main": "dist/index.js",

"scripts": {
"prepublish": "make build",
"release": "ts-node scripts/release.ts"
"prepublish": "make build"
},

@@ -32,49 +31,28 @@ "repository": {

"dependencies": {
"@webassemblyjs/ast": "^1.9.0",
"@webassemblyjs/wast-printer": "^1.9.0",
"@webassemblyjs/ast": "^1.11.1",
"@webassemblyjs/wast-printer": "^1.11.1",
"arg": "^4.1.3",
"binaryen": "^95.0.0",
"binaryen": "^100.0.0",
"ebnf": "^1.7.4",
"utf8-bytes": "0.0.1",
"wabt": "^1.0.19"
"wabt": "^1.0.30"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/git-rev-sync": "^1.12.0",
"@types/glob": "^7.1.3",
"@types/mocha": "^10.0.0",
"@types/node": "^12.12.53",
"@types/node-fetch": "^2.5.7",
"@types/semver": "^6.2.1",
"chai": "^4.2.0",
"dcl-tslint-config-standard": "^1.1.0",
"expect": "^24.9.0",
"git-rev-sync": "^1.12.0",
"expect": "^29.2.2",
"git-rev-sync": "^3.0.2",
"glob": "^7.1.6",
"istanbul": "^0.4.5",
"mocha": "^6.2.3",
"mocha-junit-reporter": "^1.23.3",
"mocha-performance": "^0.1.1",
"mocha": "^10.1.0",
"moment": "^2.29.4",
"node-fetch": "^2.6.0",
"nyc": "^14.1.1",
"nyc": "^15.1.0",
"semver": "^6.3.0",
"source-map-support": "^0.5.19",
"ts-node": "^8.10.2",
"tslint": "^6.1.3",
"tslint-language-service": "^0.9.9",
"typescript": "^3.9.7"
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},
"nyc": {
"extension": [
".ts"
],
"exclude": [
"**/*.d.ts",
"test/**/*"
],
"reporter": [
"cobertura",
"text"
],
"all": true
},
"files": [

@@ -84,3 +62,4 @@ "LICENSE",

"stdlib"
]
],
"commit": "d2f25ec38f527d12a079f5dcc8f495362eb10c50"
}

@@ -144,9 +144,9 @@ <p align="center"><br><br>

fun +(lhs: int, rhs: int): int = %wasm {
(i32.add (get_local $lhs) (get_local $rhs))
(i32.add (local.get $lhs) (local.get $rhs))
}
fun -(lhs: int, rhs: int): int = %wasm {
(i32.sub (get_local $lhs) (get_local $rhs))
(i32.sub (local.get $lhs) (local.get $rhs))
}
fun >(lhs: int, rhs: int): boolean = %wasm {
(i32.gt_s (get_local $lhs) (get_local $rhs))
(i32.gt_s (local.get $lhs) (local.get $rhs))
}

@@ -225,3 +225,3 @@ }

fun as(lhs: u8): f32 = %wasm { (f32.convert_i32_u (get_local $lhs)) }
fun as(lhs: u8): f32 = %wasm { (f32.convert_i32_u (local.get $lhs)) }
}

@@ -293,3 +293,3 @@

private fun fromPointer(ptr: u32): Node = %wasm {
(i64.or (call Node$discriminant) (i64.extend_u/i32 (local.get $ptr)))
(i64.or (call Node$discriminant) (i64.extend_i32_u (local.get $ptr)))
}

@@ -296,0 +296,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc