@jackctaylor/roblox-ts 3.0.0-projectrefs.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +716 -0
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/include/Promise.lua +2068 -0
- package/include/RuntimeLib.lua +258 -0
- package/out/CLI/cli.d.ts +2 -0
- package/out/CLI/cli.js +41 -0
- package/out/CLI/commands/build.d.ts +7 -0
- package/out/CLI/commands/build.js +438 -0
- package/out/CLI/errors/CLIError.d.ts +4 -0
- package/out/CLI/errors/CLIError.js +12 -0
- package/out/CLI/index.d.ts +3 -0
- package/out/CLI/index.js +22 -0
- package/out/CLI/test.d.ts +1 -0
- package/out/CLI/test.js +82 -0
- package/out/CLI/util/patchFs.d.ts +1 -0
- package/out/CLI/util/patchFs.js +26 -0
- package/out/Project/classes/VirtualFileSystem.d.ts +14 -0
- package/out/Project/classes/VirtualFileSystem.js +102 -0
- package/out/Project/classes/VirtualProject.d.ts +15 -0
- package/out/Project/classes/VirtualProject.js +121 -0
- package/out/Project/functions/buildProject.d.ts +18 -0
- package/out/Project/functions/buildProject.js +48 -0
- package/out/Project/functions/buildProjectReferences.d.ts +3 -0
- package/out/Project/functions/buildProjectReferences.js +78 -0
- package/out/Project/functions/buildSolution.d.ts +10 -0
- package/out/Project/functions/buildSolution.js +97 -0
- package/out/Project/functions/checkFileName.d.ts +1 -0
- package/out/Project/functions/checkFileName.js +18 -0
- package/out/Project/functions/checkRojoConfig.d.ts +4 -0
- package/out/Project/functions/checkRojoConfig.js +26 -0
- package/out/Project/functions/cleanup.d.ts +2 -0
- package/out/Project/functions/cleanup.js +30 -0
- package/out/Project/functions/compileFiles.d.ts +4 -0
- package/out/Project/functions/compileFiles.js +160 -0
- package/out/Project/functions/compileProject.d.ts +14 -0
- package/out/Project/functions/compileProject.js +71 -0
- package/out/Project/functions/copyFiles.d.ts +3 -0
- package/out/Project/functions/copyFiles.js +13 -0
- package/out/Project/functions/copyInclude.d.ts +2 -0
- package/out/Project/functions/copyInclude.js +17 -0
- package/out/Project/functions/copyItem.d.ts +3 -0
- package/out/Project/functions/copyItem.js +27 -0
- package/out/Project/functions/createNodeModulesPathMapping.d.ts +1 -0
- package/out/Project/functions/createNodeModulesPathMapping.js +31 -0
- package/out/Project/functions/createPathTranslator.d.ts +4 -0
- package/out/Project/functions/createPathTranslator.js +22 -0
- package/out/Project/functions/createProgramFactory.d.ts +3 -0
- package/out/Project/functions/createProgramFactory.js +31 -0
- package/out/Project/functions/createProjectData.d.ts +2 -0
- package/out/Project/functions/createProjectData.js +102 -0
- package/out/Project/functions/createProjectProgram.d.ts +3 -0
- package/out/Project/functions/createProjectProgram.js +11 -0
- package/out/Project/functions/getChangedFilePaths.d.ts +2 -0
- package/out/Project/functions/getChangedFilePaths.js +47 -0
- package/out/Project/functions/getChangedSourceFiles.d.ts +2 -0
- package/out/Project/functions/getChangedSourceFiles.js +19 -0
- package/out/Project/functions/getParsedCommandLine.d.ts +3 -0
- package/out/Project/functions/getParsedCommandLine.js +41 -0
- package/out/Project/functions/getProjectReferences.d.ts +2 -0
- package/out/Project/functions/getProjectReferences.js +65 -0
- package/out/Project/functions/getResolvedProjectReferences.d.ts +3 -0
- package/out/Project/functions/getResolvedProjectReferences.js +43 -0
- package/out/Project/functions/setupProjectWatchProgram.d.ts +2 -0
- package/out/Project/functions/setupProjectWatchProgram.js +352 -0
- package/out/Project/functions/setupSolutionWatchProgram.d.ts +2 -0
- package/out/Project/functions/setupSolutionWatchProgram.js +355 -0
- package/out/Project/functions/tryRemoveOutput.d.ts +2 -0
- package/out/Project/functions/tryRemoveOutput.js +30 -0
- package/out/Project/functions/validateCompilerOptions.d.ts +2 -0
- package/out/Project/functions/validateCompilerOptions.js +87 -0
- package/out/Project/index.d.ts +4 -0
- package/out/Project/index.js +20 -0
- package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.d.ts +3 -0
- package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.js +28 -0
- package/out/Project/transformers/builtin/transformPaths.d.ts +5 -0
- package/out/Project/transformers/builtin/transformPaths.js +129 -0
- package/out/Project/transformers/builtin/transformTypeReferenceDirectives.d.ts +2 -0
- package/out/Project/transformers/builtin/transformTypeReferenceDirectives.js +23 -0
- package/out/Project/transformers/createTransformerList.d.ts +4 -0
- package/out/Project/transformers/createTransformerList.js +87 -0
- package/out/Project/transformers/createTransformerWatcher.d.ts +3 -0
- package/out/Project/transformers/createTransformerWatcher.js +59 -0
- package/out/Project/transformers/getPluginConfigs.d.ts +2 -0
- package/out/Project/transformers/getPluginConfigs.js +34 -0
- package/out/Project/util/createReadBuildProgramHost.d.ts +5 -0
- package/out/Project/util/createReadBuildProgramHost.js +15 -0
- package/out/Project/util/getCustomPreEmitDiagnostics.d.ts +4 -0
- package/out/Project/util/getCustomPreEmitDiagnostics.js +13 -0
- package/out/Project/util/isCompilableFile.d.ts +1 -0
- package/out/Project/util/isCompilableFile.js +18 -0
- package/out/Project/util/walkDirectorySync.d.ts +1 -0
- package/out/Project/util/walkDirectorySync.js +22 -0
- package/out/Shared/classes/Lazy.d.ts +8 -0
- package/out/Shared/classes/Lazy.js +22 -0
- package/out/Shared/classes/LogService.d.ts +9 -0
- package/out/Shared/classes/LogService.js +37 -0
- package/out/Shared/constants.d.ts +23 -0
- package/out/Shared/constants.js +50 -0
- package/out/Shared/diagnostics.d.ts +79 -0
- package/out/Shared/diagnostics.js +140 -0
- package/out/Shared/errors/DiagnosticError.d.ts +7 -0
- package/out/Shared/errors/DiagnosticError.js +16 -0
- package/out/Shared/errors/LoggableError.d.ts +5 -0
- package/out/Shared/errors/LoggableError.js +14 -0
- package/out/Shared/errors/ProjectError.d.ts +4 -0
- package/out/Shared/errors/ProjectError.js +12 -0
- package/out/Shared/index.d.ts +0 -0
- package/out/Shared/index.js +2 -0
- package/out/Shared/types.d.ts +50 -0
- package/out/Shared/types.js +3 -0
- package/out/Shared/util/assert.d.ts +1 -0
- package/out/Shared/util/assert.js +12 -0
- package/out/Shared/util/benchmark.d.ts +3 -0
- package/out/Shared/util/benchmark.js +32 -0
- package/out/Shared/util/createDiagnosticWithLocation.d.ts +3 -0
- package/out/Shared/util/createDiagnosticWithLocation.js +29 -0
- package/out/Shared/util/createGithubLink.d.ts +1 -0
- package/out/Shared/util/createGithubLink.js +12 -0
- package/out/Shared/util/createTextDiagnostic.d.ts +2 -0
- package/out/Shared/util/createTextDiagnostic.js +18 -0
- package/out/Shared/util/findAncestorDir.d.ts +1 -0
- package/out/Shared/util/findAncestorDir.js +16 -0
- package/out/Shared/util/findLastIndex.d.ts +1 -0
- package/out/Shared/util/findLastIndex.js +12 -0
- package/out/Shared/util/formatDiagnostics.d.ts +2 -0
- package/out/Shared/util/formatDiagnostics.js +19 -0
- package/out/Shared/util/getCanonicalFileName.d.ts +2 -0
- package/out/Shared/util/getCanonicalFileName.js +10 -0
- package/out/Shared/util/getOrSetDefault.d.ts +1 -0
- package/out/Shared/util/getOrSetDefault.js +12 -0
- package/out/Shared/util/getRootDirs.d.ts +2 -0
- package/out/Shared/util/getRootDirs.js +10 -0
- package/out/Shared/util/hasErrors.d.ts +2 -0
- package/out/Shared/util/hasErrors.js +11 -0
- package/out/Shared/util/isPathDescendantOf.d.ts +1 -0
- package/out/Shared/util/isPathDescendantOf.js +11 -0
- package/out/Shared/util/realPathExistsSync.d.ts +1 -0
- package/out/Shared/util/realPathExistsSync.js +13 -0
- package/out/Shared/warn.d.ts +1 -0
- package/out/Shared/warn.js +12 -0
- package/out/TSTransformer/classes/DiagnosticService.d.ts +11 -0
- package/out/TSTransformer/classes/DiagnosticService.js +37 -0
- package/out/TSTransformer/classes/MacroManager.d.ts +46 -0
- package/out/TSTransformer/classes/MacroManager.js +178 -0
- package/out/TSTransformer/classes/MultiTransformState.d.ts +9 -0
- package/out/TSTransformer/classes/MultiTransformState.js +15 -0
- package/out/TSTransformer/classes/TransformState.d.ts +73 -0
- package/out/TSTransformer/classes/TransformState.js +307 -0
- package/out/TSTransformer/index.d.ts +4 -0
- package/out/TSTransformer/index.js +23 -0
- package/out/TSTransformer/macros/callMacros.d.ts +2 -0
- package/out/TSTransformer/macros/callMacros.js +56 -0
- package/out/TSTransformer/macros/constructorMacros.d.ts +2 -0
- package/out/TSTransformer/macros/constructorMacros.js +97 -0
- package/out/TSTransformer/macros/identifierMacros.d.ts +2 -0
- package/out/TSTransformer/macros/identifierMacros.js +7 -0
- package/out/TSTransformer/macros/propertyCallMacros.d.ts +4 -0
- package/out/TSTransformer/macros/propertyCallMacros.js +726 -0
- package/out/TSTransformer/macros/types.d.ts +12 -0
- package/out/TSTransformer/macros/types.js +3 -0
- package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.js +78 -0
- package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.js +52 -0
- package/out/TSTransformer/nodes/binding/transformBindingName.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformBindingName.js +30 -0
- package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.js +97 -0
- package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.js +57 -0
- package/out/TSTransformer/nodes/class/transformClassConstructor.d.ts +7 -0
- package/out/TSTransformer/nodes/class/transformClassConstructor.js +96 -0
- package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.d.ts +7 -0
- package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.js +262 -0
- package/out/TSTransformer/nodes/class/transformDecorators.d.ts +4 -0
- package/out/TSTransformer/nodes/class/transformDecorators.js +179 -0
- package/out/TSTransformer/nodes/class/transformPropertyDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/class/transformPropertyDeclaration.js +33 -0
- package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.js +79 -0
- package/out/TSTransformer/nodes/expressions/transformAwaitExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformAwaitExpression.js +13 -0
- package/out/TSTransformer/nodes/expressions/transformBinaryExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformBinaryExpression.js +199 -0
- package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.js +15 -0
- package/out/TSTransformer/nodes/expressions/transformCallExpression.d.ts +7 -0
- package/out/TSTransformer/nodes/expressions/transformCallExpression.js +191 -0
- package/out/TSTransformer/nodes/expressions/transformClassExpression.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformClassExpression.js +10 -0
- package/out/TSTransformer/nodes/expressions/transformConditionalExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformConditionalExpression.js +55 -0
- package/out/TSTransformer/nodes/expressions/transformDeleteExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformDeleteExpression.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.js +62 -0
- package/out/TSTransformer/nodes/expressions/transformExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformExpression.js +107 -0
- package/out/TSTransformer/nodes/expressions/transformFunctionExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformFunctionExpression.js +46 -0
- package/out/TSTransformer/nodes/expressions/transformIdentifier.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformIdentifier.js +147 -0
- package/out/TSTransformer/nodes/expressions/transformImportExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformImportExpression.js +30 -0
- package/out/TSTransformer/nodes/expressions/transformJsxElement.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformJsxElement.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformJsxExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformJsxExpression.js +19 -0
- package/out/TSTransformer/nodes/expressions/transformJsxFragment.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformJsxFragment.js +28 -0
- package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformNewExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNewExpression.js +26 -0
- package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformNumericLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNumericLiteral.js +13 -0
- package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.js +98 -0
- package/out/TSTransformer/nodes/expressions/transformOmittedExpression.d.ts +2 -0
- package/out/TSTransformer/nodes/expressions/transformOmittedExpression.js +11 -0
- package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.js +19 -0
- package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.js +36 -0
- package/out/TSTransformer/nodes/expressions/transformSpreadElement.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformSpreadElement.js +35 -0
- package/out/TSTransformer/nodes/expressions/transformStringLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformStringLiteral.js +12 -0
- package/out/TSTransformer/nodes/expressions/transformSuperKeyword.d.ts +2 -0
- package/out/TSTransformer/nodes/expressions/transformSuperKeyword.js +11 -0
- package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.js +27 -0
- package/out/TSTransformer/nodes/expressions/transformTemplateExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformTemplateExpression.js +25 -0
- package/out/TSTransformer/nodes/expressions/transformThisExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformThisExpression.js +29 -0
- package/out/TSTransformer/nodes/expressions/transformTypeExpression.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformTypeExpression.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformUnaryExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformUnaryExpression.js +68 -0
- package/out/TSTransformer/nodes/expressions/transformVoidExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformVoidExpression.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformYieldExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformYieldExpression.js +46 -0
- package/out/TSTransformer/nodes/jsx/transformJsx.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsx.js +36 -0
- package/out/TSTransformer/nodes/jsx/transformJsxAttributes.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxAttributes.js +83 -0
- package/out/TSTransformer/nodes/jsx/transformJsxChildren.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxChildren.js +34 -0
- package/out/TSTransformer/nodes/jsx/transformJsxTagName.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxTagName.js +42 -0
- package/out/TSTransformer/nodes/statements/transformBlock.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformBlock.js +14 -0
- package/out/TSTransformer/nodes/statements/transformBreakStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformBreakStatement.js +24 -0
- package/out/TSTransformer/nodes/statements/transformClassDeclaration.d.ts +3 -0
- package/out/TSTransformer/nodes/statements/transformClassDeclaration.js +8 -0
- package/out/TSTransformer/nodes/statements/transformContinueStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformContinueStatement.js +24 -0
- package/out/TSTransformer/nodes/statements/transformDoStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformDoStatement.js +31 -0
- package/out/TSTransformer/nodes/statements/transformEnumDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformEnumDeclaration.js +97 -0
- package/out/TSTransformer/nodes/statements/transformExportAssignment.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformExportAssignment.js +53 -0
- package/out/TSTransformer/nodes/statements/transformExportDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformExportDeclaration.js +109 -0
- package/out/TSTransformer/nodes/statements/transformExpressionStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformExpressionStatement.js +62 -0
- package/out/TSTransformer/nodes/statements/transformForOfStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformForOfStatement.js +375 -0
- package/out/TSTransformer/nodes/statements/transformForStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformForStatement.js +371 -0
- package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.js +68 -0
- package/out/TSTransformer/nodes/statements/transformIfStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformIfStatement.js +46 -0
- package/out/TSTransformer/nodes/statements/transformImportDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformImportDeclaration.js +98 -0
- package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.js +36 -0
- package/out/TSTransformer/nodes/statements/transformModuleDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformModuleDeclaration.js +122 -0
- package/out/TSTransformer/nodes/statements/transformReturnStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformReturnStatement.js +74 -0
- package/out/TSTransformer/nodes/statements/transformStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformStatement.js +83 -0
- package/out/TSTransformer/nodes/statements/transformSwitchStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformSwitchStatement.js +105 -0
- package/out/TSTransformer/nodes/statements/transformThrowStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformThrowStatement.js +18 -0
- package/out/TSTransformer/nodes/statements/transformTryStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformTryStatement.js +148 -0
- package/out/TSTransformer/nodes/statements/transformVariableStatement.d.ts +8 -0
- package/out/TSTransformer/nodes/statements/transformVariableStatement.js +155 -0
- package/out/TSTransformer/nodes/statements/transformWhileStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformWhileStatement.js +30 -0
- package/out/TSTransformer/nodes/transformEntityName.d.ts +4 -0
- package/out/TSTransformer/nodes/transformEntityName.js +24 -0
- package/out/TSTransformer/nodes/transformInitializer.d.ts +4 -0
- package/out/TSTransformer/nodes/transformInitializer.js +22 -0
- package/out/TSTransformer/nodes/transformInterpolatedStringPart.d.ts +3 -0
- package/out/TSTransformer/nodes/transformInterpolatedStringPart.js +12 -0
- package/out/TSTransformer/nodes/transformLogical.d.ts +4 -0
- package/out/TSTransformer/nodes/transformLogical.js +103 -0
- package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.js +91 -0
- package/out/TSTransformer/nodes/transformMethodDeclaration.d.ts +5 -0
- package/out/TSTransformer/nodes/transformMethodDeclaration.js +82 -0
- package/out/TSTransformer/nodes/transformOptionalChain.d.ts +46 -0
- package/out/TSTransformer/nodes/transformOptionalChain.js +257 -0
- package/out/TSTransformer/nodes/transformParameters.d.ts +8 -0
- package/out/TSTransformer/nodes/transformParameters.js +104 -0
- package/out/TSTransformer/nodes/transformPropertyName.d.ts +4 -0
- package/out/TSTransformer/nodes/transformPropertyName.js +18 -0
- package/out/TSTransformer/nodes/transformSourceFile.d.ts +4 -0
- package/out/TSTransformer/nodes/transformSourceFile.js +171 -0
- package/out/TSTransformer/nodes/transformStatementList.d.ts +7 -0
- package/out/TSTransformer/nodes/transformStatementList.js +63 -0
- package/out/TSTransformer/nodes/transformWritable.d.ts +9 -0
- package/out/TSTransformer/nodes/transformWritable.js +49 -0
- package/out/TSTransformer/typeGuards.d.ts +5 -0
- package/out/TSTransformer/typeGuards.js +27 -0
- package/out/TSTransformer/types.d.ts +9 -0
- package/out/TSTransformer/types.js +3 -0
- package/out/TSTransformer/util/addIndexDiagnostics.d.ts +3 -0
- package/out/TSTransformer/util/addIndexDiagnostics.js +24 -0
- package/out/TSTransformer/util/addOneIfArrayType.d.ts +4 -0
- package/out/TSTransformer/util/addOneIfArrayType.js +14 -0
- package/out/TSTransformer/util/arrayBindingPatternContainsHoists.d.ts +3 -0
- package/out/TSTransformer/util/arrayBindingPatternContainsHoists.js +23 -0
- package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.d.ts +2 -0
- package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.js +17 -0
- package/out/TSTransformer/util/assertNever.d.ts +1 -0
- package/out/TSTransformer/util/assertNever.js +36 -0
- package/out/TSTransformer/util/assignment.d.ts +7 -0
- package/out/TSTransformer/util/assignment.js +48 -0
- package/out/TSTransformer/util/binding/getAccessorForBindingType.d.ts +6 -0
- package/out/TSTransformer/util/binding/getAccessorForBindingType.js +141 -0
- package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.d.ts +4 -0
- package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.js +15 -0
- package/out/TSTransformer/util/binding/objectAccessor.d.ts +4 -0
- package/out/TSTransformer/util/binding/objectAccessor.js +39 -0
- package/out/TSTransformer/util/bitwise.d.ts +6 -0
- package/out/TSTransformer/util/bitwise.js +67 -0
- package/out/TSTransformer/util/checkVariableHoist.d.ts +3 -0
- package/out/TSTransformer/util/checkVariableHoist.js +33 -0
- package/out/TSTransformer/util/cleanModuleName.d.ts +1 -0
- package/out/TSTransformer/util/cleanModuleName.js +7 -0
- package/out/TSTransformer/util/convertToIndexableExpression.d.ts +3 -0
- package/out/TSTransformer/util/convertToIndexableExpression.js +14 -0
- package/out/TSTransformer/util/createBinaryFromOperator.d.ts +4 -0
- package/out/TSTransformer/util/createBinaryFromOperator.js +54 -0
- package/out/TSTransformer/util/createGetService.d.ts +2 -0
- package/out/TSTransformer/util/createGetService.js +15 -0
- package/out/TSTransformer/util/createHoistDeclaration.d.ts +4 -0
- package/out/TSTransformer/util/createHoistDeclaration.js +20 -0
- package/out/TSTransformer/util/createImportExpression.d.ts +5 -0
- package/out/TSTransformer/util/createImportExpression.js +181 -0
- package/out/TSTransformer/util/createStringFromLiteral.d.ts +2 -0
- package/out/TSTransformer/util/createStringFromLiteral.js +27 -0
- package/out/TSTransformer/util/createTransformServices.d.ts +3 -0
- package/out/TSTransformer/util/createTransformServices.js +9 -0
- package/out/TSTransformer/util/createTruthinessChecks.d.ts +5 -0
- package/out/TSTransformer/util/createTruthinessChecks.js +50 -0
- package/out/TSTransformer/util/createTypeCheck.d.ts +2 -0
- package/out/TSTransformer/util/createTypeCheck.js +11 -0
- package/out/TSTransformer/util/ensureTransformOrder.d.ts +5 -0
- package/out/TSTransformer/util/ensureTransformOrder.js +39 -0
- package/out/TSTransformer/util/expressionChain.d.ts +3 -0
- package/out/TSTransformer/util/expressionChain.js +16 -0
- package/out/TSTransformer/util/expressionMightMutate.d.ts +4 -0
- package/out/TSTransformer/util/expressionMightMutate.js +57 -0
- package/out/TSTransformer/util/findConstructor.d.ts +4 -0
- package/out/TSTransformer/util/findConstructor.js +11 -0
- package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.d.ts +1 -0
- package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.js +306 -0
- package/out/TSTransformer/util/getAddIterableToArrayBuilder.d.ts +6 -0
- package/out/TSTransformer/util/getAddIterableToArrayBuilder.js +253 -0
- package/out/TSTransformer/util/getAssignableValue.d.ts +3 -0
- package/out/TSTransformer/util/getAssignableValue.js +15 -0
- package/out/TSTransformer/util/getConstantValueLiteral.d.ts +4 -0
- package/out/TSTransformer/util/getConstantValueLiteral.js +19 -0
- package/out/TSTransformer/util/getDeclaredVariables.d.ts +2 -0
- package/out/TSTransformer/util/getDeclaredVariables.js +37 -0
- package/out/TSTransformer/util/getExtendsNode.d.ts +2 -0
- package/out/TSTransformer/util/getExtendsNode.js +16 -0
- package/out/TSTransformer/util/getFlags.d.ts +1 -0
- package/out/TSTransformer/util/getFlags.js +13 -0
- package/out/TSTransformer/util/getKindName.d.ts +2 -0
- package/out/TSTransformer/util/getKindName.js +61 -0
- package/out/TSTransformer/util/getOriginalSymbolOfNode.d.ts +2 -0
- package/out/TSTransformer/util/getOriginalSymbolOfNode.js +15 -0
- package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.d.ts +3 -0
- package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.js +33 -0
- package/out/TSTransformer/util/getStatements.d.ts +2 -0
- package/out/TSTransformer/util/getStatements.js +11 -0
- package/out/TSTransformer/util/hasMultipleDefinitions.d.ts +2 -0
- package/out/TSTransformer/util/hasMultipleDefinitions.js +17 -0
- package/out/TSTransformer/util/isBlockedByTryStatement.d.ts +3 -0
- package/out/TSTransformer/util/isBlockedByTryStatement.js +17 -0
- package/out/TSTransformer/util/isMethod.d.ts +4 -0
- package/out/TSTransformer/util/isMethod.js +90 -0
- package/out/TSTransformer/util/isSymbolMutable.d.ts +3 -0
- package/out/TSTransformer/util/isSymbolMutable.js +24 -0
- package/out/TSTransformer/util/isSymbolOfValue.d.ts +2 -0
- package/out/TSTransformer/util/isSymbolOfValue.js +11 -0
- package/out/TSTransformer/util/isUsedAsStatement.d.ts +2 -0
- package/out/TSTransformer/util/isUsedAsStatement.js +23 -0
- package/out/TSTransformer/util/isValidMethodIndexWithoutCall.d.ts +3 -0
- package/out/TSTransformer/util/isValidMethodIndexWithoutCall.js +31 -0
- package/out/TSTransformer/util/offset.d.ts +2 -0
- package/out/TSTransformer/util/offset.js +44 -0
- package/out/TSTransformer/util/pointer.d.ts +13 -0
- package/out/TSTransformer/util/pointer.js +46 -0
- package/out/TSTransformer/util/spreadDestructuring/index.d.ts +9 -0
- package/out/TSTransformer/util/spreadDestructuring/index.js +45 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.js +17 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.js +33 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.js +34 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.js +41 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.js +28 -0
- package/out/TSTransformer/util/traversal.d.ts +7 -0
- package/out/TSTransformer/util/traversal.js +57 -0
- package/out/TSTransformer/util/types.d.ts +31 -0
- package/out/TSTransformer/util/types.js +259 -0
- package/out/TSTransformer/util/validateIdentifier.d.ts +3 -0
- package/out/TSTransformer/util/validateIdentifier.js +18 -0
- package/out/TSTransformer/util/validateMethodAssignment.d.ts +3 -0
- package/out/TSTransformer/util/validateMethodAssignment.js +81 -0
- package/out/TSTransformer/util/validateNotAny.d.ts +3 -0
- package/out/TSTransformer/util/validateNotAny.js +37 -0
- package/out/TSTransformer/util/valueToIdStr.d.ts +2 -0
- package/out/TSTransformer/util/valueToIdStr.js +29 -0
- package/out/TSTransformer/util/wrapExpressionStatement.d.ts +2 -0
- package/out/TSTransformer/util/wrapExpressionStatement.js +22 -0
- package/out/TSTransformer/util/wrapReturnIfLuaTuple.d.ts +4 -0
- package/out/TSTransformer/util/wrapReturnIfLuaTuple.js +56 -0
- package/out/TSTransformer/util/wrapStatementsAsGenerator.d.ts +4 -0
- package/out/TSTransformer/util/wrapStatementsAsGenerator.js +19 -0
- package/package.json +72 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformBinaryExpression = transformBinaryExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const diagnostics_1 = require("../../../Shared/diagnostics");
|
|
9
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
10
|
+
const DiagnosticService_1 = require("../../classes/DiagnosticService");
|
|
11
|
+
const transformArrayAssignmentPattern_1 = require("../binding/transformArrayAssignmentPattern");
|
|
12
|
+
const transformObjectAssignmentPattern_1 = require("../binding/transformObjectAssignmentPattern");
|
|
13
|
+
const transformExpression_1 = require("./transformExpression");
|
|
14
|
+
const transformInitializer_1 = require("../transformInitializer");
|
|
15
|
+
const transformLogical_1 = require("../transformLogical");
|
|
16
|
+
const transformLogicalOrCoalescingAssignmentExpression_1 = require("../transformLogicalOrCoalescingAssignmentExpression");
|
|
17
|
+
const transformWritable_1 = require("../transformWritable");
|
|
18
|
+
const arrayLikeExpressionContainsSpread_1 = require("../../util/arrayLikeExpressionContainsSpread");
|
|
19
|
+
const assignment_1 = require("../../util/assignment");
|
|
20
|
+
const bitwise_1 = require("../../util/bitwise");
|
|
21
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
22
|
+
const createBinaryFromOperator_1 = require("../../util/createBinaryFromOperator");
|
|
23
|
+
const ensureTransformOrder_1 = require("../../util/ensureTransformOrder");
|
|
24
|
+
const getAssignableValue_1 = require("../../util/getAssignableValue");
|
|
25
|
+
const getKindName_1 = require("../../util/getKindName");
|
|
26
|
+
const isUsedAsStatement_1 = require("../../util/isUsedAsStatement");
|
|
27
|
+
const traversal_1 = require("../../util/traversal");
|
|
28
|
+
const types_1 = require("../../util/types");
|
|
29
|
+
const validateNotAny_1 = require("../../util/validateNotAny");
|
|
30
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
31
|
+
function transformOptimizedArrayAssignmentPattern(state, assignmentPattern, rhs) {
|
|
32
|
+
const variables = luau_ast_1.default.list.make();
|
|
33
|
+
const writes = luau_ast_1.default.list.make();
|
|
34
|
+
const writesPrereqs = luau_ast_1.default.list.make();
|
|
35
|
+
const statements = state.capturePrereqs(() => {
|
|
36
|
+
for (let element of assignmentPattern.elements) {
|
|
37
|
+
if (typescript_1.default.isOmittedExpression(element)) {
|
|
38
|
+
luau_ast_1.default.list.push(writes, luau_ast_1.default.tempId());
|
|
39
|
+
}
|
|
40
|
+
else if (typescript_1.default.isSpreadElement(element)) {
|
|
41
|
+
(0, assert_1.assert)(false, "Cannot optimize-assign spread element");
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
let initializer;
|
|
45
|
+
if (typescript_1.default.isBinaryExpression(element)) {
|
|
46
|
+
initializer = (0, traversal_1.skipDownwards)(element.right);
|
|
47
|
+
element = (0, traversal_1.skipDownwards)(element.left);
|
|
48
|
+
}
|
|
49
|
+
if (typescript_1.default.isIdentifier(element) ||
|
|
50
|
+
typescript_1.default.isElementAccessExpression(element) ||
|
|
51
|
+
typescript_1.default.isPropertyAccessExpression(element)) {
|
|
52
|
+
const [id, idPrereqs] = state.capture(() => (0, transformWritable_1.transformWritableExpression)(state, element, true));
|
|
53
|
+
luau_ast_1.default.list.pushList(writesPrereqs, idPrereqs);
|
|
54
|
+
luau_ast_1.default.list.push(writes, id);
|
|
55
|
+
if (initializer) {
|
|
56
|
+
state.prereq((0, transformInitializer_1.transformInitializer)(state, id, initializer));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (typescript_1.default.isArrayLiteralExpression(element)) {
|
|
60
|
+
const id = luau_ast_1.default.tempId("binding");
|
|
61
|
+
luau_ast_1.default.list.push(variables, id);
|
|
62
|
+
luau_ast_1.default.list.push(writes, id);
|
|
63
|
+
if (initializer) {
|
|
64
|
+
state.prereq((0, transformInitializer_1.transformInitializer)(state, id, initializer));
|
|
65
|
+
}
|
|
66
|
+
(0, transformArrayAssignmentPattern_1.transformArrayAssignmentPattern)(state, element, id);
|
|
67
|
+
}
|
|
68
|
+
else if (typescript_1.default.isObjectLiteralExpression(element)) {
|
|
69
|
+
const id = luau_ast_1.default.tempId("binding");
|
|
70
|
+
luau_ast_1.default.list.push(variables, id);
|
|
71
|
+
luau_ast_1.default.list.push(writes, id);
|
|
72
|
+
if (initializer) {
|
|
73
|
+
state.prereq((0, transformInitializer_1.transformInitializer)(state, id, initializer));
|
|
74
|
+
}
|
|
75
|
+
(0, transformObjectAssignmentPattern_1.transformObjectAssignmentPattern)(state, element, id);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
(0, assert_1.assert)(false, `transformOptimizedArrayAssignmentPattern invalid element: ${(0, getKindName_1.getKindName)(element.kind)}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
if (!luau_ast_1.default.list.isEmpty(variables)) {
|
|
84
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
85
|
+
left: variables,
|
|
86
|
+
right: undefined,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
state.prereqList(writesPrereqs);
|
|
90
|
+
(0, assert_1.assert)(!luau_ast_1.default.list.isEmpty(writes));
|
|
91
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
92
|
+
left: writes,
|
|
93
|
+
operator: "=",
|
|
94
|
+
right: rhs,
|
|
95
|
+
}));
|
|
96
|
+
state.prereqList(statements);
|
|
97
|
+
}
|
|
98
|
+
function transformBinaryExpression(state, node) {
|
|
99
|
+
const operatorKind = node.operatorToken.kind;
|
|
100
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.left);
|
|
101
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.right);
|
|
102
|
+
if (operatorKind === typescript_1.default.SyntaxKind.EqualsEqualsToken) {
|
|
103
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noEqualsEquals(node));
|
|
104
|
+
return luau_ast_1.default.none();
|
|
105
|
+
}
|
|
106
|
+
else if (operatorKind === typescript_1.default.SyntaxKind.ExclamationEqualsToken) {
|
|
107
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noExclamationEquals(node));
|
|
108
|
+
return luau_ast_1.default.none();
|
|
109
|
+
}
|
|
110
|
+
if (operatorKind === typescript_1.default.SyntaxKind.AmpersandAmpersandToken ||
|
|
111
|
+
operatorKind === typescript_1.default.SyntaxKind.BarBarToken ||
|
|
112
|
+
operatorKind === typescript_1.default.SyntaxKind.QuestionQuestionToken) {
|
|
113
|
+
return (0, transformLogical_1.transformLogical)(state, node);
|
|
114
|
+
}
|
|
115
|
+
if (typescript_1.default.isLogicalOrCoalescingAssignmentExpression(node)) {
|
|
116
|
+
return (0, transformLogicalOrCoalescingAssignmentExpression_1.transformLogicalOrCoalescingAssignmentExpression)(state, node);
|
|
117
|
+
}
|
|
118
|
+
if (typescript_1.default.isAssignmentOperator(operatorKind)) {
|
|
119
|
+
if (typescript_1.default.isArrayLiteralExpression(node.left)) {
|
|
120
|
+
const rightExp = (0, transformExpression_1.transformExpression)(state, node.right);
|
|
121
|
+
if (node.left.elements.length === 0) {
|
|
122
|
+
if ((0, isUsedAsStatement_1.isUsedAsStatement)(node) && luau_ast_1.default.isArray(rightExp) && luau_ast_1.default.list.isEmpty(rightExp.members)) {
|
|
123
|
+
return luau_ast_1.default.none();
|
|
124
|
+
}
|
|
125
|
+
return rightExp;
|
|
126
|
+
}
|
|
127
|
+
if (luau_ast_1.default.isCall(rightExp) &&
|
|
128
|
+
(0, types_1.isLuaTupleType)(state)(state.getType(node.right)) &&
|
|
129
|
+
!(0, arrayLikeExpressionContainsSpread_1.arrayLikeExpressionContainsSpread)(node.left)) {
|
|
130
|
+
transformOptimizedArrayAssignmentPattern(state, node.left, rightExp);
|
|
131
|
+
if (!(0, isUsedAsStatement_1.isUsedAsStatement)(node)) {
|
|
132
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noLuaTupleDestructureAssignmentExpression(node));
|
|
133
|
+
}
|
|
134
|
+
return luau_ast_1.default.none();
|
|
135
|
+
}
|
|
136
|
+
if (luau_ast_1.default.isArray(rightExp) &&
|
|
137
|
+
!luau_ast_1.default.list.isEmpty(rightExp.members) &&
|
|
138
|
+
(0, isUsedAsStatement_1.isUsedAsStatement)(node) &&
|
|
139
|
+
!(0, arrayLikeExpressionContainsSpread_1.arrayLikeExpressionContainsSpread)(node.left)) {
|
|
140
|
+
transformOptimizedArrayAssignmentPattern(state, node.left, rightExp.members);
|
|
141
|
+
return luau_ast_1.default.none();
|
|
142
|
+
}
|
|
143
|
+
const parentId = state.pushToVar(rightExp, "binding");
|
|
144
|
+
(0, transformArrayAssignmentPattern_1.transformArrayAssignmentPattern)(state, node.left, parentId);
|
|
145
|
+
return parentId;
|
|
146
|
+
}
|
|
147
|
+
else if (typescript_1.default.isObjectLiteralExpression(node.left)) {
|
|
148
|
+
const rightExp = (0, transformExpression_1.transformExpression)(state, node.right);
|
|
149
|
+
if (node.left.properties.length === 0) {
|
|
150
|
+
if ((0, isUsedAsStatement_1.isUsedAsStatement)(node) && luau_ast_1.default.isMap(rightExp) && luau_ast_1.default.list.isEmpty(rightExp.fields)) {
|
|
151
|
+
return luau_ast_1.default.none();
|
|
152
|
+
}
|
|
153
|
+
return rightExp;
|
|
154
|
+
}
|
|
155
|
+
const parentId = state.pushToVar(rightExp, "binding");
|
|
156
|
+
(0, transformObjectAssignmentPattern_1.transformObjectAssignmentPattern)(state, node.left, parentId);
|
|
157
|
+
return parentId;
|
|
158
|
+
}
|
|
159
|
+
const writableType = state.getType(node.left);
|
|
160
|
+
const valueType = state.getType(node.right);
|
|
161
|
+
const operator = (0, assignment_1.getSimpleAssignmentOperator)(writableType, operatorKind, valueType);
|
|
162
|
+
const { writable, readable, value } = (0, transformWritable_1.transformWritableAssignment)(state, node.left, node.right, true, operator === undefined);
|
|
163
|
+
if (operator !== undefined) {
|
|
164
|
+
return (0, assignment_1.createAssignmentExpression)(state, writable, operator, (0, getAssignableValue_1.getAssignableValue)(operator, value, valueType));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return (0, assignment_1.createCompoundAssignmentExpression)(state, node, writable, writableType, readable, operatorKind, value, valueType);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if ((0, bitwise_1.isBitwiseOperator)(operatorKind)) {
|
|
171
|
+
return (0, bitwise_1.createBitwiseFromOperator)(state, operatorKind, node);
|
|
172
|
+
}
|
|
173
|
+
const [left, right] = (0, ensureTransformOrder_1.ensureTransformOrder)(state, [node.left, node.right]);
|
|
174
|
+
if (operatorKind === typescript_1.default.SyntaxKind.InKeyword) {
|
|
175
|
+
return luau_ast_1.default.binary(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
176
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(right),
|
|
177
|
+
index: left,
|
|
178
|
+
}), "~=", luau_ast_1.default.nil());
|
|
179
|
+
}
|
|
180
|
+
else if (operatorKind === typescript_1.default.SyntaxKind.InstanceOfKeyword) {
|
|
181
|
+
if ((0, types_1.isPossiblyType)(state.getType(node.right), (0, types_1.isRobloxType)(state))) {
|
|
182
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noRobloxSymbolInstanceof(node.right));
|
|
183
|
+
}
|
|
184
|
+
return luau_ast_1.default.call(state.TS(node, "instanceof"), [left, right]);
|
|
185
|
+
}
|
|
186
|
+
const leftType = state.getType(node.left);
|
|
187
|
+
const rightType = state.getType(node.right);
|
|
188
|
+
if (operatorKind === typescript_1.default.SyntaxKind.LessThanToken ||
|
|
189
|
+
operatorKind === typescript_1.default.SyntaxKind.LessThanEqualsToken ||
|
|
190
|
+
operatorKind === typescript_1.default.SyntaxKind.GreaterThanToken ||
|
|
191
|
+
operatorKind === typescript_1.default.SyntaxKind.GreaterThanEqualsToken) {
|
|
192
|
+
if ((!(0, types_1.isDefinitelyType)(leftType, types_1.isStringType) && !(0, types_1.isDefinitelyType)(leftType, types_1.isNumberType)) ||
|
|
193
|
+
(!(0, types_1.isDefinitelyType)(rightType, types_1.isStringType) && !(0, types_1.isDefinitelyType)(leftType, types_1.isNumberType))) {
|
|
194
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noNonNumberStringRelationOperator(node));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return (0, createBinaryFromOperator_1.createBinaryFromOperator)(state, node, left, leftType, operatorKind, right, rightType);
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=transformBinaryExpression.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformTrueKeyword = transformTrueKeyword;
|
|
7
|
+
exports.transformFalseKeyword = transformFalseKeyword;
|
|
8
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
9
|
+
function transformTrueKeyword() {
|
|
10
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.TrueLiteral, {});
|
|
11
|
+
}
|
|
12
|
+
function transformFalseKeyword() {
|
|
13
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FalseLiteral, {});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=transformBooleanLiteral.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../..";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformCallExpressionInner(state: TransformState, node: ts.CallExpression, expression: luau.Expression, nodeArguments: ReadonlyArray<ts.Expression>): luau.Expression<luau.SyntaxKind>;
|
|
5
|
+
export declare function transformPropertyCallExpressionInner(state: TransformState, node: ts.CallExpression, expression: ts.PropertyAccessExpression, baseExpression: luau.Expression, name: string, nodeArguments: ReadonlyArray<ts.Expression>): luau.Expression<luau.SyntaxKind>;
|
|
6
|
+
export declare function transformElementCallExpressionInner(state: TransformState, node: ts.CallExpression, expression: ts.ElementAccessExpression, baseExpression: luau.Expression, argumentExpression: ts.Expression, nodeArguments: ReadonlyArray<ts.Expression>): luau.Expression<luau.SyntaxKind>;
|
|
7
|
+
export declare function transformCallExpression(state: TransformState, node: ts.CallExpression): luau.Expression<luau.SyntaxKind>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformCallExpressionInner = transformCallExpressionInner;
|
|
7
|
+
exports.transformPropertyCallExpressionInner = transformPropertyCallExpressionInner;
|
|
8
|
+
exports.transformElementCallExpressionInner = transformElementCallExpressionInner;
|
|
9
|
+
exports.transformCallExpression = transformCallExpression;
|
|
10
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
11
|
+
const diagnostics_1 = require("../../../Shared/diagnostics");
|
|
12
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
13
|
+
const DiagnosticService_1 = require("../../classes/DiagnosticService");
|
|
14
|
+
const transformExpression_1 = require("./transformExpression");
|
|
15
|
+
const transformImportExpression_1 = require("./transformImportExpression");
|
|
16
|
+
const transformOptionalChain_1 = require("../transformOptionalChain");
|
|
17
|
+
const addOneIfArrayType_1 = require("../../util/addOneIfArrayType");
|
|
18
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
19
|
+
const ensureTransformOrder_1 = require("../../util/ensureTransformOrder");
|
|
20
|
+
const expressionMightMutate_1 = require("../../util/expressionMightMutate");
|
|
21
|
+
const isMethod_1 = require("../../util/isMethod");
|
|
22
|
+
const types_1 = require("../../util/types");
|
|
23
|
+
const validateNotAny_1 = require("../../util/validateNotAny");
|
|
24
|
+
const valueToIdStr_1 = require("../../util/valueToIdStr");
|
|
25
|
+
const wrapReturnIfLuaTuple_1 = require("../../util/wrapReturnIfLuaTuple");
|
|
26
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
27
|
+
function runCallMacro(macro, state, node, expression, nodeArguments) {
|
|
28
|
+
let args;
|
|
29
|
+
const prereqs = state.capturePrereqs(() => {
|
|
30
|
+
args = (0, ensureTransformOrder_1.ensureTransformOrder)(state, nodeArguments);
|
|
31
|
+
const lastArg = nodeArguments[nodeArguments.length - 1];
|
|
32
|
+
if (lastArg && typescript_1.default.isSpreadElement(lastArg)) {
|
|
33
|
+
const signature = state.typeChecker.getSignaturesOfType(state.getType(node.expression), typescript_1.default.SignatureKind.Call)[0];
|
|
34
|
+
const lastParameter = signature.parameters[signature.parameters.length - 1].valueDeclaration;
|
|
35
|
+
if (lastParameter && typescript_1.default.isParameter(lastParameter) && lastParameter.dotDotDotToken) {
|
|
36
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noVarArgsMacroSpread(lastArg));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const tupleArgType = state.getType(lastArg.expression);
|
|
40
|
+
(0, assert_1.assert)(state.typeChecker.isTupleType(tupleArgType));
|
|
41
|
+
const argumentCount = tupleArgType.target.elementFlags.length;
|
|
42
|
+
const spread = args.pop();
|
|
43
|
+
const tempIds = luau_ast_1.default.list.make();
|
|
44
|
+
for (let i = args.length; i < argumentCount; i++) {
|
|
45
|
+
const tempId = luau_ast_1.default.tempId(`spread${i}`);
|
|
46
|
+
args.push(tempId);
|
|
47
|
+
luau_ast_1.default.list.push(tempIds, tempId);
|
|
48
|
+
}
|
|
49
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
50
|
+
left: tempIds,
|
|
51
|
+
right: spread,
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
for (let i = 0; i < args.length; i++) {
|
|
55
|
+
if ((0, expressionMightMutate_1.expressionMightMutate)(state, args[i], nodeArguments[i])) {
|
|
56
|
+
args[i] = state.pushToVar(args[i], (0, valueToIdStr_1.valueToIdStr)(args[i]) || `arg${i}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
let nodeExpression = node.expression;
|
|
61
|
+
if (typescript_1.default.isPropertyAccessExpression(nodeExpression) || typescript_1.default.isElementAccessExpression(nodeExpression)) {
|
|
62
|
+
nodeExpression = nodeExpression.expression;
|
|
63
|
+
}
|
|
64
|
+
if (!luau_ast_1.default.list.isEmpty(prereqs) && (0, expressionMightMutate_1.expressionMightMutate)(state, expression, nodeExpression)) {
|
|
65
|
+
expression = state.pushToVar(expression, (0, valueToIdStr_1.valueToIdStr)(expression) || "exp");
|
|
66
|
+
}
|
|
67
|
+
state.prereqList(prereqs);
|
|
68
|
+
return (0, wrapReturnIfLuaTuple_1.wrapReturnIfLuaTuple)(state, node, macro(state, node, expression, args));
|
|
69
|
+
}
|
|
70
|
+
function fixVoidArgumentsForRobloxFunctions(state, type, args, nodeArguments) {
|
|
71
|
+
if ((0, types_1.isPossiblyType)(type, (0, types_1.isRobloxType)(state))) {
|
|
72
|
+
for (let i = 0; i < args.length; i++) {
|
|
73
|
+
const arg = args[i];
|
|
74
|
+
const nodeArg = nodeArguments[i];
|
|
75
|
+
if (typescript_1.default.isCallExpression(nodeArg) && (0, types_1.isPossiblyType)(state.getType(nodeArg), types_1.isUndefinedType)) {
|
|
76
|
+
args[i] = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ParenthesizedExpression, {
|
|
77
|
+
expression: arg,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function transformCallExpressionInner(state, node, expression, nodeArguments) {
|
|
84
|
+
if (typescript_1.default.isImportCall(node)) {
|
|
85
|
+
return (0, transformImportExpression_1.transformImportExpression)(state, node);
|
|
86
|
+
}
|
|
87
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.expression);
|
|
88
|
+
if (typescript_1.default.isSuperCall(node)) {
|
|
89
|
+
return luau_ast_1.default.call(luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(expression), "constructor"), [
|
|
90
|
+
luau_ast_1.default.globals.self,
|
|
91
|
+
...(0, ensureTransformOrder_1.ensureTransformOrder)(state, node.arguments),
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
const expType = state.typeChecker.getNonOptionalType(state.getType(node.expression));
|
|
95
|
+
const symbol = (0, types_1.getFirstDefinedSymbol)(state, expType);
|
|
96
|
+
if (symbol) {
|
|
97
|
+
const macro = state.services.macroManager.getCallMacro(symbol);
|
|
98
|
+
if (macro) {
|
|
99
|
+
return runCallMacro(macro, state, node, expression, nodeArguments);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const [args, prereqs] = state.capture(() => (0, ensureTransformOrder_1.ensureTransformOrder)(state, nodeArguments));
|
|
103
|
+
fixVoidArgumentsForRobloxFunctions(state, expType, args, nodeArguments);
|
|
104
|
+
if (!luau_ast_1.default.list.isEmpty(prereqs) && (0, expressionMightMutate_1.expressionMightMutate)(state, expression, node.expression)) {
|
|
105
|
+
expression = state.pushToVar(expression, "fn");
|
|
106
|
+
}
|
|
107
|
+
state.prereqList(prereqs);
|
|
108
|
+
const exp = luau_ast_1.default.call((0, convertToIndexableExpression_1.convertToIndexableExpression)(expression), args);
|
|
109
|
+
return (0, wrapReturnIfLuaTuple_1.wrapReturnIfLuaTuple)(state, node, exp);
|
|
110
|
+
}
|
|
111
|
+
function transformPropertyCallExpressionInner(state, node, expression, baseExpression, name, nodeArguments) {
|
|
112
|
+
(0, validateNotAny_1.validateNotAnyType)(state, expression.expression);
|
|
113
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.expression);
|
|
114
|
+
if (typescript_1.default.isSuperProperty(expression)) {
|
|
115
|
+
return luau_ast_1.default.call(luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression), expression.name.text), [
|
|
116
|
+
luau_ast_1.default.globals.self,
|
|
117
|
+
...(0, ensureTransformOrder_1.ensureTransformOrder)(state, node.arguments),
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
const expType = state.typeChecker.getNonOptionalType(state.getType(node.expression));
|
|
121
|
+
const symbol = (0, types_1.getFirstDefinedSymbol)(state, expType);
|
|
122
|
+
if (symbol) {
|
|
123
|
+
const macro = state.services.macroManager.getPropertyCallMacro(symbol);
|
|
124
|
+
if (macro) {
|
|
125
|
+
return runCallMacro(macro, state, node, baseExpression, nodeArguments);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const [args, prereqs] = state.capture(() => (0, ensureTransformOrder_1.ensureTransformOrder)(state, nodeArguments));
|
|
129
|
+
fixVoidArgumentsForRobloxFunctions(state, expType, args, nodeArguments);
|
|
130
|
+
if (!luau_ast_1.default.list.isEmpty(prereqs) && (0, expressionMightMutate_1.expressionMightMutate)(state, baseExpression, expression.expression)) {
|
|
131
|
+
baseExpression = state.pushToVar(baseExpression);
|
|
132
|
+
}
|
|
133
|
+
state.prereqList(prereqs);
|
|
134
|
+
let exp;
|
|
135
|
+
if ((0, isMethod_1.isMethod)(state, expression)) {
|
|
136
|
+
if (luau_ast_1.default.isValidIdentifier(name)) {
|
|
137
|
+
exp = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodCallExpression, {
|
|
138
|
+
name,
|
|
139
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression),
|
|
140
|
+
args: luau_ast_1.default.list.make(...args),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
baseExpression = state.pushToVarIfComplex(baseExpression);
|
|
145
|
+
args.unshift(baseExpression);
|
|
146
|
+
exp = luau_ast_1.default.call(luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression), name), args);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
exp = luau_ast_1.default.call(luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression), name), args);
|
|
151
|
+
}
|
|
152
|
+
return (0, wrapReturnIfLuaTuple_1.wrapReturnIfLuaTuple)(state, node, exp);
|
|
153
|
+
}
|
|
154
|
+
function transformElementCallExpressionInner(state, node, expression, baseExpression, argumentExpression, nodeArguments) {
|
|
155
|
+
(0, validateNotAny_1.validateNotAnyType)(state, expression.expression);
|
|
156
|
+
(0, validateNotAny_1.validateNotAnyType)(state, expression.argumentExpression);
|
|
157
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.expression);
|
|
158
|
+
if (typescript_1.default.isSuperProperty(expression)) {
|
|
159
|
+
return luau_ast_1.default.call(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
160
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression),
|
|
161
|
+
index: (0, transformExpression_1.transformExpression)(state, expression.argumentExpression),
|
|
162
|
+
}), [luau_ast_1.default.globals.self, ...(0, ensureTransformOrder_1.ensureTransformOrder)(state, node.arguments)]);
|
|
163
|
+
}
|
|
164
|
+
const expType = state.typeChecker.getNonOptionalType(state.getType(node.expression));
|
|
165
|
+
const symbol = (0, types_1.getFirstDefinedSymbol)(state, expType);
|
|
166
|
+
if (symbol) {
|
|
167
|
+
const macro = state.services.macroManager.getPropertyCallMacro(symbol);
|
|
168
|
+
if (macro) {
|
|
169
|
+
return runCallMacro(macro, state, node, baseExpression, nodeArguments);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const [[argumentExp, ...args], prereqs] = state.capture(() => (0, ensureTransformOrder_1.ensureTransformOrder)(state, [argumentExpression, ...nodeArguments]));
|
|
173
|
+
fixVoidArgumentsForRobloxFunctions(state, expType, args, nodeArguments);
|
|
174
|
+
if (!luau_ast_1.default.list.isEmpty(prereqs) && (0, expressionMightMutate_1.expressionMightMutate)(state, baseExpression, expression.expression)) {
|
|
175
|
+
baseExpression = state.pushToVar(baseExpression);
|
|
176
|
+
}
|
|
177
|
+
state.prereqList(prereqs);
|
|
178
|
+
if ((0, isMethod_1.isMethod)(state, expression)) {
|
|
179
|
+
baseExpression = state.pushToVarIfComplex(baseExpression);
|
|
180
|
+
args.unshift(baseExpression);
|
|
181
|
+
}
|
|
182
|
+
const exp = luau_ast_1.default.call(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
183
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(baseExpression),
|
|
184
|
+
index: (0, addOneIfArrayType_1.addOneIfArrayType)(state, state.typeChecker.getNonOptionalType(state.getType(expression.expression)), argumentExp),
|
|
185
|
+
}), args);
|
|
186
|
+
return (0, wrapReturnIfLuaTuple_1.wrapReturnIfLuaTuple)(state, node, exp);
|
|
187
|
+
}
|
|
188
|
+
function transformCallExpression(state, node) {
|
|
189
|
+
return (0, transformOptionalChain_1.transformOptionalChain)(state, node);
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=transformCallExpression.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TransformState } from "../..";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
export declare function transformClassExpression(state: TransformState, node: ts.ClassExpression): import("@roblox-ts/luau-ast/out/LuauAST/bundle").Identifier | import("@roblox-ts/luau-ast/out/LuauAST/bundle").TemporaryIdentifier;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformClassExpression = transformClassExpression;
|
|
4
|
+
const transformClassLikeDeclaration_1 = require("../class/transformClassLikeDeclaration");
|
|
5
|
+
function transformClassExpression(state, node) {
|
|
6
|
+
const { statements, name } = (0, transformClassLikeDeclaration_1.transformClassLikeDeclaration)(state, node);
|
|
7
|
+
state.prereqList(statements);
|
|
8
|
+
return name;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=transformClassExpression.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../..";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformConditionalExpression(state: TransformState, node: ts.ConditionalExpression): luau.TemporaryIdentifier | luau.None | luau.IfExpression;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformConditionalExpression = transformConditionalExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./transformExpression");
|
|
9
|
+
const createTruthinessChecks_1 = require("../../util/createTruthinessChecks");
|
|
10
|
+
const isUsedAsStatement_1 = require("../../util/isUsedAsStatement");
|
|
11
|
+
const wrapExpressionStatement_1 = require("../../util/wrapExpressionStatement");
|
|
12
|
+
function transformConditionalExpression(state, node) {
|
|
13
|
+
const condition = (0, transformExpression_1.transformExpression)(state, node.condition);
|
|
14
|
+
const [whenTrue, whenTruePrereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, node.whenTrue));
|
|
15
|
+
const [whenFalse, whenFalsePrereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, node.whenFalse));
|
|
16
|
+
if ((0, isUsedAsStatement_1.isUsedAsStatement)(node)) {
|
|
17
|
+
luau_ast_1.default.list.pushList(whenTruePrereqs, (0, wrapExpressionStatement_1.wrapExpressionStatement)(whenTrue));
|
|
18
|
+
luau_ast_1.default.list.pushList(whenFalsePrereqs, (0, wrapExpressionStatement_1.wrapExpressionStatement)(whenFalse));
|
|
19
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
20
|
+
condition: (0, createTruthinessChecks_1.createTruthinessChecks)(state, condition, node.condition),
|
|
21
|
+
statements: whenTruePrereqs,
|
|
22
|
+
elseBody: whenFalsePrereqs,
|
|
23
|
+
}));
|
|
24
|
+
return luau_ast_1.default.none();
|
|
25
|
+
}
|
|
26
|
+
if (luau_ast_1.default.list.isEmpty(whenTruePrereqs) && luau_ast_1.default.list.isEmpty(whenFalsePrereqs)) {
|
|
27
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfExpression, {
|
|
28
|
+
condition: (0, createTruthinessChecks_1.createTruthinessChecks)(state, condition, node.condition),
|
|
29
|
+
expression: whenTrue,
|
|
30
|
+
alternative: whenFalse,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const tempId = luau_ast_1.default.tempId("result");
|
|
34
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
35
|
+
left: tempId,
|
|
36
|
+
right: undefined,
|
|
37
|
+
}));
|
|
38
|
+
luau_ast_1.default.list.push(whenTruePrereqs, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
39
|
+
left: tempId,
|
|
40
|
+
operator: "=",
|
|
41
|
+
right: whenTrue,
|
|
42
|
+
}));
|
|
43
|
+
luau_ast_1.default.list.push(whenFalsePrereqs, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
44
|
+
left: tempId,
|
|
45
|
+
operator: "=",
|
|
46
|
+
right: whenFalse,
|
|
47
|
+
}));
|
|
48
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
49
|
+
condition: (0, createTruthinessChecks_1.createTruthinessChecks)(state, condition, node.condition),
|
|
50
|
+
statements: whenTruePrereqs,
|
|
51
|
+
elseBody: whenFalsePrereqs,
|
|
52
|
+
}));
|
|
53
|
+
return tempId;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=transformConditionalExpression.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformDeleteExpression = transformDeleteExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./transformExpression");
|
|
9
|
+
const isUsedAsStatement_1 = require("../../util/isUsedAsStatement");
|
|
10
|
+
function transformDeleteExpression(state, node) {
|
|
11
|
+
(0, transformExpression_1.transformExpression)(state, node.expression);
|
|
12
|
+
return !(0, isUsedAsStatement_1.isUsedAsStatement)(node) ? luau_ast_1.default.bool(true) : luau_ast_1.default.none();
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=transformDeleteExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../..";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformElementAccessExpressionInner(state: TransformState, node: ts.ElementAccessExpression, expression: luau.Expression, argumentExpression: ts.Expression): luau.ComputedIndexExpression | luau.ParenthesizedExpression | luau.None;
|
|
5
|
+
export declare function transformElementAccessExpression(state: TransformState, node: ts.ElementAccessExpression): luau.Expression<luau.SyntaxKind>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformElementAccessExpressionInner = transformElementAccessExpressionInner;
|
|
7
|
+
exports.transformElementAccessExpression = transformElementAccessExpression;
|
|
8
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
9
|
+
const transformExpression_1 = require("./transformExpression");
|
|
10
|
+
const transformOptionalChain_1 = require("../transformOptionalChain");
|
|
11
|
+
const addIndexDiagnostics_1 = require("../../util/addIndexDiagnostics");
|
|
12
|
+
const addOneIfArrayType_1 = require("../../util/addOneIfArrayType");
|
|
13
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
14
|
+
const getConstantValueLiteral_1 = require("../../util/getConstantValueLiteral");
|
|
15
|
+
const offset_1 = require("../../util/offset");
|
|
16
|
+
const traversal_1 = require("../../util/traversal");
|
|
17
|
+
const types_1 = require("../../util/types");
|
|
18
|
+
const validateNotAny_1 = require("../../util/validateNotAny");
|
|
19
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
20
|
+
function transformElementAccessExpressionInner(state, node, expression, argumentExpression) {
|
|
21
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.expression);
|
|
22
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.argumentExpression);
|
|
23
|
+
const expType = state.typeChecker.getNonOptionalType(state.getType(node.expression));
|
|
24
|
+
(0, addIndexDiagnostics_1.addIndexDiagnostics)(state, node, expType);
|
|
25
|
+
const [index, prereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, argumentExpression));
|
|
26
|
+
if (!luau_ast_1.default.list.isEmpty(prereqs)) {
|
|
27
|
+
if ((0, types_1.isLuaTupleType)(state)(expType)) {
|
|
28
|
+
expression = luau_ast_1.default.array([expression]);
|
|
29
|
+
}
|
|
30
|
+
expression = state.pushToVar(expression, "exp");
|
|
31
|
+
state.prereqList(prereqs);
|
|
32
|
+
}
|
|
33
|
+
if (luau_ast_1.default.isCall(expression) && (0, types_1.isLuaTupleType)(state)(expType)) {
|
|
34
|
+
if (!luau_ast_1.default.isNumberLiteral(index) || Number(index.value) !== 0) {
|
|
35
|
+
expression = luau_ast_1.default.call(luau_ast_1.default.globals.select, [(0, offset_1.offset)(index, 1), expression]);
|
|
36
|
+
}
|
|
37
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ParenthesizedExpression, { expression });
|
|
38
|
+
}
|
|
39
|
+
if (typescript_1.default.isDeleteExpression((0, traversal_1.skipUpwards)(node).parent)) {
|
|
40
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
41
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
42
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(expression),
|
|
43
|
+
index: (0, addOneIfArrayType_1.addOneIfArrayType)(state, expType, index),
|
|
44
|
+
}),
|
|
45
|
+
operator: "=",
|
|
46
|
+
right: luau_ast_1.default.nil(),
|
|
47
|
+
}));
|
|
48
|
+
return luau_ast_1.default.none();
|
|
49
|
+
}
|
|
50
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
51
|
+
expression: (0, convertToIndexableExpression_1.convertToIndexableExpression)(expression),
|
|
52
|
+
index: (0, addOneIfArrayType_1.addOneIfArrayType)(state, expType, index),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function transformElementAccessExpression(state, node) {
|
|
56
|
+
const constantValue = (0, getConstantValueLiteral_1.getConstantValueLiteral)(state, node);
|
|
57
|
+
if (constantValue) {
|
|
58
|
+
return constantValue;
|
|
59
|
+
}
|
|
60
|
+
return (0, transformOptionalChain_1.transformOptionalChain)(state, node);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=transformElementAccessExpression.js.map
|