OLD | NEW |
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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 * Initialize a newly created function element to have the given [name]. | 2732 * Initialize a newly created function element to have the given [name]. |
2733 */ | 2733 */ |
2734 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); | 2734 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); |
2735 | 2735 |
2736 /** | 2736 /** |
2737 * Initialize a newly created function element to have no name and the given | 2737 * Initialize a newly created function element to have no name and the given |
2738 * [offset]. This is used for function expressions, that have no name. | 2738 * [offset]. This is used for function expressions, that have no name. |
2739 */ | 2739 */ |
2740 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); | 2740 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); |
2741 | 2741 |
| 2742 /** |
| 2743 * Synthesize an unnamed function element that takes [parameters] and returns |
| 2744 * [returnType]. |
| 2745 */ |
| 2746 FunctionElementImpl.synthetic( |
| 2747 List<ParameterElement> parameters, DartType returnType) |
| 2748 : super("", -1) { |
| 2749 synthetic = true; |
| 2750 this.returnType = returnType; |
| 2751 this.parameters = parameters; |
| 2752 |
| 2753 type = new FunctionTypeImpl(this); |
| 2754 } |
| 2755 |
2742 @override | 2756 @override |
2743 String get identifier { | 2757 String get identifier { |
2744 String identifier = super.identifier; | 2758 String identifier = super.identifier; |
2745 if (!isStatic) { | 2759 if (!isStatic) { |
2746 identifier += "@$nameOffset"; | 2760 identifier += "@$nameOffset"; |
2747 } | 2761 } |
2748 return identifier; | 2762 return identifier; |
2749 } | 2763 } |
2750 | 2764 |
2751 @override | 2765 @override |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4922 | 4936 |
4923 @override | 4937 @override |
4924 void visitElement(Element element) { | 4938 void visitElement(Element element) { |
4925 int offset = element.nameOffset; | 4939 int offset = element.nameOffset; |
4926 if (offset != -1) { | 4940 if (offset != -1) { |
4927 map[offset] = element; | 4941 map[offset] = element; |
4928 } | 4942 } |
4929 super.visitElement(element); | 4943 super.visitElement(element); |
4930 } | 4944 } |
4931 } | 4945 } |
OLD | NEW |