scryptlib
Advanced tools
Comparing version 0.2.28 to 0.2.29-beta1
@@ -0,0 +0,0 @@ import { AbstractContract, TxContext, VerifyResult, AsmVarValues } from './contract'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -58,3 +58,3 @@ import { ContractDescription } from './contract'; | ||
opcode: string; | ||
stack: string[]; | ||
stack?: string[]; | ||
pos?: Pos; | ||
@@ -103,2 +103,3 @@ debugTag?: DebugModeTag; | ||
sourceMap?: boolean; | ||
optimize?: boolean; | ||
}): CompileResult; | ||
@@ -105,0 +106,0 @@ export declare function compilerVersion(cwd?: string): string; |
@@ -37,3 +37,4 @@ "use strict"; | ||
asm: true, | ||
debug: true | ||
debug: true, | ||
optimize: false, | ||
}) { | ||
@@ -51,3 +52,3 @@ const st = Date.now(); | ||
const cmdPrefix = settings.cmdPrefix || getDefaultScryptc(); | ||
const cmd = `${cmdPrefix} compile ${settings.asm || settings.desc ? '--asm' : ''} ${settings.ast || settings.desc ? '--ast' : ''} ${settings.debug == false ? '' : '--debug'} -r -o "${outputDir}" ${settings.cmdArgs ? settings.cmdArgs : ''}`; | ||
const cmd = `${cmdPrefix} compile ${settings.asm || settings.desc ? '--asm' : ''} ${settings.ast || settings.desc ? '--ast' : ''} ${settings.debug == false ? '' : '--debug'} ${settings.optimize ? '--opt' : ''} -r -o "${outputDir}" ${settings.cmdArgs ? settings.cmdArgs : ''}`; | ||
let output = child_process_1.execSync(cmd, { input: sourceContent, cwd: curWorkingDir }).toString(); | ||
@@ -132,40 +133,40 @@ // Because the output of the compiler on the win32 platform uses crlf as a newline, here we change \r\n to \n. make SYNTAX_ERR_REG、SEMANTIC_ERR_REG、IMPORT_ERR_REG work. | ||
outputFiles['asm'] = outputFilePath; | ||
if (settings.debug == false) { | ||
result.asm = JSON.parse(fs_1.readFileSync(outputFilePath, 'utf8')).join(' '); | ||
} | ||
else { | ||
asmObj = JSON.parse(fs_1.readFileSync(outputFilePath, 'utf8')); | ||
const sources = asmObj.sources; | ||
result.asm = asmObj.output.map(item => { | ||
const match = SOURCE_REG.exec(item.src); | ||
if (match && match.groups) { | ||
const fileIndex = parseInt(match.groups.fileIndex); | ||
let debugTag; | ||
const tagStr = match.groups.tagStr; | ||
if (/\w+\.\w+:0/.test(tagStr)) { | ||
debugTag = DebugModeTag.FuncStart; | ||
} | ||
if (/\w+\.\w+:1/.test(tagStr)) { | ||
debugTag = DebugModeTag.FuncEnd; | ||
} | ||
if (/loop:0/.test(tagStr)) { | ||
debugTag = DebugModeTag.LoopStart; | ||
} | ||
const pos = sources[fileIndex] ? { | ||
file: sources[fileIndex] ? getFullFilePath(sources[fileIndex], srcDir, sourceFileName) : undefined, | ||
line: sources[fileIndex] ? parseInt(match.groups.line) : undefined, | ||
endLine: sources[fileIndex] ? parseInt(match.groups.endLine) : undefined, | ||
column: sources[fileIndex] ? parseInt(match.groups.col) : undefined, | ||
endColumn: sources[fileIndex] ? parseInt(match.groups.endCol) : undefined, | ||
} : undefined; | ||
return { | ||
opcode: item.opcode, | ||
stack: item.stack, | ||
pos: pos, | ||
debugTag | ||
}; | ||
asmObj = JSON.parse(fs_1.readFileSync(outputFilePath, 'utf8')); | ||
const sources = asmObj.sources; | ||
result.asm = asmObj.output.map(item => { | ||
if (!settings.debug) { | ||
return { | ||
opcode: item.opcode | ||
}; | ||
} | ||
const match = SOURCE_REG.exec(item.src); | ||
if (match && match.groups) { | ||
const fileIndex = parseInt(match.groups.fileIndex); | ||
let debugTag; | ||
const tagStr = match.groups.tagStr; | ||
if (/\w+\.\w+:0/.test(tagStr)) { | ||
debugTag = DebugModeTag.FuncStart; | ||
} | ||
throw new Error('Compile Failed: Asm output parsing Error!'); | ||
}); | ||
} | ||
if (/\w+\.\w+:1/.test(tagStr)) { | ||
debugTag = DebugModeTag.FuncEnd; | ||
} | ||
if (/loop:0/.test(tagStr)) { | ||
debugTag = DebugModeTag.LoopStart; | ||
} | ||
const pos = sources[fileIndex] ? { | ||
file: sources[fileIndex] ? getFullFilePath(sources[fileIndex], srcDir, sourceFileName) : undefined, | ||
line: sources[fileIndex] ? parseInt(match.groups.line) : undefined, | ||
endLine: sources[fileIndex] ? parseInt(match.groups.endLine) : undefined, | ||
column: sources[fileIndex] ? parseInt(match.groups.col) : undefined, | ||
endColumn: sources[fileIndex] ? parseInt(match.groups.endCol) : undefined, | ||
} : undefined; | ||
return { | ||
opcode: item.opcode, | ||
stack: item.stack, | ||
pos: pos, | ||
debugTag | ||
}; | ||
} | ||
throw new Error('Compile Failed: Asm output parsing Error!'); | ||
}); | ||
} | ||
@@ -189,7 +190,7 @@ if (settings.desc) { | ||
}; | ||
if (settings.sourceMap && asmObj) { | ||
if (settings.debug && settings.sourceMap && asmObj) { | ||
Object.assign(description, { | ||
file: result.file, | ||
sources: asmObj.sources.map(source => getFullFilePath(source, srcDir, sourceFileName)), | ||
sourceMap: asmObj.output.map(item => item.src) | ||
sourceMap: asmObj.output.map(item => item.src), | ||
}); | ||
@@ -196,0 +197,0 @@ } |
@@ -0,0 +0,0 @@ import { ABICoder, Arguments, FunctionCall, Script } from "./abi"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export { buildContractClass, VerifyResult } from './contract'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { StructEntity } from "./compilerWrapper"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { bsv } from './utils'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "scryptlib", | ||
"version": "0.2.28", | ||
"version": "0.2.29-beta1", | ||
"description": "Javascript SDK for integration of Bitcoin SV Smart Contracts written in sCrypt language.", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107647
21
2440