@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,262 @@
|
|
|
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.transformClassLikeDeclaration = transformClassLikeDeclaration;
|
|
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 transformClassConstructor_1 = require("./transformClassConstructor");
|
|
12
|
+
const transformDecorators_1 = require("./transformDecorators");
|
|
13
|
+
const transformPropertyDeclaration_1 = require("./transformPropertyDeclaration");
|
|
14
|
+
const transformExpression_1 = require("../expressions/transformExpression");
|
|
15
|
+
const transformIdentifier_1 = require("../expressions/transformIdentifier");
|
|
16
|
+
const transformBlock_1 = require("../statements/transformBlock");
|
|
17
|
+
const transformMethodDeclaration_1 = require("../transformMethodDeclaration");
|
|
18
|
+
const findConstructor_1 = require("../../util/findConstructor");
|
|
19
|
+
const getExtendsNode_1 = require("../../util/getExtendsNode");
|
|
20
|
+
const getKindName_1 = require("../../util/getKindName");
|
|
21
|
+
const validateIdentifier_1 = require("../../util/validateIdentifier");
|
|
22
|
+
const validateMethodAssignment_1 = require("../../util/validateMethodAssignment");
|
|
23
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
24
|
+
const MAGIC_TO_STRING_METHOD = "toString";
|
|
25
|
+
function createNameFunction(name) {
|
|
26
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionExpression, {
|
|
27
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ReturnStatement, {
|
|
28
|
+
expression: luau_ast_1.default.string(name),
|
|
29
|
+
})),
|
|
30
|
+
parameters: luau_ast_1.default.list.make(),
|
|
31
|
+
hasDotDotDot: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function createBoilerplate(state, node, className, isClassExpression) {
|
|
35
|
+
const isAbstract = typescript_1.default.hasAbstractModifier(node);
|
|
36
|
+
const statements = luau_ast_1.default.list.make();
|
|
37
|
+
const extendsNode = (0, getExtendsNode_1.getExtendsNode)(node);
|
|
38
|
+
if (isAbstract && !extendsNode) {
|
|
39
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
40
|
+
left: className,
|
|
41
|
+
operator: "=",
|
|
42
|
+
right: luau_ast_1.default.map(),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const metatableFields = luau_ast_1.default.list.make();
|
|
47
|
+
luau_ast_1.default.list.push(metatableFields, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MapField, {
|
|
48
|
+
index: luau_ast_1.default.strings.__tostring,
|
|
49
|
+
value: createNameFunction(luau_ast_1.default.isTemporaryIdentifier(className) ? "Anonymous" : className.name),
|
|
50
|
+
}));
|
|
51
|
+
if (extendsNode) {
|
|
52
|
+
const [extendsExp, extendsExpPrereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, extendsNode.expression));
|
|
53
|
+
const superId = luau_ast_1.default.id("super");
|
|
54
|
+
luau_ast_1.default.list.pushList(statements, extendsExpPrereqs);
|
|
55
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
56
|
+
left: superId,
|
|
57
|
+
right: extendsExp,
|
|
58
|
+
}));
|
|
59
|
+
luau_ast_1.default.list.push(metatableFields, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MapField, {
|
|
60
|
+
index: luau_ast_1.default.strings.__index,
|
|
61
|
+
value: superId,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
const metatable = luau_ast_1.default.call(luau_ast_1.default.globals.setmetatable, [
|
|
65
|
+
luau_ast_1.default.map(),
|
|
66
|
+
luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Map, { fields: metatableFields }),
|
|
67
|
+
]);
|
|
68
|
+
if (isClassExpression && node.name) {
|
|
69
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
70
|
+
left: (0, transformIdentifier_1.transformIdentifierDefined)(state, node.name),
|
|
71
|
+
right: metatable,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
76
|
+
left: className,
|
|
77
|
+
operator: "=",
|
|
78
|
+
right: metatable,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
82
|
+
left: luau_ast_1.default.property(className, "__index"),
|
|
83
|
+
operator: "=",
|
|
84
|
+
right: className,
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
if (!isAbstract) {
|
|
88
|
+
const statementsInner = luau_ast_1.default.list.make();
|
|
89
|
+
luau_ast_1.default.list.push(statementsInner, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
90
|
+
left: luau_ast_1.default.globals.self,
|
|
91
|
+
right: luau_ast_1.default.call(luau_ast_1.default.globals.setmetatable, [luau_ast_1.default.map(), className]),
|
|
92
|
+
}));
|
|
93
|
+
luau_ast_1.default.list.push(statementsInner, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ReturnStatement, {
|
|
94
|
+
expression: luau_ast_1.default.binary(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodCallExpression, {
|
|
95
|
+
expression: luau_ast_1.default.globals.self,
|
|
96
|
+
name: "constructor",
|
|
97
|
+
args: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VarArgsLiteral, {})),
|
|
98
|
+
}), "or", luau_ast_1.default.globals.self),
|
|
99
|
+
}));
|
|
100
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionDeclaration, {
|
|
101
|
+
name: luau_ast_1.default.property(className, "new"),
|
|
102
|
+
parameters: luau_ast_1.default.list.make(),
|
|
103
|
+
hasDotDotDot: true,
|
|
104
|
+
statements: statementsInner,
|
|
105
|
+
localize: false,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return statements;
|
|
109
|
+
}
|
|
110
|
+
function isClassHoisted(state, node) {
|
|
111
|
+
if (node.name) {
|
|
112
|
+
const symbol = state.typeChecker.getSymbolAtLocation(node.name);
|
|
113
|
+
(0, assert_1.assert)(symbol);
|
|
114
|
+
return state.isHoisted.get(symbol) === true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
function transformClassLikeDeclaration(state, node) {
|
|
119
|
+
const isClassExpression = typescript_1.default.isClassExpression(node);
|
|
120
|
+
const statements = luau_ast_1.default.list.make();
|
|
121
|
+
const isExportDefault = typescript_1.default.hasSyntacticModifier(node, typescript_1.default.ModifierFlags.ExportDefault);
|
|
122
|
+
if (node.name) {
|
|
123
|
+
(0, validateIdentifier_1.validateIdentifier)(state, node.name);
|
|
124
|
+
}
|
|
125
|
+
const shouldUseInternalName = isClassExpression && node.name !== undefined;
|
|
126
|
+
let returnVar;
|
|
127
|
+
if (shouldUseInternalName) {
|
|
128
|
+
returnVar = luau_ast_1.default.tempId("class");
|
|
129
|
+
}
|
|
130
|
+
else if (node.name) {
|
|
131
|
+
returnVar = (0, transformIdentifier_1.transformIdentifierDefined)(state, node.name);
|
|
132
|
+
}
|
|
133
|
+
else if (isExportDefault) {
|
|
134
|
+
returnVar = luau_ast_1.default.id("default");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
returnVar = luau_ast_1.default.tempId("class");
|
|
138
|
+
}
|
|
139
|
+
let internalName;
|
|
140
|
+
if (shouldUseInternalName) {
|
|
141
|
+
internalName = (0, transformIdentifier_1.transformIdentifierDefined)(state, node.name);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
internalName = returnVar;
|
|
145
|
+
}
|
|
146
|
+
state.classIdentifierMap.set(node, internalName);
|
|
147
|
+
if (!isClassHoisted(state, node)) {
|
|
148
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
149
|
+
left: returnVar,
|
|
150
|
+
right: undefined,
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
const statementsInner = luau_ast_1.default.list.make();
|
|
154
|
+
luau_ast_1.default.list.pushList(statementsInner, createBoilerplate(state, node, internalName, isClassExpression));
|
|
155
|
+
const constructor = (0, findConstructor_1.findConstructor)(node);
|
|
156
|
+
if (constructor) {
|
|
157
|
+
luau_ast_1.default.list.pushList(statementsInner, (0, transformClassConstructor_1.transformClassConstructor)(state, constructor, internalName));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
luau_ast_1.default.list.pushList(statementsInner, (0, transformClassConstructor_1.transformImplicitClassConstructor)(state, node, internalName));
|
|
161
|
+
}
|
|
162
|
+
for (const member of node.members) {
|
|
163
|
+
if ((typescript_1.default.isPropertyDeclaration(member) || typescript_1.default.isMethodDeclaration(member)) &&
|
|
164
|
+
(typescript_1.default.isIdentifier(member.name) || typescript_1.default.isStringLiteral(member.name)) &&
|
|
165
|
+
luau_ast_1.default.isReservedClassField(member.name.text)) {
|
|
166
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noReservedClassFields(member.name));
|
|
167
|
+
}
|
|
168
|
+
if (typescript_1.default.isAutoAccessorPropertyDeclaration(member)) {
|
|
169
|
+
const keyword = typescript_1.default.getModifiers(member).find(m => m.kind === typescript_1.default.SyntaxKind.AccessorKeyword);
|
|
170
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noAutoAccessorModifiers(keyword));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const methods = new Array();
|
|
174
|
+
const staticDeclarations = new Array();
|
|
175
|
+
for (const member of node.members) {
|
|
176
|
+
(0, validateMethodAssignment_1.validateMethodAssignment)(state, member);
|
|
177
|
+
if (typescript_1.default.isConstructorDeclaration(member) ||
|
|
178
|
+
typescript_1.default.isIndexSignatureDeclaration(member) ||
|
|
179
|
+
typescript_1.default.isSemicolonClassElement(member)) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
else if (typescript_1.default.isMethodDeclaration(member)) {
|
|
183
|
+
methods.push(member);
|
|
184
|
+
}
|
|
185
|
+
else if (typescript_1.default.isPropertyDeclaration(member)) {
|
|
186
|
+
if (!typescript_1.default.hasStaticModifier(member)) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
staticDeclarations.push(member);
|
|
190
|
+
}
|
|
191
|
+
else if (typescript_1.default.isAccessor(member)) {
|
|
192
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noGetterSetter(member));
|
|
193
|
+
}
|
|
194
|
+
else if (typescript_1.default.isClassStaticBlockDeclaration(member)) {
|
|
195
|
+
staticDeclarations.push(member);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
(0, assert_1.assert)(false, `ClassMember kind not implemented: ${(0, getKindName_1.getKindName)(member.kind)}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const classType = state.typeChecker.getTypeOfSymbolAtLocation(node.symbol, node);
|
|
202
|
+
const instanceType = state.typeChecker.getDeclaredTypeOfSymbol(node.symbol);
|
|
203
|
+
for (const method of methods) {
|
|
204
|
+
if (typescript_1.default.isIdentifier(method.name) || typescript_1.default.isStringLiteral(method.name)) {
|
|
205
|
+
if (luau_ast_1.default.isMetamethod(method.name.text)) {
|
|
206
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noClassMetamethods(method.name));
|
|
207
|
+
}
|
|
208
|
+
if (typescript_1.default.hasStaticModifier(method)) {
|
|
209
|
+
if (instanceType.getProperty(method.name.text) !== undefined) {
|
|
210
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noInstanceMethodCollisions(method));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
if (classType.getProperty(method.name.text) !== undefined) {
|
|
215
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noStaticMethodCollisions(method));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const [statements, prereqs] = state.capture(() => (0, transformMethodDeclaration_1.transformMethodDeclaration)(state, method, { name: "name", value: internalName }));
|
|
220
|
+
luau_ast_1.default.list.pushList(statementsInner, prereqs);
|
|
221
|
+
luau_ast_1.default.list.pushList(statementsInner, statements);
|
|
222
|
+
}
|
|
223
|
+
const toStringProperty = instanceType.getProperty(MAGIC_TO_STRING_METHOD);
|
|
224
|
+
if (toStringProperty && !!(toStringProperty.flags & typescript_1.default.SymbolFlags.Method)) {
|
|
225
|
+
luau_ast_1.default.list.push(statementsInner, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodDeclaration, {
|
|
226
|
+
expression: internalName,
|
|
227
|
+
name: "__tostring",
|
|
228
|
+
hasDotDotDot: false,
|
|
229
|
+
parameters: luau_ast_1.default.list.make(),
|
|
230
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ReturnStatement, {
|
|
231
|
+
expression: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodCallExpression, {
|
|
232
|
+
expression: luau_ast_1.default.globals.self,
|
|
233
|
+
name: MAGIC_TO_STRING_METHOD,
|
|
234
|
+
args: luau_ast_1.default.list.make(),
|
|
235
|
+
}),
|
|
236
|
+
})),
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
for (const declaration of staticDeclarations) {
|
|
240
|
+
if (typescript_1.default.isClassStaticBlockDeclaration(declaration)) {
|
|
241
|
+
luau_ast_1.default.list.pushList(statementsInner, (0, transformBlock_1.transformBlock)(state, declaration.body));
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
const [statements, prereqs] = state.capture(() => (0, transformPropertyDeclaration_1.transformPropertyDeclaration)(state, declaration, internalName));
|
|
245
|
+
luau_ast_1.default.list.pushList(statementsInner, prereqs);
|
|
246
|
+
luau_ast_1.default.list.pushList(statementsInner, statements);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (shouldUseInternalName) {
|
|
250
|
+
luau_ast_1.default.list.push(statementsInner, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
251
|
+
left: returnVar,
|
|
252
|
+
operator: "=",
|
|
253
|
+
right: internalName,
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
luau_ast_1.default.list.pushList(statementsInner, (0, transformDecorators_1.transformDecorators)(state, node, returnVar));
|
|
257
|
+
luau_ast_1.default.list.push(statements, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.DoStatement, {
|
|
258
|
+
statements: statementsInner,
|
|
259
|
+
}));
|
|
260
|
+
return { statements, name: returnVar };
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=transformClassLikeDeclaration.js.map
|
|
@@ -0,0 +1,179 @@
|
|
|
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.transformDecorators = transformDecorators;
|
|
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 transformPropertyName_1 = require("../transformPropertyName");
|
|
11
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
12
|
+
const expressionMightMutate_1 = require("../../util/expressionMightMutate");
|
|
13
|
+
const findConstructor_1 = require("../../util/findConstructor");
|
|
14
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
+
function countDecorators(node) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
return (_b = (_a = typescript_1.default.getDecorators(node)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
18
|
+
}
|
|
19
|
+
function shouldInline(state, isLastDecorator, decorator, expression) {
|
|
20
|
+
if (!(0, expressionMightMutate_1.expressionMightMutate)(state, expression, decorator.expression))
|
|
21
|
+
return true;
|
|
22
|
+
if (!isLastDecorator)
|
|
23
|
+
return false;
|
|
24
|
+
const node = decorator.parent;
|
|
25
|
+
if (typescript_1.default.isMethodDeclaration(node) && node.parameters.some(parameter => countDecorators(parameter) > 0))
|
|
26
|
+
return false;
|
|
27
|
+
if (typescript_1.default.isClassLike(node)) {
|
|
28
|
+
const constructor = (0, findConstructor_1.findConstructor)(node);
|
|
29
|
+
if (constructor && constructor.parameters.some(parameter => countDecorators(parameter) > 0))
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (typescript_1.default.isParameter(node)) {
|
|
33
|
+
const parameters = node.parent.parameters;
|
|
34
|
+
const paramIdx = parameters.findIndex(param => param === node);
|
|
35
|
+
for (let i = paramIdx + 1; i < parameters.length; i++) {
|
|
36
|
+
if (countDecorators(parameters[i]) > 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
function transformMemberDecorators(state, node, callback) {
|
|
44
|
+
var _a;
|
|
45
|
+
const initializers = luau_ast_1.default.list.make();
|
|
46
|
+
const finalizers = luau_ast_1.default.list.make();
|
|
47
|
+
const decorators = (_a = typescript_1.default.getDecorators(node)) !== null && _a !== void 0 ? _a : [];
|
|
48
|
+
for (let i = 0; i < decorators.length; i++) {
|
|
49
|
+
const decorator = decorators[i];
|
|
50
|
+
let [expression, prereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, decorator.expression));
|
|
51
|
+
luau_ast_1.default.list.pushList(initializers, prereqs);
|
|
52
|
+
const isLastDecorator = i === decorators.length - 1;
|
|
53
|
+
if (!shouldInline(state, isLastDecorator, decorator, expression)) {
|
|
54
|
+
const tempId = luau_ast_1.default.tempId("decorator");
|
|
55
|
+
luau_ast_1.default.list.push(initializers, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
56
|
+
left: tempId,
|
|
57
|
+
right: expression,
|
|
58
|
+
}));
|
|
59
|
+
expression = tempId;
|
|
60
|
+
}
|
|
61
|
+
luau_ast_1.default.list.unshiftList(finalizers, callback((0, convertToIndexableExpression_1.convertToIndexableExpression)(expression)));
|
|
62
|
+
}
|
|
63
|
+
return [initializers, finalizers];
|
|
64
|
+
}
|
|
65
|
+
function transformMethodDecorators(state, member, classId) {
|
|
66
|
+
const [initializers, finalizers] = transformMemberDecorators(state, member, expression => {
|
|
67
|
+
const result = luau_ast_1.default.list.make();
|
|
68
|
+
const descriptorId = luau_ast_1.default.tempId("descriptor");
|
|
69
|
+
const key = state.getClassElementObjectKey(member);
|
|
70
|
+
(0, assert_1.assert)(key, "Did not find method key for method decorator");
|
|
71
|
+
luau_ast_1.default.list.push(result, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
72
|
+
left: descriptorId,
|
|
73
|
+
right: luau_ast_1.default.call(expression, [
|
|
74
|
+
classId,
|
|
75
|
+
key,
|
|
76
|
+
luau_ast_1.default.map([
|
|
77
|
+
[
|
|
78
|
+
luau_ast_1.default.string("value"),
|
|
79
|
+
luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
80
|
+
expression: classId,
|
|
81
|
+
index: key,
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
]),
|
|
85
|
+
]),
|
|
86
|
+
}));
|
|
87
|
+
luau_ast_1.default.list.push(result, luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
88
|
+
condition: descriptorId,
|
|
89
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
90
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
91
|
+
expression: classId,
|
|
92
|
+
index: key,
|
|
93
|
+
}),
|
|
94
|
+
operator: "=",
|
|
95
|
+
right: luau_ast_1.default.property(descriptorId, "value"),
|
|
96
|
+
})),
|
|
97
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
98
|
+
}));
|
|
99
|
+
return result;
|
|
100
|
+
});
|
|
101
|
+
const result = luau_ast_1.default.list.make();
|
|
102
|
+
luau_ast_1.default.list.pushList(result, initializers);
|
|
103
|
+
luau_ast_1.default.list.pushList(result, transformParameterDecorators(state, member, classId));
|
|
104
|
+
luau_ast_1.default.list.pushList(result, finalizers);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
function transformPropertyDecorators(state, member, classId) {
|
|
108
|
+
const [initializers, finalizers] = transformMemberDecorators(state, member, expression => {
|
|
109
|
+
const key = state.noPrereqs(() => (0, transformPropertyName_1.transformPropertyName)(state, member.name));
|
|
110
|
+
return luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.CallStatement, {
|
|
111
|
+
expression: luau_ast_1.default.call(expression, [classId, key]),
|
|
112
|
+
}));
|
|
113
|
+
});
|
|
114
|
+
const result = luau_ast_1.default.list.make();
|
|
115
|
+
luau_ast_1.default.list.pushList(result, initializers);
|
|
116
|
+
luau_ast_1.default.list.pushList(result, finalizers);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
function transformParameterDecorators(state, member, classId) {
|
|
120
|
+
const initializers = luau_ast_1.default.list.make();
|
|
121
|
+
const finalizers = luau_ast_1.default.list.make();
|
|
122
|
+
for (let i = 0; i < member.parameters.length; i++) {
|
|
123
|
+
const parameter = member.parameters[i];
|
|
124
|
+
const [paramInitializers, paramFinalizers] = transformMemberDecorators(state, parameter, expression => {
|
|
125
|
+
const key = member.name ? state.getClassElementObjectKey(member) : luau_ast_1.default.nil();
|
|
126
|
+
(0, assert_1.assert)(key, "Did not find method key for parameter decorator");
|
|
127
|
+
return luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.CallStatement, {
|
|
128
|
+
expression: luau_ast_1.default.call(expression, [classId, key, luau_ast_1.default.number(i)]),
|
|
129
|
+
}));
|
|
130
|
+
});
|
|
131
|
+
luau_ast_1.default.list.pushList(initializers, paramInitializers);
|
|
132
|
+
luau_ast_1.default.list.unshiftList(finalizers, paramFinalizers);
|
|
133
|
+
}
|
|
134
|
+
const result = luau_ast_1.default.list.make();
|
|
135
|
+
luau_ast_1.default.list.pushList(result, initializers);
|
|
136
|
+
luau_ast_1.default.list.pushList(result, finalizers);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
function transformClassDecorators(state, node, classId) {
|
|
140
|
+
const [initializers, finalizers] = transformMemberDecorators(state, node, expression => luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
141
|
+
left: classId,
|
|
142
|
+
operator: "=",
|
|
143
|
+
right: luau_ast_1.default.binary(luau_ast_1.default.call(expression, [classId]), "or", classId),
|
|
144
|
+
})));
|
|
145
|
+
const result = luau_ast_1.default.list.make();
|
|
146
|
+
luau_ast_1.default.list.pushList(result, initializers);
|
|
147
|
+
const constructor = (0, findConstructor_1.findConstructor)(node);
|
|
148
|
+
if (constructor) {
|
|
149
|
+
luau_ast_1.default.list.pushList(result, transformParameterDecorators(state, constructor, classId));
|
|
150
|
+
}
|
|
151
|
+
luau_ast_1.default.list.pushList(result, finalizers);
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
function transformDecorators(state, node, classId) {
|
|
155
|
+
const result = luau_ast_1.default.list.make();
|
|
156
|
+
for (const member of node.members) {
|
|
157
|
+
if (!typescript_1.default.hasStaticModifier(member)) {
|
|
158
|
+
if (typescript_1.default.isMethodDeclaration(member) && member.body) {
|
|
159
|
+
luau_ast_1.default.list.pushList(result, transformMethodDecorators(state, member, classId));
|
|
160
|
+
}
|
|
161
|
+
else if (typescript_1.default.isPropertyDeclaration(member)) {
|
|
162
|
+
luau_ast_1.default.list.pushList(result, transformPropertyDecorators(state, member, classId));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const member of node.members) {
|
|
167
|
+
if (typescript_1.default.hasStaticModifier(member)) {
|
|
168
|
+
if (typescript_1.default.isMethodDeclaration(member) && member.body) {
|
|
169
|
+
luau_ast_1.default.list.pushList(result, transformMethodDecorators(state, member, classId));
|
|
170
|
+
}
|
|
171
|
+
else if (typescript_1.default.isPropertyDeclaration(member)) {
|
|
172
|
+
luau_ast_1.default.list.pushList(result, transformPropertyDecorators(state, member, classId));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
luau_ast_1.default.list.pushList(result, transformClassDecorators(state, node, classId));
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=transformDecorators.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 transformPropertyDeclaration(state: TransformState, node: ts.PropertyDeclaration, name: luau.AnyIdentifier): luau.List<luau.Statement<luau.SyntaxKind>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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.transformPropertyDeclaration = transformPropertyDeclaration;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const diagnostics_1 = require("../../../Shared/diagnostics");
|
|
9
|
+
const DiagnosticService_1 = require("../../classes/DiagnosticService");
|
|
10
|
+
const transformExpression_1 = require("../expressions/transformExpression");
|
|
11
|
+
const transformPropertyName_1 = require("../transformPropertyName");
|
|
12
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
13
|
+
function transformPropertyDeclaration(state, node, name) {
|
|
14
|
+
if (!typescript_1.default.hasStaticModifier(node)) {
|
|
15
|
+
return luau_ast_1.default.list.make();
|
|
16
|
+
}
|
|
17
|
+
if (typescript_1.default.isPrivateIdentifier(node.name)) {
|
|
18
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noPrivateIdentifier(node));
|
|
19
|
+
return luau_ast_1.default.list.make();
|
|
20
|
+
}
|
|
21
|
+
if (!node.initializer) {
|
|
22
|
+
return luau_ast_1.default.list.make();
|
|
23
|
+
}
|
|
24
|
+
return luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
25
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
26
|
+
expression: name,
|
|
27
|
+
index: (0, transformPropertyName_1.transformPropertyName)(state, node.name),
|
|
28
|
+
}),
|
|
29
|
+
operator: "=",
|
|
30
|
+
right: (0, transformExpression_1.transformExpression)(state, node.initializer),
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=transformPropertyDeclaration.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
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.transformArrayLiteralExpression = transformArrayLiteralExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
9
|
+
const transformExpression_1 = require("./transformExpression");
|
|
10
|
+
const ensureTransformOrder_1 = require("../../util/ensureTransformOrder");
|
|
11
|
+
const getAddIterableToArrayBuilder_1 = require("../../util/getAddIterableToArrayBuilder");
|
|
12
|
+
const pointer_1 = require("../../util/pointer");
|
|
13
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
14
|
+
function transformArrayLiteralExpression(state, node) {
|
|
15
|
+
if (!node.elements.find(element => typescript_1.default.isSpreadElement(element))) {
|
|
16
|
+
return luau_ast_1.default.array((0, ensureTransformOrder_1.ensureTransformOrder)(state, node.elements));
|
|
17
|
+
}
|
|
18
|
+
const ptr = (0, pointer_1.createArrayPointer)("array");
|
|
19
|
+
const lengthId = luau_ast_1.default.tempId("length");
|
|
20
|
+
let lengthInitialized = false;
|
|
21
|
+
let amtElementsSinceUpdate = 0;
|
|
22
|
+
function updateLengthId() {
|
|
23
|
+
const right = luau_ast_1.default.unary("#", ptr.value);
|
|
24
|
+
if (lengthInitialized) {
|
|
25
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
26
|
+
left: lengthId,
|
|
27
|
+
operator: "=",
|
|
28
|
+
right,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
33
|
+
left: lengthId,
|
|
34
|
+
right,
|
|
35
|
+
}));
|
|
36
|
+
lengthInitialized = true;
|
|
37
|
+
}
|
|
38
|
+
amtElementsSinceUpdate = 0;
|
|
39
|
+
}
|
|
40
|
+
for (let i = 0; i < node.elements.length; i++) {
|
|
41
|
+
const element = node.elements[i];
|
|
42
|
+
if (typescript_1.default.isSpreadElement(element)) {
|
|
43
|
+
if (luau_ast_1.default.isArray(ptr.value)) {
|
|
44
|
+
(0, pointer_1.disableArrayInline)(state, ptr);
|
|
45
|
+
updateLengthId();
|
|
46
|
+
}
|
|
47
|
+
(0, assert_1.assert)(luau_ast_1.default.isAnyIdentifier(ptr.value));
|
|
48
|
+
const type = state.getType(element.expression);
|
|
49
|
+
const addIterableToArrayBuilder = (0, getAddIterableToArrayBuilder_1.getAddIterableToArrayBuilder)(state, element.expression, type);
|
|
50
|
+
const spreadExp = (0, transformExpression_1.transformExpression)(state, element.expression);
|
|
51
|
+
const shouldUpdateLengthId = i < node.elements.length - 1;
|
|
52
|
+
state.prereqList(addIterableToArrayBuilder(state, spreadExp, ptr.value, lengthId, amtElementsSinceUpdate, shouldUpdateLengthId));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const [expression, prereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, element));
|
|
56
|
+
if (luau_ast_1.default.isArray(ptr.value) && !luau_ast_1.default.list.isEmpty(prereqs)) {
|
|
57
|
+
(0, pointer_1.disableArrayInline)(state, ptr);
|
|
58
|
+
updateLengthId();
|
|
59
|
+
}
|
|
60
|
+
if (luau_ast_1.default.isArray(ptr.value)) {
|
|
61
|
+
luau_ast_1.default.list.push(ptr.value.members, expression);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
state.prereqList(prereqs);
|
|
65
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
66
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
67
|
+
expression: ptr.value,
|
|
68
|
+
index: luau_ast_1.default.binary(lengthId, "+", luau_ast_1.default.number(amtElementsSinceUpdate + 1)),
|
|
69
|
+
}),
|
|
70
|
+
operator: "=",
|
|
71
|
+
right: expression,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
amtElementsSinceUpdate++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return ptr.value;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=transformArrayLiteralExpression.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
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.transformAwaitExpression = transformAwaitExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./transformExpression");
|
|
9
|
+
const traversal_1 = require("../../util/traversal");
|
|
10
|
+
function transformAwaitExpression(state, node) {
|
|
11
|
+
return luau_ast_1.default.call(state.TS(node, "await"), [(0, transformExpression_1.transformExpression)(state, (0, traversal_1.skipDownwards)(node.expression))]);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=transformAwaitExpression.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 transformBinaryExpression(state: TransformState, node: ts.BinaryExpression): luau.Identifier | luau.TemporaryIdentifier | luau.ComputedIndexExpression | luau.PropertyAccessExpression | luau.CallExpression | luau.MethodCallExpression | luau.ParenthesizedExpression | luau.None | luau.NilLiteral | luau.FalseLiteral | luau.TrueLiteral | luau.NumberLiteral | luau.StringLiteral | luau.VarArgsLiteral | luau.FunctionExpression | luau.BinaryExpression | luau.UnaryExpression | luau.IfExpression | luau.InterpolatedString | luau.Array | luau.Map | luau.Set | luau.MixedTable;
|