Skip to content

Commit

Permalink
- compiler-utils lib upgrade
Browse files Browse the repository at this point in the history
- Cip68 tag parsing in parseDataFields  bug fix
  • Loading branch information
christianschmitz committed Aug 19, 2024
1 parent 417a63a commit b6c8c49
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 18 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helios-lang/compiler",
"version": "0.17.0-44",
"version": "0.17.0-45",
"description": "Helios is a Domain Specific Language that compiles to Plutus-Core (i.e. Cardano on-chain validator scripts). Helios is a non-Haskell alternative to Plutus. With this library you can compile Helios scripts and build Cardano transactions, all you need to build 100% client-side dApps for Cardano.",
"main": "src/index.js",
"types": "types/index.d.ts",
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"dependencies": {
"@helios-lang/codec-utils": "^0.1.32",
"@helios-lang/compiler-utils": "^0.1.53",
"@helios-lang/compiler-utils": "^0.1.54",
"@helios-lang/ir": "^0.1.26",
"@helios-lang/type-utils": "^0.1.21",
"@helios-lang/uplc": "^0.1.35"
Expand Down
6 changes: 5 additions & 1 deletion src/parse/parseDataFields.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
StringLiteral,
TokenReader,
Word,
strlit,
symbol
Expand Down Expand Up @@ -89,6 +90,9 @@ export function parseDataFields(ctx, allowTags = false) {
let typeReader = r.readUntil(anyName, symbol(":"))

if ((m = typeReader.findLastMatch(strlit()))) {
/**
* @satisfies {[TokenReader, StringLiteral]}
*/
const [before, tag] = m
typeReader.end()
typeReader = before
Expand All @@ -99,7 +103,7 @@ export function parseDataFields(ctx, allowTags = false) {
assertUniqueTag(tag.site, tag.value)
}

tags.set(name.value, tag.value)
tags.set(name.value, tag)
} else {
r.endMatch(false)

Expand Down
23 changes: 23 additions & 0 deletions src/program/multi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,27 @@ describe(analyzeMulti.name, () => {
true
)
})

it("detects module function", () => {
const src1 = `spending s
import { ok } from utils
func main(_, _) -> Bool {
ok()
}`

const src2 = `minting m
func main(_) -> Bool {
true
}`

const mod = `module utils
func ok() -> Bool {
true
}`

const analysis = analyzeMulti([src1, src2], [mod])

console.log(analysis.modules)
})
})
2 changes: 1 addition & 1 deletion src/program/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "0.17.0-44"
export const VERSION = "0.17.0-45"
10 changes: 5 additions & 5 deletions src/statements/DataDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ export class DataDefinition {
fieldsToSchema(parents) {
const fieldSchemas = []

this.fieldNames.forEach((fn, i) => {
const externalName = this.hasTags() ? this.#fields[i].tag : fn
const ts = expectSome(this.getFieldType(i).toSchema(parents))
this.#fields.forEach((f) => {
const externalName = this.hasTags() ? f.tag : f.name.value
const ts = expectSome(f.type.toSchema(parents))
fieldSchemas.push({
type: ts,
name: externalName
name: externalName,
type: ts
})
})

Expand Down

0 comments on commit b6c8c49

Please sign in to comment.