Skip to content

Commit 00afeb0

Browse files
authored
Use myArray as the variable name for an array (#211)
* Use myArray as the variable name for an array. * Added TODO comment about localization.
1 parent cf4f33c commit 00afeb0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/blocks/utils/variable.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export function varNameForType(type: string): string {
6161
if (alias) {
6262
type = alias;
6363
}
64-
64+
65+
// TODO(lizlooney): Should the prefix "my" in myTuple, myDict, myCallable, myArray, and my<type> be localized?
66+
// TODO(lizlooney): Should variable names be lowerPascalCase or snake_case?
67+
6568
if (type.startsWith('tuple[') || type.startsWith('Tuple[')) {
6669
return 'myTuple';
6770
}
@@ -76,8 +79,7 @@ export function varNameForType(type: string): string {
7679
}
7780
if (type.includes('[')) {
7881
// The type is an array.
79-
// TODO(lizlooney): What's a good name for an array variable?
80-
return '';
82+
return 'myArray';
8183
}
8284
// If the type has a dot, it is an object and we should provide a variable
8385
// block for this type.

0 commit comments

Comments
 (0)