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
Tobias Hunger
qt-creator
Commits
1178d623
Commit
1178d623
authored
Mar 01, 2011
by
Thomas Hartmann
Browse files
QmlJs::Check: using the Option enum to ignore type errors
Unifying the api and exposing the options.
parent
d6e08c35
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljscheck.cpp
View file @
1178d623
...
...
@@ -371,11 +371,10 @@ Check::Check(Document::Ptr doc, const Snapshot &snapshot, const Context *linkedC
,
_snapshot
(
snapshot
)
,
_context
(
*
linkedContextNoScope
)
,
_scopeBuilder
(
&
_context
,
doc
,
snapshot
)
,
_ignoreTypeErrors
(
false
)
,
_options
(
WarnDangerousNonStrictEqualityChecks
|
WarnBlocks
|
WarnWith
|
WarnVoid
|
WarnCommaExpression
|
WarnExpressionStatement
|
WarnAssignInCondition
|
WarnUseBeforeDeclaration
|
WarnDuplicateDeclaration
|
WarnCaseWithoutFlowControlEnd
)
|
WarnCaseWithoutFlowControlEnd
|
ErrCheckTypeErrors
)
,
_lastValue
(
0
)
{
}
...
...
@@ -474,7 +473,7 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
_scopeBuilder
.
push
(
ast
);
if
(
!
_context
.
lookupType
(
_doc
.
data
(),
typeId
))
{
if
(
!
_ignore
TypeErrors
)
if
(
_options
&
ErrCheck
TypeErrors
)
error
(
typeId
->
identifierToken
,
Check
::
tr
(
"unknown type"
));
// suppress subsequent errors about scope object lookup by clearing
...
...
src/libs/qmljs/qmljscheck.h
View file @
1178d623
...
...
@@ -58,10 +58,6 @@ public:
QList
<
DiagnosticMessage
>
operator
()();
void
setIgnoreTypeErrors
(
bool
ignore
)
{
_ignoreTypeErrors
=
ignore
;
}
enum
Option
{
WarnDangerousNonStrictEqualityChecks
=
1
<<
0
,
WarnAllNonStrictEqualityChecks
=
1
<<
1
,
...
...
@@ -74,10 +70,17 @@ public:
WarnUseBeforeDeclaration
=
1
<<
8
,
WarnDuplicateDeclaration
=
1
<<
9
,
WarnDeclarationsNotStartOfFunction
=
1
<<
10
,
WarnCaseWithoutFlowControlEnd
=
1
<<
11
WarnCaseWithoutFlowControlEnd
=
1
<<
11
,
ErrCheckTypeErrors
=
1
<<
12
};
Q_DECLARE_FLAGS
(
Options
,
Option
)
const
Options
options
()
const
{
return
_options
;
}
void
setOptions
(
Options
options
)
{
_options
=
options
;
}
protected:
virtual
bool
preVisit
(
AST
::
Node
*
ast
);
virtual
void
postVisit
(
AST
::
Node
*
ast
);
...
...
@@ -130,7 +133,6 @@ private:
QList
<
DiagnosticMessage
>
_messages
;
bool
_ignoreTypeErrors
;
Options
_options
;
const
Interpreter
::
Value
*
_lastValue
;
...
...
src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
View file @
1178d623
...
...
@@ -608,8 +608,13 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
m_document
=
doc
;
QList
<
RewriterView
::
Error
>
errors
;
foreach
(
const
QmlJS
::
DiagnosticMessage
&
diagnosticMessage
,
ctxt
.
diagnosticLinkMessages
())
{
errors
.
append
(
RewriterView
::
Error
(
diagnosticMessage
,
QUrl
::
fromLocalFile
(
doc
->
fileName
())));
}
Check
check
(
doc
,
snapshot
,
m_lookupContext
->
context
());
check
.
set
Ignore
TypeErrors
(
true
);
check
.
set
Options
(
check
.
options
()
&
~
Check
::
ErrCheck
TypeErrors
);
foreach
(
const
QmlJS
::
DiagnosticMessage
&
diagnosticMessage
,
check
())
if
(
diagnosticMessage
.
isError
())
errors
.
append
(
RewriterView
::
Error
(
diagnosticMessage
,
QUrl
::
fromLocalFile
(
doc
->
fileName
())));
...
...
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