@ Nullable public static PrimitiveNode convertPrimitiveDataToExpr ( PrimitiveData primitiveData , SourceLocation location ) { if ( primitiveData instanceof StringData ) { return new StringNode ( primitiveData . stringValue ( ) , QuoteStyle . SINGLE , location ) ; } else if ( primitiveData instanceof BooleanData ) { return new BooleanNode ( primitiveData . booleanValue ( ) , location ) ; } else if ( primitiveData instanceof IntegerData ) { // NOTE: We only support numbers in the range of JS [MIN_SAFE_INTEGER, MAX_SAFE_INTEGER] if ( ! IntegerNode . isInRange ( primitiveData . longValue ( ) ) ) { return null ; } else { return new IntegerNode ( primitiveData . longValue ( ) , location ) ; } } else if ( primitiveData instanceof FloatData ) { return new FloatNode ( primitiveData . floatValue ( ) , location ) ; } else if ( primitiveData instanceof NullData ) { return new NullNode ( location ) ; } else { throw new IllegalArgumentException ( ) ; } }
Converts a primitive data object into a primitive expression node .