| OLD | NEW |
| 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.kernel_procedure_builder; | 5 library fasta.kernel_procedure_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
| 8 show | 8 show |
| 9 Arguments, | 9 Arguments, |
| 10 AsyncMarker, | 10 AsyncMarker, |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 void set asyncModifier(AsyncMarker newModifier) { | 244 void set asyncModifier(AsyncMarker newModifier) { |
| 245 actualAsyncModifier = newModifier; | 245 actualAsyncModifier = newModifier; |
| 246 if (function != null) { | 246 if (function != null) { |
| 247 // No parent, it's an enum. | 247 // No parent, it's an enum. |
| 248 function.asyncMarker = actualAsyncModifier; | 248 function.asyncMarker = actualAsyncModifier; |
| 249 function.dartAsyncMarker = actualAsyncModifier; | 249 function.dartAsyncMarker = actualAsyncModifier; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool get isEligibleForTopLevelInference { | 253 bool get isEligibleForTopLevelInference { |
| 254 if (!isInstanceMember) return false; | 254 if (isInstanceMember) { |
| 255 if (returnType == null) return true; | 255 if (returnType == null) return true; |
| 256 if (formals != null) { | 256 if (formals != null) { |
| 257 for (var formal in formals) { | 257 for (var formal in formals) { |
| 258 if (formal.type == null) return true; | 258 if (formal.type == null) return true; |
| 259 } |
| 259 } | 260 } |
| 261 } else { |
| 262 if (isSetter && returnType == null) return true; |
| 260 } | 263 } |
| 261 return false; | 264 return false; |
| 262 } | 265 } |
| 263 | 266 |
| 264 Procedure build(SourceLibraryBuilder library) { | 267 Procedure build(SourceLibraryBuilder library) { |
| 265 // TODO(ahe): I think we may call this twice on parts. Investigate. | 268 // TODO(ahe): I think we may call this twice on parts. Investigate. |
| 266 if (procedure.name == null) { | 269 if (procedure.name == null) { |
| 267 procedure.function = buildFunction(library); | 270 procedure.function = buildFunction(library); |
| 268 procedure.function.parent = procedure; | 271 procedure.function.parent = procedure; |
| 269 procedure.function.fileOffset = charOpenParenOffset; | 272 procedure.function.fileOffset = charOpenParenOffset; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 412 } |
| 410 } | 413 } |
| 411 initializers.add(initializer..parent = constructor); | 414 initializers.add(initializer..parent = constructor); |
| 412 initializers.add(superInitializer); | 415 initializers.add(superInitializer); |
| 413 return; | 416 return; |
| 414 } | 417 } |
| 415 initializers.add(initializer); | 418 initializers.add(initializer); |
| 416 initializer.parent = constructor; | 419 initializer.parent = constructor; |
| 417 } | 420 } |
| 418 } | 421 } |
| OLD | NEW |