示例#1
0
        private HassiumProperty compileProperty(PropertyNode node, HassiumClass parent)
        {
            var temp = method;
            method = new HassiumMethod();
            method.Name = string.Format("get_{0}", node.Variable);
            method.IsPrivate = node.IsPrivate;
            method.SourceRepresentation = string.Format("{0} ()", method.Name);
            table.PushScope();
            node.GetBody.Visit(this);
            table.PopScope();
            HassiumMethod getBody = method;
            getBody.Parent = parent;
            getBody.ReturnType = "";
            method = new HassiumMethod();
            method.Name = string.Format("set_{0}", node.Variable);
            method.IsPrivate = node.IsPrivate;
            method.SourceRepresentation = string.Format("{0} (value)", method.Name);
            table.PushScope();
            if (!table.ContainsSymbol("value"))
                table.AddSymbol("value");
            method.Parameters.Add(new FuncParameter("value"), table.GetSymbol("value"));
            node.SetBody.Visit(this);
            table.PopScope();
            HassiumMethod setBody = method;
            setBody.Parent = parent;
            setBody.ReturnType = "";
            HassiumProperty property = new HassiumProperty(getBody, setBody);
            property.Parent = parent;
            method = temp;

            return property;
        }
 public void Accept(PropertyNode node)
 {
 }
示例#3
0
 public void Accept(PropertyNode node)
 {
     module.Attributes.Add(node.Variable, compileProperty(node, method.Parent));
 }