Exemple #1
0
        public override void Visit(TypeRhs e)
        {
            UserDefinedType t = null;

            if (e.Type is UserDefinedType type)
            {
                t = type;
            }

            if (t == null)
            {
                return;
            }

            var nav         = new SymbolNavigator();
            var declaration = nav.GetSymbolAtPosition(RootNode, t.ResolvedClass.tok);

            CreateSymbol(
                name: t.Name,
                kind: Kind.Class,
                type: e.Type,

                positionAsToken: t.tok,
                bodyStartPosAsToken: e.Tok,  //"new"
                bodyEndPosAsToken: t.tok,    //ClassName

                isDeclaration: false,
                declarationSymbol: declaration,
                addUsageAtDeclaration: true,

                canHaveChildren: false,
                canBeUsed: false
                );
        }
Exemple #2
0
 public virtual void Visit(TypeRhs typeRhs)
 {
     VisitNullableAttributes(typeRhs.Attributes);
     if (typeRhs.Bindings != null)
     {
         Visit(typeRhs.Bindings);
     }
     if (typeRhs.ArrayDimensions != null)
     {
         foreach (var dimension in typeRhs.ArrayDimensions)
         {
             Visit(dimension);
         }
     }
 }
 public virtual void Visit(TypeRhs typeRhs)
 {
     VisitNullableAttributes(typeRhs.Attributes);
     if (typeRhs.Arguments != null)
     {
         foreach (var argument in typeRhs.Arguments)
         {
             Visit(argument);
         }
     }
     if (typeRhs.ArrayDimensions != null)
     {
         foreach (var dimension in typeRhs.ArrayDimensions)
         {
             Visit(dimension);
         }
     }
 }
Exemple #4
0
        void Rhs(out AssignmentRhs r)
        {
            Contract.Ensures(Contract.ValueAtReturn<AssignmentRhs>(out r) != null);
            IToken/*!*/ x, newToken;  Expression/*!*/ e;
            Type ty = null;
            List<Expression> ee = null;
            List<Expression> args = null;
            r = dummyRhs;  // to please compiler
            Attributes attrs = null;

            if (la.kind == 97) {
            Get();
            newToken = t;
            TypeAndToken(out x, out ty);
            if (la.kind == 48 || la.kind == 50) {
                if (la.kind == 48) {
                    Get();
                    ee = new List<Expression>();
                    Expressions(ee);
                    Expect(49);
                    var tmp = theBuiltIns.ArrayType(ee.Count, new IntType(), true);

                } else {
                    x = null; args = new List<Expression/*!*/>();
                    Get();
                    if (StartOf(7)) {
                        Expressions(args);
                    }
                    Expect(51);
                }
            }
            if (ee != null) {
             r = new TypeRhs(newToken, ty, ee);
            } else if (args != null) {
             r = new TypeRhs(newToken, ty, args, false);
            } else {
             r = new TypeRhs(newToken, ty);
            }

            } else if (la.kind == 57) {
            Get();
            r = new HavocRhs(t);
            } else if (StartOf(7)) {
            Expression(out e, false, true);
            r = new ExprRhs(e);
            } else SynErr(197);
            while (la.kind == 46) {
            Attribute(ref attrs);
            }
            r.Attributes = attrs;
        }
 public override void Leave(TypeRhs e)
 {
 }
 public override void Visit(TypeRhs e)
 {
 }
Exemple #7
0
 public virtual AssignmentRhs CloneRHS(AssignmentRhs rhs) {
   AssignmentRhs c;
   if (rhs is ExprRhs) {
     var r = (ExprRhs)rhs;
     c = new ExprRhs(CloneExpr(r.Expr));
   } else if (rhs is HavocRhs) {
     c = new HavocRhs(Tok(rhs.Tok));
   } else {
     var r = (TypeRhs)rhs;
     if (r.ArrayDimensions != null) {
       c = new TypeRhs(Tok(r.Tok), CloneType(r.EType), r.ArrayDimensions.ConvertAll(CloneExpr));
     } else if (r.Arguments == null) {
       c = new TypeRhs(Tok(r.Tok), CloneType(r.EType));
     } else {
       c = new TypeRhs(Tok(r.Tok), CloneType(r.Path), r.Arguments.ConvertAll(CloneExpr), false);
     }
   }
   c.Attributes = CloneAttributes(rhs.Attributes);
   return c;
 }
Exemple #8
0
 public override void Visit(TypeRhs typeRhs)
 {
     _cancellationToken.ThrowIfCancellationRequested();
     RegisterTypeDesignator(_currentScope, typeRhs.EType);
     base.Visit(typeRhs);
 }