Fixed type cast issue!

pull/185/head
Ben Sobel 2020-07-22 21:16:50 +07:00
parent 5f085080e8
commit a50a2ccbf6
8 changed files with 70086 additions and 66815 deletions

@ -20,8 +20,9 @@ const DART_PREC = {
Bitwise_AND: 12, // & Left
Bitwise_XOR: 11, // ˆ Left
Bitwise_Or: 10, // | Left
RelationalTypeCast: 9, // <, >, <=, >=, as, is, is! None 8
RelationalTypeTest: 9,
Relational: 8, // <, >, <=, >=, as, is, is! None 8
RelationalTypeCast: 19, // <, >, <=, >=, as, is, is! None 8
Equality: 7, // ==, != None 7
Logical_AND: 6, // AND && Left
Logical_OR: 5, // Or || Left
@ -108,10 +109,10 @@ module.exports = grammar({
[$.declaration, $._external_and_static],
[$.method_signature, $._static_or_covariant],
[$.constructor_signature, $._formal_parameter_part],
[$._type_not_function, $._type_not_void],
// [$._type_not_function, $._type_not_void],
[$._cascade_subsection],
[$._expression],
[$._real_expression, $._below_relational_expression],
// [$._real_expression, $._below_relational_expression],
[$._postfix_expression],
[$._top_level_definition, $.lambda_expression],
[$._top_level_definition, $._final_const_var_or_type],
@ -129,26 +130,28 @@ module.exports = grammar({
[$.assignable_selector_part, $.postfix_expression],
[$._primary, $.assignable_expression],
[$._simple_formal_parameter, $.assignable_expression],
[$._type_name, $._primary, $.assignable_expression],
// [$._type_name, $._primary, $.assignable_expression],
[$.assignable_expression, $.postfix_expression],
[$.assignable_expression, $._postfix_expression],
[$._type_name, $.assignable_expression],
[$._type_name, $.function_signature],
// [$._type_name, $.assignable_expression],
// [$._type_name, $.function_signature],
[$._type_name, $._function_formal_parameter],
[$._type_name],
// [$.assignment_expression, $._expression],
[$.assignable_expression],
[$.method_signature, $.declaration, $._static_or_covariant],
// [$._type_args],
[$.type_arguments],
[$._primary, $._type_name, $.assignable_expression],
[$._primary, $._type_name, $.assignable_expression, $.function_signature],
[$._primary, $._type_name, $.assignable_expression, $._function_formal_parameter],
[$.relational_operator, $._shift_operator],
[$._type_name, $.function_signature],
// [$.relational_operator, $._shift_operator],
[$.relational_expression],
// [$.type_expression],
// [$._real_expression, $._below_relational_type_cast_expression],
// [$._below_relational_expression, $._below_relational_type_cast_expression],
[$.factory_constructor_signature, $.redirecting_factory_constructor_signature],
[$._function_type_tail]
[$._function_type_tail],
[$._type_not_void_not_function, $._function_type_tail],
[$._type_not_void],
[$._type_not_void_not_function],
],
word: $ => $.identifier,
@ -196,16 +199,18 @@ module.exports = grammar({
$.function_body
),
seq(
optional($._type),
$._get,
$.identifier,
$.getter_signature,
// optional($._type),
// $._get,
// $.identifier,
$.function_body
),
seq(
optional($._type),
$._set,
$.identifier,
$.formal_parameter_list,
$.setter_signature,
// optional($._type),
// $._set,
// $.identifier,
// $.formal_parameter_list,
$.function_body
),
@ -536,51 +541,52 @@ module.exports = grammar({
$.bitwise_or_expression,
$.bitwise_xor_expression,
$.shift_expression,
// $.type_cast_expression,
$.type_cast_expression,
$.type_test_expression,
$._unary_expression
),
_below_relational_expression: $ => choice(
// UNARY_POSTFIX: 16,
// UNARY_PREFIX: 15,
// Multiplicative: 14, // *, /, ˜/, % Left
// Additive: 13, // +, - Left
// Shift: 12, // <<, >>, >>> Left
// Bitwise_AND: 11, // & Left
// Bitwise_XOR: 10, // ˆ Left
// Bitwise_Or: 9 , // | Left
// $.type_cast_expression,
$._unary_expression,
$.multiplicative_expression,
$.additive_expression,
$.shift_expression,
$.bitwise_and_expression,
$.bitwise_or_expression,
$.bitwise_xor_expression,
),
_below_relational_type_cast_expression: $ => prec(
DART_PREC.RelationalTypeCast,
choice(
// UNARY_POSTFIX: 16,
// UNARY_PREFIX: 15,
// Multiplicative: 14, // *, /, ˜/, % Left
// Additive: 13, // +, - Left
// Shift: 12, // <<, >>, >>> Left
// Bitwise_AND: 11, // & Left
// Bitwise_XOR: 10, // ˆ Left
// Bitwise_Or: 9 , // | Left
$._unary_expression,
$.multiplicative_expression,
$.additive_expression,
$.shift_expression,
$.bitwise_and_expression,
$.bitwise_or_expression,
$.bitwise_xor_expression,
)
),
// _below_relational_expression: $ => choice(
// // UNARY_POSTFIX: 16,
// // UNARY_PREFIX: 15,
// // Multiplicative: 14, // *, /, ˜/, % Left
// // Additive: 13, // +, - Left
// // Shift: 12, // <<, >>, >>> Left
// // Bitwise_AND: 11, // & Left
// // Bitwise_XOR: 10, // ˆ Left
// // Bitwise_Or: 9 , // | Left
// // $.type_cast_expression,
// $._unary_expression,
// $.multiplicative_expression,
// $.additive_expression,
// $.shift_expression,
// $.bitwise_and_expression,
// $.bitwise_or_expression,
// $.bitwise_xor_expression,
//
// ),
//
// _below_relational_type_cast_expression: $ => prec(
// DART_PREC.RelationalTypeCast,
// choice(
// // UNARY_POSTFIX: 16,
// // UNARY_PREFIX: 15,
// // Multiplicative: 14, // *, /, ˜/, % Left
// // Additive: 13, // +, - Left
// // Shift: 12, // <<, >>, >>> Left
// // Bitwise_AND: 11, // & Left
// // Bitwise_XOR: 10, // ˆ Left
// // Bitwise_Or: 9 , // | Left
// $._unary_expression,
// $.multiplicative_expression,
// $.additive_expression,
// $.shift_expression,
// $.bitwise_and_expression,
// $.bitwise_or_expression,
// $.bitwise_xor_expression,
//
// )
// ),
throw_expression: $ => seq(
'throw',
@ -775,21 +781,30 @@ module.exports = grammar({
'!='
)
),
// type_cast_expression: $ => prec(
// DART_PREC.RelationalTypeCast,
type_cast_expression: $ => prec.left(
DART_PREC.RelationalTypeCast,
seq(
// $._below_relational_type_cast_expression,
$._real_expression,
$.type_cast,
)
),
type_test_expression: $ => prec(
DART_PREC.RelationalTypeTest,
seq(
// $._below_relational_type_cast_expression,
$._real_expression,
$.type_test,
)
),
// _raw_type_cast: $ => prec.right(
// seq(
// $._below_relational_type_cast_expression,
// $.type_cast,
// )
// ),
_raw_type_cast: $ => prec.right(
seq(
$._below_relational_type_cast_expression,
$.type_cast,
)
),
relational_expression: $ => prec.right( // neither
relational_expression: $ => prec( // neither
DART_PREC.Relational,
choice(
// $._raw_type_cast,
@ -801,14 +816,16 @@ module.exports = grammar({
// I am not certain this is what designers intended. (see other comments on github)
// optional(
$._real_expression,
choice(
$.type_test,
$.type_cast,
seq(
$.relational_operator,
$._real_expression
)
)
$.relational_operator,
$._real_expression
// choice(
// $.type_test,
// $.type_cast,
// seq(
// $.relational_operator,
// $._real_expression
// )
// )
// ),
),
// seq(
@ -832,20 +849,10 @@ module.exports = grammar({
),
relational_operator: $ => choice(
prec.dynamic(
DART_PREC.RelationalTypeCast,
$._open_arrow_builtin
),
$._close_arrow_builtin,
seq(
choice(
prec.dynamic(
DART_PREC.RelationalTypeCast,
$._open_arrow_builtin
),
$._close_arrow_builtin
),
'=')
'<',
'>',
'<=',
'>='
),
//BITWISE EXPRESSIONS
@ -863,19 +870,9 @@ module.exports = grammar({
),
shift_operator: $ => $._shift_operator,
_shift_operator: $ => choice(
seq(
$._open_arrow_builtin,
$._open_arrow_builtin
),
seq(
$._close_arrow_builtin,
$._close_arrow_builtin
),
seq(
$._close_arrow_builtin,
$._close_arrow_builtin,
$._close_arrow_builtin
),
'<<',
'>>',
'>>>'
),
additive_operator: $ => $._additive_operator,
_additive_operator: $ => token(
@ -1134,27 +1131,17 @@ module.exports = grammar({
seq('?.', $.identifier)
),
type_arguments: $ => $._type_args,
_type_args: $ => prec.left(
DART_PREC.TYPE_ARGUMENTS,
choice( // was prec.right
seq(
prec.dynamic(
DART_PREC.TYPE_ARGS,
$._open_arrow_builtin
),
$._close_arrow_builtin,
optional($._nullable_type)
),
seq(
prec.dynamic(
DART_PREC.TYPE_ARGS,
$._open_arrow_builtin
),
commaSep1($._type),
$._close_arrow_builtin,
optional($._nullable_type)
)
type_arguments: $ => choice( // was prec.right
// seq(
// '<',
// '>',
// optional($._nullable_type)
// ),
seq(
'<',
commaSep($._type),
'>',
// optional($._nullable_type)
)
),
@ -1591,7 +1578,7 @@ module.exports = grammar({
type_parameters: $ => seq(
$._open_arrow_builtin, commaSep1($.type_parameter), $._close_arrow_builtin
'<', commaSep1($.type_parameter), '>'
),
type_parameter: $ => seq(
@ -1991,12 +1978,17 @@ module.exports = grammar({
),
_type: $ => choice(
$._function_type_tails,
seq(
$._type_not_function,
$._function_type_tails
$.function_type,
optional($._nullable_type)
),
$._type_not_function
// $._function_type_tails,
// seq(
// $._type_not_function,
// $._function_type_tails
// ),
// $._type_not_function
// $._unannotated_type,
// $.annotated_type
),
@ -2004,22 +1996,24 @@ module.exports = grammar({
$._type_not_void_not_function,
$.void_type
),
_type_not_void_not_function: $ => prec.right(
_type_not_void_not_function: $ => choice(
seq(
$._type_name,
optional($._nullable_type),
optional($.type_arguments),
optional($._nullable_type)
),
// rewritten in accordance with the draft spec page 198
seq(
$._function_builtin_identifier,
optional($._nullable_type)
)
),
function_type: $ => prec.right(
choice(
$._function_type_tails,
seq(
$._type_not_function,
$._function_type_tails
)
function_type: $ => choice(
$._function_type_tails,
seq(
$._type_not_function,
$._function_type_tails
)
),
_function_type_tails: $ => repeat1($._function_type_tail),
@ -2068,7 +2062,11 @@ module.exports = grammar({
),
_type_not_void: $ => choice(
$.function_type,
seq(
$.function_type,
optional($._nullable_type)
),
// $.function_type,
$._type_not_void_not_function
// alias($.identifier, $.type_identifier),
// // $.scoped_type_identifier,
@ -2087,9 +2085,22 @@ module.exports = grammar({
optional(
$._type_dot_identifier
),
optional($._nullable_type),
// optional($._nullable_type),
),
// _type_name: $ => prec.right( // changed from above?
// seq(
// alias(
// $.identifier,
// $.type_identifier
// ),
// optional(
// $._type_dot_identifier
// ),
// optional($._nullable_type),
// )
// ),
_type_dot_identifier: $ => prec.right(
DART_PREC.IMPORT_EXPORT,
seq(
@ -2117,10 +2128,7 @@ module.exports = grammar({
'bool',
),
void_type: $ => prec(
DART_PREC.BUILTIN,
'void',
),
void_type: $ => token('void'),
inferred_type: $ => prec(
DART_PREC.BUILTIN,
@ -2146,10 +2154,7 @@ module.exports = grammar({
function_body: $ => choice(
seq(
optional('async'),
seq(
'=',
$._close_arrow_builtin
),
'=>',
$._expression,
$._semicolon
),
@ -2165,10 +2170,7 @@ module.exports = grammar({
function_expression_body: $ => choice(
seq(
optional('async'),
seq(
'=',
$._close_arrow_builtin
),
'=>',
$._expression
),
seq(
@ -2465,12 +2467,12 @@ module.exports = grammar({
DART_PREC.BUILTIN,
'external',
),
_open_arrow_builtin: $ => token(
'<'
),
_close_arrow_builtin: $ => token(
'>'
),
// _open_arrow_builtin: $ => token(
// '<'
// ),
// _close_arrow_builtin: $ => token(
// '>'
// ),
// _try: $ => prec(
// DART_PREC.TRY,
// token.immediate('try')

@ -201,25 +201,9 @@
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_type"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_get"
},
{
"type": "SYMBOL",
"name": "identifier"
"name": "getter_signature"
},
{
"type": "SYMBOL",
@ -230,29 +214,9 @@
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_type"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_set"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "formal_parameter_list"
"name": "setter_signature"
},
{
"type": "SYMBOL",
@ -1796,80 +1760,18 @@
},
{
"type": "SYMBOL",
"name": "_unary_expression"
}
]
},
"_below_relational_expression": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_unary_expression"
},
{
"type": "SYMBOL",
"name": "multiplicative_expression"
},
{
"type": "SYMBOL",
"name": "additive_expression"
},
{
"type": "SYMBOL",
"name": "shift_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_and_expression"
"name": "type_cast_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_or_expression"
"name": "type_test_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_xor_expression"
"name": "_unary_expression"
}
]
},
"_below_relational_type_cast_expression": {
"type": "PREC",
"value": 19,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_unary_expression"
},
{
"type": "SYMBOL",
"name": "multiplicative_expression"
},
{
"type": "SYMBOL",
"name": "additive_expression"
},
{
"type": "SYMBOL",
"name": "shift_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_and_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_or_expression"
},
{
"type": "SYMBOL",
"name": "bitwise_xor_expression"
}
]
}
},
"throw_expression": {
"type": "SEQ",
"members": [
@ -2349,15 +2251,15 @@
]
}
},
"_raw_type_cast": {
"type": "PREC_RIGHT",
"value": 0,
"type_cast_expression": {
"type": "PREC_LEFT",
"value": 9,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_below_relational_type_cast_expression"
"name": "_real_expression"
},
{
"type": "SYMBOL",
@ -2366,8 +2268,25 @@
]
}
},
"type_test_expression": {
"type": "PREC",
"value": 9,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_real_expression"
},
{
"type": "SYMBOL",
"name": "type_test"
}
]
}
},
"relational_expression": {
"type": "PREC_RIGHT",
"type": "PREC",
"value": 8,
"content": {
"type": "CHOICE",
@ -2380,30 +2299,12 @@
"name": "_real_expression"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "type_test"
},
{
"type": "SYMBOL",
"name": "type_cast"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "relational_operator"
},
{
"type": "SYMBOL",
"name": "_real_expression"
}
]
}
]
"type": "SYMBOL",
"name": "relational_operator"
},
{
"type": "SYMBOL",
"name": "_real_expression"
}
]
},
@ -2431,42 +2332,20 @@
"type": "CHOICE",
"members": [
{
"type": "PREC_DYNAMIC",
"value": 19,
"content": {
"type": "SYMBOL",
"name": "_open_arrow_builtin"
}
"type": "STRING",
"value": "<"
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
"type": "STRING",
"value": ">"
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "PREC_DYNAMIC",
"value": 19,
"content": {
"type": "SYMBOL",
"name": "_open_arrow_builtin"
}
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
}
]
},
{
"type": "STRING",
"value": "="
}
]
"type": "STRING",
"value": "<="
},
{
"type": "STRING",
"value": ">="
}
]
},
@ -2853,47 +2732,16 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_open_arrow_builtin"
},
{
"type": "SYMBOL",
"name": "_open_arrow_builtin"
}
]
"type": "STRING",
"value": "<<"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
}
]
"type": "STRING",
"value": ">>"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
}
]
"type": "STRING",
"value": ">>>"
}
]
},
@ -3786,100 +3634,55 @@
]
},
"type_arguments": {
"type": "SYMBOL",
"name": "_type_args"
},
"_type_args": {
"type": "PREC_LEFT",
"value": 13,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "PREC_DYNAMIC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "_open_arrow_builtin"
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_type"
}
]
}
}
]
},
{
"type": "BLANK"
}
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "PREC_DYNAMIC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "_open_arrow_builtin"
}
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_type"
}
]
}
}
]
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
}
]
}
]
},
{
"type": "STRING",
"value": ">"
}
]
}
]
},
"wildcard": {
"type": "SEQ",
@ -5882,8 +5685,8 @@
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_open_arrow_builtin"
"type": "STRING",
"value": "<"
},
{
"type": "SEQ",
@ -5911,8 +5714,8 @@
]
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
"type": "STRING",
"value": ">"
}
]
},
@ -7820,20 +7623,24 @@
"_type": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_function_type_tails"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type_not_function"
"name": "function_type"
},
{
"type": "SYMBOL",
"name": "_function_type_tails"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
},
@ -7857,79 +7664,85 @@
]
},
"_type_not_void_not_function": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "type_arguments"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "type_arguments"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_function_builtin_identifier"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
}
]
},
"function_type": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_function_type_tails"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type_not_function"
},
{
"type": "SYMBOL",
"name": "_function_type_tails"
}
]
}
]
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_function_type_tails"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type_not_function"
},
{
"type": "SYMBOL",
"name": "_function_type_tails"
}
]
}
]
},
"_function_type_tails": {
"type": "REPEAT1",
@ -8230,8 +8043,25 @@
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "function_type"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "function_type"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
@ -8287,18 +8117,6 @@
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_nullable_type"
},
{
"type": "BLANK"
}
]
}
]
},
@ -8361,8 +8179,7 @@
}
},
"void_type": {
"type": "PREC",
"value": 0,
"type": "TOKEN",
"content": {
"type": "STRING",
"value": "void"
@ -8494,17 +8311,8 @@
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
}
]
"type": "STRING",
"value": "=>"
},
{
"type": "SYMBOL",
@ -8571,17 +8379,8 @@
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "SYMBOL",
"name": "_close_arrow_builtin"
}
]
"type": "STRING",
"value": "=>"
},
{
"type": "SYMBOL",
@ -9664,20 +9463,6 @@
"value": "external"
}
},
"_open_arrow_builtin": {
"type": "TOKEN",
"content": {
"type": "STRING",
"value": "<"
}
},
"_close_arrow_builtin": {
"type": "TOKEN",
"content": {
"type": "STRING",
"value": ">"
}
},
"this": {
"type": "PREC",
"value": 0,
@ -9867,20 +9652,12 @@
"constructor_signature",
"_formal_parameter_part"
],
[
"_type_not_function",
"_type_not_void"
],
[
"_cascade_subsection"
],
[
"_expression"
],
[
"_real_expression",
"_below_relational_expression"
],
[
"_postfix_expression"
],
@ -9947,11 +9724,6 @@
"_simple_formal_parameter",
"assignable_expression"
],
[
"_type_name",
"_primary",
"assignable_expression"
],
[
"assignable_expression",
"postfix_expression"
@ -9960,14 +9732,6 @@
"assignable_expression",
"_postfix_expression"
],
[
"_type_name",
"assignable_expression"
],
[
"_type_name",
"function_signature"
],
[
"_type_name",
"_function_formal_parameter"
@ -9983,6 +9747,14 @@
"declaration",
"_static_or_covariant"
],
[
"type_arguments"
],
[
"_primary",
"_type_name",
"assignable_expression"
],
[
"_primary",
"_type_name",
@ -9996,8 +9768,8 @@
"_function_formal_parameter"
],
[
"relational_operator",
"_shift_operator"
"_type_name",
"function_signature"
],
[
"relational_expression"
@ -10008,6 +9780,16 @@
],
[
"_function_type_tail"
],
[
"_type_not_void_not_function",
"_function_type_tail"
],
[
"_type_not_void"
],
[
"_type_not_void_not_function"
]
],
"externals": [

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -25,11 +25,11 @@ get a => 'Also a string';
---
(program
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal (escape_sequence)))
(identifier) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(identifier) (function_body (string_literal (template_substitution (identifier))))
(identifier) (function_body (string_literal)))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal (escape_sequence)))
(getter_signature (identifier)) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(getter_signature (identifier)) (function_body (string_literal (template_substitution (identifier))))
(getter_signature (identifier)) (function_body (string_literal)))
=========================================
dart string literals 2
@ -45,11 +45,11 @@ get a => '''Also a string''';
---
(program
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal (escape_sequence)))
(identifier) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal)))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal (escape_sequence)))
(getter_signature (identifier)) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal)))
=========================================
dart string literals raw
=========================================
@ -64,11 +64,11 @@ get a => r'''Also a string''';
---
(program
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(identifier) (function_body (string_literal))
(identifier) (function_body (string_literal)))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal (template_substitution (identifier_dollar_escaped))))
(getter_signature (identifier)) (function_body (string_literal))
(getter_signature (identifier)) (function_body (string_literal)))
==================================================

@ -476,8 +476,12 @@ void callback(Future<void> Function(String?) handler) {
(program
(function_signature (void_type) (identifier)
(formal_parameter_list (formal_parameter (type_identifier) (type_arguments (void_type))
(parameter_type_list (normal_parameter_type (type_identifier))) (identifier))))
(formal_parameter_list
(formal_parameter
(function_type
(type_identifier)
(type_arguments (void_type))
(parameter_type_list (normal_parameter_type (type_identifier)))) (identifier))))
(function_body (block)))
==================================
@ -570,6 +574,49 @@ class MyClass {
---
==================================
Get and set methods (functional?)
==================================
String get myGetterName => 'A string hello';
class MyClass {
void set myValue(String name, Object value) {}
}
---
(program
(getter_signature (type_identifier) (identifier))
(function_body (string_literal))
(class_definition (identifier)
(class_body
(method_signature
(setter_signature (void_type) (identifier)
(formal_parameter_list (formal_parameter (type_identifier) (identifier))
(formal_parameter (type_identifier) (identifier)))))
(function_body (block)))))
==================================
void types
==================================
class MyClass {
void mySet(String name, Object value) {}
}
---
(program
(class_definition (identifier)
(class_body
(method_signature
(function_signature (void_type) (identifier)
(formal_parameter_list (formal_parameter (type_identifier) (identifier))
(formal_parameter (type_identifier) (identifier)))))
(function_body (block)))))
==================================
external factories
==================================
@ -587,4 +634,4 @@ class LinkedHashMap {
(class_definition (identifier)
(class_body
(declaration (factory_constructor_signature (identifier) (formal_parameter_list)))
(declaration (factory_constructor_signature (identifier) (identifier) (formal_parameter_list))))))
(declaration (factory_constructor_signature (identifier) (identifier) (formal_parameter_list))))))

@ -71,13 +71,13 @@ c is C;
---
(program
(expression_statement
(relational_expression
(type_test_expression
(identifier)
(type_test (is_operator) (type_identifier) (type_identifier))
)
)
(expression_statement
(relational_expression
(type_test_expression
(identifier)
(type_test (is_operator) (type_identifier)
(type_arguments (type_identifier))
@ -85,7 +85,7 @@ c is C;
)
)
(expression_statement
(relational_expression
(type_test_expression
(identifier)
(type_test (is_operator) (type_identifier))
)
@ -375,7 +375,7 @@ if (data['frame_count'] as int < 5) {
(if_statement
(parenthesized_expression
(relational_expression
(relational_expression
(type_cast_expression
(identifier) (selector
(assignable_selector (unconditional_assignable_selector (string_literal)))
)
@ -405,7 +405,7 @@ if ((data['frame_count'] as int) < 5) {
(if_statement
(parenthesized_expression
(relational_expression
(relational_expression
(type_cast_expression
(identifier) (selector
(assignable_selector (unconditional_assignable_selector (string_literal)))
)
@ -527,7 +527,7 @@ printStream(args['json'] as bool ? '' : 'hi');
(argument_part
(arguments
(conditional_expression
(relational_expression (identifier)
(type_cast_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier))
)
@ -555,7 +555,7 @@ printStream((args['json'] as bool) ? '' : 'hi');
(argument_part
(arguments
(conditional_expression
(relational_expression (identifier)
(type_cast_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier))
)
@ -585,35 +585,37 @@ a as BigB | b as BigB;
---
(program
(expression_statement
(relational_expression (relational_expression
(identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier))) (relational_operator) (identifier))
)
(program
(expression_statement
(relational_expression
(type_cast_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier)))
(relational_operator)
(identifier)))
(expression_statement
(relational_expression (identifier) (relational_operator)
(identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))) (type_cast (as_operator) (type_identifier))
))
(expression_statement (equality_expression (identifier) (equality_operator) (relational_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(expression_statement (relational_expression (relational_expression (identifier) (type_cast (as_operator) (type_identifier))) (relational_operator) (identifier)))
(type_cast_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier)))))
(expression_statement (equality_expression (identifier) (equality_operator) (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(expression_statement (relational_expression (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier))) (relational_operator) (identifier)))
(expression_statement (relational_expression (identifier) (relational_operator) (identifier)))
(expression_statement (equality_expression (relational_expression (identifier) (type_cast (as_operator) (type_identifier))) (equality_operator) (identifier)))
(expression_statement (logical_and_expression (identifier) (relational_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(expression_statement (logical_or_expression (relational_expression (identifier) (type_cast (as_operator) (type_identifier))) (relational_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(expression_statement (equality_expression (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier))) (equality_operator) (identifier)))
(expression_statement (logical_and_expression (identifier) (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(expression_statement (logical_or_expression (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier))) (type_cast_expression (identifier) (type_cast (as_operator) (type_identifier)))))
(if_statement
(parenthesized_expression
(relational_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier)) (relational_operator)
(relational_expression (identifier) (type_cast (as_operator) (type_identifier))))) (block))
(expression_statement (bitwise_or_expression (relational_expression (identifier) (type_cast (as_operator) (type_identifier))) (relational_expression (identifier) (type_cast (as_operator) (type_identifier)))))
)
(relational_expression
(type_cast_expression (identifier)
(selector (assignable_selector (unconditional_assignable_selector (string_literal))))
(type_cast (as_operator) (type_identifier)))
(relational_operator)
(type_cast_expression (identifier) (type_cast (as_operator) (type_identifier))))) (block))
(expression_statement
(bitwise_or_expression
(type_cast_expression (identifier) (type_cast (as_operator) (type_identifier)))
(type_cast_expression (identifier) (type_cast (as_operator) (type_identifier))))))

@ -92,7 +92,9 @@ var a;
---
(program (identifier)
(program
(getter_signature (identifier))
(function_body
(block
(local_variable_declaration (initialized_variable_definition (inferred_type) name: (identifier)))