@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,155 @@
|
|
|
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.transformVariable = transformVariable;
|
|
7
|
+
exports.transformVariableDeclaration = transformVariableDeclaration;
|
|
8
|
+
exports.isVarDeclaration = isVarDeclaration;
|
|
9
|
+
exports.transformVariableDeclarationList = transformVariableDeclarationList;
|
|
10
|
+
exports.transformVariableStatement = transformVariableStatement;
|
|
11
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
12
|
+
const diagnostics_1 = require("../../../Shared/diagnostics");
|
|
13
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
14
|
+
const DiagnosticService_1 = require("../../classes/DiagnosticService");
|
|
15
|
+
const transformArrayBindingPattern_1 = require("../binding/transformArrayBindingPattern");
|
|
16
|
+
const transformObjectBindingPattern_1 = require("../binding/transformObjectBindingPattern");
|
|
17
|
+
const transformExpression_1 = require("../expressions/transformExpression");
|
|
18
|
+
const transformIdentifier_1 = require("../expressions/transformIdentifier");
|
|
19
|
+
const transformInitializer_1 = require("../transformInitializer");
|
|
20
|
+
const arrayBindingPatternContainsHoists_1 = require("../../util/arrayBindingPatternContainsHoists");
|
|
21
|
+
const arrayLikeExpressionContainsSpread_1 = require("../../util/arrayLikeExpressionContainsSpread");
|
|
22
|
+
const getTargetIdForBindingPattern_1 = require("../../util/binding/getTargetIdForBindingPattern");
|
|
23
|
+
const checkVariableHoist_1 = require("../../util/checkVariableHoist");
|
|
24
|
+
const isSymbolMutable_1 = require("../../util/isSymbolMutable");
|
|
25
|
+
const types_1 = require("../../util/types");
|
|
26
|
+
const validateIdentifier_1 = require("../../util/validateIdentifier");
|
|
27
|
+
const wrapExpressionStatement_1 = require("../../util/wrapExpressionStatement");
|
|
28
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
29
|
+
function transformVariable(state, identifier, right) {
|
|
30
|
+
(0, validateIdentifier_1.validateIdentifier)(state, identifier);
|
|
31
|
+
const symbol = state.typeChecker.getSymbolAtLocation(identifier);
|
|
32
|
+
(0, assert_1.assert)(symbol);
|
|
33
|
+
if ((0, isSymbolMutable_1.isSymbolMutable)(state, symbol)) {
|
|
34
|
+
const exportAccess = state.getModuleIdPropertyAccess(symbol);
|
|
35
|
+
if (exportAccess) {
|
|
36
|
+
if (right) {
|
|
37
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
38
|
+
left: exportAccess,
|
|
39
|
+
operator: "=",
|
|
40
|
+
right,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
return exportAccess;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const left = (0, transformIdentifier_1.transformIdentifierDefined)(state, identifier);
|
|
47
|
+
(0, checkVariableHoist_1.checkVariableHoist)(state, identifier, symbol);
|
|
48
|
+
if (state.isHoisted.get(symbol) === true) {
|
|
49
|
+
if (right) {
|
|
50
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, { left, operator: "=", right }));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, { left, right }));
|
|
55
|
+
}
|
|
56
|
+
return left;
|
|
57
|
+
}
|
|
58
|
+
function transformOptimizedArrayBindingPattern(state, bindingPattern, rhs) {
|
|
59
|
+
return state.capturePrereqs(() => {
|
|
60
|
+
const ids = luau_ast_1.default.list.make();
|
|
61
|
+
const statements = state.capturePrereqs(() => {
|
|
62
|
+
for (const element of bindingPattern.elements) {
|
|
63
|
+
if (typescript_1.default.isOmittedExpression(element)) {
|
|
64
|
+
luau_ast_1.default.list.push(ids, luau_ast_1.default.tempId());
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (typescript_1.default.isIdentifier(element.name)) {
|
|
68
|
+
(0, validateIdentifier_1.validateIdentifier)(state, element.name);
|
|
69
|
+
const id = (0, transformIdentifier_1.transformIdentifierDefined)(state, element.name);
|
|
70
|
+
luau_ast_1.default.list.push(ids, id);
|
|
71
|
+
if (element.initializer) {
|
|
72
|
+
state.prereq((0, transformInitializer_1.transformInitializer)(state, id, element.initializer));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const id = luau_ast_1.default.tempId("binding");
|
|
77
|
+
luau_ast_1.default.list.push(ids, id);
|
|
78
|
+
if (element.initializer) {
|
|
79
|
+
state.prereq((0, transformInitializer_1.transformInitializer)(state, id, element.initializer));
|
|
80
|
+
}
|
|
81
|
+
if (typescript_1.default.isArrayBindingPattern(element.name)) {
|
|
82
|
+
(0, transformArrayBindingPattern_1.transformArrayBindingPattern)(state, element.name, id);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
(0, transformObjectBindingPattern_1.transformObjectBindingPattern)(state, element.name, id);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
(0, assert_1.assert)(!luau_ast_1.default.list.isEmpty(ids));
|
|
92
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, { left: ids, right: rhs }));
|
|
93
|
+
state.prereqList(statements);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function transformVariableDeclaration(state, node) {
|
|
97
|
+
const statements = luau_ast_1.default.list.make();
|
|
98
|
+
let value;
|
|
99
|
+
if (node.initializer) {
|
|
100
|
+
luau_ast_1.default.list.pushList(statements, state.capturePrereqs(() => (value = (0, transformExpression_1.transformExpression)(state, node.initializer))));
|
|
101
|
+
}
|
|
102
|
+
const name = node.name;
|
|
103
|
+
if (typescript_1.default.isIdentifier(name)) {
|
|
104
|
+
luau_ast_1.default.list.pushList(statements, state.capturePrereqs(() => transformVariable(state, name, value)));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
(0, assert_1.assert)(node.initializer && value);
|
|
108
|
+
if (name.elements.length === 0) {
|
|
109
|
+
if (!luau_ast_1.default.isArray(value) || !luau_ast_1.default.list.isEmpty(value.members)) {
|
|
110
|
+
luau_ast_1.default.list.pushList(statements, (0, wrapExpressionStatement_1.wrapExpressionStatement)(value));
|
|
111
|
+
}
|
|
112
|
+
return statements;
|
|
113
|
+
}
|
|
114
|
+
if (typescript_1.default.isArrayBindingPattern(name)) {
|
|
115
|
+
if (luau_ast_1.default.isCall(value) &&
|
|
116
|
+
(0, types_1.isLuaTupleType)(state)(state.getType(node.initializer)) &&
|
|
117
|
+
!(0, arrayBindingPatternContainsHoists_1.arrayBindingPatternContainsHoists)(state, name) &&
|
|
118
|
+
!(0, arrayLikeExpressionContainsSpread_1.arrayLikeExpressionContainsSpread)(name)) {
|
|
119
|
+
luau_ast_1.default.list.pushList(statements, transformOptimizedArrayBindingPattern(state, name, value));
|
|
120
|
+
}
|
|
121
|
+
else if (luau_ast_1.default.isArray(value) &&
|
|
122
|
+
!luau_ast_1.default.list.isEmpty(value.members) &&
|
|
123
|
+
!(0, arrayBindingPatternContainsHoists_1.arrayBindingPatternContainsHoists)(state, name) &&
|
|
124
|
+
!(0, arrayLikeExpressionContainsSpread_1.arrayLikeExpressionContainsSpread)(name)) {
|
|
125
|
+
luau_ast_1.default.list.pushList(statements, transformOptimizedArrayBindingPattern(state, name, value.members));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
luau_ast_1.default.list.pushList(statements, state.capturePrereqs(() => (0, transformArrayBindingPattern_1.transformArrayBindingPattern)(state, name, (0, getTargetIdForBindingPattern_1.getTargetIdForBindingPattern)(state, name, value))));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
luau_ast_1.default.list.pushList(statements, state.capturePrereqs(() => (0, transformObjectBindingPattern_1.transformObjectBindingPattern)(state, name, (0, getTargetIdForBindingPattern_1.getTargetIdForBindingPattern)(state, name, value))));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return statements;
|
|
136
|
+
}
|
|
137
|
+
function isVarDeclaration(node) {
|
|
138
|
+
return !(node.flags & typescript_1.default.NodeFlags.Const) && !(node.flags & typescript_1.default.NodeFlags.Let);
|
|
139
|
+
}
|
|
140
|
+
function transformVariableDeclarationList(state, node) {
|
|
141
|
+
if (isVarDeclaration(node)) {
|
|
142
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noVar(node));
|
|
143
|
+
}
|
|
144
|
+
const statements = luau_ast_1.default.list.make();
|
|
145
|
+
for (const declaration of node.declarations) {
|
|
146
|
+
const [variableStatements, prereqs] = state.capture(() => transformVariableDeclaration(state, declaration));
|
|
147
|
+
luau_ast_1.default.list.pushList(statements, prereqs);
|
|
148
|
+
luau_ast_1.default.list.pushList(statements, variableStatements);
|
|
149
|
+
}
|
|
150
|
+
return statements;
|
|
151
|
+
}
|
|
152
|
+
function transformVariableStatement(state, node) {
|
|
153
|
+
return transformVariableDeclarationList(state, node.declarationList);
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=transformVariableStatement.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
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.transformWhileStatement = transformWhileStatement;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("../expressions/transformExpression");
|
|
9
|
+
const transformStatementList_1 = require("../transformStatementList");
|
|
10
|
+
const createTruthinessChecks_1 = require("../../util/createTruthinessChecks");
|
|
11
|
+
const getStatements_1 = require("../../util/getStatements");
|
|
12
|
+
function transformWhileStatement(state, node) {
|
|
13
|
+
const whileStatements = luau_ast_1.default.list.make();
|
|
14
|
+
let [conditionExp, conditionPrereqs] = state.capture(() => (0, createTruthinessChecks_1.createTruthinessChecks)(state, (0, transformExpression_1.transformExpression)(state, node.expression), node.expression));
|
|
15
|
+
if (!luau_ast_1.default.list.isEmpty(conditionPrereqs)) {
|
|
16
|
+
luau_ast_1.default.list.pushList(whileStatements, conditionPrereqs);
|
|
17
|
+
luau_ast_1.default.list.push(whileStatements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
18
|
+
condition: luau_ast_1.default.unary("not", conditionExp),
|
|
19
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.BreakStatement, {})),
|
|
20
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
21
|
+
}));
|
|
22
|
+
conditionExp = luau_ast_1.default.bool(true);
|
|
23
|
+
}
|
|
24
|
+
luau_ast_1.default.list.pushList(whileStatements, (0, transformStatementList_1.transformStatementList)(state, node.statement, (0, getStatements_1.getStatements)(node.statement)));
|
|
25
|
+
return luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.WhileStatement, {
|
|
26
|
+
condition: conditionExp,
|
|
27
|
+
statements: whileStatements,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=transformWhileStatement.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
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.transformEntityName = transformEntityName;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformIdentifier_1 = require("./expressions/transformIdentifier");
|
|
9
|
+
const convertToIndexableExpression_1 = require("../util/convertToIndexableExpression");
|
|
10
|
+
const validateIdentifier_1 = require("../util/validateIdentifier");
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
function transformEntityName(state, node) {
|
|
13
|
+
if (typescript_1.default.isIdentifier(node)) {
|
|
14
|
+
(0, validateIdentifier_1.validateIdentifier)(state, node);
|
|
15
|
+
return (0, transformIdentifier_1.transformIdentifier)(state, node);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return transformQualifiedName(state, node);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function transformQualifiedName(state, node) {
|
|
22
|
+
return luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(transformEntityName(state, node.left)), node.right.text);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=transformEntityName.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
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.transformInitializer = transformInitializer;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./expressions/transformExpression");
|
|
9
|
+
function transformInitializer(state, id, initializer) {
|
|
10
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
11
|
+
condition: luau_ast_1.default.binary(id, "==", luau_ast_1.default.nil()),
|
|
12
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
13
|
+
statements: state.capturePrereqs(() => {
|
|
14
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
15
|
+
left: id,
|
|
16
|
+
operator: "=",
|
|
17
|
+
right: (0, transformExpression_1.transformExpression)(state, initializer),
|
|
18
|
+
}));
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=transformInitializer.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
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.transformInterpolatedStringPart = transformInterpolatedStringPart;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const createStringFromLiteral_1 = require("../util/createStringFromLiteral");
|
|
9
|
+
function transformInterpolatedStringPart(node) {
|
|
10
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.InterpolatedStringPart, { text: (0, createStringFromLiteral_1.createStringFromLiteral)(node) });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=transformInterpolatedStringPart.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
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.transformLogical = transformLogical;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const assert_1 = require("../../Shared/util/assert");
|
|
9
|
+
const transformExpression_1 = require("./expressions/transformExpression");
|
|
10
|
+
const createTruthinessChecks_1 = require("../util/createTruthinessChecks");
|
|
11
|
+
const expressionChain_1 = require("../util/expressionChain");
|
|
12
|
+
const getKindName_1 = require("../util/getKindName");
|
|
13
|
+
const types_1 = require("../util/types");
|
|
14
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
+
function flattenByOperator(node, operatorKind) {
|
|
16
|
+
const result = new Array();
|
|
17
|
+
while (typescript_1.default.isBinaryExpression(node) && node.operatorToken.kind === operatorKind) {
|
|
18
|
+
result.unshift(node.right);
|
|
19
|
+
node = node.left;
|
|
20
|
+
}
|
|
21
|
+
result.unshift(node);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function getLogicalChain(state, binaryExp, binaryOperatorKind, enableInlining) {
|
|
25
|
+
return flattenByOperator(binaryExp, binaryOperatorKind).map((node, index, array) => {
|
|
26
|
+
const type = state.getType(node);
|
|
27
|
+
const [expression, statements] = state.capture(() => (0, transformExpression_1.transformExpression)(state, node));
|
|
28
|
+
let inline = false;
|
|
29
|
+
if (enableInlining) {
|
|
30
|
+
const willWrap = index < array.length - 1 && (0, createTruthinessChecks_1.willCreateTruthinessChecks)(type);
|
|
31
|
+
inline = luau_ast_1.default.list.isEmpty(statements) && !willWrap;
|
|
32
|
+
}
|
|
33
|
+
return { node, type, expression, statements, inline };
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function buildLogicalChainPrereqs(state, chain, conditionId, buildCondition, index = 0) {
|
|
37
|
+
const expInfo = chain[index];
|
|
38
|
+
state.prereqList(expInfo.statements);
|
|
39
|
+
if (index === 0) {
|
|
40
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
41
|
+
left: conditionId,
|
|
42
|
+
right: expInfo.expression,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
47
|
+
left: conditionId,
|
|
48
|
+
operator: "=",
|
|
49
|
+
right: expInfo.expression,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
if (index + 1 < chain.length) {
|
|
53
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
54
|
+
condition: buildCondition(conditionId, expInfo.node),
|
|
55
|
+
statements: state.capturePrereqs(() => buildLogicalChainPrereqs(state, chain, conditionId, buildCondition, index + 1)),
|
|
56
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function mergeInlineExpressions(chain, binaryOperator) {
|
|
61
|
+
for (let i = 0; i < chain.length; i++) {
|
|
62
|
+
const info = chain[i];
|
|
63
|
+
if (info.inline) {
|
|
64
|
+
const exps = [info.expression];
|
|
65
|
+
const j = i + 1;
|
|
66
|
+
while (j < chain.length && chain[j].inline) {
|
|
67
|
+
exps.push(chain[j].expression);
|
|
68
|
+
chain.splice(j, 1);
|
|
69
|
+
}
|
|
70
|
+
info.expression = (0, expressionChain_1.binaryExpressionChain)(exps, binaryOperator);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function buildInlineConditionExpression(state, node, tsBinaryOperator, luaBinaryOperator, buildCondition) {
|
|
75
|
+
const chain = getLogicalChain(state, node, tsBinaryOperator, true);
|
|
76
|
+
mergeInlineExpressions(chain, luaBinaryOperator);
|
|
77
|
+
if (chain.length === 1 && chain[0].inline) {
|
|
78
|
+
return chain[0].expression;
|
|
79
|
+
}
|
|
80
|
+
const conditionId = luau_ast_1.default.tempId("condition");
|
|
81
|
+
buildLogicalChainPrereqs(state, chain, conditionId, buildCondition);
|
|
82
|
+
return conditionId;
|
|
83
|
+
}
|
|
84
|
+
function transformLogical(state, node) {
|
|
85
|
+
if (node.operatorToken.kind === typescript_1.default.SyntaxKind.AmpersandAmpersandToken) {
|
|
86
|
+
return buildInlineConditionExpression(state, node, node.operatorToken.kind, "and", (conditionId, node) => (0, createTruthinessChecks_1.createTruthinessChecks)(state, conditionId, node));
|
|
87
|
+
}
|
|
88
|
+
else if (node.operatorToken.kind === typescript_1.default.SyntaxKind.BarBarToken) {
|
|
89
|
+
return buildInlineConditionExpression(state, node, node.operatorToken.kind, "or", (conditionId, node) => luau_ast_1.default.unary("not", (0, createTruthinessChecks_1.createTruthinessChecks)(state, conditionId, node)));
|
|
90
|
+
}
|
|
91
|
+
else if (node.operatorToken.kind === typescript_1.default.SyntaxKind.QuestionQuestionToken) {
|
|
92
|
+
const conditionBuilder = (conditionId) => luau_ast_1.default.binary(conditionId, "==", luau_ast_1.default.nil());
|
|
93
|
+
if (!(0, types_1.isPossiblyType)(state.getType(node), (0, types_1.isBooleanLiteralType)(state, false))) {
|
|
94
|
+
return buildInlineConditionExpression(state, node, node.operatorToken.kind, "or", conditionBuilder);
|
|
95
|
+
}
|
|
96
|
+
const chain = getLogicalChain(state, node, typescript_1.default.SyntaxKind.QuestionQuestionToken, false);
|
|
97
|
+
const conditionId = luau_ast_1.default.tempId("condition");
|
|
98
|
+
buildLogicalChainPrereqs(state, chain, conditionId, conditionBuilder);
|
|
99
|
+
return conditionId;
|
|
100
|
+
}
|
|
101
|
+
(0, assert_1.assert)(false, `Operator not implemented: ${(0, getKindName_1.getKindName)(node.operatorToken.kind)}`);
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=transformLogical.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../classes/TransformState";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformLogicalOrCoalescingAssignmentExpression(state: TransformState, node: ts.AssignmentExpression<ts.Token<ts.LogicalOrCoalescingAssignmentOperator>>): luau.WritableExpression;
|
|
5
|
+
export declare function transformLogicalOrCoalescingAssignmentExpressionStatement(state: TransformState, node: ts.AssignmentExpression<ts.Token<ts.LogicalOrCoalescingAssignmentOperator>>): luau.List<luau.Statement>;
|
|
@@ -0,0 +1,91 @@
|
|
|
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.transformLogicalOrCoalescingAssignmentExpression = transformLogicalOrCoalescingAssignmentExpression;
|
|
7
|
+
exports.transformLogicalOrCoalescingAssignmentExpressionStatement = transformLogicalOrCoalescingAssignmentExpressionStatement;
|
|
8
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
9
|
+
const transformExpression_1 = require("./expressions/transformExpression");
|
|
10
|
+
const transformWritable_1 = require("./transformWritable");
|
|
11
|
+
const createTruthinessChecks_1 = require("../util/createTruthinessChecks");
|
|
12
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
13
|
+
function transformCoalescingAssignmentExpression(state, left, right) {
|
|
14
|
+
const writable = (0, transformWritable_1.transformWritableExpression)(state, left, true);
|
|
15
|
+
const [value, valuePreqreqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, right));
|
|
16
|
+
const ifStatements = luau_ast_1.default.list.make();
|
|
17
|
+
luau_ast_1.default.list.pushList(ifStatements, valuePreqreqs);
|
|
18
|
+
luau_ast_1.default.list.push(ifStatements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
19
|
+
left: writable,
|
|
20
|
+
operator: "=",
|
|
21
|
+
right: value,
|
|
22
|
+
}));
|
|
23
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
24
|
+
condition: luau_ast_1.default.binary(writable, "==", luau_ast_1.default.nil()),
|
|
25
|
+
statements: ifStatements,
|
|
26
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
27
|
+
}));
|
|
28
|
+
return writable;
|
|
29
|
+
}
|
|
30
|
+
function transformLogicalAndAssignmentExpression(state, left, right) {
|
|
31
|
+
const writable = (0, transformWritable_1.transformWritableExpression)(state, left, true);
|
|
32
|
+
const [value, valuePreqreqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, right));
|
|
33
|
+
const conditionId = state.pushToVar(writable, "condition");
|
|
34
|
+
const ifStatements = luau_ast_1.default.list.make();
|
|
35
|
+
luau_ast_1.default.list.pushList(ifStatements, valuePreqreqs);
|
|
36
|
+
luau_ast_1.default.list.push(ifStatements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
37
|
+
left: conditionId,
|
|
38
|
+
operator: "=",
|
|
39
|
+
right: value,
|
|
40
|
+
}));
|
|
41
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
42
|
+
condition: (0, createTruthinessChecks_1.createTruthinessChecks)(state, writable, left),
|
|
43
|
+
statements: ifStatements,
|
|
44
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
45
|
+
}));
|
|
46
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
47
|
+
left: writable,
|
|
48
|
+
operator: "=",
|
|
49
|
+
right: conditionId,
|
|
50
|
+
}));
|
|
51
|
+
return writable;
|
|
52
|
+
}
|
|
53
|
+
function transformLogicalOrAssignmentExpression(state, left, right) {
|
|
54
|
+
const writable = (0, transformWritable_1.transformWritableExpression)(state, left, true);
|
|
55
|
+
const [value, valuePreqreqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, right));
|
|
56
|
+
const conditionId = state.pushToVar(writable, "condition");
|
|
57
|
+
const ifStatements = luau_ast_1.default.list.make();
|
|
58
|
+
luau_ast_1.default.list.pushList(ifStatements, valuePreqreqs);
|
|
59
|
+
luau_ast_1.default.list.push(ifStatements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
60
|
+
left: conditionId,
|
|
61
|
+
operator: "=",
|
|
62
|
+
right: value,
|
|
63
|
+
}));
|
|
64
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
65
|
+
condition: luau_ast_1.default.unary("not", (0, createTruthinessChecks_1.createTruthinessChecks)(state, writable, left)),
|
|
66
|
+
statements: ifStatements,
|
|
67
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
68
|
+
}));
|
|
69
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
70
|
+
left: writable,
|
|
71
|
+
operator: "=",
|
|
72
|
+
right: conditionId,
|
|
73
|
+
}));
|
|
74
|
+
return writable;
|
|
75
|
+
}
|
|
76
|
+
function transformLogicalOrCoalescingAssignmentExpression(state, node) {
|
|
77
|
+
const operator = node.operatorToken.kind;
|
|
78
|
+
if (operator === typescript_1.default.SyntaxKind.QuestionQuestionEqualsToken) {
|
|
79
|
+
return transformCoalescingAssignmentExpression(state, node.left, node.right);
|
|
80
|
+
}
|
|
81
|
+
else if (operator === typescript_1.default.SyntaxKind.AmpersandAmpersandEqualsToken) {
|
|
82
|
+
return transformLogicalAndAssignmentExpression(state, node.left, node.right);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return transformLogicalOrAssignmentExpression(state, node.left, node.right);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function transformLogicalOrCoalescingAssignmentExpressionStatement(state, node) {
|
|
89
|
+
return state.capturePrereqs(() => transformLogicalOrCoalescingAssignmentExpression(state, node));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=transformLogicalOrCoalescingAssignmentExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "..";
|
|
3
|
+
import { Pointer } from "../util/pointer";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
export declare function transformMethodDeclaration(state: TransformState, node: ts.MethodDeclaration, ptr: Pointer<luau.Map | luau.AnyIdentifier>): luau.List<luau.Statement<luau.SyntaxKind>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
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.transformMethodDeclaration = transformMethodDeclaration;
|
|
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 transformParameters_1 = require("./transformParameters");
|
|
12
|
+
const transformPropertyName_1 = require("./transformPropertyName");
|
|
13
|
+
const transformStatementList_1 = require("./transformStatementList");
|
|
14
|
+
const isMethod_1 = require("../util/isMethod");
|
|
15
|
+
const pointer_1 = require("../util/pointer");
|
|
16
|
+
const wrapStatementsAsGenerator_1 = require("../util/wrapStatementsAsGenerator");
|
|
17
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
18
|
+
function transformMethodDeclaration(state, node, ptr) {
|
|
19
|
+
const result = luau_ast_1.default.list.make();
|
|
20
|
+
if (!node.body) {
|
|
21
|
+
return luau_ast_1.default.list.make();
|
|
22
|
+
}
|
|
23
|
+
(0, assert_1.assert)(node.name);
|
|
24
|
+
if (typescript_1.default.isPrivateIdentifier(node.name)) {
|
|
25
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noPrivateIdentifier(node.name));
|
|
26
|
+
return luau_ast_1.default.list.make();
|
|
27
|
+
}
|
|
28
|
+
let { statements, parameters, hasDotDotDot } = (0, transformParameters_1.transformParameters)(state, node);
|
|
29
|
+
luau_ast_1.default.list.pushList(statements, (0, transformStatementList_1.transformStatementList)(state, node.body, node.body.statements));
|
|
30
|
+
let name = (0, transformPropertyName_1.transformPropertyName)(state, node.name);
|
|
31
|
+
if (typescript_1.default.hasDecorators(node) || node.parameters.some(parameter => typescript_1.default.hasDecorators(parameter))) {
|
|
32
|
+
if (!luau_ast_1.default.isSimplePrimitive(name)) {
|
|
33
|
+
const tempId = luau_ast_1.default.tempId("key");
|
|
34
|
+
luau_ast_1.default.list.push(result, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
35
|
+
left: tempId,
|
|
36
|
+
right: name,
|
|
37
|
+
}));
|
|
38
|
+
name = tempId;
|
|
39
|
+
}
|
|
40
|
+
state.setClassElementObjectKey(node, name);
|
|
41
|
+
}
|
|
42
|
+
const isAsync = typescript_1.default.hasSyntacticModifier(node, typescript_1.default.ModifierFlags.Async);
|
|
43
|
+
if (node.asteriskToken) {
|
|
44
|
+
if (isAsync) {
|
|
45
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noAsyncGeneratorFunctions(node));
|
|
46
|
+
}
|
|
47
|
+
statements = (0, wrapStatementsAsGenerator_1.wrapStatementsAsGenerator)(state, node, statements);
|
|
48
|
+
}
|
|
49
|
+
if (!isAsync && luau_ast_1.default.isStringLiteral(name) && !luau_ast_1.default.isMap(ptr.value) && luau_ast_1.default.isValidIdentifier(name.value)) {
|
|
50
|
+
if ((0, isMethod_1.isMethod)(state, node)) {
|
|
51
|
+
luau_ast_1.default.list.shift(parameters);
|
|
52
|
+
luau_ast_1.default.list.push(result, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodDeclaration, {
|
|
53
|
+
expression: ptr.value,
|
|
54
|
+
name: name.value,
|
|
55
|
+
statements,
|
|
56
|
+
parameters,
|
|
57
|
+
hasDotDotDot,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
luau_ast_1.default.list.push(result, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionDeclaration, {
|
|
62
|
+
name: luau_ast_1.default.property(ptr.value, name.value),
|
|
63
|
+
localize: false,
|
|
64
|
+
statements,
|
|
65
|
+
parameters,
|
|
66
|
+
hasDotDotDot,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
let expression = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionExpression, {
|
|
72
|
+
statements,
|
|
73
|
+
parameters,
|
|
74
|
+
hasDotDotDot,
|
|
75
|
+
});
|
|
76
|
+
if (isAsync) {
|
|
77
|
+
expression = luau_ast_1.default.call(state.TS(node, "async"), [expression]);
|
|
78
|
+
}
|
|
79
|
+
luau_ast_1.default.list.pushList(result, state.capturePrereqs(() => (0, pointer_1.assignToMapPointer)(state, ptr, name, expression)));
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=transformMethodDeclaration.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "..";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
declare enum OptionalChainItemKind {
|
|
5
|
+
PropertyAccess = 0,
|
|
6
|
+
ElementAccess = 1,
|
|
7
|
+
Call = 2,
|
|
8
|
+
PropertyCall = 3,
|
|
9
|
+
ElementCall = 4
|
|
10
|
+
}
|
|
11
|
+
interface OptionalChainItem<T extends OptionalChainItemKind, U extends ts.Expression> {
|
|
12
|
+
kind: T;
|
|
13
|
+
node: U;
|
|
14
|
+
optional: boolean;
|
|
15
|
+
type: ts.Type;
|
|
16
|
+
}
|
|
17
|
+
interface PropertyAccessItem extends OptionalChainItem<OptionalChainItemKind.PropertyAccess, ts.PropertyAccessExpression> {
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
interface ElementAccessItem extends OptionalChainItem<OptionalChainItemKind.ElementAccess, ts.ElementAccessExpression> {
|
|
21
|
+
expression: ts.Expression;
|
|
22
|
+
}
|
|
23
|
+
interface CallItem extends OptionalChainItem<OptionalChainItemKind.Call, ts.CallExpression> {
|
|
24
|
+
args: ReadonlyArray<ts.Expression>;
|
|
25
|
+
}
|
|
26
|
+
interface PropertyCallItem extends OptionalChainItem<OptionalChainItemKind.PropertyCall, ts.CallExpression> {
|
|
27
|
+
expression: ts.PropertyAccessExpression;
|
|
28
|
+
name: string;
|
|
29
|
+
callOptional: boolean;
|
|
30
|
+
callType: ts.Type;
|
|
31
|
+
args: ReadonlyArray<ts.Expression>;
|
|
32
|
+
}
|
|
33
|
+
interface ElementCallItem extends OptionalChainItem<OptionalChainItemKind.ElementCall, ts.CallExpression> {
|
|
34
|
+
expression: ts.ElementAccessExpression;
|
|
35
|
+
argumentExpression: ts.Expression;
|
|
36
|
+
callOptional: boolean;
|
|
37
|
+
callType: ts.Type;
|
|
38
|
+
args: ReadonlyArray<ts.Expression>;
|
|
39
|
+
}
|
|
40
|
+
type ChainItem = PropertyAccessItem | ElementAccessItem | CallItem | PropertyCallItem | ElementCallItem;
|
|
41
|
+
export declare function flattenOptionalChain(state: TransformState, expression: ts.Expression): {
|
|
42
|
+
chain: ChainItem[];
|
|
43
|
+
expression: ts.Expression;
|
|
44
|
+
};
|
|
45
|
+
export declare function transformOptionalChain(state: TransformState, node: ts.PropertyAccessExpression | ts.ElementAccessExpression | ts.CallExpression): luau.Expression;
|
|
46
|
+
export {};
|