Skip to content

Conversation

@Ne0nWinds
Copy link

Description

When generating a function that doesn't have any input parameters, the TSLEncoder emits an extraneous comma, causing the generated JavaScript to be invalid.

This PR fixes that by only emitting a comma if there is at least one input parameter to the function.

Example
Creating a function with no input parameters like this:

float example() {
	return 1.0;
}

Causes the TSLEncoder to emit the following:

import { Fn } from 'three/tsl';

export const example = /*@__PURE__*/ Fn( () => {

	return 1.0;

}, { , return: 'float' } );

The second parameter to Fn (i.e, the function layout) has an invalidly placed comma before the return property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant