bool HandleDecl(TypeOfDeclaration t, AbstractType r) { // Can I enter some template parameter referencing id into a typeof specialization!? // class Foo(T:typeof(1)) {} ? var t_res = TypeDeclarationResolver.Resolve(t, ctxt); if (t_res == null) { return(false); } return(ResultComparer.IsImplicitlyConvertible(r, t_res)); }
public static AbstractType Resolve(TypeOfDeclaration typeOf, ResolutionContext ctxt) { // typeof(return) if (typeOf.Expression is TokenExpression && (typeOf.Expression as TokenExpression).Token == DTokens.Return) { var m = HandleNodeMatch(ctxt.ScopedBlock, ctxt, null, typeOf); if (m != null) { return(m); } } // typeOf(myInt) => int else if (typeOf.Expression != null) { var wantedTypes = ExpressionTypeEvaluation.EvaluateType(typeOf.Expression, ctxt); return(DResolver.StripMemberSymbols(wantedTypes)); } return(null); }
public virtual void Visit(TypeOfDeclaration td) { VisitInner(td); if (td.Expression != null) td.Expression.Accept(this); }
TypeOfDeclaration TypeOf() { Expect(Typeof); var md = new TypeOfDeclaration { Location = t.Location }; LastParsedObject = md; if (Expect(OpenParenthesis)) { if (laKind == Return) { Step(); md.Expression = new TokenExpression(Return) { Location = t.Location, EndLocation = t.EndLocation }; } else md.Expression = Expression(); Expect(CloseParenthesis); } md.EndLocation = t.EndLocation; return md; }
public static AbstractType Resolve(TypeOfDeclaration typeOf, ResolutionContext ctxt) { // typeof(return) if (typeOf.Expression is TokenExpression && (typeOf.Expression as TokenExpression).Token == DTokens.Return) { var m = HandleNodeMatch(ctxt.ScopedBlock, ctxt, null, typeOf); if (m != null) return m; } // typeOf(myInt) => int else if (typeOf.Expression != null) { var wantedTypes = Evaluation.EvaluateType(typeOf.Expression, ctxt); return DResolver.StripMemberSymbols(wantedTypes); } return null; }
public ulong Visit(TypeOfDeclaration typeOfDeclaration) { return(1001593); }
bool HandleDecl(TypeOfDeclaration t, AbstractType r) { // Can I enter some template parameter referencing id into a typeof specialization!? // class Foo(T:typeof(1)) {} ? var t_res = TypeDeclarationResolver.Resolve(t,ctxt); if (t_res == null) return false; return ResultComparer.IsImplicitlyConvertible(r,t_res); }