コード例 #1
0
ファイル: ResConceptClassDecl.cs プロジェクト: kzyg/spark
 public void AddDirectMemberLine(ResMemberLineDeclBuilder memberLine)
 {
 }
コード例 #2
0
ファイル: ResMemberDecl.cs プロジェクト: kzyg/spark
 public void AddLine(ResMemberLineDeclBuilder line)
 {
     AssertBuildable();
     _lines.Add(line);
 }
コード例 #3
0
ファイル: ResConceptClassDecl.cs プロジェクト: kzyg/spark
        public override IResMemberDecl CreateInheritedDeclImpl(
            ResolveContext resContext,
            IResContainerBuilderRef resContainer,
            ILazy <IResMemberLineDecl> resLine,
            SourceRange range,
            IResMemberRef originalRef)
        {
            var firstRef  = originalRef as IResConceptClassRef;
            var firstDecl = (IResConceptClassDecl)firstRef.Decl;

            var result = ResConceptClassDecl.Build(
                resContext.LazyFactory,
                resLine,
                range,
                firstDecl.Name,
                (builder) =>
            {
                var thisConceptClassBuilder = new ResConceptClassBuilderRef(
                    range,
                    builder);

                var thisConceptClass = (IResConceptClassRef)resContainer.CreateMemberRef(
                    range,
                    builder.Value);
                var thisParameter = new ResVarDecl(
                    range,
                    firstDecl.ThisParameter.Name,
                    thisConceptClass);

                builder.ThisConceptClass = thisConceptClass;
                builder.ThisParameter    = thisParameter;

                foreach (var ml in firstRef.MemberLines)
                {
                    var memberLine = ml; // Freaking C# variable capture!!!!

                    var memberNameGroupBuilder     = builder.GetMemberNameGroup(memberLine.Name);
                    var memberCategoryGroupBuilder = memberNameGroupBuilder.GetMemberCategoryGroup(memberLine.Category);

                    var newMemberLineBuilder = new ResMemberLineDeclBuilder(
                        memberCategoryGroupBuilder,
                        builder.LazyFactory,
                        memberLine.Name,
                        memberLine.OriginalLexicalID,
                        memberLine.Category);
                    memberCategoryGroupBuilder.AddLine(newMemberLineBuilder);

                    newMemberLineBuilder.AddAction(() =>
                    {
                        var memberRef = memberLine.EffectiveSpec.Bind(
                            range,
                            new ResVarRef(range, thisParameter));

                        var newMemberDecl = CreateInheritedDecl(
                            resContext,
                            thisConceptClassBuilder,
                            newMemberLineBuilder,
                            range,
                            memberRef);
                        newMemberLineBuilder.DirectDecl = newMemberDecl;
                    });

                    builder.AddDirectMemberLine(newMemberLineBuilder);
                }
            });

            return(result);
        }