mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #2772 from JakubValtar/preproc-constructorCast-fix
Fixes #1936 - Preproc constructor cast fix
This commit is contained in:
@@ -194,13 +194,14 @@ constructorCast!
|
||||
// if this is a string literal, make sure the type we're trying to cast
|
||||
// to is one of the supported ones
|
||||
//
|
||||
{ #e.getType() != STRING_LITERAL ||
|
||||
( #t.getType() == LITERAL_byte ||
|
||||
{ (#e == null) ||
|
||||
( (#e.getType() != STRING_LITERAL) ||
|
||||
( #t.getType() == LITERAL_boolean ||
|
||||
#t.getType() == LITERAL_double ||
|
||||
#t.getType() == LITERAL_float ||
|
||||
#t.getType() == LITERAL_int ||
|
||||
#t.getType() == LITERAL_long ||
|
||||
#t.getType() == LITERAL_short ) }?
|
||||
#t.getType() == LITERAL_short )) }?
|
||||
// create the node
|
||||
//
|
||||
{#constructorCast = #(#[CONSTRUCTOR_CAST,"CONSTRUCTOR_CAST"], t, e);}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import processing.core.*;
|
||||
import processing.data.*;
|
||||
import processing.event.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class bug1936 extends PApplet {
|
||||
public void setup() {
|
||||
char a = PApplet.parseChar(PApplet.parseByte(PApplet.parseInt("15")));
|
||||
noLoop();
|
||||
}
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "bug1936" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
char a = char(byte(int("15")));
|
||||
@@ -276,6 +276,11 @@ public class ParserTests {
|
||||
public void bug1534() {
|
||||
expectGood("bug1534");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1936() {
|
||||
expectGood("bug1936");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug315g() {
|
||||
|
||||
@@ -9635,7 +9635,7 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
static final public float[] parseByte(byte what[]) {
|
||||
static final public float[] parseFloat(byte what[]) {
|
||||
float floaties[] = new float[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
floaties[i] = what[i];
|
||||
|
||||
Reference in New Issue
Block a user