@@ -2,13 +2,13 @@ import { NonterminalKind } from '@nomicfoundation/slang/cst';
22import { printBinaryOperation } from '../slang-printers/print-binary-operation.js' ;
33import { createHugFunction } from '../slang-utils/create-hug-function.js' ;
44import { createKindCheckFunction } from '../slang-utils/create-kind-check-function.js' ;
5- import { getNodeMetadata , updateMetadata } from '../slang-utils/metadata .js' ;
5+ import { SlangNode } from './SlangNode .js' ;
66import { Expression } from './Expression.js' ;
77
88import type * as ast from '@nomicfoundation/slang/ast' ;
99import type { AstPath , Doc , ParserOptions } from 'prettier' ;
1010import type { AstNode } from './types.d.ts' ;
11- import type { PrintFunction , SlangNode } from '../types.d.ts' ;
11+ import type { PrintFunction } from '../types.d.ts' ;
1212
1313const tryToHug = createHugFunction ( [ '%' ] ) ;
1414
@@ -25,30 +25,23 @@ const printAdditiveExpression = printBinaryOperation(
2525 ] )
2626) ;
2727
28- export class AdditiveExpression implements SlangNode {
28+ export class AdditiveExpression extends SlangNode {
2929 readonly kind = NonterminalKind . AdditiveExpression ;
3030
31- comments ;
32-
33- loc ;
34-
3531 leftOperand : Expression ;
3632
3733 operator : string ;
3834
3935 rightOperand : Expression ;
4036
4137 constructor ( ast : ast . AdditiveExpression , options : ParserOptions < AstNode > ) {
42- [ this . loc , this . comments ] = getNodeMetadata ( ast ) ;
38+ super ( ast ) ;
4339
4440 this . leftOperand = new Expression ( ast . leftOperand , options ) ;
4541 this . operator = ast . operator . unparse ( ) ;
4642 this . rightOperand = new Expression ( ast . rightOperand , options ) ;
4743
48- updateMetadata ( this . loc , this . comments , [
49- this . leftOperand ,
50- this . rightOperand
51- ] ) ;
44+ this . updateMetadata ( [ this . leftOperand , this . rightOperand ] ) ;
5245
5346 this . leftOperand = tryToHug ( this . leftOperand ) ;
5447 this . rightOperand = tryToHug ( this . rightOperand ) ;
0 commit comments