File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
src/transformation/visitors/helpers Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 11import * as ts from "typescript" ;
22import * as lua from "../../../LuaAST" ;
33import * as helpers from "../../utils/helpers" ;
4- import { isNonNull } from "../../../utils" ;
54import { TransformationContext } from "../../context" ;
65import { transformAssignmentLeftHandSideExpression } from "../binary-expression/assignments" ;
76import { transformIdentifier } from "../identifier" ;
@@ -166,17 +165,19 @@ export function findMultiHelperAssignmentViolations(
166165 context : TransformationContext ,
167166 node : ts . ObjectLiteralExpression
168167) : ts . Node [ ] {
169- return node . properties
170- . filter ( ts . isShorthandPropertyAssignment )
171- . map ( element => {
172- const valueSymbol = context . checker . getShorthandAssignmentValueSymbol ( element ) ;
173- if ( valueSymbol ) {
174- const declaration = valueSymbol . valueDeclaration ;
175- if ( declaration && isMultiFunctionDeclaration ( declaration ) ) {
176- context . diagnostics . push ( invalidMultiFunctionUse ( element ) ) ;
177- return element ;
178- }
168+ const result : ts . Node [ ] = [ ] ;
169+
170+ for ( const element of node . properties ) {
171+ if ( ! ts . isShorthandPropertyAssignment ( element ) ) continue ;
172+ const valueSymbol = context . checker . getShorthandAssignmentValueSymbol ( element ) ;
173+ if ( valueSymbol ) {
174+ const declaration = valueSymbol . valueDeclaration ;
175+ if ( declaration && isMultiFunctionDeclaration ( declaration ) ) {
176+ context . diagnostics . push ( invalidMultiFunctionUse ( element ) ) ;
177+ result . push ( element ) ;
179178 }
180- } )
181- . filter ( isNonNull ) ;
179+ }
180+ }
181+
182+ return result ;
182183}
You can’t perform that action at this time.
0 commit comments