void INodeParent.Replace(CNode child, CNode newchild) { if (child == m_targetAccess) m_targetAccess = (CAccess)newchild; newchild.Parent = this; m_targetAccess.IsCallExplicit = true; }
void INodeParent.Replace(CNode child, CNode newchild) { if (child == access) { access = (CAccess)newchild; newchild.Parent = this; } }
public CMemberAccess(CToken tok, CAccess objectSource, CToken item) : base(tok, item) { _object = objectSource; _object.Parent = this; _object.IsMemberSource = true; IsRootAccess = false; }
void INodeParent.Replace(CNode child, CNode newchild) { if (child == _object) { _object = (CAccess)newchild; } newchild.Parent = this; }
void INodeParent.Replace(CNode child, CNode newchild) { if (child == m_targetAccess) { m_targetAccess = (CAccess)newchild; } newchild.Parent = this; m_targetAccess.IsCallExplicit = true; }
public CDefaultAccess(CToken tok, CAccess item, CParameters parameters) : base(tok, tok) { m_targetAccess = item; m_targetAccess.Parent = this; this.parameters = parameters; this.parameters.Parent = this; item.IsCallExplicit = true; IsRootAccess = false; }
void INodeParent.Replace(CNode child, CNode newchild) { if (lhs == child) { lhs = (CAccess)newchild; } if (rhs == child) { rhs = (CExpression)newchild; } newchild.Parent = this; }
private CExpression step; // the expression to add to the var #endregion Fields #region Constructors public CFor(CToken token, CToken var) : base(token) { forVariable = new CAccess(var, var); forVariable.Parent = this; }
public CPictureOfExpression(CToken tok, CAccess access) : base(tok) { this.access = access; this.access.Parent = this; }
public void VisitFile(CFile file) { if (!canGenerate(file)) return; visitor.PreVisitFile(file); filenamesrc = file.Token; new CNewline(null).Accept(visitor); if (instrument) { COption cCodeCoverage = new COption(new CToken(file.Filename, TokenTypes.keyword, "option"), new CToken(file.Filename, TokenTypes.keyword, "include"), new CToken(file.Filename, TokenTypes.str, "cCodeCoverage.asp")); cCodeCoverage.Accept(this); } visitor.VisitFile(file); if (file.Attributes.contains("GenerateProcessAjaxFunction")) { CFunction unicoderequest = CProgram.Global.FindFunction("unicoderequest"); CFunction intrequest = CProgram.Global.FindFunction("intrequest"); CFunction boolrequest = CProgram.Global.FindFunction("boolrequest"); CToken tok = CreateTokenWithAdditionalInfo("ProcessAjax", "processajax", TokenTypes.identifier); CFunction processAjax = new CFunction(tok, tok.RawValue, tok.Value, TokenTypes.visPublic, CFunction.vbSub, null, new CTypeRef(null, BuiltIns.Void)); CAccess pivotitem = new CAccess(unicoderequest.Token, unicoderequest.Token); pivotitem.ReferenceTarget = unicoderequest; CParameters pivotparams = new CParameters(); pivotparams.Unnamed.Add( new CConstantExpression(CreateTokenWithAdditionalInfo("sFunction", TokenTypes.str))); CSelect select = new CSelect(CreateTokenWithAdditionalInfo("select", TokenTypes.controlFlow), new CDefaultAccess(pivotitem.Token, pivotitem, pivotparams)); IEnumerator it = CProgram.Global.Functions.GetEnumerator(); List<CVariable> vars = new List<CVariable>(); while (it.MoveNext()) { CFunction func = (CFunction)it.Current; if (!func.Attributes.contains("ExecuteOnServer")) continue; CStatementBlock block = new CStatementBlock(); CParameters funcParams = new CParameters(); for (int ixArg = 0; ixArg < func.Arguments.Count - 3; ixArg++) { CArgument arg = func.Arguments[ixArg]; tok = CreateTokenWithAdditionalInfo("vParam" + (ixArg + 1), "vparam" + (ixArg + 1), TokenTypes.identifier); if (ixArg >= vars.Count) vars.Add(new CVariable(tok, false, new CTypeRef(null, BuiltIns.Variant), null, null, null)); CAssignment assign = new CAssignment(tok); CAccess left = new CAccess(tok, tok); left.ReferenceTarget = vars[ixArg]; assign.Target = left; funcParams.Unnamed.Add(left); CFunction rightfunc = intrequest; if (arg.Type.RawName == "Boolean") rightfunc = boolrequest; else if (arg.Type.RawName == "String") rightfunc = unicoderequest; CParameters parameters = new CParameters(); parameters.Unnamed.Add( new CConstantExpression(CreateTokenWithAdditionalInfo(tok.RawValue, TokenTypes.str))); CAccess rightitem = new CAccess(rightfunc.Token, rightfunc.Token); rightitem.ReferenceTarget = rightfunc; assign.Source = new CDefaultAccess(rightfunc.Token, rightitem, parameters); assign.Source.RhsAssignmentSource = true; block.Add(assign); } CAccess calledItem = new CAccess(func.Token, func.Token); CDefaultAccess called = new CDefaultAccess(func.Token, calledItem, funcParams); calledItem.ReferenceTarget = calledItem.ReferenceTarget = func; if (func.Attributes.contains("picture") || func.FunctionType == CFunction.vbFunction) { CAccess returnItem = new CAccess(processAjax.Token, processAjax.Token); returnItem.ReferenceTarget = processAjax; CAssignment assign = new CAssignment(processAjax.Token); assign.Target = returnItem; if (func.FunctionType == CFunction.vbFunction) assign.Source = called; else assign.Source = new CPictureOfExpression(tok, called); block.Add(assign); } else block.Add(new CExpressionStatement(called)); tok = CreateTokenWithAdditionalInfo("case", TokenTypes.controlFlow); CExpression exp = new CConstantExpression(CreateTokenWithAdditionalInfo(func.RawName, TokenTypes.str)); select.Cases.Add(new CCase(tok, exp, block)); } CDim dim = new CDim(CreateTokenWithAdditionalInfo("Dim", TokenTypes.declaration)); dim.Variables.AddRange(vars); processAjax.Statements.Add(dim); processAjax.Statements.Add(select); CNewline nl = new CNewline(CreateTokenWithAdditionalInfo("\n", TokenTypes.newline)); nl.Accept(this); processAjax.Accept(this); nl.Accept(this); } }
public CForEach(CToken token, CToken var) : base(token) { forVariable = new CAccess(var, var); }
public void VisitAccess(CAccess access) { VisitExpression(access); }
void INodeParent.Replace(CNode child, CNode newchild) { if (child == _object) _object = (CAccess)newchild; newchild.Parent = this; }
public CFor(CToken token, CToken var) : base(token) { forVariable = new CAccess(var, var); forVariable.Parent = this; }