OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library elements.modelx; | 5 library elements.modelx; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show | 8 import '../common/resolution.dart' show |
9 Resolution, | 9 Resolution, |
10 Parsing; | 10 Parsing; |
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 with AnalyzableElementX implements MethodElement { | 2045 with AnalyzableElementX implements MethodElement { |
2046 | 2046 |
2047 FunctionElementX(String name, | 2047 FunctionElementX(String name, |
2048 ElementKind kind, | 2048 ElementKind kind, |
2049 Modifiers modifiers, | 2049 Modifiers modifiers, |
2050 Element enclosing) | 2050 Element enclosing) |
2051 : super(name, kind, modifiers, enclosing); | 2051 : super(name, kind, modifiers, enclosing); |
2052 | 2052 |
2053 MemberElement get memberContext => this; | 2053 MemberElement get memberContext => this; |
2054 | 2054 |
| 2055 @override |
| 2056 SourceSpan get sourcePosition { |
| 2057 SourceSpan span = super.sourcePosition; |
| 2058 if (span != null && hasNode) { |
| 2059 FunctionExpression functionExpression = node.asFunctionExpression(); |
| 2060 if (functionExpression != null) { |
| 2061 Token begin = functionExpression.getBeginToken(); |
| 2062 Token end; |
| 2063 if (functionExpression.parameters != null) { |
| 2064 end = functionExpression.parameters.getEndToken(); |
| 2065 } else { |
| 2066 end = functionExpression.name.getEndToken(); |
| 2067 } |
| 2068 span = new SourceSpan.fromTokens(span.uri, begin, end); |
| 2069 } |
| 2070 } |
| 2071 return span; |
| 2072 } |
| 2073 |
2055 void reuseElement() { | 2074 void reuseElement() { |
2056 super.reuseElement(); | 2075 super.reuseElement(); |
2057 nestedClosures.clear(); | 2076 nestedClosures.clear(); |
2058 _functionSignatureCache = null; | 2077 _functionSignatureCache = null; |
2059 typeCache = null; | 2078 typeCache = null; |
2060 } | 2079 } |
2061 } | 2080 } |
2062 | 2081 |
2063 abstract class MethodElementX extends FunctionElementX { | 2082 abstract class MethodElementX extends FunctionElementX { |
2064 final bool hasBody; | 2083 final bool hasBody; |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 AstElement get definingElement; | 3120 AstElement get definingElement; |
3102 | 3121 |
3103 bool get hasResolvedAst => definingElement.hasTreeElements; | 3122 bool get hasResolvedAst => definingElement.hasTreeElements; |
3104 | 3123 |
3105 ResolvedAst get resolvedAst { | 3124 ResolvedAst get resolvedAst { |
3106 return new ResolvedAst(declaration, | 3125 return new ResolvedAst(declaration, |
3107 definingElement.node, definingElement.treeElements); | 3126 definingElement.node, definingElement.treeElements); |
3108 } | 3127 } |
3109 | 3128 |
3110 } | 3129 } |
OLD | NEW |