public override void OnRounding() { LifeTime--; if (LifeTime == 0) { This.GetComponent <Controller>().StartCoroutine(Coroutine()); } }
public object VisitThisExpr(This expr) { if (_callingBodyStack.Contains(CallingBody.CLASS) && _callingBodyStack.Contains(CallingBody.FUNCTION)) { return(null); } throw new SemanticError(expr.Keyword, "'this' must be used inside of a class"); }
public void ThrowIfNullOrEmpty_EmptyString_ThrowException() { string param = string.Empty; var ex = This.Action(() => VkErrors.ThrowIfNullOrEmpty(() => param)).Throws <ArgumentNullException>(); ex.Message.ShouldStartsWith("Значение не может быть неопределенным").ShouldContains("param"); }
public void GetDialogs_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var cat = new MessagesCategory(new VkApi()); int totalCount; int unreadCount; This.Action(() => cat.GetDialogs(out totalCount, out unreadCount, 0, 201)).Throws <AccessTokenInvalidException>(); }
public void should_correctly_calculate_this_year_start() { var tense = new This(); var place = new Start(); var unit = new Year(_dateTime); var dt = unit.GetDateTime(tense, place); Assert.That(dt, Is.EqualTo(_thisYearStart)); }
public void ThrowIfNullOrEmpty_EmptyString_ThrowException() { string param = string.Empty; var ex = This.Action(() => VkErrors.ThrowIfNullOrEmpty(() => param)).Throws <ArgumentNullException>(); ex.Message.ShouldStartsWith("Value cannot be null").ShouldContains("param"); }
public void Send_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var cat = new MessagesCategory(new VkApi()); This.Action(() => cat.Send(new MessageSendParams { UserId = 1, Message = "Привет, Паша!" })).Throws <AccessTokenInvalidException>(); }
public void should_correctly_calculate_this_hour_end() { var tense = new This(); var place = new End(); var unit = new Hour(_dateTime); var dt = unit.GetDateTime(tense, place); Assert.That(dt, Is.EqualTo(_thisHourEnd)); }
public void AreFriends_NullInput_ThrowArgumentNullException() { var f = new FriendsCategory(new VkApi { AccessToken = "token" }); This.Action(() => f.AreFriends(null)).Throws <ArgumentNullException>(); }
public override void Invoke() { Schedule(This.Enqueue(), new DateTime(1, 1, 1, 0, 10, 20)); Schedule(This.UpdToDequeue(false), new DateTime(1, 1, 1, 0, 10, 40)); Schedule(This.Enqueue(), new DateTime(1, 1, 1, 0, 11, 20)); Schedule(This.Enqueue(), new DateTime(1, 1, 1, 0, 12, 20)); Schedule(This.UpdToDequeue(true), new DateTime(1, 1, 1, 0, 13, 40)); }
void Session_InputItemQueueProgress(InputItemQueue input_item_queue, int total_item_count, int processed_item_count) { This.DisplayStatus(input_item_queue.Name, "taken " + processed_item_count.ToString() + " /remain " + (total_item_count - processed_item_count).ToString()); if (ProgressBarInputItemQueueName == input_item_queue.Name) { This.display_progress(total_item_count, processed_item_count); } }
public void Set_TextIsNull_ThrowArgumentNullException() { var status = new StatusCategory(new VkApi { AccessToken = "token" }); This.Action(() => status.Set(null)).Throws <ArgumentNullException>(); }
[Test, Ignore] // TODO important: strange error, with nullable long everytihng ok, check later on windows OS public void ThrowIfNumberIsNegative_ExpressionVersion_Long() { const long paramName = -1; var ex = This.Action(() => VkErrors.ThrowIfNumberIsNegative(() => paramName)).Throws <ArgumentException>(); ex.Message.ShouldStartsWith("Отрицательное значение.").ShouldContains("paramName"); }
public override Expression VisitThis(This This) { if (this._string == null) { this._string = new StringBuilder(); } this._string.Append("this"); return(This); }
public void should_correctly_calculate_this_day_start() { var tense = new This(); var place = new Start(); var unit = new Day(); var dt = unit.GetDateTime(tense, place); var dateTime = DateTime.UtcNow.Date; Assert.That(dt, Is.EqualTo(dateTime)); }
public virtual void VisitThis(This node) { if (node == null) { return; } VisitTypeNode(node.Type); }
public string[] GetValidPrefixes(string[] prefixes, string culture) { var messages = This.GetAll(); return(prefixes .Where(y => messages.Any(x => x.Code.StartsWith(y) && (string.IsNullOrEmpty(culture) || culture.Equals(x.Culture, StringComparison.CurrentCultureIgnoreCase)) && x.IsEnable)) .ToArray()); }
//resolve expressions public override AstNode VisitThis(This ast) { if (m_currentMethod.IsStatic) { AddError(c_SE_ThisInStaticMethod, ast.ThisSpan); } ast.ExpressionType = m_currentType; return(ast); }
public override Type visitThis(This @this, Environment env) { if (env.enclStruct == null) { log.error(@this.Pos, messages.thisInFreeFunction); return(symtab.errorType); } return(env.enclStruct.type); }
public void should_correctly_calculate_this_day_end() { var tense = new This(); var place = new End(); var unit = new Day(); var dt = unit.GetDateTime(tense, place); var dateTime = DateTime.UtcNow.Date.AddDays(1).AddMilliseconds(-1); Assert.That(dt, Is.EqualTo(dateTime)); }
/// <summary> /// Runs the command with the specified arguments. /// </summary> protected override void RunCommand() { var document = OpenDocument(Arguments); if (document != null) { This.GetService <IDocumentManagerService>(true).OpenDocument(document); } }
//get notified before set value - use it even if same value private static object OnCoerceValue(DependencyObject d, object baseValue) { if (d is FadingAutoZoomingLabelControl This) { This.TextBlock_TextUpdated(d, null); } return(baseValue); }
public IndexLastDayTimeValue GetOverallIndexLastValue() { long[] topCodes = new long[] { Constants.KnownInstruments.Overall_Index, }; var values = This.GetLastDay(topCodes); return(values.OrderByDescending(x => x.Dt).FirstOrDefault()); }
public bool IsWorkingDay(DateTime date) { if (date.DayOfWeek == DayOfWeek.Friday || date.DayOfWeek == DayOfWeek.Thursday) { return(false); } var holidays = This.GetAll(); return(!holidays.Any(x => x.Date == date.Date)); }
protected void M(This other) { Use(this); this.M(this); M(this); Use(other); this.M(other); M(other); new This(); }
public int DeleteAndCommitForever(long id) { var entity = This.FirstOrDefault(o => o.Id == id); if (entity != null) { This.Remove(entity); } return(Db.SaveChanges()); }
public Task <int> DeleteAndCommitForeverAsync(long id) { var entity = This.FirstOrDefaultAsync(o => o.Id == id); if (entity.Result != null) { This.Remove(entity.Result); } return(Db.SaveChangesAsync()); }
public object VisitThisExpr(This expr) { if (_currentClass == ClassType.NONE) { _lox.Error(expr.Keyword, "Can't use 'this' outside of a class."); return(null); } ResolveLocal(expr, expr.Keyword); return(null); }
public int HolidaysCountBetweenTwoDate(DateTime fromDate, DateTime toDate, bool includeFriday = false) { var holidaysCount = This.GetAll().Count(x => x.Date.Date >= fromDate.Date && x.Date.Date <= toDate.Date); if (includeFriday) { holidaysCount += CountDays(DayOfWeek.Friday, fromDate.Date, toDate.Date); } return(holidaysCount); }
public virtual Expression VisitThis(This node) { if (node == null) { return(null); } node.Type = VisitTypeNode(node.Type); return(node); }
public static void Display() { if (This.Visibility == Visibility.Visible) { This.Close(); return; } This.Show(); This.Activate(); This.WindowState = WindowState.Normal; }
internal static RequestContext get_RequestContext(this HttpRequest t) { var @this = This.Get(t); if (@this._requestContext == null) { HttpContext httpContext = @this.Context ?? HttpContext.Current; @this._requestContext = new RequestContext(new HttpContextWrapper(httpContext), new RouteData()); } return(@this._requestContext); }
public virtual TEntity GetById(long id) { var predicate = PredicateBuilder.New <TEntity>(); predicate.Start(_predicate); var e = DynamicExpressionParser.ParseLambda(typeof(TEntity), typeof(bool), "Id = @0", id) as Expression <Func <TEntity, bool> >; predicate.And(e); //predicate.And(o => o.Id == id); return(This.FirstOrDefault(_predicate)); }
public OptionsDialog() { InitializeComponent(); var layoutService = This.GetService <ILayoutService>(); if (layoutService != null) { layoutService.RegisterForm("OPTIONS", this); } }
public virtual Expression VisitThis (This node) { if (node == null) return null; node.Type = VisitTypeNode (node.Type); return node; }
public virtual void VisitThis (This node) { if (node == null) return; VisitTypeNode (node.Type); }
protected virtual MemberList GetMembers(int line, int col, This thisNode, Scope scope, bool doingCompletion) { if (thisNode == null || scope == null || !(thisNode.Type is Class)) return null; if (thisNode.IsCtorCall) return ((Class)thisNode.Type).GetConstructors(); else return ((Class)thisNode.Type).DefaultMembers; }
/// <summary> /// Implements the runtime check for invariants of class C. Also implements the runtime check for modelfields. /// ensures: If c declares invariants or modelfields, then c.Contract.InvariantMethod contains their runtime checking code; /// Adds the CheckInvariant method to c.Members if it wasn't a member already. /// </summary> void ImplementCheckInvariantMethod(Class c) { // c is the class to which all of this code is going to get attached to. Method m = null; #region Get a handle m on the invariant method, create one if necessary if (c.Contract == null || c.Contract.InvariantMethod == null) { Method invariantMethod = new Method( c, new AttributeList(), Identifier.For("SpecSharp::CheckInvariant"), new ParameterList(new Parameter(Identifier.For("throwException"), SystemTypes.Boolean)), SystemTypes.Boolean, null); invariantMethod.CallingConvention = CallingConventionFlags.HasThis; invariantMethod.Flags = MethodFlags.Private; m = invariantMethod; } else m = c.Contract.InvariantMethod; #endregion Get a handle on the invariant method, create one if necessary StatementList stmts = new StatementList(); #region Create code for all of the invariants, implicit and explicit. Add that code to stmts. Parameter throwException = m.Parameters[0]; InvariantList consolidatedInvariants = new InvariantList(); InvariantList invariants = c.Contract == null ? null : c.Contract.Invariants; for (int i = 0, n = invariants == null ? 0 : invariants.Count; i < n; i++) if (!invariants[i].IsStatic) consolidatedInvariants.Add(invariants[i]); // InterfaceList ifaces = this.GetTypeView(c).Interfaces; InterfaceList ifaces = c.Interfaces; for (int i = 0, n = ifaces.Count; i < n; i++){ Interface iface = ifaces[i]; if (iface == null) continue; GatherInheritedInstanceInvariants(iface, consolidatedInvariants); } for (int i = 0; i < consolidatedInvariants.Count; i++){ Invariant inv = consolidatedInvariants[i]; stmts.Add(new If(new UnaryExpression(inv.Condition, NodeType.LogicalNot, SystemTypes.Boolean), new Block(new StatementList( new If(throwException, new Block(new StatementList( new Throw(new Construct(new MemberBinding(null, SystemTypes.ObjectInvariantException.GetConstructor()), null, SystemTypes.ObjectInvariantException), inv.SourceContext) )), new Block(new StatementList(new Return(Literal.False)))))), null)); } #endregion #region Create code for all of the modelfields defined by c. Add that code to stmts. StatementList mfStats = new StatementList(); ExpressionList modifiesList = new ExpressionList(); // synthesize modifies clause foreach (ModelfieldContract mfC in c.Contract.ModelfieldContracts) { //Add the following code to the method: // if (!E) { // <mfC.Modelfield> = value(mfC.Witness); // if (!E) throw exception; // } //where E is the conjunction of (1) all satisfies clauses of the contract, and (2) all satisfies clauses of overridden contracts in superclasses. //Note that satisifes clauses of contracts implemented by mfC (i.e., contracts in interfaces) have been copied to mfC. //Note that if f in C overrides f in D, and f in D overrides f in E, then f in C overrides f in E. Expression E = Literal.True; for (ModelfieldContract currentMfC = mfC; currentMfC != null; currentMfC = currentMfC.NearestOverriddenContract) { foreach (Expression satClause in currentMfC.SatisfiesList) { if (satClause == null) continue; //error will have been dealt with elsewhere E = new BinaryExpression(satClause, E, NodeType.LogicalAnd, SystemTypes.Boolean); } } Expression notE = new UnaryExpression(E, NodeType.LogicalNot, SystemTypes.Boolean); #region create the if statement //Start with the creation of the body of the if. MemberBinding lhs = new MemberBinding(new This(c), mfC.Modelfield); Statement setF = new AssignmentStatement(lhs, mfC.Witness); modifiesList.Add(lhs); // synthesize modifies clause String mfAsString = mfC.Modelfield.FullName; MemberBinding exc = new MemberBinding(null,SystemTypes.ModelfieldException.GetConstructor(SystemTypes.String)); Construct exception = new Construct(exc, new ExpressionList(new Literal(mfAsString,SystemTypes.String)), SystemTypes.ModelfieldException); Block innerIfBody = new Block(new StatementList( new If(throwException, new Block(new StatementList( new Throw(exception, mfC.Modelfield.SourceContext) )), new Block(new StatementList(new Return(Literal.False)))))); Statement innerIf = new If(notE, innerIfBody, null); StatementList body = new StatementList(); body.Add(setF); body.Add(innerIf); Statement outerIf = new If(notE, new Block(body), null); #endregion mfStats.Add(outerIf); } #endregion #region If c declares invariants or modelfields, then add a contract to c if it has none, and make sure that m is c's InvariantMethod. if (stmts.Count > 0 || mfStats.Count > 0) { Duplicator dup = new Duplicator(this.currentModule, this.currentType); dup.DuplicateFor[throwException.UniqueKey] = throwException; stmts = dup.VisitStatementList(stmts); mfStats = dup.VisitStatementList(mfStats); m.Body = new Block(stmts); m.Body.Statements.Add(new Block(mfStats)); //The model field code should be wrapped in a ContractMarkerException block, but I can't get it to work m.Body.Statements.Add(new Return(Literal.True)); m.Body.HasLocals = true; //who knows? there might be locals in the invariants or model fields (quantifier bound variables). #region Slap on NoDefaultContract and (what is roughly the equivalent of) a requires this.PreValid. //I doubt if this is still needed //No need for a runtime check of this precondition though, so directly add an attribute. //Bit of a hack, but there does not seem to be a really good place to do this. InstanceInitializer ndCtor = SystemTypes.NoDefaultContractAttribute.GetConstructor(); if (ndCtor != null) m.Attributes.Add(new AttributeNode(new MemberBinding(null, ndCtor), null, AttributeTargets.Method)); TypeNode guard = SystemTypes.Guard; if (guard != null) { Method method = guard.GetMethod(Identifier.For("FrameIsPrevalid"), SystemTypes.Object, SystemTypes.Type); if (method != null) { This t = new This(c); Expression req = new MethodCall( new MemberBinding(null, method), new ExpressionList(t, new UnaryExpression(new Literal(t.Type, SystemTypes.Type), NodeType.Typeof, OptionalModifier.For(SystemTypes.NonNullType, SystemTypes.Type)))); // Place it in the method contract so downstream tools that are in the compiler pipeline see it if (m.Contract == null) { m.Contract = new MethodContract(m); } if (m.Contract.Requires == null) { m.Contract.Requires = new RequiresList(1); } m.Contract.Requires.Add(new RequiresPlain(req)); m.Contract.Modifies = modifiesList; // needed for model fields // Since this happens after contracts are serialized, serialize the precondition and stick it in the method's attributes. ContractSerializer cs = new ContractSerializer(this.currentModule); cs.Visit(req); string val = cs.SerializedContract; InstanceInitializer ctor = SystemTypes.RequiresAttribute.GetConstructor(SystemTypes.String); MemberBinding attrBinding = new MemberBinding(null, ctor); ExpressionList args = new ExpressionList(); args.Add(new Literal(val, SystemTypes.String)); AttributeNode a = new AttributeNode(attrBinding, args, (AttributeTargets)0); m.Attributes.Add(a); if (modifiesList.Count > 0) { ctor = SystemTypes.ModifiesAttribute.GetConstructor(SystemTypes.String); for (int i = 0, n = modifiesList.Count; i < n; i++) { Expression e = modifiesList[i]; a = Checker.SerializeExpression(ctor, e, this.currentModule); m.Attributes.Add(a); } } } } #endregion if (c.Contract == null) { c.Contract = new TypeContract(c); c.Contract.DeclaringType = c; } if (c.Contract.InvariantMethod == null) { c.Contract.InvariantMethod = m; c.Members.Add(m); } //else assert (m == c.Contract.InvairantMethod) } #endregion }
//resolve expressions public override AstNode VisitThis(This ast) { if (m_currentMethod.IsStatic) { m_errorManager.AddError(c_SE_ThisInStaticMethod, ast.ThisSpan); } ast.ExpressionType = m_currentType; return ast; }
public override Method VisitMethod(Method method) { if (method == null) return null; if (method.IsNormalized) return method; if (method.CciKind != CciMemberKind.Regular) { method.Attributes.Add(new AttributeNode(new MemberBinding(null, SystemTypes.CciMemberKindAttribute.GetConstructor(SystemTypes.CciMemberKind)), new ExpressionList(new Literal(method.CciKind, SystemTypes.CciMemberKind)), AttributeTargets.Method)); } method.IsNormalized = true; method.Attributes = this.VisitAttributeList(method.Attributes); if (method.ReturnAttributes == null) method.ReturnAttributes = new AttributeList(); else method.ReturnAttributes = this.VisitAttributeList(method.ReturnAttributes); AttributeList al = this.ExtractAttributes(method.Attributes, AttributeTargets.ReturnValue); for (int i = 0, n = al == null ? 0 : al.Count; i < n; i++){ method.ReturnAttributes.Add(al[i]); } method.SecurityAttributes = this.VisitSecurityAttributeList(method.SecurityAttributes); if (method.Attributes != null && method.Attributes.Count > 0) { SecurityAttributeList secAttrs = method.SecurityAttributes; this.ExtractSecurityAttributes(method.Attributes, ref secAttrs); method.SecurityAttributes = secAttrs; } if (method.SecurityAttributes != null && method.SecurityAttributes.Count > 0) method.Flags |= MethodFlags.HasSecurity; Method savedMethod = this.currentMethod; This savedThisParameter = this.currentThisParameter; Local savedReturnLocal = this.currentReturnLocal; Block savedReturnLabel = this.currentReturnLabel; Local savedClosureLocal = this.currentClosureLocal; Block savedContractPrelude = this.currentContractPrelude; BlockList savedContractExceptionalTerminationChecks = this.currentContractExceptionalTerminationChecks; Local savedcurrentExceptionalTerminationException = this.currentExceptionalTerminationException; Block savedContractNormalTerminationCheck = this.currentContractNormalTerminationCheck; Block savedParentBlock = null; this.currentMethod = method; this.currentThisParameter = method.ThisParameter; if (method.ThisParameter != null) { method.ThisParameter.DeclaringMethod = method; if (method.DeclaringType != null && method.DeclaringType.IsValueType) method.ThisParameter.Type = method.DeclaringType.GetReferenceType(); } this.currentReturnLabel = new Block(new StatementList()); this.currentClosureLocal = null; this.currentContractPrelude = new Block(new StatementList()); this.currentContractExceptionalTerminationChecks = new BlockList(); this.currentExceptionalTerminationException = new Local(Identifier.For("SS$caught_exception"), SystemTypes.Exception); this.currentContractNormalTerminationCheck = new Block(new StatementList()); if (TypeNode.StripModifiers(method.ReturnType) == SystemTypes.Void) this.currentReturnLocal = null; else this.currentReturnLocal = new Local(Identifier.For("return value"), method.ReturnType); method.Parameters = this.VisitParameterList(method.Parameters); method.TemplateArguments = this.VisitTypeReferenceList(method.TemplateArguments); method.TemplateParameters = this.VisitTypeParameterList(method.TemplateParameters); TypeNodeList tpars = method.TemplateParameters; if (!method.IsGeneric){ for (int i = 0, n = tpars == null ? 0 : tpars.Count; i < n; i++){ TypeNode tpar = tpars[i]; if (tpar == null) continue; tpar.Name = new Identifier(method.Name+":"+tpar.Name, tpar.SourceContext); tpar.DeclaringType = method.DeclaringType; method.DeclaringType.Members.Add(tpar); } } if (method.Template == null) { // skip this part for instance methods. Block closureInit = null; bool methodHasClosure = method.Scope != null && method.Scope.CapturedForClosure; if (methodHasClosure) this.SetUpClosureClass(method); // Normalizer.VisitRequiresList needs to be called in case it wants to generate // some default preconditions (that are not injected by Checker in order to not // have these preconditions seen by any static checking tools). If there is // no contract on this method, then it won't get called, so create a dummy // contract and Requires list just so it will get a chance to do its stuff. if (method.Contract == null) { method.Contract = new MethodContract(method); method.Contract.Requires = new RequiresList(); } if (!methodHasClosure || (method is InstanceInitializer)) { // ctors will construct the closure class instance after they call another ctor, since they need to pass in "this" as a parameter to the closure class constructor method.Contract = this.VisitMethodContract(method.Contract); method.Body = this.VisitBlock(method.Body); }else{ method.Contract = this.VisitMethodContract(method.Contract); Block b = this.CreateClosureClassInstance(method); method.Body = this.VisitBlock(method.Body); savedParentBlock = method.Body; closureInit = b; if (method.Body != null){ closureInit.SourceContext = method.Body.SourceContext; method.Body.HasLocals = true; } } { #region If this method has a contract, then modify its body to add the contracts at the right point if (method.Body != null && method.Body.Statements != null){ if (this.currentContractExceptionalTerminationChecks.Count > 0){ // then wrap the body into a try catch with these checks as the catch blocks Block b = new Block(new StatementList(this.currentContractExceptionalTerminationChecks.Count)); b.HasLocals = true; for (int i = 0, n = this.currentContractExceptionalTerminationChecks.Count; i < n; i++) { b.Statements.Add(this.currentContractExceptionalTerminationChecks[i]); } #region Rethrow caught exception // last "functional" thing in the block is re-throw whatever exception we caught. Throw t = new Throw(); t.NodeType = NodeType.Rethrow; b.Statements.Add(t); #endregion LocalList ls = new LocalList(1); this.currentExceptionalTerminationException.DeclaringBlock = b; ls.Add(this.currentExceptionalTerminationException); BlockList bs = new BlockList(1); bs.Add(b); Block newBody = CreateTryCatchBlock(method, method.Body, bs, ls); //Block newBody = CreateTryCatchBlock(method,method.Body,this.currentContractExceptionalTerminationChecks,this.currentContractExceptionalLocals); method.Body = newBody; } if (this.currentContractPrelude.Statements.Count > 0){ Block newBody = new Block(new StatementList(3)); // Wrap the contract prelude in a block with a dummy catch block. // It has a special handler type that lets downstream tools know // this block was not part of the original code. Throw t = new Throw(); t.NodeType = NodeType.Rethrow; this.currentContractPrelude = CreateTryCatchBlock( method, this.currentContractPrelude, // try body new Block(new StatementList(t)), // catch: just rethrow new Local(Identifier.For("SS$Contract Marker"), SystemTypes.ContractMarkerException) ); newBody.Statements.Add(closureInit); closureInit = null; newBody.Statements.Add(this.currentContractPrelude); newBody.Statements.Add(method.Body); method.Body = newBody; } } } #endregion if (closureInit != null){ closureInit.Statements.Add(method.Body); method.Body = closureInit; } if (method.Body != null && method.Body.Statements != null){ Return r = new Return(); r.Expression = this.currentReturnLocal; Block returnBlock = new Block(new StatementList()); returnBlock.Statements.Add(this.currentReturnLabel); { InstanceInitializer ctor = method as InstanceInitializer; if (ctor != null && method.DeclaringType.Contract != null && method.DeclaringType.Contract.FrameField != null && !ctor.IsDeferringConstructor){ // then add a Pack to the end // BUGBUG: if the programmer has indicated that this default shouldn't apply, then don't do this! SourceContext rightBrace = new SourceContext(method.SourceContext.Document, method.SourceContext.EndPos - 1, method.SourceContext.EndPos); returnBlock.Statements.Add( new ExpressionStatement( new MethodCall(new MemberBinding(new MethodCall(new MemberBinding(method.ThisParameter, method.DeclaringType.Contract.FramePropertyGetter), null, NodeType.Call, OptionalModifier.For(SystemTypes.NonNullType, SystemTypes.Guard)), SystemTypes.Guard.GetMethod(Identifier.For("EndWriting"))), null, NodeType.Call, SystemTypes.Void), rightBrace )); } if (this.currentContractNormalTerminationCheck.Statements.Count > 0){ // Wrap the contract normal termination checks in a block with a dummy catch block. // It has a special handler type that lets downstream tools know this block was not // part of the original code. Throw t = new Throw(); t.NodeType = NodeType.Rethrow; this.currentContractNormalTerminationCheck = CreateTryCatchBlock( method, this.currentContractNormalTerminationCheck, // try body new Block(new StatementList(t)), // catch: just rethrow new Local(Identifier.For("SS$Contract Marker"),SystemTypes.ContractMarkerException) ); returnBlock.Statements.Add(this.currentContractNormalTerminationCheck); } } if (this.currentReturnLocal != null){ Local displayReturnLocal = new Local(Identifier.For("SS$Display Return Local"), method.ReturnType); returnBlock.Statements.Add(new AssignmentStatement(displayReturnLocal, this.currentReturnLocal)); returnBlock.HasLocals = true; } returnBlock.Statements.Add(r); if (method.Body.SourceContext.Document != null){ r.SourceContext = method.SourceContext; r.SourceContext.StartPos = method.Body.SourceContext.EndPos-1; } if (savedParentBlock != null){ if (savedParentBlock.Statements == null) savedParentBlock.Statements = new StatementList(1); savedParentBlock.Statements.Add(returnBlock); }else method.Body.Statements.Add(returnBlock); } if (method.ImplementedInterfaceMethods != null && method.ImplementedInterfaceMethods.Count > 0 && method.ImplementedInterfaceMethods[0] != null){ string typeName = method.ImplementedInterfaceMethods[0].DeclaringType.GetFullUnmangledNameWithTypeParameters(); method.Name = new Identifier(typeName + "." + method.Name.ToString(), method.Name.SourceContext); } if (method.HasCompilerGeneratedSignature && method.Parameters != null){ if (method.Parameters.Count == 1 && (method.Parameters[0].Attributes == null || method.Parameters[0].Attributes.Count == 0)) method.Parameters[0].Attributes = this.ExtractAttributes(method.Attributes, AttributeTargets.Parameter); else if (method.Parameters.Count == 2 && (method.Parameters[1].Attributes == null || method.Parameters[1].Attributes.Count == 0)) method.Parameters[1].Attributes = this.ExtractAttributes(method.Attributes, AttributeTargets.Parameter); } } this.currentMethod = savedMethod; this.currentThisParameter = savedThisParameter; this.currentReturnLocal = savedReturnLocal; this.currentReturnLabel = savedReturnLabel; this.currentClosureLocal = savedClosureLocal; this.currentContractPrelude = savedContractPrelude; this.currentContractExceptionalTerminationChecks = savedContractExceptionalTerminationChecks; this.currentExceptionalTerminationException = savedcurrentExceptionalTerminationException; this.currentContractNormalTerminationCheck = savedContractNormalTerminationCheck; return method; }
public virtual object Visit (This thisExpression) { return null; }
public override Expression VisitThis(This This) { if (this._string == null){ this._string = new StringBuilder(); } this._string.Append("this"); return This; }
public override Expression VisitThis(This This) { if (This == null) return null; This dup = (This)this.DuplicateFor[This.UniqueKey]; if (dup != null) return dup; this.DuplicateFor[This.UniqueKey] = dup = (This)This.Clone(); return base.VisitThis(dup); }
/** the generated parser. Maintains a state and a value stack, currently with fixed maximum size. @param yyLex scanner. @return result of the last reduction, if any. @throws yyException on irrecoverable parse error. */ internal Object yyparse (yyParser.yyInput yyLex) { if (yyMax <= 0) yyMax = 256; // initial size int yyState = 0; // state stack ptr int [] yyStates; // state stack yyVal = null; yyToken = -1; int yyErrorFlag = 0; // #tks to shift if (use_global_stacks && global_yyStates != null) { yyVals = global_yyVals; yyStates = global_yyStates; } else { yyVals = new object [yyMax]; yyStates = new int [yyMax]; if (use_global_stacks) { global_yyVals = yyVals; global_yyStates = yyStates; } } /*yyLoop:*/ for (yyTop = 0;; ++ yyTop) { if (yyTop >= yyStates.Length) { // dynamically increase global::System.Array.Resize (ref yyStates, yyStates.Length+yyMax); global::System.Array.Resize (ref yyVals, yyVals.Length+yyMax); } yyStates[yyTop] = yyState; yyVals[yyTop] = yyVal; //t if (debug != null) debug.push(yyState, yyVal); /*yyDiscarded:*/ while (true) { // discarding a token does not change stack int yyN; if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); } if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) { //t if (debug != null) //t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); yyState = yyTable[yyN]; // shift to yyN yyVal = yyLex.value(); yyToken = -1; if (yyErrorFlag > 0) -- yyErrorFlag; goto continue_yyLoop; } if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == yyToken) yyN = yyTable[yyN]; // reduce (yyN) else switch (yyErrorFlag) { case 0: yyExpectingState = yyState; // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState)); //t if (debug != null) debug.error("syntax error"); if (yyToken == 0 /*eof*/ || yyToken == eof_token) throw new yyParser.yyUnexpectedEof (); goto case 1; case 1: case 2: yyErrorFlag = 3; do { if ((yyN = yySindex[yyStates[yyTop]]) != 0 && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == Token.yyErrorCode) { //t if (debug != null) //t debug.shift(yyStates[yyTop], yyTable[yyN], 3); yyState = yyTable[yyN]; yyVal = yyLex.value(); goto continue_yyLoop; } //t if (debug != null) debug.pop(yyStates[yyTop]); } while (-- yyTop >= 0); //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error"); case 3: if (yyToken == 0) { //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error at end-of-file"); } //t if (debug != null) //t debug.discard(yyState, yyToken, yyname(yyToken), //t yyLex.value()); yyToken = -1; goto continue_yyDiscarded; // leave stack alone } } int yyV = yyTop + 1-yyLen[yyN]; //t if (debug != null) //t debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]); yyVal = yyV > yyTop ? null : yyVals[yyV]; // yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]); switch (yyN) { case 1: #line 392 "cs-parser.jay" { Lexer.check_incorrect_doc_comment (); } break; case 2: #line 393 "cs-parser.jay" { Lexer.CompleteOnEOF = false; } break; case 6: case_6(); break; case 7: #line 412 "cs-parser.jay" { module.AddAttributes ((Attributes) yyVals[0+yyTop], current_namespace); } break; case 8: case_8(); break; case 13: case_13(); break; case 14: #line 457 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 17: case_17(); break; case 18: case_18(); break; case 19: case_19(); break; case 20: case_20(); break; case 23: case_23(); break; case 24: case_24(); break; case 25: case_25(); break; case 26: case_26(); break; case 29: case_29(); break; case 30: case_30(); break; case 31: case_31(); break; case 32: case_32(); break; case 45: case_45(); break; case 46: #line 660 "cs-parser.jay" { current_namespace.DeclarationFound = true; } break; case 47: case_47(); break; case 55: case_55(); break; case 56: case_56(); break; case 57: case_57(); break; case 58: case_58(); break; case 59: case_59(); break; case 60: case_60(); break; case 61: case_61(); break; case 62: case_62(); break; case 63: case_63(); break; case 64: case_64(); break; case 65: #line 787 "cs-parser.jay" { yyVal = "event"; PushLocation (GetLocation (yyVals[0+yyTop])); } break; case 66: #line 788 "cs-parser.jay" { yyVal = "return"; PushLocation (GetLocation (yyVals[0+yyTop])); } break; case 67: #line 795 "cs-parser.jay" { yyVal = new List<Attribute> (4) { (Attribute) yyVals[0+yyTop] }; } break; case 68: case_68(); break; case 69: #line 812 "cs-parser.jay" { ++lexer.parsing_block; } break; case 70: case_70(); break; case 72: #line 840 "cs-parser.jay" { yyVal = null; HadAttributeParens = false; } break; case 73: case_73(); break; case 74: #line 852 "cs-parser.jay" { yyVal = null; } break; case 75: case_75(); break; case 76: case_76(); break; case 77: case_77(); break; case 78: case_78(); break; case 79: #line 896 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 81: case_81(); break; case 82: #line 909 "cs-parser.jay" { ++lexer.parsing_block; } break; case 83: case_83(); break; case 84: case_84(); break; case 86: #line 940 "cs-parser.jay" { yyVal = null; } break; case 87: #line 944 "cs-parser.jay" { yyVal = Argument.AType.Ref; } break; case 88: #line 948 "cs-parser.jay" { yyVal = Argument.AType.Out; } break; case 91: case_91(); break; case 92: case_92(); break; case 106: case_106(); break; case 107: case_107(); break; case 108: case_108(); break; case 109: #line 1025 "cs-parser.jay" { } break; case 110: case_110(); break; case 111: case_111(); break; case 112: case_112(); break; case 113: case_113(); break; case 114: case_114(); break; case 115: #line 1075 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 116: case_116(); break; case 117: case_117(); break; case 118: case_118(); break; case 121: #line 1124 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 122: #line 1128 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 123: case_123(); break; case 124: #line 1144 "cs-parser.jay" { ++lexer.parsing_block; } break; case 125: case_125(); break; case 126: case_126(); break; case 129: case_129(); break; case 130: case_130(); break; case 131: case_131(); break; case 132: case_132(); break; case 133: #line 1223 "cs-parser.jay" { report.Error (1641, GetLocation (yyVals[-1+yyTop]), "A fixed size buffer field must have the array size specifier after the field name"); } break; case 135: case_135(); break; case 136: case_136(); break; case 139: #line 1253 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 140: #line 1257 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 141: case_141(); break; case 142: #line 1270 "cs-parser.jay" { ++lexer.parsing_block; } break; case 143: case_143(); break; case 146: #line 1289 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 147: #line 1293 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 148: case_148(); break; case 149: #line 1309 "cs-parser.jay" { ++lexer.parsing_block; } break; case 150: case_150(); break; case 151: case_151(); break; case 154: case_154(); break; case 155: case_155(); break; case 156: case_156(); break; case 157: #line 1377 "cs-parser.jay" { valid_param_mod = ParameterModifierType.All; } break; case 158: case_158(); break; case 159: case_159(); break; case 160: #line 1416 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 161: case_161(); break; case 162: #line 1426 "cs-parser.jay" { lexer.ConstraintsParsing = true; } break; case 163: case_163(); break; case 164: case_164(); break; case 165: case_165(); break; case 169: #line 1504 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } break; case 170: case_170(); break; case 171: case_171(); break; case 172: #line 1528 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 174: case_174(); break; case 175: case_175(); break; case 176: case_176(); break; case 177: case_177(); break; case 178: case_178(); break; case 179: case_179(); break; case 180: case_180(); break; case 181: #line 1600 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter[] { (Parameter) yyVals[0+yyTop] } ); } break; case 182: #line 1604 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter [] { new ArglistParameter (GetLocation (yyVals[0+yyTop])) }, true); } break; case 183: case_183(); break; case 184: case_184(); break; case 185: case_185(); break; case 186: case_186(); break; case 187: case_187(); break; case 188: case_188(); break; case 189: case_189(); break; case 190: #line 1685 "cs-parser.jay" { ++lexer.parsing_block; } break; case 191: case_191(); break; case 192: #line 1726 "cs-parser.jay" { yyVal = Parameter.Modifier.NONE; } break; case 194: #line 1734 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 195: case_195(); break; case 196: case_196(); break; case 197: case_197(); break; case 198: case_198(); break; case 199: case_199(); break; case 200: case_200(); break; case 201: case_201(); break; case 202: case_202(); break; case 203: case_203(); break; case 204: #line 1828 "cs-parser.jay" { Error_DuplicateParameterModifier (GetLocation (yyVals[-1+yyTop]), Parameter.Modifier.PARAMS); } break; case 205: case_205(); break; case 206: case_206(); break; case 207: case_207(); break; case 208: case_208(); break; case 209: case_209(); break; case 210: #line 1878 "cs-parser.jay" { current_property = null; } break; case 211: case_211(); break; case 212: case_212(); break; case 214: case_214(); break; case 215: case_215(); break; case 218: #line 1940 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Params | ParameterModifierType.DefaultValue; } break; case 219: case_219(); break; case 220: case_220(); break; case 221: #line 1986 "cs-parser.jay" { lbag.AppendToMember (current_property, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } break; case 222: case_222(); break; case 227: case_227(); break; case 228: case_228(); break; case 229: case_229(); break; case 230: case_230(); break; case 231: case_231(); break; case 233: case_233(); break; case 234: case_234(); break; case 235: #line 2127 "cs-parser.jay" { } break; case 236: case_236(); break; case 237: case_237(); break; case 238: case_238(); break; case 239: case_239(); break; case 240: #line 2167 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 243: case_243(); break; case 244: case_244(); break; case 245: #line 2192 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 246: #line 2196 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 251: #line 2204 "cs-parser.jay" { report.Error (567, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain operators"); } break; case 252: #line 2208 "cs-parser.jay" { report.Error (526, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain contructors"); } break; case 253: #line 2212 "cs-parser.jay" { report.Error (524, GetLocation (yyVals[0+yyTop]), "Interfaces cannot declare classes, structs, interfaces, delegates, or enumerations"); } break; case 254: #line 2218 "cs-parser.jay" { } break; case 255: case_255(); break; case 257: case_257(); break; case 258: case_258(); break; case 259: case_259(); break; case 261: #line 2312 "cs-parser.jay" { yyVal = Operator.OpType.LogicalNot; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 262: #line 2313 "cs-parser.jay" { yyVal = Operator.OpType.OnesComplement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 263: #line 2314 "cs-parser.jay" { yyVal = Operator.OpType.Increment; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 264: #line 2315 "cs-parser.jay" { yyVal = Operator.OpType.Decrement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 265: #line 2316 "cs-parser.jay" { yyVal = Operator.OpType.True; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 266: #line 2317 "cs-parser.jay" { yyVal = Operator.OpType.False; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 267: #line 2319 "cs-parser.jay" { yyVal = Operator.OpType.Addition; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 268: #line 2320 "cs-parser.jay" { yyVal = Operator.OpType.Subtraction; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 269: #line 2322 "cs-parser.jay" { yyVal = Operator.OpType.Multiply; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 270: #line 2323 "cs-parser.jay" { yyVal = Operator.OpType.Division; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 271: #line 2324 "cs-parser.jay" { yyVal = Operator.OpType.Modulus; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 272: #line 2325 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseAnd; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 273: #line 2326 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 274: #line 2327 "cs-parser.jay" { yyVal = Operator.OpType.ExclusiveOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 275: #line 2328 "cs-parser.jay" { yyVal = Operator.OpType.LeftShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 276: #line 2329 "cs-parser.jay" { yyVal = Operator.OpType.RightShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 277: #line 2330 "cs-parser.jay" { yyVal = Operator.OpType.Equality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 278: #line 2331 "cs-parser.jay" { yyVal = Operator.OpType.Inequality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 279: #line 2332 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 280: #line 2333 "cs-parser.jay" { yyVal = Operator.OpType.LessThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 281: #line 2334 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 282: #line 2335 "cs-parser.jay" { yyVal = Operator.OpType.LessThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 283: case_283(); break; case 284: #line 2349 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } break; case 285: case_285(); break; case 286: #line 2372 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } break; case 287: case_287(); break; case 288: case_288(); break; case 289: case_289(); break; case 290: case_290(); break; case 291: case_291(); break; case 292: case_292(); break; case 293: case_293(); break; case 295: #line 2496 "cs-parser.jay" { current_block = null; yyVal = null; } break; case 298: #line 2508 "cs-parser.jay" { ++lexer.parsing_block; } break; case 299: case_299(); break; case 300: #line 2518 "cs-parser.jay" { ++lexer.parsing_block; } break; case 301: case_301(); break; case 302: case_302(); break; case 303: case_303(); break; case 304: case_304(); break; case 305: case_305(); break; case 306: case_306(); break; case 307: case_307(); break; case 308: case_308(); break; case 309: case_309(); break; case 310: case_310(); break; case 311: case_311(); break; case 313: #line 2645 "cs-parser.jay" { ++lexer.parsing_block; } break; case 314: case_314(); break; case 317: #line 2663 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 318: #line 2667 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 319: case_319(); break; case 320: #line 2680 "cs-parser.jay" { ++lexer.parsing_block; } break; case 321: case_321(); break; case 322: case_322(); break; case 323: #line 2705 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 326: case_326(); break; case 327: case_327(); break; case 328: case_328(); break; case 329: case_329(); break; case 330: case_330(); break; case 331: case_331(); break; case 332: case_332(); break; case 333: case_333(); break; case 335: case_335(); break; case 336: case_336(); break; case 337: case_337(); break; case 338: case_338(); break; case 339: case_339(); break; case 340: case_340(); break; case 342: case_342(); break; case 343: case_343(); break; case 346: #line 2893 "cs-parser.jay" { lbag.AppendToMember (current_container, GetLocation (yyVals[0+yyTop])); } break; case 348: case_348(); break; case 349: case_349(); break; case 350: case_350(); break; case 351: case_351(); break; case 352: case_352(); break; case 354: #line 2967 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out | ParameterModifierType.Params | ParameterModifierType.DefaultValue; } break; case 355: case_355(); break; case 356: #line 2986 "cs-parser.jay" { lexer.ConstraintsParsing = false; } break; case 357: case_357(); break; case 359: case_359(); break; case 361: case_361(); break; case 362: case_362(); break; case 364: case_364(); break; case 365: case_365(); break; case 366: case_366(); break; case 367: case_367(); break; case 369: case_369(); break; case 370: case_370(); break; case 371: case_371(); break; case 372: case_372(); break; case 373: #line 3111 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 374: case_374(); break; case 375: case_375(); break; case 377: case_377(); break; case 378: case_378(); break; case 379: case_379(); break; case 380: case_380(); break; case 381: case_381(); break; case 382: case_382(); break; case 384: case_384(); break; case 385: case_385(); break; case 386: case_386(); break; case 387: case_387(); break; case 388: case_388(); break; case 390: #line 3236 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } break; case 391: #line 3243 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 397: case_397(); break; case 399: #line 3273 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 400: case_400(); break; case 401: #line 3292 "cs-parser.jay" { yyVal = new ComposedCast ((ATypeNameExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 403: case_403(); break; case 404: case_404(); break; case 405: #line 3313 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 406: #line 3317 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 407: case_407(); break; case 408: case_408(); break; case 409: case_409(); break; case 410: #line 3351 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[0+yyTop])); } break; case 411: #line 3352 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.String, GetLocation (yyVals[0+yyTop])); } break; case 412: #line 3353 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Bool, GetLocation (yyVals[0+yyTop])); } break; case 413: #line 3354 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Decimal, GetLocation (yyVals[0+yyTop])); } break; case 414: #line 3355 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Float, GetLocation (yyVals[0+yyTop])); } break; case 415: #line 3356 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Double, GetLocation (yyVals[0+yyTop])); } break; case 417: #line 3361 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.SByte, GetLocation (yyVals[0+yyTop])); } break; case 418: #line 3362 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Byte, GetLocation (yyVals[0+yyTop])); } break; case 419: #line 3363 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Short, GetLocation (yyVals[0+yyTop])); } break; case 420: #line 3364 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UShort, GetLocation (yyVals[0+yyTop])); } break; case 421: #line 3365 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Int, GetLocation (yyVals[0+yyTop])); } break; case 422: #line 3366 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UInt, GetLocation (yyVals[0+yyTop])); } break; case 423: #line 3367 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Long, GetLocation (yyVals[0+yyTop])); } break; case 424: #line 3368 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.ULong, GetLocation (yyVals[0+yyTop])); } break; case 425: #line 3369 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Char, GetLocation (yyVals[0+yyTop])); } break; case 448: case_448(); break; case 452: #line 3413 "cs-parser.jay" { yyVal = new NullLiteral (GetLocation (yyVals[0+yyTop])); } break; case 453: #line 3417 "cs-parser.jay" { yyVal = new BoolLiteral (compiler.BuiltinTypes, true, GetLocation (yyVals[0+yyTop])); } break; case 454: #line 3418 "cs-parser.jay" { yyVal = new BoolLiteral (compiler.BuiltinTypes, false, GetLocation (yyVals[0+yyTop])); } break; case 455: #line 3425 "cs-parser.jay" { yyVal = new InterpolatedString ((StringLiteral) yyVals[-2+yyTop], (List<Expression>) yyVals[-1+yyTop], (StringLiteral) yyVals[0+yyTop]); } break; case 456: #line 3429 "cs-parser.jay" { yyVal = new InterpolatedString ((StringLiteral) yyVals[0+yyTop], null, null); } break; case 457: case_457(); break; case 458: case_458(); break; case 459: #line 3452 "cs-parser.jay" { yyVal = new InterpolatedStringInsert ((Expression) yyVals[0+yyTop]); } break; case 460: case_460(); break; case 461: #line 3462 "cs-parser.jay" { lexer.parsing_interpolation_format = true; } break; case 462: case_462(); break; case 463: #line 3474 "cs-parser.jay" { lexer.parsing_interpolation_format = true; } break; case 464: case_464(); break; case 469: case_469(); break; case 470: #line 3516 "cs-parser.jay" { yyVal = new ParenthesizedExpression ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 471: case_471(); break; case 472: case_472(); break; case 473: case_473(); break; case 474: case_474(); break; case 475: case_475(); break; case 476: case_476(); break; case 477: case_477(); break; case 478: case_478(); break; case 479: #line 3577 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null,GetLocation (yyVals[0+yyTop])); } break; case 480: case_480(); break; case 481: #line 3585 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null, lexer.Location); } break; case 482: case_482(); break; case 483: case_483(); break; case 484: case_484(); break; case 485: case_485(); break; case 486: #line 3615 "cs-parser.jay" { yyVal = null; } break; case 488: case_488(); break; case 489: case_489(); break; case 490: #line 3637 "cs-parser.jay" { yyVal = null; } break; case 491: #line 3641 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 492: case_492(); break; case 493: case_493(); break; case 494: case_494(); break; case 495: case_495(); break; case 496: case_496(); break; case 497: #line 3680 "cs-parser.jay" { yyVal = new CompletionElementInitializer (null, GetLocation (yyVals[0+yyTop])); } break; case 498: case_498(); break; case 499: case_499(); break; case 500: case_500(); break; case 501: case_501(); break; case 504: #line 3720 "cs-parser.jay" { yyVal = null; } break; case 506: case_506(); break; case 507: case_507(); break; case 508: case_508(); break; case 509: case_509(); break; case 510: case_510(); break; case 511: #line 3774 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 515: case_515(); break; case 516: #line 3792 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Ref); } break; case 517: case_517(); break; case 518: #line 3801 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Out); } break; case 519: case_519(); break; case 520: case_520(); break; case 521: case_521(); break; case 522: case_522(); break; case 523: case_523(); break; case 525: case_525(); break; case 526: case_526(); break; case 527: case_527(); break; case 528: case_528(); break; case 529: case_529(); break; case 530: case_530(); break; case 531: case_531(); break; case 532: case_532(); break; case 533: #line 3928 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 535: #line 3936 "cs-parser.jay" { yyVal = new This (GetLocation (yyVals[0+yyTop])); } break; case 536: case_536(); break; case 537: case_537(); break; case 538: #line 3956 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; case 539: #line 3963 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; case 540: case_540(); break; case 541: case_541(); break; case 542: case_542(); break; case 543: case_543(); break; case 544: case_544(); break; case 545: case_545(); break; case 546: case_546(); break; case 547: #line 4030 "cs-parser.jay" { ++lexer.parsing_type; } break; case 548: case_548(); break; case 549: case_549(); break; case 550: #line 4052 "cs-parser.jay" { yyVal = new EmptyCompletion (); } break; case 553: #line 4061 "cs-parser.jay" { yyVal = null; } break; case 555: case_555(); break; case 556: case_556(); break; case 557: #line 4083 "cs-parser.jay" { yyVal = new EmptyCompletion (); } break; case 558: #line 4087 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 559: case_559(); break; case 560: case_560(); break; case 561: case_561(); break; case 562: case_562(); break; case 566: case_566(); break; case 567: case_567(); break; case 568: case_568(); break; case 569: #line 4147 "cs-parser.jay" { yyVal = 2; } break; case 570: #line 4151 "cs-parser.jay" { yyVal = ((int) yyVals[-1+yyTop]) + 1; } break; case 571: #line 4158 "cs-parser.jay" { yyVal = null; } break; case 572: #line 4162 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 573: case_573(); break; case 574: case_574(); break; case 575: case_575(); break; case 576: case_576(); break; case 577: case_577(); break; case 579: case_579(); break; case 580: case_580(); break; case 581: case_581(); break; case 582: case_582(); break; case 583: case_583(); break; case 584: case_584(); break; case 585: case_585(); break; case 586: case_586(); break; case 587: case_587(); break; case 588: case_588(); break; case 589: #line 4295 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], false, GetLocation (yyVals[-1+yyTop])); } break; case 590: case_590(); break; case 591: #line 4308 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], true, GetLocation (yyVals[-2+yyTop])); } break; case 592: case_592(); break; case 593: #line 4325 "cs-parser.jay" { yyVal = ParametersCompiled.Undefined; } break; case 595: #line 4333 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 596: case_596(); break; case 597: case_597(); break; case 599: #line 4359 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.LogicalNot, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 600: #line 4363 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.OnesComplement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 601: case_601(); break; case 602: case_602(); break; case 603: case_603(); break; case 604: case_604(); break; case 605: case_605(); break; case 606: case_606(); break; case 608: #line 4427 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryPlus, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 609: #line 4431 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryNegation, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 610: #line 4435 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreIncrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 611: #line 4439 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreDecrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 612: #line 4443 "cs-parser.jay" { yyVal = new Indirection ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 613: #line 4447 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 614: case_614(); break; case 615: case_615(); break; case 616: case_616(); break; case 617: case_617(); break; case 618: case_618(); break; case 619: case_619(); break; case 621: case_621(); break; case 622: case_622(); break; case 623: case_623(); break; case 624: case_624(); break; case 625: case_625(); break; case 626: case_626(); break; case 628: case_628(); break; case 629: case_629(); break; case 630: case_630(); break; case 631: case_631(); break; case 632: #line 4555 "cs-parser.jay" { yyVal = new As ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 633: case_633(); break; case 634: case_634(); break; case 635: case_635(); break; case 636: case_636(); break; case 637: case_637(); break; case 638: case_638(); break; case 641: #line 4611 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryPlus, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 642: #line 4615 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryNegation, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 645: case_645(); break; case 646: #line 4626 "cs-parser.jay" { yyVal = new WildcardPattern (GetLocation (yyVals[0+yyTop])); } break; case 649: #line 4635 "cs-parser.jay" { yyVal = new RecursivePattern ((ATypeNameExpression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 650: #line 4642 "cs-parser.jay" { yyVal = new PropertyPattern ((ATypeNameExpression) yyVals[-3+yyTop], (List<PropertyPatternMember>) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 651: case_651(); break; case 652: case_652(); break; case 653: case_653(); break; case 655: case_655(); break; case 656: #line 4684 "cs-parser.jay" { yyVal = new Arguments (0); } break; case 658: case_658(); break; case 659: case_659(); break; case 660: #line 4710 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 661: case_661(); break; case 663: case_663(); break; case 664: case_664(); break; case 665: case_665(); break; case 666: case_666(); break; case 668: case_668(); break; case 669: case_669(); break; case 670: case_670(); break; case 671: case_671(); break; case 672: case_672(); break; case 673: case_673(); break; case 674: case_674(); break; case 675: case_675(); break; case 677: case_677(); break; case 678: case_678(); break; case 679: case_679(); break; case 680: case_680(); break; case 682: case_682(); break; case 683: case_683(); break; case 685: case_685(); break; case 686: case_686(); break; case 688: case_688(); break; case 689: case_689(); break; case 691: case_691(); break; case 692: case_692(); break; case 694: case_694(); break; case 695: case_695(); break; case 697: case_697(); break; case 699: case_699(); break; case 700: case_700(); break; case 701: case_701(); break; case 702: case_702(); break; case 703: case_703(); break; case 704: case_704(); break; case 705: case_705(); break; case 706: case_706(); break; case 707: case_707(); break; case 708: case_708(); break; case 709: case_709(); break; case 710: case_710(); break; case 711: case_711(); break; case 712: case_712(); break; case 713: case_713(); break; case 714: case_714(); break; case 715: case_715(); break; case 716: case_716(); break; case 717: case_717(); break; case 718: case_718(); break; case 719: case_719(); break; case 720: #line 5055 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 721: case_721(); break; case 722: #line 5066 "cs-parser.jay" { start_block (Location.Null); } break; case 723: case_723(); break; case 725: case_725(); break; case 727: case_727(); break; case 728: case_728(); break; case 729: case_729(); break; case 730: case_730(); break; case 731: case_731(); break; case 732: case_732(); break; case 733: case_733(); break; case 734: #line 5133 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 735: case_735(); break; case 736: case_736(); break; case 737: #line 5147 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 738: case_738(); break; case 739: case_739(); break; case 745: #line 5172 "cs-parser.jay" { yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop])); } break; case 746: case_746(); break; case 747: case_747(); break; case 748: case_748(); break; case 750: #line 5201 "cs-parser.jay" { yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]); } break; case 751: #line 5208 "cs-parser.jay" { yyVal = null; } break; case 753: case_753(); break; case 754: #line 5229 "cs-parser.jay" { yyVal = null; } break; case 755: #line 5233 "cs-parser.jay" { yyVal = null; } break; case 756: #line 5237 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 757: #line 5241 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 758: case_758(); break; case 759: case_759(); break; case 760: #line 5266 "cs-parser.jay" { } break; case 761: case_761(); break; case 762: case_762(); break; case 763: case_763(); break; case 764: case_764(); break; case 765: #line 5318 "cs-parser.jay" { yyVal = null; } break; case 766: #line 5320 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[0+yyTop])); } break; case 767: case_767(); break; case 768: #line 5333 "cs-parser.jay" { lexer.parsing_modifiers = false; } break; case 770: case_770(); break; case 771: case_771(); break; case 772: case_772(); break; case 773: case_773(); break; case 774: case_774(); break; case 775: case_775(); break; case 776: case_776(); break; case 777: case_777(); break; case 778: case_778(); break; case 779: case_779(); break; case 780: case_780(); break; case 781: case_781(); break; case 782: case_782(); break; case 783: case_783(); break; case 784: case_784(); break; case 785: case_785(); break; case 788: case_788(); break; case 789: case_789(); break; case 791: #line 5463 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 792: case_792(); break; case 793: case_793(); break; case 794: case_794(); break; case 795: case_795(); break; case 796: case_796(); break; case 797: case_797(); break; case 798: case_798(); break; case 799: case_799(); break; case 800: #line 5556 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Class, GetLocation (yyVals[0+yyTop])); } break; case 801: #line 5560 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Struct, GetLocation (yyVals[0+yyTop])); } break; case 802: #line 5567 "cs-parser.jay" { yyVal = null; } break; case 803: case_803(); break; case 804: case_804(); break; case 805: case_805(); break; case 806: case_806(); break; case 807: #line 5612 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 808: case_808(); break; case 809: case_809(); break; case 810: case_810(); break; case 811: case_811(); break; case 812: case_812(); break; case 813: case_813(); break; case 814: case_814(); break; case 819: #line 5674 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 820: #line 5678 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 822: case_822(); break; case 823: case_823(); break; case 826: #line 5712 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 827: #line 5716 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 856: case_856(); break; case 857: case_857(); break; case 858: case_858(); break; case 859: case_859(); break; case 860: case_860(); break; case 863: case_863(); break; case 864: case_864(); break; case 865: case_865(); break; case 869: case_869(); break; case 870: #line 5857 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreatePointer (GetLocation (yyVals[0+yyTop])); } break; case 872: #line 5865 "cs-parser.jay" { yyVal = Error_AwaitAsIdentifier (yyVals[0+yyTop]); } break; case 873: case_873(); break; case 874: case_874(); break; case 875: case_875(); break; case 876: case_876(); break; case 878: case_878(); break; case 880: case_880(); break; case 881: case_881(); break; case 885: case_885(); break; case 888: case_888(); break; case 889: case_889(); break; case 890: #line 5979 "cs-parser.jay" { report.Error (145, lexer.Location, "A const field requires a value to be provided"); } break; case 891: case_891(); break; case 896: case_896(); break; case 898: case_898(); break; case 899: case_899(); break; case 900: case_900(); break; case 901: #line 6029 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 902: case_902(); break; case 903: #line 6039 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 904: #line 6040 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 905: case_905(); break; case 906: case_906(); break; case 907: case_907(); break; case 910: case_910(); break; case 911: case_911(); break; case 912: case_912(); break; case 913: #line 6112 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); } break; case 914: case_914(); break; case 915: case_915(); break; case 916: #line 6132 "cs-parser.jay" { report.Warning (1522, 1, current_block.StartLocation, "Empty switch block"); } break; case 920: #line 6142 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 922: case_922(); break; case 923: #line 6159 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 924: case_924(); break; case 925: case_925(); break; case 926: #line 6188 "cs-parser.jay" { yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop])); } break; case 931: case_931(); break; case 932: case_932(); break; case 933: case_933(); break; case 934: case_934(); break; case 935: case_935(); break; case 936: case_936(); break; case 937: #line 6249 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 938: case_938(); break; case 939: #line 6264 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 940: case_940(); break; case 941: case_941(); break; case 942: #line 6285 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 943: case_943(); break; case 944: case_944(); break; case 945: case_945(); break; case 946: #line 6319 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 948: case_948(); break; case 949: case_949(); break; case 951: #line 6343 "cs-parser.jay" { yyVal = null; } break; case 953: #line 6348 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 957: case_957(); break; case 958: case_958(); break; case 959: case_959(); break; case 960: case_960(); break; case 961: case_961(); break; case 962: case_962(); break; case 963: case_963(); break; case 970: case_970(); break; case 971: case_971(); break; case 972: case_972(); break; case 973: case_973(); break; case 974: case_974(); break; case 975: case_975(); break; case 976: case_976(); break; case 977: case_977(); break; case 978: case_978(); break; case 979: case_979(); break; case 980: case_980(); break; case 981: case_981(); break; case 982: case_982(); break; case 983: case_983(); break; case 984: case_984(); break; case 987: #line 6594 "cs-parser.jay" { yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false); } break; case 988: case_988(); break; case 989: case_989(); break; case 990: case_990(); break; case 991: case_991(); break; case 992: case_992(); break; case 995: case_995(); break; case 996: case_996(); break; case 997: case_997(); break; case 998: case_998(); break; case 999: #line 6685 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 1000: case_1000(); break; case 1001: #line 6697 "cs-parser.jay" { lexer.parsing_catch_when = false; } break; case 1002: #line 6701 "cs-parser.jay" { lexer.parsing_catch_when = false; } break; case 1003: case_1003(); break; case 1004: #line 6716 "cs-parser.jay" { yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 1005: #line 6723 "cs-parser.jay" { yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 1006: case_1006(); break; case 1007: #line 6733 "cs-parser.jay" { yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 1008: case_1008(); break; case 1009: case_1009(); break; case 1010: case_1010(); break; case 1011: case_1011(); break; case 1012: case_1012(); break; case 1013: case_1013(); break; case 1014: case_1014(); break; case 1015: case_1015(); break; case 1016: case_1016(); break; case 1017: case_1017(); break; case 1019: case_1019(); break; case 1020: #line 6838 "cs-parser.jay" { Error_MissingInitializer (lexer.Location); } break; case 1021: case_1021(); break; case 1022: case_1022(); break; case 1023: case_1023(); break; case 1024: case_1024(); break; case 1025: case_1025(); break; case 1026: case_1026(); break; case 1027: case_1027(); break; case 1028: case_1028(); break; case 1029: case_1029(); break; case 1030: #line 6943 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 1031: case_1031(); break; case 1032: #line 6958 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 1033: case_1033(); break; case 1034: case_1034(); break; case 1035: case_1035(); break; case 1037: case_1037(); break; case 1038: case_1038(); break; case 1039: #line 7022 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 1040: case_1040(); break; case 1041: case_1041(); break; case 1042: case_1042(); break; case 1043: case_1043(); break; case 1044: #line 7061 "cs-parser.jay" { yyVal = new object[] { yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]) }; } break; case 1045: case_1045(); break; case 1047: case_1047(); break; case 1053: #line 7090 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 1054: case_1054(); break; case 1055: #line 7109 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 1056: case_1056(); break; case 1057: case_1057(); break; case 1058: case_1058(); break; case 1059: case_1059(); break; case 1060: case_1060(); break; case 1061: case_1061(); break; case 1062: case_1062(); break; case 1063: case_1063(); break; case 1064: case_1064(); break; case 1066: case_1066(); break; case 1067: case_1067(); break; case 1068: case_1068(); break; case 1070: case_1070(); break; case 1071: case_1071(); break; case 1073: case_1073(); break; case 1074: case_1074(); break; case 1075: #line 7310 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } break; case 1076: case_1076(); break; case 1077: case_1077(); break; case 1078: #line 7327 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } break; case 1079: case_1079(); break; case 1080: case_1080(); break; case 1082: case_1082(); break; case 1083: case_1083(); break; case 1086: case_1086(); break; case 1087: case_1087(); break; case 1095: #line 7452 "cs-parser.jay" { module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; } break; case 1096: #line 7459 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop]; } break; case 1097: case_1097(); break; case 1098: case_1098(); break; case 1099: case_1099(); break; case 1100: #line 7482 "cs-parser.jay" { yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); } break; case 1101: #line 7486 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 1102: case_1102(); break; case 1103: case_1103(); break; case 1104: case_1104(); break; case 1105: case_1105(); break; case 1107: #line 7522 "cs-parser.jay" { yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); } break; case 1109: #line 7530 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 1110: #line 7534 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 1111: #line 7541 "cs-parser.jay" { yyVal = new List<DocumentationParameter> (0); } break; case 1113: case_1113(); break; case 1114: case_1114(); break; case 1115: case_1115(); break; #line default } yyTop -= yyLen[yyN]; yyState = yyStates[yyTop]; int yyM = yyLhs[yyN]; if (yyState == 0 && yyM == 0) { //t if (debug != null) debug.shift(0, yyFinal); yyState = yyFinal; if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value()); } if (yyToken == 0) { //t if (debug != null) debug.accept(yyVal); return yyVal; } goto continue_yyLoop; } if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState)) yyState = yyTable[yyN]; else yyState = yyDgoto[yyM]; //t if (debug != null) debug.shift(yyStates[yyTop], yyState); goto continue_yyLoop; continue_yyDiscarded: ; // implements the named-loop continue: 'continue yyDiscarded' } continue_yyLoop: ; // implements the named-loop continue: 'continue yyLoop' } }
public void SetUpClosureClass(Method method){ Class closureClass = method.Scope.ClosureClass; if (this.CodeMightBeVerified) { // Closure classes contain user-written code, but it doesn't get verified. closureClass.Attributes.Add( new AttributeNode(new MemberBinding(null, SystemTypes.VerifyAttribute.GetConstructor(SystemTypes.Boolean)), new ExpressionList(Literal.False), AttributeTargets.Class) ); } this.currentType.Members.Add(closureClass); MemberList members = closureClass.Members; ParameterList parameters = new ParameterList(); StatementList statements = new StatementList(); TypeNode thisType = method.Scope.ThisTypeInstance; This thisParameter = new This(closureClass); if (thisType != null && !method.IsStatic) { if (!thisType.IsValueType) thisType = OptionalModifier.For(SystemTypes.NonNullType, thisType); Field f = (Field)closureClass.Members[0]; f.Type = thisType; Parameter p = new Parameter(f.Name, f.Type); // The captured class object parameters to closure class constructors are delayed p.Attributes.Add(new AttributeNode(new MemberBinding(null, ExtendedRuntimeTypes.DelayedAttribute.GetConstructor()), null, AttributeTargets.Parameter)); method.Scope.ThisField = f; parameters.Add(p); Expression pval = p; if (p.Type.IsValueType) pval = new AddressDereference(p, p.Type); statements.Add(new AssignmentStatement(new MemberBinding(thisParameter, f), p)); } MemberList scopeMembers = method.Scope.Members; for (int i = 0, n = scopeMembers.Count; i < n; i++){ Member m = scopeMembers[i]; Field f = m as Field; if (f == null || f.Type is Reference) continue; f.Type = method.Scope.FixTypeReference(f.Type); members.Add(f); if (!(f is ParameterField)) continue; Parameter p = new Parameter(f.Name, f.Type); parameters.Add(p); statements.Add(new AssignmentStatement(new MemberBinding(thisParameter, f), p)); } InstanceInitializer cons = new InstanceInitializer(); cons.ThisParameter = thisParameter; cons.DeclaringType = closureClass; cons.Flags |= MethodFlags.CompilerControlled; cons.Parameters = parameters; cons.Scope = new MethodScope(closureClass, new UsedNamespaceList(0)); cons.Body = new Block(statements); MethodCall mcall = new MethodCall(new MemberBinding(thisParameter, CoreSystemTypes.Object.GetConstructor()), new ExpressionList(0), NodeType.Call, CoreSystemTypes.Void); statements.Add(new ExpressionStatement(mcall)); statements.Add(new Return()); closureClass.Members.Add(cons); }
public override Expression VisitThis(This This){ if (This == null) return null; if (this.stackFrame != null) return this.stackFrame.thisObject; return null; }
public virtual Differences VisitThis(This this1, This this2){ Differences differences = new Differences(this1, this2); if (this1 == null || this2 == null){ if (this1 != this2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; }else{ differences.NumberOfSimilarities++; differences.Changes = null; } return differences; }
public override object Visit (This thisExpression) { var result = new ThisReferenceExpression (); result.Location = Convert (thisExpression.Location); return result; }
public virtual Expression VisitThis(This This){ if (This == null) return null; This.Type = this.VisitTypeReference(This.Type); #if !MinimalReader ThisBinding tb = This as ThisBinding; if (tb != null) { This boundThis = this.VisitThis(tb.BoundThis) as This; if (boundThis != null) tb.BoundThis = boundThis; } #endif return This; }
public virtual void VisitThis(This This) { if (This == null) return; this.VisitTypeReference(This.Type); #if !MinimalReader && !CodeContracts ThisBinding tb = This as ThisBinding; if (tb != null) { this.VisitThis(tb.BoundThis); } #endif }
public override Expression VisitThis (This This) { Inspect(This.Type, This); return base.VisitThis(This); }
void Literal(out Expression e) { e =null; switch (la.kind) { case 71: { Get(); e = Cci.Literal.True; break; } case 72: { Get(); e = Cci.Literal.False; break; } case 73: { Get(); e = Cci.Literal.Null; break; } case 74: { Get(); if (currentMethod == null) { e = new This(); if (currentType is Struct) e.Type = currentType.GetReferenceType(); else e.Type = currentType; } else { if (currentMethod.ThisParameter == null) { currentMethod.ThisParameter = new This(); } e = currentMethod.ThisParameter; } break; } case 2: case 70: { Num(out e); break; } case 3: { Get(); string s = t.val.Substring(1,t.val.Length-2); e = new Literal(s,SystemTypes.String); break; } case 4: { Get(); string s = t.val; if (s.Length == 3 && s[0] == '\'' && s[2] == '\''){ e = new Literal(s[1], SystemTypes.Char); }else if (s.StartsWith("'\\u")){ try{ string unicode = s.Substring(3,s.Length-4); uint x = Convert.ToUInt32(unicode); char c = Convert.ToChar(x); e= new Literal(c, SystemTypes.Char); }catch{ e = new Literal('\0', SystemTypes.Char); } }else{ e = new Literal('\0', SystemTypes.Char); } break; } case 75: { NewObj(out e); break; } default: SynErr(113); break; } }
public override Expression VisitThis(This This){ if (This == null) return null; TypeNode currentType = this.currentTypeInstance; if (currentType == null) This.Type = SystemTypes.Object; else{ if (currentType.IsValueType) This.Type = currentType.GetReferenceType(); else This.Type = currentType; } return This; }
public override Expression VisitThis(This This) { if (!this.MayReferenceThisAndBase && (this.currentMethod == null // this is true when it is visited as part of a field initializer || !this.insideInvariant // this is true when it is visited as part of a ctor with an explicit call to base in the body )) { this.HandleError(This, Error.ThisInBadContext); return null; } else if (this.currentMethod != null && this.currentMethod.IsStatic) { if (this.currentMethod.NodeType == NodeType.Invariant) this.HandleError(This, Error.ThisInBadContext); else this.HandleError(This, Error.ThisInStaticCode); return null; } if (this.NonNullChecking && (This.Type is Class)) This.Type = OptionalModifier.For(SystemTypes.NonNullType, This.Type); return This; }
//translate expressions public override AstNode VisitThis(This ast) { //push "this m_ilgen.Emit(OpCodes.Ldarg_0); return ast; }
/// <summary> /// Create a proxy method implementing the abstractMethod and which calls the implementingMethod. /// This is needed when the implementingMethod is supposed to be used for the implementation /// of the abstractMethod, but cannot be because it lives in another assembly or isn't virtual /// or the abstractMethod has an out-of-band contract and the implementingMethod must have /// an identical type signature (i.e., no optional type modifiers for the non-null types). /// </summary> /// <param name="type">The type containing the implementingMethod and to which the /// proxy will be added as a member.</param> /// <param name="abstractMethod">The abstract method that the proxy is an implementation of.</param> /// <param name="implementingMethod">The implementing method that is supposed to implement /// the abstractMethod, but is unable to for various reasons.</param> /// <returns>The newly created proxy method.</returns> private Method CreateProxy(TypeNode type, Method abstractMethod, Method implementingMethod) { ParameterList parameters = abstractMethod.Parameters; if (parameters == null) parameters = new ParameterList(0); else parameters = parameters.Clone(); int m = parameters.Count; ExpressionList arguments = new ExpressionList(m); for (int j = 0; j < m; j++) { Parameter p = (Parameter)parameters[j].Clone(); parameters[j] = p; if (this.typeSystem.IsNonNullType(p.Type)) { arguments.Add(this.typeSystem.ExplicitNonNullCoercion(p, p.Type)); } else { arguments.Add(p); } p.Type = TypeNode.DeepStripModifiers(p.Type, (abstractMethod.Template!=null)?abstractMethod.Template.Parameters[j].Type:null, SystemTypes.NonNullType); } This ThisParameter = new This(this.currentType); StatementList statements = new StatementList(2); NodeType typeOfCall = type.IsValueType ? NodeType.Call : NodeType.Callvirt; MethodCall mCall = new MethodCall(new MemberBinding(ThisParameter, implementingMethod), arguments, typeOfCall, implementingMethod.ReturnType); if (implementingMethod.ReturnType != SystemTypes.Void) { statements.Add(new Return(mCall)); } else { statements.Add(new ExpressionStatement(mCall)); statements.Add(new Return()); } TypeNode returnType = TypeNode.DeepStripModifiers(abstractMethod.ReturnType, (abstractMethod.Template != null) ? abstractMethod.Template.ReturnType : null, SystemTypes.NonNullType); ProxyMethod proxy = new ProxyMethod(type, null, new Identifier(abstractMethod.DeclaringType.Name + "." + abstractMethod.Name, implementingMethod.Name.SourceContext), parameters, returnType, new Block(statements)); proxy.ProxyFor = implementingMethod; proxy.ThisParameter = ThisParameter; proxy.CallingConvention = CallingConventionFlags.HasThis; proxy.Flags = MethodFlags.CompilerControlled | MethodFlags.HideBySig | MethodFlags.NewSlot | MethodFlags.Virtual | MethodFlags.Final; proxy.ImplementedInterfaceMethods = new MethodList(abstractMethod); type.Members.Add(proxy); return proxy; }
public override Expression VisitThis(This This) { throw new ApplicationException("unimplemented"); }
protected virtual void VisitThis(This This){ this.ILGenerator.Emit(OpCodes.Ldarg_0); }
public virtual Expression VisitThis(This This, This changes, This deletions, This insertions){ this.UpdateSourceContext(This, changes); if (This == null) return changes; if (changes != null){ if (deletions == null || insertions == null) Debug.Assert(false); else{ } }else if (deletions != null) return null; return This; }
public virtual Expression VisitThis(This This1, This This2) { if (This1 == null) return null; if (This2 == null) This1.Type = this.VisitTypeReference(This1.Type, null); else This1.Type = this.VisitTypeReference(This1.Type, This2.Type); return This1; }