Skip to content

Commit

Permalink
Merge branch '6.1.0' into 6.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	loader/build.xml
#	loader/pom.xml
#	test/tickets/LDEV4899.cfc
  • Loading branch information
michaeloffner committed Jun 16, 2024
2 parents adab7b8 + bb9ca47 commit 58f84cd
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package lucee.transformer.bytecode.expression;

import lucee.transformer.bytecode.Statement;

public interface AsExpression {
public Statement getStatement();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
import lucee.runtime.functions.other.CreateUniqueId;
import lucee.transformer.TransformerException;
import lucee.transformer.bytecode.BytecodeContext;
import lucee.transformer.bytecode.Statement;
import lucee.transformer.bytecode.statement.tag.Attribute;
import lucee.transformer.bytecode.statement.tag.TagComponent;
import lucee.transformer.bytecode.util.Types;
import lucee.transformer.cfml.Data;
import lucee.transformer.cfml.evaluator.EvaluatorException;

public class ComponentAsExpression extends ExpressionBase {
public class ComponentAsExpression extends ExpressionBase implements AsExpression {
private static final Type COMPONENT_LOADER = Type.getType(ComponentLoader.class);
// ComponentImpl loadInline(PageContext pc, CIPage page)
private static final Method LOAD_INLINE1 = new Method("loadInline", Types.COMPONENT_IMPL, new Type[] { Types.CI_PAGE });
Expand Down Expand Up @@ -74,4 +75,9 @@ public Type _writeOut(BytecodeContext bc, int mode) throws TransformerException
public TagComponent getTagComponent() {
return tc;
}

@Override
public Statement getStatement() {
return tc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

import lucee.transformer.TransformerException;
import lucee.transformer.bytecode.BytecodeContext;
import lucee.transformer.bytecode.Statement;
import lucee.transformer.bytecode.statement.udf.Function;
import lucee.transformer.bytecode.util.Types;

public class FunctionAsExpression extends ExpressionBase {
public class FunctionAsExpression extends ExpressionBase implements AsExpression {

private Function function;

Expand All @@ -45,4 +46,8 @@ public Type _writeOut(BytecodeContext bc, int mode) throws TransformerException
public Function getFunction() {
return function;
}

public Statement getStatement() {
return function;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import lucee.runtime.op.Elvis;
import lucee.transformer.TransformerException;
import lucee.transformer.bytecode.BytecodeContext;
import lucee.transformer.bytecode.expression.AsExpression;
import lucee.transformer.bytecode.expression.ExpressionBase;
import lucee.transformer.bytecode.util.ASMUtil;
import lucee.transformer.bytecode.util.Types;
Expand All @@ -54,7 +55,9 @@ public final class OpElvis extends ExpressionBase {

@Override
public Type _writeOut(BytecodeContext bc, int mode) throws TransformerException {
if (ASMUtil.hasOnlyDataMembers(left)) return _writeOutPureDataMember(bc, mode);
// FUTURE this is just a patch, for unknown reason the assignment of inline component or closures
// causes a issue, most likely in the way the object uses the stack
if (ASMUtil.hasOnlyDataMembers(left) && !(right instanceof AsExpression)) return _writeOutPureDataMember(bc, mode);

String name = createRandom(bc);
GeneratorAdapter ga = bc.getAdapter();
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.1.1.2-SNAPSHOT"/>
<property name="version" value="6.1.1.3-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.1.1.2-SNAPSHOT</version>
<version>6.1.1.3-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down
64 changes: 52 additions & 12 deletions test/tickets/LDEV4899.cfc
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="syntax" skip=true{

function run( testResults, testBox ) {
describe("Testcase for LDEV-4899 - compiler crash", function() {
it( title="lucee.runtime.type.Closure not found by org.objectweb.asm", body=function( currentSpec ) {
expect( function(){
//var prop = args.prop ?: function(){ return "" };
}).notToThrow();
});
});
}
}
component extends = "org.lucee.cfml.test.LuceeTestCase" labels="struct" {

function run( testResults, testBox ) {
describe( "Testcase for LDEV-4899", function() {
it( title="testing elvis with default closure", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: function(){ return "" };
});
it( title="testing elvis with default lambda", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: () => "susi";
});

it( title="testing elvis with default array", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [1,2,3];
});

it( title="testing elvis with default struct", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: {a:1};
});

it( title="testing elvis with default component", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: new Query();
});

it( title="testing elvis with default inline component", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: new component {};
});


it( title="testing elvis with default array of closure", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [function(){ return "" }];
});
it( title="testing elvis with default array of lambda", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [() => "susi"];
});

it( title="testing elvis with default array of struct", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [{a:1}];
});

it( title="testing elvis with default array of component", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [new Query()];
});

it( title="testing elvis with default array of inline component", skip="true", body=function( currentSpec ) {
var prop = a.b.c ?: [new component {}];
});



});
}
}

0 comments on commit 58f84cd

Please sign in to comment.