예제 #1
0
        public void EmitMain()
        {
            var typeId               = new TypeIdentifier(Assembly.EntryPoint.DeclaringType);
            var memberId             = new MemberIdentifier(Translator.TypeInfoProvider, Assembly.EntryPoint);
            var entryPointIdentifier = new QualifiedMemberIdentifier(typeId, memberId);

            var mainExpression = Translator.FunctionCache.GetExpression(entryPointIdentifier);

            var astEmitter  = (AstEmitter)EntryPointAstEmitter;
            var mainEmitter = new AstEmitter(this, Formatter, astEmitter.JSIL, astEmitter.TypeSystem, astEmitter.TypeInfo, astEmitter.Configuration, isTopLevel: true);

            Switch(PrecedingType.TopLevel);

            if (NeedStaticInit)
            {
                Formatter.ConditionalNewLine();
                Formatter.WriteRaw("(invoke \"__static_init\")");
                Formatter.NewLine();
                Formatter.NewLine();
            }

            var body = mainExpression.Body;

            foreach (var stmt in body.Statements)
            {
                mainEmitter.Visit(stmt);
                Formatter.ConditionalNewLine();
            }
        }
예제 #2
0
 internal virtual void AfterWriteValues(AstEmitter astEmitter)
 {
 }
예제 #3
0
 internal virtual void BeforeWriteValues(AstEmitter astEmitter)
 {
 }
예제 #4
0
 internal override void BeforeWriteValues(AstEmitter astEmitter)
 {
     astEmitter.Formatter.Value(ExportedFunctionName);
     astEmitter.Formatter.Space();
 }