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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 45763004: Revert "Re-land "Search for main in the exported names of the main library, not in the library itse… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 final Tracer tracer; 409 final Tracer tracer;
410 410
411 CompilerTask measuredTask; 411 CompilerTask measuredTask;
412 Element _currentElement; 412 Element _currentElement;
413 LibraryElement coreLibrary; 413 LibraryElement coreLibrary;
414 LibraryElement isolateLibrary; 414 LibraryElement isolateLibrary;
415 LibraryElement isolateHelperLibrary; 415 LibraryElement isolateHelperLibrary;
416 LibraryElement jsHelperLibrary; 416 LibraryElement jsHelperLibrary;
417 LibraryElement interceptorsLibrary; 417 LibraryElement interceptorsLibrary;
418 LibraryElement foreignLibrary; 418 LibraryElement foreignLibrary;
419
420 LibraryElement mainApp; 419 LibraryElement mainApp;
421 FunctionElement mainFunction;
422 420
423 /// Initialized when dart:mirrors is loaded. 421 /// Initialized when dart:mirrors is loaded.
424 LibraryElement mirrorsLibrary; 422 LibraryElement mirrorsLibrary;
425 423
426 /// Initialized when dart:typed_data is loaded. 424 /// Initialized when dart:typed_data is loaded.
427 LibraryElement typedDataLibrary; 425 LibraryElement typedDataLibrary;
428 426
429 ClassElement objectClass; 427 ClassElement objectClass;
430 ClassElement closureClass; 428 ClassElement closureClass;
431 ClassElement boundClosureClass; 429 ClassElement boundClosureClass;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1018 }
1021 }).then((_) { 1019 }).then((_) {
1022 compileLoadedLibraries(); 1020 compileLoadedLibraries();
1023 }); 1021 });
1024 } 1022 }
1025 1023
1026 /// Performs the compilation when all libraries have been loaded. 1024 /// Performs the compilation when all libraries have been loaded.
1027 void compileLoadedLibraries() { 1025 void compileLoadedLibraries() {
1028 Element main = null; 1026 Element main = null;
1029 if (mainApp != null) { 1027 if (mainApp != null) {
1030 main = mainApp.findExported(MAIN); 1028 main = mainApp.find(MAIN);
1031 if (main == null) { 1029 if (main == null) {
1032 if (!analyzeOnly) { 1030 if (!analyzeOnly) {
1033 // Allow analyze only of libraries with no main. 1031 // Allow analyze only of libraries with no main.
1034 reportFatalError( 1032 reportFatalError(
1035 mainApp, 1033 mainApp,
1036 MessageKind.GENERIC, 1034 MessageKind.GENERIC,
1037 {'text': "Error: Could not find '$MAIN'."}); 1035 {'text': "Error: Could not find '$MAIN'."});
1038 } else if (!analyzeAll) { 1036 } else if (!analyzeAll) {
1039 reportFatalError( 1037 reportFatalError(
1040 mainApp, 1038 mainApp,
1041 MessageKind.GENERIC, 1039 MessageKind.GENERIC,
1042 {'text': "Error: Could not find '$MAIN'. " 1040 {'text': "Error: Could not find '$MAIN'. "
1043 "No source will be analyzed. " 1041 "No source will be analyzed. "
1044 "Use '--analyze-all' to analyze all code in the library."}); 1042 "Use '--analyze-all' to analyze all code in the library."});
1045 } 1043 }
1046 } else { 1044 } else {
1047 if (main.isErroneous()) { 1045 if (!main.isFunction()) {
1048 reportFatalError(
1049 main,
1050 MessageKind.GENERIC,
1051 {'text': "Error: Cannot determine which '$MAIN' to use."});
1052 } else if (!main.isFunction()) {
1053 reportFatalError( 1046 reportFatalError(
1054 main, 1047 main,
1055 MessageKind.GENERIC, 1048 MessageKind.GENERIC,
1056 {'text': "Error: '$MAIN' is not a function."}); 1049 {'text': "Error: '$MAIN' is not a function."});
1057 } 1050 }
1058 mainFunction = main; 1051 FunctionElement mainMethod = main;
1059 FunctionSignature parameters = mainFunction.computeSignature(this); 1052 FunctionSignature parameters = mainMethod.computeSignature(this);
1060 if (parameters.parameterCount > 2) { 1053 if (parameters.parameterCount > 2) {
1061 int index = 0; 1054 int index = 0;
1062 parameters.forEachParameter((Element parameter) { 1055 parameters.forEachParameter((Element parameter) {
1063 if (index++ < 2) return; 1056 if (index++ < 2) return;
1064 reportError( 1057 reportError(
1065 parameter, 1058 parameter,
1066 MessageKind.GENERIC, 1059 MessageKind.GENERIC,
1067 {'text': 1060 {'text':
1068 "Error: '$MAIN' cannot have more than two parameters."}); 1061 "Error: '$MAIN' cannot have more than two parameters."});
1069 }); 1062 });
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1103
1111 log('Inferring types...'); 1104 log('Inferring types...');
1112 typesTask.onResolutionComplete(main); 1105 typesTask.onResolutionComplete(main);
1113 1106
1114 log('Compiling...'); 1107 log('Compiling...');
1115 phase = PHASE_COMPILING; 1108 phase = PHASE_COMPILING;
1116 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. 1109 // TODO(johnniwinther): Move these to [CodegenEnqueuer].
1117 if (hasIsolateSupport()) { 1110 if (hasIsolateSupport()) {
1118 enqueuer.codegen.addToWorkList( 1111 enqueuer.codegen.addToWorkList(
1119 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); 1112 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE));
1120 enqueuer.codegen.registerGetOfStaticFunction(main); 1113 enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN));
1121 } 1114 }
1122 if (enabledNoSuchMethod) { 1115 if (enabledNoSuchMethod) {
1123 backend.enableNoSuchMethod(enqueuer.codegen); 1116 backend.enableNoSuchMethod(enqueuer.codegen);
1124 } 1117 }
1125 if (compileAll) { 1118 if (compileAll) {
1126 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib, 1119 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib,
1127 enqueuer.codegen)); 1120 enqueuer.codegen));
1128 } 1121 }
1129 processQueue(enqueuer.codegen, main); 1122 processQueue(enqueuer.codegen, main);
1130 enqueuer.codegen.logSummary(log); 1123 enqueuer.codegen.logSummary(log);
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 1645
1653 void close() {} 1646 void close() {}
1654 1647
1655 toString() => name; 1648 toString() => name;
1656 1649
1657 /// Convenience method for getting an [api.CompilerOutputProvider]. 1650 /// Convenience method for getting an [api.CompilerOutputProvider].
1658 static NullSink outputProvider(String name, String extension) { 1651 static NullSink outputProvider(String name, String extension) {
1659 return new NullSink('$name.$extension'); 1652 return new NullSink('$name.$extension');
1660 } 1653 }
1661 } 1654 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698