File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
src/transformation/visitors Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 captureThisValue ,
2424} from "./optional-chaining" ;
2525import { SyntaxKind } from "typescript" ;
26+ import { getCustomNameFromSymbol } from "./identifier" ;
2627
2728function addOneToArrayAccessArgument (
2829 context : TransformationContext ,
@@ -108,10 +109,16 @@ export function transformPropertyAccessExpressionWithCapture(
108109 node : ts . PropertyAccessExpression ,
109110 thisValueCapture : lua . Identifier | undefined
110111) : ExpressionWithThisValue {
111- const property = node . name . text ;
112112 const type = context . checker . getTypeAtLocation ( node . expression ) ;
113113 const isOptionalLeft = isOptionalContinuation ( node . expression ) ;
114114
115+ let property = node . name . text ;
116+ const symbol = context . checker . getSymbolAtLocation ( node . name ) ;
117+ const customName = getCustomNameFromSymbol ( symbol ) ;
118+ if ( customName ) {
119+ property = customName ;
120+ }
121+
115122 const constEnumValue = tryGetConstEnumValue ( context , node ) ;
116123 if ( constEnumValue ) {
117124 return { expression : constEnumValue } ;
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ escapedCharsInTemplateString = "\\\\ \\0 \\b \\t \\n \\v \\f \\" ' \`"
2424nonEmptyTemplateString = ("Level 0: \\ n\\ t " .. ("Level 1: \\ n\\ t\\ t " .. ("Level 3: \\ n\\ t\\ t\\ t " .. "Last level \\ n --") .. " \\ n --") .. " \\ n --") .. " \\ n --""
2525` ;
2626
27+ exports [` Transformation (customNameWithNoSelf) 1` ] = ` "TestNamespace.pass()"` ;
28+
2729exports [` Transformation (exportStatement) 1` ] = `
2830"local ____exports = { }
2931local xyz = 4
Original file line number Diff line number Diff line change 1+ /** @noSelf */
2+ declare namespace TestNamespace {
3+ /** @customName pass */
4+ function fail ( ) : void ;
5+ }
6+
7+ TestNamespace . fail ( ) ;
You can’t perform that action at this time.
0 commit comments