OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 | 2 |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:collection' show HashMap, HashSet; | 6 import 'dart:collection' show HashMap, HashSet; |
7 import 'dart:math' show min, max; | 7 import 'dart:math' show min, max; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3438 var body = js.call('# == null ? null : #', | 3438 var body = js.call('# == null ? null : #', |
3439 [_visit(left), _emitSet(_stripNullAwareOp(node, left), right)]); | 3439 [_visit(left), _emitSet(_stripNullAwareOp(node, left), right)]); |
3440 return new JS.MetaLet(vars, [body]); | 3440 return new JS.MetaLet(vars, [body]); |
3441 } | 3441 } |
3442 | 3442 |
3443 @override | 3443 @override |
3444 JS.Block visitExpressionFunctionBody(ExpressionFunctionBody node) { | 3444 JS.Block visitExpressionFunctionBody(ExpressionFunctionBody node) { |
3445 var savedFunction = _currentFunction; | 3445 var savedFunction = _currentFunction; |
3446 _currentFunction = node; | 3446 _currentFunction = node; |
3447 var initArgs = _emitArgumentInitializers(node.parent); | 3447 var initArgs = _emitArgumentInitializers(node.parent); |
3448 var ret = new JS.Return(_visit(node.expression)); | 3448 var ret = annotate(new JS.Return(_visit(node.expression)), node.expression); |
3449 _currentFunction = savedFunction; | 3449 _currentFunction = savedFunction; |
3450 return new JS.Block(initArgs != null ? [initArgs, ret] : [ret]); | 3450 var _statements = initArgs != null ? [initArgs, ret] : [ret]; |
| 3451 var block = annotate(new JS.Block(_statements), node); |
| 3452 return block; |
3451 } | 3453 } |
3452 | 3454 |
3453 @override | 3455 @override |
3454 JS.Block visitEmptyFunctionBody(EmptyFunctionBody node) => new JS.Block([]); | 3456 JS.Block visitEmptyFunctionBody(EmptyFunctionBody node) => new JS.Block([]); |
3455 | 3457 |
3456 @override | 3458 @override |
3457 JS.Block visitBlockFunctionBody(BlockFunctionBody node) { | 3459 JS.Block visitBlockFunctionBody(BlockFunctionBody node) { |
3458 var savedFunction = _currentFunction; | 3460 var savedFunction = _currentFunction; |
3459 _currentFunction = node; | 3461 _currentFunction = node; |
3460 var initArgs = _emitArgumentInitializers(node.parent); | 3462 var initArgs = _emitArgumentInitializers(node.parent); |
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5948 if (targetIdentifier.staticElement is! PrefixElement) return false; | 5950 if (targetIdentifier.staticElement is! PrefixElement) return false; |
5949 var prefix = targetIdentifier.staticElement as PrefixElement; | 5951 var prefix = targetIdentifier.staticElement as PrefixElement; |
5950 | 5952 |
5951 // The library the prefix is referring to must come from a deferred import. | 5953 // The library the prefix is referring to must come from a deferred import. |
5952 var containingLibrary = resolutionMap | 5954 var containingLibrary = resolutionMap |
5953 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 5955 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
5954 .library; | 5956 .library; |
5955 var imports = containingLibrary.getImportsWithPrefix(prefix); | 5957 var imports = containingLibrary.getImportsWithPrefix(prefix); |
5956 return imports.length == 1 && imports[0].isDeferred; | 5958 return imports.length == 1 && imports[0].isDeferred; |
5957 } | 5959 } |
OLD | NEW |