Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: lib/src/compiler/code_generator.dart

Issue 1935823002: include type parameters on generic sync/async functions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/codegen/language/generic_async_star_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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';
OLDNEW
« no previous file with comments | « no previous file | test/codegen/language/generic_async_star_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698