summaryrefslogtreecommitdiff
path: root/deps/v8/src/torque/declarations.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-09-21 09:14:51 +0200
committerMichaël Zasso <targos@protonmail.com>2018-09-22 18:29:25 +0200
commit0e7ddbd3d7e9439c67573b854c49cf82c398ae82 (patch)
tree2afe372acde921cb57ddb3444ff00c5adef8848c /deps/v8/src/torque/declarations.cc
parent13245dc50da4cb7443c39ef6c68d419d5e6336d4 (diff)
downloadandroid-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.tar.gz
android-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.tar.bz2
android-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.zip
deps: update V8 to 7.0.276.20
PR-URL: https://github.com/nodejs/node/pull/22754 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/src/torque/declarations.cc')
-rw-r--r--deps/v8/src/torque/declarations.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/deps/v8/src/torque/declarations.cc b/deps/v8/src/torque/declarations.cc
index 95764e3029..9b2964d210 100644
--- a/deps/v8/src/torque/declarations.cc
+++ b/deps/v8/src/torque/declarations.cc
@@ -43,10 +43,13 @@ Scope* Declarations::GetGenericScope(Generic* generic,
return result;
}
+bool Declarations::IsDeclaredInCurrentScope(const std::string& name) {
+ return chain_.ShallowLookup(name) != nullptr;
+}
+
void Declarations::CheckAlreadyDeclared(const std::string& name,
const char* new_type) {
- auto i = chain_.ShallowLookup(name);
- if (i != nullptr) {
+ if (IsDeclaredInCurrentScope(name)) {
std::stringstream s;
s << "cannot redeclare " << name << " (type " << new_type << ")";
ReportError(s.str());
@@ -85,7 +88,7 @@ const Type* Declarations::GetType(TypeExpression* type_expression) {
} else {
auto* function_type_exp = FunctionTypeExpression::cast(type_expression);
TypeVector argument_types;
- for (TypeExpression* type_exp : function_type_exp->parameters.types) {
+ for (TypeExpression* type_exp : function_type_exp->parameters) {
argument_types.push_back(GetType(type_exp));
}
return TypeOracle::GetFunctionPointerType(
@@ -269,8 +272,8 @@ MacroList* Declarations::GetMacroListForName(const std::string& name,
Macro* Declarations::DeclareMacro(const std::string& name,
const Signature& signature,
base::Optional<std::string> op) {
- Macro* macro =
- RegisterDeclarable(std::unique_ptr<Macro>(new Macro(name, signature)));
+ Macro* macro = RegisterDeclarable(
+ std::unique_ptr<Macro>(new Macro(name, signature, GetCurrentGeneric())));
GetMacroListForName(name, signature)->AddMacro(macro);
if (op) GetMacroListForName(*op, signature)->AddMacro(macro);
return macro;
@@ -280,7 +283,8 @@ Builtin* Declarations::DeclareBuiltin(const std::string& name,
Builtin::Kind kind, bool external,
const Signature& signature) {
CheckAlreadyDeclared(name, "builtin");
- Builtin* result = new Builtin(name, kind, external, signature);
+ Builtin* result =
+ new Builtin(name, kind, external, signature, GetCurrentGeneric());
Declare(name, std::unique_ptr<Declarable>(result));
return result;
}
@@ -288,7 +292,8 @@ Builtin* Declarations::DeclareBuiltin(const std::string& name,
RuntimeFunction* Declarations::DeclareRuntimeFunction(
const std::string& name, const Signature& signature) {
CheckAlreadyDeclared(name, "runtime function");
- RuntimeFunction* result = new RuntimeFunction(name, signature);
+ RuntimeFunction* result =
+ new RuntimeFunction(name, signature, GetCurrentGeneric());
Declare(name, std::unique_ptr<Declarable>(result));
return result;
}
@@ -367,6 +372,13 @@ TypeVector Declarations::GetCurrentSpecializationTypeNamesVector() {
return result;
}
+base::Optional<Generic*> Declarations::GetCurrentGeneric() {
+ if (current_generic_specialization_ != nullptr) {
+ return current_generic_specialization_->first;
+ }
+ return base::nullopt;
+}
+
std::string GetGeneratedCallableName(const std::string& name,
const TypeVector& specialized_types) {
std::string result = name;