Skip to content

Commit 28957ed

Browse files
committed
TSLEncoder: Remove While usage.
1 parent e431ae3 commit 28957ed

File tree

1 file changed

+1
-46
lines changed

1 file changed

+1
-46
lines changed

examples/jsm/transpiler/TSLEncoder.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class TSLEncoder {
289289

290290
} else if ( node.isFor ) {
291291

292-
code = this.emitFor( node );
292+
code = this.emitLoop( node );
293293

294294
} else if ( node.isVariableDeclaration ) {
295295

@@ -470,51 +470,6 @@ ${ this.tab }} )`;
470470

471471
}
472472

473-
emitFor( node ) {
474-
475-
const { initialization, condition, afterthought } = node;
476-
477-
if ( ( initialization && initialization.isVariableDeclaration && initialization.next === null ) &&
478-
( condition && condition.left.isAccessor && condition.left.property === initialization.name ) &&
479-
( afterthought && afterthought.isUnary ) &&
480-
( initialization.name === afterthought.expression.property )
481-
) {
482-
483-
return this.emitLoop( node );
484-
485-
}
486-
487-
return this.emitForWhile( node );
488-
489-
}
490-
491-
emitForWhile( node ) {
492-
493-
const initialization = this.emitExpression( node.initialization );
494-
const condition = this.emitExpression( node.condition );
495-
const afterthought = this.emitExpression( node.afterthought );
496-
497-
this.tab += '\t';
498-
499-
let forStr = '{\n\n' + this.tab + initialization + ';\n\n';
500-
forStr += `${ this.tab }While( ${ condition }, () => {\n\n`;
501-
502-
forStr += this.emitBody( node.body ) + '\n\n';
503-
504-
forStr += this.tab + '\t' + afterthought + ';\n\n';
505-
506-
forStr += this.tab + '} )\n\n';
507-
508-
this.tab = this.tab.slice( 0, - 1 );
509-
510-
forStr += this.tab + '}';
511-
512-
this.imports.add( 'While' );
513-
514-
return forStr;
515-
516-
}
517-
518473
emitVariables( node, isRoot = true ) {
519474

520475
const { name, type, value, next } = node;

0 commit comments

Comments
 (0)