BoundExpression BindConstUse(AST.ConstantUse x) { if (x is AST.GlobalConstUse) { return(BindGlobalConstUse((AST.GlobalConstUse)x)); } if (x is AST.ClassConstUse) { var cx = (AST.ClassConstUse)x; var typeref = BindTypeRef(cx.TargetType); if (cx.Name.Equals("class")) // pseudo class constant { return(new BoundPseudoClassConst(typeref, AST.PseudoClassConstUse.Types.Class)); } return(BoundFieldRef.CreateClassConst(typeref, new BoundVariableName(cx.Name))); } throw ExceptionUtilities.UnexpectedValue(x); }
BoundExpression BindConstUse(AST.ConstantUse x) { if (x is AST.GlobalConstUse) { return(BindGlobalConstUse((AST.GlobalConstUse)x)); } if (x is AST.ClassConstUse) { var cx = (AST.ClassConstUse)x; var dtype = cx.TargetType as AST.INamedTypeRef; if (dtype != null && cx.Name.Equals("class")) // Type::class ~ "Type" { return(new BoundLiteral(dtype.ClassName.ToString())); } var typeref = BindTypeRef(cx.TargetType); return(BoundFieldRef.CreateClassConst(typeref, new BoundVariableName(cx.Name))); } throw ExceptionUtilities.UnexpectedValue(x); }