示例#1
0
 public override SyntaxNode Visit(WorkspaceSyntax pNode)
 {
     _consts = new Dictionary <string, IdentifierSyntax>(StringComparer.OrdinalIgnoreCase);
     foreach (var c in pNode.Consts)
     {
         _consts.Add(c.Identifier.Value, c.Value);
     }
     return(base.Visit(pNode));
 }
示例#2
0
        public override void Visit(WorkspaceSyntax pNode)
        {
            foreach (var i in pNode.Imports)
            {
                i.Accept(this);
            }

            //We need to register all types since structs could have fields of other types
            foreach (var s in pNode.Structs)
            {
                var st = SmallType.RegisterType("", s.Prefix, true, s.TypeArgs);
                if (s.Initializer != null)
                {
                    st.SetInitializer(new InitializerInfo(s.Initializer));
                }
            }
            foreach (var s in pNode.Structs)
            {
                s.Accept(this);
            }

            foreach (var m in pNode.Methods)
            {
                m.Accept(this);
            }

            foreach (var c in pNode.Casts)
            {
                c.Accept(this);
            }
            if (!_mainFound && _mainRequired)
            {
                Compiler.ReportError(CompilerErrorType.NoRun, new TextSpan());
            }
            MetadataCache.AddImplicitCasts();
        }
 protected override void VisitWorkspaceSyntax(WorkspaceSyntax pNode)
 {
     _mainModule = pNode.Module;
     base.VisitWorkspaceSyntax(pNode);
 }
示例#4
0
 protected virtual void VisitWorkspaceSyntax(WorkspaceSyntax pNode)
 {
     Visit(pNode.Module);
 }
示例#5
0
        public static CompilationModule Build(WorkspaceSyntax pWorkspace)
        {
            var module = BuildInternal(pWorkspace.Module, null);

            return(module);
        }
示例#6
0
 protected virtual SyntaxNode VisitWorkspaceSyntax(WorkspaceSyntax pNode)
 {
     return(SyntaxFactory.Workspace(pNode.Name, (ModuleSyntax)Visit(pNode.Module)));
 }