Exemplo n.º 1
0
    /// <summary>
    /// Merge two lists together
    /// </summary>
    /// <param name="st"></param>
    /// <param name="solution_list"></param>
    /// <returns></returns>
    public IEnumerable<Solution> Resolve(Statement st, Solution solution) {

      IVariable lv = null;
      List<Expression> call_arguments;
      IList result = null;
      InitArgs(st, out lv, out call_arguments);
      Contract.Assert(lv != null, Error.MkErr(st, 8));
      Contract.Assert(tcce.OfSize(call_arguments, 2), Error.MkErr(st, 0, 2, call_arguments.Count));

      foreach (var arg1 in ResolveExpression(call_arguments[0])) {
        foreach (var arg2 in ResolveExpression(call_arguments[1])) {
          // valdiate the argument types
          Type type1 = arg1.GetType().GetGenericArguments().Single();
          Type type2 = arg2.GetType().GetGenericArguments().Single();
          Contract.Assert(type1.Equals(type2), Error.MkErr(st, 1, type1));

          if (!(arg1 is IEnumerable) || !(arg2 is IEnumerable))
            Contract.Assert(false, Error.MkErr(st, 1, typeof(IEnumerable)));

          dynamic darg1 = arg1;
          dynamic darg2 = arg2;

          result = MergeLists(darg1, darg2, type1);
          yield return AddNewLocal(lv, result);
        }
      }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Replace a singleton with a new term
        /// </summary>
        /// <param name="st">replace_singleton(); Statement</param>
        /// <param name="solution_list">Reference to the solution tree</param>
        /// <returns> null if success; error message otherwise</returns>
        private void Replace(Statement st, ref List<Solution> solution_list)
        {
            IVariable lv = null;
            List<Expression> call_arguments = null;
            List<Expression> processed_args = new List<Expression>(3);
            Expression old_singleton = null;
            Expression new_term = null;
            Expression formula = null;

            InitArgs(st, out lv, out call_arguments);
            Contract.Assert(lv != null, Util.Error.MkErr(st,8));
            Contract.Assert(tcce.OfSize(call_arguments, 3), Util.Error.MkErr(st, 0, 3, call_arguments.Count));

            ProcessArg(call_arguments[0], out old_singleton);
            ProcessArg(call_arguments[1], out new_term);
            ProcessArg(call_arguments[2], out formula);
            
            ExpressionTree et = ExpressionTree.ExpressionToTree(formula);

            List<Expression> exp_list = new List<Expression>();

            ReplaceTerm(old_singleton, new_term, et, ref exp_list);
            // branch
            if (exp_list.Count > 0)
            {
                for (int i = 0; i < exp_list.Count; i++)
                {
                    AddLocal(lv, exp_list[i]);
                    solution_list.Add(new Solution(this.Copy()));
                }
            }
        }
Exemplo n.º 3
0
 public IEnumerable<Solution> Resolve(Statement st, Solution solution) {
   Contract.Assert(ExtractGuard(st) != null, Error.MkErr(st, 2));
   /**
    * Check if the loop guard can be resolved localy
    */
   return IsResolvable() ? ExecuteLoop(st as WhileStmt) : InsertLoop(st as WhileStmt);
 }
Exemplo n.º 4
0
    private Solution GenerateExpression(Statement st) {
      IVariable lv = null;
      List<Expression> callArguments = null;
      InitArgs(st, out lv, out callArguments);
      BinaryExpr bexp = null;
      foreach (var lhsValue in ResolveExpression(callArguments[0])) {
        Expression lhs = null;
        if (lhsValue is Expression)
          lhs = lhsValue as Expression;
        else if (lhsValue is IVariable)
          lhs = VariableToExpression(lhsValue as IVariable);
        foreach (var rhsValue in ResolveExpression(callArguments[2])) {
          Expression rhs = null;
          if (rhsValue is Expression)
            rhs = rhsValue as Expression;
          else if (rhsValue is IVariable)
            rhs = VariableToExpression(rhsValue as IVariable);
          foreach (var op in ResolveExpression(callArguments[1])) {

            var opLiteral = op as StringLiteralExpr;
            string opString = opLiteral?.Value.ToString();
            bexp = new BinaryExpr(st.Tok, ToOpCode(opString), lhs, rhs);
          }
        }
      }
      return AddNewLocal(lv, bexp);
    }
Exemplo n.º 5
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return
     Replace(Target, oldValue, newValue, n => Target= n)
     ||
     base.Replace(oldValue, newValue);
 }
			public IfStatement (int startIndex, ConditionStatement condition, Statement elseStatement, Statement endIfStatement)
			{
				Start = startIndex;
				Condition = condition;
				ElseStatement = elseStatement;
					EndIfStatement = endIfStatement;
			}
Exemplo n.º 7
0
	public void Select (Statement template, StatementSink sink)
	{
		// extract the fields for easy access
		Entity subj = template.Subject;
		Entity pred = template.Predicate;
		Resource obj = template.Object;

		// convert the SemWeb fields to the RDFQuery fields
		Uri s;
		string p, o;
		rdf_to_beagle_hook (subj, pred, obj, out s, out p, out o);

		RDFQuery query = new RDFQuery (s, p, o);
		RDFQueryResult result = (RDFQueryResult) query.Send ();
		
		foreach (Hit hit in result.Hits) {
			Entity subject = new Entity (hit.Uri.ToString ()); //FIXME: Do we have to use strings here?
			foreach (Property prop in hit.Properties) {
				Entity predicate = BeaglePropertyToEntity (prop.Type, prop.Key);
				Resource _object;
				property_to_rdf_hook (prop, out _object);
			
				// now create a the statement and add it to the result
				Statement st = new Statement (subject, predicate, _object);
				sink.Add (st);
			}
		}
	}
Exemplo n.º 8
0
		public ForLoopStatement(ScriptLoadingContext lcontext, Token nameToken, Token forToken)
			: base(lcontext)
		{
			//	for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 

			// lexer already at the '=' ! [due to dispatching vs for-each]
			CheckTokenType(lcontext, TokenType.Op_Assignment);

			m_Start = Expression.Expr(lcontext);
			CheckTokenType(lcontext, TokenType.Comma);
			m_End = Expression.Expr(lcontext);

			if (lcontext.Lexer.Current.Type == TokenType.Comma)
			{
				lcontext.Lexer.Next();
				m_Step = Expression.Expr(lcontext);
			}
			else
			{
				m_Step = new LiteralExpression(lcontext, DynValue.NewNumber(1));
			}

			lcontext.Scope.PushBlock();
			m_VarName = lcontext.Scope.DefineLocal(nameToken.Text);
			m_RefFor = forToken.GetSourceRef(CheckTokenType(lcontext, TokenType.Do));
			m_InnerBlock = new CompositeStatement(lcontext);
			m_RefEnd = CheckTokenType(lcontext, TokenType.End).GetSourceRef();
			m_StackFrame = lcontext.Scope.PopBlock();

			lcontext.Source.Refs.Add(m_RefFor);
			lcontext.Source.Refs.Add(m_RefEnd);
		}		
Exemplo n.º 9
0
 public override bool Replace(Node oldValue, Node newValue)
 {
   return 
     Replace(Statement, oldValue, newValue, n => Statement = n)
     ||
     base.Replace(oldValue, newValue);
 }
Exemplo n.º 10
0
 public ForStatement(Expression init, Expression condition, Expression loop, Statement body)
 {
     this.Init = init;
     this.Condition = condition;
     this.Loop = loop;
     this.Body = body;
 }
 public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition)
 {
     this.condition = condition;
     this.embeddedStatement = embeddedStatement;
     this.conditionType = conditionType;
     this.conditionPosition = conditionPosition;
 }
Exemplo n.º 12
0
        private static Statement convertStatement(JsonData jStatement)
        {
            if (jStatement[JsonDocumentFields.STATEMENT_EFFECT] == null || !jStatement[JsonDocumentFields.STATEMENT_EFFECT].IsString)
                return null;


            string jEffect = (string)jStatement[JsonDocumentFields.STATEMENT_EFFECT];
            Statement.StatementEffect effect;
            if (JsonDocumentFields.EFFECT_VALUE_ALLOW.Equals(jEffect))
                effect = Statement.StatementEffect.Allow;
            else
                effect = Statement.StatementEffect.Deny;

            Statement statement = new Statement(effect);

            if (jStatement[JsonDocumentFields.STATEMENT_ID] != null && jStatement[JsonDocumentFields.STATEMENT_ID].IsString)
                statement.Id = (string)jStatement[JsonDocumentFields.STATEMENT_ID];

            convertActions(statement, jStatement);
            convertResources(statement, jStatement);
            convertCondition(statement, jStatement);
            convertPrincipals(statement, jStatement);

            return statement;
        }
Exemplo n.º 13
0
    public static SUnit TranslateMethodCall(Statement statement)
    {
        var expressions = statement.GetExpressions();

        // Give an empty SUnit if statement has no expressions.
        if (expressions.Count() == 0)
        {
            return new SUnit(SUnitType.SingleMethodCall, "", "", "", new List<string>(), "void");
        }

        // Build a minimal method context and declaration node required by SWUM.
        var exp = expressions.First();
        string type = exp.ResolveType().ToString();
        MethodContext mc = new MethodContext(type);
        MethodDeclarationNode mdn = new MethodDeclarationNode(exp.ToString(), mc);

        // Apply the SWUM to our statement
        var swumRule = SetupBaseVerbRule();
        swumRule.InClass(mdn);
        swumRule.ConstructSwum(mdn);

        // Build and return SUnit from the SWUM
        SUnit sunit = new SUnit();
        sunit.action = GetAction(mdn);
        sunit.theme = GetTheme(mdn);
        sunit.args = GetArgs(mdn);

        return sunit;
    }
Exemplo n.º 14
0
 public Program(SourceSpan span, SourceSpan start, SourceSpan end, Statement body)
     : base(span)
 {
     _start = start;
     _end = end;
     _body = body;
 }
Exemplo n.º 15
0
 public Block(VarDeclaration[] varDeclarations, Statement[] statements)
 {
     VarDeclarations = varDeclarations;
     Statements = statements;
     AddChildren(varDeclarations);
     AddChildren(statements);
 }
Exemplo n.º 16
0
    public static SUnit Translate(Statement statement)
    {
        // Return empty SUnit for empty statement.
        if(statement.GetExpressions().Count() == 0)
        {
            return new SUnit(SUnitType.SingleMethodCall, "", "", "", new List<string>(), "void");
        }

        if(statement is ReturnStatement)
        {
            //Console.WriteLine("TRANSLATE RETURN");
            return TranslateReturn(statement);
        }

        //
        if (statement.GetExpressions().First() is VariableDeclaration)
        {
            //Console.WriteLine("TRANSLATE ASSIGNMENT");
            return TranslateAssignment(statement);

        }

        else
        {
            //Console.WriteLine("TRANSLATE METHODCALL");
            return TranslateMethodCall(statement);
        }
    }
Exemplo n.º 17
0
        public Generator(Statement stmt, string moduleName)
        {
            var path = Path.GetFileNameWithoutExtension(moduleName);
            var assemblyName = new AssemblyName(path);
            var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Save);
            var moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName);
            var typeBuilder = moduleBuilder.DefineType(moduleName);

            var methodBuilder = typeBuilder.DefineMethod("Main", MethodAttributes.Static, typeof(void), Type.EmptyTypes);

            // CodeGenerator
            ilgenerator = methodBuilder.GetILGenerator();
            symbolsTable = new Dictionary<string, LocalBuilder>();

            // Go Compile!
            GenerateStatements(stmt);

            ilgenerator.Emit(OpCodes.Call, typeof(Console).GetMethod("ReadKey", BindingFlags.Public | BindingFlags.Static, null, new Type[] { }, null));
            ilgenerator.Emit(OpCodes.Ret);
            typeBuilder.CreateType();
            moduleBuilder.CreateGlobalFunctions();
            assemblyBuilder.SetEntryPoint(methodBuilder);
            assemblyBuilder.Save(moduleName);

            symbolsTable = null;
            ilgenerator = null;
        }
Exemplo n.º 18
0
        public PythonAst(Statement body, bool isModule, ModuleOptions languageFeatures, bool printExpressions, CompilerContext context) {
            ContractUtils.RequiresNotNull(body, "body");

            _body = body;
            _isModule = isModule;
            _printExpressions = printExpressions;
            _languageFeatures = languageFeatures;
            _mode = ((PythonCompilerOptions)context.Options).CompilationMode ?? GetCompilationMode(context);
            _compilerContext = context;
            FuncCodeExpr = _functionCode;

            PythonCompilerOptions pco = context.Options as PythonCompilerOptions;
            Debug.Assert(pco != null);

            string name;
            if (!context.SourceUnit.HasPath || (pco.Module & ModuleOptions.ExecOrEvalCode) != 0) {
                name = "<module>";
            } else {
                name = context.SourceUnit.Path;
            }

            _name = name;
            Debug.Assert(_name != null);
            PythonOptions po = ((PythonContext)context.SourceUnit.LanguageContext).PythonOptions;

            if (po.EnableProfiler && _mode != CompilationMode.ToDisk) {
                _profiler = Profiler.GetProfiler(PyContext);
            }

            _document = context.SourceUnit.Document ?? Ast.SymbolDocument(name, PyContext.LanguageGuid, PyContext.VendorGuid);
        }
Exemplo n.º 19
0
 private void Init(Statement statement)
 {
     EditStatement = statement;
     EditStatement.PaidDate = DateTime.Now;
     EditStatement.PaidAmount = EditStatement.Balance;
     UpdateStatus();
 }
Exemplo n.º 20
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Statement> TableToList(DataTable table){
			List<Statement> retVal=new List<Statement>();
			Statement statement;
			for(int i=0;i<table.Rows.Count;i++) {
				statement=new Statement();
				statement.StatementNum = PIn.Long  (table.Rows[i]["StatementNum"].ToString());
				statement.PatNum       = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				statement.DateSent     = PIn.Date  (table.Rows[i]["DateSent"].ToString());
				statement.DateRangeFrom= PIn.Date  (table.Rows[i]["DateRangeFrom"].ToString());
				statement.DateRangeTo  = PIn.Date  (table.Rows[i]["DateRangeTo"].ToString());
				statement.Note         = PIn.String(table.Rows[i]["Note"].ToString());
				statement.NoteBold     = PIn.String(table.Rows[i]["NoteBold"].ToString());
				statement.Mode_        = (StatementMode)PIn.Int(table.Rows[i]["Mode_"].ToString());
				statement.HidePayment  = PIn.Bool  (table.Rows[i]["HidePayment"].ToString());
				statement.SinglePatient= PIn.Bool  (table.Rows[i]["SinglePatient"].ToString());
				statement.Intermingled = PIn.Bool  (table.Rows[i]["Intermingled"].ToString());
				statement.IsSent       = PIn.Bool  (table.Rows[i]["IsSent"].ToString());
				statement.DocNum       = PIn.Long  (table.Rows[i]["DocNum"].ToString());
				statement.DateTStamp   = PIn.DateT (table.Rows[i]["DateTStamp"].ToString());
				statement.IsReceipt    = PIn.Bool  (table.Rows[i]["IsReceipt"].ToString());
				statement.IsInvoice    = PIn.Bool  (table.Rows[i]["IsInvoice"].ToString());
				statement.IsInvoiceCopy= PIn.Bool  (table.Rows[i]["IsInvoiceCopy"].ToString());
				statement.EmailSubject = PIn.String(table.Rows[i]["EmailSubject"].ToString());
				statement.EmailBody    = PIn.String(table.Rows[i]["EmailBody"].ToString());
				retVal.Add(statement);
			}
			return retVal;
		}
Exemplo n.º 21
0
    private IEnumerable<Solution> ReplaceConstant(Statement st) {
      IVariable lv = null;
      List<Expression> callArgs;
      InitArgs(st, out lv, out callArgs);
      Contract.Assert(lv != null, Error.MkErr(st, 8));
      Contract.Assert(callArgs.Count == 3, Error.MkErr(st, 0, 3, callArgs.Count));
      var varLists = new List<List<IVariable>>();
      var constLists = new List<List<Expression>>();

      foreach (var arg2 in ResolveExpression(callArgs[1])) {
        var tmp = arg2 as List<Expression>;
        Contract.Assert(tmp != null, Error.MkErr(st, 1, "Term Seq"));
        constLists.Add(tmp);
      }
      foreach (var arg2 in ResolveExpression(callArgs[2])) {
        var tmp = arg2 as List<IVariable>;
        Contract.Assert(tmp != null, Error.MkErr(st, 1, "Term Seq"));
        varLists.Add(tmp);
      }

      foreach (var arg1 in ResolveExpression(callArgs[0])) {
        var expression = arg1 as Expression;
        Contract.Assert(expression != null, Error.MkErr(st, 1, "Term"));
        foreach (var varList in varLists) {
          foreach (var constList in constLists) {
            foreach (var item in ReplaceConstants(ExpressionTree.ExpressionToTree(expression), constList, varList)) {
              yield return AddNewLocal(lv, item);
            }
          }
        }
      }
    }
Exemplo n.º 22
0
        ArrayList iterator; // list of StatmentExpressions

        #endregion Fields

        #region Constructors

        public ForStatement(ArrayList initializers, Expression condition, ArrayList iterator, Statement embeddedStatement)
        {
            this.initializers = initializers;
            this.condition = condition;
            this.iterator = iterator;
            this.embeddedStatement = embeddedStatement;
        }
Exemplo n.º 23
0
 public RetRemover(Statement root)
 {
     _root = root;
     IList<Statement> slist = root.AsStatementList();
     if (slist.Count > 0)
         _lastStatement = slist.Last();
 }
Exemplo n.º 24
0
        public void CreateStatement_ExpectValid()
        {
            //Arrange
            string localStatementIdString = "STMT01";
            StatementId localStatementId = new StatementId(localStatementIdString);

            SpecificFieldsFactory localfactory = new SpecificFieldsFactory();
            string[] listspecificfields = { "Credit Card", "12" };
            StatementType localStatementType = new StatementType(localfactory, "CreditCardProvider", listspecificfields);

            StatementSpecificFields localspecificfields = localStatementType.getSpecificFields();

            int localstatementAccountnumber = 1234567;
            string localstatementAccountholdername = "Bruce";
            DateTime localstatementDate = DateTime.Now;
            StatementCommonFields localStatementCommonFields = new StatementCommonFields(localstatementAccountnumber, localstatementAccountholdername, localstatementDate);

            APSUser localAPSUser = new APSUser(new APSUserId("1"), "testusername", "testpassword");
            BillingAccount localBillingAccount = new BillingAccount(new BillingAccountId("1"), new BillingCompanyId("1"), "testusername", "testpassword", localAPSUser);

            //Act
            Statement localStatement = new Statement(localStatementId, localStatementCommonFields, localStatementType, localspecificfields, localAPSUser, localBillingAccount);

            //Assert
            Assert.AreEqual(localStatement.StatementId, localStatementId);
            Assert.AreEqual(localStatement.StatementCommonFields, localStatementCommonFields);
            Assert.AreEqual(localStatement.StatementType, localStatementType);
            Assert.AreEqual(localStatement.StatementSpecificFields, localspecificfields);
            Assert.AreEqual(localStatement.APSUser, localAPSUser);
            Assert.AreEqual(localStatement.BillingAccount, localBillingAccount);
        }
 public UnaryExpression(Statement statement, object p, Expression expression, SourceData sourceData)
     : base(statement, sourceData)
 {
     // TODO: Complete member initialization
     this.p = p;
     this.expression = expression;
 }
Exemplo n.º 26
0
        public StopLossRule(string name,
            TimeIntervalDefinition executeFrequency,
            Variable iterator,
            Statement statement,
            BooleanExpression stopLossCondition,
            Variable positionSet)

            : base(name, executeFrequency,
            // wrap the statement with for all loop
            // and null checking for position
               new ForAllStatement(
                    iterator, positionSet,
                    new IfStatement(new NotEqual(){
                        LeftExpression = new PropertyAccessor(iterator,"Currency"),
                        RightExpression = new Constant(typeof(DBNull),null)},
                        new CompositeStatement(
                            new List<Statement>{
                                    statement,
                                    new IfStatement(stopLossCondition,new PositionStopLoss(iterator))
                                }
                        )            
                    )
                    
                ), stopLossCondition, positionSet
            
            
            )
        {
        }
Exemplo n.º 27
0
		public IfStatement(Predicate condition, Statement thenStatement, Statement elseStatement) {
			Debug.Assert(condition != null);
			Debug.Assert(thenStatement != null);
			this.condition = condition;
			this.thenStatement = thenStatement;
			this.elseStatement = elseStatement;
		}
 public QueryRecordExecutor(Cluster cluster, QueryPolicy policy, Statement statement)
     : base(cluster, policy, statement)
 {
     this.recordSet = new RecordSet(this, policy.recordQueueSize, cancel.Token);
     statement.Prepare(true);
     InitializeThreads();
 }
Exemplo n.º 29
0
 public void PopTarget(Statement s)
 {
   Debug.Assert(Targets.Count > 0 && Targets[Targets.Count - 1] == s, "Target statement {0} does not exist in the list", s);
   Targets.RemoveAt(Targets.Count - 1);
   if (CompletionType == Interpreter.CompletionTypes.Break && CompletionTargetStatement == s)
     SetCompletion(CompletionTypes.Normal, null);
 }
Exemplo n.º 30
0
    private Solution Constants(Statement st) {
      IVariable lv = null;
      List<Expression> callArgs;
      var result = new List<Expression>();
      InitArgs(st, out lv, out callArgs);
      Contract.Assert(lv != null, Error.MkErr(st, 8));
      Contract.Assert(callArgs.Count == 1, Error.MkErr(st, 0, 1, callArgs.Count));

      foreach(var arg1 in ResolveExpression(callArgs[0])) {
        var expression = arg1 as Expression;
        Contract.Assert(expression != null, Error.MkErr(st, 1, "Term"));
        var expt = ExpressionTree.ExpressionToTree(expression);
        var leafs = expt.GetLeafData();
        foreach(var leaf in leafs) {
          if(leaf is LiteralExpr) {
            if(!result.Exists(j => (j as LiteralExpr)?.Value == (leaf as LiteralExpr)?.Value)) {
              result.Add(leaf);
            }
          } else if(leaf is ExprDotName) {
            var edn = leaf as ExprDotName;
            if (!result.Exists(j => SingletonEquality(j, edn))) {
              result.Add(leaf);
            }
          }
        }

      }

      return AddNewLocal(lv, result);
    }
Exemplo n.º 31
0
        public IActionResult Post(Statement data)
        {
            var createdAbout = service.Add(data);

            return(CreatedAtAction("Get", new { id = createdAbout.Data.Id }, createdAbout));
        }
Exemplo n.º 32
0
        /// <summary>
        /// Переносит данные из объекта в элементы на форме
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        public override void MoveDataFromObject2GUI(Statement statement)
        {
            if (statement.Address != null)
            {
                // Лицо без определенного места жительства
                if (statement.Address.IsHomeless != null)
                {
                    chBIsHomeless.Checked = (bool)statement.Address.IsHomeless;
                }

                // адрес в свободной форме
                if (statement.Address.IsNotStructureAddress != null)
                {
                    chbIsFreeMainAddress.Checked = (bool)statement.Address.IsNotStructureAddress;
                    mainAddressKladr.Mode        = (bool)statement.Address.IsNotStructureAddress
                                    ? KladrUserControlMode.Free
                                    : KladrUserControlMode.Database;
                }

                // switch (GetKLADRControlType())
                // {
                // case KLADRControlType.Structured:
                // {
                MoveDataFromObject2GUI(statement.Address, mainAddressKladr);

                // }
                // break;
                // case KLADRControlType.Intellisense:
                // {
                MoveDataFromObject2GUI(statement.Address, mainAddressKladrIntellisense);

                // }
                // break;
                // }

                // Дата регистрации
                tbDateRegistration.Text = statement.Address.DateRegistration == null
                                    ? string.Empty
                                    : statement.Address.DateRegistration.Value.ToShortDateString();
            }

            //// Проверка на совпадение документов
            //chBCopyFromUDL.Checked = statement.DocumentUdl == null || statement.DocumentRegistration == null
            //                         || statement.DocumentUdl.id == statement.DocumentRegistration.id;

            //if (statement.DocumentRegistration != null)
            //{
            //  // Вид документа
            //  if (statement.DocumentRegistration.DocumentType != null)
            //  {
            //    var documentType = statement.DocumentRegistration.DocumentType;
            //    documentRegistration.FillDocumentTypeDdl(
            //      new[]
            //        {
            //          new ListItem
            //            {
            //               Text = documentType.Name, Value = documentType.id.ToString(CultureInfo.InvariantCulture)
            //            }
            //        },
            //      documentType.id.ToString(CultureInfo.InvariantCulture));
            //    documentRegistration.DocumentType = statement.DocumentRegistration.DocumentType.id;
            //  }

            //  // Серия
            //  documentRegistration.DocumentSeries = statement.DocumentRegistration.Series;

            //  // Номер
            //  documentRegistration.DocumentNumber = statement.DocumentRegistration.Number;

            //  // Выдавший орган
            //  documentRegistration.DocumentIssuingAuthority = statement.DocumentRegistration.IssuingAuthority;

            //  // Дата выдачи
            //  documentRegistration.DocumentIssueDate = statement.DocumentRegistration.DateIssue;
            //  documentRegistration.DocumentExpDate = statement.DocumentRegistration.DateExp;


            //}

            if (statement.ContactInfo != null)
            {
                // Телефон домашний
                tbHomePhone.Text = statement.ContactInfo.HomePhone;

                // Телефон рабочий
                //tbWorkPhone.Text = statement.ContactInfo.WorkPhone;

                // Электронная почта
                tbEmail.Text = statement.ContactInfo.Email;
            }

            if (statement.Address2 != null)
            {
                // адрес в свободной форме
                if (statement.Address2.IsNotStructureAddress != null)
                {
                    chbIsFreeResidencyAddress.Checked = (bool)statement.Address2.IsNotStructureAddress;

                    // mainAddressKladr.Mode = (bool)statement.Address.IsNotStructureAddress ?
                    // KLADRUserControlMode.Free : KLADRUserControlMode.Database;
                }

                //switch (GetKLADRControlType())
                //{
                //  case KLADRControlType.Structured:
                //    {
                MoveDataFromObject2GUI(statement.Address2, residencyAddressKladr);
                //    }

                //    break;
                //  case KLADRControlType.Intellisense:
                //    {
                MoveDataFromObject2GUI(statement.Address2, residencyAddressKladrIntellisense);
                //    }

                //    break;
                //}

                rbYesResAddress.Checked = true;
                rbNoResAddress.Checked  = false;
            }

            RestoreAfterPostBack();
        }
Exemplo n.º 33
0
 private Completion ExecuteStatement(Statement statement)
 {
     return(_engine.ExecuteStatement(statement));
 }
Exemplo n.º 34
0
 public void Match(Identifier id, Statement stm)
 {
     this.stmCur = stm;
     this.id     = id;
     stm.Instruction.Accept(this);
 }
Exemplo n.º 35
0
 public IncrementedUse(Statement stm, BinaryExpression exp, Constant inc)
 {
     this.Statement  = stm;
     this.Expression = exp;
     this.Increment  = inc;
 }
 public IfStatement(Expression expression, Statement ifBranch, Statement elseBranch)
 {
     this.expression = expression;
     this.ifBranch   = ifBranch;
     this.elseBranch = elseBranch;
 }
Exemplo n.º 37
0
        public override object VisitBlockStatement(BlockStatement blockStatement, object data)
        {
            int numberOfVariablesOutsideBlock = currentlyUsedVariableNames.Count;

            base.VisitBlockStatement(blockStatement, data);
            foreach (ExpressionStatement stmt in blockStatement.Statements.OfType <ExpressionStatement>().ToArray())
            {
                Match displayClassAssignmentMatch = displayClassAssignmentPattern.Match(stmt);
                if (!displayClassAssignmentMatch.Success)
                {
                    continue;
                }

                ILVariable variable = displayClassAssignmentMatch.Get <AstNode>("variable").Single().Annotation <ILVariable>();
                if (variable == null)
                {
                    continue;
                }
                TypeDefinition type = variable.Type.ResolveWithinSameModule();
                if (!IsPotentialClosure(context, type))
                {
                    continue;
                }
                if (displayClassAssignmentMatch.Get <AstType>("type").Single().Annotation <TypeReference>().ResolveWithinSameModule() != type)
                {
                    continue;
                }

                // Looks like we found a display class creation. Now let's verify that the variable is used only for field accesses:
                bool ok = true;
                foreach (var identExpr in blockStatement.Descendants.OfType <IdentifierExpression>())
                {
                    if (identExpr.Identifier == variable.Name && identExpr != displayClassAssignmentMatch.Get("variable").Single())
                    {
                        if (!(identExpr.Parent is MemberReferenceExpression && identExpr.Parent.Annotation <FieldReference>() != null))
                        {
                            ok = false;
                        }
                    }
                }
                if (!ok)
                {
                    continue;
                }
                Dictionary <FieldReference, AstNode> dict = new Dictionary <FieldReference, AstNode>();

                // Delete the variable declaration statement:
                VariableDeclarationStatement displayClassVarDecl = PatternStatementTransform.FindVariableDeclaration(stmt, variable.Name);
                if (displayClassVarDecl != null)
                {
                    displayClassVarDecl.Remove();
                }

                // Delete the assignment statement:
                AstNode cur = stmt.NextSibling;
                stmt.Remove();

                // Delete any following statements as long as they assign parameters to the display class
                BlockStatement    rootBlock            = blockStatement.Ancestors.OfType <BlockStatement>().LastOrDefault() ?? blockStatement;
                List <ILVariable> parameterOccurrances = rootBlock.Descendants.OfType <IdentifierExpression>()
                                                         .Select(n => n.Annotation <ILVariable>()).Where(p => p != null && p.IsParameter).ToList();
                AstNode next;
                for (; cur != null; cur = next)
                {
                    next = cur.NextSibling;

                    // Test for the pattern:
                    // "variableName.MemberName = right;"
                    ExpressionStatement closureFieldAssignmentPattern = new ExpressionStatement(
                        new AssignmentExpression(
                            new NamedNode("left", new MemberReferenceExpression {
                        Target     = new IdentifierExpression(variable.Name),
                        MemberName = Pattern.AnyString
                    }),
                            new AnyNode("right")
                            )
                        );
                    Match m = closureFieldAssignmentPattern.Match(cur);
                    if (m.Success)
                    {
                        FieldDefinition fieldDef    = m.Get <MemberReferenceExpression>("left").Single().Annotation <FieldReference>().ResolveWithinSameModule();
                        AstNode         right       = m.Get <AstNode>("right").Single();
                        bool            isParameter = false;
                        bool            isDisplayClassParentPointerAssignment = false;
                        if (right is ThisReferenceExpression)
                        {
                            isParameter = true;
                        }
                        else if (right is IdentifierExpression)
                        {
                            // handle parameters only if the whole method contains no other occurrence except for 'right'
                            ILVariable v = right.Annotation <ILVariable>();
                            isParameter = v.IsParameter && parameterOccurrances.Count(c => c == v) == 1;
                            if (!isParameter && IsPotentialClosure(context, v.Type.ResolveWithinSameModule()))
                            {
                                // parent display class within the same method
                                // (closure2.localsX = closure1;)
                                isDisplayClassParentPointerAssignment = true;
                            }
                        }
                        else if (right is MemberReferenceExpression)
                        {
                            // copy of parent display class reference from an outer lambda
                            // closure2.localsX = this.localsY
                            MemberReferenceExpression mre = m.Get <MemberReferenceExpression>("right").Single();
                            do
                            {
                                // descend into the targets of the mre as long as the field types are closures
                                FieldDefinition fieldDef2 = mre.Annotation <FieldReference>().ResolveWithinSameModule();
                                if (fieldDef2 == null || !IsPotentialClosure(context, fieldDef2.FieldType.ResolveWithinSameModule()))
                                {
                                    break;
                                }
                                // if we finally get to a this reference, it's copying a display class parent pointer
                                if (mre.Target is ThisReferenceExpression)
                                {
                                    isDisplayClassParentPointerAssignment = true;
                                }
                                mre = mre.Target as MemberReferenceExpression;
                            } while (mre != null);
                        }
                        if (isParameter || isDisplayClassParentPointerAssignment)
                        {
                            dict[fieldDef] = right;
                            cur.Remove();
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                // Now create variables for all fields of the display class (except for those that we already handled as parameters)
                List <Tuple <AstType, ILVariable> > variablesToDeclare = new List <Tuple <AstType, ILVariable> >();
                foreach (FieldDefinition field in type.Fields)
                {
                    if (field.IsStatic)
                    {
                        continue;                         // skip static fields
                    }
                    if (dict.ContainsKey(field))          // skip field if it already was handled as parameter
                    {
                        continue;
                    }
                    string capturedVariableName = field.Name;
                    if (capturedVariableName.StartsWith("$VB$Local_", StringComparison.Ordinal) && capturedVariableName.Length > 10)
                    {
                        capturedVariableName = capturedVariableName.Substring(10);
                    }
                    EnsureVariableNameIsAvailable(blockStatement, capturedVariableName);
                    currentlyUsedVariableNames.Add(capturedVariableName);
                    ILVariable ilVar = new ILVariable
                    {
                        IsGenerated = true,
                        Name        = capturedVariableName,
                        Type        = field.FieldType,
                    };
                    variablesToDeclare.Add(Tuple.Create(AstBuilder.ConvertType(field.FieldType, field), ilVar));
                    dict[field] = new IdentifierExpression(capturedVariableName).WithAnnotation(ilVar);
                }

                // Now figure out where the closure was accessed and use the simpler replacement expression there:
                foreach (var identExpr in blockStatement.Descendants.OfType <IdentifierExpression>())
                {
                    if (identExpr.Identifier == variable.Name)
                    {
                        MemberReferenceExpression mre = (MemberReferenceExpression)identExpr.Parent;
                        AstNode replacement;
                        if (dict.TryGetValue(mre.Annotation <FieldReference>().ResolveWithinSameModule(), out replacement))
                        {
                            mre.ReplaceWith(replacement.Clone());
                        }
                    }
                }
                // Now insert the variable declarations (we can do this after the replacements only so that the scope detection works):
                Statement insertionPoint = blockStatement.Statements.FirstOrDefault();
                foreach (var tuple in variablesToDeclare)
                {
                    var newVarDecl = new VariableDeclarationStatement(tuple.Item1, tuple.Item2.Name);
                    newVarDecl.Variables.Single().AddAnnotation(new CapturedVariableAnnotation());
                    newVarDecl.Variables.Single().AddAnnotation(tuple.Item2);
                    blockStatement.Statements.InsertBefore(insertionPoint, newVarDecl);
                }
            }
            currentlyUsedVariableNames.RemoveRange(numberOfVariablesOutsideBlock, currentlyUsedVariableNames.Count - numberOfVariablesOutsideBlock);
            return(null);
        }
Exemplo n.º 38
0
 private static Statement Await(Statement statement)
 {
     statement.Text.Value = $"await {statement.Text.Value}";
     return(statement);
 }
Exemplo n.º 39
0
 ICodeLocation DecompilerEventListener.CreateStatementNavigator(Program program, Statement stm)
 {
     return(new StatementNavigator(program, stm, sp));
 }
Exemplo n.º 40
0
        protected internal static void FillBody(CodeBlock cb, List <Statement> stmts, Cons body, bool allowtailcall)
        {
            Cons c = body;

            while (c != null)
            {
                Expression e = GetAst(c.car, cb, c.cdr == null);
                Statement  s = null;
                if (c.cdr == null)
                {
                    if (e.Type != cb.ReturnType)
                    {
                        Expression ee = e;
                        while (ee is UnaryExpression)
                        {
                            var ue = ee as UnaryExpression;
                            if (ue.NodeType != AstNodeType.Convert)
                            {
                                break;
                            }
                            if (ue.Operand.Type == cb.ReturnType)
                            {
                                e = ue.Operand;
                                break;
                            }
                            ee = ue.Operand;
                        }
                        if (!(e is VoidExpression))
                        {
                            e = Ast.ConvertHelper(e, cb.ReturnType);
                        }
                    }
                    s = MakeTailCallReturn(allowtailcall, e);
                }
                else
                {
                    s = Ast.Statement(e);
                }

                stmts.Add(s);
                c = c.cdr as Cons;
            }

            if (stmts.Count == 0)
            {
                stmts.Add(Ast.Return(Ast.ReadField(null, Unspecified)));
            }

            if (cb.Body != null)
            {
                stmts.InsertRange(0, (cb.Body as BlockStatement).Statements);
            }

            cb.Body = Ast.Block(stmts);
            cb.Body = OptimizeBody(cb.Body);

            if (cb.Parent == null || (cb.Parent.IsGlobal && cb.ParameterCount < 9))
            {
                cb.ExplicitCodeContextExpression = Ast.CodeContext();
            }
        }
Exemplo n.º 41
0
 protected virtual bool CanReachModification(ControlFlowNode node, Statement start,
                                             IDictionary <Statement, IList <Node> > modifications)
 {
     return(node.NextStatement != null && node.NextStatement != start &&
            modifications.ContainsKey(node.NextStatement));
 }
Exemplo n.º 42
0
 private Expression ReplaceDstWithSsaIdentifier(Expression dst, BinaryExpression src, Statement stmLong)
 {
     if (stmLong.Instruction is Assignment ass)
     {
         var sid = ssa.Identifiers.Add(ass.Dst, stmLong, src, false);
         ass.Dst = sid.Identifier;
         return(ass.Dst);
     }
     return(dst);
 }
Exemplo n.º 43
0
 public Node(AstNode astNode, NodeKind kind)
 {
     AstNode             = astNode;
     Kind                = kind;
     ContainingStatement = astNode.GetParent <Statement> ();
 }
Exemplo n.º 44
0
 public Environment(AstNode astNode, Statement body)
     : base(astNode, NodeKind.Environment)
 {
     Body     = body;
     Children = new List <Node> ();
 }
Exemplo n.º 45
0
 internal IfElse(Expression condition, Statement ifTrue, Statement ifFalse)
 {
     Condition = condition;
     IfTrue    = ifTrue;
     IfFalse   = ifFalse;
 }
Exemplo n.º 46
0
 internal WhileLoop(Expression condition, Statement body)
 {
     Condition = condition;
     Body      = body;
 }
Exemplo n.º 47
0
 public static ForLoop For(Variable loopVar, Expression initialValue, Expression condition,
                           Expression increment, Statement body)
 {
     return(new ForLoop(loopVar, initialValue, condition, increment, body));
 }
Exemplo n.º 48
0
 public static WhileLoop While(Expression condition, Statement body)
 {
     return(new WhileLoop(condition, body));
 }
Exemplo n.º 49
0
 public virtual object Visit(Statement stmt)
 {
     Debug.Fail("unknown statement:" + stmt);
     return(null);
 }
Exemplo n.º 50
0
 public static IfElse If(Expression condition, Statement ifTrue)
 {
     return(new IfElse(condition, ifTrue, null));
 }
Exemplo n.º 51
0
        private void construct(String databaseFilePath)
        {
            try {
                ILOG.J2CsMapping.Reflect.Helper.GetNativeType("org.sqlite.JDBC");
            } catch (TypeLoadException ex) {
                // We don't expect this to happen.
                ILOG.J2CsMapping.Util.Logging.Logger.getLogger(typeof(BasicIdentityStorage).FullName).log(
                    ILOG.J2CsMapping.Util.Logging.Level.SEVERE, null, ex);
                return;
            }

            try {
                database_ = System.Data.SqlClient.DriverManager.getConnection("jdbc:sqlite:"
                                                                              + databaseFilePath);

                Statement statement = database_.CreateCommand();
                // Use "try/finally instead of "try-with-resources" or "using" which are not supported before Java 7.
                try {
                    // Check if the TpmInfo table exists.
                    SqlDataReader result = statement
                                           .executeQuery(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.SELECT_MASTER_TPM_INFO_TABLE);
                    bool tpmInfoTableExists = false;
                    if (result.NextResult())
                    {
                        tpmInfoTableExists = true;
                    }
                    result.close();

                    if (!tpmInfoTableExists)
                    {
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_TPM_INFO_TABLE);
                    }

                    // Check if the ID table exists.
                    result = statement.executeQuery(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.SELECT_MASTER_ID_TABLE);
                    bool idTableExists = false;
                    if (result.NextResult())
                    {
                        idTableExists = true;
                    }
                    result.close();

                    if (!idTableExists)
                    {
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_ID_TABLE1);
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_ID_TABLE2);
                    }

                    // Check if the Key table exists.
                    result        = statement.executeQuery(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.SELECT_MASTER_KEY_TABLE);
                    idTableExists = false;
                    if (result.NextResult())
                    {
                        idTableExists = true;
                    }
                    result.close();

                    if (!idTableExists)
                    {
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_KEY_TABLE1);
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_KEY_TABLE2);
                    }

                    // Check if the Certificate table exists.
                    result        = statement.executeQuery(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.SELECT_MASTER_CERT_TABLE);
                    idTableExists = false;
                    if (result.NextResult())
                    {
                        idTableExists = true;
                    }
                    result.close();

                    if (!idTableExists)
                    {
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_CERT_TABLE1);
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_CERT_TABLE2);
                        statement.executeUpdate(net.named_data.jndn.security.identity.Sqlite3IdentityStorageBase.INIT_CERT_TABLE3);
                    }
                } finally {
                    statement.close();
                }
            } catch (SQLException exception) {
                throw new SecurityException("BasicIdentityStorage: SQLite error: "
                                            + exception);
            }
        }
Exemplo n.º 52
0
        public Completion ExecuteStatement(Statement statement)
        {
            var maxStatements = Options._MaxStatements;

            if (maxStatements > 0 && _statementsCount++ > maxStatements)
            {
                throw new StatementsCountOverflowException();
            }

            if (_timeoutTicks > 0 && _timeoutTicks < DateTime.UtcNow.Ticks)
            {
                throw new TimeoutException();
            }

            _lastSyntaxNode = statement;

            if (Options._IsDebugMode)
            {
                DebugHandler.OnStep(statement);
            }

            switch (statement.Type)
            {
            case SyntaxNodes.BlockStatement:
                return(_statements.ExecuteBlockStatement(statement.As <BlockStatement>()));

            case SyntaxNodes.BreakStatement:
                return(_statements.ExecuteBreakStatement(statement.As <BreakStatement>()));

            case SyntaxNodes.ContinueStatement:
                return(_statements.ExecuteContinueStatement(statement.As <ContinueStatement>()));

            case SyntaxNodes.DoWhileStatement:
                return(_statements.ExecuteDoWhileStatement(statement.As <DoWhileStatement>()));

            case SyntaxNodes.DebuggerStatement:
                return(_statements.ExecuteDebuggerStatement(statement.As <DebuggerStatement>()));

            case SyntaxNodes.EmptyStatement:
                return(_statements.ExecuteEmptyStatement(statement.As <EmptyStatement>()));

            case SyntaxNodes.ExpressionStatement:
                return(_statements.ExecuteExpressionStatement(statement.As <ExpressionStatement>()));

            case SyntaxNodes.ForStatement:
                return(_statements.ExecuteForStatement(statement.As <ForStatement>()));

            case SyntaxNodes.ForInStatement:
                return(_statements.ExecuteForInStatement(statement.As <ForInStatement>()));

            case SyntaxNodes.FunctionDeclaration:
                return(new Completion(Completion.Normal, null, null));

            case SyntaxNodes.IfStatement:
                return(_statements.ExecuteIfStatement(statement.As <IfStatement>()));

            case SyntaxNodes.LabeledStatement:
                return(_statements.ExecuteLabelledStatement(statement.As <LabelledStatement>()));

            case SyntaxNodes.ReturnStatement:
                return(_statements.ExecuteReturnStatement(statement.As <ReturnStatement>()));

            case SyntaxNodes.SwitchStatement:
                return(_statements.ExecuteSwitchStatement(statement.As <SwitchStatement>()));

            case SyntaxNodes.ThrowStatement:
                return(_statements.ExecuteThrowStatement(statement.As <ThrowStatement>()));

            case SyntaxNodes.TryStatement:
                return(_statements.ExecuteTryStatement(statement.As <TryStatement>()));

            case SyntaxNodes.VariableDeclaration:
                return(_statements.ExecuteVariableDeclaration(statement.As <VariableDeclaration>()));

            case SyntaxNodes.WhileStatement:
                return(_statements.ExecuteWhileStatement(statement.As <WhileStatement>()));

            case SyntaxNodes.WithStatement:
                return(_statements.ExecuteWithStatement(statement.As <WithStatement>()));

            case SyntaxNodes.Program:
                return(_statements.ExecuteProgram(statement.As <Program>()));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 53
0
 public StatementDeclaration(Statement statement, TextSpan textSpan, FileNode fileNode)
     : base(new IdToken("Statement"), textSpan, fileNode)
 {
     Statement = statement;
 }
Exemplo n.º 54
0
 public TResult Visit(Statement statement, TEnvironment environment)
 {
     statement.Accept(this, environment);
     return(default(TResult));
 }
Exemplo n.º 55
0
 private void SsaId(Identifier id, Statement stm, Expression expr, bool isSideEffect)
 {
     ssaIds.Add(id, new SsaIdentifier(id, id, stm, expr, isSideEffect));
 }
Exemplo n.º 56
0
 public void AddCallEdge(Procedure caller, Statement stm, Procedure callee)
 {
 }
Exemplo n.º 57
0
        /// <summary>
        /// Переносит данные из элементов на форме в объект
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// </summary>
        /// <param name="setCurrentStatement">
        /// Обновлять ли свойство CurrentStatement после присвоения заявлению данных из дизайна
        /// </param>
        public override void MoveDataFromGui2Object(ref Statement statement, bool setCurrentStatement = true)
        {
            var mainAdress = statement.Address ?? new address();

            // Адрес в свободной форме
            mainAdress.IsHomeless            = chBIsHomeless.Checked;
            mainAdress.IsNotStructureAddress = chbIsFreeMainAddress.Checked;

            if (GetKLADRControlType() == KLADRControlType.Structured || chbIsFreeMainAddress.Checked)
            {
                MoveDataFromGui2Object(mainAddressKladr, mainAdress);
            }
            else
            {
                MoveDataFromGui2Object(mainAddressKladrIntellisense, mainAdress);
            }

            // Дата регистрации
            if (!string.IsNullOrEmpty(tbDateRegistration.Text))
            {
                DateTime dt;
                mainAdress.DateRegistration = DateTime.TryParse(tbDateRegistration.Text, out dt) ? (DateTime?)dt : null;
            }

            statement.Address = mainAdress;


            //if (chBCopyFromUDL.Checked)
            //{
            //  if (statement.DocumentUdl != null)
            //  {
            //    statement.DocumentRegistration = statement.DocumentUdl;
            //  }
            //}
            //else
            //{
            //  Document document;
            //  if (statement.DocumentRegistration != null && statement.DocumentUdl != null
            //      && statement.DocumentRegistration.id != statement.DocumentUdl.id)
            //  {
            //    document = statement.DocumentRegistration;
            //  }
            //  else
            //  {
            //    document = new Document();
            //  }

            //  // Вид документа
            //  if (documentRegistration.DocumentType >= 0)
            //  {
            //    document.DocumentType = statementService.GetConcept(documentRegistration.DocumentType);
            //  }

            //  // Серия
            //  document.Series = documentRegistration.DocumentSeries;

            //  // Номер
            //  document.Number = documentRegistration.DocumentNumber;

            //  // Выдавший орган
            //  document.IssuingAuthority = documentRegistration.DocumentIssuingAuthority;

            //  // Дата выдачи
            //  document.DateIssue = documentRegistration.DocumentIssueDate;
            //  document.DateExp = documentRegistration.DocumentExpDate;

            //  // Признак валидности документа по дублю
            //  document.ExistDocument = documentRegistration.ValidDocument;

            //  // Присвоени ссылки
            //  statement.DocumentRegistration = document;
            //}

            var contactInfo = statement.ContactInfo ?? new ContactInfo();

            // Телефон домашний
            contactInfo.HomePhone = tbHomePhone.Text;

            // Телефон рабочий
            contactInfo.WorkPhone = null;//tbWorkPhone.Text;

            // Электронная почта
            contactInfo.Email = tbEmail.Text;

            statement.ContactInfo = contactInfo;

            if (rbYesResAddress.Checked)
            {
                var resAddress = statement.Address2 ?? new address();

                // Адрес в свободной форме
                resAddress.IsNotStructureAddress = chbIsFreeResidencyAddress.Checked;

                if (GetKLADRControlType() == KLADRControlType.Structured || chbIsFreeResidencyAddress.Checked)
                {
                    MoveDataFromGui2Object(residencyAddressKladr, resAddress);
                }
                else
                {
                    MoveDataFromGui2Object(residencyAddressKladrIntellisense, resAddress);
                }

                statement.Address2 = resAddress;
            }

            statementService.TrimStatementData(statement);

            //сохранение изменений в сессию
            if (setCurrentStatement)
            {
                CurrentStatement = statement;
            }
        }
Exemplo n.º 58
0
 public bool Add(Statement stmt)
 {
     return(((SemWeb.StatementSink)store).Add(stmt));
 }
Exemplo n.º 59
0
 public StoreOffset(Statement stm, Store store, Constant Offset)
 {
     this.Statement = stm;
     this.Store     = store;
     this.Offset    = Offset;
 }
Exemplo n.º 60
0
        protected virtual void VisitStatement(Statement statement)
        {
            switch (statement.Type)
            {
            case Nodes.BlockStatement:
                VisitBlockStatement(statement.As <BlockStatement>());
                break;

            case Nodes.BreakStatement:
                VisitBreakStatement(statement.As <BreakStatement>());
                break;

            case Nodes.ContinueStatement:
                VisitContinueStatement(statement.As <ContinueStatement>());
                break;

            case Nodes.DoWhileStatement:
                VisitDoWhileStatement(statement.As <DoWhileStatement>());
                break;

            case Nodes.DebuggerStatement:
                VisitDebuggerStatement(statement.As <DebuggerStatement>());
                break;

            case Nodes.EmptyStatement:
                VisitEmptyStatement(statement.As <EmptyStatement>());
                break;

            case Nodes.ExpressionStatement:
                VisitExpressionStatement(statement.As <ExpressionStatement>());
                break;

            case Nodes.ForStatement:
                VisitForStatement(statement.As <ForStatement>());
                break;

            case Nodes.ForInStatement:
                VisitForInStatement(statement.As <ForInStatement>());
                break;

            case Nodes.ForOfStatement:
                VisitForOfStatement(statement.As <ForOfStatement>());
                break;

            case Nodes.FunctionDeclaration:
                VisitFunctionDeclaration(statement.As <FunctionDeclaration>());
                break;

            case Nodes.IfStatement:
                VisitIfStatement(statement.As <IfStatement>());
                break;

            case Nodes.LabeledStatement:
                VisitLabeledStatement(statement.As <LabeledStatement>());
                break;

            case Nodes.ReturnStatement:
                VisitReturnStatement(statement.As <ReturnStatement>());
                break;

            case Nodes.SwitchStatement:
                VisitSwitchStatement(statement.As <SwitchStatement>());
                break;

            case Nodes.ThrowStatement:
                VisitThrowStatement(statement.As <ThrowStatement>());
                break;

            case Nodes.TryStatement:
                VisitTryStatement(statement.As <TryStatement>());
                break;

            case Nodes.VariableDeclaration:
                VisitVariableDeclaration(statement.As <VariableDeclaration>());
                break;

            case Nodes.WhileStatement:
                VisitWhileStatement(statement.As <WhileStatement>());
                break;

            case Nodes.WithStatement:
                VisitWithStatement(statement.As <WithStatement>());
                break;

            case Nodes.Program:
                VisitProgram(statement.As <Program>());
                break;

            case Nodes.CatchClause:
                VisitCatchClause(statement.As <CatchClause>());
                break;

            default:
                VisitUnknownNode(statement);
                break;
            }
        }