@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,107 @@
|
|
|
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.transformExpression = transformExpression;
|
|
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 transformArrayLiteralExpression_1 = require("./transformArrayLiteralExpression");
|
|
12
|
+
const transformAwaitExpression_1 = require("./transformAwaitExpression");
|
|
13
|
+
const transformBinaryExpression_1 = require("./transformBinaryExpression");
|
|
14
|
+
const transformBooleanLiteral_1 = require("./transformBooleanLiteral");
|
|
15
|
+
const transformCallExpression_1 = require("./transformCallExpression");
|
|
16
|
+
const transformClassExpression_1 = require("./transformClassExpression");
|
|
17
|
+
const transformConditionalExpression_1 = require("./transformConditionalExpression");
|
|
18
|
+
const transformDeleteExpression_1 = require("./transformDeleteExpression");
|
|
19
|
+
const transformElementAccessExpression_1 = require("./transformElementAccessExpression");
|
|
20
|
+
const transformFunctionExpression_1 = require("./transformFunctionExpression");
|
|
21
|
+
const transformIdentifier_1 = require("./transformIdentifier");
|
|
22
|
+
const transformJsxElement_1 = require("./transformJsxElement");
|
|
23
|
+
const transformJsxExpression_1 = require("./transformJsxExpression");
|
|
24
|
+
const transformJsxFragment_1 = require("./transformJsxFragment");
|
|
25
|
+
const transformJsxSelfClosingElement_1 = require("./transformJsxSelfClosingElement");
|
|
26
|
+
const transformNewExpression_1 = require("./transformNewExpression");
|
|
27
|
+
const transformNoSubstitutionTemplateLiteral_1 = require("./transformNoSubstitutionTemplateLiteral");
|
|
28
|
+
const transformNumericLiteral_1 = require("./transformNumericLiteral");
|
|
29
|
+
const transformObjectLiteralExpression_1 = require("./transformObjectLiteralExpression");
|
|
30
|
+
const transformOmittedExpression_1 = require("./transformOmittedExpression");
|
|
31
|
+
const transformParenthesizedExpression_1 = require("./transformParenthesizedExpression");
|
|
32
|
+
const transformPropertyAccessExpression_1 = require("./transformPropertyAccessExpression");
|
|
33
|
+
const transformSpreadElement_1 = require("./transformSpreadElement");
|
|
34
|
+
const transformStringLiteral_1 = require("./transformStringLiteral");
|
|
35
|
+
const transformSuperKeyword_1 = require("./transformSuperKeyword");
|
|
36
|
+
const transformTaggedTemplateExpression_1 = require("./transformTaggedTemplateExpression");
|
|
37
|
+
const transformTemplateExpression_1 = require("./transformTemplateExpression");
|
|
38
|
+
const transformThisExpression_1 = require("./transformThisExpression");
|
|
39
|
+
const transformTypeExpression_1 = require("./transformTypeExpression");
|
|
40
|
+
const transformUnaryExpression_1 = require("./transformUnaryExpression");
|
|
41
|
+
const transformVoidExpression_1 = require("./transformVoidExpression");
|
|
42
|
+
const transformYieldExpression_1 = require("./transformYieldExpression");
|
|
43
|
+
const getKindName_1 = require("../../util/getKindName");
|
|
44
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
45
|
+
const NO_EMIT = () => luau_ast_1.default.none();
|
|
46
|
+
const DIAGNOSTIC = (factory) => (state, node) => {
|
|
47
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(factory(node));
|
|
48
|
+
return NO_EMIT();
|
|
49
|
+
};
|
|
50
|
+
function createTransformerMap(values) {
|
|
51
|
+
return new Map(values);
|
|
52
|
+
}
|
|
53
|
+
const TRANSFORMER_BY_KIND = createTransformerMap([
|
|
54
|
+
[typescript_1.default.SyntaxKind.BigIntLiteral, DIAGNOSTIC(diagnostics_1.errors.noBigInt)],
|
|
55
|
+
[typescript_1.default.SyntaxKind.NullKeyword, DIAGNOSTIC(diagnostics_1.errors.noNullLiteral)],
|
|
56
|
+
[typescript_1.default.SyntaxKind.PrivateIdentifier, DIAGNOSTIC(diagnostics_1.errors.noPrivateIdentifier)],
|
|
57
|
+
[typescript_1.default.SyntaxKind.RegularExpressionLiteral, DIAGNOSTIC(diagnostics_1.errors.noRegex)],
|
|
58
|
+
[typescript_1.default.SyntaxKind.TypeOfExpression, DIAGNOSTIC(diagnostics_1.errors.noTypeOfExpression)],
|
|
59
|
+
[typescript_1.default.SyntaxKind.ImportKeyword, NO_EMIT],
|
|
60
|
+
[typescript_1.default.SyntaxKind.ArrayLiteralExpression, transformArrayLiteralExpression_1.transformArrayLiteralExpression],
|
|
61
|
+
[typescript_1.default.SyntaxKind.ArrowFunction, transformFunctionExpression_1.transformFunctionExpression],
|
|
62
|
+
[typescript_1.default.SyntaxKind.AsExpression, transformTypeExpression_1.transformTypeExpression],
|
|
63
|
+
[typescript_1.default.SyntaxKind.AwaitExpression, transformAwaitExpression_1.transformAwaitExpression],
|
|
64
|
+
[typescript_1.default.SyntaxKind.BinaryExpression, transformBinaryExpression_1.transformBinaryExpression],
|
|
65
|
+
[typescript_1.default.SyntaxKind.CallExpression, transformCallExpression_1.transformCallExpression],
|
|
66
|
+
[typescript_1.default.SyntaxKind.ClassExpression, transformClassExpression_1.transformClassExpression],
|
|
67
|
+
[typescript_1.default.SyntaxKind.ConditionalExpression, transformConditionalExpression_1.transformConditionalExpression],
|
|
68
|
+
[typescript_1.default.SyntaxKind.DeleteExpression, transformDeleteExpression_1.transformDeleteExpression],
|
|
69
|
+
[typescript_1.default.SyntaxKind.ElementAccessExpression, transformElementAccessExpression_1.transformElementAccessExpression],
|
|
70
|
+
[typescript_1.default.SyntaxKind.ExpressionWithTypeArguments, transformTypeExpression_1.transformTypeExpression],
|
|
71
|
+
[typescript_1.default.SyntaxKind.FalseKeyword, transformBooleanLiteral_1.transformFalseKeyword],
|
|
72
|
+
[typescript_1.default.SyntaxKind.FunctionExpression, transformFunctionExpression_1.transformFunctionExpression],
|
|
73
|
+
[typescript_1.default.SyntaxKind.Identifier, transformIdentifier_1.transformIdentifier],
|
|
74
|
+
[typescript_1.default.SyntaxKind.JsxElement, transformJsxElement_1.transformJsxElement],
|
|
75
|
+
[typescript_1.default.SyntaxKind.JsxExpression, transformJsxExpression_1.transformJsxExpression],
|
|
76
|
+
[typescript_1.default.SyntaxKind.JsxFragment, transformJsxFragment_1.transformJsxFragment],
|
|
77
|
+
[typescript_1.default.SyntaxKind.JsxSelfClosingElement, transformJsxSelfClosingElement_1.transformJsxSelfClosingElement],
|
|
78
|
+
[typescript_1.default.SyntaxKind.NewExpression, transformNewExpression_1.transformNewExpression],
|
|
79
|
+
[typescript_1.default.SyntaxKind.NonNullExpression, transformTypeExpression_1.transformTypeExpression],
|
|
80
|
+
[typescript_1.default.SyntaxKind.NoSubstitutionTemplateLiteral, transformNoSubstitutionTemplateLiteral_1.transformNoSubstitutionTemplateLiteral],
|
|
81
|
+
[typescript_1.default.SyntaxKind.NumericLiteral, transformNumericLiteral_1.transformNumericLiteral],
|
|
82
|
+
[typescript_1.default.SyntaxKind.ObjectLiteralExpression, transformObjectLiteralExpression_1.transformObjectLiteralExpression],
|
|
83
|
+
[typescript_1.default.SyntaxKind.OmittedExpression, transformOmittedExpression_1.transformOmittedExpression],
|
|
84
|
+
[typescript_1.default.SyntaxKind.ParenthesizedExpression, transformParenthesizedExpression_1.transformParenthesizedExpression],
|
|
85
|
+
[typescript_1.default.SyntaxKind.PostfixUnaryExpression, transformUnaryExpression_1.transformPostfixUnaryExpression],
|
|
86
|
+
[typescript_1.default.SyntaxKind.PrefixUnaryExpression, transformUnaryExpression_1.transformPrefixUnaryExpression],
|
|
87
|
+
[typescript_1.default.SyntaxKind.PropertyAccessExpression, transformPropertyAccessExpression_1.transformPropertyAccessExpression],
|
|
88
|
+
[typescript_1.default.SyntaxKind.SatisfiesExpression, transformTypeExpression_1.transformTypeExpression],
|
|
89
|
+
[typescript_1.default.SyntaxKind.SpreadElement, transformSpreadElement_1.transformSpreadElement],
|
|
90
|
+
[typescript_1.default.SyntaxKind.StringLiteral, transformStringLiteral_1.transformStringLiteral],
|
|
91
|
+
[typescript_1.default.SyntaxKind.SuperKeyword, transformSuperKeyword_1.transformSuperKeyword],
|
|
92
|
+
[typescript_1.default.SyntaxKind.TaggedTemplateExpression, transformTaggedTemplateExpression_1.transformTaggedTemplateExpression],
|
|
93
|
+
[typescript_1.default.SyntaxKind.TemplateExpression, transformTemplateExpression_1.transformTemplateExpression],
|
|
94
|
+
[typescript_1.default.SyntaxKind.ThisKeyword, transformThisExpression_1.transformThisExpression],
|
|
95
|
+
[typescript_1.default.SyntaxKind.TrueKeyword, transformBooleanLiteral_1.transformTrueKeyword],
|
|
96
|
+
[typescript_1.default.SyntaxKind.TypeAssertionExpression, transformTypeExpression_1.transformTypeExpression],
|
|
97
|
+
[typescript_1.default.SyntaxKind.VoidExpression, transformVoidExpression_1.transformVoidExpression],
|
|
98
|
+
[typescript_1.default.SyntaxKind.YieldExpression, transformYieldExpression_1.transformYieldExpression],
|
|
99
|
+
]);
|
|
100
|
+
function transformExpression(state, node) {
|
|
101
|
+
const transformer = TRANSFORMER_BY_KIND.get(node.kind);
|
|
102
|
+
if (transformer) {
|
|
103
|
+
return transformer(state, node);
|
|
104
|
+
}
|
|
105
|
+
(0, assert_1.assert)(false, `Unknown expression: ${(0, getKindName_1.getKindName)(node.kind)}`);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=transformExpression.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 transformFunctionExpression(state: TransformState, node: ts.FunctionExpression | ts.ArrowFunction): luau.CallExpression | luau.FunctionExpression;
|
|
@@ -0,0 +1,46 @@
|
|
|
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.transformFunctionExpression = transformFunctionExpression;
|
|
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 transformReturnStatement_1 = require("../statements/transformReturnStatement");
|
|
11
|
+
const transformParameters_1 = require("../transformParameters");
|
|
12
|
+
const transformStatementList_1 = require("../transformStatementList");
|
|
13
|
+
const wrapStatementsAsGenerator_1 = require("../../util/wrapStatementsAsGenerator");
|
|
14
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
+
function transformFunctionExpression(state, node) {
|
|
16
|
+
if (node.name) {
|
|
17
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noFunctionExpressionName(node.name));
|
|
18
|
+
}
|
|
19
|
+
let { statements, parameters, hasDotDotDot } = (0, transformParameters_1.transformParameters)(state, node);
|
|
20
|
+
const body = node.body;
|
|
21
|
+
if (typescript_1.default.isFunctionBody(body)) {
|
|
22
|
+
luau_ast_1.default.list.pushList(statements, (0, transformStatementList_1.transformStatementList)(state, body, body.statements));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const [returnStatements, prereqs] = state.capture(() => (0, transformReturnStatement_1.transformReturnStatementInner)(state, body));
|
|
26
|
+
luau_ast_1.default.list.pushList(statements, prereqs);
|
|
27
|
+
luau_ast_1.default.list.pushList(statements, returnStatements);
|
|
28
|
+
}
|
|
29
|
+
const isAsync = typescript_1.default.hasSyntacticModifier(node, typescript_1.default.ModifierFlags.Async);
|
|
30
|
+
if (node.asteriskToken) {
|
|
31
|
+
if (isAsync) {
|
|
32
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noAsyncGeneratorFunctions(node));
|
|
33
|
+
}
|
|
34
|
+
statements = (0, wrapStatementsAsGenerator_1.wrapStatementsAsGenerator)(state, node, statements);
|
|
35
|
+
}
|
|
36
|
+
let expression = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionExpression, {
|
|
37
|
+
hasDotDotDot,
|
|
38
|
+
parameters,
|
|
39
|
+
statements,
|
|
40
|
+
});
|
|
41
|
+
if (isAsync) {
|
|
42
|
+
expression = luau_ast_1.default.call(state.TS(node, "async"), [expression]);
|
|
43
|
+
}
|
|
44
|
+
return expression;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=transformFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../..";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformIdentifierDefined(state: TransformState, node: ts.Identifier): luau.Identifier | luau.TemporaryIdentifier;
|
|
5
|
+
export declare function transformIdentifier(state: TransformState, node: ts.Identifier): luau.Expression<luau.SyntaxKind>;
|
|
@@ -0,0 +1,147 @@
|
|
|
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.transformIdentifierDefined = transformIdentifierDefined;
|
|
7
|
+
exports.transformIdentifier = transformIdentifier;
|
|
8
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
9
|
+
const diagnostics_1 = require("../../../Shared/diagnostics");
|
|
10
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
11
|
+
const getOrSetDefault_1 = require("../../../Shared/util/getOrSetDefault");
|
|
12
|
+
const TSTransformer_1 = require("../..");
|
|
13
|
+
const DiagnosticService_1 = require("../../classes/DiagnosticService");
|
|
14
|
+
const typeGuards_1 = require("../../typeGuards");
|
|
15
|
+
const getExtendsNode_1 = require("../../util/getExtendsNode");
|
|
16
|
+
const isSymbolMutable_1 = require("../../util/isSymbolMutable");
|
|
17
|
+
const traversal_1 = require("../../util/traversal");
|
|
18
|
+
const types_1 = require("../../util/types");
|
|
19
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
20
|
+
function transformIdentifierDefined(state, node) {
|
|
21
|
+
const symbol = typescript_1.default.isShorthandPropertyAssignment(node.parent)
|
|
22
|
+
? state.typeChecker.getShorthandAssignmentValueSymbol(node.parent)
|
|
23
|
+
: state.typeChecker.getSymbolAtLocation(node);
|
|
24
|
+
(0, assert_1.assert)(symbol);
|
|
25
|
+
const replacementId = state.symbolToIdMap.get(symbol);
|
|
26
|
+
if (replacementId) {
|
|
27
|
+
return replacementId;
|
|
28
|
+
}
|
|
29
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Identifier, {
|
|
30
|
+
name: node.text,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function getAncestorWhichIsChildOf(parent, node) {
|
|
34
|
+
while (node.parent && node.parent !== parent) {
|
|
35
|
+
node = node.parent;
|
|
36
|
+
}
|
|
37
|
+
return node.parent ? node : undefined;
|
|
38
|
+
}
|
|
39
|
+
function getDeclarationFromImport(symbol) {
|
|
40
|
+
var _a;
|
|
41
|
+
for (const declaration of (_a = symbol.declarations) !== null && _a !== void 0 ? _a : []) {
|
|
42
|
+
const importDec = (0, traversal_1.getAncestor)(declaration, typescript_1.default.isAnyImportSyntax);
|
|
43
|
+
if (importDec) {
|
|
44
|
+
return declaration;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function checkIdentifierHoist(state, node, symbol) {
|
|
49
|
+
var _a;
|
|
50
|
+
if (state.isHoisted.get(symbol) !== undefined) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const declaration = (_a = symbol.valueDeclaration) !== null && _a !== void 0 ? _a : getDeclarationFromImport(symbol);
|
|
54
|
+
if (!declaration || (0, traversal_1.getAncestor)(declaration, typescript_1.default.isParameter) || typescript_1.default.isShorthandPropertyAssignment(declaration)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (typescript_1.default.isClassLike(declaration) && (0, traversal_1.isAncestorOf)(declaration, node)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const declarationStatement = (0, traversal_1.getAncestor)(declaration, typescript_1.default.isStatement);
|
|
61
|
+
if (!declarationStatement ||
|
|
62
|
+
typescript_1.default.isForStatement(declarationStatement) ||
|
|
63
|
+
typescript_1.default.isForOfStatement(declarationStatement) ||
|
|
64
|
+
typescript_1.default.isTryStatement(declarationStatement)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const parent = declarationStatement.parent;
|
|
68
|
+
if (!parent || !(0, typeGuards_1.isBlockLike)(parent)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const sibling = getAncestorWhichIsChildOf(parent, node);
|
|
72
|
+
if (!sibling || !typescript_1.default.isStatement(sibling)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const declarationIdx = parent.statements.indexOf(declarationStatement);
|
|
76
|
+
const siblingIdx = parent.statements.indexOf(sibling);
|
|
77
|
+
if (siblingIdx > declarationIdx) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (siblingIdx === declarationIdx) {
|
|
81
|
+
if ((typescript_1.default.isFunctionDeclaration(declarationStatement) &&
|
|
82
|
+
!typescript_1.default.hasSyntacticModifier(declarationStatement, typescript_1.default.ModifierFlags.Async)) ||
|
|
83
|
+
typescript_1.default.isClassDeclaration(declarationStatement) ||
|
|
84
|
+
(typescript_1.default.isVariableStatement(declarationStatement) &&
|
|
85
|
+
(0, traversal_1.getAncestor)(node, node => typescript_1.default.isStatement(node) || typescript_1.default.isFunctionLikeDeclaration(node)) ===
|
|
86
|
+
declarationStatement)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
(0, getOrSetDefault_1.getOrSetDefault)(state.hoistsByStatement, sibling, () => new Array()).push(node);
|
|
91
|
+
state.isHoisted.set(symbol, true);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
function transformIdentifier(state, node) {
|
|
95
|
+
var _a;
|
|
96
|
+
if (!node.parent || typescript_1.default.positionIsSynthesized(node.pos)) {
|
|
97
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Identifier, { name: node.text });
|
|
98
|
+
}
|
|
99
|
+
const symbol = typescript_1.default.isShorthandPropertyAssignment(node.parent)
|
|
100
|
+
? state.typeChecker.getShorthandAssignmentValueSymbol(node.parent)
|
|
101
|
+
: state.typeChecker.getSymbolAtLocation(node);
|
|
102
|
+
(0, assert_1.assert)(symbol);
|
|
103
|
+
if (state.typeChecker.isUndefinedSymbol(symbol)) {
|
|
104
|
+
return luau_ast_1.default.nil();
|
|
105
|
+
}
|
|
106
|
+
else if (state.typeChecker.isArgumentsSymbol(symbol)) {
|
|
107
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noArguments(node));
|
|
108
|
+
}
|
|
109
|
+
else if (symbol === state.services.macroManager.getSymbolOrThrow(TSTransformer_1.SYMBOL_NAMES.globalThis)) {
|
|
110
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noGlobalThis(node));
|
|
111
|
+
}
|
|
112
|
+
const macro = state.services.macroManager.getIdentifierMacro(symbol);
|
|
113
|
+
if (macro) {
|
|
114
|
+
return macro(state, node);
|
|
115
|
+
}
|
|
116
|
+
const constructSymbol = (0, types_1.getFirstConstructSymbol)(state, node);
|
|
117
|
+
if (constructSymbol) {
|
|
118
|
+
const constructorMacro = state.services.macroManager.getConstructorMacro(constructSymbol);
|
|
119
|
+
if (constructorMacro) {
|
|
120
|
+
const isClassExtendsNode = typescript_1.default.isClassLike(node.parent.parent.parent) &&
|
|
121
|
+
((_a = (0, getExtendsNode_1.getExtendsNode)(node.parent.parent.parent)) === null || _a === void 0 ? void 0 : _a.expression) === node;
|
|
122
|
+
if (isClassExtendsNode) {
|
|
123
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noMacroExtends(node));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noConstructorMacroWithoutNew(node));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const parent = (0, traversal_1.skipUpwards)(node).parent;
|
|
131
|
+
if ((!typescript_1.default.isCallExpression(parent) || (0, traversal_1.skipDownwards)(parent.expression) != node) &&
|
|
132
|
+
state.services.macroManager.getCallMacro(symbol)) {
|
|
133
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noIndexWithoutCall(node));
|
|
134
|
+
return luau_ast_1.default.none();
|
|
135
|
+
}
|
|
136
|
+
if (symbol.valueDeclaration &&
|
|
137
|
+
symbol.valueDeclaration.getSourceFile() === node.getSourceFile() &&
|
|
138
|
+
(0, traversal_1.getAncestor)(symbol.valueDeclaration, node => typescript_1.default.isModuleDeclaration(node) && !(0, typeGuards_1.isNamespace)(node)) === undefined) {
|
|
139
|
+
const exportAccess = state.getModuleIdPropertyAccess(symbol);
|
|
140
|
+
if (exportAccess && (0, isSymbolMutable_1.isSymbolMutable)(state, symbol)) {
|
|
141
|
+
return exportAccess;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
checkIdentifierHoist(state, node, symbol);
|
|
145
|
+
return transformIdentifierDefined(state, node);
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=transformIdentifier.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.transformImportExpression = transformImportExpression;
|
|
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 createImportExpression_1 = require("../../util/createImportExpression");
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
function transformImportExpression(state, node) {
|
|
13
|
+
const moduleSpecifier = node.arguments[0];
|
|
14
|
+
if (!moduleSpecifier || !typescript_1.default.isStringLiteral(moduleSpecifier)) {
|
|
15
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noNonStringModuleSpecifier(node));
|
|
16
|
+
return luau_ast_1.default.none();
|
|
17
|
+
}
|
|
18
|
+
const importExpression = (0, createImportExpression_1.createImportExpression)(state, node.getSourceFile(), moduleSpecifier);
|
|
19
|
+
const resolveId = luau_ast_1.default.id("resolve");
|
|
20
|
+
return luau_ast_1.default.call(luau_ast_1.default.property(state.TS(node, "Promise"), "new"), [
|
|
21
|
+
luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.FunctionExpression, {
|
|
22
|
+
hasDotDotDot: false,
|
|
23
|
+
parameters: luau_ast_1.default.list.make(resolveId),
|
|
24
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.CallStatement, {
|
|
25
|
+
expression: luau_ast_1.default.call(resolveId, [importExpression]),
|
|
26
|
+
})),
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=transformImportExpression.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformJsxElement = transformJsxElement;
|
|
4
|
+
const transformJsx_1 = require("../jsx/transformJsx");
|
|
5
|
+
function transformJsxElement(state, node) {
|
|
6
|
+
return (0, transformJsx_1.transformJsx)(state, node, node.openingElement.tagName, node.openingElement.attributes, node.children);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=transformJsxElement.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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.transformJsxExpression = transformJsxExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./transformExpression");
|
|
9
|
+
function transformJsxExpression(state, node) {
|
|
10
|
+
if (node.expression) {
|
|
11
|
+
const expression = (0, transformExpression_1.transformExpression)(state, node.expression);
|
|
12
|
+
if (node.dotDotDotToken) {
|
|
13
|
+
return luau_ast_1.default.call(luau_ast_1.default.globals.unpack, [expression]);
|
|
14
|
+
}
|
|
15
|
+
return expression;
|
|
16
|
+
}
|
|
17
|
+
return luau_ast_1.default.none();
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=transformJsxExpression.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
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.transformJsxFragment = transformJsxFragment;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const assert_1 = require("../../../Shared/util/assert");
|
|
9
|
+
const transformJsxChildren_1 = require("../jsx/transformJsxChildren");
|
|
10
|
+
const transformEntityName_1 = require("../transformEntityName");
|
|
11
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
12
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
13
|
+
function transformJsxFragment(state, node) {
|
|
14
|
+
var _a;
|
|
15
|
+
const jsxFactoryEntity = state.resolver.getJsxFactoryEntity(node);
|
|
16
|
+
(0, assert_1.assert)(jsxFactoryEntity, "Expected jsxFactoryEntity to be defined");
|
|
17
|
+
const createElementExpression = (0, convertToIndexableExpression_1.convertToIndexableExpression)((0, transformEntityName_1.transformEntityName)(state, jsxFactoryEntity));
|
|
18
|
+
const jsxFragmentFactoryEntity = (_a = state.resolver.getJsxFragmentFactoryEntity(node)) !== null && _a !== void 0 ? _a : typescript_1.default.parseIsolatedEntityName("Fragment", typescript_1.default.ScriptTarget.ESNext);
|
|
19
|
+
(0, assert_1.assert)(jsxFragmentFactoryEntity, "Unable to find valid jsxFragmentFactoryEntity");
|
|
20
|
+
const args = [(0, transformEntityName_1.transformEntityName)(state, jsxFragmentFactoryEntity)];
|
|
21
|
+
const transformedChildren = (0, transformJsxChildren_1.transformJsxChildren)(state, node.children);
|
|
22
|
+
if (transformedChildren.length > 0) {
|
|
23
|
+
args.push(luau_ast_1.default.nil());
|
|
24
|
+
}
|
|
25
|
+
args.push(...transformedChildren);
|
|
26
|
+
return luau_ast_1.default.call(createElementExpression, args);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=transformJsxFragment.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformJsxSelfClosingElement = transformJsxSelfClosingElement;
|
|
4
|
+
const transformJsx_1 = require("../jsx/transformJsx");
|
|
5
|
+
function transformJsxSelfClosingElement(state, node) {
|
|
6
|
+
return (0, transformJsx_1.transformJsx)(state, node, node.tagName, node.attributes, []);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=transformJsxSelfClosingElement.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
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.transformNewExpression = transformNewExpression;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformExpression_1 = require("./transformExpression");
|
|
9
|
+
const convertToIndexableExpression_1 = require("../../util/convertToIndexableExpression");
|
|
10
|
+
const ensureTransformOrder_1 = require("../../util/ensureTransformOrder");
|
|
11
|
+
const types_1 = require("../../util/types");
|
|
12
|
+
const validateNotAny_1 = require("../../util/validateNotAny");
|
|
13
|
+
function transformNewExpression(state, node) {
|
|
14
|
+
(0, validateNotAny_1.validateNotAnyType)(state, node.expression);
|
|
15
|
+
const symbol = (0, types_1.getFirstConstructSymbol)(state, node.expression);
|
|
16
|
+
if (symbol) {
|
|
17
|
+
const macro = state.services.macroManager.getConstructorMacro(symbol);
|
|
18
|
+
if (macro) {
|
|
19
|
+
return macro(state, node);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const expression = (0, convertToIndexableExpression_1.convertToIndexableExpression)((0, transformExpression_1.transformExpression)(state, node.expression));
|
|
23
|
+
const args = node.arguments ? (0, ensureTransformOrder_1.ensureTransformOrder)(state, node.arguments) : [];
|
|
24
|
+
return luau_ast_1.default.call(luau_ast_1.default.property(expression, "new"), args);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=transformNewExpression.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import luau from "@roblox-ts/luau-ast";
|
|
2
|
+
import { TransformState } from "../../classes/TransformState";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export declare function transformNoSubstitutionTemplateLiteral(state: TransformState, node: ts.NoSubstitutionTemplateLiteral): luau.InterpolatedString;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformNoSubstitutionTemplateLiteral = transformNoSubstitutionTemplateLiteral;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const transformInterpolatedStringPart_1 = require("../transformInterpolatedStringPart");
|
|
9
|
+
function transformNoSubstitutionTemplateLiteral(state, node) {
|
|
10
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.InterpolatedString, {
|
|
11
|
+
parts: luau_ast_1.default.list.make((0, transformInterpolatedStringPart_1.transformInterpolatedStringPart)(node)),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=transformNoSubstitutionTemplateLiteral.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.transformNumericLiteral = transformNumericLiteral;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
function transformNumericLiteral(state, node) {
|
|
9
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.NumberLiteral, {
|
|
10
|
+
value: node.getText(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=transformNumericLiteral.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
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.transformObjectLiteralExpression = transformObjectLiteralExpression;
|
|
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("./transformExpression");
|
|
11
|
+
const transformMethodDeclaration_1 = require("../transformMethodDeclaration");
|
|
12
|
+
const transformPropertyName_1 = require("../transformPropertyName");
|
|
13
|
+
const createTruthinessChecks_1 = require("../../util/createTruthinessChecks");
|
|
14
|
+
const pointer_1 = require("../../util/pointer");
|
|
15
|
+
const types_1 = require("../../util/types");
|
|
16
|
+
const validateMethodAssignment_1 = require("../../util/validateMethodAssignment");
|
|
17
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
18
|
+
function transformPropertyAssignment(state, ptr, name, initializer) {
|
|
19
|
+
let [left, leftPrereqs] = state.capture(() => (0, transformPropertyName_1.transformPropertyName)(state, name));
|
|
20
|
+
const [right, rightPrereqs] = state.capture(() => (0, transformExpression_1.transformExpression)(state, initializer));
|
|
21
|
+
if (!luau_ast_1.default.list.isEmpty(leftPrereqs) || !luau_ast_1.default.list.isEmpty(rightPrereqs)) {
|
|
22
|
+
(0, pointer_1.disableMapInline)(state, ptr);
|
|
23
|
+
state.prereqList(leftPrereqs);
|
|
24
|
+
left = state.pushToVar(left, "left");
|
|
25
|
+
}
|
|
26
|
+
state.prereqList(rightPrereqs);
|
|
27
|
+
(0, pointer_1.assignToMapPointer)(state, ptr, left, right);
|
|
28
|
+
}
|
|
29
|
+
function transformSpreadAssignment(state, ptr, property) {
|
|
30
|
+
const expType = state.typeChecker.getNonOptionalType(state.getType(property.expression));
|
|
31
|
+
const symbol = (0, types_1.getFirstDefinedSymbol)(state, expType);
|
|
32
|
+
if (symbol && state.services.macroManager.isMacroOnlyClass(symbol)) {
|
|
33
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noMacroObjectSpread(property));
|
|
34
|
+
}
|
|
35
|
+
const type = state.getType(property.expression);
|
|
36
|
+
const definitelyObject = (0, types_1.isDefinitelyType)(type, types_1.isObjectType);
|
|
37
|
+
if (definitelyObject && luau_ast_1.default.isMap(ptr.value) && luau_ast_1.default.list.isEmpty(ptr.value.fields)) {
|
|
38
|
+
ptr.value = state.pushToVar(luau_ast_1.default.call(luau_ast_1.default.globals.table.clone, [(0, transformExpression_1.transformExpression)(state, property.expression)]), ptr.name);
|
|
39
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.CallStatement, {
|
|
40
|
+
expression: luau_ast_1.default.call(luau_ast_1.default.globals.setmetatable, [ptr.value, luau_ast_1.default.nil()]),
|
|
41
|
+
}));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
(0, pointer_1.disableMapInline)(state, ptr);
|
|
45
|
+
let spreadExp = (0, transformExpression_1.transformExpression)(state, property.expression);
|
|
46
|
+
if (!definitelyObject) {
|
|
47
|
+
spreadExp = state.pushToVarIfComplex(spreadExp, "spread");
|
|
48
|
+
}
|
|
49
|
+
const keyId = luau_ast_1.default.tempId("k");
|
|
50
|
+
const valueId = luau_ast_1.default.tempId("v");
|
|
51
|
+
let statement = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ForStatement, {
|
|
52
|
+
ids: luau_ast_1.default.list.make(keyId, valueId),
|
|
53
|
+
expression: spreadExp,
|
|
54
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
55
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
56
|
+
expression: ptr.value,
|
|
57
|
+
index: keyId,
|
|
58
|
+
}),
|
|
59
|
+
operator: "=",
|
|
60
|
+
right: valueId,
|
|
61
|
+
})),
|
|
62
|
+
});
|
|
63
|
+
if (!definitelyObject) {
|
|
64
|
+
statement = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.IfStatement, {
|
|
65
|
+
condition: (0, createTruthinessChecks_1.createTruthinessChecks)(state, spreadExp, property.expression),
|
|
66
|
+
statements: luau_ast_1.default.list.make(statement),
|
|
67
|
+
elseBody: luau_ast_1.default.list.make(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
state.prereq(statement);
|
|
71
|
+
}
|
|
72
|
+
function transformObjectLiteralExpression(state, node) {
|
|
73
|
+
const ptr = (0, pointer_1.createMapPointer)("object");
|
|
74
|
+
for (const property of node.properties) {
|
|
75
|
+
(0, validateMethodAssignment_1.validateMethodAssignment)(state, property);
|
|
76
|
+
if (typescript_1.default.isPropertyAssignment(property)) {
|
|
77
|
+
if (typescript_1.default.isPrivateIdentifier(property.name)) {
|
|
78
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noPrivateIdentifier(property.name));
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
transformPropertyAssignment(state, ptr, property.name, property.initializer);
|
|
82
|
+
}
|
|
83
|
+
else if (typescript_1.default.isShorthandPropertyAssignment(property)) {
|
|
84
|
+
transformPropertyAssignment(state, ptr, property.name, property.name);
|
|
85
|
+
}
|
|
86
|
+
else if (typescript_1.default.isSpreadAssignment(property)) {
|
|
87
|
+
transformSpreadAssignment(state, ptr, property);
|
|
88
|
+
}
|
|
89
|
+
else if (typescript_1.default.isMethodDeclaration(property)) {
|
|
90
|
+
state.prereqList((0, transformMethodDeclaration_1.transformMethodDeclaration)(state, property, ptr));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noGetterSetter(property));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return ptr.value;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=transformObjectLiteralExpression.js.map
|