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 library dart2js.resolution.members; | 5 library dart2js.resolution.members; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show Selectors; | 8 import '../common/names.dart' show Selectors; |
9 import '../common/resolution.dart' show Feature; | 9 import '../common/resolution.dart' show Feature; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 /// | 557 /// |
558 /// This is used to distinguish local function declarations from anonymous | 558 /// This is used to distinguish local function declarations from anonymous |
559 /// function expressions. | 559 /// function expressions. |
560 ResolutionResult visitFunctionExpression(FunctionExpression node, | 560 ResolutionResult visitFunctionExpression(FunctionExpression node, |
561 {bool inFunctionDeclaration: false}) { | 561 {bool inFunctionDeclaration: false}) { |
562 bool doAddToScope = inFunctionDeclaration; | 562 bool doAddToScope = inFunctionDeclaration; |
563 if (!inFunctionDeclaration && node.name != null) { | 563 if (!inFunctionDeclaration && node.name != null) { |
564 reporter.reportErrorMessage(node.name, | 564 reporter.reportErrorMessage(node.name, |
565 MessageKind.NAMED_FUNCTION_EXPRESSION, {'name': node.name}); | 565 MessageKind.NAMED_FUNCTION_EXPRESSION, {'name': node.name}); |
566 } | 566 } |
567 visit(node.returnType); | |
568 String name; | 567 String name; |
569 if (node.name == null) { | 568 if (node.name == null) { |
570 name = ""; | 569 name = ""; |
571 } else { | 570 } else { |
572 name = node.name.asIdentifier().source; | 571 name = node.name.asIdentifier().source; |
573 } | 572 } |
574 LocalFunctionElementX function = new LocalFunctionElementX( | 573 LocalFunctionElementX function = new LocalFunctionElementX( |
575 name, node, ElementKind.FUNCTION, Modifiers.EMPTY, enclosingElement); | 574 name, node, ElementKind.FUNCTION, Modifiers.EMPTY, enclosingElement); |
576 ResolverTask.processAsyncMarker(compiler, function, registry); | 575 ResolverTask.processAsyncMarker(compiler, function, registry); |
577 function.functionSignature = SignatureResolver.analyze( | 576 function.functionSignature = SignatureResolver.analyze( |
(...skipping 4148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4726 } | 4725 } |
4727 return const NoneResult(); | 4726 return const NoneResult(); |
4728 } | 4727 } |
4729 } | 4728 } |
4730 | 4729 |
4731 /// Looks up [name] in [scope] and unwraps the result. | 4730 /// Looks up [name] in [scope] and unwraps the result. |
4732 Element lookupInScope( | 4731 Element lookupInScope( |
4733 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4732 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
4734 return Elements.unwrap(scope.lookup(name), reporter, node); | 4733 return Elements.unwrap(scope.lookup(name), reporter, node); |
4735 } | 4734 } |
OLD | NEW |