Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Fix enum bug in module legacy namespace. #928

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,7 @@ private void visitEnumType(String symbolName, String qualifiedName, EnumType typ
emit(elementsTypeName);
emit(";");
emitBreak();
typesUsed.add(elementsTypeName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this fix the 'enu' or 'enum' test (or both)?

return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Generated from src/test/java/com/google/javascript/clutz/testdata/partial/declare_legacy_namespace_enu.js
declare namespace ಠ_ಠ.clutz.declare.legacy.namespace.enu {
export import E = module$contents$declare$legacy$namespace$enu_E ;
}
declare module 'goog:declare.legacy.namespace.enu' {
import enu = ಠ_ಠ.clutz.declare.legacy.namespace.enu;
export = enu;
}
// Generated from src/test/java/com/google/javascript/clutz/testdata/partial/declare_legacy_namespace_enu.js
declare namespace ಠ_ಠ.clutz {
enum module$contents$declare$legacy$namespace$enu_E {
A = 1.0 ,
B = 2.0 ,
C = 3.0 ,
}
}
declare namespace ಠ_ಠ.clutz.module$exports$declare$legacy$namespace$enu {
export import E = ಠ_ಠ.clutz.module$contents$declare$legacy$namespace$enu_E ;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This test is the same as declare_legacy_namespace_enum.js with the
// difference that it doesn't use "enum" which is reserved keyword and triggers
// separate flow in Clutz.

goog.module('declare.legacy.namespace.enu');
goog.module.declareLegacyNamespace();

/**
* @enum {number}
*/
const E = {
A: 1,
B: 2,
C: 3
};

exports.E = E;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare namespace ಠ_ಠ.clutz.declare.legacy {
let namespace : { enum : { E : module$contents$declare$legacy$namespace$enum_E } };
}
declare module 'goog:declare.legacy.namespace.enum' {
import enum_ = ಠ_ಠ.clutz.declare.legacy.namespace;
export default enum_.enum;
}
// Generated from src/test/java/com/google/javascript/clutz/testdata/partial/declare_legacy_namespace_enum.js
declare namespace ಠ_ಠ.clutz {
enum module$contents$declare$legacy$namespace$enum_E {
A = 1.0 ,
B = 2.0 ,
C = 3.0 ,
}
}
declare namespace ಠ_ಠ.clutz.module$exports$declare$legacy$namespace$enum {
export import E = ಠ_ಠ.clutz.module$contents$declare$legacy$namespace$enum_E ;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
goog.module('declare.legacy.namespace.enum');
goog.module.declareLegacyNamespace();

/**
* @enum {number}
*/
const E = {
A: 1,
B: 2,
C: 3
};

exports.E = E;