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 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 void handleLabel(Token token) { | 2028 void handleLabel(Token token) { |
2029 debugEvent("Label"); | 2029 debugEvent("Label"); |
2030 Identifier identifier = pop(); | 2030 Identifier identifier = pop(); |
2031 push(new Label(identifier.name)); | 2031 push(new Label(identifier.name)); |
2032 } | 2032 } |
2033 | 2033 |
2034 @override | 2034 @override |
2035 void beginLabeledStatement(Token token, int labelCount) { | 2035 void beginLabeledStatement(Token token, int labelCount) { |
2036 debugEvent("beginLabeledStatement"); | 2036 debugEvent("beginLabeledStatement"); |
2037 List<Label> labels = popList(labelCount); | 2037 List<Label> labels = popList(labelCount); |
2038 enterLocalScope(); | 2038 enterLocalScope(scope.createNestedLabelScope()); |
2039 LabelTarget target = | 2039 LabelTarget target = |
2040 new LabelTarget(member, functionNestingLevel, token.charOffset); | 2040 new LabelTarget(member, functionNestingLevel, token.charOffset); |
2041 for (Label label in labels) { | 2041 for (Label label in labels) { |
2042 scope.declareLabel(label.name, target); | 2042 scope.declareLabel(label.name, target); |
2043 } | 2043 } |
2044 push(target); | 2044 push(target); |
2045 } | 2045 } |
2046 | 2046 |
2047 @override | 2047 @override |
2048 void endLabeledStatement(int labelCount) { | 2048 void endLabeledStatement(int labelCount) { |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2899 } else if (node is PrefixBuilder) { | 2899 } else if (node is PrefixBuilder) { |
2900 return node.name; | 2900 return node.name; |
2901 } else if (node is ThisAccessor) { | 2901 } else if (node is ThisAccessor) { |
2902 return node.isSuper ? "super" : "this"; | 2902 return node.isSuper ? "super" : "this"; |
2903 } else if (node is FastaAccessor) { | 2903 } else if (node is FastaAccessor) { |
2904 return node.plainNameForRead; | 2904 return node.plainNameForRead; |
2905 } else { | 2905 } else { |
2906 return internalError("Unhandled: ${node.runtimeType}"); | 2906 return internalError("Unhandled: ${node.runtimeType}"); |
2907 } | 2907 } |
2908 } | 2908 } |
OLD | NEW |