Consider improving error message for top-level expressions #15535
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
web-dart2js
See the discussion in https://groups.google.com/a/dartlang.org/d/msg/misc/gs6DzCA-mHk/-Gy3TCY5JNYJ.
The user is new to Dart and used to top-level expressions in JavaScript. Tried running this program:
library altapp;
import 'package:logging/logging.dart';
Logger.root.level = Level.ALL;
The problem was lack of main method. The error is:
js.dart:5:1: Error: Can't have modifier 'StringToken(Logger)' here.
Try replacing modifier 'StringToken(Logger)' with 'var', 'final', or a type.
Logger.root.level = Level.ALL;
^^^^^^
js.dart:5:12: Error: Can't have modifier 'SymbolToken(.)' here.
Try replacing modifier 'SymbolToken(.)' with 'var', 'final', or a type.
Logger.root.level = Level.ALL;
^
js.dart:1:1: Error: Could not find 'main'.
library altapp;
Error: Compilation failed.
Perhaps dart2js can do better.
The text was updated successfully, but these errors were encountered: