-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement var statement pre-scanning. (#3103)
The patch also checks whether pre-scanning is successful when scanning is, so no need for explicit pre-scanner checks anymore. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
- Loading branch information
Showing
18 changed files
with
193 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* Copyright JS Foundation and other contributors, http:https://js.foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef JS_SCANNER_INTERNAL_H | ||
#define JS_SCANNER_INTERNAL_H | ||
|
||
/** \addtogroup parser Parser | ||
* @{ | ||
* | ||
* \addtogroup jsparser JavaScript | ||
* @{ | ||
* | ||
* \addtogroup jsparser_scanner Scanner | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* Generic descriptor which stores only the start position. | ||
*/ | ||
typedef struct | ||
{ | ||
const uint8_t *source_p; /**< start source byte */ | ||
} scanner_source_start_t; | ||
|
||
/** | ||
* For statement descriptor. | ||
*/ | ||
typedef struct | ||
{ | ||
/** shared fields of for statements */ | ||
union | ||
{ | ||
const uint8_t *source_p; /**< start source byte */ | ||
scanner_for_info_t *for_info_p; /**< for info */ | ||
} u; | ||
} scanner_for_statement_t; | ||
|
||
/** | ||
* Switch statement descriptor. | ||
*/ | ||
typedef struct | ||
{ | ||
scanner_case_info_t **last_case_p; /**< last case info */ | ||
} scanner_switch_statement_t; | ||
|
||
/** | ||
* Scanner context. | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t mode; /**< scanner mode */ | ||
scanner_switch_statement_t active_switch_statement; /**< currently active switch statement */ | ||
} scanner_context_t; | ||
|
||
/** | ||
* @} | ||
* @} | ||
* @} | ||
*/ | ||
|
||
#endif /* !JS_SCANNER_INTERNAL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
*/ | ||
|
||
#include "js-parser-internal.h" | ||
#include "js-scanner-internal.h" | ||
|
||
#if ENABLED (JERRY_PARSER) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,3 @@ | |
|
||
export var x = 41 | ||
export default a = "str" | ||
|
||
// Pre-scanner regression test | ||
for (var tmp in {}) ; |
Oops, something went wrong.