Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/element.dart |
| diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart |
| index 45404fc67ad938d29b1a19e690e4388860fe6b40..fb6195804713aa9084ccd831b40d3e67e918240c 100644 |
| --- a/pkg/analyzer/lib/src/generated/element.dart |
| +++ b/pkg/analyzer/lib/src/generated/element.dart |
| @@ -3933,6 +3933,11 @@ abstract class FunctionElement implements ExecutableElement, LocalElement { |
| static final String CALL_METHOD_NAME = "call"; |
| /** |
| + * The name of the function used as an entry point. |
| + */ |
| + static const String MAIN_FUNCTION_NAME = "main"; |
| + |
| + /** |
| * The name of the method that will be invoked if an attempt is made to invoke |
| * an undefined method on an object. |
| */ |
| @@ -3944,6 +3949,12 @@ abstract class FunctionElement implements ExecutableElement, LocalElement { |
| static final String LOAD_LIBRARY_NAME = "loadLibrary"; |
|
Brian Wilkerson
2015/03/11 17:19:23
Could you move this before MAIN... so that they're
scheglov
2015/03/11 17:20:59
Done.
|
| /** |
| + * Return `true` if the function is an entry point, i.e. a top-level function |
| + * and has the name `main`. |
| + */ |
| + bool get isEntryPoint; |
| + |
| + /** |
| * Return the resolved function declaration node that declares this element. |
| * |
| * This method is expensive, because resolved AST might be evicted from cache, |
| @@ -4001,6 +4012,11 @@ class FunctionElementImpl extends ExecutableElementImpl |
| } |
| @override |
| + bool get isEntryPoint { |
| + return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME; |
| + } |
| + |
| + @override |
| bool get isStatic => enclosingElement is CompilationUnitElement; |
| @override |