ceylon-dart icon indicating copy to clipboard operation
ceylon-dart copied to clipboard

I'm not surprised: assemble-dart not working

Open welopino opened this issue 7 years ago • 6 comments

I am using ceylon 1.3.2 and the corresponding ceylon-dart plugin.

running:

$ ./bin/ceylon assemble-dart --mode=js --out=first-assembly first

gives:

/tmp/ceylon-run-dart1838713660084194959/ceylon/dart/runtime/model/model.dart:836:3:
Error: Unexpected token 'Function'.
  Function([Scope container, $dart$core.String name, $dart$core.Object typeLG, $dart$core.Object qualifier = $ceylon$language.dart$default, $dart$core.Object isDeclaredVoid = $ceylon$language.dart$default, $dart$core.Object isShared = $ceylon$language.dart$default, $dart$core.Object isFormal = $ceylon$language.dart$default, $dart$core.Object isActual = $ceylon$language.dart$default, $dart$core.Object isDefault = $ceylon$language.dart$default, $dart$core.Object isAnnotation = $ceylon$language.dart$default, $dart$core.Object isDeprecated = $ceylon$language.dart$default, $dart$core.Object isStatic = $ceylon$language.dart$default, $dart$core.Object isAnonymous = $ceylon$language.dart$default, $dart$core.Object isNamed = $ceylon$language.dart$default, $dart$core.Object isDynamic = $ceylon$language.dart$default, $dart$core.Object annotations = $ceylon$language.dart$default, $dart$core.Object unit = $ceylon$language.dart$default]) : this.$s((() {
  ^^^^^^^^
Error: Compilation failed.
ceylon assemble-dart: dart2js reported an error.

The assembling tool of the java backend of version 1.3.2 doesn't work correctly either. Possibly those issues are related.

welopino avatar Jun 30 '17 13:06 welopino

Ooops, looks like recent versions of Dart are not happy with using Function as an identifier. This should be easy to fix.

Thanks for the report.

jvasileff avatar Jun 30 '17 14:06 jvasileff

Ok, it has nothing to do with https://github.com/ceylon/ceylon/issues/6956 ?!

welopino avatar Jun 30 '17 14:06 welopino

Right, they don't share any code.

jvasileff avatar Jun 30 '17 14:06 jvasileff

@welopino as a workaround, you can use Dart version 1.19.1.

jvasileff avatar Jun 30 '17 14:06 jvasileff

Working example, using node to run a Ceylon/Dart program:

jvasileff@tau:tmp.Yboq6CCf$ cat source/simple/run.ceylon
"Run the module `simple`."
shared void run() {
    print("hello");
}

jvasileff@tau:tmp.Yboq6CCf$ ceylon compile-dart simple
Note: Created module simple/1.0.0

jvasileff@tau:tmp.Yboq6CCf$ ceylon assemble-dart --mode=js simple
Dart file (/var/folders/cw/vkgzjns15b14q4r5g992gwdw0000gn/T/ceylon-run-dart4054175707493727852/simple/simple.dart) compiled to JavaScript: /var/folders/cw/vkgzjns15b14q4r5g992gwdw0000gn/T/5488022163303916103.tmp
Created executable Dart script simple.js

jvasileff@tau:tmp.Yboq6CCf$ cat /Users/jvasileff/Transient/dart/dart-sdk/lib/_internal/js_runtime/lib/preambles/d8.js simple.js > simple-node.js

jvasileff@tau:tmp.Yboq6CCf$ node simple-node.js
hello

jvasileff@tau:tmp.Yboq6CCf$ dart --version
Dart VM version: 1.19.1 (Wed Sep  7 08:59:17 2016) on "macos_x64"

jvasileff avatar Jun 30 '17 14:06 jvasileff

More on this here: https://github.com/dart-lang/sdk/issues/28610

jvasileff avatar Jun 30 '17 15:06 jvasileff