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

Side by Side Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 997203002: Add FunctionElement.isEntryPoint getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 3915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3926 * variable. 3926 * variable.
3927 */ 3927 */
3928 abstract class FunctionElement implements ExecutableElement, LocalElement { 3928 abstract class FunctionElement implements ExecutableElement, LocalElement {
3929 /** 3929 /**
3930 * The name of the method that can be implemented by a class to allow its 3930 * The name of the method that can be implemented by a class to allow its
3931 * instances to be invoked as if they were a function. 3931 * instances to be invoked as if they were a function.
3932 */ 3932 */
3933 static final String CALL_METHOD_NAME = "call"; 3933 static final String CALL_METHOD_NAME = "call";
3934 3934
3935 /** 3935 /**
3936 * The name of the function used as an entry point.
3937 */
3938 static const String MAIN_FUNCTION_NAME = "main";
3939
3940 /**
3936 * The name of the method that will be invoked if an attempt is made to invoke 3941 * The name of the method that will be invoked if an attempt is made to invoke
3937 * an undefined method on an object. 3942 * an undefined method on an object.
3938 */ 3943 */
3939 static final String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod"; 3944 static final String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod";
3940 3945
3941 /** 3946 /**
3942 * The name of the synthetic function defined for libraries that are deferred. 3947 * The name of the synthetic function defined for libraries that are deferred.
3943 */ 3948 */
3944 static final String LOAD_LIBRARY_NAME = "loadLibrary"; 3949 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.
3945 3950
3946 /** 3951 /**
3952 * Return `true` if the function is an entry point, i.e. a top-level function
3953 * and has the name `main`.
3954 */
3955 bool get isEntryPoint;
3956
3957 /**
3947 * Return the resolved function declaration node that declares this element. 3958 * Return the resolved function declaration node that declares this element.
3948 * 3959 *
3949 * This method is expensive, because resolved AST might be evicted from cache, 3960 * This method is expensive, because resolved AST might be evicted from cache,
3950 * so parsing and resolving will be performed. 3961 * so parsing and resolving will be performed.
3951 */ 3962 */
3952 @override 3963 @override
3953 FunctionDeclaration get node; 3964 FunctionDeclaration get node;
3954 } 3965 }
3955 3966
3956 /** 3967 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 @override 4005 @override
3995 String get identifier { 4006 String get identifier {
3996 String identifier = super.identifier; 4007 String identifier = super.identifier;
3997 if (!isStatic) { 4008 if (!isStatic) {
3998 identifier += "@$nameOffset"; 4009 identifier += "@$nameOffset";
3999 } 4010 }
4000 return identifier; 4011 return identifier;
4001 } 4012 }
4002 4013
4003 @override 4014 @override
4015 bool get isEntryPoint {
4016 return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME;
4017 }
4018
4019 @override
4004 bool get isStatic => enclosingElement is CompilationUnitElement; 4020 bool get isStatic => enclosingElement is CompilationUnitElement;
4005 4021
4006 @override 4022 @override
4007 ElementKind get kind => ElementKind.FUNCTION; 4023 ElementKind get kind => ElementKind.FUNCTION;
4008 4024
4009 @override 4025 @override
4010 FunctionDeclaration get node => 4026 FunctionDeclaration get node =>
4011 getNodeMatching((node) => node is FunctionDeclaration); 4027 getNodeMatching((node) => node is FunctionDeclaration);
4012 4028
4013 @override 4029 @override
(...skipping 6394 matching lines...) Expand 10 before | Expand all | Expand 10 after
10408 // void <: void (by reflexivity) 10424 // void <: void (by reflexivity)
10409 // bottom <: void (as bottom is a subtype of all types). 10425 // bottom <: void (as bottom is a subtype of all types).
10410 // void <: dynamic (as dynamic is a supertype of all types) 10426 // void <: dynamic (as dynamic is a supertype of all types)
10411 return identical(type, this) || type.isDynamic; 10427 return identical(type, this) || type.isDynamic;
10412 } 10428 }
10413 10429
10414 @override 10430 @override
10415 VoidTypeImpl substitute2( 10431 VoidTypeImpl substitute2(
10416 List<DartType> argumentTypes, List<DartType> parameterTypes) => this; 10432 List<DartType> argumentTypes, List<DartType> parameterTypes) => this;
10417 } 10433 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698