Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: dart/frog/leg/compiler.dart

Issue 9838038: "Implement" #resource tag and various restrictions on library definitions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/frog/leg/scanner/scanner_task.dart » ('j') | dart/frog/leg/scanner/scanner_task.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/compiler.dart
diff --git a/dart/frog/leg/compiler.dart b/dart/frog/leg/compiler.dart
index 3cdedd5de1ab87a4834eae9ed0fee13f4fcb4843..13105d81bb5fe4888f97d44fb8a0d90525014e2a 100644
--- a/dart/frog/leg/compiler.dart
+++ b/dart/frog/leg/compiler.dart
@@ -270,13 +270,22 @@ class Compiler implements DiagnosticListener {
void runCompiler(Uri uri) {
scanBuiltinLibraries();
mainApp = scanner.loadLibrary(uri, null);
- Element element;
- withCurrentElement(mainApp, () {
- element = mainApp.find(MAIN);
- if (element === null) cancel('Could not find $MAIN');
- });
+ final Element mainMethod = mainApp.find(MAIN);
+ if (mainMethod === null) {
+ withCurrentElement(mainApp, () => cancel('Could not find $MAIN'));
+ } else {
+ withCurrentElement(mainMethod, () {
+ if (!mainMethod.isFunction()) {
+ cancel('main is not a function', element: mainMethod);
+ }
+ FunctionParameters parameters = mainMethod.computeParameters(this);
+ if (parameters.parameterCount > 0) {
+ cancel('main cannot have parameters', element: mainMethod);
+ }
+ });
+ }
native.processNativeClasses(this, universe.libraries.getValues());
- enqueue(new WorkItem.toCompile(element));
+ enqueue(new WorkItem.toCompile(mainMethod));
codegenProgress.reset();
while (!worklist.isEmpty()) {
WorkItem work = worklist.removeLast();
« no previous file with comments | « no previous file | dart/frog/leg/scanner/scanner_task.dart » ('j') | dart/frog/leg/scanner/scanner_task.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698