brighterscript 0.66.0-alpha.6 → 0.66.0-alpha.7
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 +52 -10
- package/README.md +16 -0
- package/bsconfig.schema.json +15 -0
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/BsConfig.d.ts +15 -1
- package/dist/CommentFlagProcessor.d.ts +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +2 -0
- package/dist/DiagnosticMessages.js +25 -13
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.js.map +1 -1
- package/dist/PluginInterface.d.ts +11 -2
- package/dist/PluginInterface.js +69 -10
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +84 -37
- package/dist/Program.js +390 -267
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +10 -4
- package/dist/ProgramBuilder.js +44 -54
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +13 -13
- package/dist/Scope.js +28 -26
- package/dist/Scope.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -4
- package/dist/XmlScope.js +11 -10
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +6 -1
- package/dist/astUtils/{AstEditor.js → Editor.js} +9 -3
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +10 -6
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/reflection.d.ts +9 -4
- package/dist/astUtils/reflection.js +23 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +2 -2
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +3 -3
- package/dist/astUtils/visitors.spec.js +7 -7
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +10 -2
- package/dist/bscPlugin/BscPlugin.js +24 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +8 -8
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +5 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +38 -15
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +65 -3
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +1 -7
- package/dist/bscPlugin/hover/HoverProcessor.js +1 -7
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +43 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +22 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +25 -4
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +2 -2
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.js +24 -15
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +326 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +2 -2
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -0
- package/dist/diagnosticUtils.js +4 -3
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +1 -1
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +26 -0
- package/dist/files/AssetFile.js +26 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +40 -40
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +42 -15
- package/dist/files/BrsFile.js +120 -78
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +266 -167
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/File.d.ts +106 -0
- package/dist/files/File.js +16 -0
- package/dist/files/File.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +55 -17
- package/dist/files/XmlFile.js +88 -47
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +64 -57
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +21 -8
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.js +14 -14
- package/dist/files/tests/optionalChaning.spec.js.map +1 -1
- package/dist/globalCallables.js +1 -1
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +312 -84
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.js +1 -1
- package/dist/lexer/TokenKind.js +0 -1
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +2 -2
- package/dist/parser/AstNode.js +1 -1
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +3 -2
- package/dist/parser/BrsTranspileState.js +3 -2
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +1 -1
- package/dist/parser/Expression.js +3 -9
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.js +3 -0
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +15 -1
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +2 -2
- package/dist/parser/SGParser.js +3 -3
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +2 -2
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +1 -1
- package/dist/parser/Statement.d.ts +3 -2
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +10 -10
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +64 -36
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +34 -34
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.js +16 -16
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Continue.spec.js +2 -2
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +26 -26
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/For.spec.js +6 -6
- package/dist/parser/tests/statement/For.spec.js.map +1 -1
- package/dist/parser/tests/statement/ForEach.spec.js +4 -4
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +12 -12
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +10 -10
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +1 -1
- package/dist/preprocessor/Manifest.js +2 -2
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/data.json +81 -143
- package/dist/roku-types/index.d.ts +15 -11
- package/dist/types/ArrayType.d.ts +1 -1
- package/dist/types/ArrayType.js +4 -0
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +1 -1
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +1 -1
- package/dist/types/AssociativeArrayType.js +1 -1
- package/dist/types/AssociativeArrayType.js.map +1 -1
- package/dist/types/BooleanType.js +2 -1
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.js +2 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +3 -0
- package/dist/types/BuiltInInterfaceAdder.js +32 -13
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
- package/dist/types/ComponentType.js +3 -0
- package/dist/types/ComponentType.js.map +1 -1
- package/dist/types/DoubleType.js +3 -1
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/FloatType.js +3 -1
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/IntegerType.js +3 -1
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +1 -1
- package/dist/types/InterfaceType.js +1 -8
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +23 -0
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.js +3 -1
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/ObjectType.d.ts +1 -1
- package/dist/types/StringType.js +2 -2
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +6 -1
- package/dist/types/TypedFunctionType.js +45 -15
- package/dist/types/TypedFunctionType.js.map +1 -1
- package/dist/types/TypedFunctionType.spec.js +99 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -1
- package/dist/types/UnionType.js +7 -0
- package/dist/types/UnionType.js.map +1 -1
- package/dist/types/helper.spec.js +15 -0
- package/dist/types/helper.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +3 -0
- package/dist/types/helpers.js +29 -1
- package/dist/types/helpers.js.map +1 -1
- package/dist/util.d.ts +11 -5
- package/dist/util.js +79 -40
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +1 -1
- package/dist/astUtils/AstEditor.js.map +0 -1
- package/dist/astUtils/AstEditor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -31
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
- /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → serialize/BslibInjector.spec.d.ts} +0 -0
|
@@ -15,8 +15,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
15
15
|
program.dispose();
|
|
16
16
|
});
|
|
17
17
|
describe('transpile', () => {
|
|
18
|
-
it('allows bs source literals local vars in brs mode', () => {
|
|
19
|
-
testTranspile(`
|
|
18
|
+
it('allows bs source literals local vars in brs mode', async () => {
|
|
19
|
+
await testTranspile(`
|
|
20
20
|
sub main()
|
|
21
21
|
source_file_path = true
|
|
22
22
|
source_line_num = true
|
|
@@ -37,8 +37,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
37
37
|
end sub
|
|
38
38
|
`, undefined, undefined, 'source/main.brs');
|
|
39
39
|
});
|
|
40
|
-
it('computes SOURCE_FILE_PATH', () => {
|
|
41
|
-
testTranspile(`
|
|
40
|
+
it('computes SOURCE_FILE_PATH', async () => {
|
|
41
|
+
await testTranspile(`
|
|
42
42
|
sub main()
|
|
43
43
|
print SOURCE_FILE_PATH
|
|
44
44
|
end sub
|
|
@@ -48,8 +48,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
48
48
|
end sub
|
|
49
49
|
`, undefined, 'source/main.bs');
|
|
50
50
|
});
|
|
51
|
-
it('computes SOURCE_LINE_NUM', () => {
|
|
52
|
-
testTranspile(`
|
|
51
|
+
it('computes SOURCE_LINE_NUM', async () => {
|
|
52
|
+
await testTranspile(`
|
|
53
53
|
sub main()
|
|
54
54
|
print SOURCE_LINE_NUM
|
|
55
55
|
print "hello world"
|
|
@@ -63,8 +63,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
63
63
|
end sub
|
|
64
64
|
`);
|
|
65
65
|
});
|
|
66
|
-
it('computes FUNCTION_NAME', () => {
|
|
67
|
-
testTranspile(`
|
|
66
|
+
it('computes FUNCTION_NAME', async () => {
|
|
67
|
+
await testTranspile(`
|
|
68
68
|
sub main1()
|
|
69
69
|
print FUNCTION_NAME
|
|
70
70
|
end sub
|
|
@@ -82,8 +82,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
82
82
|
end sub
|
|
83
83
|
`);
|
|
84
84
|
});
|
|
85
|
-
it('computes SOURCE_FUNCTION_NAME', () => {
|
|
86
|
-
testTranspile(`
|
|
85
|
+
it('computes SOURCE_FUNCTION_NAME', async () => {
|
|
86
|
+
await testTranspile(`
|
|
87
87
|
sub main1()
|
|
88
88
|
print SOURCE_FUNCTION_NAME
|
|
89
89
|
end sub
|
|
@@ -101,8 +101,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
101
101
|
end sub
|
|
102
102
|
`);
|
|
103
103
|
});
|
|
104
|
-
it('SOURCE_FUNCTION_NAME computes nested anon', () => {
|
|
105
|
-
testTranspile(`
|
|
104
|
+
it('SOURCE_FUNCTION_NAME computes nested anon', async () => {
|
|
105
|
+
await testTranspile(`
|
|
106
106
|
namespace NameA
|
|
107
107
|
sub main()
|
|
108
108
|
speak = sub()
|
|
@@ -124,8 +124,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
124
124
|
end sub
|
|
125
125
|
`);
|
|
126
126
|
});
|
|
127
|
-
it('computes SOURCE_LOCATION', () => {
|
|
128
|
-
testTranspile(`
|
|
127
|
+
it('computes SOURCE_LOCATION', async () => {
|
|
128
|
+
await testTranspile(`
|
|
129
129
|
sub main()
|
|
130
130
|
print SOURCE_LOCATION
|
|
131
131
|
end sub
|
|
@@ -135,8 +135,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
135
135
|
end sub
|
|
136
136
|
`, undefined, 'source/main.bs');
|
|
137
137
|
});
|
|
138
|
-
it('computes PKG_PATH', () => {
|
|
139
|
-
testTranspile(`
|
|
138
|
+
it('computes PKG_PATH', async () => {
|
|
139
|
+
await testTranspile(`
|
|
140
140
|
sub main()
|
|
141
141
|
print PKG_PATH
|
|
142
142
|
end sub
|
|
@@ -146,8 +146,8 @@ describe('SourceLiteralExpression', () => {
|
|
|
146
146
|
end sub
|
|
147
147
|
`, undefined, 'source/main.bs');
|
|
148
148
|
});
|
|
149
|
-
it('computes PKG_LOCATION', () => {
|
|
150
|
-
testTranspile(`
|
|
149
|
+
it('computes PKG_LOCATION', async () => {
|
|
150
|
+
await testTranspile(`
|
|
151
151
|
sub main()
|
|
152
152
|
print PKG_LOCATION
|
|
153
153
|
end sub
|
|
@@ -157,20 +157,20 @@ describe('SourceLiteralExpression', () => {
|
|
|
157
157
|
end sub
|
|
158
158
|
`, undefined, 'source/main.bs');
|
|
159
159
|
});
|
|
160
|
-
it('retains LINE_NUM', () => {
|
|
161
|
-
testTranspile(`
|
|
160
|
+
it('retains LINE_NUM', async () => {
|
|
161
|
+
await testTranspile(`
|
|
162
162
|
sub main()
|
|
163
163
|
print LINE_NUM
|
|
164
164
|
end sub
|
|
165
165
|
`);
|
|
166
166
|
});
|
|
167
|
-
it('accounts for sourceRoot in SOURCE_FILE_PATH', () => {
|
|
167
|
+
it('accounts for sourceRoot in SOURCE_FILE_PATH', async () => {
|
|
168
168
|
let sourceRoot = (0, util_1.standardizePath) `${process.cwd()} / sourceRoot`;
|
|
169
169
|
program = new Program_1.Program({
|
|
170
170
|
rootDir: rootDir,
|
|
171
171
|
sourceRoot: sourceRoot
|
|
172
172
|
});
|
|
173
|
-
testTranspile(`
|
|
173
|
+
await testTranspile(`
|
|
174
174
|
sub main()
|
|
175
175
|
print SOURCE_FILE_PATH
|
|
176
176
|
end sub
|
|
@@ -180,13 +180,13 @@ describe('SourceLiteralExpression', () => {
|
|
|
180
180
|
end sub
|
|
181
181
|
`, undefined, 'source/main.bs');
|
|
182
182
|
});
|
|
183
|
-
it('accounts for sourceRoot in SOURCE_LOCATION', () => {
|
|
183
|
+
it('accounts for sourceRoot in SOURCE_LOCATION', async () => {
|
|
184
184
|
let sourceRoot = (0, util_1.standardizePath) `${process.cwd()} / sourceRoot`;
|
|
185
185
|
program = new Program_1.Program({
|
|
186
186
|
rootDir: rootDir,
|
|
187
187
|
sourceRoot: sourceRoot
|
|
188
188
|
});
|
|
189
|
-
testTranspile(`
|
|
189
|
+
await testTranspile(`
|
|
190
190
|
sub main()
|
|
191
191
|
print SOURCE_LOCATION
|
|
192
192
|
end sub
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceLiteralExpression.spec.js","sourceRoot":"","sources":["../../../../src/parser/tests/expression/SourceLiteralExpression.spec.ts"],"names":[],"mappings":";;AAAA,8CAA2C;AAC3C,wCAAqD;AACrD,oCAAoC;AACpC,gEAA6D;AAE7D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACrC,IAAI,OAAO,GAAG,IAAA,sBAAC,EAAA,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;IAC1C,IAAI,OAAgB,CAAC;IACrB,IAAI,aAAa,GAAG,IAAA,mCAAgB,EAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/D,UAAU,CAAC,GAAG,EAAE;QACZ,OAAO,GAAG,IAAI,iBAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QAEvB,EAAE,CAAC,kDAAkD,EAAE,
|
|
1
|
+
{"version":3,"file":"SourceLiteralExpression.spec.js","sourceRoot":"","sources":["../../../../src/parser/tests/expression/SourceLiteralExpression.spec.ts"],"names":[],"mappings":";;AAAA,8CAA2C;AAC3C,wCAAqD;AACrD,oCAAoC;AACpC,gEAA6D;AAE7D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACrC,IAAI,OAAO,GAAG,IAAA,sBAAC,EAAA,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;IAC1C,IAAI,OAAgB,CAAC;IACrB,IAAI,aAAa,GAAG,IAAA,mCAAgB,EAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/D,UAAU,CAAC,GAAG,EAAE;QACZ,OAAO,GAAG,IAAI,iBAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QAEvB,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;YAC9D,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;aAmBnB,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAA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EAAE;;6BAEc,OAAO,CAAC,IAAA,sBAAC,EAAA,GAAG,UAAU,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,OAAO,CAAC,IAAA,sBAAC,EAAA,GAAG,UAAU,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;;aAErI,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-for-in-array */
|
|
3
|
-
/* eslint no-template-curly-in-string: 0 */
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-template-curly-in-string */
|
|
5
4
|
const chai_config_spec_1 = require("../../../chai-config.spec");
|
|
6
5
|
const DiagnosticMessages_1 = require("../../../DiagnosticMessages");
|
|
7
6
|
const Lexer_1 = require("../../../lexer/Lexer");
|
|
@@ -9,6 +8,7 @@ const Parser_1 = require("../../Parser");
|
|
|
9
8
|
const Statement_1 = require("../../Statement");
|
|
10
9
|
const Program_1 = require("../../../Program");
|
|
11
10
|
const testHelpers_spec_1 = require("../../../testHelpers.spec");
|
|
11
|
+
const util_1 = require("../../../util");
|
|
12
12
|
describe('TemplateStringExpression', () => {
|
|
13
13
|
describe('parser template String', () => {
|
|
14
14
|
it('throws exception when used in brightscript scope', () => {
|
|
@@ -18,6 +18,34 @@ describe('TemplateStringExpression', () => {
|
|
|
18
18
|
(0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.code).to.equal(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('').code);
|
|
19
19
|
});
|
|
20
20
|
describe('in assignment', () => {
|
|
21
|
+
it('generates correct locations for quasis', () => {
|
|
22
|
+
let { tokens } = Lexer_1.Lexer.scan('print `0xAAAAAA${"0xBBBBBB"}0xCCCCCC`');
|
|
23
|
+
(0, chai_config_spec_1.expect)(tokens.filter(x => /"?0x/.test(x.text)).map(x => x.range)).to.eql([
|
|
24
|
+
util_1.util.createRange(0, 7, 0, 15),
|
|
25
|
+
util_1.util.createRange(0, 17, 0, 27),
|
|
26
|
+
util_1.util.createRange(0, 28, 0, 36) // 0xCCCCCC
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
it('generates correct locations for items', () => {
|
|
30
|
+
let { tokens } = Lexer_1.Lexer.scan('print `${111}${222}${333}`');
|
|
31
|
+
//throw out the `print` token
|
|
32
|
+
tokens.shift();
|
|
33
|
+
(0, chai_config_spec_1.expect)(
|
|
34
|
+
//compute the length of the token char spread
|
|
35
|
+
tokens.filter(x => x.text !== '').map(x => [x.range.end.character - x.range.start.character, x.text])).to.eql([
|
|
36
|
+
'`',
|
|
37
|
+
'${',
|
|
38
|
+
'111',
|
|
39
|
+
'}',
|
|
40
|
+
'${',
|
|
41
|
+
'222',
|
|
42
|
+
'}',
|
|
43
|
+
'${',
|
|
44
|
+
'333',
|
|
45
|
+
'}',
|
|
46
|
+
'`'
|
|
47
|
+
].map(x => [x.length, x]));
|
|
48
|
+
});
|
|
21
49
|
it(`simple case`, () => {
|
|
22
50
|
let { tokens } = Lexer_1.Lexer.scan(`a = \`hello world\``);
|
|
23
51
|
let { statements, diagnostics } = Parser_1.Parser.parse(tokens, { mode: Parser_1.ParseMode.BrighterScript });
|
|
@@ -66,9 +94,9 @@ describe('TemplateStringExpression', () => {
|
|
|
66
94
|
afterEach(() => {
|
|
67
95
|
program.dispose();
|
|
68
96
|
});
|
|
69
|
-
it('uses the proper prefix when aliased package is installed', () => {
|
|
97
|
+
it('uses the proper prefix when aliased package is installed', async () => {
|
|
70
98
|
program.setFile('source/roku_modules/rokucommunity_bslib/bslib.brs', '');
|
|
71
|
-
testTranspile(`
|
|
99
|
+
await testTranspile(`
|
|
72
100
|
sub main()
|
|
73
101
|
a = \`\${LINE_NUM},\${LINE_NUM}\`
|
|
74
102
|
end sub
|
|
@@ -78,8 +106,8 @@ describe('TemplateStringExpression', () => {
|
|
|
78
106
|
end sub
|
|
79
107
|
`);
|
|
80
108
|
});
|
|
81
|
-
it('properly transpiles simple template string with no leading text', () => {
|
|
82
|
-
testTranspile(`
|
|
109
|
+
it('properly transpiles simple template string with no leading text', async () => {
|
|
110
|
+
await testTranspile(`
|
|
83
111
|
sub main()
|
|
84
112
|
a = \`\${LINE_NUM},\${LINE_NUM}\`
|
|
85
113
|
end sub
|
|
@@ -89,8 +117,8 @@ describe('TemplateStringExpression', () => {
|
|
|
89
117
|
end sub
|
|
90
118
|
`);
|
|
91
119
|
});
|
|
92
|
-
it('properly transpiles simple template string', () => {
|
|
93
|
-
testTranspile(`
|
|
120
|
+
it('properly transpiles simple template string', async () => {
|
|
121
|
+
await testTranspile(`
|
|
94
122
|
sub main()
|
|
95
123
|
a = \`hello world\`
|
|
96
124
|
end sub
|
|
@@ -100,8 +128,8 @@ describe('TemplateStringExpression', () => {
|
|
|
100
128
|
end sub
|
|
101
129
|
`);
|
|
102
130
|
});
|
|
103
|
-
it('properly transpiles one line template string with expressions', () => {
|
|
104
|
-
testTranspile(`
|
|
131
|
+
it('properly transpiles one line template string with expressions', async () => {
|
|
132
|
+
await testTranspile(`
|
|
105
133
|
sub main()
|
|
106
134
|
a = \`hello \${LINE_NUM.text} world \${"template" + "".getChars()} test\`
|
|
107
135
|
end sub
|
|
@@ -111,8 +139,8 @@ describe('TemplateStringExpression', () => {
|
|
|
111
139
|
end sub
|
|
112
140
|
`);
|
|
113
141
|
});
|
|
114
|
-
it('handles escaped characters', () => {
|
|
115
|
-
testTranspile(`
|
|
142
|
+
it('handles escaped characters', async () => {
|
|
143
|
+
await testTranspile(`
|
|
116
144
|
sub main()
|
|
117
145
|
a = \`\\r\\n\\\`\\$\`
|
|
118
146
|
end sub
|
|
@@ -122,8 +150,8 @@ describe('TemplateStringExpression', () => {
|
|
|
122
150
|
end sub
|
|
123
151
|
`);
|
|
124
152
|
});
|
|
125
|
-
it('handles escaped unicode char codes', () => {
|
|
126
|
-
testTranspile(`
|
|
153
|
+
it('handles escaped unicode char codes', async () => {
|
|
154
|
+
await testTranspile(`
|
|
127
155
|
sub main()
|
|
128
156
|
a = \`\\c2\\c987\`
|
|
129
157
|
end sub
|
|
@@ -133,8 +161,8 @@ describe('TemplateStringExpression', () => {
|
|
|
133
161
|
end sub
|
|
134
162
|
`);
|
|
135
163
|
});
|
|
136
|
-
it('properly transpiles simple multiline template string', () => {
|
|
137
|
-
testTranspile(`
|
|
164
|
+
it('properly transpiles simple multiline template string', async () => {
|
|
165
|
+
await testTranspile(`
|
|
138
166
|
sub main()
|
|
139
167
|
a = \`hello world\nI am multiline\`
|
|
140
168
|
end sub
|
|
@@ -144,8 +172,8 @@ describe('TemplateStringExpression', () => {
|
|
|
144
172
|
end sub
|
|
145
173
|
`);
|
|
146
174
|
});
|
|
147
|
-
it('properly handles newlines', () => {
|
|
148
|
-
testTranspile(`
|
|
175
|
+
it('properly handles newlines', async () => {
|
|
176
|
+
await testTranspile(`
|
|
149
177
|
sub main()
|
|
150
178
|
a = \`\n\`
|
|
151
179
|
end sub
|
|
@@ -155,8 +183,8 @@ describe('TemplateStringExpression', () => {
|
|
|
155
183
|
end sub
|
|
156
184
|
`);
|
|
157
185
|
});
|
|
158
|
-
it('properly handles clrf', () => {
|
|
159
|
-
testTranspile(`
|
|
186
|
+
it('properly handles clrf', async () => {
|
|
187
|
+
await testTranspile(`
|
|
160
188
|
sub main()
|
|
161
189
|
a = \`\r\n\`
|
|
162
190
|
end sub
|
|
@@ -166,8 +194,8 @@ describe('TemplateStringExpression', () => {
|
|
|
166
194
|
end sub
|
|
167
195
|
`);
|
|
168
196
|
});
|
|
169
|
-
it('properly transpiles more complex multiline template string', () => {
|
|
170
|
-
testTranspile(`
|
|
197
|
+
it('properly transpiles more complex multiline template string', async () => {
|
|
198
|
+
await testTranspile(`
|
|
171
199
|
sub main()
|
|
172
200
|
a = \`I am multiline\n\${a.isRunning()}\nmore\`
|
|
173
201
|
end sub
|
|
@@ -177,8 +205,8 @@ describe('TemplateStringExpression', () => {
|
|
|
177
205
|
end sub
|
|
178
206
|
`);
|
|
179
207
|
});
|
|
180
|
-
it('properly transpiles complex multiline template string in array def', () => {
|
|
181
|
-
testTranspile(`
|
|
208
|
+
it('properly transpiles complex multiline template string in array def', async () => {
|
|
209
|
+
await testTranspile(`
|
|
182
210
|
sub main()
|
|
183
211
|
a = [
|
|
184
212
|
"one",
|
|
@@ -200,8 +228,8 @@ describe('TemplateStringExpression', () => {
|
|
|
200
228
|
end sub
|
|
201
229
|
`);
|
|
202
230
|
});
|
|
203
|
-
it('properly transpiles complex multiline template string in array def, with nested template', () => {
|
|
204
|
-
testTranspile(`
|
|
231
|
+
it('properly transpiles complex multiline template string in array def, with nested template', async () => {
|
|
232
|
+
await testTranspile(`
|
|
205
233
|
sub main()
|
|
206
234
|
a = [
|
|
207
235
|
"one",
|
|
@@ -229,8 +257,8 @@ describe('TemplateStringExpression', () => {
|
|
|
229
257
|
end sub
|
|
230
258
|
`);
|
|
231
259
|
});
|
|
232
|
-
it('properly transpiles two
|
|
233
|
-
testTranspile(`
|
|
260
|
+
it('properly transpiles two template strings side-by-side', async () => {
|
|
261
|
+
await testTranspile(`
|
|
234
262
|
sub main()
|
|
235
263
|
a = \`\${"hello"}\${"world"}\`
|
|
236
264
|
end sub
|
|
@@ -240,8 +268,8 @@ describe('TemplateStringExpression', () => {
|
|
|
240
268
|
end sub
|
|
241
269
|
`);
|
|
242
270
|
});
|
|
243
|
-
it('skips calling toString on strings', () => {
|
|
244
|
-
testTranspile(`
|
|
271
|
+
it('skips calling toString on strings', async () => {
|
|
272
|
+
await testTranspile(`
|
|
245
273
|
sub main()
|
|
246
274
|
text = \`Hello \${"world"}\`
|
|
247
275
|
end sub
|
|
@@ -252,8 +280,8 @@ describe('TemplateStringExpression', () => {
|
|
|
252
280
|
`);
|
|
253
281
|
});
|
|
254
282
|
describe('tagged template strings', () => {
|
|
255
|
-
it('properly transpiles with escaped characters and quasis', () => {
|
|
256
|
-
testTranspile(`
|
|
283
|
+
it('properly transpiles with escaped characters and quasis', async () => {
|
|
284
|
+
await testTranspile(`
|
|
257
285
|
function zombify(strings, values)
|
|
258
286
|
end function
|
|
259
287
|
sub main()
|
|
@@ -268,8 +296,8 @@ describe('TemplateStringExpression', () => {
|
|
|
268
296
|
end sub
|
|
269
297
|
`);
|
|
270
298
|
});
|
|
271
|
-
it('handles multiple embedded expressions', () => {
|
|
272
|
-
testTranspile(`
|
|
299
|
+
it('handles multiple embedded expressions', async () => {
|
|
300
|
+
await testTranspile(`
|
|
273
301
|
function zombify(strings, values)
|
|
274
302
|
end function
|
|
275
303
|
sub main()
|
|
@@ -284,8 +312,8 @@ describe('TemplateStringExpression', () => {
|
|
|
284
312
|
end sub
|
|
285
313
|
`);
|
|
286
314
|
});
|
|
287
|
-
it('can be concatenated with regular string', () => {
|
|
288
|
-
testTranspile(`
|
|
315
|
+
it('can be concatenated with regular string', async () => {
|
|
316
|
+
await testTranspile(`
|
|
289
317
|
sub main()
|
|
290
318
|
thing = "this" + \`that\`
|
|
291
319
|
otherThing = \`that\` + "this"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateStringExpression.spec.js","sourceRoot":"","sources":["../../../../src/parser/tests/expression/TemplateStringExpression.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TemplateStringExpression.spec.js","sourceRoot":"","sources":["../../../../src/parser/tests/expression/TemplateStringExpression.spec.ts"],"names":[],"mappings":";;AAAA,gDAAgD;AAChD,gEAAmD;AACnD,oEAAiE;AACjE,gDAA6C;AAC7C,yCAAiD;AACjD,+CAAsD;AACtD,8CAA2C;AAC3C,gEAAoF;AACpF,wCAAqC;AAErC,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,QAAQ,CAAC,wBAAwB,E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@@ describe('ternary expressions', () => {
|
|
|
228
228
|
afterEach(() => {
|
|
229
229
|
program.dispose();
|
|
230
230
|
});
|
|
231
|
-
it('uses the proper prefix when aliased package is installed', () => {
|
|
231
|
+
it('uses the proper prefix when aliased package is installed', async () => {
|
|
232
232
|
program.setFile('source/roku_modules/rokucommunity_bslib/bslib.brs', '');
|
|
233
|
-
testTranspile(`
|
|
233
|
+
await testTranspile(`
|
|
234
234
|
sub main()
|
|
235
235
|
user = {}
|
|
236
236
|
a = user = invalid ? "no user" : "logged in"
|
|
@@ -242,8 +242,8 @@ describe('ternary expressions', () => {
|
|
|
242
242
|
end sub
|
|
243
243
|
`);
|
|
244
244
|
});
|
|
245
|
-
it('simple consequents', () => {
|
|
246
|
-
testTranspile(`
|
|
245
|
+
it('simple consequents', async () => {
|
|
246
|
+
await testTranspile(`
|
|
247
247
|
sub main()
|
|
248
248
|
user = {}
|
|
249
249
|
a = user = invalid ? "no user" : "logged in"
|
|
@@ -254,7 +254,7 @@ describe('ternary expressions', () => {
|
|
|
254
254
|
a = bslib_ternary(user = invalid, "no user", "logged in")
|
|
255
255
|
end sub
|
|
256
256
|
`);
|
|
257
|
-
testTranspile(`
|
|
257
|
+
await testTranspile(`
|
|
258
258
|
sub main()
|
|
259
259
|
user = {}
|
|
260
260
|
a = user = invalid ? 1 : "logged in"
|
|
@@ -265,7 +265,7 @@ describe('ternary expressions', () => {
|
|
|
265
265
|
a = bslib_ternary(user = invalid, 1, "logged in")
|
|
266
266
|
end sub
|
|
267
267
|
`);
|
|
268
|
-
testTranspile(`
|
|
268
|
+
await testTranspile(`
|
|
269
269
|
sub main()
|
|
270
270
|
user = {}
|
|
271
271
|
a = user = invalid ? 1.2 : "logged in"
|
|
@@ -276,7 +276,7 @@ describe('ternary expressions', () => {
|
|
|
276
276
|
a = bslib_ternary(user = invalid, 1.2, "logged in")
|
|
277
277
|
end sub
|
|
278
278
|
`);
|
|
279
|
-
testTranspile(`
|
|
279
|
+
await testTranspile(`
|
|
280
280
|
sub main()
|
|
281
281
|
user = {}
|
|
282
282
|
a = user = invalid ? {} : "logged in"
|
|
@@ -287,7 +287,7 @@ describe('ternary expressions', () => {
|
|
|
287
287
|
a = bslib_ternary(user = invalid, {}, "logged in")
|
|
288
288
|
end sub
|
|
289
289
|
`);
|
|
290
|
-
testTranspile(`
|
|
290
|
+
await testTranspile(`
|
|
291
291
|
sub main()
|
|
292
292
|
user = {}
|
|
293
293
|
a = user = invalid ? [] : "logged in"
|
|
@@ -299,8 +299,8 @@ describe('ternary expressions', () => {
|
|
|
299
299
|
end sub
|
|
300
300
|
`);
|
|
301
301
|
});
|
|
302
|
-
it('simple alternates', () => {
|
|
303
|
-
testTranspile(`
|
|
302
|
+
it('simple alternates', async () => {
|
|
303
|
+
await testTranspile(`
|
|
304
304
|
sub main()
|
|
305
305
|
user = {}
|
|
306
306
|
a = user = invalid ? "logged in" : "no user"
|
|
@@ -311,7 +311,7 @@ describe('ternary expressions', () => {
|
|
|
311
311
|
a = bslib_ternary(user = invalid, "logged in", "no user")
|
|
312
312
|
end sub
|
|
313
313
|
`);
|
|
314
|
-
testTranspile(`
|
|
314
|
+
await testTranspile(`
|
|
315
315
|
sub main()
|
|
316
316
|
user = {}
|
|
317
317
|
a = user = invalid ? "logged in" : 1
|
|
@@ -322,7 +322,7 @@ describe('ternary expressions', () => {
|
|
|
322
322
|
a = bslib_ternary(user = invalid, "logged in", 1)
|
|
323
323
|
end sub
|
|
324
324
|
`);
|
|
325
|
-
testTranspile(`
|
|
325
|
+
await testTranspile(`
|
|
326
326
|
sub main()
|
|
327
327
|
user = {}
|
|
328
328
|
a = user = invalid ? "logged in" : 1.2
|
|
@@ -333,7 +333,7 @@ describe('ternary expressions', () => {
|
|
|
333
333
|
a = bslib_ternary(user = invalid, "logged in", 1.2)
|
|
334
334
|
end sub
|
|
335
335
|
`);
|
|
336
|
-
testTranspile(`
|
|
336
|
+
await testTranspile(`
|
|
337
337
|
sub main()
|
|
338
338
|
user = {}
|
|
339
339
|
a = user = invalid ? "logged in" : []
|
|
@@ -344,7 +344,7 @@ describe('ternary expressions', () => {
|
|
|
344
344
|
a = bslib_ternary(user = invalid, "logged in", [])
|
|
345
345
|
end sub
|
|
346
346
|
`);
|
|
347
|
-
testTranspile(`
|
|
347
|
+
await testTranspile(`
|
|
348
348
|
sub main()
|
|
349
349
|
user = {}
|
|
350
350
|
a = user = invalid ? "logged in" : {}
|
|
@@ -356,8 +356,8 @@ describe('ternary expressions', () => {
|
|
|
356
356
|
end sub
|
|
357
357
|
`);
|
|
358
358
|
});
|
|
359
|
-
it('complex conditions do not cause scope capture', () => {
|
|
360
|
-
testTranspile(`
|
|
359
|
+
it('complex conditions do not cause scope capture', async () => {
|
|
360
|
+
await testTranspile(`
|
|
361
361
|
sub main()
|
|
362
362
|
a = str(123) = "123" ? true : false
|
|
363
363
|
end sub
|
|
@@ -366,7 +366,7 @@ describe('ternary expressions', () => {
|
|
|
366
366
|
a = bslib_ternary(str(123) = "123", true, false)
|
|
367
367
|
end sub
|
|
368
368
|
`);
|
|
369
|
-
testTranspile(`
|
|
369
|
+
await testTranspile(`
|
|
370
370
|
sub main()
|
|
371
371
|
a = m.top.service.IsTrue() ? true : false
|
|
372
372
|
end sub
|
|
@@ -375,7 +375,7 @@ describe('ternary expressions', () => {
|
|
|
375
375
|
a = bslib_ternary(m.top.service.IsTrue(), true, false)
|
|
376
376
|
end sub
|
|
377
377
|
`);
|
|
378
|
-
testTranspile(`
|
|
378
|
+
await testTranspile(`
|
|
379
379
|
sub test(param1)
|
|
380
380
|
end sub
|
|
381
381
|
|
|
@@ -391,8 +391,8 @@ describe('ternary expressions', () => {
|
|
|
391
391
|
end sub
|
|
392
392
|
`);
|
|
393
393
|
});
|
|
394
|
-
it('captures scope for function call conseqent', () => {
|
|
395
|
-
testTranspile(`
|
|
394
|
+
it('captures scope for function call conseqent', async () => {
|
|
395
|
+
await testTranspile(`
|
|
396
396
|
sub main()
|
|
397
397
|
zombie = {}
|
|
398
398
|
name = zombie.getName() <> invalid ? zombie.GetName() : "zombie"
|
|
@@ -410,8 +410,8 @@ describe('ternary expressions', () => {
|
|
|
410
410
|
end sub
|
|
411
411
|
`);
|
|
412
412
|
});
|
|
413
|
-
it('captures scope for function call alternate', () => {
|
|
414
|
-
testTranspile(`
|
|
413
|
+
it('captures scope for function call alternate', async () => {
|
|
414
|
+
await testTranspile(`
|
|
415
415
|
sub main()
|
|
416
416
|
zombie = {}
|
|
417
417
|
name = zombie.getName() = invalid ? "zombie" : zombie.GetName()
|
|
@@ -429,8 +429,8 @@ describe('ternary expressions', () => {
|
|
|
429
429
|
end sub
|
|
430
430
|
`);
|
|
431
431
|
});
|
|
432
|
-
it('captures scope for complex consequent', () => {
|
|
433
|
-
testTranspile(`
|
|
432
|
+
it('captures scope for complex consequent', async () => {
|
|
433
|
+
await testTranspile(`
|
|
434
434
|
sub main()
|
|
435
435
|
settings = {}
|
|
436
436
|
name = {} ? m.defaults.getAccount(settings.name) : "no"
|
|
@@ -448,8 +448,8 @@ describe('ternary expressions', () => {
|
|
|
448
448
|
end sub
|
|
449
449
|
`);
|
|
450
450
|
});
|
|
451
|
-
it('supports scope-captured outer, and simple inner', () => {
|
|
452
|
-
testTranspile(`
|
|
451
|
+
it('supports scope-captured outer, and simple inner', async () => {
|
|
452
|
+
await testTranspile(`
|
|
453
453
|
sub main()
|
|
454
454
|
zombie = {}
|
|
455
455
|
human = {}
|
|
@@ -469,8 +469,8 @@ describe('ternary expressions', () => {
|
|
|
469
469
|
end sub
|
|
470
470
|
`);
|
|
471
471
|
});
|
|
472
|
-
it('uses scope capture for property access', () => {
|
|
473
|
-
testTranspile(`
|
|
472
|
+
it('uses scope capture for property access', async () => {
|
|
473
|
+
await testTranspile(`
|
|
474
474
|
sub main()
|
|
475
475
|
person = {}
|
|
476
476
|
name = person <> invalid ? person.name : "John Doe"
|
|
@@ -488,14 +488,14 @@ describe('ternary expressions', () => {
|
|
|
488
488
|
end sub
|
|
489
489
|
`);
|
|
490
490
|
});
|
|
491
|
-
it('uses `invalid` in place of missing consequent ', () => {
|
|
492
|
-
testTranspile(`print name = "bob" ? :"zombie"`, `print bslib_ternary(name = "bob", invalid, "zombie")`, 'none', undefined, false);
|
|
491
|
+
it('uses `invalid` in place of missing consequent ', async () => {
|
|
492
|
+
await testTranspile(`print name = "bob" ? :"zombie"`, `print bslib_ternary(name = "bob", invalid, "zombie")`, 'none', undefined, false);
|
|
493
493
|
});
|
|
494
|
-
it('uses `invalid` in place of missing alternate ', () => {
|
|
495
|
-
testTranspile(`print name = "bob" ? "human"`, `print bslib_ternary(name = "bob", "human", invalid)`, 'none', undefined, false);
|
|
494
|
+
it('uses `invalid` in place of missing alternate ', async () => {
|
|
495
|
+
await testTranspile(`print name = "bob" ? "human"`, `print bslib_ternary(name = "bob", "human", invalid)`, 'none', undefined, false);
|
|
496
496
|
});
|
|
497
|
-
it('uses `invalid` in place of missing alternate and consequent ', () => {
|
|
498
|
-
testTranspile(`print name = "bob" ?:`, `print bslib_ternary(name = "bob", invalid, invalid)`, 'none', undefined, false);
|
|
497
|
+
it('uses `invalid` in place of missing alternate and consequent ', async () => {
|
|
498
|
+
await testTranspile(`print name = "bob" ?:`, `print bslib_ternary(name = "bob", invalid, invalid)`, 'none', undefined, false);
|
|
499
499
|
});
|
|
500
500
|
});
|
|
501
501
|
});
|