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.analyzer.ast_builder; | 5 library fasta.analyzer.ast_builder; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; | 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 exitBreakTarget(); | 944 exitBreakTarget(); |
945 exitLocalScope(); | 945 exitLocalScope(); |
946 List<SwitchMember> members = | 946 List<SwitchMember> members = |
947 membersList?.expand((members) => members)?.toList() ?? <SwitchMember>[]; | 947 membersList?.expand((members) => members)?.toList() ?? <SwitchMember>[]; |
948 push(leftBracket); | 948 push(leftBracket); |
949 push(members); | 949 push(members); |
950 push(rightBracket); | 950 push(rightBracket); |
951 } | 951 } |
952 | 952 |
953 @override | 953 @override |
954 void handleSwitchCase( | 954 void endSwitchCase(int labelCount, int expressionCount, Token defaultKeyword, |
955 int labelCount, | 955 int statementCount, Token firstToken, Token endToken) { |
956 int expressionCount, | |
957 Token defaultKeyword, | |
958 int statementCount, | |
959 Token firstToken, | |
960 Token endToken) { | |
961 debugEvent("SwitchCase"); | 956 debugEvent("SwitchCase"); |
962 List<Statement> statements = popList(statementCount); | 957 List<Statement> statements = popList(statementCount); |
963 List<SwitchMember> members = popList(expressionCount) ?? []; | 958 List<SwitchMember> members = popList(expressionCount) ?? []; |
964 List<Label> labels = popList(labelCount); | 959 List<Label> labels = popList(labelCount); |
965 if (defaultKeyword != null) { | 960 if (defaultKeyword != null) { |
966 members.add(ast.switchDefault( | 961 members.add(ast.switchDefault( |
967 <Label>[], defaultKeyword, defaultKeyword.next, <Statement>[])); | 962 <Label>[], defaultKeyword, defaultKeyword.next, <Statement>[])); |
968 } | 963 } |
969 members.last.statements.addAll(statements); | 964 members.last.statements.addAll(statements); |
970 members.first.labels.addAll(labels); | 965 members.first.labels.addAll(labels); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 } else if (identical('var', s)) { | 2016 } else if (identical('var', s)) { |
2022 finalConstOrVarKeyword = token; | 2017 finalConstOrVarKeyword = token; |
2023 } else if (identical('covariant', s)) { | 2018 } else if (identical('covariant', s)) { |
2024 covariantKeyword = token; | 2019 covariantKeyword = token; |
2025 } else { | 2020 } else { |
2026 unhandled("$s", "modifier", token.charOffset, null); | 2021 unhandled("$s", "modifier", token.charOffset, null); |
2027 } | 2022 } |
2028 } | 2023 } |
2029 } | 2024 } |
2030 } | 2025 } |
OLD | NEW |