@@ -9,12 +9,18 @@ import {AddressType} from "../common/symbol";
99import { Type } from "../type" ;
1010import { ClassType } from "../type/class_type" ;
1111import { ArrayType } from "../type/compound_type" ;
12- import { I32Binary , WBinaryOperation , WConst , WLoad , WStore , WType } from "../wasm" ;
13- import { getNativeType } from "../wasm/constant" ;
14- import { Emitter } from "../wasm/emitter" ;
15- import { WGetAddress , WGetGlobal , WGetLocal , WMemoryLocation } from "../wasm/expression" ;
16- import { WExpression , WStatement } from "../wasm/node" ;
17- import { WSetGlobal , WSetLocal } from "../wasm/statement" ;
12+ import {
13+ Emitter ,
14+ getNativeType ,
15+ I32Binary ,
16+ WBinaryOperation ,
17+ WConst , WExpression , WGetAddress , WGetGlobal , WGetLocal ,
18+ WLoad ,
19+ WMemoryLocation ,
20+ WSetGlobal , WSetLocal , WStatement ,
21+ WStore ,
22+ WType ,
23+ } from "../wasm" ;
1824import { CompileContext } from "./context" ;
1925
2026export class WAddressHolder extends WExpression {
@@ -275,7 +281,7 @@ export class WAddressHolder extends WExpression {
275281 result = new WBinaryOperation (
276282 I32Binary . add ,
277283 new WGetLocal ( WType . i32 , ctx . currentFuncContext . currentFunction . $sp , this . location ) ,
278- new WConst ( WType . i32 , ( this . place as number + this . offset ) . toString ( ) ) ,
284+ new WConst ( WType . i32 , ( this . place as number + this . offset ) . toString ( ) , this . location ) ,
279285 this . location ,
280286 ) ;
281287 break ;
@@ -286,7 +292,7 @@ export class WAddressHolder extends WExpression {
286292 result = new WBinaryOperation (
287293 I32Binary . add ,
288294 new WGetGlobal ( WType . i32 , "$sp" , this . location ) ,
289- new WConst ( WType . i32 , ( this . place as number + this . offset ) . toString ( ) ) ,
295+ new WConst ( WType . i32 , ( this . place as number + this . offset ) . toString ( ) , this . location ) ,
290296 this . location ,
291297 ) ;
292298 break ;
@@ -321,24 +327,8 @@ export class WAddressHolder extends WExpression {
321327 throw new EmitError ( `WAddressHolder()` ) ;
322328 }
323329
324- public emitJSON ( e : Emitter ) : void {
325- throw new EmitError ( `WAddressHolder()` ) ;
326- }
327-
328- public fold ( ) : WExpression {
329- return this ;
330- }
331-
332- public length ( e : Emitter ) : number {
333- throw new EmitError ( `WAddressHolder()` ) ;
334- }
335-
336330 public isPure ( ) : boolean {
337331 return true ;
338332 }
339333
340- public dump ( e : Emitter ) : void {
341- e . dump ( "===ADDRESS HOLDER===" , this . location ) ;
342- }
343-
344334}
0 commit comments