Exemplo n.º 1
0
 internal ClassData(ElaClassMember[] members)
 {
     Members = members;
     Code = -1;
 }
Exemplo n.º 2
0
        //Compiles class member - function or constant
        private void CompileMember(ElaClassMember m)
        {
            //Each class function should a mask with at least one entry of a type parameter
            if (m.Mask == 0)
                AddError(ElaCompilerError.InvalidMemberSignature, m, m.Name);

            //Class member can be a constant or a function
            var isConst = m.Components == 1;

            //m.Components are function arguments plus return type.
            var addr = AddVariable(m.Name, m, ElaVariableFlags.ClassFun | (m.Components>1?ElaVariableFlags.Function:ElaVariableFlags.None)
                | (isConst ? ElaVariableFlags.Polyadric : ElaVariableFlags.None), m.Components - 1);

            if (!isConst) //This is a function
            {
                cw.Emit(Op.PushI4, m.Components - 1);
                cw.Emit(Op.PushI4, m.Mask);
                cw.Emit(Op.Newfunc, AddString(m.Name));
            }
            else //This is a polymorphic constant
                cw.Emit(Op.Newconst, AddString(m.Name));

            PopVar(addr);
        }