Exemple #1
0
 private void CreateImplicitBaseConstructor(AstNode node, Method function)
 {
     Function parentConstructor = function.GetCtorParent();
     if(parentConstructor != null &&
        function.GetParentScope().IsStructure() == parentConstructor.GetParentScope().IsStructure())
     {
         builder.CreateLoadArg(0);
         builder.CreateCall(parentConstructor, 1);
     }
 }
Exemple #2
0
        private void CheckConstructorCycles(AstNode node, Method ctor)
        {
            Method current = ctor.GetCtorParent();
            while(current != null)
            {
                // Don't continue checking when hitting a leaf.
                if(current.IsCtorLeaf())
                    return;

                // If the parent is equal to the start point,
                // a cycle has been found.
                if(current == ctor)
                    Error(node, "constructor initializers produces a cycle.");

                // Check the next parent.
                current = current.GetCtorParent();
            }
        }