예제 #1
0
파일: decls.cs 프로젝트: hlorenzi/trapl
        private void ConvertStructDecl(Grammar.ASTNodeDeclStruct structNode, Core.Name curNamespace, List <Core.UseDirective> useDirectives)
        {
            var name = curNamespace.Concatenate(NameResolver.Resolve(structNode.name));

            if (!ValidateName(name, structNode.name.GetSpan()))
            {
                return;
            }

            var structIndex = this.session.CreateStruct(name, structNode);

            foreach (var structUseNode in structNode.useDirectives)
            {
                useDirectives.Add(UseDirectiveResolver.Resolve(structUseNode));
            }

            this.structWorkData.Add(new StructWorkData
            {
                name          = name,
                declNode      = structNode,
                declIndex     = structIndex,
                useDirectives = useDirectives.ToArray()
            });

            foreach (var structUseNode in structNode.useDirectives)
            {
                useDirectives.RemoveAt(useDirectives.Count - 1);
            }
        }
예제 #2
0
파일: decls.cs 프로젝트: hlorenzi/trapl
        private void ConvertNamespaceDecl(Grammar.ASTNodeDeclNamespace namespaceNode, Core.Name curNamespace, List <Core.UseDirective> useDirectives)
        {
            var innerNamespace = curNamespace.Concatenate(NameResolver.ResolvePath(namespaceNode.path));

            for (var i = 0; i < namespaceNode.path.identifiers.Count; i++)
            {
                useDirectives.Add(new Core.UseDirectiveAll {
                    name = curNamespace.ConcatenateIdentifier(namespaceNode.path.identifiers[i].GetExcerpt())
                });
            }

            this.ConvertDeclGroup(namespaceNode.innerGroup, innerNamespace, useDirectives);

            for (var i = 0; i < namespaceNode.path.identifiers.Count; i++)
            {
                useDirectives.RemoveAt(useDirectives.Count - 1);
            }
        }
예제 #3
0
파일: decls.cs 프로젝트: hlorenzi/trapl
        private void ConvertFunctDecl(Grammar.ASTNodeDeclFunct functNode, Core.Name curNamespace, List <Core.UseDirective> useDirectives)
        {
            var name = curNamespace.Concatenate(NameResolver.Resolve(functNode.name));

            if (!ValidateName(name, functNode.name.GetSpan()))
            {
                return;
            }

            var functIndex = this.session.CreateFunct(name);

            this.functWorkData.Add(new FunctWorkData
            {
                name          = name,
                declNode      = functNode,
                declIndex     = functIndex,
                useDirectives = useDirectives.ToArray()
            });
        }