From 0e591bf2d5a959b1ce16894b6ed731fe6bb4236a Mon Sep 17 00:00:00 2001 From: "K. Andrew Parker" Date: Thu, 4 Nov 2021 08:32:39 -0700 Subject: [PATCH] restore typeMatch and block string assignment --- macros/parserAssignment.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/macros/parserAssignment.pl b/macros/parserAssignment.pl index cb63d563bf..c3f0feaef7 100644 --- a/macros/parserAssignment.pl +++ b/macros/parserAssignment.pl @@ -348,9 +348,20 @@ sub new { my $self = shift; $class = ref($self) || $self; my $f = $self->SUPER::new(@_); bless $f, $class if $f->type eq 'Assignment'; + my $rhs = $f->getTypicalValue($f)->{data}[1]; + Value->Error('Assignment of strings is not allowed.') if $rhs && $rhs->type eq 'String'; return $f; } +sub typeMatch { + my $self = shift; my $other = shift; my $ans = shift; + return 0 unless $self->type eq $other->type; + my $typeMatch = $self->getTypicalValue($self)->{data}[1]; + $other = $self->getTypicalValue($other,1)->{data}[1]; + return 1 unless defined($other); # can't really tell, so don't report type mismatch + $typeMatch->typeMatch($other,$ans); +} + sub cmp_class { my $self = shift; my $value; if ($self->{tree}{rop}{isConstant}) {