Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/declarationbuilder.cpp
Show First 20 Lines • Show All 1211 Lines • ▼ Show 20 Line(s) | 1185 | if (scalar && scalar->string != -1) { | |||
---|---|---|---|---|---|
1212 | closeInjectedContext(); | 1212 | closeInjectedContext(); | ||
1213 | } | 1213 | } | ||
1214 | } | 1214 | } | ||
1215 | } | 1215 | } | ||
1216 | } | 1216 | } | ||
1217 | 1217 | | |||
1218 | void DeclarationBuilder::visitFunctionCallParameterList(FunctionCallParameterListAst* node) | 1218 | void DeclarationBuilder::visitFunctionCallParameterList(FunctionCallParameterListAst* node) | ||
1219 | { | 1219 | { | ||
1220 | int oldPos = m_functionCallParameterPos; | 1220 | PushValue<FunctionCallParameterListElementAst*> push(m_functionCallPreviousArgument, 0); | ||
1221 | m_functionCallParameterPos = 0; | 1221 | PushValue<int> pos(m_functionCallParameterPos, 0); | ||
1222 | 1222 | | |||
1223 | DeclarationBuilderBase::visitFunctionCallParameterList(node); | 1223 | DeclarationBuilderBase::visitFunctionCallParameterList(node); | ||
1224 | | ||||
1225 | m_functionCallParameterPos = oldPos; | | |||
1226 | } | 1224 | } | ||
1227 | 1225 | | |||
1228 | void DeclarationBuilder::visitFunctionCallParameterListElement(FunctionCallParameterListElementAst* node) | 1226 | void DeclarationBuilder::visitFunctionCallParameterListElement(FunctionCallParameterListElementAst* node) | ||
1229 | { | 1227 | { | ||
1230 | PushValue<FindVariableResults> restore(m_findVariable); | 1228 | PushValue<FindVariableResults> restore(m_findVariable); | ||
1231 | 1229 | | |||
1232 | DeclarationBuilderBase::visitFunctionCallParameterListElement(node); | 1230 | DeclarationBuilderBase::visitFunctionCallParameterListElement(node); | ||
1233 | 1231 | | |||
1234 | if ( m_findVariable.node && m_currentFunctionType && | 1232 | if ( m_findVariable.node && m_currentFunctionType && | ||
1235 | m_currentFunctionType->arguments().count() > m_functionCallParameterPos) { | 1233 | m_currentFunctionType->arguments().count() > m_functionCallParameterPos) { | ||
1236 | ReferenceType::Ptr refType = m_currentFunctionType->arguments() | 1234 | ReferenceType::Ptr refType = m_currentFunctionType->arguments() | ||
1237 | .at(m_functionCallParameterPos).cast<ReferenceType>(); | 1235 | .at(m_functionCallParameterPos).cast<ReferenceType>(); | ||
1238 | if ( refType ) { | 1236 | if ( refType ) { | ||
1239 | // this argument is referenced, so if the node contains undeclared variables we have | 1237 | // this argument is referenced, so if the node contains undeclared variables we have | ||
1240 | // to declare them with a NULL type, see also: | 1238 | // to declare them with a NULL type, see also: | ||
1241 | // http://de.php.net/manual/en/language.references.whatdo.php | 1239 | // http://de.php.net/manual/en/language.references.whatdo.php | ||
1242 | 1240 | | |||
1243 | // declare with NULL type, just like PHP does | 1241 | // declare with NULL type, just like PHP does | ||
1244 | declareFoundVariable(AbstractType::Ptr(new IntegralType(IntegralType::TypeNull))); | 1242 | declareFoundVariable(AbstractType::Ptr(new IntegralType(IntegralType::TypeNull))); | ||
1245 | } | 1243 | } | ||
1246 | } | 1244 | } | ||
1247 | 1245 | | |||
1246 | if (m_functionCallPreviousArgument && m_functionCallPreviousArgument->isVariadic != -1 && node->isVariadic == -1) { | ||||
1247 | reportError(i18n("Cannot use positional argument after argument unpacking"), node); | ||||
1248 | } | ||||
1249 | | ||||
1250 | m_functionCallPreviousArgument = node; | ||||
1251 | | ||||
1248 | ++m_functionCallParameterPos; | 1252 | ++m_functionCallParameterPos; | ||
1249 | } | 1253 | } | ||
1250 | 1254 | | |||
1251 | void DeclarationBuilder::visitAssignmentListElement(AssignmentListElementAst* node) | 1255 | void DeclarationBuilder::visitAssignmentListElement(AssignmentListElementAst* node) | ||
1252 | { | 1256 | { | ||
1253 | PushValue<FindVariableResults> restore(m_findVariable); | 1257 | PushValue<FindVariableResults> restore(m_findVariable); | ||
1254 | 1258 | | |||
1255 | DeclarationBuilderBase::DefaultVisitor::visitAssignmentListElement(node); | 1259 | DeclarationBuilderBase::DefaultVisitor::visitAssignmentListElement(node); | ||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |