basic.carbon 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // CHECK:STDOUT: [
  7. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  8. // CHECK:STDOUT: {kind: 'Name', text: 'F'},
  9. // CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
  10. // CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
  11. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  12. // CHECK:STDOUT: {kind: 'WhileConditionStart', text: '('},
  13. // CHECK:STDOUT: {kind: 'NameExpression', text: 'a'},
  14. // CHECK:STDOUT: {kind: 'WhileCondition', text: ')', subtree_size: 3},
  15. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: '{'},
  16. // CHECK:STDOUT: {kind: 'IfConditionStart', text: '('},
  17. // CHECK:STDOUT: {kind: 'NameExpression', text: 'b'},
  18. // CHECK:STDOUT: {kind: 'IfCondition', text: ')', subtree_size: 3},
  19. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: '{'},
  20. // CHECK:STDOUT: {kind: 'BreakStatementStart', text: 'break'},
  21. // CHECK:STDOUT: {kind: 'BreakStatement', text: ';', subtree_size: 2},
  22. // CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 4},
  23. // CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 8},
  24. // CHECK:STDOUT: {kind: 'IfConditionStart', text: '('},
  25. // CHECK:STDOUT: {kind: 'NameExpression', text: 'c'},
  26. // CHECK:STDOUT: {kind: 'IfCondition', text: ')', subtree_size: 3},
  27. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: '{'},
  28. // CHECK:STDOUT: {kind: 'ContinueStatementStart', text: 'continue'},
  29. // CHECK:STDOUT: {kind: 'ContinueStatement', text: ';', subtree_size: 2},
  30. // CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 4},
  31. // CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 8},
  32. // CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 18},
  33. // CHECK:STDOUT: {kind: 'WhileStatement', text: 'while', subtree_size: 22},
  34. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 28},
  35. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  36. // CHECK:STDOUT: ]
  37. fn F() {
  38. while (a) {
  39. if (b) {
  40. break;
  41. }
  42. if (c) {
  43. continue;
  44. }
  45. }
  46. }