Skip to content

Commit

Permalink
Revert "compilerEs: refactor code generation for once methods"
Browse files Browse the repository at this point in the history
This reverts commit 0d84906.
  • Loading branch information
Matthew Giannini authored and Matthew Giannini committed Jul 12, 2024
1 parent 0d84906 commit 339cc83
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
13 changes: 0 additions & 13 deletions src/compilerEs/fan/ast/JsExpr.fan
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,6 @@ class JsExpr : JsNode
leave := x.leave
isAssign := x.assignTarget != null

// convert binary expressions assigning or testing for equivalence to
// synthetic str "_once_" to undefined
if (lhs.expr is FieldExpr)
{
fe := (FieldExpr)lhs.expr
if (rhs.expr.id === ExprId.strLiteral && rhs.expr->val == "_once_")
{
lhs.write
js.w(" ${symbol} undefined", loc)
return
}
}

if (isAssign && lhs.expr is FieldExpr)
{
fe := (FieldExpr)lhs.expr
Expand Down
3 changes: 0 additions & 3 deletions src/compilerEs/fan/ast/JsType.fan
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ class JsType : JsNode

private static Str fieldDefVal(FieldDef f)
{
// initialize once fields to undefined
if (f.isOnce) return "undefined"

defVal := "null"
fieldType := f.fieldType
if (!fieldType.isNullable)
Expand Down

0 comments on commit 339cc83

Please sign in to comment.