prettier-plugin-solidity 2.0.0-beta.6 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/591f276013d241f7a687.wasm +0 -0
- package/dist/78244c53725e2131398e.wasm +0 -0
- package/dist/d6da904aec8bb797eac6.wasm +0 -0
- package/dist/e5a84a17f0f9e01763d3.wasm +0 -0
- package/dist/slang-nodes/Expression.js +3 -3
- package/dist/slang-nodes/{ComparisonExpression.js → InequalityExpression.js} +3 -3
- package/dist/slang-nodes/{ComparisonExpression.js.map → InequalityExpression.js.map} +1 -1
- package/dist/slang-nodes/YulExpression.js +0 -4
- package/dist/slang-nodes/YulExpression.js.map +1 -1
- package/dist/slang-nodes/YulPath.js +4 -5
- package/dist/slang-nodes/YulPath.js.map +1 -1
- package/dist/slang-utils/create-parser.js +11 -10
- package/dist/slang-utils/create-parser.js.map +1 -1
- package/dist/slang-utils/is-binary-operation.js +1 -1
- package/dist/slang-utils/is-binary-operation.js.map +1 -1
- package/dist/slang-utils/metadata.js +1 -1
- package/dist/slang-utils/metadata.js.map +1 -1
- package/dist/slangSolidityParser.js +2 -2
- package/dist/slangSolidityParser.js.map +1 -1
- package/dist/standalone.js +1 -1
- package/dist/standalone.js.map +1 -1
- package/package.json +13 -13
- package/src/slang-nodes/Expression.ts +5 -5
- package/src/slang-nodes/{ComparisonExpression.ts → InequalityExpression.ts} +4 -4
- package/src/slang-nodes/YulExpression.ts +1 -11
- package/src/slang-nodes/YulPath.ts +5 -7
- package/src/slang-nodes/types.d.ts +2 -6
- package/src/slang-printers/print-binary-operation.ts +2 -2
- package/src/slang-utils/create-parser.ts +11 -10
- package/src/slang-utils/is-binary-operation.ts +1 -1
- package/src/slang-utils/metadata.ts +1 -1
- package/src/slangSolidityParser.ts +3 -3
- package/src/types.d.ts +1 -3
- package/dist/31ca71009a37f38d3a02.wasm +0 -0
- package/dist/8c7945c354c0e90e3eea.wasm +0 -0
- package/dist/fe6fce76f8236b8b86c6.wasm +0 -0
- package/dist/ffc577b688b8d07825c1.wasm +0 -0
- package/dist/slang-nodes/YulBuiltInFunction.js +0 -15
- package/dist/slang-nodes/YulBuiltInFunction.js.map +0 -1
- package/dist/slang-nodes/YulPathComponent.js +0 -16
- package/dist/slang-nodes/YulPathComponent.js.map +0 -1
- package/src/slang-nodes/YulBuiltInFunction.ts +0 -29
- package/src/slang-nodes/YulPathComponent.ts +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-solidity",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.8",
|
|
4
4
|
"description": "A Prettier Plugin for automatically formatting your Solidity code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -86,31 +86,31 @@
|
|
|
86
86
|
"@babel/code-frame": "^7.26.2",
|
|
87
87
|
"@types/jest": "^29.5.14",
|
|
88
88
|
"@types/semver": "^7.5.8",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
90
|
-
"@typescript-eslint/parser": "^8.
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
90
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
91
91
|
"c8": "^10.1.3",
|
|
92
92
|
"cross-env": "^7.0.3",
|
|
93
|
-
"eslint": "^9.
|
|
94
|
-
"eslint-config-prettier": "
|
|
93
|
+
"eslint": "^9.23.0",
|
|
94
|
+
"eslint-config-prettier": "10.1.1",
|
|
95
95
|
"esm-utils": "^4.3.0",
|
|
96
96
|
"jest": "^29.7.0",
|
|
97
97
|
"jest-light-runner": "^0.6.0",
|
|
98
|
-
"jest-snapshot-serializer-ansi": "^2.1
|
|
98
|
+
"jest-snapshot-serializer-ansi": "^2.2.1",
|
|
99
99
|
"jest-snapshot-serializer-raw": "^2.0.0",
|
|
100
100
|
"jest-watch-typeahead": "^2.2.2",
|
|
101
101
|
"lines-and-columns": "^2.0.4",
|
|
102
|
-
"prettier": "^3.
|
|
103
|
-
"solc": "^0.8.
|
|
104
|
-
"ts-loader": "^9.5.
|
|
102
|
+
"prettier": "^3.5.3",
|
|
103
|
+
"solc": "^0.8.29",
|
|
104
|
+
"ts-loader": "^9.5.2",
|
|
105
105
|
"ts-node": "^10.9.2",
|
|
106
|
-
"typescript": "^5.
|
|
107
|
-
"webpack": "^5.
|
|
106
|
+
"typescript": "^5.8.2",
|
|
107
|
+
"webpack": "^5.98.0",
|
|
108
108
|
"webpack-cli": "^6.0.1"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@nomicfoundation/slang": "0.
|
|
111
|
+
"@nomicfoundation/slang": "1.0.0",
|
|
112
112
|
"@solidity-parser/parser": "^0.19.0",
|
|
113
|
-
"semver": "^7.
|
|
113
|
+
"semver": "^7.7.1"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"prettier": ">=3.0.0"
|
|
@@ -9,7 +9,7 @@ import { ConditionalExpression } from './ConditionalExpression.js';
|
|
|
9
9
|
import { OrExpression } from './OrExpression.js';
|
|
10
10
|
import { AndExpression } from './AndExpression.js';
|
|
11
11
|
import { EqualityExpression } from './EqualityExpression.js';
|
|
12
|
-
import {
|
|
12
|
+
import { InequalityExpression } from './InequalityExpression.js';
|
|
13
13
|
import { BitwiseOrExpression } from './BitwiseOrExpression.js';
|
|
14
14
|
import { BitwiseXorExpression } from './BitwiseXorExpression.js';
|
|
15
15
|
import { BitwiseAndExpression } from './BitwiseAndExpression.js';
|
|
@@ -51,7 +51,7 @@ export class Expression implements SlangNode {
|
|
|
51
51
|
| OrExpression
|
|
52
52
|
| AndExpression
|
|
53
53
|
| EqualityExpression
|
|
54
|
-
|
|
|
54
|
+
| InequalityExpression
|
|
55
55
|
| BitwiseOrExpression
|
|
56
56
|
| BitwiseXorExpression
|
|
57
57
|
| BitwiseAndExpression
|
|
@@ -112,9 +112,9 @@ export class Expression implements SlangNode {
|
|
|
112
112
|
options
|
|
113
113
|
);
|
|
114
114
|
break;
|
|
115
|
-
case NonterminalKind.
|
|
116
|
-
this.variant = new
|
|
117
|
-
ast.variant as ast.
|
|
115
|
+
case NonterminalKind.InequalityExpression:
|
|
116
|
+
this.variant = new InequalityExpression(
|
|
117
|
+
ast.variant as ast.InequalityExpression,
|
|
118
118
|
options
|
|
119
119
|
);
|
|
120
120
|
break;
|
|
@@ -8,8 +8,8 @@ import type { AstPath, Doc, ParserOptions } from 'prettier';
|
|
|
8
8
|
import type { AstNode } from './types.d.ts';
|
|
9
9
|
import type { PrintFunction, SlangNode } from '../types.d.ts';
|
|
10
10
|
|
|
11
|
-
export class
|
|
12
|
-
readonly kind = NonterminalKind.
|
|
11
|
+
export class InequalityExpression implements SlangNode {
|
|
12
|
+
readonly kind = NonterminalKind.InequalityExpression;
|
|
13
13
|
|
|
14
14
|
comments;
|
|
15
15
|
|
|
@@ -21,7 +21,7 @@ export class ComparisonExpression implements SlangNode {
|
|
|
21
21
|
|
|
22
22
|
rightOperand: Expression;
|
|
23
23
|
|
|
24
|
-
constructor(ast: ast.
|
|
24
|
+
constructor(ast: ast.InequalityExpression, options: ParserOptions<AstNode>) {
|
|
25
25
|
let metadata = getNodeMetadata(ast);
|
|
26
26
|
|
|
27
27
|
this.leftOperand = new Expression(ast.leftOperand, options);
|
|
@@ -35,7 +35,7 @@ export class ComparisonExpression implements SlangNode {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
print(
|
|
38
|
-
path: AstPath<
|
|
38
|
+
path: AstPath<InequalityExpression>,
|
|
39
39
|
print: PrintFunction,
|
|
40
40
|
options: ParserOptions<AstNode>
|
|
41
41
|
): Doc {
|
|
@@ -2,7 +2,6 @@ import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
|
2
2
|
import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js';
|
|
3
3
|
import { YulFunctionCallExpression } from './YulFunctionCallExpression.js';
|
|
4
4
|
import { YulLiteral } from './YulLiteral.js';
|
|
5
|
-
import { YulBuiltInFunction } from './YulBuiltInFunction.js';
|
|
6
5
|
import { YulPath } from './YulPath.js';
|
|
7
6
|
|
|
8
7
|
import type * as ast from '@nomicfoundation/slang/ast';
|
|
@@ -17,11 +16,7 @@ export class YulExpression implements SlangNode {
|
|
|
17
16
|
|
|
18
17
|
loc;
|
|
19
18
|
|
|
20
|
-
variant:
|
|
21
|
-
| YulFunctionCallExpression
|
|
22
|
-
| YulLiteral
|
|
23
|
-
| YulBuiltInFunction
|
|
24
|
-
| YulPath;
|
|
19
|
+
variant: YulFunctionCallExpression | YulLiteral | YulPath;
|
|
25
20
|
|
|
26
21
|
constructor(ast: ast.YulExpression, options: ParserOptions<AstNode>) {
|
|
27
22
|
let metadata = getNodeMetadata(ast);
|
|
@@ -36,11 +31,6 @@ export class YulExpression implements SlangNode {
|
|
|
36
31
|
case NonterminalKind.YulLiteral:
|
|
37
32
|
this.variant = new YulLiteral(ast.variant as ast.YulLiteral, options);
|
|
38
33
|
break;
|
|
39
|
-
case NonterminalKind.YulBuiltInFunction:
|
|
40
|
-
this.variant = new YulBuiltInFunction(
|
|
41
|
-
ast.variant as ast.YulBuiltInFunction
|
|
42
|
-
);
|
|
43
|
-
break;
|
|
44
34
|
case NonterminalKind.YulPath:
|
|
45
35
|
this.variant = new YulPath(ast.variant as ast.YulPath);
|
|
46
36
|
break;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
2
|
-
import { getNodeMetadata
|
|
3
|
-
import {
|
|
2
|
+
import { getNodeMetadata } from '../slang-utils/metadata.js';
|
|
3
|
+
import { YulIdentifier } from './YulIdentifier.js';
|
|
4
4
|
|
|
5
5
|
import type * as ast from '@nomicfoundation/slang/ast';
|
|
6
6
|
import type { AstPath, Doc } from 'prettier';
|
|
@@ -13,18 +13,16 @@ export class YulPath implements SlangNode {
|
|
|
13
13
|
|
|
14
14
|
loc;
|
|
15
15
|
|
|
16
|
-
items:
|
|
16
|
+
items: YulIdentifier[];
|
|
17
17
|
|
|
18
18
|
separators: string[];
|
|
19
19
|
|
|
20
20
|
constructor(ast: ast.YulPath) {
|
|
21
|
-
|
|
21
|
+
const metadata = getNodeMetadata(ast, true);
|
|
22
22
|
|
|
23
|
-
this.items = ast.items.map((item) => new
|
|
23
|
+
this.items = ast.items.map((item) => new YulIdentifier(item));
|
|
24
24
|
this.separators = ast.separators.map((separator) => separator.unparse());
|
|
25
25
|
|
|
26
|
-
metadata = updateMetadata(metadata, [this.items]);
|
|
27
|
-
|
|
28
26
|
this.comments = metadata.comments;
|
|
29
27
|
this.loc = metadata.loc;
|
|
30
28
|
}
|
|
@@ -20,7 +20,6 @@ import type { CallOptionsExpression } from './CallOptionsExpression.ts';
|
|
|
20
20
|
import type { CatchClause } from './CatchClause.ts';
|
|
21
21
|
import type { CatchClauseError } from './CatchClauseError.ts';
|
|
22
22
|
import type { CatchClauses } from './CatchClauses.ts';
|
|
23
|
-
import type { ComparisonExpression } from './ComparisonExpression.ts';
|
|
24
23
|
import type { ConditionalExpression } from './ConditionalExpression.ts';
|
|
25
24
|
import type { ConstantDefinition } from './ConstantDefinition.ts';
|
|
26
25
|
import type { ConstructorAttribute } from './ConstructorAttribute.ts';
|
|
@@ -80,6 +79,7 @@ import type { ImportDeconstructionSymbols } from './ImportDeconstructionSymbols.
|
|
|
80
79
|
import type { ImportDirective } from './ImportDirective.ts';
|
|
81
80
|
import type { IndexAccessEnd } from './IndexAccessEnd.ts';
|
|
82
81
|
import type { IndexAccessExpression } from './IndexAccessExpression.ts';
|
|
82
|
+
import type { InequalityExpression } from './InequalityExpression.ts';
|
|
83
83
|
import type { InheritanceSpecifier } from './InheritanceSpecifier.ts';
|
|
84
84
|
import type { InheritanceType } from './InheritanceType.ts';
|
|
85
85
|
import type { InheritanceTypes } from './InheritanceTypes.ts';
|
|
@@ -190,7 +190,6 @@ import type { YulArguments } from './YulArguments.ts';
|
|
|
190
190
|
import type { YulAssignmentOperator } from './YulAssignmentOperator.ts';
|
|
191
191
|
import type { YulBlock } from './YulBlock.ts';
|
|
192
192
|
import type { YulBreakStatement } from './YulBreakStatement.ts';
|
|
193
|
-
import type { YulBuiltInFunction } from './YulBuiltInFunction.ts';
|
|
194
193
|
import type { YulColonAndEqual } from './YulColonAndEqual.ts';
|
|
195
194
|
import type { YulContinueStatement } from './YulContinueStatement.ts';
|
|
196
195
|
import type { YulDefaultCase } from './YulDefaultCase.ts';
|
|
@@ -207,7 +206,6 @@ import type { YulLiteral } from './YulLiteral.ts';
|
|
|
207
206
|
import type { YulParameters } from './YulParameters.ts';
|
|
208
207
|
import type { YulParametersDeclaration } from './YulParametersDeclaration.ts';
|
|
209
208
|
import type { YulPath } from './YulPath.ts';
|
|
210
|
-
import type { YulPathComponent } from './YulPathComponent.ts';
|
|
211
209
|
import type { YulPaths } from './YulPaths.ts';
|
|
212
210
|
import type { YulReturnsDeclaration } from './YulReturnsDeclaration.ts';
|
|
213
211
|
import type { YulStackAssignmentOperator } from './YulStackAssignmentOperator.ts';
|
|
@@ -322,7 +320,7 @@ export type StrictAstNode =
|
|
|
322
320
|
| OrExpression
|
|
323
321
|
| AndExpression
|
|
324
322
|
| EqualityExpression
|
|
325
|
-
|
|
|
323
|
+
| InequalityExpression
|
|
326
324
|
| BitwiseOrExpression
|
|
327
325
|
| BitwiseXorExpression
|
|
328
326
|
| BitwiseAndExpression
|
|
@@ -410,8 +408,6 @@ export type StrictAstNode =
|
|
|
410
408
|
| YulAssignmentOperator
|
|
411
409
|
| YulSwitchCase
|
|
412
410
|
| YulExpression
|
|
413
|
-
| YulPathComponent
|
|
414
|
-
| YulBuiltInFunction
|
|
415
411
|
| YulLiteral
|
|
416
412
|
| SourceUnitMembers
|
|
417
413
|
| VersionExpressionSet
|
|
@@ -5,8 +5,8 @@ import { createKindCheckFunction } from '../slang-utils/create-kind-check-functi
|
|
|
5
5
|
|
|
6
6
|
import type { AstPath, Doc } from 'prettier';
|
|
7
7
|
import type { BinaryOperation, StrictAstNode } from '../slang-nodes/types.d.ts';
|
|
8
|
-
import type { ComparisonExpression } from '../slang-nodes/ComparisonExpression.ts';
|
|
9
8
|
import type { EqualityExpression } from '../slang-nodes/EqualityExpression.ts';
|
|
9
|
+
import type { InequalityExpression } from '../slang-nodes/InequalityExpression.ts';
|
|
10
10
|
|
|
11
11
|
const { group, indent } = doc.builders;
|
|
12
12
|
|
|
@@ -25,7 +25,7 @@ const isBinaryOperationWithoutComparison = createKindCheckFunction([
|
|
|
25
25
|
node: StrictAstNode
|
|
26
26
|
) => node is Exclude<
|
|
27
27
|
BinaryOperation,
|
|
28
|
-
|
|
28
|
+
EqualityExpression | InequalityExpression
|
|
29
29
|
>;
|
|
30
30
|
|
|
31
31
|
const binaryGroupRulesBuilder =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VersionExpressionSets as SlangVersionExpressionSets } from '@nomicfoundation/slang/ast';
|
|
2
2
|
import { NonterminalKind, Query } from '@nomicfoundation/slang/cst';
|
|
3
3
|
import { Parser } from '@nomicfoundation/slang/parser';
|
|
4
|
+
import { LanguageFacts } from '@nomicfoundation/slang/utils';
|
|
4
5
|
import {
|
|
5
6
|
maxSatisfying,
|
|
6
7
|
minSatisfying,
|
|
@@ -15,7 +16,7 @@ import type { ParseOutput } from '@nomicfoundation/slang/parser';
|
|
|
15
16
|
import type { ParserOptions } from 'prettier';
|
|
16
17
|
import type { AstNode } from '../slang-nodes/types.js';
|
|
17
18
|
|
|
18
|
-
const supportedVersions =
|
|
19
|
+
const supportedVersions = LanguageFacts.allVersions();
|
|
19
20
|
|
|
20
21
|
const milestoneVersions = Array.from(
|
|
21
22
|
supportedVersions.reduce((minorRanges, version) => {
|
|
@@ -31,7 +32,7 @@ const milestoneVersions = Array.from(
|
|
|
31
32
|
}, []);
|
|
32
33
|
|
|
33
34
|
const queries = [
|
|
34
|
-
Query.
|
|
35
|
+
Query.create('[VersionPragma @versionRanges [VersionExpressionSets]]')
|
|
35
36
|
];
|
|
36
37
|
|
|
37
38
|
let parser: Parser;
|
|
@@ -42,10 +43,10 @@ export function createParser(
|
|
|
42
43
|
): [Parser, ParseOutput] {
|
|
43
44
|
const compiler = maxSatisfying(supportedVersions, options.compiler);
|
|
44
45
|
if (compiler) {
|
|
45
|
-
if (!parser || parser.
|
|
46
|
+
if (!parser || parser.languageVersion !== compiler) {
|
|
46
47
|
parser = Parser.create(compiler);
|
|
47
48
|
}
|
|
48
|
-
return [parser, parser.
|
|
49
|
+
return [parser, parser.parseNonterminal(NonterminalKind.SourceUnit, text)];
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
let isCachedParser = false;
|
|
@@ -59,7 +60,7 @@ export function createParser(
|
|
|
59
60
|
let inferredRanges: string[] = [];
|
|
60
61
|
|
|
61
62
|
try {
|
|
62
|
-
parseOutput = parser.
|
|
63
|
+
parseOutput = parser.parseNonterminal(NonterminalKind.SourceUnit, text);
|
|
63
64
|
inferredRanges = tryToCollectPragmas(parseOutput, parser, isCachedParser);
|
|
64
65
|
} catch {
|
|
65
66
|
for (
|
|
@@ -70,7 +71,7 @@ export function createParser(
|
|
|
70
71
|
try {
|
|
71
72
|
const version = milestoneVersions[i];
|
|
72
73
|
parser = Parser.create(version);
|
|
73
|
-
parseOutput = parser.
|
|
74
|
+
parseOutput = parser.parseNonterminal(NonterminalKind.SourceUnit, text);
|
|
74
75
|
inferredRanges = tryToCollectPragmas(parseOutput, parser);
|
|
75
76
|
break;
|
|
76
77
|
} catch {
|
|
@@ -98,9 +99,9 @@ export function createParser(
|
|
|
98
99
|
? satisfyingVersions[satisfyingVersions.length - 1]
|
|
99
100
|
: supportedVersions[supportedVersions.length - 1];
|
|
100
101
|
|
|
101
|
-
if (inferredVersion !== parser.
|
|
102
|
+
if (inferredVersion !== parser.languageVersion) {
|
|
102
103
|
parser = Parser.create(inferredVersion);
|
|
103
|
-
parseOutput = parser.
|
|
104
|
+
parseOutput = parser.parseNonterminal(NonterminalKind.SourceUnit, text);
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
@@ -132,11 +133,11 @@ function tryToCollectPragmas(
|
|
|
132
133
|
if (ranges.length === 0) {
|
|
133
134
|
// If we didn't find pragmas but succeeded parsing the source we keep it.
|
|
134
135
|
if (!isCachedParser && parseOutput.isValid()) {
|
|
135
|
-
return [parser.
|
|
136
|
+
return [parser.languageVersion];
|
|
136
137
|
}
|
|
137
138
|
// Otherwise we throw.
|
|
138
139
|
throw new Error(
|
|
139
|
-
`Using version ${parser.
|
|
140
|
+
`Using version ${parser.languageVersion} did not find any pragma statement and does not parse without errors.`
|
|
140
141
|
);
|
|
141
142
|
}
|
|
142
143
|
|
|
@@ -11,8 +11,8 @@ export const isBinaryOperation = createKindCheckFunction([
|
|
|
11
11
|
NonterminalKind.BitwiseAndExpression,
|
|
12
12
|
NonterminalKind.BitwiseOrExpression,
|
|
13
13
|
NonterminalKind.BitwiseXorExpression,
|
|
14
|
-
NonterminalKind.ComparisonExpression,
|
|
15
14
|
NonterminalKind.EqualityExpression,
|
|
15
|
+
NonterminalKind.InequalityExpression,
|
|
16
16
|
NonterminalKind.AndExpression,
|
|
17
17
|
NonterminalKind.OrExpression,
|
|
18
18
|
NonterminalKind.ShiftExpression
|
|
@@ -15,13 +15,13 @@ export default function parse(
|
|
|
15
15
|
|
|
16
16
|
if (parseOutput.isValid()) {
|
|
17
17
|
// We update the compiler version by the inferred one.
|
|
18
|
-
options.compiler = parser.
|
|
18
|
+
options.compiler = parser.languageVersion;
|
|
19
19
|
const parsed = new SourceUnit(
|
|
20
|
-
new SlangSourceUnit(parseOutput.tree.asNonterminalNode()
|
|
20
|
+
new SlangSourceUnit(parseOutput.tree.asNonterminalNode()),
|
|
21
21
|
options
|
|
22
22
|
);
|
|
23
23
|
clearOffsets();
|
|
24
24
|
return parsed;
|
|
25
25
|
}
|
|
26
|
-
throw new Error(parseOutput.errors[0].message);
|
|
26
|
+
throw new Error(parseOutput.errors()[0].message);
|
|
27
27
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ export type SlangAstNode =
|
|
|
142
142
|
| ast.OrExpression
|
|
143
143
|
| ast.AndExpression
|
|
144
144
|
| ast.EqualityExpression
|
|
145
|
-
| ast.
|
|
145
|
+
| ast.InequalityExpression
|
|
146
146
|
| ast.BitwiseOrExpression
|
|
147
147
|
| ast.BitwiseXorExpression
|
|
148
148
|
| ast.BitwiseAndExpression
|
|
@@ -230,8 +230,6 @@ export type SlangAstNode =
|
|
|
230
230
|
| ast.YulAssignmentOperator
|
|
231
231
|
| ast.YulSwitchCase
|
|
232
232
|
| ast.YulExpression
|
|
233
|
-
| ast.YulPathComponent
|
|
234
|
-
| ast.YulBuiltInFunction
|
|
235
233
|
| ast.YulLiteral
|
|
236
234
|
| ast.SourceUnitMembers
|
|
237
235
|
| ast.VersionExpressionSet
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
2
|
-
import { getNodeMetadata } from '../slang-utils/metadata.js';
|
|
3
|
-
export class YulBuiltInFunction {
|
|
4
|
-
constructor(ast) {
|
|
5
|
-
this.kind = NonterminalKind.YulBuiltInFunction;
|
|
6
|
-
const metadata = getNodeMetadata(ast);
|
|
7
|
-
this.variant = ast.variant.unparse();
|
|
8
|
-
this.comments = metadata.comments;
|
|
9
|
-
this.loc = metadata.loc;
|
|
10
|
-
}
|
|
11
|
-
print() {
|
|
12
|
-
return this.variant;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=YulBuiltInFunction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YulBuiltInFunction.js","sourceRoot":"","sources":["../../src/slang-nodes/YulBuiltInFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7D,MAAM,OAAO,kBAAkB;IAS7B,YAAY,GAA2B;QAR9B,SAAI,GAAG,eAAe,CAAC,kBAAkB,CAAC;QASjD,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
2
|
-
import { getNodeMetadata } from '../slang-utils/metadata.js';
|
|
3
|
-
import { YulIdentifier } from './YulIdentifier.js';
|
|
4
|
-
export class YulPathComponent {
|
|
5
|
-
constructor(ast) {
|
|
6
|
-
this.kind = NonterminalKind.YulPathComponent;
|
|
7
|
-
const metadata = getNodeMetadata(ast);
|
|
8
|
-
this.variant = new YulIdentifier(ast.variant);
|
|
9
|
-
this.comments = metadata.comments;
|
|
10
|
-
this.loc = metadata.loc;
|
|
11
|
-
}
|
|
12
|
-
print(path, print) {
|
|
13
|
-
return path.call(print, 'variant');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=YulPathComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YulPathComponent.js","sourceRoot":"","sources":["../../src/slang-nodes/YulPathComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,OAAO,gBAAgB;IAS3B,YAAY,GAAyB;QAR5B,SAAI,GAAG,eAAe,CAAC,gBAAgB,CAAC;QAS/C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAA+B,EAAE,KAAoB;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
2
|
-
import { getNodeMetadata } from '../slang-utils/metadata.js';
|
|
3
|
-
|
|
4
|
-
import type * as ast from '@nomicfoundation/slang/ast';
|
|
5
|
-
import type { Doc } from 'prettier';
|
|
6
|
-
import type { SlangNode } from '../types.d.ts';
|
|
7
|
-
|
|
8
|
-
export class YulBuiltInFunction implements SlangNode {
|
|
9
|
-
readonly kind = NonterminalKind.YulBuiltInFunction;
|
|
10
|
-
|
|
11
|
-
comments;
|
|
12
|
-
|
|
13
|
-
loc;
|
|
14
|
-
|
|
15
|
-
variant: string;
|
|
16
|
-
|
|
17
|
-
constructor(ast: ast.YulBuiltInFunction) {
|
|
18
|
-
const metadata = getNodeMetadata(ast);
|
|
19
|
-
|
|
20
|
-
this.variant = ast.variant.unparse();
|
|
21
|
-
|
|
22
|
-
this.comments = metadata.comments;
|
|
23
|
-
this.loc = metadata.loc;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
print(): Doc {
|
|
27
|
-
return this.variant;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { NonterminalKind } from '@nomicfoundation/slang/cst';
|
|
2
|
-
import { getNodeMetadata } from '../slang-utils/metadata.js';
|
|
3
|
-
import { YulIdentifier } from './YulIdentifier.js';
|
|
4
|
-
|
|
5
|
-
import type * as ast from '@nomicfoundation/slang/ast';
|
|
6
|
-
import type { AstPath, Doc } from 'prettier';
|
|
7
|
-
import type { PrintFunction, SlangNode } from '../types.d.ts';
|
|
8
|
-
|
|
9
|
-
export class YulPathComponent implements SlangNode {
|
|
10
|
-
readonly kind = NonterminalKind.YulPathComponent;
|
|
11
|
-
|
|
12
|
-
comments;
|
|
13
|
-
|
|
14
|
-
loc;
|
|
15
|
-
|
|
16
|
-
variant: YulIdentifier;
|
|
17
|
-
|
|
18
|
-
constructor(ast: ast.YulPathComponent) {
|
|
19
|
-
const metadata = getNodeMetadata(ast);
|
|
20
|
-
|
|
21
|
-
this.variant = new YulIdentifier(ast.variant);
|
|
22
|
-
|
|
23
|
-
this.comments = metadata.comments;
|
|
24
|
-
this.loc = metadata.loc;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
print(path: AstPath<YulPathComponent>, print: PrintFunction): Doc {
|
|
28
|
-
return path.call(print, 'variant');
|
|
29
|
-
}
|
|
30
|
-
}
|