コード例 #1
0
        public override void Accept(InterfaceDeclaration contractDecl)
        {
            IodineInterface contract = new IodineInterface(contractDecl.Name);

            foreach (AstNode node in contractDecl.Children)
            {
                FunctionDeclaration decl = node as FunctionDeclaration;
                contract.AddMethod(new IodineMethod(module, decl.Name, decl.InstanceMethod,
                                                    decl.Parameters.Count, 0));
            }
            module.SetAttribute(contractDecl.Name, contract);
        }
コード例 #2
0
ファイル: FunctionCompiler.cs プロジェクト: parhelia512/nginz
        public override void Accept(InterfaceDeclaration contractDecl)
        {
            IodineInterface contract = new IodineInterface(contractDecl.Name);

            foreach (AstNode node in contractDecl.Children)
            {
                FunctionDeclaration decl = node as FunctionDeclaration;
                contract.AddMethod(new IodineMethod(methodBuilder.Module, decl.Name, decl.InstanceMethod,
                                                    decl.Parameters.Count, 0));
            }
            methodBuilder.EmitInstruction(contractDecl.Location, Opcode.LoadConst,
                                          methodBuilder.Module.DefineConstant(contract));
            methodBuilder.EmitInstruction(contractDecl.Location, Opcode.StoreLocal,
                                          symbolTable.GetSymbol(contractDecl.Name).Index);
        }