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

Side by Side Diff: pkg/front_end/lib/src/fasta/builder/procedure_builder.dart

Issue 2899073004: Use declared return type for inference of return and yield statements. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.procedure_builder; 5 library fasta.procedure_builder;
6 6
7 // Note: we're deliberately using AsyncMarker and ProcedureKind from kernel 7 // Note: we're deliberately using AsyncMarker and ProcedureKind from kernel
8 // outside the kernel-specific builders. This is simpler than creating 8 // outside the kernel-specific builders. This is simpler than creating
9 // additional enums. 9 // additional enums.
10 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; 10 import 'package:kernel/ast.dart' show AsyncMarker, FunctionNode, ProcedureKind;
ahe 2017/05/24 15:36:39 Could you move this to KernelProcedureBuilder?
Paul Berry 2017/05/24 16:20:16 Acknowledged. In light of your other suggestion,
11 11
12 import 'builder.dart' 12 import 'builder.dart'
13 show 13 show
14 Builder, 14 Builder,
15 FormalParameterBuilder, 15 FormalParameterBuilder,
16 LibraryBuilder, 16 LibraryBuilder,
17 MemberBuilder, 17 MemberBuilder,
18 MetadataBuilder, 18 MetadataBuilder,
19 Scope, 19 Scope,
20 TypeBuilder, 20 TypeBuilder,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 bool get isRegularMethod => identical(ProcedureKind.Method, kind); 53 bool get isRegularMethod => identical(ProcedureKind.Method, kind);
54 54
55 bool get isGetter => identical(ProcedureKind.Getter, kind); 55 bool get isGetter => identical(ProcedureKind.Getter, kind);
56 56
57 bool get isSetter => identical(ProcedureKind.Setter, kind); 57 bool get isSetter => identical(ProcedureKind.Setter, kind);
58 58
59 bool get isOperator => identical(ProcedureKind.Operator, kind); 59 bool get isOperator => identical(ProcedureKind.Operator, kind);
60 60
61 bool get isFactory => identical(ProcedureKind.Factory, kind); 61 bool get isFactory => identical(ProcedureKind.Factory, kind);
62 62
63 FunctionNode get function;
64
63 void set body(covariant statement); 65 void set body(covariant statement);
64 66
65 /// This is the formal parameter scope as specified in the Dart Programming 67 /// This is the formal parameter scope as specified in the Dart Programming
66 /// Language Specifiction, 4th ed, section 9.2. 68 /// Language Specifiction, 4th ed, section 9.2.
67 Scope computeFormalParameterScope(Scope parent) { 69 Scope computeFormalParameterScope(Scope parent) {
68 if (formals == null) return parent; 70 if (formals == null) return parent;
69 Map<String, Builder> local = <String, Builder>{}; 71 Map<String, Builder> local = <String, Builder>{};
70 for (FormalParameterBuilder formal in formals) { 72 for (FormalParameterBuilder formal in formals) {
71 if (!isConstructor || !formal.hasThis) { 73 if (!isConstructor || !formal.hasThis) {
72 local[formal.name] = formal; 74 local[formal.name] = formal;
73 } 75 }
74 } 76 }
75 return new Scope(local, null, parent, isModifiable: false); 77 return new Scope(local, null, parent, isModifiable: false);
76 } 78 }
77 79
78 /// This scope doesn't correspond to any scope specified in the Dart 80 /// This scope doesn't correspond to any scope specified in the Dart
79 /// Programming Language Specifiction, 4th ed. It's an unspecified extension 81 /// Programming Language Specifiction, 4th ed. It's an unspecified extension
80 /// to support generic methods. 82 /// to support generic methods.
81 Scope computeTypeParameterScope(Scope parent) { 83 Scope computeTypeParameterScope(Scope parent) {
82 if (typeVariables == null) return parent; 84 if (typeVariables == null) return parent;
83 Map<String, Builder> local = <String, Builder>{}; 85 Map<String, Builder> local = <String, Builder>{};
84 for (TypeVariableBuilder variable in typeVariables) { 86 for (TypeVariableBuilder variable in typeVariables) {
85 local[variable.name] = variable; 87 local[variable.name] = variable;
86 } 88 }
87 return new Scope(local, null, parent, isModifiable: false); 89 return new Scope(local, null, parent, isModifiable: false);
88 } 90 }
89 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698