Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
db2f91ef
Commit
db2f91ef
authored
Apr 07, 2010
by
Christian Kamm
Browse files
QmlJS: Don't produce Qml type errors if plugins are imported.
Task-number: QTCREATORBUG-1021 Reviewed-by: Erik Verbruggen
parent
eae88f02
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljscheck.cpp
View file @
db2f91ef
...
...
@@ -176,6 +176,7 @@ Check::Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &imp
,
_context
(
&
_engine
)
,
_link
(
&
_context
,
doc
,
snapshot
,
importPaths
)
,
_scopeBuilder
(
doc
,
&
_context
)
,
_ignoreTypeErrors
(
_context
.
documentImportsPlugins
(
_doc
.
data
()))
{
}
...
...
@@ -227,7 +228,8 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
_scopeBuilder
.
push
(
ast
);
if
(
!
_context
.
lookupType
(
_doc
.
data
(),
typeId
))
{
warning
(
typeId
->
identifierToken
,
tr
(
Messages
::
unknown_type
));
if
(
!
_ignoreTypeErrors
)
error
(
typeId
->
identifierToken
,
tr
(
Messages
::
unknown_type
));
// suppress subsequent errors about scope object lookup by clearing
// the scope object list
// ### todo: better way?
...
...
src/libs/qmljs/qmljscheck.h
View file @
db2f91ef
...
...
@@ -72,6 +72,8 @@ private:
ScopeBuilder
_scopeBuilder
;
QList
<
DiagnosticMessage
>
_messages
;
bool
_ignoreTypeErrors
;
};
}
// namespace QmlJS
...
...
src/libs/qmljs/qmljsinterpreter.cpp
View file @
db2f91ef
...
...
@@ -1448,6 +1448,16 @@ void Context::setProperty(const ObjectValue *object, const QString &name, const
_properties
[
object
].
insert
(
name
,
value
);
}
bool
Context
::
documentImportsPlugins
(
const
Document
*
doc
)
const
{
return
_documentsImportingPlugins
.
contains
(
doc
->
fileName
());
}
void
Context
::
setDocumentImportsPlugins
(
const
Document
*
doc
)
{
_documentsImportingPlugins
.
insert
(
doc
->
fileName
());
}
Reference
::
Reference
(
Engine
*
engine
)
:
_engine
(
engine
)
{
...
...
src/libs/qmljs/qmljsinterpreter.h
View file @
db2f91ef
...
...
@@ -308,6 +308,9 @@ public:
const
Value
*
property
(
const
ObjectValue
*
object
,
const
QString
&
name
)
const
;
void
setProperty
(
const
ObjectValue
*
object
,
const
QString
&
name
,
const
Value
*
value
);
bool
documentImportsPlugins
(
const
Document
*
doc
)
const
;
void
setDocumentImportsPlugins
(
const
Document
*
doc
);
private:
typedef
QHash
<
QString
,
const
Value
*>
Properties
;
...
...
@@ -315,6 +318,7 @@ private:
LookupMode
_lookupMode
;
QHash
<
const
ObjectValue
*
,
Properties
>
_properties
;
QHash
<
QString
,
const
ObjectValue
*>
_typeEnvironments
;
QSet
<
QString
>
_documentsImportingPlugins
;
ScopeChain
_scopeChain
;
int
_qmlScopeObjectIndex
;
bool
_qmlScopeObjectSet
;
...
...
src/libs/qmljs/qmljslink.cpp
View file @
db2f91ef
...
...
@@ -302,6 +302,9 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
if
(
!
libraryInfo
.
isValid
())
continue
;
if
(
!
libraryInfo
.
plugins
().
isEmpty
())
_context
->
setDocumentImportsPlugins
(
doc
.
data
());
QSet
<
QString
>
importedTypes
;
foreach
(
const
QmlDirParser
::
Component
&
component
,
libraryInfo
.
components
())
{
if
(
importedTypes
.
contains
(
component
.
typeName
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment