import * as ts from 'typescript' ; import { Checker } from '../../checker' ; import { debugLog } from '../ast_tools' ; import { isLiteral } from '../is_literal' ; import { PropertyMatcher } from '../property_matcher' ; import { matchPropertyWrite , PropertyWriteEngine } from './property_write_engine' ; function matchPropertyNonConstantWrite ( tc , n , matcher ) { debugLog ( ( ) => `inspecting ${ n . getFullText ( ) . trim ( ) }` ) ; if ( matchPropertyWrite ( tc , n , matcher ) === undefined ) { return ; } const rval = ( n . parent as ts . BinaryExpression ) . right ; if ( isLiteral ( tc , rval ) ) { debugLog ( ( ) => `Assigned value (${ rval . getFullText ( ) }) is a compile-time constant.` ) ; return ; } return n . parent ; } /**
 * The engine for BANNED_PROPERTY_NON_CONSTANT_WRITE.
 */ export class PropertyNonConstantWriteEngine extends PropertyWriteEngine { override register ( checker ) { this . registerWith ( checker , matchPropertyNonConstantWrite ) ; } }