• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# node.ALvalueExp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.ALvalueExp的典型用法代码示例。如果您正苦于以下问题:C# ALvalueExp类的具体用法?C# ALvalueExp怎么用?C# ALvalueExp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ALvalueExp类属于Galaxy_Editor_2.Compiler.Generated.node命名空间,在下文中一共展示了ALvalueExp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CaseAAssignmentExp

        public override void CaseAAssignmentExp(AAssignmentExp node)
        {
            if (!(node.Parent() is AExpStm))
            {
                PStm parentStm = Util.GetAncestor<PStm>(node);

                MoveMethodDeclsOut mover = new MoveMethodDeclsOut("multipleAssignmentsVar", finalTrans.data);
                node.GetLvalue().Apply(mover);
                PLvalue lvalue = Util.MakeClone(node.GetLvalue(), finalTrans.data);
                ALvalueExp exp = new ALvalueExp(lvalue);
                finalTrans.data.ExpTypes[exp] = finalTrans.data.LvalueTypes[lvalue];
                node.ReplaceBy(exp);

                AExpStm stm = new AExpStm(new TSemicolon(";"), node);

                AABlock block = (AABlock) parentStm.Parent();
                //block.GetStatements().Insert(block.GetStatements().IndexOf(parentStm), localDeclStm);
                block.GetStatements().Insert(block.GetStatements().IndexOf(parentStm), stm);

                //localDeclStm.Apply(this);
                stm.Apply(this);

                if (parentStm is AWhileStm && Util.IsAncestor(exp, ((AWhileStm)parentStm).GetCondition()))
                {
                    AWhileStm aStm = (AWhileStm)parentStm;
                    //Copy assignment before continues
                    //Before each continue in the while, and at the end.

                    //Add continue statement, if not present
                    block = (AABlock)((ABlockStm)aStm.GetBody()).GetBlock();
                    if (block.GetStatements().Count == 0 || !(block.GetStatements()[block.GetStatements().Count - 1] is AContinueStm))
                        block.GetStatements().Add(new AContinueStm(new TContinue("continue")));

                    //Get all continue statements in the while
                    ContinueFinder finder = new ContinueFinder();
                    block.Apply(finder);
                    foreach (AContinueStm continueStm in finder.Continues)
                    {
                        stm = new AExpStm(new TSemicolon(";"), Util.MakeClone(node, finalTrans.data));
                        block.GetStatements().Insert(block.GetStatements().IndexOf(continueStm), stm);

                        stm.Apply(this);
                    }
                }
                return;
            }

            base.CaseAAssignmentExp(node);
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:49,代码来源:AssignFixup.cs


示例2: CaseASimpleInvokeExp

        public override void CaseASimpleInvokeExp(ASimpleInvokeExp node)
        {
            PExp expNode = (PExp)node;
            PType type = data.ExpTypes[expNode];
            if (type is APointerType) type = new ANamedType(new TIdentifier("string"), null);
            ALocalLvalue local = new ALocalLvalue(new TIdentifier("tempName", 0, 0));
            ALvalueExp exp = new ALvalueExp(local);
            PStm stm = Util.GetAncestor<PStm>(node);
            AABlock block = (AABlock)stm.Parent();
            node.ReplaceBy(exp);
            AALocalDecl localDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null,
                                                    Util.MakeClone(type, data),
                                                    new TIdentifier(varName, 0, 0), expNode);
            ALocalDeclStm newStm = new ALocalDeclStm(new TSemicolon(";"), localDecl);
            block.GetStatements().Insert(block.GetStatements().IndexOf(stm), newStm);
            NewStatements.Add(newStm);

            data.LvalueTypes[local] = type;
            data.ExpTypes[exp] = type;
            data.LocalLinks[local] = localDecl;
            //localDecl.Apply(this);
            exp.Apply(this);
            return;
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:24,代码来源:MoveMethodDeclsOut.cs


示例3: OutAIncDecExp

        public override void OutAIncDecExp(AIncDecExp node)
        {
            PIncDecOp op = node.GetIncDecOp();
            if (!Util.HasAncestor<AABlock>(node))
            {
                Token token = null;
                if (op is APostDecIncDecOp)
                    token = ((APostDecIncDecOp) op).GetToken();
                else if (op is APreDecIncDecOp)
                    token = ((APreDecIncDecOp)op).GetToken();
                else if (op is APostIncIncDecOp)
                    token = ((APostIncIncDecOp)op).GetToken();
                else if (op is APreIncIncDecOp)
                    token = ((APreIncIncDecOp)op).GetToken();
                errors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText114")));
                throw new ParserException(token, "TypeChecking.OutAIncDecExp");
            }

            bool plus = op is APreIncIncDecOp || op is APostIncIncDecOp;
            if (op is APreIncIncDecOp || op is APreDecIncDecOp || node.Parent() is AExpStm)
            {//++i, --i, i++; or i--;
                //Replace with assignment
                //<exp>++ => <exp> + 1
                //(... foo = <exp> ...)++ => (... foo = <exp> ...) = (... foo ...) + 1
                //(... foo++ ...)++ => (... foo++ ...) = (... foo ...) + 1

                PLvalue clone = Util.MakeClone(node.GetLvalue(), data);
                clone.Apply(new AssignFixup(data));
                PBinop binop;
                if (plus)
                {
                    binop = new APlusBinop(new TPlus("+"));
                }
                else
                {
                    binop = new AMinusBinop(new TMinus("-"));
                }
                ABinopExp addExp = new ABinopExp(new ALvalueExp(clone), binop, new AIntConstExp(new TIntegerLiteral("1")));
                AAssignmentExp exp = new AAssignmentExp(new TAssign("="), node.GetLvalue(), addExp);
                node.ReplaceBy(exp);
                exp.Apply(this);
                return;
            }
            {//i++ or i--
                //Make a new local so
                //int newLocal = i;
                //++i;
                //...newLocal...;
                PLvalue lvalueClone = Util.MakeClone(node.GetLvalue(), data);
                PExp exp = new ALvalueExp(Util.MakeClone(node.GetLvalue(), data));
                data.ExpTypes[exp] = data.LvalueTypes[node.GetLvalue()];
                AALocalDecl localDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, Util.MakeClone(data.LvalueTypes[node.GetLvalue()], data), new TIdentifier("incDecVar"), exp);
                ALocalDeclStm localDeclStm = new ALocalDeclStm(new TSemicolon(";"), localDecl);

                node.SetIncDecOp(plus
                                     ? (PIncDecOp) new APreIncIncDecOp(new TPlusPlus("++"))
                                     : new APreDecIncDecOp(new TMinusMinus("--")));

                ALocalLvalue lvalue = new ALocalLvalue(new TIdentifier(localDecl.GetName().Text));
                exp = new ALvalueExp(lvalue);
                data.ExpTypes[exp] = data.LvalueTypes[lvalue] = data.LvalueTypes[node.GetLvalue()];
                data.LocalLinks[lvalue] = localDecl;

                PStm pStm = Util.GetAncestor<PStm>(node);
                node.ReplaceBy(exp);
                PStm nodeStm = new AExpStm(new TSemicolon(";"), node);

                AABlock block = (AABlock) pStm.Parent();

                block.GetStatements().Insert(block.GetStatements().IndexOf(pStm), localDeclStm);
                block.GetStatements().Insert(block.GetStatements().IndexOf(pStm), nodeStm);
                localDeclStm.Apply(this);
                nodeStm.Apply(this);
                exp.Apply(this);

                if (pStm is AWhileStm && Util.IsAncestor(exp, ((AWhileStm)pStm).GetCondition()))
                {
                    AWhileStm aStm = (AWhileStm)pStm;
                    //Insert
                    // newLocal = i
                    // ++i
                    //Before each continue in the while, and at the end.

                    //Add continue statement, if not present
                    block = (AABlock)((ABlockStm)aStm.GetBody()).GetBlock();
                    if (block.GetStatements().Count == 0 || !(block.GetStatements()[block.GetStatements().Count - 1] is AContinueStm))
                        block.GetStatements().Add(new AContinueStm(new TContinue("continue")));

                    //Get all continue statements in the while
                    ContinueFinder finder = new ContinueFinder();
                    block.Apply(finder);
                    foreach (AContinueStm continueStm in finder.Continues)
                    {
                        PLvalue nodeLvalue1 = Util.MakeClone(lvalueClone, data);
                        PExp nodeLvalue1Exp = new ALvalueExp(nodeLvalue1);
                        PLvalue nodeLvalue2 = Util.MakeClone(lvalueClone, data);
                        ALocalLvalue newLocalLvalue = new ALocalLvalue(new TIdentifier("newLocal"));
                        data.LocalLinks[newLocalLvalue] = localDecl;
                        AAssignmentExp assignment = new AAssignmentExp(new TAssign("="), newLocalLvalue, nodeLvalue1Exp);
                        PStm assignmentStm = new AExpStm(new TSemicolon(";"), assignment);
//.........这里部分代码省略.........
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:101,代码来源:TypeChecking.cs


示例4: New388

 ArrayList New388()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList6 = (ArrayList) Pop();
     ArrayList nodeArrayList5 = (ArrayList) Pop();
     ArrayList nodeArrayList4 = (ArrayList) Pop();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode8 = new TypedList();
     PLvalue plvalueNode3 = (PLvalue)nodeArrayList1[0];
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TDot tdotNode5 = (TDot)nodeArrayList2[0];
     ADotDotType pdottypeNode4 = new ADotDotType (
       tdotNode5
     );
     TIdentifier tidentifierNode6 = (TIdentifier)nodeArrayList3[0];
     TypedList listNode7 = (TypedList)nodeArrayList5[0];
     if ( listNode7 != null )
     {
     listNode8.AddAll(listNode7);
     }
     ANonstaticInvokeExp pexpNode1 = new ANonstaticInvokeExp (
       pexpNode2,
       pdottypeNode4,
       tidentifierNode6,
       listNode8
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:33,代码来源:parser.cs


示例5: OutACastExp

        public override void OutACastExp(ACastExp node)
        {
            string toType = ((AAName)((ANamedType) node.GetType()).GetName()).AsString();
            string fromType;
            PType fromPType = data.ExpTypes[node.GetExp()];
            AStructDecl toEnum = null;
            AStructDecl fromEnum = null;

            if (data.StructTypeLinks.ContainsKey((ANamedType)node.GetType()))
            {
                AStructDecl str = data.StructTypeLinks[(ANamedType)node.GetType()];
                if (data.Enums.ContainsKey(str))
                    toEnum = str;
            }
            if (fromPType is ANamedType)
            {
                fromType = ((AAName)((ANamedType)fromPType).GetName()).AsString();
                //Namespace ignored
                if (data.StructTypeLinks.ContainsKey((ANamedType) fromPType))
                {
                    AStructDecl str = data.StructTypeLinks[(ANamedType) fromPType];
                    if (data.Enums.ContainsKey(str))
                        fromEnum = str;
                }
            }
            else
            {
                errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile, LocRM.GetString("ErrorText121")));
                throw new ParserException(node.GetToken(), "Invalid cast");
            }

            if (toEnum != null && (fromType == "int" || fromType == "byte"))
            {
                ANamedType type = new ANamedType(new TIdentifier(toEnum.GetName().Text), null);
                data.StructTypeLinks[type] = toEnum;
                data.ExpTypes[node.GetExp()] = type;
                node.ReplaceBy(node.GetExp());
                return;
            }

            if (fromEnum != null && (toType == "int" || toType == "byte"))
            {
                int enumDefinitions = 0;
                foreach (PLocalDecl local in fromEnum.GetLocals())
                {
                    if (local is AALocalDecl)
                        enumDefinitions++;
                }
                string typeName = enumDefinitions > 255 ? "int" : "byte";
                ANamedType type = new ANamedType(new TIdentifier(typeName), null);
                data.ExpTypes[node.GetExp()] = new ANamedType(new TIdentifier(typeName), null);
                node.ReplaceBy(node.GetExp());
                return;
            }

            if (fromEnum != null && toType == "string")
            {
                AMethodDecl targetMethod = data.StructMethods[fromEnum][0];
                ASimpleInvokeExp invokeExp = new ASimpleInvokeExp(new TIdentifier("toString"), new ArrayList(){node.GetExp()});
                data.SimpleMethodLinks[invokeExp] = targetMethod;
                data.ExpTypes[invokeExp] = targetMethod.GetReturnType();
                node.ReplaceBy(invokeExp);
                return;
            }

            ASimpleInvokeExp replacementMethod = null;
            switch (toType)
            {
                case "string":
                    switch (fromType)
                    {
                        case "wave":
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("AIWaveToString"), new ArrayList{node.GetExp()});
                            break;
                        case "fixed"://Implicit
                            AFieldLvalue precisionArg = new AFieldLvalue(new TIdentifier("c_fixedPrecisionAny"));
                            ALvalueExp exp = new ALvalueExp(precisionArg);
                            data.FieldLinks[precisionArg] =
                                data.Libraries.Fields.First(field => field.GetName().Text == precisionArg.GetName().Text);
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("FixedToString"), new ArrayList { node.GetExp(), exp});
                            break;
                        case "int"://Implicit
                        case "byte"://Implicit
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("IntToString"), new ArrayList { node.GetExp()});
                            break;
                        case "bool"://Implicit
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("libNtve_gf_ConvertBooleanToString"), new ArrayList { node.GetExp() });
                            break;
                        case "color"://Implicit
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("libNtve_gf_ConvertColorToString"), new ArrayList { node.GetExp() });
                            break;
                    }
                    break;
                case "text":
                    switch (fromType)
                    {
                        case "wave":
                            replacementMethod = new ASimpleInvokeExp(new TIdentifier("AIWaveToText"), new ArrayList { node.GetExp() });
                            break;
                        case "fixed"://Implicit
//.........这里部分代码省略.........
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:101,代码来源:TypeChecking.cs


示例6: InALvalueExp

 public virtual void InALvalueExp(ALvalueExp node)
 {
     DefaultIn(node);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:4,代码来源:analysis.cs


示例7: New393

 ArrayList New393()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList6 = (ArrayList) Pop();
     ArrayList nodeArrayList5 = (ArrayList) Pop();
     ArrayList nodeArrayList4 = (ArrayList) Pop();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode9 = new TypedList();
     TValue tvalueNode4 = (TValue)nodeArrayList1[0];
     AValueLvalue plvalueNode3 = new AValueLvalue (
       tvalueNode4
     );
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TArrow tarrowNode6 = (TArrow)nodeArrayList2[0];
     AArrowDotType pdottypeNode5 = new AArrowDotType (
       tarrowNode6
     );
     TIdentifier tidentifierNode7 = (TIdentifier)nodeArrayList3[0];
     TypedList listNode8 = (TypedList)nodeArrayList5[0];
     if ( listNode8 != null )
     {
     listNode9.AddAll(listNode8);
     }
     ANonstaticInvokeExp pexpNode1 = new ANonstaticInvokeExp (
       pexpNode2,
       pdottypeNode5,
       tidentifierNode7,
       listNode9
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:36,代码来源:parser.cs


示例8: CaseAAssignmentExp

 public override void CaseAAssignmentExp(AAssignmentExp node)
 {
     ALvalueExp replacer = new ALvalueExp(node.GetLvalue());
     data.ExpTypes[replacer] = data.LvalueTypes[replacer.GetLvalue()];
     node.ReplaceBy(replacer);
     replacer.Apply(this);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:7,代码来源:TypeChecking.cs


示例9: OutAPointerMultiLvalue

        public override void OutAPointerMultiLvalue(APointerMultiLvalue node)
        {
            ALvalueExp lvalueExp;
            APointerLvalue pointerLvalue = new APointerLvalue((TStar) node.GetTokens()[0], node.GetBase());

            while (node.GetTokens().Count > 0)
            {
                lvalueExp = new ALvalueExp(pointerLvalue);
                pointerLvalue = new APointerLvalue((TStar) node.GetTokens()[0], lvalueExp);
            }

            node.ReplaceBy(pointerLvalue);
            pointerLvalue.Apply(this);
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:14,代码来源:Weeder.cs


示例10: New575

 ArrayList New575()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     PLvalue plvalueNode3 = (PLvalue)nodeArrayList1[0];
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TDot tdotNode5 = (TDot)nodeArrayList2[0];
     ADotDotType pdottypeNode4 = new ADotDotType (
       tdotNode5
     );
     TIdentifier tidentifierNode6 = (TIdentifier)nodeArrayList3[0];
     AStructLvalue plvalueNode1 = new AStructLvalue (
       pexpNode2,
       pdottypeNode4,
       tidentifierNode6
     );
     nodeList.Add(plvalueNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:23,代码来源:parser.cs


示例11: New576

 ArrayList New576()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TThis tthisNode4 = (TThis)nodeArrayList1[0];
     AThisLvalue plvalueNode3 = new AThisLvalue (
       tthisNode4
     );
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TDot tdotNode6 = (TDot)nodeArrayList2[0];
     ADotDotType pdottypeNode5 = new ADotDotType (
       tdotNode6
     );
     TIdentifier tidentifierNode7 = (TIdentifier)nodeArrayList3[0];
     AStructLvalue plvalueNode1 = new AStructLvalue (
       pexpNode2,
       pdottypeNode5,
       tidentifierNode7
     );
     nodeList.Add(plvalueNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:26,代码来源:parser.cs


示例12: New427

 ArrayList New427()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TThis tthisNode3 = (TThis)nodeArrayList1[0];
     AThisLvalue plvalueNode2 = new AThisLvalue (
       tthisNode3
     );
     ALvalueExp pexpNode1 = new ALvalueExp (
       plvalueNode2
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:14,代码来源:parser.cs


示例13: New428

 ArrayList New428()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TValue tvalueNode3 = (TValue)nodeArrayList1[0];
     AValueLvalue plvalueNode2 = new AValueLvalue (
       tvalueNode3
     );
     ALvalueExp pexpNode1 = new ALvalueExp (
       plvalueNode2
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:14,代码来源:parser.cs


示例14: New426

 ArrayList New426()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     PLvalue plvalueNode2 = (PLvalue)nodeArrayList1[0];
     ALvalueExp pexpNode1 = new ALvalueExp (
       plvalueNode2
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:11,代码来源:parser.cs


示例15: New425

 ArrayList New425()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TIdentifier tidentifierNode3 = (TIdentifier)nodeArrayList3[0];
     AStructFieldLvalue plvalueNode2 = new AStructFieldLvalue (
       tidentifierNode3
     );
     ALvalueExp pexpNode1 = new ALvalueExp (
       plvalueNode2
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:16,代码来源:parser.cs


示例16: New422

 ArrayList New422()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode5 = new TypedList();
     TypedList listNode4 = (TypedList)nodeArrayList1[0];
     if ( listNode4 != null )
     {
     listNode5.AddAll(listNode4);
     }
     AAName pnameNode3 = new AAName (
       listNode5
     );
     AAmbiguousNameLvalue plvalueNode2 = new AAmbiguousNameLvalue (
       pnameNode3
     );
     ALvalueExp pexpNode1 = new ALvalueExp (
       plvalueNode2
     );
     nodeList.Add(pexpNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:22,代码来源:parser.cs


示例17: GetTargets

        public static void GetTargets(string name,
            Token node,
            Node reciever, //Either null, AAName, or PExp
            PType returnType, //Either null, or Some type the method return type must be assignable to
            List<PType> argTypes,
            List<AMethodDecl> candidates,
            out bool matchArrayResize,
            List<AMethodDecl> implicitCandidates,
            List<AMethodDecl> matchingNames,
            out PExp baseExp,
            List<AMethodDecl> matchingDelegates,
            SharedData data,
            ErrorCollection errors
            )
        {
            baseExp = null;
            matchArrayResize = false;
            if (reciever == null)
            {//A simple invoke
                //Look in current struct
                //Look in all visible namespaces
                //Look in library methods
                AStructDecl currentStruct = Util.GetAncestor<AStructDecl>(node);
                if (currentStruct != null)
                {
                    foreach (AMethodDecl methodDecl in data.StructMethods[currentStruct])
                    {
                        if (methodDecl.GetName().Text == name &&
                            methodDecl.GetFormals().Count == argTypes.Count &&
                            methodDecl.GetDelegate() == null)
                        {
                            matchingNames.Add(methodDecl);

                            //Visibility
                            if (methodDecl.GetVisibilityModifier() is APrivateVisibilityModifier &&
                                Util.GetAncestor<AStructDecl>(methodDecl) != currentStruct)
                                continue;
                            if (methodDecl.GetVisibilityModifier() is AProtectedVisibilityModifier &&
                                !Util.Extends(Util.GetAncestor<AStructDecl>(methodDecl), currentStruct, data))
                                continue;
                            if (methodDecl.GetStatic() == null &&
                                Util.IsStaticContext(node))
                                continue;

                            //Check return type
                            if (returnType != null && !(returnType is AVoidType) &&
                                !Assignable(methodDecl.GetReturnType(), returnType))
                                continue;

                            //Check that parameters are assignable
                            bool add = true;
                            bool matchImplicit = false;
                            for (int i = 0; i < argTypes.Count; i++)
                            {
                                PType argType = argTypes[i];
                                AALocalDecl formal = (AALocalDecl) methodDecl.GetFormals()[i];
                                PType formalType = formal.GetType();
                                if (formal.GetOut() != null && !Assignable(formalType, argType)
                                    ||
                                    formal.GetRef() != null &&
                                    !(Assignable(argType, formalType) && Assignable(formalType, argType))
                                    ||
                                    formal.GetOut() == null && formal.GetRef() == null &&
                                    !Assignable(argType, formalType))
                                {
                                    add = false;
                                    if (formal.GetOut() == null && formal.GetRef() == null &&
                                        ImplicitAssignable(argType, formalType))
                                    {
                                        matchImplicit = true;
                                    }
                                    else
                                    {
                                        matchImplicit = false;
                                        break;
                                    }
                                }
                            }
                            if (!add && !matchImplicit)
                                continue;
                            if (candidates.Count == 0)
                            {//Set base exp
                                if (methodDecl.GetStatic() != null)
                                {
                                    //Calling static method
                                    baseExp = null;
                                }
                                else if (currentStruct.GetClassToken() != null || Util.HasAncestor<AConstructorDecl>(node) || Util.HasAncestor<ADeconstructorDecl>(node))
                                {//Dynamic context
                                    baseExp = new ALvalueExp(new APointerLvalue(new TStar("*"),
                                                                 new ALvalueExp(new AThisLvalue(new TThis("this")))));
                                }
                                else
                                {//Struct method to struct method
                                    baseExp = null;
                                }
                            }
                            if (add)
                                candidates.Add(methodDecl);
                            if (matchImplicit)
//.........这里部分代码省略.........
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:101,代码来源:TypeChecking.cs


示例18: New583

 ArrayList New583()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode6 = new TypedList();
     TypedList listNode5 = (TypedList)nodeArrayList1[0];
     if ( listNode5 != null )
     {
     listNode6.AddAll(listNode5);
     }
     AAName pnameNode4 = new AAName (
       listNode6
     );
     AAmbiguousNameLvalue plvalueNode3 = new AAmbiguousNameLvalue (
       pnameNode4
     );
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TArrow tarrowNode8 = (TArrow)nodeArrayList2[0];
     AArrowDotType pdottypeNode7 = new AArrowDotType (
       tarrowNode8
     );
     TIdentifier tidentifierNode9 = (TIdentifier)nodeArrayList3[0];
     AStructLvalue plvalueNode1 = new AStructLvalue (
       pexpNode2,
       pdottypeNode7,
       tidentifierNode9
     );
     nodeList.Add(plvalueNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:34,代码来源:parser.cs


示例19: OutALvalueExp

 public override void OutALvalueExp(ALvalueExp node)
 {
     if (!(node.GetLvalue() is AAmbiguousNameLvalue ||
         node.GetLvalue() is ANamespaceLvalue ||
         node.GetLvalue() is ATypeLvalue))
         if (node.Parent() != null) //If I havent been replaced
             data.ExpTypes[node] = data.LvalueTypes[node.GetLvalue()];
     base.OutALvalueExp(node);
 }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:9,代码来源:TypeChecking.cs


示例20: New589

 ArrayList New589()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TValue tvalueNode4 = (TValue)nodeArrayList1[0];
     AValueLvalue plvalueNode3 = new AValueLvalue (
       tvalueNode4
     );
     ALvalueExp pexpNode2 = new ALvalueExp (
       plvalueNode3
     );
     TArrow tarrowNode6 = (TArrow)nodeArrayList2[0];
     AArrowDotType pdottypeNode5 = new AArrowDotType (
       tarrowNode6
     );
     TIdentifier tidentifierNode7 = (TIdentifier)nodeArrayList3[0];
     AStructLvalue plvalueNode1 = new AStructLvalue (
       pexpNode2,
       pdottypeNode5,
       tidentifierNode7
     );
     nodeList.Add(plvalueNode1);
     return nodeList;
 }
开发者ID:cg-source,项目名称:GalaxyEditorPlusPlus,代码行数:26,代码来源:parser.cs



注:本文中的Galaxy_Editor_2.Compiler.Generated.node.ALvalueExp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# node.AMethodDecl类代码示例发布时间:2022-05-26
下一篇:
C# ViewModel.TestViewModel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap