@@ -95,8 +95,7 @@ public Type Visit(ScriptBody visitable)
9595 public Type Visit ( WhileStatement visitable )
9696 {
9797 var condType = visitable . Condition . Accept ( This ) ;
98- Type boolean = "boolean" ;
99- if ( ! condType . Equals ( boolean ) )
98+ if ( ! condType . Equals ( "boolean" ) )
10099 throw new NotBooleanTestExpression ( visitable . Segment , condType ) ;
101100
102101 visitable . Statement . Accept ( This ) ;
@@ -107,8 +106,7 @@ public Type Visit(WhileStatement visitable)
107106 public Type Visit ( IfStatement visitable )
108107 {
109108 var testType = visitable . Test . Accept ( This ) ;
110- Type boolean = "boolean" ;
111- if ( ! testType . Equals ( boolean ) )
109+ if ( ! testType . Equals ( "boolean" ) )
112110 throw new NotBooleanTestExpression ( visitable . Segment , testType ) ;
113111
114112 visitable . Then . Accept ( This ) ;
@@ -219,8 +217,7 @@ public ObjectType Visit(ObjectLiteral visitable)
219217 public Type Visit ( ConditionalExpression visitable )
220218 {
221219 var tType = visitable . Test . Accept ( This ) ;
222- Type boolean = "boolean" ;
223- if ( ! tType . Equals ( boolean ) )
220+ if ( ! tType . Equals ( "boolean" ) )
224221 throw new NotBooleanTestExpression ( visitable . Test . Segment , tType ) ;
225222
226223 var cType = visitable . Consequent . Accept ( This ) ;
@@ -296,7 +293,7 @@ public Type Visit(UnaryExpression visitable)
296293
297294 public Type Visit ( LexicalDeclaration visitable )
298295 {
299- Type undefined = "undefined" , @void = "void" ;
296+ Type undefined = "undefined" ;
300297
301298 for ( var i = 0 ; i < visitable . Assignments . Count ; i ++ )
302299 {
@@ -306,7 +303,7 @@ public Type Visit(LexicalDeclaration visitable)
306303
307304 if ( sourceType . Equals ( undefined ) )
308305 throw new CannotDefineType ( assignment . Source . Segment ) ;
309- if ( sourceType . Equals ( @ void) )
306+ if ( sourceType . Equals ( " void" ) )
310307 throw new CannotAssignVoid ( assignment . Source . Segment ) ;
311308 if ( ! registeredSymbol . Type . Equals ( undefined ) && ! registeredSymbol . Type . Equals ( sourceType ) )
312309 throw new IncompatibleTypesOfOperands (
@@ -384,9 +381,8 @@ public Type Visit(IndexAccess visitable)
384381 if ( prevType is not ArrayType arrayType )
385382 throw new NonAccessibleType ( prevType ) ;
386383
387- Type number = "number" ;
388384 var indexType = visitable . Index . Accept ( This ) ;
389- if ( ! indexType . Equals ( number ) )
385+ if ( ! indexType . Equals ( " number" ) )
390386 throw new ArrayAccessException ( visitable . Segment , indexType ) ;
391387
392388 var elemType = arrayType . Type ;
@@ -437,10 +433,9 @@ public ObjectType Visit(WithExpression visitable)
437433
438434 public Type Visit ( CastAsExpression visitable )
439435 {
440- Type undefined = "undefined" ;
441436 var from = visitable . Expression . Accept ( This ) ;
442437
443- if ( from . Equals ( undefined ) )
438+ if ( from . Equals ( " undefined" ) )
444439 throw new CannotDefineType ( visitable . Expression . Segment ) ;
445440
446441 var to = visitable . Cast . Accept ( _typeBuilder ) ;
@@ -495,8 +490,7 @@ public Type Visit(CallExpression visitable)
495490 throw new WrongTypeOfArgument ( expr . Segment , expectedType , actualType ) ;
496491 } ) ;
497492
498- Type undefined = "undefined" ;
499- if ( functionSymbol . Type . Equals ( undefined ) )
493+ if ( functionSymbol . Type . Equals ( "undefined" ) )
500494 {
501495 var declaration = _functionStorage . Get ( functionSymbol ) ;
502496 functionReturnType = declaration . Accept ( This ) ;
0 commit comments