[torque] Add local const bindings
This CL adds local const bindings. This means that instead of generating TVARIABLEs for variables, we can generate simple TNodes. Example: macro FooBar(): { const kSomeSmi: Smi = 10; ... } This CL also enforces that variables with a constexpr type are bound using 'const' and not 'let'. R=tebbi@chromium.org Bug: v8:7793 Change-Id: Id20a18149df9fc374ce718bdb1478e3eabb6e6df Reviewed-on: https://chromium-review.googlesource.com/1138316 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54479}
This commit is contained in:
parent
aab1d29d82
commit
b95def3488
@ -31,6 +31,7 @@ TAIL: 'tail';
|
|||||||
ISNT: 'isnt';
|
ISNT: 'isnt';
|
||||||
IS: 'is';
|
IS: 'is';
|
||||||
LET: 'let';
|
LET: 'let';
|
||||||
|
CONST: 'const';
|
||||||
EXTERN: 'extern';
|
EXTERN: 'extern';
|
||||||
ASSERT_TOKEN: 'assert';
|
ASSERT_TOKEN: 'assert';
|
||||||
CHECK_TOKEN: 'check';
|
CHECK_TOKEN: 'check';
|
||||||
@ -227,7 +228,7 @@ argumentList: '(' argument? (',' argument)* ')';
|
|||||||
helperCall: (MIN | MAX | IDENTIFIER) genericSpecializationTypeList? argumentList optionalOtherwise;
|
helperCall: (MIN | MAX | IDENTIFIER) genericSpecializationTypeList? argumentList optionalOtherwise;
|
||||||
|
|
||||||
labelReference: IDENTIFIER;
|
labelReference: IDENTIFIER;
|
||||||
variableDeclaration: LET IDENTIFIER ':' type;
|
variableDeclaration: (LET | CONST) IDENTIFIER ':' type;
|
||||||
variableDeclarationWithInitialization: variableDeclaration (ASSIGNMENT expression)?;
|
variableDeclarationWithInitialization: variableDeclaration (ASSIGNMENT expression)?;
|
||||||
helperCallStatement: (TAIL)? helperCall;
|
helperCallStatement: (TAIL)? helperCall;
|
||||||
expressionStatement: assignment;
|
expressionStatement: assignment;
|
||||||
@ -277,8 +278,8 @@ externalRuntime : EXTERN RUNTIME IDENTIFIER typeListMaybeVarArgs optionalType ';
|
|||||||
builtinDeclaration : JAVASCRIPT? BUILTIN IDENTIFIER optionalGenericTypeList parameterList optionalType (helperBody | ';');
|
builtinDeclaration : JAVASCRIPT? BUILTIN IDENTIFIER optionalGenericTypeList parameterList optionalType (helperBody | ';');
|
||||||
genericSpecialization: IDENTIFIER genericSpecializationTypeList parameterList optionalType optionalLabelList helperBody;
|
genericSpecialization: IDENTIFIER genericSpecializationTypeList parameterList optionalType optionalLabelList helperBody;
|
||||||
macroDeclaration : ('operator' STRING_LITERAL)? MACRO IDENTIFIER optionalGenericTypeList parameterList optionalType optionalLabelList (helperBody | ';');
|
macroDeclaration : ('operator' STRING_LITERAL)? MACRO IDENTIFIER optionalGenericTypeList parameterList optionalType optionalLabelList (helperBody | ';');
|
||||||
externConstDeclaration : 'const' IDENTIFIER ':' type generatesDeclaration ';';
|
externConstDeclaration : CONST IDENTIFIER ':' type generatesDeclaration ';';
|
||||||
constDeclaration: 'const' IDENTIFIER ':' type ASSIGNMENT expression ';';
|
constDeclaration: CONST IDENTIFIER ':' type ASSIGNMENT expression ';';
|
||||||
|
|
||||||
declaration
|
declaration
|
||||||
: typeDeclaration
|
: typeDeclaration
|
||||||
|
@ -69,7 +69,6 @@ std::vector<std::string> TorqueLexer::_ruleNames = {u8"T__0",
|
|||||||
u8"T__17",
|
u8"T__17",
|
||||||
u8"T__18",
|
u8"T__18",
|
||||||
u8"T__19",
|
u8"T__19",
|
||||||
u8"T__20",
|
|
||||||
u8"MACRO",
|
u8"MACRO",
|
||||||
u8"BUILTIN",
|
u8"BUILTIN",
|
||||||
u8"RUNTIME",
|
u8"RUNTIME",
|
||||||
@ -92,6 +91,7 @@ std::vector<std::string> TorqueLexer::_ruleNames = {u8"T__0",
|
|||||||
u8"ISNT",
|
u8"ISNT",
|
||||||
u8"IS",
|
u8"IS",
|
||||||
u8"LET",
|
u8"LET",
|
||||||
|
u8"CONST",
|
||||||
u8"EXTERN",
|
u8"EXTERN",
|
||||||
u8"ASSERT_TOKEN",
|
u8"ASSERT_TOKEN",
|
||||||
u8"CHECK_TOKEN",
|
u8"CHECK_TOKEN",
|
||||||
@ -160,7 +160,6 @@ std::vector<std::string> TorqueLexer::_literalNames = {"",
|
|||||||
u8"'extends'",
|
u8"'extends'",
|
||||||
u8"'generates'",
|
u8"'generates'",
|
||||||
u8"'operator'",
|
u8"'operator'",
|
||||||
u8"'const'",
|
|
||||||
u8"'macro'",
|
u8"'macro'",
|
||||||
u8"'builtin'",
|
u8"'builtin'",
|
||||||
u8"'runtime'",
|
u8"'runtime'",
|
||||||
@ -183,6 +182,7 @@ std::vector<std::string> TorqueLexer::_literalNames = {"",
|
|||||||
u8"'isnt'",
|
u8"'isnt'",
|
||||||
u8"'is'",
|
u8"'is'",
|
||||||
u8"'let'",
|
u8"'let'",
|
||||||
|
u8"'const'",
|
||||||
u8"'extern'",
|
u8"'extern'",
|
||||||
u8"'assert'",
|
u8"'assert'",
|
||||||
u8"'check'",
|
u8"'check'",
|
||||||
@ -237,7 +237,6 @@ std::vector<std::string> TorqueLexer::_symbolicNames = {
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
u8"MACRO",
|
u8"MACRO",
|
||||||
u8"BUILTIN",
|
u8"BUILTIN",
|
||||||
u8"RUNTIME",
|
u8"RUNTIME",
|
||||||
@ -260,6 +259,7 @@ std::vector<std::string> TorqueLexer::_symbolicNames = {
|
|||||||
u8"ISNT",
|
u8"ISNT",
|
||||||
u8"IS",
|
u8"IS",
|
||||||
u8"LET",
|
u8"LET",
|
||||||
|
u8"CONST",
|
||||||
u8"EXTERN",
|
u8"EXTERN",
|
||||||
u8"ASSERT_TOKEN",
|
u8"ASSERT_TOKEN",
|
||||||
u8"CHECK_TOKEN",
|
u8"CHECK_TOKEN",
|
||||||
@ -376,36 +376,36 @@ TorqueLexer::Initializer::Initializer() {
|
|||||||
0x3, 0x15, 0x3, 0x15, 0x3, 0x15, 0x3, 0x16, 0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3, 0x21, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3,
|
||||||
0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x23, 0x3, 0x23,
|
0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x23, 0x3, 0x23,
|
||||||
0x3, 0x23, 0x3, 0x23, 0x3, 0x23, 0x3, 0x23, 0x3,
|
0x3, 0x23, 0x3, 0x23, 0x3, 0x23, 0x3, 0x24, 0x3,
|
||||||
0x24, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24,
|
0x24, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24,
|
||||||
0x3, 0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x25, 0x3,
|
0x3, 0x24, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24, 0x3,
|
||||||
0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x25,
|
0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x26,
|
||||||
0x3, 0x25, 0x3, 0x26, 0x3, 0x26, 0x3, 0x26, 0x3,
|
0x3, 0x26, 0x3, 0x26, 0x3, 0x26, 0x3, 0x26, 0x3,
|
||||||
0x26, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27,
|
0x26, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27,
|
||||||
0x3, 0x27, 0x3, 0x27, 0x3, 0x28, 0x3, 0x28, 0x3,
|
0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x28, 0x3,
|
||||||
0x28, 0x3, 0x28, 0x3, 0x28, 0x3, 0x28, 0x3, 0x28,
|
0x28, 0x3, 0x28, 0x3, 0x28, 0x3, 0x28, 0x3, 0x29,
|
||||||
0x3, 0x29, 0x3, 0x29, 0x3, 0x29, 0x3, 0x29, 0x3,
|
0x3, 0x29, 0x3, 0x29, 0x3, 0x29, 0x3, 0x29, 0x3,
|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, 0x10e, 0x3,
|
0x31, 0x108, 0x3, 0x2, 0x2, 0x2, 0x33, 0x10f, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x35, 0x115, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x35, 0x11a, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x37, 0x120, 0x3, 0x2, 0x2, 0x2, 0x39, 0x129, 0x3,
|
0x37, 0x123, 0x3, 0x2, 0x2, 0x2, 0x39, 0x126, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x3b, 0x12c, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x3b, 0x12a, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x3d, 0x130, 0x3, 0x2, 0x2, 0x2, 0x3f, 0x136, 0x3,
|
0x3d, 0x130, 0x3, 0x2, 0x2, 0x2, 0x3f, 0x137, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x41, 0x13d, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x41, 0x141, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x43, 0x147, 0x3, 0x2, 0x2, 0x2, 0x45, 0x150, 0x3,
|
0x43, 0x14a, 0x3, 0x2, 0x2, 0x2, 0x45, 0x150, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x47, 0x156, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x47, 0x155, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x49, 0x15b, 0x3, 0x2, 0x2, 0x2, 0x4b, 0x165, 0x3,
|
0x49, 0x15f, 0x3, 0x2, 0x2, 0x2, 0x4b, 0x163, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x4d, 0x169, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x4d, 0x169, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x4f, 0x16f, 0x3, 0x2, 0x2, 0x2, 0x51, 0x176, 0x3,
|
0x4f, 0x170, 0x3, 0x2, 0x2, 0x2, 0x51, 0x175, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x53, 0x17b, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x53, 0x17a, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x55, 0x180, 0x3, 0x2, 0x2, 0x2, 0x57, 0x183, 0x3,
|
0x55, 0x17d, 0x3, 0x2, 0x2, 0x2, 0x57, 0x181, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x59, 0x187, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x59, 0x187, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x5b, 0x18e, 0x3, 0x2, 0x2, 0x2, 0x5d, 0x195, 0x3,
|
0x5b, 0x18e, 0x3, 0x2, 0x2, 0x2, 0x5d, 0x195, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x5f, 0x19b, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x5f, 0x19b, 0x3, 0x2, 0x2, 0x2,
|
||||||
@ -656,104 +656,104 @@ TorqueLexer::Initializer::Initializer() {
|
|||||||
0x63, 0x2, 0x2, 0xee, 0xef, 0x7, 0x76, 0x2, 0x2,
|
0x63, 0x2, 0x2, 0xee, 0xef, 0x7, 0x76, 0x2, 0x2,
|
||||||
0xef, 0xf0, 0x7, 0x71, 0x2, 0x2, 0xf0, 0xf1, 0x7,
|
0xef, 0xf0, 0x7, 0x71, 0x2, 0x2, 0xf0, 0xf1, 0x7,
|
||||||
0x74, 0x2, 0x2, 0xf1, 0x2a, 0x3, 0x2, 0x2, 0x2,
|
0x74, 0x2, 0x2, 0xf1, 0x2a, 0x3, 0x2, 0x2, 0x2,
|
||||||
0xf2, 0xf3, 0x7, 0x65, 0x2, 0x2, 0xf3, 0xf4, 0x7,
|
0xf2, 0xf3, 0x7, 0x6f, 0x2, 0x2, 0xf3, 0xf4, 0x7,
|
||||||
0x71, 0x2, 0x2, 0xf4, 0xf5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0x104, 0x7, 0x6b, 0x2, 0x2,
|
0x70, 0x2, 0x2, 0x103, 0x104, 0x7, 0x76, 0x2, 0x2,
|
||||||
0x104, 0x105, 0x7, 0x70, 0x2, 0x2, 0x105, 0x30, 0x3,
|
0x104, 0x105, 0x7, 0x6b, 0x2, 0x2, 0x105, 0x106, 0x7,
|
||||||
0x2, 0x2, 0x2, 0x106, 0x107, 0x7, 0x74, 0x2, 0x2,
|
0x6f, 0x2, 0x2, 0x106, 0x107, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x107, 0x108, 0x7, 0x77, 0x2, 0x2, 0x108, 0x109, 0x7,
|
0x107, 0x30, 0x3, 0x2, 0x2, 0x2, 0x108, 0x109, 0x7,
|
||||||
0x70, 0x2, 0x2, 0x109, 0x10a, 0x7, 0x76, 0x2, 0x2,
|
0x6f, 0x2, 0x2, 0x109, 0x10a, 0x7, 0x71, 0x2, 0x2,
|
||||||
0x10a, 0x10b, 0x7, 0x6b, 0x2, 0x2, 0x10b, 0x10c, 0x7,
|
0x10a, 0x10b, 0x7, 0x66, 0x2, 0x2, 0x10b, 0x10c, 0x7,
|
||||||
0x6f, 0x2, 0x2, 0x10c, 0x10d, 0x7, 0x67, 0x2, 0x2,
|
0x77, 0x2, 0x2, 0x10c, 0x10d, 0x7, 0x6e, 0x2, 0x2,
|
||||||
0x10d, 0x32, 0x3, 0x2, 0x2, 0x2, 0x10e, 0x10f, 0x7,
|
0x10d, 0x10e, 0x7, 0x67, 0x2, 0x2, 0x10e, 0x32, 0x3,
|
||||||
0x6f, 0x2, 0x2, 0x10f, 0x110, 0x7, 0x71, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x10f, 0x110, 0x7, 0x6c, 0x2, 0x2,
|
||||||
0x110, 0x111, 0x7, 0x66, 0x2, 0x2, 0x111, 0x112, 0x7,
|
0x110, 0x111, 0x7, 0x63, 0x2, 0x2, 0x111, 0x112, 0x7,
|
||||||
0x77, 0x2, 0x2, 0x112, 0x113, 0x7, 0x6e, 0x2, 0x2,
|
0x78, 0x2, 0x2, 0x112, 0x113, 0x7, 0x63, 0x2, 0x2,
|
||||||
0x113, 0x114, 0x7, 0x67, 0x2, 0x2, 0x114, 0x34, 0x3,
|
0x113, 0x114, 0x7, 0x75, 0x2, 0x2, 0x114, 0x115, 0x7,
|
||||||
0x2, 0x2, 0x2, 0x115, 0x116, 0x7, 0x6c, 0x2, 0x2,
|
0x65, 0x2, 0x2, 0x115, 0x116, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x116, 0x117, 0x7, 0x63, 0x2, 0x2, 0x117, 0x118, 0x7,
|
0x116, 0x117, 0x7, 0x6b, 0x2, 0x2, 0x117, 0x118, 0x7,
|
||||||
0x78, 0x2, 0x2, 0x118, 0x119, 0x7, 0x63, 0x2, 0x2,
|
0x72, 0x2, 0x2, 0x118, 0x119, 0x7, 0x76, 0x2, 0x2,
|
||||||
0x119, 0x11a, 0x7, 0x75, 0x2, 0x2, 0x11a, 0x11b, 0x7,
|
0x119, 0x34, 0x3, 0x2, 0x2, 0x2, 0x11a, 0x11b, 0x7,
|
||||||
0x65, 0x2, 0x2, 0x11b, 0x11c, 0x7, 0x74, 0x2, 0x2,
|
0x66, 0x2, 0x2, 0x11b, 0x11c, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x11c, 0x11d, 0x7, 0x6b, 0x2, 0x2, 0x11d, 0x11e, 0x7,
|
0x11c, 0x11d, 0x7, 0x68, 0x2, 0x2, 0x11d, 0x11e, 0x7,
|
||||||
0x72, 0x2, 0x2, 0x11e, 0x11f, 0x7, 0x76, 0x2, 0x2,
|
0x67, 0x2, 0x2, 0x11e, 0x11f, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x11f, 0x36, 0x3, 0x2, 0x2, 0x2, 0x120, 0x121, 0x7,
|
0x11f, 0x120, 0x7, 0x74, 0x2, 0x2, 0x120, 0x121, 0x7,
|
||||||
0x66, 0x2, 0x2, 0x121, 0x122, 0x7, 0x67, 0x2, 0x2,
|
0x67, 0x2, 0x2, 0x121, 0x122, 0x7, 0x66, 0x2, 0x2,
|
||||||
0x122, 0x123, 0x7, 0x68, 0x2, 0x2, 0x123, 0x124, 0x7,
|
0x122, 0x36, 0x3, 0x2, 0x2, 0x2, 0x123, 0x124, 0x7,
|
||||||
0x67, 0x2, 0x2, 0x124, 0x125, 0x7, 0x74, 0x2, 0x2,
|
0x6b, 0x2, 0x2, 0x124, 0x125, 0x7, 0x68, 0x2, 0x2,
|
||||||
0x125, 0x126, 0x7, 0x74, 0x2, 0x2, 0x126, 0x127, 0x7,
|
0x125, 0x38, 0x3, 0x2, 0x2, 0x2, 0x126, 0x127, 0x7,
|
||||||
0x67, 0x2, 0x2, 0x127, 0x128, 0x7, 0x66, 0x2, 0x2,
|
0x68, 0x2, 0x2, 0x127, 0x128, 0x7, 0x71, 0x2, 0x2,
|
||||||
0x128, 0x38, 0x3, 0x2, 0x2, 0x2, 0x129, 0x12a, 0x7,
|
0x128, 0x129, 0x7, 0x74, 0x2, 0x2, 0x129, 0x3a, 0x3,
|
||||||
0x6b, 0x2, 0x2, 0x12a, 0x12b, 0x7, 0x68, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x12a, 0x12b, 0x7, 0x79, 0x2, 0x2,
|
||||||
0x12b, 0x3a, 0x3, 0x2, 0x2, 0x2, 0x12c, 0x12d, 0x7,
|
0x12b, 0x12c, 0x7, 0x6a, 0x2, 0x2, 0x12c, 0x12d, 0x7,
|
||||||
0x68, 0x2, 0x2, 0x12d, 0x12e, 0x7, 0x71, 0x2, 0x2,
|
0x6b, 0x2, 0x2, 0x12d, 0x12e, 0x7, 0x6e, 0x2, 0x2,
|
||||||
0x12e, 0x12f, 0x7, 0x74, 0x2, 0x2, 0x12f, 0x3c, 0x3,
|
0x12e, 0x12f, 0x7, 0x67, 0x2, 0x2, 0x12f, 0x3c, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x130, 0x131, 0x7, 0x79, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x130, 0x131, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x131, 0x132, 0x7, 0x6a, 0x2, 0x2, 0x132, 0x133, 0x7,
|
0x131, 0x132, 0x7, 0x67, 0x2, 0x2, 0x132, 0x133, 0x7,
|
||||||
0x6b, 0x2, 0x2, 0x133, 0x134, 0x7, 0x6e, 0x2, 0x2,
|
0x76, 0x2, 0x2, 0x133, 0x134, 0x7, 0x77, 0x2, 0x2,
|
||||||
0x134, 0x135, 0x7, 0x67, 0x2, 0x2, 0x135, 0x3e, 0x3,
|
0x134, 0x135, 0x7, 0x74, 0x2, 0x2, 0x135, 0x136, 0x7,
|
||||||
0x2, 0x2, 0x2, 0x136, 0x137, 0x7, 0x74, 0x2, 0x2,
|
0x70, 0x2, 0x2, 0x136, 0x3e, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x137, 0x138, 0x7, 0x67, 0x2, 0x2, 0x138, 0x139, 0x7,
|
0x137, 0x138, 0x7, 0x65, 0x2, 0x2, 0x138, 0x139, 0x7,
|
||||||
0x76, 0x2, 0x2, 0x139, 0x13a, 0x7, 0x77, 0x2, 0x2,
|
0x71, 0x2, 0x2, 0x139, 0x13a, 0x7, 0x70, 0x2, 0x2,
|
||||||
0x13a, 0x13b, 0x7, 0x74, 0x2, 0x2, 0x13b, 0x13c, 0x7,
|
0x13a, 0x13b, 0x7, 0x75, 0x2, 0x2, 0x13b, 0x13c, 0x7,
|
||||||
0x70, 0x2, 0x2, 0x13c, 0x40, 0x3, 0x2, 0x2, 0x2,
|
0x76, 0x2, 0x2, 0x13c, 0x13d, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x13d, 0x13e, 0x7, 0x65, 0x2, 0x2, 0x13e, 0x13f, 0x7,
|
0x13d, 0x13e, 0x7, 0x7a, 0x2, 0x2, 0x13e, 0x13f, 0x7,
|
||||||
0x71, 0x2, 0x2, 0x13f, 0x140, 0x7, 0x70, 0x2, 0x2,
|
0x72, 0x2, 0x2, 0x13f, 0x140, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x140, 0x141, 0x7, 0x75, 0x2, 0x2, 0x141, 0x142, 0x7,
|
0x140, 0x40, 0x3, 0x2, 0x2, 0x2, 0x141, 0x142, 0x7,
|
||||||
0x76, 0x2, 0x2, 0x142, 0x143, 0x7, 0x67, 0x2, 0x2,
|
0x65, 0x2, 0x2, 0x142, 0x143, 0x7, 0x71, 0x2, 0x2,
|
||||||
0x143, 0x144, 0x7, 0x7a, 0x2, 0x2, 0x144, 0x145, 0x7,
|
0x143, 0x144, 0x7, 0x70, 0x2, 0x2, 0x144, 0x145, 0x7,
|
||||||
0x72, 0x2, 0x2, 0x145, 0x146, 0x7, 0x74, 0x2, 0x2,
|
0x76, 0x2, 0x2, 0x145, 0x146, 0x7, 0x6b, 0x2, 0x2,
|
||||||
0x146, 0x42, 0x3, 0x2, 0x2, 0x2, 0x147, 0x148, 0x7,
|
0x146, 0x147, 0x7, 0x70, 0x2, 0x2, 0x147, 0x148, 0x7,
|
||||||
0x65, 0x2, 0x2, 0x148, 0x149, 0x7, 0x71, 0x2, 0x2,
|
0x77, 0x2, 0x2, 0x148, 0x149, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x149, 0x14a, 0x7, 0x70, 0x2, 0x2, 0x14a, 0x14b, 0x7,
|
0x149, 0x42, 0x3, 0x2, 0x2, 0x2, 0x14a, 0x14b, 0x7,
|
||||||
0x76, 0x2, 0x2, 0x14b, 0x14c, 0x7, 0x6b, 0x2, 0x2,
|
0x64, 0x2, 0x2, 0x14b, 0x14c, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x14c, 0x14d, 0x7, 0x70, 0x2, 0x2, 0x14d, 0x14e, 0x7,
|
0x14c, 0x14d, 0x7, 0x67, 0x2, 0x2, 0x14d, 0x14e, 0x7,
|
||||||
0x77, 0x2, 0x2, 0x14e, 0x14f, 0x7, 0x67, 0x2, 0x2,
|
0x63, 0x2, 0x2, 0x14e, 0x14f, 0x7, 0x6d, 0x2, 0x2,
|
||||||
0x14f, 0x44, 0x3, 0x2, 0x2, 0x2, 0x150, 0x151, 0x7,
|
0x14f, 0x44, 0x3, 0x2, 0x2, 0x2, 0x150, 0x151, 0x7,
|
||||||
0x64, 0x2, 0x2, 0x151, 0x152, 0x7, 0x74, 0x2, 0x2,
|
0x69, 0x2, 0x2, 0x151, 0x152, 0x7, 0x71, 0x2, 0x2,
|
||||||
0x152, 0x153, 0x7, 0x67, 0x2, 0x2, 0x153, 0x154, 0x7,
|
0x152, 0x153, 0x7, 0x76, 0x2, 0x2, 0x153, 0x154, 0x7,
|
||||||
0x63, 0x2, 0x2, 0x154, 0x155, 0x7, 0x6d, 0x2, 0x2,
|
0x71, 0x2, 0x2, 0x154, 0x46, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x155, 0x46, 0x3, 0x2, 0x2, 0x2, 0x156, 0x157, 0x7,
|
0x155, 0x156, 0x7, 0x71, 0x2, 0x2, 0x156, 0x157, 0x7,
|
||||||
0x69, 0x2, 0x2, 0x157, 0x158, 0x7, 0x71, 0x2, 0x2,
|
0x76, 0x2, 0x2, 0x157, 0x158, 0x7, 0x6a, 0x2, 0x2,
|
||||||
0x158, 0x159, 0x7, 0x76, 0x2, 0x2, 0x159, 0x15a, 0x7,
|
0x158, 0x159, 0x7, 0x67, 0x2, 0x2, 0x159, 0x15a, 0x7,
|
||||||
0x71, 0x2, 0x2, 0x15a, 0x48, 0x3, 0x2, 0x2, 0x2,
|
0x74, 0x2, 0x2, 0x15a, 0x15b, 0x7, 0x79, 0x2, 0x2,
|
||||||
0x15b, 0x15c, 0x7, 0x71, 0x2, 0x2, 0x15c, 0x15d, 0x7,
|
0x15b, 0x15c, 0x7, 0x6b, 0x2, 0x2, 0x15c, 0x15d, 0x7,
|
||||||
0x76, 0x2, 0x2, 0x15d, 0x15e, 0x7, 0x6a, 0x2, 0x2,
|
0x75, 0x2, 0x2, 0x15d, 0x15e, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x15e, 0x15f, 0x7, 0x67, 0x2, 0x2, 0x15f, 0x160, 0x7,
|
0x15e, 0x48, 0x3, 0x2, 0x2, 0x2, 0x15f, 0x160, 0x7,
|
||||||
0x74, 0x2, 0x2, 0x160, 0x161, 0x7, 0x79, 0x2, 0x2,
|
0x76, 0x2, 0x2, 0x160, 0x161, 0x7, 0x74, 0x2, 0x2,
|
||||||
0x161, 0x162, 0x7, 0x6b, 0x2, 0x2, 0x162, 0x163, 0x7,
|
0x161, 0x162, 0x7, 0x7b, 0x2, 0x2, 0x162, 0x4a, 0x3,
|
||||||
0x75, 0x2, 0x2, 0x163, 0x164, 0x7, 0x67, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x163, 0x164, 0x7, 0x6e, 0x2, 0x2,
|
||||||
0x164, 0x4a, 0x3, 0x2, 0x2, 0x2, 0x165, 0x166, 0x7,
|
0x164, 0x165, 0x7, 0x63, 0x2, 0x2, 0x165, 0x166, 0x7,
|
||||||
0x76, 0x2, 0x2, 0x166, 0x167, 0x7, 0x74, 0x2, 0x2,
|
0x64, 0x2, 0x2, 0x166, 0x167, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x167, 0x168, 0x7, 0x7b, 0x2, 0x2, 0x168, 0x4c, 0x3,
|
0x167, 0x168, 0x7, 0x6e, 0x2, 0x2, 0x168, 0x4c, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x169, 0x16a, 0x7, 0x6e, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x169, 0x16a, 0x7, 0x6e, 0x2, 0x2,
|
||||||
0x16a, 0x16b, 0x7, 0x63, 0x2, 0x2, 0x16b, 0x16c, 0x7,
|
0x16a, 0x16b, 0x7, 0x63, 0x2, 0x2, 0x16b, 0x16c, 0x7,
|
||||||
0x64, 0x2, 0x2, 0x16c, 0x16d, 0x7, 0x67, 0x2, 0x2,
|
0x64, 0x2, 0x2, 0x16c, 0x16d, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x16d, 0x16e, 0x7, 0x6e, 0x2, 0x2, 0x16e, 0x4e, 0x3,
|
0x16d, 0x16e, 0x7, 0x6e, 0x2, 0x2, 0x16e, 0x16f, 0x7,
|
||||||
0x2, 0x2, 0x2, 0x16f, 0x170, 0x7, 0x6e, 0x2, 0x2,
|
0x75, 0x2, 0x2, 0x16f, 0x4e, 0x3, 0x2, 0x2, 0x2,
|
||||||
0x170, 0x171, 0x7, 0x63, 0x2, 0x2, 0x171, 0x172, 0x7,
|
0x170, 0x171, 0x7, 0x76, 0x2, 0x2, 0x171, 0x172, 0x7,
|
||||||
0x64, 0x2, 0x2, 0x172, 0x173, 0x7, 0x67, 0x2, 0x2,
|
0x63, 0x2, 0x2, 0x172, 0x173, 0x7, 0x6b, 0x2, 0x2,
|
||||||
0x173, 0x174, 0x7, 0x6e, 0x2, 0x2, 0x174, 0x175, 0x7,
|
0x173, 0x174, 0x7, 0x6e, 0x2, 0x2, 0x174, 0x50, 0x3,
|
||||||
0x75, 0x2, 0x2, 0x175, 0x50, 0x3, 0x2, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x175, 0x176, 0x7, 0x6b, 0x2, 0x2,
|
||||||
0x176, 0x177, 0x7, 0x76, 0x2, 0x2, 0x177, 0x178, 0x7,
|
0x176, 0x177, 0x7, 0x75, 0x2, 0x2, 0x177, 0x178, 0x7,
|
||||||
0x63, 0x2, 0x2, 0x178, 0x179, 0x7, 0x6b, 0x2, 0x2,
|
0x70, 0x2, 0x2, 0x178, 0x179, 0x7, 0x76, 0x2, 0x2,
|
||||||
0x179, 0x17a, 0x7, 0x6e, 0x2, 0x2, 0x17a, 0x52, 0x3,
|
0x179, 0x52, 0x3, 0x2, 0x2, 0x2, 0x17a, 0x17b, 0x7,
|
||||||
0x2, 0x2, 0x2, 0x17b, 0x17c, 0x7, 0x6b, 0x2, 0x2,
|
0x6b, 0x2, 0x2, 0x17b, 0x17c, 0x7, 0x75, 0x2, 0x2,
|
||||||
0x17c, 0x17d, 0x7, 0x75, 0x2, 0x2, 0x17d, 0x17e, 0x7,
|
0x17c, 0x54, 0x3, 0x2, 0x2, 0x2, 0x17d, 0x17e, 0x7,
|
||||||
0x70, 0x2, 0x2, 0x17e, 0x17f, 0x7, 0x76, 0x2, 0x2,
|
0x6e, 0x2, 0x2, 0x17e, 0x17f, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x17f, 0x54, 0x3, 0x2, 0x2, 0x2, 0x180, 0x181, 0x7,
|
0x17f, 0x180, 0x7, 0x76, 0x2, 0x2, 0x180, 0x56, 0x3,
|
||||||
0x6b, 0x2, 0x2, 0x181, 0x182, 0x7, 0x75, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x181, 0x182, 0x7, 0x65, 0x2, 0x2,
|
||||||
0x182, 0x56, 0x3, 0x2, 0x2, 0x2, 0x183, 0x184, 0x7,
|
0x182, 0x183, 0x7, 0x71, 0x2, 0x2, 0x183, 0x184, 0x7,
|
||||||
0x6e, 0x2, 0x2, 0x184, 0x185, 0x7, 0x67, 0x2, 0x2,
|
0x70, 0x2, 0x2, 0x184, 0x185, 0x7, 0x75, 0x2, 0x2,
|
||||||
0x185, 0x186, 0x7, 0x76, 0x2, 0x2, 0x186, 0x58, 0x3,
|
0x185, 0x186, 0x7, 0x76, 0x2, 0x2, 0x186, 0x58, 0x3,
|
||||||
0x2, 0x2, 0x2, 0x187, 0x188, 0x7, 0x67, 0x2, 0x2,
|
0x2, 0x2, 0x2, 0x187, 0x188, 0x7, 0x67, 0x2, 0x2,
|
||||||
0x188, 0x189, 0x7, 0x7a, 0x2, 0x2, 0x189, 0x18a, 0x7,
|
0x188, 0x189, 0x7, 0x7a, 0x2, 0x2, 0x189, 0x18a, 0x7,
|
||||||
|
@ -33,29 +33,29 @@ class TorqueLexer : public antlr4::Lexer {
|
|||||||
T__17 = 18,
|
T__17 = 18,
|
||||||
T__18 = 19,
|
T__18 = 19,
|
||||||
T__19 = 20,
|
T__19 = 20,
|
||||||
T__20 = 21,
|
MACRO = 21,
|
||||||
MACRO = 22,
|
BUILTIN = 22,
|
||||||
BUILTIN = 23,
|
RUNTIME = 23,
|
||||||
RUNTIME = 24,
|
MODULE = 24,
|
||||||
MODULE = 25,
|
JAVASCRIPT = 25,
|
||||||
JAVASCRIPT = 26,
|
DEFERRED = 26,
|
||||||
DEFERRED = 27,
|
IF = 27,
|
||||||
IF = 28,
|
FOR = 28,
|
||||||
FOR = 29,
|
WHILE = 29,
|
||||||
WHILE = 30,
|
RETURN = 30,
|
||||||
RETURN = 31,
|
CONSTEXPR = 31,
|
||||||
CONSTEXPR = 32,
|
CONTINUE = 32,
|
||||||
CONTINUE = 33,
|
BREAK = 33,
|
||||||
BREAK = 34,
|
GOTO = 34,
|
||||||
GOTO = 35,
|
OTHERWISE = 35,
|
||||||
OTHERWISE = 36,
|
TRY = 36,
|
||||||
TRY = 37,
|
LABEL = 37,
|
||||||
LABEL = 38,
|
LABELS = 38,
|
||||||
LABELS = 39,
|
TAIL = 39,
|
||||||
TAIL = 40,
|
ISNT = 40,
|
||||||
ISNT = 41,
|
IS = 41,
|
||||||
IS = 42,
|
LET = 42,
|
||||||
LET = 43,
|
CONST = 43,
|
||||||
EXTERN = 44,
|
EXTERN = 44,
|
||||||
ASSERT_TOKEN = 45,
|
ASSERT_TOKEN = 45,
|
||||||
CHECK_TOKEN = 46,
|
CHECK_TOKEN = 46,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -33,29 +33,29 @@ class TorqueParser : public antlr4::Parser {
|
|||||||
T__17 = 18,
|
T__17 = 18,
|
||||||
T__18 = 19,
|
T__18 = 19,
|
||||||
T__19 = 20,
|
T__19 = 20,
|
||||||
T__20 = 21,
|
MACRO = 21,
|
||||||
MACRO = 22,
|
BUILTIN = 22,
|
||||||
BUILTIN = 23,
|
RUNTIME = 23,
|
||||||
RUNTIME = 24,
|
MODULE = 24,
|
||||||
MODULE = 25,
|
JAVASCRIPT = 25,
|
||||||
JAVASCRIPT = 26,
|
DEFERRED = 26,
|
||||||
DEFERRED = 27,
|
IF = 27,
|
||||||
IF = 28,
|
FOR = 28,
|
||||||
FOR = 29,
|
WHILE = 29,
|
||||||
WHILE = 30,
|
RETURN = 30,
|
||||||
RETURN = 31,
|
CONSTEXPR = 31,
|
||||||
CONSTEXPR = 32,
|
CONTINUE = 32,
|
||||||
CONTINUE = 33,
|
BREAK = 33,
|
||||||
BREAK = 34,
|
GOTO = 34,
|
||||||
GOTO = 35,
|
OTHERWISE = 35,
|
||||||
OTHERWISE = 36,
|
TRY = 36,
|
||||||
TRY = 37,
|
LABEL = 37,
|
||||||
LABEL = 38,
|
LABELS = 38,
|
||||||
LABELS = 39,
|
TAIL = 39,
|
||||||
TAIL = 40,
|
ISNT = 40,
|
||||||
ISNT = 41,
|
IS = 41,
|
||||||
IS = 42,
|
LET = 42,
|
||||||
LET = 43,
|
CONST = 43,
|
||||||
EXTERN = 44,
|
EXTERN = 44,
|
||||||
ASSERT_TOKEN = 45,
|
ASSERT_TOKEN = 45,
|
||||||
CHECK_TOKEN = 46,
|
CHECK_TOKEN = 46,
|
||||||
@ -893,9 +893,10 @@ class TorqueParser : public antlr4::Parser {
|
|||||||
VariableDeclarationContext(antlr4::ParserRuleContext* parent,
|
VariableDeclarationContext(antlr4::ParserRuleContext* parent,
|
||||||
size_t invokingState);
|
size_t invokingState);
|
||||||
size_t getRuleIndex() const override;
|
size_t getRuleIndex() const override;
|
||||||
antlr4::tree::TerminalNode* LET();
|
|
||||||
antlr4::tree::TerminalNode* IDENTIFIER();
|
antlr4::tree::TerminalNode* IDENTIFIER();
|
||||||
TypeContext* type();
|
TypeContext* type();
|
||||||
|
antlr4::tree::TerminalNode* LET();
|
||||||
|
antlr4::tree::TerminalNode* CONST();
|
||||||
|
|
||||||
void enterRule(antlr4::tree::ParseTreeListener* listener) override;
|
void enterRule(antlr4::tree::ParseTreeListener* listener) override;
|
||||||
void exitRule(antlr4::tree::ParseTreeListener* listener) override;
|
void exitRule(antlr4::tree::ParseTreeListener* listener) override;
|
||||||
@ -1404,6 +1405,7 @@ class TorqueParser : public antlr4::Parser {
|
|||||||
ExternConstDeclarationContext(antlr4::ParserRuleContext* parent,
|
ExternConstDeclarationContext(antlr4::ParserRuleContext* parent,
|
||||||
size_t invokingState);
|
size_t invokingState);
|
||||||
size_t getRuleIndex() const override;
|
size_t getRuleIndex() const override;
|
||||||
|
antlr4::tree::TerminalNode* CONST();
|
||||||
antlr4::tree::TerminalNode* IDENTIFIER();
|
antlr4::tree::TerminalNode* IDENTIFIER();
|
||||||
TypeContext* type();
|
TypeContext* type();
|
||||||
GeneratesDeclarationContext* generatesDeclaration();
|
GeneratesDeclarationContext* generatesDeclaration();
|
||||||
@ -1421,6 +1423,7 @@ class TorqueParser : public antlr4::Parser {
|
|||||||
ConstDeclarationContext(antlr4::ParserRuleContext* parent,
|
ConstDeclarationContext(antlr4::ParserRuleContext* parent,
|
||||||
size_t invokingState);
|
size_t invokingState);
|
||||||
size_t getRuleIndex() const override;
|
size_t getRuleIndex() const override;
|
||||||
|
antlr4::tree::TerminalNode* CONST();
|
||||||
antlr4::tree::TerminalNode* IDENTIFIER();
|
antlr4::tree::TerminalNode* IDENTIFIER();
|
||||||
TypeContext* type();
|
TypeContext* type();
|
||||||
antlr4::tree::TerminalNode* ASSIGNMENT();
|
antlr4::tree::TerminalNode* ASSIGNMENT();
|
||||||
|
@ -345,8 +345,10 @@ antlrcpp::Any AstGenerator::visitTypeAliasDeclaration(
|
|||||||
|
|
||||||
antlrcpp::Any AstGenerator::visitVariableDeclaration(
|
antlrcpp::Any AstGenerator::visitVariableDeclaration(
|
||||||
TorqueParser::VariableDeclarationContext* context) {
|
TorqueParser::VariableDeclarationContext* context) {
|
||||||
|
bool is_const_qualified = context->CONST() != nullptr;
|
||||||
return RegisterNode(
|
return RegisterNode(
|
||||||
new VarDeclarationStatement{Pos(context),
|
new VarDeclarationStatement{Pos(context),
|
||||||
|
is_const_qualified,
|
||||||
context->IDENTIFIER()->getSymbol()->getText(),
|
context->IDENTIFIER()->getSymbol()->getText(),
|
||||||
GetType(context->type()),
|
GetType(context->type()),
|
||||||
{}});
|
{}});
|
||||||
|
@ -436,9 +436,14 @@ struct TailCallStatement : Statement {
|
|||||||
|
|
||||||
struct VarDeclarationStatement : Statement {
|
struct VarDeclarationStatement : Statement {
|
||||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(VarDeclarationStatement)
|
DEFINE_AST_NODE_LEAF_BOILERPLATE(VarDeclarationStatement)
|
||||||
VarDeclarationStatement(SourcePosition p, std::string n, TypeExpression* t,
|
VarDeclarationStatement(SourcePosition p, bool c, std::string n,
|
||||||
base::Optional<Expression*> i)
|
TypeExpression* t, base::Optional<Expression*> i)
|
||||||
: Statement(kKind, p), name(std::move(n)), type(t), initializer(i) {}
|
: Statement(kKind, p),
|
||||||
|
const_qualified(c),
|
||||||
|
name(std::move(n)),
|
||||||
|
type(t),
|
||||||
|
initializer(i) {}
|
||||||
|
bool const_qualified;
|
||||||
std::string name;
|
std::string name;
|
||||||
TypeExpression* type;
|
TypeExpression* type;
|
||||||
base::Optional<Expression*> initializer;
|
base::Optional<Expression*> initializer;
|
||||||
|
@ -132,19 +132,19 @@ class ModuleConstant : public Value {
|
|||||||
class Variable : public Value {
|
class Variable : public Value {
|
||||||
public:
|
public:
|
||||||
DECLARE_DECLARABLE_BOILERPLATE(Variable, variable);
|
DECLARE_DECLARABLE_BOILERPLATE(Variable, variable);
|
||||||
bool IsConst() const override { return false; }
|
bool IsConst() const override { return const_; }
|
||||||
std::string value() const override { return value_; }
|
std::string value() const override { return value_; }
|
||||||
std::string RValue() const override {
|
std::string RValue() const override {
|
||||||
if (!IsDefined()) {
|
if (!IsDefined()) {
|
||||||
ReportError("Reading uninitialized variable.");
|
ReportError("Reading uninitialized variable.");
|
||||||
}
|
}
|
||||||
std::string result = "(*" + value() + ")";
|
std::string result = "(*" + value() + ")";
|
||||||
if (!type()->IsConstexpr()) result += ".value()";
|
if (!IsConst()) result += ".value()";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
void Define() {
|
void Define() {
|
||||||
if (defined_ && type()->IsConstexpr()) {
|
if (defined_ && IsConst()) {
|
||||||
ReportError("Cannot re-define a constexpr variable.");
|
ReportError("Cannot re-define a const-bound variable.");
|
||||||
}
|
}
|
||||||
defined_ = true;
|
defined_ = true;
|
||||||
}
|
}
|
||||||
@ -152,13 +152,18 @@ class Variable : public Value {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Declarations;
|
friend class Declarations;
|
||||||
Variable(const std::string& name, const std::string& value, const Type* type)
|
Variable(const std::string& name, const std::string& value, const Type* type,
|
||||||
|
bool is_const)
|
||||||
: Value(Declarable::kVariable, type, name),
|
: Value(Declarable::kVariable, type, name),
|
||||||
value_(value),
|
value_(value),
|
||||||
defined_(false) {}
|
defined_(false),
|
||||||
|
const_(is_const) {
|
||||||
|
DCHECK_IMPLIES(type->IsConstexpr(), IsConst());
|
||||||
|
}
|
||||||
|
|
||||||
std::string value_;
|
std::string value_;
|
||||||
bool defined_;
|
bool defined_;
|
||||||
|
bool const_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Label : public Declarable {
|
class Label : public Declarable {
|
||||||
|
@ -158,8 +158,9 @@ void DeclarationVisitor::Visit(TorqueMacroDeclaration* decl,
|
|||||||
DeclareSignature(signature);
|
DeclareSignature(signature);
|
||||||
Variable* return_variable = nullptr;
|
Variable* return_variable = nullptr;
|
||||||
if (!signature.return_type->IsVoidOrNever()) {
|
if (!signature.return_type->IsVoidOrNever()) {
|
||||||
return_variable = declarations()->DeclareVariable(kReturnValueVariable,
|
return_variable = declarations()->DeclareVariable(
|
||||||
signature.return_type);
|
kReturnValueVariable, signature.return_type,
|
||||||
|
signature.return_type->IsConstexpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
PushControlSplit();
|
PushControlSplit();
|
||||||
@ -254,14 +255,23 @@ void DeclarationVisitor::Visit(ReturnStatement* stmt) {
|
|||||||
void DeclarationVisitor::Visit(VarDeclarationStatement* stmt) {
|
void DeclarationVisitor::Visit(VarDeclarationStatement* stmt) {
|
||||||
std::string variable_name = stmt->name;
|
std::string variable_name = stmt->name;
|
||||||
const Type* type = declarations()->GetType(stmt->type);
|
const Type* type = declarations()->GetType(stmt->type);
|
||||||
if (type->IsConstexpr()) {
|
if (type->IsConstexpr() && !stmt->const_qualified) {
|
||||||
ReportError("cannot declare variable with constexpr type");
|
ReportError(
|
||||||
|
"cannot declare variable with constexpr type. Use 'const' instead.");
|
||||||
}
|
}
|
||||||
declarations()->DeclareVariable(variable_name, type);
|
declarations()->DeclareVariable(variable_name, type, stmt->const_qualified);
|
||||||
if (global_context_.verbose()) {
|
if (global_context_.verbose()) {
|
||||||
std::cout << "declared variable " << variable_name << " with type " << *type
|
std::cout << "declared variable " << variable_name << " with type " << *type
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const qualified variables are required to be initialized properly.
|
||||||
|
if (stmt->const_qualified && !stmt->initializer) {
|
||||||
|
std::stringstream stream;
|
||||||
|
stream << "local constant \"" << variable_name << "\" is not initialized.";
|
||||||
|
ReportError(stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
if (stmt->initializer) {
|
if (stmt->initializer) {
|
||||||
Visit(*stmt->initializer);
|
Visit(*stmt->initializer);
|
||||||
if (global_context_.verbose()) {
|
if (global_context_.verbose()) {
|
||||||
@ -399,8 +409,14 @@ void DeclarationVisitor::Visit(TryLabelStatement* stmt) {
|
|||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (auto p : block->parameters.names) {
|
for (auto p : block->parameters.names) {
|
||||||
shared_label->AddVariable(declarations()->DeclareVariable(
|
const Type* type =
|
||||||
p, declarations()->GetType(block->parameters.types[i])));
|
declarations()->GetType(block->parameters.types[i]);
|
||||||
|
if (type->IsConstexpr()) {
|
||||||
|
ReportError("no constexpr type allowed for label arguments");
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_label->AddVariable(
|
||||||
|
declarations()->DeclareVariable(p, type, false));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -549,9 +565,13 @@ void DeclarationVisitor::DeclareSignature(const Signature& signature) {
|
|||||||
Label* new_label = declarations()->DeclareLabel(label.name);
|
Label* new_label = declarations()->DeclareLabel(label.name);
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (auto var_type : label_params) {
|
for (auto var_type : label_params) {
|
||||||
|
if (var_type->IsConstexpr()) {
|
||||||
|
ReportError("no constexpr type allowed for label arguments");
|
||||||
|
}
|
||||||
|
|
||||||
std::string var_name = label.name + std::to_string(i++);
|
std::string var_name = label.name + std::to_string(i++);
|
||||||
new_label->AddVariable(
|
new_label->AddVariable(
|
||||||
declarations()->DeclareVariable(var_name, var_type));
|
declarations()->DeclareVariable(var_name, var_type, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,10 +288,10 @@ RuntimeFunction* Declarations::DeclareRuntimeFunction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Variable* Declarations::DeclareVariable(const std::string& var,
|
Variable* Declarations::DeclareVariable(const std::string& var,
|
||||||
const Type* type) {
|
const Type* type, bool is_const) {
|
||||||
std::string name(var + std::to_string(GetNextUniqueDeclarationNumber()));
|
std::string name(var + std::to_string(GetNextUniqueDeclarationNumber()));
|
||||||
CheckAlreadyDeclared(var, "variable");
|
CheckAlreadyDeclared(var, "variable");
|
||||||
Variable* result = new Variable(var, name, type);
|
Variable* result = new Variable(var, name, type, is_const);
|
||||||
Declare(var, std::unique_ptr<Declarable>(result));
|
Declare(var, std::unique_ptr<Declarable>(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,8 @@ class Declarations {
|
|||||||
RuntimeFunction* DeclareRuntimeFunction(const std::string& name,
|
RuntimeFunction* DeclareRuntimeFunction(const std::string& name,
|
||||||
const Signature& signature);
|
const Signature& signature);
|
||||||
|
|
||||||
Variable* DeclareVariable(const std::string& var, const Type* type);
|
Variable* DeclareVariable(const std::string& var, const Type* type,
|
||||||
|
bool is_const);
|
||||||
|
|
||||||
Parameter* DeclareParameter(const std::string& name,
|
Parameter* DeclareParameter(const std::string& name,
|
||||||
const std::string& mangled_name,
|
const std::string& mangled_name,
|
||||||
|
@ -814,10 +814,6 @@ const Type* ImplementationVisitor::Visit(ReturnStatement* stmt) {
|
|||||||
source_out() << "Return(" << return_result.RValue() << ");"
|
source_out() << "Return(" << return_result.RValue() << ");"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
} else if (current_callable->IsModuleConstant()) {
|
|
||||||
Variable* var =
|
|
||||||
Variable::cast(declarations()->LookupValue(kReturnValueVariable));
|
|
||||||
GenerateAssignToVariable(var, return_result);
|
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -1231,7 +1227,7 @@ void ImplementationVisitor::GenerateChangedVarsFromControlSplit(AstNode* node) {
|
|||||||
source_out() << "{";
|
source_out() << "{";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto v : changed_vars) {
|
for (auto v : changed_vars) {
|
||||||
if (v->type()->IsConstexpr()) continue;
|
if (v->IsConst()) continue;
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
@ -1339,7 +1335,7 @@ Variable* ImplementationVisitor::GenerateVariableDeclaration(
|
|||||||
if (declarations()->TryLookup(name)) {
|
if (declarations()->TryLookup(name)) {
|
||||||
variable = Variable::cast(declarations()->LookupValue(name));
|
variable = Variable::cast(declarations()->LookupValue(name));
|
||||||
} else {
|
} else {
|
||||||
variable = declarations()->DeclareVariable(name, *type);
|
variable = declarations()->DeclareVariable(name, *type, false);
|
||||||
// Because the variable is being defined during code generation, it must be
|
// Because the variable is being defined during code generation, it must be
|
||||||
// assumed that it changes along all control split paths because it's no
|
// assumed that it changes along all control split paths because it's no
|
||||||
// longer possible to run the control-flow anlaysis in the declaration pass
|
// longer possible to run the control-flow anlaysis in the declaration pass
|
||||||
@ -1352,17 +1348,20 @@ Variable* ImplementationVisitor::GenerateVariableDeclaration(
|
|||||||
GenerateIndent();
|
GenerateIndent();
|
||||||
if (variable->type()->IsConstexpr()) {
|
if (variable->type()->IsConstexpr()) {
|
||||||
source_out() << variable->type()->GetGeneratedTypeName();
|
source_out() << variable->type()->GetGeneratedTypeName();
|
||||||
source_out() << " " << variable->value() << "_impl;" << std::endl;
|
source_out() << " " << variable->value() << "_impl;\n";
|
||||||
|
} else if (variable->IsConst()) {
|
||||||
|
source_out() << "TNode<" << variable->type()->GetGeneratedTNodeTypeName();
|
||||||
|
source_out() << "> " << variable->value() << "_impl;\n";
|
||||||
} else {
|
} else {
|
||||||
source_out() << "TVARIABLE(";
|
source_out() << "TVARIABLE(";
|
||||||
source_out() << variable->type()->GetGeneratedTNodeTypeName();
|
source_out() << variable->type()->GetGeneratedTNodeTypeName();
|
||||||
source_out() << ", " << variable->value() << "_impl);" << std::endl;
|
source_out() << ", " << variable->value() << "_impl);\n";
|
||||||
}
|
}
|
||||||
GenerateIndent();
|
GenerateIndent();
|
||||||
source_out() << "auto " << variable->value() << " = &" << variable->value()
|
source_out() << "auto " << variable->value() << " = &" << variable->value()
|
||||||
<< "_impl;" << std::endl;
|
<< "_impl;\n";
|
||||||
GenerateIndent();
|
GenerateIndent();
|
||||||
source_out() << "USE(" << variable->value() << ");" << std::endl;
|
source_out() << "USE(" << variable->value() << ");\n";
|
||||||
if (initialization) {
|
if (initialization) {
|
||||||
GenerateAssignToVariable(variable, *initialization);
|
GenerateAssignToVariable(variable, *initialization);
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,18 @@ TEST(TestModuleConstBindings) {
|
|||||||
ft.Call();
|
ft.Call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(TestLocalConstBindings) {
|
||||||
|
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||||
|
CodeAssemblerTester asm_tester(isolate, 0);
|
||||||
|
TestBuiltinsFromDSLAssembler m(asm_tester.state());
|
||||||
|
{
|
||||||
|
m.TestLocalConstBindings();
|
||||||
|
m.Return(m.UndefinedConstant());
|
||||||
|
}
|
||||||
|
FunctionTester ft(asm_tester.GenerateCode(), 0);
|
||||||
|
ft.Call();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
@ -238,4 +238,9 @@ module test {
|
|||||||
check(kIntptrConst == 4);
|
check(kIntptrConst == 4);
|
||||||
check(kSmiConst == 3);
|
check(kSmiConst == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro TestLocalConstBindings() {
|
||||||
|
const kSmi: Smi = 3;
|
||||||
|
check(kSmi == 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user