{"record":{"id":"aa4513044077239e","repo":"swc-project/swc","slug":"getter-setter-property-be-compiled-as-compiledprop","errorCode":null,"errorMessage":"getter/setter property be compiled as CompiledProp::Accessor","messagePattern":"getter/setter property be compiled as CompiledProp::Accessor","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_compat_es2015/src/generator.rs","lineNumber":1329,"sourceCode":"                }\n                .into(),\n                Prop::KeyValue(p) => AssignExpr {\n                    span: DUMMY_SP,\n                    op: op!(\"=\"),\n                    left: MemberExpr {\n                        span: DUMMY_SP,\n                        obj: temp.clone().into(),\n                        prop: p.key.into(),\n                    }\n                    .into(),\n                    right: p.value,\n                }\n                .into(),\n                Prop::Assign(_) => {\n                    unreachable!(\"assignment property be removed before generator pass\")\n                }\n                Prop::Getter(_) | Prop::Setter(_) => {\n                    unreachable!(\"getter/setter property be compiled as CompiledProp::Accessor\")\n                }\n                Prop::Method(p) => AssignExpr {\n                    span: DUMMY_SP,\n                    op: op!(\"=\"),\n                    left: MemberExpr {\n                        span: DUMMY_SP,\n                        obj: temp.clone().into(),\n                        prop: p.key.into(),\n                    }\n                    .into(),\n                    right: p.function.into(),\n                }\n                .into(),\n                #[cfg(swc_ast_unknown)]\n                _ => panic!(\"unable to access unknown nodes\"),\n            },\n            CompiledProp::Accessor(getter, setter) => {\n                let key = getter","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_compat_es2015/src/generator.rs#L1311-L1347","documentation":"In the same object-literal emission path of the es2015 generator pass, getter and setter properties are expected to have been folded into CompiledProp::Accessor variants by earlier logic in the pass (it pairs getter/setter pairs onto one accessor). A raw Prop::Getter/Prop::Setter reaching this match means that earlier collection step did not classify them, so the unreachable! fires as an internal invariant of the pass.","triggerScenarios":"An object literal inside a generator/async body whose getter/setter property was not recognized by the CompiledProp collection step — e.g. unusual computed keys, spread mixed with accessors, or an AST produced/mutated by a custom pass that desynced the two code paths.","commonSituations":"Third-party AST transforms mutating object literals between passes; swc version regressions in the generator pass; hand-built ASTs with accessor props.","solutions":["Update swc_core/swc_ecma_compat_es2015 — accessor handling regressions get fixed quickly when reported.","Remove any custom passes that mutate ObjectLit props between the accessor-collection and emission phases; run the generator pass on unmodified parse output.","Reduce the repro (generator function containing `{ get x() {...}, set x(v) {...} }`) and file an swc issue."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Prefer unmodified parse output for the generator pass; if you must mutate,\n// verify accessors still pair up\nfn accessor_pairs_sane(o: &ObjectLit) -> bool {\n    // no duplicate raw Getter/Setter with identical keys after your mutation\n    let mut keys = std::collections::HashSet::new();\n    o.props.iter().all(|p| match p {\n        PropOrSpread::Prop(p) => match &**p {\n            Prop::Getter(g) => keys.insert(format!(\"{:?}\", g.key)),\n            Prop::Setter(s) => keys.insert(format!(\"{:?}\", s.key)),\n            _ => true,\n        },\n        _ => true,\n    })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not mutate object literals between the generator pass's collection and emission phases.","Run the generator pass on freshly parsed, untouched ASTs.","Keep swc crates version-aligned; accessor regressions are fixed upstream quickly."],"tags":["swc","compat-es2015","generator","accessor","getter-setter","ast-invariant","panic"],"backgroundTag":"compiler-internal-panic","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}