public override void ExitLocalVariableDeclarationStatement([NotNull] SBP.LocalVariableDeclarationStatementContext context) { TypeReference type = m_variableType; VariableModifier modifier = m_variableModifier; if (type == null) { return; } if (modifier == VariableModifier.None) { if (type.Type == typeof(VarSpecifiedType)) { if (m_variables[0].Value.IsError()) { return; // Just leave; no point in spending more time on this variable. } else if (m_variables[0].Value.DataType != null) { type = m_variables[0].Value.DataType; } else if (m_variables[0].Value.ExpressionCode != null) { type = new TypeReference(m_variables[0].Value.ExpressionCode.Type); } else { throw new NotImplementedException("Unknown value type for assignment."); } } foreach (var variable in m_variables) { if (!type.Type.IsAssignableFrom(variable.Value.DataType.Type)) { throw new NotImplementedException("Variables assignment of incompatible type."); } if (m_scopeStack.Peek().StatementCount > 0) { var scope = m_scopeStack.Peek(); var v = scope.AddVariable(variable.Name, type, null, EntryModifiers.Private); scope.AddStatementCode(Expression.Assign(v.VariableExpression, variable.Value.ExpressionCode)); } else { m_scopeStack.Peek().AddVariable(variable.Name, type, variable.Value, EntryModifiers.Private); } } } else // Some kind of static { throw new NotImplementedException(); } }
public override void EnterVariableModifier([NotNull] SBP.VariableModifierContext context) { var modifier = context.GetText(); if (modifier == "static") { m_variableModifier = VariableModifier.Static; } else if (modifier == "execution") { m_variableModifier = VariableModifier.Execution; } else if (modifier == "session") { m_variableModifier = VariableModifier.Session; } }
public virtual void Visit(VariableModifier variableModifier) { }
void ReadXML(string file) { //var file = @"D:\_MY_PROJECTS\Mond\AIFS_Manager\DevNoteCmd\Katalon\Xamun.xml";// @"D:\_MY_PROJECTS\Mond\AIFS_Manager\CodeceptSupport\Katalon\test.xml"; //run series of commands Interpreter it = new Interpreter(); //step# 80 _Entry CONVERSION xml to codecept //_STEP_.Player _Entry CONVERSION xml to codecept it.ReadXmlFile(file); if (it.MyActions == null) { return; } //STEP.CodeCept #80 ACTIONS modifier //step# 81 mods..modify actions ClickModifier clickExt = new ClickModifier(); it.Mod <ClickModifier>(clickExt); SendKeyModifier keyExt = new SendKeyModifier(); it.Mod <SendKeyModifier>(keyExt); //step# 82 Declare VARIABLES FillFieldModifier fillFieldExt = new FillFieldModifier(); it.Mod <FillFieldModifier>(fillFieldExt); //step# 83 identify Variables VariableModifier variableList = new VariableModifier(); it.Mod <VariableModifier>(variableList); //step# 83 assign Variables AssignModifier variableExt = new AssignModifier(); it.Mod <AssignModifier>(variableExt); //step# 84 finalize FinalModifier finalExt = new FinalModifier(); it.Mod <FinalModifier>(finalExt); //MyActions = it.MyActions; //add summary MyActions = SummaryModifier.AddSummary(it, variableList.ListOfVariables); //this.actionSource.DataSource = MyActions; //refreshList(); //txtCaption.Text = "DevNote Recorder -" + System.IO.Path.GetFileName(openFileDialog1.FileName); //saveFileDialog1.FileName = openFileDialog1.FileName; // var folder = Path.GetDirectoryName(jsXMLFile); //var dir = LogApplication.Agent.GetCurrentDir(); //dir = dir.Replace("file:\\", string.Empty); //string drive =System.IO.Path.GetPathRoot(dir); //string driveLetter = drive.First().ToString(); var codeceptjsFolder = FileEndPointManager.Project2Folder;//string.Format("{0}\\CodeceptJs\\Project2", dir); //@"D:\_ROBOtFRAMeWORK\CodeceptsJs\Project1\"; var codeceptTestPath = System.IO.Path.Combine(codeceptjsFolder, "latest_test.js"); if (System.IO.File.Exists(codeceptTestPath)) { System.IO.File.Delete(codeceptTestPath); } saveFileDialog1.FileName = codeceptTestPath; //step# 30 Save to default js file toolStripButtonSave_Click(this, EventArgs.Empty); }
/// <summary> /// Adds one row for each variable of the specified <see cref="EntityClass"/>.</summary> /// <param name="entityClass"> /// The <see cref="EntityClass"/> whose variables to show.</param> /// <param name="category"> /// The <see cref="VariableCategory"/> whose variables to show.</param> /// <param name="showBuildResources"> /// <c>true</c> to show <see cref="EntityClass.BuildResources"/>, <c>false</c> to show <see /// cref="EntityClass.Resources"/>. This argument is ignored if <paramref name="category"/> /// does not equal <see cref="VariableCategory.Resource"/>.</param> /// <exception cref="InvalidEnumArgumentException"> /// <paramref name="category"/> is neither <see cref="VariableCategory.Attribute"/> nor <see /// cref="VariableCategory.Resource"/>.</exception> /// <remarks> /// <b>CreateVariableRows</b> adds one row for each initial value and modifier value defined /// by the specified <paramref name="entityClass"/>. The <see cref="PropertyListItem.Tag"/> /// of each row holds the corresponding <see cref="VariableClass"/>.</remarks> private void CreateVariableRows(EntityClass entityClass, VariableCategory category, bool showBuildResources) { string categoryLabel = ""; VariableClassDictionary variables = null; VariableValueDictionary basics = null; VariableModifierDictionary modifiers = null; // retrieve name and variable collections for category if (category == VariableCategory.Attribute) { categoryLabel = Global.Strings.LabelAttribute; variables = MasterSection.Instance.Variables.Attributes; basics = entityClass.Attributes; modifiers = entityClass.AttributeModifiers; } else if (category == VariableCategory.Resource) { variables = MasterSection.Instance.Variables.Resources; if (showBuildResources) { categoryLabel = Global.Strings.LabelBuildCost; basics = entityClass.BuildResources; } else { categoryLabel = Global.Strings.LabelResource; basics = entityClass.Resources; modifiers = entityClass.ResourceModifiers; } } else { ThrowHelper.ThrowInvalidEnumArgumentException( "category", (int)category, typeof(VariableCategory)); } // insert separator before first property? bool addSeparator = (Items.Count > 0); // add variable row, preceded by separator if required Action <VariableClass, String> addRow = (variable, value) => { if (addSeparator) { ApplicationUtility.AddSeparator(this); addSeparator = false; } Items.Add(new PropertyListItem(categoryLabel, variable.Name, value, variable)); }; // process all variables defined by the scenario foreach (var pair in variables) { string id = pair.Key; string basicValue = null, modSelf = null; // get basic value if defined if (basics.ContainsKey(id)) { basicValue = pair.Value.Format(basics[id], false); } // get set of modifiers and self-modifier value VariableModifier modifier = null; if (modifiers != null && modifiers.TryGetValue(id, out modifier) && modifier.Self != null) { modSelf = pair.Value.Format(modifier.Self.Value, true); } string column = (basicValue == null ? modSelf : (modSelf == null ? basicValue : String.Format( ApplicationInfo.Culture, "{0} {1}", basicValue, modSelf))); if (column != null) { addRow(pair.Value, column); } if (modifier == null) { continue; } // add one row for each additional modifier value foreach (ModifierTarget target in VariableModifier.AllModifierTargets) { if (target == ModifierTarget.Self) { continue; } int?value = modifier.GetByTarget(target); if (value != null) { column = pair.Value.Format(value, target, entityClass.ModifierRange); addRow(pair.Value, column); } } } }