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 | 8 show |
9 FastaMessage, | 9 FastaMessage, |
10 codeConstFieldWithoutInitializer, | 10 codeConstFieldWithoutInitializer, |
(...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2869 } else if (target == null || | 2869 } else if (target == null || |
2870 target is! JumpTarget || | 2870 target is! JumpTarget || |
2871 !target.isBreakTarget) { | 2871 !target.isBreakTarget) { |
2872 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2872 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
2873 "Can't break to '$name'.", breakKeyword.next.charOffset)); | 2873 "Can't break to '$name'.", breakKeyword.next.charOffset)); |
2874 } else if (target.functionNestingLevel != functionNestingLevel) { | 2874 } else if (target.functionNestingLevel != functionNestingLevel) { |
2875 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2875 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
2876 "Can't break to '$name' in a different function.", | 2876 "Can't break to '$name' in a different function.", |
2877 breakKeyword.next.charOffset)); | 2877 breakKeyword.next.charOffset)); |
2878 } else { | 2878 } else { |
2879 BreakStatement statement = new BreakStatement(null) | 2879 BreakStatement statement = new KernelBreakStatement(null) |
2880 ..fileOffset = breakKeyword.charOffset; | 2880 ..fileOffset = breakKeyword.charOffset; |
2881 target.addBreak(statement); | 2881 target.addBreak(statement); |
2882 push(statement); | 2882 push(statement); |
2883 } | 2883 } |
2884 } | 2884 } |
2885 | 2885 |
2886 @override | 2886 @override |
2887 void handleContinueStatement( | 2887 void handleContinueStatement( |
2888 bool hasTarget, Token continueKeyword, Token endToken) { | 2888 bool hasTarget, Token continueKeyword, Token endToken) { |
2889 debugEvent("ContinueStatement"); | 2889 debugEvent("ContinueStatement"); |
(...skipping 12 matching lines...) Expand all Loading... |
2902 if (switchScope == null) { | 2902 if (switchScope == null) { |
2903 push(buildCompileTimeErrorStatement( | 2903 push(buildCompileTimeErrorStatement( |
2904 "Can't find label '$name'.", continueKeyword.next.charOffset)); | 2904 "Can't find label '$name'.", continueKeyword.next.charOffset)); |
2905 return; | 2905 return; |
2906 } | 2906 } |
2907 switchScope.forwardDeclareLabel(identifier.name, | 2907 switchScope.forwardDeclareLabel(identifier.name, |
2908 target = createGotoTarget(offsetForToken(identifier.token))); | 2908 target = createGotoTarget(offsetForToken(identifier.token))); |
2909 } | 2909 } |
2910 if (target.isGotoTarget && | 2910 if (target.isGotoTarget && |
2911 target.functionNestingLevel == functionNestingLevel) { | 2911 target.functionNestingLevel == functionNestingLevel) { |
2912 ContinueSwitchStatement statement = new ContinueSwitchStatement(null); | 2912 ContinueSwitchStatement statement = |
| 2913 new KernelContinueSwitchStatement(null); |
2913 target.addGoto(statement); | 2914 target.addGoto(statement); |
2914 push(statement); | 2915 push(statement); |
2915 return; | 2916 return; |
2916 } | 2917 } |
2917 } | 2918 } |
2918 if (target == null) { | 2919 if (target == null) { |
2919 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2920 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
2920 "No target of continue.", continueKeyword.charOffset)); | 2921 "No target of continue.", continueKeyword.charOffset)); |
2921 } else if (!target.isContinueTarget) { | 2922 } else if (!target.isContinueTarget) { |
2922 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2923 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
2923 "Can't continue at '$name'.", continueKeyword.next.charOffset)); | 2924 "Can't continue at '$name'.", continueKeyword.next.charOffset)); |
2924 } else if (target.functionNestingLevel != functionNestingLevel) { | 2925 } else if (target.functionNestingLevel != functionNestingLevel) { |
2925 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2926 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
2926 "Can't continue at '$name' in a different function.", | 2927 "Can't continue at '$name' in a different function.", |
2927 continueKeyword.next.charOffset)); | 2928 continueKeyword.next.charOffset)); |
2928 } else { | 2929 } else { |
2929 BreakStatement statement = new BreakStatement(null) | 2930 BreakStatement statement = new KernelBreakStatement(null) |
2930 ..fileOffset = continueKeyword.charOffset; | 2931 ..fileOffset = continueKeyword.charOffset; |
2931 target.addContinue(statement); | 2932 target.addContinue(statement); |
2932 push(statement); | 2933 push(statement); |
2933 } | 2934 } |
2934 } | 2935 } |
2935 | 2936 |
2936 @override | 2937 @override |
2937 void endTypeVariable(Token token, Token extendsOrSuper) { | 2938 void endTypeVariable(Token token, Token extendsOrSuper) { |
2938 debugEvent("TypeVariable"); | 2939 debugEvent("TypeVariable"); |
2939 // TODO(ahe): Do not discard these when enabling generic method syntax. | 2940 // TODO(ahe): Do not discard these when enabling generic method syntax. |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 if (starToken == null) { | 3693 if (starToken == null) { |
3693 return AsyncMarker.Async; | 3694 return AsyncMarker.Async; |
3694 } else { | 3695 } else { |
3695 assert(identical(starToken.stringValue, "*")); | 3696 assert(identical(starToken.stringValue, "*")); |
3696 return AsyncMarker.AsyncStar; | 3697 return AsyncMarker.AsyncStar; |
3697 } | 3698 } |
3698 } else { | 3699 } else { |
3699 return internalError("Unknown async modifier: $asyncToken"); | 3700 return internalError("Unknown async modifier: $asyncToken"); |
3700 } | 3701 } |
3701 } | 3702 } |
OLD | NEW |