diff --git a/src/runtime/modules/call.js b/src/runtime/modules/call.js new file mode 100644 index 000000000..1980ba77c --- /dev/null +++ b/src/runtime/modules/call.js @@ -0,0 +1,15 @@ +// Copyright 2016 Traceur Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +export {tailCall as default} from './properTailCalls.js'; diff --git a/src/runtime/modules/construct.js b/src/runtime/modules/construct.js new file mode 100644 index 000000000..7db5bb8ba --- /dev/null +++ b/src/runtime/modules/construct.js @@ -0,0 +1,15 @@ +// Copyright 2016 Traceur Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +export {construct as default} from './properTailCalls.js'; diff --git a/src/runtime/modules/continuation.js b/src/runtime/modules/continuation.js new file mode 100644 index 000000000..31f8ed573 --- /dev/null +++ b/src/runtime/modules/continuation.js @@ -0,0 +1,15 @@ +// Copyright 2016 Traceur Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +export {createContinuation as default} from './properTailCalls.js'; diff --git a/src/runtime/modules/initTailRecursiveFunction.js b/src/runtime/modules/initTailRecursiveFunction.js new file mode 100644 index 000000000..89bbb24db --- /dev/null +++ b/src/runtime/modules/initTailRecursiveFunction.js @@ -0,0 +1,15 @@ +// Copyright 2016 Traceur Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +export {initTailRecursiveFunction as default} from './properTailCalls.js'; diff --git a/src/runtime/modules/properTailCalls.js b/src/runtime/modules/properTailCalls.js index fd80fae44..56dcc2831 100644 --- a/src/runtime/modules/properTailCalls.js +++ b/src/runtime/modules/properTailCalls.js @@ -20,7 +20,7 @@ var CONTINUATION_TYPE = Object.create(null); var isTailRecursiveName = null; -function createContinuation(operand, thisArg, argsArray) { +export function createContinuation(operand, thisArg, argsArray) { return [CONTINUATION_TYPE, operand, thisArg, argsArray]; } @@ -47,7 +47,7 @@ function isTailRecursive(func) { return !!getPrivate(func, isTailRecursiveName); } -function tailCall(func, thisArg, argArray) { +export function tailCall(func, thisArg, argArray) { var continuation = argArray[0]; if (isContinuation(continuation)) { continuation = $apply(func, thisArg, continuation[3]); @@ -113,6 +113,3 @@ export function initTailRecursiveFunction(func) { setPrivate(func, isTailRecursiveName, true); return func; } - -export {tailCall as call}; -export {createContinuation as continuation}; diff --git a/src/runtime/properTailCalls.js b/src/runtime/properTailCalls.js index cc51ab280..cb0f0b5c0 100644 --- a/src/runtime/properTailCalls.js +++ b/src/runtime/properTailCalls.js @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { - initTailRecursiveFunction, - call, - continuation, - construct, -} from './modules/properTailCalls.js'; +import initTailRecursiveFunction from './modules/initTailRecursiveFunction.js'; +import call from './modules/call.js'; +import continuation from './modules/continuation.js'; +import construct from './modules/construct.js'; $traceurRuntime.initTailRecursiveFunction = initTailRecursiveFunction; $traceurRuntime.call = call;