@Test public void testHexIntLiteralTyped() throws Exception { final TranslationUnit tu = ParseHelper.parse("#version 300 es\n" + "void main() {" + " int x = 0xA03B;" + "}"); new NullCheckTyper(tu) { @Override public void visitInitializer(Initializer initializer) { super.visitInitializer(initializer); assertSame(lookupType(initializer.getExpr()), BasicType.INT); } }.visit(tu); }
public Type lookupType(Expr expr) { return types.get(expr); }
Typer extends ScopeTrackingVisitor { public Type lookupType(Expr expr) { return types.get(expr); } }
Typer extends ScopeTrackingVisitor { public Type lookupType(Expr expr) { return types.get(expr); } Typer(TranslationUnit tu); }
Typer extends ScopeTrackingVisitor { public Type lookupType(Expr expr) { return types.get(expr); } Typer(TranslationUnit tu); @Override void visitParenExpr(ParenExpr parenExpr); @Override void visitFunctionPrototype(FunctionPrototype functionPrototype); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr); boolean prototypeMatches(FunctionPrototype prototype, FunctionCallExpr functionCallExpr); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr); @Override void visitTypeConstructorExpr(TypeConstructorExpr typeConstructorExpr); @Override void visitUnaryExpr(UnaryExpr unaryExpr); @Override void visitTernaryExpr(TernaryExpr ternaryExpr); @Override void visitBinaryExpr(BinaryExpr binaryExpr); @Override void visitBoolConstantExpr(BoolConstantExpr boolConstantExpr); @Override void visitIntConstantExpr(IntConstantExpr intConstantExpr); @Override void visitUIntConstantExpr(UIntConstantExpr uintConstantExpr); @Override void visitFloatConstantExpr(FloatConstantExpr floatConstantExpr); @Override void visitMemberLookupExpr(MemberLookupExpr memberLookupExpr); @Override void visitArrayConstructorExpr(ArrayConstructorExpr arrayConstructorExpr); Type lookupType(Expr expr); boolean hasType(Expr expr); Set<FunctionPrototype> getPrototypes(String name); @Override void visitStructDefinitionType(StructDefinitionType structDefinitionType); @Override void visitArrayIndexExpr(ArrayIndexExpr arrayIndexExpr); @Override void visitInterfaceBlock(InterfaceBlock interfaceBlock); static Optional<Type> maybeGetTypeOfBuiltinVariable(String name); static ImmutablePair<Type, ArrayInfo> getBaseTypeArrayInfo(Type type); static Type combineBaseTypeAndArrayInfo(Type type, ArrayInfo arrayInfo); }
Typer extends ScopeTrackingVisitor { public Type lookupType(Expr expr) { return types.get(expr); } Typer(TranslationUnit tu); @Override void visitParenExpr(ParenExpr parenExpr); @Override void visitFunctionPrototype(FunctionPrototype functionPrototype); @Override void visitFunctionDefinition(FunctionDefinition functionDefinition); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr); boolean prototypeMatches(FunctionPrototype prototype, FunctionCallExpr functionCallExpr); @Override void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr); @Override void visitTypeConstructorExpr(TypeConstructorExpr typeConstructorExpr); @Override void visitUnaryExpr(UnaryExpr unaryExpr); @Override void visitTernaryExpr(TernaryExpr ternaryExpr); @Override void visitBinaryExpr(BinaryExpr binaryExpr); @Override void visitBoolConstantExpr(BoolConstantExpr boolConstantExpr); @Override void visitIntConstantExpr(IntConstantExpr intConstantExpr); @Override void visitUIntConstantExpr(UIntConstantExpr uintConstantExpr); @Override void visitFloatConstantExpr(FloatConstantExpr floatConstantExpr); @Override void visitMemberLookupExpr(MemberLookupExpr memberLookupExpr); @Override void visitArrayConstructorExpr(ArrayConstructorExpr arrayConstructorExpr); Type lookupType(Expr expr); boolean hasType(Expr expr); Set<FunctionPrototype> getPrototypes(String name); @Override void visitStructDefinitionType(StructDefinitionType structDefinitionType); @Override void visitArrayIndexExpr(ArrayIndexExpr arrayIndexExpr); @Override void visitInterfaceBlock(InterfaceBlock interfaceBlock); static Optional<Type> maybeGetTypeOfBuiltinVariable(String name); static ImmutablePair<Type, ArrayInfo> getBaseTypeArrayInfo(Type type); static Type combineBaseTypeAndArrayInfo(Type type, ArrayInfo arrayInfo);  }