Skip to content

Commit

Permalink
reefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zianksm committed Dec 11, 2022
1 parent 61f0bd5 commit 11e8ca3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import {
FORMAT_LINE,
PUBLIC_IDENT,
} from "../token";
import { TreeBuilder } from "../grouper";
import { TreeBuilder } from "../tree-builder";
import { TypescriptBodyParser } from "./body-parser";

const UNNAMED_VAR = "argv";
const SINGLE_ELEMENT = 1;
export class TypescriptParser {
export class TypescriptAssembler {
private unnamedCounter: number = 0;

private incrementCounter() {
Expand Down Expand Up @@ -98,7 +98,7 @@ export class TypescriptParser {
return SPACE.concat(OPEN_PAR);
}

public parse(Tree: Tree) {
public build(Tree: Tree) {
for (const fn of Tree) {
// it is IMPORTANT that we parse signature literal AFTER parsing input and output literals.
// because we need input and output literals to complete function signature literals.
Expand Down
10 changes: 5 additions & 5 deletions src/implementation/writer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as fs from "fs-extra";
import * as path from "path";
import { ABI, Branch } from "./type-mapping";
import { TypescriptParser } from "./typescript/io-parser";
import { ABI, Branch, Tree } from "./type-mapping";
import { TypescriptAssembler } from "./typescript/assembler";
import { AbiReader } from "./reader";
import { TypescriptClassParser } from "./typescript/class-parser";
import { TreeBuilder } from "./grouper";
import { TreeBuilder } from "./tree-builder";

export type writerOtions =
| {
Expand All @@ -27,14 +27,12 @@ export type writerOtions =
};

export class Writer {
typeScriptTypescriptBodyParser: TypescriptParser;
typeScriptClassParser: TypescriptClassParser;
abiReader: AbiReader;
TreeBuilder: TreeBuilder;

constructor() {
this.abiReader = new AbiReader();
this.typeScriptTypescriptBodyParser = new TypescriptParser();
this.typeScriptClassParser = new TypescriptClassParser();
this.TreeBuilder = new TreeBuilder();
}
Expand Down Expand Up @@ -64,6 +62,8 @@ export class Writer {
}

private buildTypescriptBinding(tree: Tree) {
let contract: string;

for (const node of tree) {
contract = contract.concat(node.signatureLiteral as string);
}
Expand Down

0 comments on commit 11e8ca3

Please sign in to comment.