private TypeExprArray<IdentifierType, TType> checkTypeExprArray( final TypeExprArray<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final TypeExprType<IdentifierType, TType> e_type = this.checkTypeExpression(e.getElementType()); final SizeExprType<IdentifierType, TType> e_count = this.checkSizeExpr(e.getElementCount()); final Size<?> ex_count = JPRAChecker.evaluateSize(e_count); final TType ex_type = e_type.getType(); final TArray type = new TArray(e.getLexicalInformation(), ex_count, ex_type); return new TypeExprArray<>( type, e.getLexicalInformation(), e_count, e_type); }
@Test public final void testRecordTypeExprArray_0() throws Exception { final JPRAParserType p = this.newParser(); final GlobalContextType c = GlobalContexts.newContext(new AlwaysEmptyLoader()); final JPRAResolverType r = this.newResolver(c); final JPRACheckerType ch = this.newChecker( c, JPRACheckerStandardCapabilities.newCapabilities()); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(array [integer signed 32] 32)"))); final TypeExprArray<IdentifierType, TType> e = TypeExprArray.class.cast(ch.checkTypeExpression(te)); final TArray ta = TArray.class.cast(e.getType()); Assert.assertEquals( BigInteger.valueOf(32L * 32L), ta.getSizeInBits().getValue()); Assert.assertEquals( BigInteger.valueOf(32L), ta.getElementCount().getValue()); Assert.assertEquals(TIntegerSigned.class, ta.getElementType().getClass()); }
private TypeExprArray<IdentifierType, TType> checkTypeExprArray( final TypeExprArray<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final TypeExprType<IdentifierType, TType> e_type = this.checkTypeExpression(e.getElementType()); final SizeExprType<IdentifierType, TType> e_count = this.checkSizeExpr(e.getElementCount()); final Size<?> ex_count = this.evaluateSize(e_count); final TType ex_type = e_type.getType(); final TArray type = new TArray(e.getLexicalInformation(), ex_count, ex_type); return new TypeExprArray<>( type, e.getLexicalInformation(), e_count, e_type); }