001 aspect NullObjects { 002 // the actual unknown declaration null object is created in PredefinedTypes.jrag 003 004 // explicit check if declaration is null object 005 syn boolean Decl.isUnknown() = false; 006 eq UnknownDecl.isUnknown() = true; 007 008 009 // all types are compatible with the unknown type 010 eq UnknownDecl.isSubtypeOf(TypeDecl typeDecl) = true; 011 eq UnknownDecl.isSuperTypeOf(TypeDecl typeDecl) = true; 012 eq UnknownDecl.isSuperTypeOfClassDecl(ClassDecl typeDecl) = true; 013 014 015 // broadcast the unknown declaration null object to useful places in the AST 016 syn lazy UnknownDecl Program.unknownDecl() = (UnknownDecl) localLookup("$unknown"); 017 eq Program.getBlock().unknownDecl() = unknownDecl(); 018 eq Program.getPredefinedType().unknownDecl() = unknownDecl(); 019 020 inh Decl TypeDecl.unknownDecl(); 021 inh Decl Block.unknownDecl(); 022 } 023