public override void Begin(ref Expression e, ExpressionUsage u) { switch (e.ExpressionType) { case ExpressionType.GetMetaProperty: { var s = e as GetMetaProperty; _fc.AddReqStatement(new ReqProperty(s.Source, s.Name, s.ReturnType, s.Offset, null)); break; } case ExpressionType.GetMetaObject: { var s = e as GetMetaObject; _fc.AddReqStatement(new ReqObject(s.Source, s.ReturnType)); break; } } }
void CompileMetaPropertyDefinitions(AstMetaProperty ast, MetaProperty mp) { var defs = new MetaDefinition[ast.Definitions.Count]; for (int i = 0; i < defs.Length; i++) { var fc = new FunctionCompiler(_compiler, mp); foreach (var req in ast.Definitions[i].Requirements) { DataType dt = null; if (req.Type != null) { dt = _resolver.GetType(mp.Parent, req.Type); } fc.AddReqStatement(new ReqProperty(req.Source, req.Name.Symbol, dt, req.Offset, req.Tag)); } var fixedInit = ast.Definitions[i].Value as AstFixedArrayInitializer; Statement s; if (fixedInit != null) { s = fc.CompileFixedArrayDeclaration(mp.Source, mp.ReturnType, mp.Name, fixedInit); } else { s = fc.CompileStatement(ast.Definitions[i].Value); if (s is Expression) { s = fc.CompileImplicitCast(mp.Source, mp.ReturnType, s as Expression); } } // Find implicit req statements if (s is Expression) { var e = s as Expression; new ReqStatementFinder(fc).VisitNullable(ref e); } else { new ReqStatementFinder(fc).VisitNullable(ref s); } defs[i] = new MetaDefinition(s, ast.Definitions[i].Tags, fc.ReqStatements); } mp.SetDefinitions(defs); }