Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@helios-lang/compiler-utils

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helios-lang/compiler-utils - npm Package Compare versions

Comparing version 0.1.55 to 0.1.56

2

package.json
{
"name": "@helios-lang/compiler-utils",
"version": "0.1.55",
"version": "0.1.56",
"description": "Helios language compiler library",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -11,2 +11,25 @@ /**

/**
* @readonly
* @type {CompilerErrorKind}
*/
kind
/**
* @readonly
* @type {Site}
*/
site
/**
* @readonly
* @type {string}
* */
originalMessage
/**
* @type {CompilerError[] | null}
*/
otherErrors
/**
* @param {CompilerErrorKind} kind

@@ -21,2 +44,3 @@ * @param {Site} site

this.originalMessage = msg
this.otherErrors = null
}

@@ -23,0 +47,0 @@

@@ -28,5 +28,7 @@ import { CompilerError } from "./CompilerError.js"

if (this.errors.length > 0) {
throw this.errors[0]
const [firstError, ...others] = this.errors
firstError.otherErrors = others
throw firstError
}
}
}

@@ -44,3 +44,8 @@ import { None, isNone, isSome } from "@helios-lang/type-utils"

/**
* @readonly
* @type {string | null}
*/
error
/**
* @param {string} kind - "(", "[" or "{"

@@ -52,5 +57,10 @@ * @param {F[]} fields

constructor(kind, fields, separators, site = TokenSite.dummy()) {
if (separators.length != Math.max(fields.length - 1, 0)) {
const expectCount = Math.max(fields.length - 1, 0)
this.error = null
if (separators.length > expectCount) {
const separatorType = separators[0].value
this.error = `'${kind}' group: excess '${separatorType}' - expected ${expectCount}, got ${separators.length}`
} else if (separators.length != expectCount) {
throw new Error(
`expected ${Math.max(fields.length - 1, 0)}, got ${separators.length}`
`expected ${expectCount}, got ${separators.length}`
)

@@ -57,0 +67,0 @@ }

@@ -857,4 +857,4 @@ import { encodeUtf8, hexToBytes } from "@helios-lang/codec-utils"

if (separators.length > 0 && separators.length >= fields.length) {
this.addSyntaxError(separators[0].site, `trailing comma`)
}
this.addSyntaxError(separators[separators.length-1].site, `trailing comma`)
}

@@ -869,3 +869,7 @@ const groupSite = new TokenSite(

return new Group(open.value, fields, separators, groupSite)
const group = new Group(open.value, fields, separators, groupSite)
if (group.error) {
this.addSyntaxError(group.site, group.error)
}
return group
}

@@ -917,3 +921,5 @@

const group = this.buildGroup(open, current.concat([t]))
if (group.error) {
this.addSyntaxError(group.site, group.error)
}
current = stack.pop() ?? []

@@ -920,0 +926,0 @@

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