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 // 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 import 'dart:collection' show HashMap, HashSet; | 5 import 'dart:collection' show HashMap, HashSet; |
6 import 'dart:math' show min, max; | 6 import 'dart:math' show min, max; |
7 | 7 |
8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 FormalParameterList parameters, FunctionBody body) { | 1874 FormalParameterList parameters, FunctionBody body) { |
1875 FunctionType type = element.type; | 1875 FunctionType type = element.type; |
1876 | 1876 |
1877 // sync*, async, async* | 1877 // sync*, async, async* |
1878 if (element.isAsynchronous || element.isGenerator) { | 1878 if (element.isAsynchronous || element.isGenerator) { |
1879 return new JS.Fun( | 1879 return new JS.Fun( |
1880 visitFormalParameterList(parameters, destructure: false), | 1880 visitFormalParameterList(parameters, destructure: false), |
1881 new JS.Block([ | 1881 new JS.Block([ |
1882 _emitGeneratorFunctionBody(element, parameters, body).toReturn() | 1882 _emitGeneratorFunctionBody(element, parameters, body).toReturn() |
1883 ]), | 1883 ]), |
| 1884 typeParams: _emitTypeFormals(type.typeFormals), |
1884 returnType: emitTypeRef(type.returnType)); | 1885 returnType: emitTypeRef(type.returnType)); |
1885 } | 1886 } |
1886 | 1887 |
1887 // normal function (sync) | 1888 // normal function (sync) |
1888 return new JS.Fun(visitFormalParameterList(parameters), _visit(body), | 1889 return new JS.Fun(visitFormalParameterList(parameters), _visit(body), |
1889 typeParams: _emitTypeFormals(type.typeFormals), | 1890 typeParams: _emitTypeFormals(type.typeFormals), |
1890 returnType: emitTypeRef(type.returnType)); | 1891 returnType: emitTypeRef(type.returnType)); |
1891 } | 1892 } |
1892 | 1893 |
1893 JS.Expression _emitGeneratorFunctionBody(ExecutableElement element, | 1894 JS.Expression _emitGeneratorFunctionBody(ExecutableElement element, |
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4184 } | 4185 } |
4185 | 4186 |
4186 bool isLibraryPrefix(Expression node) => | 4187 bool isLibraryPrefix(Expression node) => |
4187 node is SimpleIdentifier && node.staticElement is PrefixElement; | 4188 node is SimpleIdentifier && node.staticElement is PrefixElement; |
4188 | 4189 |
4189 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 4190 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
4190 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 4191 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
4191 | 4192 |
4192 bool _isDartRuntime(LibraryElement l) => | 4193 bool _isDartRuntime(LibraryElement l) => |
4193 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 4194 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
OLD | NEW |