| OLD | NEW |
| 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
| 6 | 6 |
| 7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
| 8 import com.google.common.collect.Sets; | 8 import com.google.common.collect.Sets; |
| 9 import com.google.common.collect.Sets.SetView; | 9 import com.google.common.collect.Sets.SetView; |
| 10 import com.google.common.io.CharStreams; | 10 import com.google.common.io.CharStreams; |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Element element = lib.getElement().lookupLocalElement(MAIN_ENTRY_POINT_NAM
E); | 684 Element element = lib.getElement().lookupLocalElement(MAIN_ENTRY_POINT_NAM
E); |
| 685 switch (ElementKind.of(element)) { | 685 switch (ElementKind.of(element)) { |
| 686 case NONE: | 686 case NONE: |
| 687 // this is ok, it might just be a library | 687 // this is ok, it might just be a library |
| 688 break; | 688 break; |
| 689 | 689 |
| 690 case METHOD: | 690 case METHOD: |
| 691 MethodElement methodElement = (MethodElement) element; | 691 MethodElement methodElement = (MethodElement) element; |
| 692 Modifiers modifiers = methodElement.getModifiers(); | 692 Modifiers modifiers = methodElement.getModifiers(); |
| 693 if (modifiers.isGetter()) { | 693 if (modifiers.isGetter()) { |
| 694 context.onError(new DartCompilationError(element.getNode(), | 694 context.onError(new DartCompilationError(element, |
| 695 DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_GETTER, MAIN
_ENTRY_POINT_NAME)); | 695 DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_GETTER, MAIN
_ENTRY_POINT_NAME)); |
| 696 } else if (modifiers.isSetter()) { | 696 } else if (modifiers.isSetter()) { |
| 697 context.onError(new DartCompilationError(element.getNode(), | 697 context.onError(new DartCompilationError(element, |
| 698 DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_SETTER, MAIN
_ENTRY_POINT_NAME)); | 698 DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_SETTER, MAIN
_ENTRY_POINT_NAME)); |
| 699 } else if (methodElement.getParameters().size() > 0) { | 699 } else if (methodElement.getParameters().size() > 0) { |
| 700 context.onError(new DartCompilationError(element.getNode(), | 700 context.onError(new DartCompilationError(element, |
| 701 DartCompilerErrorCode.ENTRY_POINT_METHOD_CANNOT_HAVE_PARAMETERS, | 701 DartCompilerErrorCode.ENTRY_POINT_METHOD_CANNOT_HAVE_PARAMETERS, |
| 702 MAIN_ENTRY_POINT_NAME)); | 702 MAIN_ENTRY_POINT_NAME)); |
| 703 } else { | 703 } else { |
| 704 lib.getElement().setEntryPoint(methodElement); | 704 lib.getElement().setEntryPoint(methodElement); |
| 705 } | 705 } |
| 706 break; | 706 break; |
| 707 | 707 |
| 708 default: | 708 default: |
| 709 context.onError(new DartCompilationError(element.getNode(), | 709 context.onError(new DartCompilationError(element, |
| 710 ResolverErrorCode.NOT_A_STATIC_METHOD, MAIN_ENTRY_POINT_NAME)); | 710 ResolverErrorCode.NOT_A_STATIC_METHOD, MAIN_ENTRY_POINT_NAME)); |
| 711 break; | 711 break; |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 | 714 |
| 715 private void compileLibraries() throws IOException { | 715 private void compileLibraries() throws IOException { |
| 716 TraceEvent logEvent = | 716 TraceEvent logEvent = |
| 717 Tracer.canTrace() ? Tracer.start(DartEventType.COMPILE_LIBRARIES) : nu
ll; | 717 Tracer.canTrace() ? Tracer.start(DartEventType.COMPILE_LIBRARIES) : nu
ll; |
| 718 | 718 |
| 719 CompilerMetrics compilerMetrics = context.getCompilerMetrics(); | 719 CompilerMetrics compilerMetrics = context.getCompilerMetrics(); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 return unit; | 1228 return unit; |
| 1229 } | 1229 } |
| 1230 } | 1230 } |
| 1231 return null; | 1231 return null; |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) { | 1234 public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) { |
| 1235 return findLibrary(libraryUnit, "dart:core", new HashSet<LibraryElement>()); | 1235 return findLibrary(libraryUnit, "dart:core", new HashSet<LibraryElement>()); |
| 1236 } | 1236 } |
| 1237 } | 1237 } |
| OLD | NEW |