Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:c9s/gutscript
- Loading branch information
Showing
19 changed files
with
1,148 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
package ast | ||
|
||
type ClassStatement struct { | ||
Name string | ||
Properties []Node | ||
Methods []Node | ||
type Class struct { | ||
Name string | ||
// Properties []Node | ||
// Methods []Node | ||
Super *string | ||
Interfaces []string | ||
Body *StatementList | ||
} | ||
|
||
func CreateClassStatement(className string) Node { | ||
return ClassStatement{className, nil, nil, nil, []string{}} | ||
func CreateClass(className string) Node { | ||
return Class{className, nil, []string{}, nil} | ||
} | ||
|
||
func (self ClassStatement) SetSuperClass(className string) { | ||
func (self *Class) SetSuper(className string) { | ||
self.Super = &className | ||
} | ||
|
||
func (self ClassStatement) AddInterface(intf string) { | ||
self.Interfaces = append(self.Interfaces, intf) | ||
func (self *Class) AddInterface(inf string) { | ||
self.Interfaces = append(self.Interfaces, inf) | ||
} | ||
|
||
func (self *Class) SetInterfaces(infs []string) { | ||
self.Interfaces = infs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ast | ||
|
||
type ClassMember struct { | ||
Name string | ||
Value Node | ||
} | ||
|
||
func CreateClassMember(name string) ClassMember { | ||
return ClassMember{name, nil} | ||
} | ||
|
||
func (self *ClassMember) SetValue(val Node) { | ||
self.Value = val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.