mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 22:02:41 +01:00
This is a step toward making binding pattern handling more robust, by removing its reliance on the node stack for context.
37 lines
2.0 KiB
Plaintext
37 lines
2.0 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/prefix.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/prefix.carbon
|
|
|
|
var n: i8 = -n;
|
|
var b: bool = not true;
|
|
|
|
// CHECK:STDOUT: - filename: prefix.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'n'},
|
|
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
|
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
|
|
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'n'},
|
|
// CHECK:STDOUT: {kind: 'PrefixOperatorMinus', text: '-', subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
|
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
|
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'},
|
|
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
|
|
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
|
|
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
|
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
|
// CHECK:STDOUT: {kind: 'PrefixOperatorNot', text: 'not', subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|