| 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.body_builder; | 5 library fasta.body_builder; |
| 6 | 6 |
| 7 import '../fasta_codes.dart' | 7 import '../fasta_codes.dart' |
| 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; | 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; |
| 9 | 9 |
| 10 import '../parser/parser.dart' show FormalParameterType, optional; | 10 import '../parser/parser.dart' show FormalParameterType, optional; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 Statement popStatementIfNotNull(Object value) { | 229 Statement popStatementIfNotNull(Object value) { |
| 230 return value == null ? null : popStatement(); | 230 return value == null ? null : popStatement(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 Statement popStatement() { | 233 Statement popStatement() { |
| 234 var statement = pop(); | 234 var statement = pop(); |
| 235 if (statement is List) { | 235 if (statement is List) { |
| 236 return new Block(new List<Statement>.from(statement)); | 236 return new Block(new List<Statement>.from(statement)); |
| 237 } else if (statement is VariableDeclaration) { |
| 238 return new Block(<Statement>[statement]); |
| 237 } else { | 239 } else { |
| 238 return statement; | 240 return statement; |
| 239 } | 241 } |
| 240 } | 242 } |
| 241 | 243 |
| 242 void ignore(Unhandled value) { | 244 void ignore(Unhandled value) { |
| 243 pop(); | 245 pop(); |
| 244 } | 246 } |
| 245 | 247 |
| 246 void enterSwitchScope() { | 248 void enterSwitchScope() { |
| (...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 } else if (node is PrefixBuilder) { | 2972 } else if (node is PrefixBuilder) { |
| 2971 return node.name; | 2973 return node.name; |
| 2972 } else if (node is ThisAccessor) { | 2974 } else if (node is ThisAccessor) { |
| 2973 return node.isSuper ? "super" : "this"; | 2975 return node.isSuper ? "super" : "this"; |
| 2974 } else if (node is FastaAccessor) { | 2976 } else if (node is FastaAccessor) { |
| 2975 return node.plainNameForRead; | 2977 return node.plainNameForRead; |
| 2976 } else { | 2978 } else { |
| 2977 return internalError("Unhandled: ${node.runtimeType}"); | 2979 return internalError("Unhandled: ${node.runtimeType}"); |
| 2978 } | 2980 } |
| 2979 } | 2981 } |
| OLD | NEW |