feat(enum): object.freeze the enum

This commit is contained in:
Ashley Williams 2018-03-29 17:28:42 +02:00
parent 79ef5979f4
commit 3ed363ae39

View File

@ -1573,9 +1573,9 @@ impl<'a, 'b> SubContext<'a, 'b> {
enum_string.push_str(&export); enum_string.push_str(&export);
enum_string enum_string
} else { } else {
let mut enum_string = format!("export const {} = {{", enum_.name); let mut enum_string = format!("export const {} = Object.freeze({{", enum_.name);
enum_string.push_str(&variants); enum_string.push_str(&variants);
enum_string.push_str("}\n"); enum_string.push_str("})\n");
enum_string enum_string
}; };
self.cx.globals.push_str(&global_export); self.cx.globals.push_str(&global_export);