Skip to content

Commit

Permalink
Generate class member value
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Oct 20, 2013
1 parent a644622 commit 0674b48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gutscript/ast/class_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ func CreateClassMember(name string) ClassMember {
}

func (self *ClassMember) SetValue(val Node) {
self.Value = &val
self.Value = val
}
6 changes: 5 additions & 1 deletion src/gutscript/codegen/php/visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ func (self *Visitor) Visit(n ast.Node) (out string) {
return out
}
if member, ok := n.(ast.ClassMember); ok {
out += self.IndentSpace() + "public $" + member.Name + ";\n"
out += self.IndentSpace() + "public $" + member.Name
if member.Value != nil {
out += " = " + self.Visit(member.Value)
}
out += ";\n"
return out
}
if stmt, ok := n.(*ast.IfStatement); ok {
Expand Down

0 comments on commit 0674b48

Please sign in to comment.