forked from PuqiAR/Fig-TreeWalker
[VER 0.3.2-Hotfix]
[Feat] 面对对象(struct)支持,完成对其初始化解析。 [Impl] Value更换为Object,且简单类型按值存储,复杂类型为shared_ptr。 [Impl] 全局使用 Object shared_ptr
This commit is contained in:
21
test.fig
21
test.fig
@@ -1,17 +1,16 @@
|
||||
struct Person
|
||||
{
|
||||
name: String;
|
||||
age: Int = 10;
|
||||
|
||||
public func getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
age: Int;
|
||||
}
|
||||
|
||||
var person = Person{"123"};
|
||||
var person := Person{"Fig", 1};
|
||||
|
||||
const print := __fstdout_print;
|
||||
print(person.name);
|
||||
person.name = "sb";
|
||||
print(person.name);
|
||||
const print := __fstdout_println;
|
||||
|
||||
print(person.name, " ", person.age);
|
||||
|
||||
person.name = "hello";
|
||||
person.age = 114514;
|
||||
|
||||
print(person.name, " ", person.age);
|
||||
|
||||
Reference in New Issue
Block a user