-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConstructorDefinition.go
46 lines (40 loc) · 1.66 KB
/
ConstructorDefinition.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package IDL
//--------------------------------------------------------------------
type ConstructorDefinition struct {
FunctionDefinition
parent *ClassDefinition
}
//--------------------------------------------------------------------
func NewConstructorDefinition(name string) *ConstructorDefinition {
cstr := &ConstructorDefinition{
FunctionDefinition: *NewFunctionDefinition(name),
}
// set return value to instance of the class
// NOTICE: this forces that the first return value is the new instance,
// in case something different is required, this return value need to be removed
cstr.AddReturnValues(NewArgDefinition("new_instance", HANDLE))
return cstr
}
//--------------------------------------------------------------------
func NewConstructorDefinitionFromFunctionDefinition(f *FunctionDefinition) *ConstructorDefinition {
return &ConstructorDefinition{FunctionDefinition: *f}
}
//--------------------------------------------------------------------
func (this *ConstructorDefinition) Duplicate() *ConstructorDefinition{
dup := ConstructorDefinition{}
dup.FunctionDefinition = *this.FunctionDefinition.Duplicate()
return &dup
}
//--------------------------------------------------------------------
func (this *ConstructorDefinition) IsMethod() bool {
return false
}
//--------------------------------------------------------------------
func (this *ConstructorDefinition) GetParent() *ClassDefinition {
return this.parent
}
//--------------------------------------------------------------------
func (this *ConstructorDefinition) SetParent(parent *ClassDefinition) {
this.parent = parent
}
//--------------------------------------------------------------------