@@ -603,49 +603,72 @@ public JSIndirectVariable (IDictionary<string, JSVariable> variables, string ide
603603 Variables = variables ;
604604 }
605605
606+ private void CheckForMissingVariable ( ) {
607+ if ( ! Variables . ContainsKey ( Identifier ) )
608+ throw new KeyNotFoundException ( String . Format ( "No variable named '{0}' currently exists." , Identifier ) ) ;
609+ }
610+
606611 public override TypeReference GetActualType ( TypeSystem typeSystem ) {
612+ CheckForMissingVariable ( ) ;
613+
607614 return Variables [ Identifier ] . GetActualType ( typeSystem ) ;
608615 }
609616
610617 public override TypeReference IdentifierType {
611618 get {
619+ CheckForMissingVariable ( ) ;
620+
612621 return Variables [ Identifier ] . IdentifierType ;
613622 }
614623 }
615624
616625 public override bool IsReference {
617626 get {
627+ CheckForMissingVariable ( ) ;
628+
618629 return Variables [ Identifier ] . IsReference ;
619630 }
620631 }
621632
622633 public override bool IsParameter {
623634 get {
635+ CheckForMissingVariable ( ) ;
636+
624637 return Variables [ Identifier ] . IsParameter ;
625638 }
626639 }
627640
628641 public override JSParameter GetParameter ( ) {
642+ CheckForMissingVariable ( ) ;
643+
629644 return Variables [ Identifier ] . GetParameter ( ) ;
630645 }
631646
632647 public override bool IsConstant {
633648 get {
649+ CheckForMissingVariable ( ) ;
650+
634651 return Variables [ Identifier ] . IsConstant ;
635652 }
636653 }
637654
638655 public override bool IsThis {
639656 get {
657+ CheckForMissingVariable ( ) ;
658+
640659 return Variables [ Identifier ] . IsThis ;
641660 }
642661 }
643662
644663 public override JSVariable Dereference ( ) {
664+ CheckForMissingVariable ( ) ;
665+
645666 return Variables [ Identifier ] . Dereference ( ) ;
646667 }
647668
648669 public override JSVariable Reference ( ) {
670+ CheckForMissingVariable ( ) ;
671+
649672 return Variables [ Identifier ] . Reference ( ) ;
650673 }
651674
@@ -667,7 +690,7 @@ public override string ToString () {
667690 if ( Variables . TryGetValue ( Identifier , out variable ) )
668691 return String . Format ( "@{0}" , variable ) ;
669692 else
670- return "@undef" ;
693+ return String . Format ( "@missing({0})" , Identifier ) ;
671694 }
672695 }
673696
0 commit comments