@@ -86,15 +86,15 @@ export interface Argument {
86
86
export class ContractBuilder implements Contract {
87
87
readonly name : string ;
88
88
readonly account : boolean ;
89
- license : string = 'MIT' ;
89
+ license = 'MIT' ;
90
90
upgradeable = false ;
91
91
92
92
readonly constructorArgs : Argument [ ] = [ ] ;
93
93
readonly constructorCode : string [ ] = [ ] ;
94
94
95
- private componentsMap : Map < string , Component > = new Map < string , Component > ( ) ;
96
- private implementedTraitsMap : Map < string , ImplementedTrait > = new Map < string , ImplementedTrait > ( ) ;
97
- private superVariablesMap : Map < string , Variable > = new Map < string , Variable > ( ) ;
95
+ private componentsMap : Map < string , Component > = new Map ( ) ;
96
+ private implementedTraitsMap : Map < string , ImplementedTrait > = new Map ( ) ;
97
+ private superVariablesMap : Map < string , Variable > = new Map ( ) ;
98
98
private standaloneImportsSet : Set < string > = new Set ( ) ;
99
99
private interfaceFlagsSet : Set < string > = new Set ( ) ;
100
100
@@ -126,7 +126,7 @@ export class ContractBuilder implements Contract {
126
126
return this . interfaceFlagsSet ;
127
127
}
128
128
129
- addStandaloneImport ( fullyQualified : string ) {
129
+ addStandaloneImport ( fullyQualified : string ) : void {
130
130
this . standaloneImportsSet . add ( fullyQualified ) ;
131
131
}
132
132
@@ -141,7 +141,7 @@ export class ContractBuilder implements Contract {
141
141
return ! present ;
142
142
}
143
143
144
- addImplToComponent ( component : Component , impl : Impl ) {
144
+ addImplToComponent ( component : Component , impl : Impl ) : void {
145
145
this . addComponent ( component ) ;
146
146
let c = this . componentsMap . get ( component . name ) ;
147
147
if ( c == undefined ) {
@@ -153,7 +153,7 @@ export class ContractBuilder implements Contract {
153
153
}
154
154
}
155
155
156
- addSuperVariable ( variable : Variable ) {
156
+ addSuperVariable ( variable : Variable ) : boolean {
157
157
if ( this . superVariablesMap . has ( variable . name ) ) {
158
158
return false ;
159
159
} else {
@@ -162,7 +162,7 @@ export class ContractBuilder implements Contract {
162
162
}
163
163
}
164
164
165
- addImplementedTrait ( baseTrait : BaseImplementedTrait ) {
165
+ addImplementedTrait ( baseTrait : BaseImplementedTrait ) : ImplementedTrait {
166
166
const key = baseTrait . name ;
167
167
const existingTrait = this . implementedTraitsMap . get ( key ) ;
168
168
if ( existingTrait !== undefined ) {
@@ -180,7 +180,7 @@ export class ContractBuilder implements Contract {
180
180
}
181
181
}
182
182
183
- addFunction ( baseTrait : BaseImplementedTrait , fn : BaseFunction ) {
183
+ addFunction ( baseTrait : BaseImplementedTrait , fn : BaseFunction ) : ContractFunction {
184
184
const t = this . addImplementedTrait ( baseTrait ) ;
185
185
186
186
const signature = this . getFunctionSignature ( fn ) ;
@@ -203,17 +203,17 @@ export class ContractBuilder implements Contract {
203
203
return contractFn ;
204
204
}
205
205
206
- private getFunctionSignature ( fn : BaseFunction ) {
206
+ private getFunctionSignature ( fn : BaseFunction ) : string {
207
207
return [ fn . name , '(' , ...fn . args . map ( a => a . name ) , ')' ] . join ( '' ) ;
208
208
}
209
209
210
- addFunctionCodeBefore ( baseTrait : BaseImplementedTrait , fn : BaseFunction , codeBefore : string ) {
210
+ addFunctionCodeBefore ( baseTrait : BaseImplementedTrait , fn : BaseFunction , codeBefore : string ) : void {
211
211
this . addImplementedTrait ( baseTrait ) ;
212
212
const existingFn = this . addFunction ( baseTrait , fn ) ;
213
213
existingFn . codeBefore = [ ...existingFn . codeBefore ?? [ ] , codeBefore ] ;
214
214
}
215
215
216
- addConstructorArgument ( arg : Argument ) {
216
+ addConstructorArgument ( arg : Argument ) : void {
217
217
for ( const existingArg of this . constructorArgs ) {
218
218
if ( existingArg . name == arg . name ) {
219
219
return ;
@@ -222,11 +222,11 @@ export class ContractBuilder implements Contract {
222
222
this . constructorArgs . push ( arg ) ;
223
223
}
224
224
225
- addConstructorCode ( code : string ) {
225
+ addConstructorCode ( code : string ) : void {
226
226
this . constructorCode . push ( code ) ;
227
227
}
228
228
229
- addInterfaceFlag ( flag : string ) {
229
+ addInterfaceFlag ( flag : string ) : void {
230
230
this . interfaceFlagsSet . add ( flag ) ;
231
231
}
232
232
}
0 commit comments